@phosart/devtool 0.2.63 → 0.2.64

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/B1Et4Mud.js +1 -0
  2. package/build/client/editor/_app/immutable/chunks/B1Et4Mud.js.br +0 -0
  3. package/build/client/editor/_app/immutable/chunks/B1Et4Mud.js.gz +0 -0
  4. package/build/client/editor/_app/immutable/chunks/BZYFUfL0.js +2 -0
  5. package/build/client/editor/_app/immutable/chunks/BZYFUfL0.js.br +0 -0
  6. package/build/client/editor/_app/immutable/chunks/BZYFUfL0.js.gz +0 -0
  7. package/build/client/editor/_app/immutable/chunks/BxTAxrQU.js +1 -0
  8. package/build/client/editor/_app/immutable/chunks/BxTAxrQU.js.br +0 -0
  9. package/build/client/editor/_app/immutable/chunks/BxTAxrQU.js.gz +0 -0
  10. package/build/client/editor/_app/immutable/chunks/C26Wy4GU.js +1 -0
  11. package/build/client/editor/_app/immutable/chunks/C26Wy4GU.js.br +2 -0
  12. package/build/client/editor/_app/immutable/chunks/C26Wy4GU.js.gz +0 -0
  13. package/build/client/editor/_app/immutable/chunks/C4GS5Jl1.js +1 -0
  14. package/build/client/editor/_app/immutable/chunks/C4GS5Jl1.js.br +0 -0
  15. package/build/client/editor/_app/immutable/chunks/C4GS5Jl1.js.gz +0 -0
  16. package/build/client/editor/_app/immutable/chunks/CD0INihO.js +1 -0
  17. package/build/client/editor/_app/immutable/chunks/CD0INihO.js.br +0 -0
  18. package/build/client/editor/_app/immutable/chunks/CD0INihO.js.gz +0 -0
  19. package/build/client/editor/_app/immutable/chunks/{BwDguXJU.js → CLoMVj1r.js} +1 -1
  20. package/build/client/editor/_app/immutable/chunks/CLoMVj1r.js.br +0 -0
  21. package/build/client/editor/_app/immutable/chunks/CLoMVj1r.js.gz +0 -0
  22. package/build/client/editor/_app/immutable/chunks/CtvC2rTB.js +1 -0
  23. package/build/client/editor/_app/immutable/chunks/CtvC2rTB.js.br +0 -0
  24. package/build/client/editor/_app/immutable/chunks/CtvC2rTB.js.gz +0 -0
  25. package/build/client/editor/_app/immutable/chunks/D6c7u6-3.js +1 -0
  26. package/build/client/editor/_app/immutable/chunks/D6c7u6-3.js.br +2 -0
  27. package/build/client/editor/_app/immutable/chunks/D6c7u6-3.js.gz +0 -0
  28. package/build/client/editor/_app/immutable/chunks/{B7zEkvv4.js → D89-z53e.js} +1 -1
  29. package/build/client/editor/_app/immutable/chunks/D89-z53e.js.br +0 -0
  30. package/build/client/editor/_app/immutable/chunks/D89-z53e.js.gz +0 -0
  31. package/build/client/editor/_app/immutable/chunks/DNv1AA-7.js +2 -0
  32. package/build/client/editor/_app/immutable/chunks/DNv1AA-7.js.br +0 -0
  33. package/build/client/editor/_app/immutable/chunks/DNv1AA-7.js.gz +0 -0
  34. package/build/client/editor/_app/immutable/chunks/{BX1XjmQ4.js → DPuQZwse.js} +1 -1
  35. package/build/client/editor/_app/immutable/chunks/DPuQZwse.js.br +0 -0
  36. package/build/client/editor/_app/immutable/chunks/DPuQZwse.js.gz +0 -0
  37. package/build/client/editor/_app/immutable/chunks/{D40E3qq_.js → DbX_9jw0.js} +1 -1
  38. package/build/client/editor/_app/immutable/chunks/DbX_9jw0.js.br +0 -0
  39. package/build/client/editor/_app/immutable/chunks/DbX_9jw0.js.gz +0 -0
  40. package/build/client/editor/_app/immutable/chunks/DxuUmkCn.js +1 -0
  41. package/build/client/editor/_app/immutable/chunks/DxuUmkCn.js.br +0 -0
  42. package/build/client/editor/_app/immutable/chunks/DxuUmkCn.js.gz +0 -0
  43. package/build/client/editor/_app/immutable/chunks/Dzm1ufsB.js +5 -0
  44. package/build/client/editor/_app/immutable/chunks/Dzm1ufsB.js.br +0 -0
  45. package/build/client/editor/_app/immutable/chunks/Dzm1ufsB.js.gz +0 -0
  46. package/build/client/editor/_app/immutable/chunks/kjw-rJuK.js +3 -0
  47. package/build/client/editor/_app/immutable/chunks/kjw-rJuK.js.br +0 -0
  48. package/build/client/editor/_app/immutable/chunks/kjw-rJuK.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.C9wXiFT-.js +2 -0
  56. package/build/client/editor/_app/immutable/entry/app.C9wXiFT-.js.br +0 -0
  57. package/build/client/editor/_app/immutable/entry/app.C9wXiFT-.js.gz +0 -0
  58. package/build/client/editor/_app/immutable/entry/start.BP6Dtuul.js +1 -0
  59. package/build/client/editor/_app/immutable/entry/start.BP6Dtuul.js.br +2 -0
  60. package/build/client/editor/_app/immutable/entry/start.BP6Dtuul.js.gz +0 -0
  61. package/build/client/editor/_app/immutable/nodes/0.6KEy7gPC.js +1 -0
  62. package/build/client/editor/_app/immutable/nodes/0.6KEy7gPC.js.br +0 -0
  63. package/build/client/editor/_app/immutable/nodes/0.6KEy7gPC.js.gz +0 -0
  64. package/build/client/editor/_app/immutable/nodes/1.K8MzEWhM.js +1 -0
  65. package/build/client/editor/_app/immutable/nodes/1.K8MzEWhM.js.br +0 -0
  66. package/build/client/editor/_app/immutable/nodes/1.K8MzEWhM.js.gz +0 -0
  67. package/build/client/editor/_app/immutable/nodes/2.DehrXOZl.js +1 -0
  68. package/build/client/editor/_app/immutable/nodes/2.DehrXOZl.js.br +0 -0
  69. package/build/client/editor/_app/immutable/nodes/2.DehrXOZl.js.gz +0 -0
  70. package/build/client/editor/_app/immutable/nodes/3.CGlRzjPm.js +1 -0
  71. package/build/client/editor/_app/immutable/nodes/3.CGlRzjPm.js.br +0 -0
  72. package/build/client/editor/_app/immutable/nodes/3.CGlRzjPm.js.gz +0 -0
  73. package/build/client/editor/_app/immutable/nodes/4.CZXZx0Qb.js +2 -0
  74. package/build/client/editor/_app/immutable/nodes/4.CZXZx0Qb.js.br +0 -0
  75. package/build/client/editor/_app/immutable/nodes/4.CZXZx0Qb.js.gz +0 -0
  76. package/build/client/editor/_app/immutable/nodes/5.XdQ6pUCI.js +1 -0
  77. package/build/client/editor/_app/immutable/nodes/5.XdQ6pUCI.js.br +0 -0
  78. package/build/client/editor/_app/immutable/nodes/5.XdQ6pUCI.js.gz +0 -0
  79. package/build/client/editor/_app/immutable/nodes/6.85XvX62P.js +1 -0
  80. package/build/client/editor/_app/immutable/nodes/6.85XvX62P.js.br +0 -0
  81. package/build/client/editor/_app/immutable/nodes/6.85XvX62P.js.gz +0 -0
  82. package/build/client/editor/_app/immutable/nodes/{7.CNs61aEF.js → 7.DlcLOOVb.js} +1 -1
  83. package/build/client/editor/_app/immutable/nodes/7.DlcLOOVb.js.br +0 -0
  84. package/build/client/editor/_app/immutable/nodes/7.DlcLOOVb.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-B4umNRQd.js} +7 -7
  91. package/build/server/chunks/{0-BnmcUAQx.js.map → 0-B4umNRQd.js.map} +1 -1
  92. package/build/server/chunks/1-B7zSpv41.js +9 -0
  93. package/build/server/chunks/{1-CYCf-lQK.js.map → 1-B7zSpv41.js.map} +1 -1
  94. package/build/server/chunks/{2-C3l0BQnh.js → 2-DX2Uz9PL.js} +7 -7
  95. package/build/server/chunks/{2-C3l0BQnh.js.map → 2-DX2Uz9PL.js.map} +1 -1
  96. package/build/server/chunks/{3-DOc6yKc_.js → 3-CzmpnTjP.js} +3 -3
  97. package/build/server/chunks/{3-DOc6yKc_.js.map → 3-CzmpnTjP.js.map} +1 -1
  98. package/build/server/chunks/{4-sfYNoQFz.js → 4-jkzC1KR3.js} +3 -3
  99. package/build/server/chunks/{4-sfYNoQFz.js.map → 4-jkzC1KR3.js.map} +1 -1
  100. package/build/server/chunks/{5-DysVCz2n.js → 5-wdnguk_s.js} +3 -3
  101. package/build/server/chunks/{5-DysVCz2n.js.map → 5-wdnguk_s.js.map} +1 -1
  102. package/build/server/chunks/{6-DZU9gG9O.js → 6-DNqdHKKN.js} +8 -8
  103. package/build/server/chunks/{6-DZU9gG9O.js.map → 6-DNqdHKKN.js.map} +1 -1
  104. package/build/server/chunks/{7-DKyQ6J6h.js → 7-uMK92M75.js} +3 -3
  105. package/build/server/chunks/{7-DKyQ6J6h.js.map → 7-uMK92M75.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
@@ -1,11 +1,8 @@
1
- import { S as SvelteKitError, j as json, t as text, R as Redirect, H as HttpError, e as error, A as ActionFailure } from './chunks/index-CoD1IJuy.js';
2
- import { w as with_request_store } from './chunks/event-ByDKS2H7.js';
3
- import { b as base, a as app_dir, e as exec, c as assets, r as relative, o as override, d as reset } from './chunks/routing-C4Egnc9A.js';
4
- import { t as text_decoder, b as base64_decode, d as define_property, o as object_prototype, a as array_prototype, g as get_descriptor, i as is_extensible, c as array_from, e as get_prototype_of, f as is_array, h as deferred, r as run_all, j as index_of, s as setContext, k as decode_pathname, l as decode_params, n as normalize_path, m as disable_search, v as validate_layout_server_exports, p as validate_layout_exports, q as validate_page_server_exports, u as validate_page_exports, w as text_encoder, x as resolve, y as make_trackable, z as base64_encode, A as get_relative_path } from './chunks/exports-DTikbzSR.js';
5
- import { D as DevalueError, i as is_primitive, g as get_type, a as is_plain_object, e as enumerable_symbols, s as stringify_key, b as stringify_string, r as render, L as LEGACY_PROPS, C as CONNECTED, E as ERROR_VALUE, c as COMMENT_NODE, H as HYDRATION_START, d as HYDRATION_ERROR, S as STATE_SYMBOL, U as UNINITIALIZED, f as DERIVED, h as DIRTY, M as MAYBE_DIRTY, j as CLEAN, I as INERT, k as EFFECT, B as BLOCK_EFFECT, W as WAS_MARKED, l as is_passive_event, m as BRANCH_EFFECT, R as ROOT_EFFECT, n as RENDER_EFFECT, o as MANAGED_EFFECT, p as DESTROYED, A as ASYNC, q as HEAD_EFFECT, t as REACTION_IS_UPDATING, u as EFFECT_RAN, v as EFFECT_PRESERVED, w as EFFECT_TRANSPARENT, x as BOUNDARY_EFFECT, y as EAGER_EFFECT, z as STALE_REACTION, F as HYDRATION_END, G as HYDRATION_START_ELSE, J as USER_EFFECT, K as uneval } from './chunks/index-Z8eOP0z5.js';
6
- import { s as safe_equals, e as equals, r as readable, w as writable } from './chunks/index2-RKMiVZcy.js';
7
-
8
- const BROWSER = false;
1
+ import { w as with_request_store, D as DevalueError, i as is_primitive, g as get_type, a as is_plain_object, e as enumerable_symbols, s as stringify_key, b as stringify_string, v as valid_array_indices, r as root, d as decode_pathname, B as BROWSER, n as normalize_path, c as disable_search, u as uneval, f as resolve, m as make_trackable } from './chunks/url-DAcOnjX0.js';
2
+ import { H as HttpError, j as json, t as text, S as SvelteKitError, R as Redirect, e as error, A as ActionFailure } from './chunks/index-CoD1IJuy.js';
3
+ import { b as base, a as app_dir, f as find_route, c as assets, r as relative, o as override, d as reset } from './chunks/routing-DnQyokYQ.js';
4
+ import { t as text_decoder, b as base64_decode, v as validate_layout_server_exports, a as validate_layout_exports, c as validate_page_server_exports, d as validate_page_exports, e as text_encoder, f as base64_encode, g as get_relative_path } from './chunks/exports-7ECo9oy7.js';
5
+ import { w as writable, r as readable } from './chunks/index-DeXr9LUC.js';
9
6
 
10
7
  /**
11
8
  * @template {{ tracing: { enabled: boolean, root: import('@opentelemetry/api').Span, current: import('@opentelemetry/api').Span } }} T
@@ -23,6 +20,10 @@ function merge_tracing(event_like, current) {
23
20
  };
24
21
  }
25
22
 
23
+ const SVELTE_KIT_ASSETS = "/_svelte_kit_assets";
24
+ const ENDPOINT_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
25
+ const MUTATIVE_METHODS = ["POST", "PUT", "PATCH", "DELETE"];
26
+ const PAGE_METHODS = ["GET", "POST", "HEAD"];
26
27
  function encode64(arraybuffer) {
27
28
  const dv = new DataView(arraybuffer);
28
29
  let binaryString = "";
@@ -99,6 +100,7 @@ const NAN = -3;
99
100
  const POSITIVE_INFINITY = -4;
100
101
  const NEGATIVE_INFINITY = -5;
101
102
  const NEGATIVE_ZERO = -6;
103
+ const SPARSE = -7;
102
104
  function parse(serialized, revivers) {
103
105
  return unflatten(JSON.parse(serialized), revivers);
104
106
  }
@@ -166,7 +168,11 @@ function unflatten(parsed, revivers) {
166
168
  hydrated[index] = new RegExp(value[1], value[2]);
167
169
  break;
168
170
  case "Object":
169
- hydrated[index] = Object(value[1]);
171
+ const object = Object(value[1]);
172
+ if (Object.hasOwn(object, "__proto__")) {
173
+ throw new Error("Cannot parse an object with a `__proto__` property");
174
+ }
175
+ hydrated[index] = object;
170
176
  break;
171
177
  case "BigInt":
172
178
  hydrated[index] = BigInt(value[1]);
@@ -175,6 +181,9 @@ function unflatten(parsed, revivers) {
175
181
  const obj = /* @__PURE__ */ Object.create(null);
176
182
  hydrated[index] = obj;
177
183
  for (let i = 1; i < value.length; i += 2) {
184
+ if (value[i] === "__proto__") {
185
+ throw new Error("Cannot parse an object with a `__proto__` property");
186
+ }
178
187
  obj[value[i]] = hydrate(value[i + 1]);
179
188
  }
180
189
  break;
@@ -232,6 +241,20 @@ function unflatten(parsed, revivers) {
232
241
  default:
233
242
  throw new Error(`Unknown type ${type}`);
234
243
  }
244
+ } else if (value[0] === SPARSE) {
245
+ const len = value[1];
246
+ if (!Number.isInteger(len) || len < 0) {
247
+ throw new Error("Invalid input");
248
+ }
249
+ const array = new Array(len);
250
+ hydrated[index] = array;
251
+ for (let i = 2; i < value.length; i += 2) {
252
+ const idx = value[i];
253
+ if (!Number.isInteger(idx) || idx < 0 || idx >= len) {
254
+ throw new Error("Invalid input");
255
+ }
256
+ array[idx] = hydrate(value[i + 1]);
257
+ }
235
258
  } else {
236
259
  const array = new Array(value.length);
237
260
  hydrated[index] = array;
@@ -244,7 +267,7 @@ function unflatten(parsed, revivers) {
244
267
  } else {
245
268
  const object = {};
246
269
  hydrated[index] = object;
247
- for (const key in value) {
270
+ for (const key of Object.keys(value)) {
248
271
  if (key === "__proto__") {
249
272
  throw new Error("Cannot parse an object with a `__proto__` property");
250
273
  }
@@ -314,20 +337,44 @@ function stringify$1(value, reducers) {
314
337
  const { source, flags } = thing;
315
338
  str = flags ? `["RegExp",${stringify_string(source)},"${flags}"]` : `["RegExp",${stringify_string(source)}]`;
316
339
  break;
317
- case "Array":
340
+ case "Array": {
341
+ let mostly_dense = false;
318
342
  str = "[";
319
343
  for (let i = 0; i < thing.length; i += 1) {
320
344
  if (i > 0) str += ",";
321
- if (i in thing) {
345
+ if (Object.hasOwn(thing, i)) {
322
346
  keys.push(`[${i}]`);
323
347
  str += flatten(thing[i]);
324
348
  keys.pop();
325
- } else {
349
+ } else if (mostly_dense) {
326
350
  str += HOLE;
351
+ } else {
352
+ const populated_keys = valid_array_indices(
353
+ /** @type {any[]} */
354
+ thing
355
+ );
356
+ const population = populated_keys.length;
357
+ const d = String(thing.length).length;
358
+ const hole_cost = (thing.length - population) * 3;
359
+ const sparse_cost = 4 + d + population * (d + 1);
360
+ if (hole_cost > sparse_cost) {
361
+ str = "[" + SPARSE + "," + thing.length;
362
+ for (let j = 0; j < populated_keys.length; j++) {
363
+ const key = populated_keys[j];
364
+ keys.push(`[${key}]`);
365
+ str += "," + key + "," + flatten(thing[key]);
366
+ keys.pop();
367
+ }
368
+ break;
369
+ } else {
370
+ mostly_dense = true;
371
+ str += HOLE;
372
+ }
327
373
  }
328
374
  }
329
375
  str += "]";
330
376
  break;
377
+ }
331
378
  case "Set":
332
379
  str = '["Set"';
333
380
  for (const value2 of thing) {
@@ -403,7 +450,15 @@ function stringify$1(value, reducers) {
403
450
  }
404
451
  if (Object.getPrototypeOf(thing) === null) {
405
452
  str = '["null"';
406
- for (const key in thing) {
453
+ for (const key of Object.keys(thing)) {
454
+ if (key === "__proto__") {
455
+ throw new DevalueError(
456
+ `Cannot stringify objects with __proto__ keys`,
457
+ keys,
458
+ thing,
459
+ value
460
+ );
461
+ }
407
462
  keys.push(stringify_key(key));
408
463
  str += `,${stringify_string(key)},${flatten(thing[key])}`;
409
464
  keys.pop();
@@ -412,7 +467,15 @@ function stringify$1(value, reducers) {
412
467
  } else {
413
468
  str = "{";
414
469
  let started = false;
415
- for (const key in thing) {
470
+ for (const key of Object.keys(thing)) {
471
+ if (key === "__proto__") {
472
+ throw new DevalueError(
473
+ `Cannot stringify objects with __proto__ keys`,
474
+ keys,
475
+ thing,
476
+ value
477
+ );
478
+ }
416
479
  if (started) str += ",";
417
480
  started = true;
418
481
  keys.push(stringify_key(key));
@@ -559,32 +622,49 @@ async function deserialize_binary_form(request) {
559
622
  if (file_offsets_length > 0) {
560
623
  const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
561
624
  if (!file_offsets_buffer) throw deserialize_error("file offset table too short");
625
+ const parsed_offsets = JSON.parse(text_decoder.decode(file_offsets_buffer));
626
+ if (!Array.isArray(parsed_offsets) || parsed_offsets.some((n) => typeof n !== "number" || !Number.isInteger(n) || n < 0)) {
627
+ throw deserialize_error("invalid file offset table");
628
+ }
562
629
  file_offsets = /** @type {Array<number>} */
563
- JSON.parse(text_decoder.decode(file_offsets_buffer));
630
+ parsed_offsets;
564
631
  files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
565
632
  }
633
+ const file_spans = [];
566
634
  const [data, meta] = parse(text_decoder.decode(data_buffer), {
567
635
  File: ([name, type, size, last_modified, index]) => {
568
- if (files_start_offset + file_offsets[index] + size > content_length) {
636
+ if (typeof name !== "string" || typeof type !== "string" || typeof size !== "number" || typeof last_modified !== "number" || typeof index !== "number") {
637
+ throw deserialize_error("invalid file metadata");
638
+ }
639
+ let offset = file_offsets[index];
640
+ if (offset === void 0) {
641
+ throw deserialize_error("duplicate file offset table index");
642
+ }
643
+ file_offsets[index] = void 0;
644
+ offset += files_start_offset;
645
+ if (offset + size > content_length) {
569
646
  throw deserialize_error("file data overflow");
570
647
  }
571
- return new Proxy(
572
- new LazyFile(
573
- name,
574
- type,
575
- size,
576
- last_modified,
577
- get_chunk,
578
- files_start_offset + file_offsets[index]
579
- ),
580
- {
581
- getPrototypeOf() {
582
- return File.prototype;
583
- }
648
+ file_spans.push({ offset, size });
649
+ return new Proxy(new LazyFile(name, type, size, last_modified, get_chunk, offset), {
650
+ getPrototypeOf() {
651
+ return File.prototype;
584
652
  }
585
- );
653
+ });
586
654
  }
587
655
  });
656
+ file_spans.sort((a, b) => a.offset - b.offset || a.size - b.size);
657
+ for (let i = 1; i < file_spans.length; i++) {
658
+ const previous = file_spans[i - 1];
659
+ const current = file_spans[i];
660
+ const previous_end = previous.offset + previous.size;
661
+ if (previous_end < current.offset) {
662
+ throw deserialize_error("gaps in file data");
663
+ }
664
+ if (previous_end > current.offset) {
665
+ throw deserialize_error("overlapping file data");
666
+ }
667
+ }
588
668
  void (async () => {
589
669
  let has_more = true;
590
670
  while (has_more) {
@@ -666,7 +746,7 @@ class LazyFile {
666
746
  return new ReadableStream({
667
747
  start: async (controller) => {
668
748
  let chunk_start = 0;
669
- let start_chunk = null;
749
+ let start_chunk;
670
750
  for (chunk_index = 0; ; chunk_index++) {
671
751
  const chunk = await this.#get_chunk(chunk_index);
672
752
  if (!chunk) return null;
@@ -744,2905 +824,361 @@ function deep_set(object, keys, value) {
744
824
  check_prototype_pollution(final_key);
745
825
  current[final_key] = value;
746
826
  }
747
- const INVALIDATED_PARAM = "x-sveltekit-invalidated";
748
- const TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
749
- function stringify(data, transport) {
750
- const encoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]));
751
- return stringify$1(data, encoders);
827
+ function negotiate(accept, types) {
828
+ const parts = [];
829
+ accept.split(",").forEach((str, i) => {
830
+ const match = /([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
831
+ if (match) {
832
+ const [, type, subtype, q = "1"] = match;
833
+ parts.push({ type, subtype, q: +q, i });
834
+ }
835
+ });
836
+ parts.sort((a, b) => {
837
+ if (a.q !== b.q) {
838
+ return b.q - a.q;
839
+ }
840
+ if (a.subtype === "*" !== (b.subtype === "*")) {
841
+ return a.subtype === "*" ? 1 : -1;
842
+ }
843
+ if (a.type === "*" !== (b.type === "*")) {
844
+ return a.type === "*" ? 1 : -1;
845
+ }
846
+ return a.i - b.i;
847
+ });
848
+ let accepted;
849
+ let min_priority = Infinity;
850
+ for (const mimetype of types) {
851
+ const [type, subtype] = mimetype.split("/");
852
+ const priority = parts.findIndex(
853
+ (part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*")
854
+ );
855
+ if (priority !== -1 && priority < min_priority) {
856
+ accepted = mimetype;
857
+ min_priority = priority;
858
+ }
859
+ }
860
+ return accepted;
752
861
  }
753
- function parse_remote_arg(string, transport) {
754
- if (!string) return void 0;
755
- const json_string = text_decoder.decode(
756
- // no need to add back `=` characters, atob can handle it
757
- base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))
862
+ function is_content_type(request, ...types) {
863
+ const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? "";
864
+ return types.includes(type.toLowerCase());
865
+ }
866
+ function is_form_content_type(request) {
867
+ return is_content_type(
868
+ request,
869
+ "application/x-www-form-urlencoded",
870
+ "multipart/form-data",
871
+ "text/plain",
872
+ BINARY_FORM_CONTENT_TYPE
758
873
  );
759
- const decoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.decode]));
760
- return parse(json_string, decoders);
761
874
  }
762
- function create_remote_key(id, payload) {
763
- return id + "/" + payload;
875
+ function coalesce_to_error(err) {
876
+ return err instanceof Error || err && /** @type {any} */
877
+ err.name && /** @type {any} */
878
+ err.message ? (
879
+ /** @type {Error} */
880
+ err
881
+ ) : new Error(JSON.stringify(err));
764
882
  }
765
-
766
- let public_env = {};
767
- function set_private_env(environment) {
883
+ function normalize_error(error) {
884
+ return (
885
+ /** @type {import('../exports/internal/index.js').Redirect | HttpError | SvelteKitError | Error} */
886
+ error
887
+ );
768
888
  }
769
- function set_public_env(environment) {
770
- public_env = environment;
889
+ function get_status(error) {
890
+ return error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
771
891
  }
772
- function effect_update_depth_exceeded() {
773
- {
774
- throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
775
- }
892
+ function get_message(error) {
893
+ return error instanceof SvelteKitError ? error.text : "Internal Error";
776
894
  }
777
- function hydration_failed() {
778
- {
779
- throw new Error(`https://svelte.dev/e/hydration_failed`);
780
- }
895
+ const escape_html_attr_dict = {
896
+ "&": "&amp;",
897
+ '"': "&quot;"
898
+ // Svelte also escapes < because the escape function could be called inside a `noscript` there
899
+ // https://github.com/sveltejs/svelte/security/advisories/GHSA-8266-84wp-wv5c
900
+ // However, that doesn't apply in SvelteKit
901
+ };
902
+ const escape_html_dict = {
903
+ "&": "&amp;",
904
+ "<": "&lt;"
905
+ };
906
+ const surrogates = (
907
+ // high surrogate without paired low surrogate
908
+ "[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]"
909
+ );
910
+ const escape_html_attr_regex = new RegExp(
911
+ `[${Object.keys(escape_html_attr_dict).join("")}]|` + surrogates,
912
+ "g"
913
+ );
914
+ const escape_html_regex = new RegExp(
915
+ `[${Object.keys(escape_html_dict).join("")}]|` + surrogates,
916
+ "g"
917
+ );
918
+ function escape_html(str, is_attr) {
919
+ const dict = is_attr ? escape_html_attr_dict : escape_html_dict;
920
+ const escaped_str = str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => {
921
+ if (match.length === 2) {
922
+ return match;
923
+ }
924
+ return dict[match] ?? `&#${match.charCodeAt(0)};`;
925
+ });
926
+ return escaped_str;
781
927
  }
782
- function state_descriptors_fixed() {
783
- {
784
- throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
785
- }
928
+ function method_not_allowed(mod, method) {
929
+ return text(`${method} method not allowed`, {
930
+ status: 405,
931
+ headers: {
932
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
933
+ // "The server must generate an Allow header field in a 405 status code response"
934
+ allow: allowed_methods(mod).join(", ")
935
+ }
936
+ });
786
937
  }
787
- function state_prototype_fixed() {
788
- {
789
- throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
938
+ function allowed_methods(mod) {
939
+ const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
940
+ if ("GET" in mod && !("HEAD" in mod)) {
941
+ allowed.push("HEAD");
790
942
  }
943
+ return allowed;
791
944
  }
792
- function state_unsafe_mutation() {
793
- {
794
- throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
795
- }
945
+ function get_global_name(options) {
946
+ return `__sveltekit_${options.version_hash}`;
796
947
  }
797
- function svelte_boundary_reset_onerror() {
798
- {
799
- throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
800
- }
948
+ function static_error_page(options, status, message) {
949
+ let page = options.templates.error({ status, message: escape_html(message) });
950
+ return text(page, {
951
+ headers: { "content-type": "text/html; charset=utf-8" },
952
+ status
953
+ });
801
954
  }
802
- function hydration_mismatch(location) {
803
- {
804
- console.warn(`https://svelte.dev/e/hydration_mismatch`);
955
+ async function handle_fatal_error(event, state, options, error) {
956
+ error = error instanceof HttpError ? error : coalesce_to_error(error);
957
+ const status = get_status(error);
958
+ const body = await handle_error_and_jsonify(event, state, options, error);
959
+ const type = negotiate(event.request.headers.get("accept") || "text/html", [
960
+ "application/json",
961
+ "text/html"
962
+ ]);
963
+ if (event.isDataRequest || type === "application/json") {
964
+ return json(body, {
965
+ status
966
+ });
805
967
  }
968
+ return static_error_page(options, status, body.message);
806
969
  }
807
- function svelte_boundary_reset_noop() {
808
- {
809
- console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
970
+ async function handle_error_and_jsonify(event, state, options, error) {
971
+ if (error instanceof HttpError) {
972
+ return { message: "Unknown Error", ...error.body };
810
973
  }
974
+ const status = get_status(error);
975
+ const message = get_message(error);
976
+ return await with_request_store(
977
+ { event, state },
978
+ () => options.hooks.handleError({ error, event, status, message })
979
+ ) ?? { message };
811
980
  }
812
- let hydrating = false;
813
- function set_hydrating(value) {
814
- hydrating = value;
981
+ function redirect_response(status, location) {
982
+ const response = new Response(void 0, {
983
+ status,
984
+ headers: { location }
985
+ });
986
+ return response;
815
987
  }
816
- let hydrate_node;
817
- function set_hydrate_node(node) {
818
- if (node === null) {
819
- hydration_mismatch();
820
- throw HYDRATION_ERROR;
988
+ function clarify_devalue_error(event, error) {
989
+ if (error.path) {
990
+ return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error.message} (${error.path}). If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#Universal-hooks-transport.`;
821
991
  }
822
- return hydrate_node = node;
823
- }
824
- function hydrate_next() {
825
- return set_hydrate_node(/* @__PURE__ */ get_next_sibling(hydrate_node));
826
- }
827
- function next(count = 1) {
828
- if (hydrating) {
829
- var i = count;
830
- var node = hydrate_node;
831
- while (i--) {
832
- node = /** @type {TemplateNode} */
833
- /* @__PURE__ */ get_next_sibling(node);
834
- }
835
- hydrate_node = node;
992
+ if (error.path === "") {
993
+ return `Data returned from \`load\` while rendering ${event.route.id} is not a plain object`;
836
994
  }
995
+ return error.message;
837
996
  }
838
- function skip_nodes(remove = true) {
839
- var depth = 0;
840
- var node = hydrate_node;
841
- while (true) {
842
- if (node.nodeType === COMMENT_NODE) {
843
- var data = (
844
- /** @type {Comment} */
845
- node.data
846
- );
847
- if (data === HYDRATION_END) {
848
- if (depth === 0) return node;
849
- depth -= 1;
850
- } else if (data === HYDRATION_START || data === HYDRATION_START_ELSE) {
851
- depth += 1;
852
- }
853
- }
854
- var next2 = (
855
- /** @type {TemplateNode} */
856
- /* @__PURE__ */ get_next_sibling(node)
857
- );
858
- if (remove) node.remove();
859
- node = next2;
860
- }
861
- }
862
- let tracing_mode_flag = false;
863
- let component_context = null;
864
- function set_component_context(context) {
865
- component_context = context;
866
- }
867
- function push(props, runes = false, fn) {
868
- component_context = {
869
- p: component_context,
870
- i: false,
871
- c: null,
872
- e: null,
873
- s: props,
874
- x: null,
875
- l: null
876
- };
877
- }
878
- function pop(component) {
879
- var context = (
880
- /** @type {ComponentContext} */
881
- component_context
882
- );
883
- var effects = context.e;
884
- if (effects !== null) {
885
- context.e = null;
886
- for (var fn of effects) {
887
- create_user_effect(fn);
888
- }
997
+ function serialize_uses(node) {
998
+ const uses = {};
999
+ if (node.uses && node.uses.dependencies.size > 0) {
1000
+ uses.dependencies = Array.from(node.uses.dependencies);
889
1001
  }
890
- context.i = true;
891
- component_context = context.p;
892
- return (
893
- /** @type {T} */
894
- {}
895
- );
896
- }
897
- function is_runes() {
898
- return true;
899
- }
900
- let micro_tasks = [];
901
- function run_micro_tasks() {
902
- var tasks = micro_tasks;
903
- micro_tasks = [];
904
- run_all(tasks);
905
- }
906
- function queue_micro_task(fn) {
907
- if (micro_tasks.length === 0 && !is_flushing_sync) {
908
- var tasks = micro_tasks;
909
- queueMicrotask(() => {
910
- if (tasks === micro_tasks) run_micro_tasks();
911
- });
1002
+ if (node.uses && node.uses.search_params.size > 0) {
1003
+ uses.search_params = Array.from(node.uses.search_params);
912
1004
  }
913
- micro_tasks.push(fn);
914
- }
915
- function flush_tasks() {
916
- while (micro_tasks.length > 0) {
917
- run_micro_tasks();
1005
+ if (node.uses && node.uses.params.size > 0) {
1006
+ uses.params = Array.from(node.uses.params);
918
1007
  }
1008
+ if (node.uses?.parent) uses.parent = 1;
1009
+ if (node.uses?.route) uses.route = 1;
1010
+ if (node.uses?.url) uses.url = 1;
1011
+ return uses;
919
1012
  }
920
- function handle_error(error) {
921
- var effect = active_effect;
922
- if (effect === null) {
923
- active_reaction.f |= ERROR_VALUE;
924
- return error;
925
- }
926
- if ((effect.f & EFFECT_RAN) === 0) {
927
- if ((effect.f & BOUNDARY_EFFECT) === 0) {
928
- throw error;
929
- }
930
- effect.b.error(error);
931
- } else {
932
- invoke_error_boundary(error, effect);
933
- }
1013
+ function has_prerendered_path(manifest, pathname) {
1014
+ return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
934
1015
  }
935
- function invoke_error_boundary(error, effect) {
936
- while (effect !== null) {
937
- if ((effect.f & BOUNDARY_EFFECT) !== 0) {
938
- try {
939
- effect.b.error(error);
940
- return;
941
- } catch (e) {
942
- error = e;
943
- }
944
- }
945
- effect = effect.parent;
1016
+ function format_server_error(status, error, event) {
1017
+ const formatted_text = `
1018
+ \x1B[1;31m[${status}] ${event.request.method} ${event.url.pathname}\x1B[0m`;
1019
+ if (status === 404) {
1020
+ return formatted_text;
946
1021
  }
947
- throw error;
1022
+ return `${formatted_text}
1023
+ ${error.stack}`;
948
1024
  }
949
- const STATUS_MASK = -7169;
950
- function set_signal_status(signal, status) {
951
- signal.f = signal.f & STATUS_MASK | status;
1025
+ function get_node_type(node_id) {
1026
+ const parts = node_id?.split("/");
1027
+ const filename = parts?.at(-1);
1028
+ if (!filename) return "unknown";
1029
+ const dot_parts = filename.split(".");
1030
+ return dot_parts.slice(0, -1).join(".");
952
1031
  }
953
- function update_derived_status(derived) {
954
- if ((derived.f & CONNECTED) !== 0 || derived.deps === null) {
955
- set_signal_status(derived, CLEAN);
956
- } else {
957
- set_signal_status(derived, MAYBE_DIRTY);
958
- }
1032
+ const INVALIDATED_PARAM = "x-sveltekit-invalidated";
1033
+ const TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
1034
+ function stringify(data, transport) {
1035
+ const encoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]));
1036
+ return stringify$1(data, encoders);
959
1037
  }
960
- function clear_marked(deps) {
961
- if (deps === null) return;
962
- for (const dep of deps) {
963
- if ((dep.f & DERIVED) === 0 || (dep.f & WAS_MARKED) === 0) {
964
- continue;
965
- }
966
- dep.f ^= WAS_MARKED;
967
- clear_marked(
968
- /** @type {Derived} */
969
- dep.deps
970
- );
971
- }
1038
+ function parse_remote_arg(string, transport) {
1039
+ if (!string) return void 0;
1040
+ const json_string = text_decoder.decode(
1041
+ // no need to add back `=` characters, atob can handle it
1042
+ base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))
1043
+ );
1044
+ const decoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.decode]));
1045
+ return parse(json_string, decoders);
972
1046
  }
973
- function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
974
- if ((effect.f & DIRTY) !== 0) {
975
- dirty_effects.add(effect);
976
- } else if ((effect.f & MAYBE_DIRTY) !== 0) {
977
- maybe_dirty_effects.add(effect);
978
- }
979
- clear_marked(effect.deps);
980
- set_signal_status(effect, CLEAN);
981
- }
982
- const batches = /* @__PURE__ */ new Set();
983
- let current_batch = null;
984
- let batch_values = null;
985
- let queued_root_effects = [];
986
- let last_scheduled_effect = null;
987
- let is_flushing = false;
988
- let is_flushing_sync = false;
989
- class Batch {
990
- committed = false;
991
- /**
992
- * The current values of any sources that are updated in this batch
993
- * They keys of this map are identical to `this.#previous`
994
- * @type {Map<Source, any>}
995
- */
996
- current = /* @__PURE__ */ new Map();
997
- /**
998
- * The values of any sources that are updated in this batch _before_ those updates took place.
999
- * They keys of this map are identical to `this.#current`
1000
- * @type {Map<Source, any>}
1001
- */
1002
- previous = /* @__PURE__ */ new Map();
1003
- /**
1004
- * When the batch is committed (and the DOM is updated), we need to remove old branches
1005
- * and append new ones by calling the functions added inside (if/each/key/etc) blocks
1006
- * @type {Set<() => void>}
1007
- */
1008
- #commit_callbacks = /* @__PURE__ */ new Set();
1009
- /**
1010
- * If a fork is discarded, we need to destroy any effects that are no longer needed
1011
- * @type {Set<(batch: Batch) => void>}
1012
- */
1013
- #discard_callbacks = /* @__PURE__ */ new Set();
1014
- /**
1015
- * The number of async effects that are currently in flight
1016
- */
1017
- #pending = 0;
1018
- /**
1019
- * The number of async effects that are currently in flight, _not_ inside a pending boundary
1020
- */
1021
- #blocking_pending = 0;
1022
- /**
1023
- * A deferred that resolves when the batch is committed, used with `settled()`
1024
- * TODO replace with Promise.withResolvers once supported widely enough
1025
- * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
1026
- */
1027
- #deferred = null;
1028
- /**
1029
- * Deferred effects (which run after async work has completed) that are DIRTY
1030
- * @type {Set<Effect>}
1031
- */
1032
- #dirty_effects = /* @__PURE__ */ new Set();
1033
- /**
1034
- * Deferred effects that are MAYBE_DIRTY
1035
- * @type {Set<Effect>}
1036
- */
1037
- #maybe_dirty_effects = /* @__PURE__ */ new Set();
1038
- /**
1039
- * A set of branches that still exist, but will be destroyed when this batch
1040
- * is committed — we skip over these during `process`
1041
- * @type {Set<Effect>}
1042
- */
1043
- skipped_effects = /* @__PURE__ */ new Set();
1044
- is_fork = false;
1045
- is_deferred() {
1046
- return this.is_fork || this.#blocking_pending > 0;
1047
- }
1048
- /**
1049
- *
1050
- * @param {Effect[]} root_effects
1051
- */
1052
- process(root_effects) {
1053
- queued_root_effects = [];
1054
- this.apply();
1055
- var effects = [];
1056
- var render_effects = [];
1057
- for (const root2 of root_effects) {
1058
- this.#traverse_effect_tree(root2, effects, render_effects);
1059
- }
1060
- if (!this.is_fork) {
1061
- this.#resolve();
1062
- }
1063
- if (this.is_deferred()) {
1064
- this.#defer_effects(render_effects);
1065
- this.#defer_effects(effects);
1066
- } else {
1067
- current_batch = null;
1068
- flush_queued_effects(render_effects);
1069
- flush_queued_effects(effects);
1070
- this.#deferred?.resolve();
1071
- }
1072
- batch_values = null;
1073
- }
1074
- /**
1075
- * Traverse the effect tree, executing effects or stashing
1076
- * them for later execution as appropriate
1077
- * @param {Effect} root
1078
- * @param {Effect[]} effects
1079
- * @param {Effect[]} render_effects
1080
- */
1081
- #traverse_effect_tree(root2, effects, render_effects) {
1082
- root2.f ^= CLEAN;
1083
- var effect = root2.first;
1084
- var pending_boundary = null;
1085
- while (effect !== null) {
1086
- var flags2 = effect.f;
1087
- var is_branch = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
1088
- var is_skippable_branch = is_branch && (flags2 & CLEAN) !== 0;
1089
- var skip = is_skippable_branch || (flags2 & INERT) !== 0 || this.skipped_effects.has(effect);
1090
- if (!skip && effect.fn !== null) {
1091
- if (is_branch) {
1092
- effect.f ^= CLEAN;
1093
- } else if (pending_boundary !== null && (flags2 & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0) {
1094
- pending_boundary.b.defer_effect(effect);
1095
- } else if ((flags2 & EFFECT) !== 0) {
1096
- effects.push(effect);
1097
- } else if (is_dirty(effect)) {
1098
- if ((flags2 & BLOCK_EFFECT) !== 0) this.#dirty_effects.add(effect);
1099
- update_effect(effect);
1100
- }
1101
- var child = effect.first;
1102
- if (child !== null) {
1103
- effect = child;
1104
- continue;
1105
- }
1106
- }
1107
- var parent = effect.parent;
1108
- effect = effect.next;
1109
- while (effect === null && parent !== null) {
1110
- if (parent === pending_boundary) {
1111
- pending_boundary = null;
1112
- }
1113
- effect = parent.next;
1114
- parent = parent.parent;
1115
- }
1116
- }
1117
- }
1118
- /**
1119
- * @param {Effect[]} effects
1120
- */
1121
- #defer_effects(effects) {
1122
- for (var i = 0; i < effects.length; i += 1) {
1123
- defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
1124
- }
1125
- }
1126
- /**
1127
- * Associate a change to a given source with the current
1128
- * batch, noting its previous and current values
1129
- * @param {Source} source
1130
- * @param {any} value
1131
- */
1132
- capture(source2, value) {
1133
- if (value !== UNINITIALIZED && !this.previous.has(source2)) {
1134
- this.previous.set(source2, value);
1135
- }
1136
- if ((source2.f & ERROR_VALUE) === 0) {
1137
- this.current.set(source2, source2.v);
1138
- batch_values?.set(source2, source2.v);
1139
- }
1140
- }
1141
- activate() {
1142
- current_batch = this;
1143
- this.apply();
1144
- }
1145
- deactivate() {
1146
- if (current_batch !== this) return;
1147
- current_batch = null;
1148
- batch_values = null;
1149
- }
1150
- flush() {
1151
- this.activate();
1152
- if (queued_root_effects.length > 0) {
1153
- flush_effects();
1154
- if (current_batch !== null && current_batch !== this) {
1155
- return;
1156
- }
1157
- } else if (this.#pending === 0) {
1158
- this.process([]);
1159
- }
1160
- this.deactivate();
1161
- }
1162
- discard() {
1163
- for (const fn of this.#discard_callbacks) fn(this);
1164
- this.#discard_callbacks.clear();
1165
- }
1166
- #resolve() {
1167
- if (this.#blocking_pending === 0) {
1168
- for (const fn of this.#commit_callbacks) fn();
1169
- this.#commit_callbacks.clear();
1170
- }
1171
- if (this.#pending === 0) {
1172
- this.#commit();
1173
- }
1174
- }
1175
- #commit() {
1176
- if (batches.size > 1) {
1177
- this.previous.clear();
1178
- var previous_batch_values = batch_values;
1179
- var is_earlier = true;
1180
- for (const batch of batches) {
1181
- if (batch === this) {
1182
- is_earlier = false;
1183
- continue;
1184
- }
1185
- const sources = [];
1186
- for (const [source2, value] of this.current) {
1187
- if (batch.current.has(source2)) {
1188
- if (is_earlier && value !== batch.current.get(source2)) {
1189
- batch.current.set(source2, value);
1190
- } else {
1191
- continue;
1192
- }
1193
- }
1194
- sources.push(source2);
1195
- }
1196
- if (sources.length === 0) {
1197
- continue;
1198
- }
1199
- const others = [...batch.current.keys()].filter((s) => !this.current.has(s));
1200
- if (others.length > 0) {
1201
- var prev_queued_root_effects = queued_root_effects;
1202
- queued_root_effects = [];
1203
- const marked = /* @__PURE__ */ new Set();
1204
- const checked = /* @__PURE__ */ new Map();
1205
- for (const source2 of sources) {
1206
- mark_effects(source2, others, marked, checked);
1207
- }
1208
- if (queued_root_effects.length > 0) {
1209
- current_batch = batch;
1210
- batch.apply();
1211
- for (const root2 of queued_root_effects) {
1212
- batch.#traverse_effect_tree(root2, [], []);
1213
- }
1214
- batch.deactivate();
1215
- }
1216
- queued_root_effects = prev_queued_root_effects;
1217
- }
1218
- }
1219
- current_batch = null;
1220
- batch_values = previous_batch_values;
1221
- }
1222
- this.committed = true;
1223
- batches.delete(this);
1224
- }
1225
- /**
1226
- *
1227
- * @param {boolean} blocking
1228
- */
1229
- increment(blocking) {
1230
- this.#pending += 1;
1231
- if (blocking) this.#blocking_pending += 1;
1232
- }
1233
- /**
1234
- *
1235
- * @param {boolean} blocking
1236
- */
1237
- decrement(blocking) {
1238
- this.#pending -= 1;
1239
- if (blocking) this.#blocking_pending -= 1;
1240
- this.revive();
1241
- }
1242
- revive() {
1243
- for (const e of this.#dirty_effects) {
1244
- this.#maybe_dirty_effects.delete(e);
1245
- set_signal_status(e, DIRTY);
1246
- schedule_effect(e);
1247
- }
1248
- for (const e of this.#maybe_dirty_effects) {
1249
- set_signal_status(e, MAYBE_DIRTY);
1250
- schedule_effect(e);
1251
- }
1252
- this.flush();
1253
- }
1254
- /** @param {() => void} fn */
1255
- oncommit(fn) {
1256
- this.#commit_callbacks.add(fn);
1257
- }
1258
- /** @param {(batch: Batch) => void} fn */
1259
- ondiscard(fn) {
1260
- this.#discard_callbacks.add(fn);
1261
- }
1262
- settled() {
1263
- return (this.#deferred ??= deferred()).promise;
1264
- }
1265
- static ensure() {
1266
- if (current_batch === null) {
1267
- const batch = current_batch = new Batch();
1268
- batches.add(current_batch);
1269
- if (!is_flushing_sync) {
1270
- Batch.enqueue(() => {
1271
- if (current_batch !== batch) {
1272
- return;
1273
- }
1274
- batch.flush();
1275
- });
1276
- }
1277
- }
1278
- return current_batch;
1279
- }
1280
- /** @param {() => void} task */
1281
- static enqueue(task) {
1282
- queue_micro_task(task);
1283
- }
1284
- apply() {
1285
- return;
1286
- }
1287
- }
1288
- function flushSync(fn) {
1289
- var was_flushing_sync = is_flushing_sync;
1290
- is_flushing_sync = true;
1291
- try {
1292
- var result;
1293
- if (fn) ;
1294
- while (true) {
1295
- flush_tasks();
1296
- if (queued_root_effects.length === 0) {
1297
- current_batch?.flush();
1298
- if (queued_root_effects.length === 0) {
1299
- last_scheduled_effect = null;
1300
- return (
1301
- /** @type {T} */
1302
- result
1303
- );
1304
- }
1305
- }
1306
- flush_effects();
1307
- }
1308
- } finally {
1309
- is_flushing_sync = was_flushing_sync;
1310
- }
1311
- }
1312
- function flush_effects() {
1313
- var was_updating_effect = is_updating_effect;
1314
- is_flushing = true;
1315
- try {
1316
- var flush_count = 0;
1317
- set_is_updating_effect(true);
1318
- while (queued_root_effects.length > 0) {
1319
- var batch = Batch.ensure();
1320
- if (flush_count++ > 1e3) {
1321
- var updates, entry;
1322
- if (BROWSER) ;
1323
- infinite_loop_guard();
1324
- }
1325
- batch.process(queued_root_effects);
1326
- old_values.clear();
1327
- if (BROWSER) ;
1328
- }
1329
- } finally {
1330
- is_flushing = false;
1331
- set_is_updating_effect(was_updating_effect);
1332
- last_scheduled_effect = null;
1333
- }
1334
- }
1335
- function infinite_loop_guard() {
1336
- try {
1337
- effect_update_depth_exceeded();
1338
- } catch (error) {
1339
- invoke_error_boundary(error, last_scheduled_effect);
1340
- }
1341
- }
1342
- let eager_block_effects = null;
1343
- function flush_queued_effects(effects) {
1344
- var length = effects.length;
1345
- if (length === 0) return;
1346
- var i = 0;
1347
- while (i < length) {
1348
- var effect = effects[i++];
1349
- if ((effect.f & (DESTROYED | INERT)) === 0 && is_dirty(effect)) {
1350
- eager_block_effects = /* @__PURE__ */ new Set();
1351
- update_effect(effect);
1352
- if (effect.deps === null && effect.first === null && effect.nodes === null) {
1353
- if (effect.teardown === null && effect.ac === null) {
1354
- unlink_effect(effect);
1355
- } else {
1356
- effect.fn = null;
1357
- }
1358
- }
1359
- if (eager_block_effects?.size > 0) {
1360
- old_values.clear();
1361
- for (const e of eager_block_effects) {
1362
- if ((e.f & (DESTROYED | INERT)) !== 0) continue;
1363
- const ordered_effects = [e];
1364
- let ancestor = e.parent;
1365
- while (ancestor !== null) {
1366
- if (eager_block_effects.has(ancestor)) {
1367
- eager_block_effects.delete(ancestor);
1368
- ordered_effects.push(ancestor);
1369
- }
1370
- ancestor = ancestor.parent;
1371
- }
1372
- for (let j = ordered_effects.length - 1; j >= 0; j--) {
1373
- const e2 = ordered_effects[j];
1374
- if ((e2.f & (DESTROYED | INERT)) !== 0) continue;
1375
- update_effect(e2);
1376
- }
1377
- }
1378
- eager_block_effects.clear();
1379
- }
1380
- }
1381
- }
1382
- eager_block_effects = null;
1383
- }
1384
- function mark_effects(value, sources, marked, checked) {
1385
- if (marked.has(value)) return;
1386
- marked.add(value);
1387
- if (value.reactions !== null) {
1388
- for (const reaction of value.reactions) {
1389
- const flags2 = reaction.f;
1390
- if ((flags2 & DERIVED) !== 0) {
1391
- mark_effects(
1392
- /** @type {Derived} */
1393
- reaction,
1394
- sources,
1395
- marked,
1396
- checked
1397
- );
1398
- } else if ((flags2 & (ASYNC | BLOCK_EFFECT)) !== 0 && (flags2 & DIRTY) === 0 && depends_on(reaction, sources, checked)) {
1399
- set_signal_status(reaction, DIRTY);
1400
- schedule_effect(
1401
- /** @type {Effect} */
1402
- reaction
1403
- );
1404
- }
1405
- }
1406
- }
1407
- }
1408
- function depends_on(reaction, sources, checked) {
1409
- const depends = checked.get(reaction);
1410
- if (depends !== void 0) return depends;
1411
- if (reaction.deps !== null) {
1412
- for (const dep of reaction.deps) {
1413
- if (sources.includes(dep)) {
1414
- return true;
1415
- }
1416
- if ((dep.f & DERIVED) !== 0 && depends_on(
1417
- /** @type {Derived} */
1418
- dep,
1419
- sources,
1420
- checked
1421
- )) {
1422
- checked.set(
1423
- /** @type {Derived} */
1424
- dep,
1425
- true
1426
- );
1427
- return true;
1428
- }
1429
- }
1430
- }
1431
- checked.set(reaction, false);
1432
- return false;
1433
- }
1434
- function schedule_effect(signal) {
1435
- var effect = last_scheduled_effect = signal;
1436
- while (effect.parent !== null) {
1437
- effect = effect.parent;
1438
- var flags2 = effect.f;
1439
- if (is_flushing && effect === active_effect && (flags2 & BLOCK_EFFECT) !== 0 && (flags2 & HEAD_EFFECT) === 0) {
1440
- return;
1441
- }
1442
- if ((flags2 & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
1443
- if ((flags2 & CLEAN) === 0) return;
1444
- effect.f ^= CLEAN;
1445
- }
1446
- }
1447
- queued_root_effects.push(effect);
1448
- }
1449
- function createSubscriber(start) {
1450
- let subscribers = 0;
1451
- let version = source(0);
1452
- let stop;
1453
- return () => {
1454
- if (effect_tracking()) {
1455
- get(version);
1456
- render_effect(() => {
1457
- if (subscribers === 0) {
1458
- stop = untrack(() => start(() => increment(version)));
1459
- }
1460
- subscribers += 1;
1461
- return () => {
1462
- queue_micro_task(() => {
1463
- subscribers -= 1;
1464
- if (subscribers === 0) {
1465
- stop?.();
1466
- stop = void 0;
1467
- increment(version);
1468
- }
1469
- });
1470
- };
1471
- });
1472
- }
1473
- };
1474
- }
1475
- var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED | BOUNDARY_EFFECT;
1476
- function boundary(node, props, children) {
1477
- new Boundary(node, props, children);
1478
- }
1479
- class Boundary {
1480
- /** @type {Boundary | null} */
1481
- parent;
1482
- is_pending = false;
1483
- /** @type {TemplateNode} */
1484
- #anchor;
1485
- /** @type {TemplateNode | null} */
1486
- #hydrate_open = hydrating ? hydrate_node : null;
1487
- /** @type {BoundaryProps} */
1488
- #props;
1489
- /** @type {((anchor: Node) => void)} */
1490
- #children;
1491
- /** @type {Effect} */
1492
- #effect;
1493
- /** @type {Effect | null} */
1494
- #main_effect = null;
1495
- /** @type {Effect | null} */
1496
- #pending_effect = null;
1497
- /** @type {Effect | null} */
1498
- #failed_effect = null;
1499
- /** @type {DocumentFragment | null} */
1500
- #offscreen_fragment = null;
1501
- /** @type {TemplateNode | null} */
1502
- #pending_anchor = null;
1503
- #local_pending_count = 0;
1504
- #pending_count = 0;
1505
- #is_creating_fallback = false;
1506
- /** @type {Set<Effect>} */
1507
- #dirty_effects = /* @__PURE__ */ new Set();
1508
- /** @type {Set<Effect>} */
1509
- #maybe_dirty_effects = /* @__PURE__ */ new Set();
1510
- /**
1511
- * A source containing the number of pending async deriveds/expressions.
1512
- * Only created if `$effect.pending()` is used inside the boundary,
1513
- * otherwise updating the source results in needless `Batch.ensure()`
1514
- * calls followed by no-op flushes
1515
- * @type {Source<number> | null}
1516
- */
1517
- #effect_pending = null;
1518
- #effect_pending_subscriber = createSubscriber(() => {
1519
- this.#effect_pending = source(this.#local_pending_count);
1520
- return () => {
1521
- this.#effect_pending = null;
1522
- };
1523
- });
1524
- /**
1525
- * @param {TemplateNode} node
1526
- * @param {BoundaryProps} props
1527
- * @param {((anchor: Node) => void)} children
1528
- */
1529
- constructor(node, props, children) {
1530
- this.#anchor = node;
1531
- this.#props = props;
1532
- this.#children = children;
1533
- this.parent = /** @type {Effect} */
1534
- active_effect.b;
1535
- this.is_pending = !!this.#props.pending;
1536
- this.#effect = block(() => {
1537
- active_effect.b = this;
1538
- if (hydrating) {
1539
- const comment = this.#hydrate_open;
1540
- hydrate_next();
1541
- const server_rendered_pending = (
1542
- /** @type {Comment} */
1543
- comment.nodeType === COMMENT_NODE && /** @type {Comment} */
1544
- comment.data === HYDRATION_START_ELSE
1545
- );
1546
- if (server_rendered_pending) {
1547
- this.#hydrate_pending_content();
1548
- } else {
1549
- this.#hydrate_resolved_content();
1550
- if (this.#pending_count === 0) {
1551
- this.is_pending = false;
1552
- }
1553
- }
1554
- } else {
1555
- var anchor = this.#get_anchor();
1556
- try {
1557
- this.#main_effect = branch(() => children(anchor));
1558
- } catch (error) {
1559
- this.error(error);
1560
- }
1561
- if (this.#pending_count > 0) {
1562
- this.#show_pending_snippet();
1563
- } else {
1564
- this.is_pending = false;
1565
- }
1566
- }
1567
- return () => {
1568
- this.#pending_anchor?.remove();
1569
- };
1570
- }, flags);
1571
- if (hydrating) {
1572
- this.#anchor = hydrate_node;
1573
- }
1574
- }
1575
- #hydrate_resolved_content() {
1576
- try {
1577
- this.#main_effect = branch(() => this.#children(this.#anchor));
1578
- } catch (error) {
1579
- this.error(error);
1580
- }
1581
- }
1582
- #hydrate_pending_content() {
1583
- const pending = this.#props.pending;
1584
- if (!pending) {
1585
- return;
1586
- }
1587
- this.#pending_effect = branch(() => pending(this.#anchor));
1588
- Batch.enqueue(() => {
1589
- var anchor = this.#get_anchor();
1590
- this.#main_effect = this.#run(() => {
1591
- Batch.ensure();
1592
- return branch(() => this.#children(anchor));
1593
- });
1594
- if (this.#pending_count > 0) {
1595
- this.#show_pending_snippet();
1596
- } else {
1597
- pause_effect(
1598
- /** @type {Effect} */
1599
- this.#pending_effect,
1600
- () => {
1601
- this.#pending_effect = null;
1602
- }
1603
- );
1604
- this.is_pending = false;
1605
- }
1606
- });
1607
- }
1608
- #get_anchor() {
1609
- var anchor = this.#anchor;
1610
- if (this.is_pending) {
1611
- this.#pending_anchor = create_text();
1612
- this.#anchor.before(this.#pending_anchor);
1613
- anchor = this.#pending_anchor;
1614
- }
1615
- return anchor;
1616
- }
1617
- /**
1618
- * Defer an effect inside a pending boundary until the boundary resolves
1619
- * @param {Effect} effect
1620
- */
1621
- defer_effect(effect) {
1622
- defer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);
1623
- }
1624
- /**
1625
- * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
1626
- * @returns {boolean}
1627
- */
1628
- is_rendered() {
1629
- return !this.is_pending && (!this.parent || this.parent.is_rendered());
1630
- }
1631
- has_pending_snippet() {
1632
- return !!this.#props.pending;
1633
- }
1634
- /**
1635
- * @param {() => Effect | null} fn
1636
- */
1637
- #run(fn) {
1638
- var previous_effect = active_effect;
1639
- var previous_reaction = active_reaction;
1640
- var previous_ctx = component_context;
1641
- set_active_effect(this.#effect);
1642
- set_active_reaction(this.#effect);
1643
- set_component_context(this.#effect.ctx);
1644
- try {
1645
- return fn();
1646
- } catch (e) {
1647
- handle_error(e);
1648
- return null;
1649
- } finally {
1650
- set_active_effect(previous_effect);
1651
- set_active_reaction(previous_reaction);
1652
- set_component_context(previous_ctx);
1653
- }
1654
- }
1655
- #show_pending_snippet() {
1656
- const pending = (
1657
- /** @type {(anchor: Node) => void} */
1658
- this.#props.pending
1659
- );
1660
- if (this.#main_effect !== null) {
1661
- this.#offscreen_fragment = document.createDocumentFragment();
1662
- this.#offscreen_fragment.append(
1663
- /** @type {TemplateNode} */
1664
- this.#pending_anchor
1665
- );
1666
- move_effect(this.#main_effect, this.#offscreen_fragment);
1667
- }
1668
- if (this.#pending_effect === null) {
1669
- this.#pending_effect = branch(() => pending(this.#anchor));
1670
- }
1671
- }
1672
- /**
1673
- * Updates the pending count associated with the currently visible pending snippet,
1674
- * if any, such that we can replace the snippet with content once work is done
1675
- * @param {1 | -1} d
1676
- */
1677
- #update_pending_count(d) {
1678
- if (!this.has_pending_snippet()) {
1679
- if (this.parent) {
1680
- this.parent.#update_pending_count(d);
1681
- }
1682
- return;
1683
- }
1684
- this.#pending_count += d;
1685
- if (this.#pending_count === 0) {
1686
- this.is_pending = false;
1687
- for (const e of this.#dirty_effects) {
1688
- set_signal_status(e, DIRTY);
1689
- schedule_effect(e);
1690
- }
1691
- for (const e of this.#maybe_dirty_effects) {
1692
- set_signal_status(e, MAYBE_DIRTY);
1693
- schedule_effect(e);
1694
- }
1695
- this.#dirty_effects.clear();
1696
- this.#maybe_dirty_effects.clear();
1697
- if (this.#pending_effect) {
1698
- pause_effect(this.#pending_effect, () => {
1699
- this.#pending_effect = null;
1700
- });
1701
- }
1702
- if (this.#offscreen_fragment) {
1703
- this.#anchor.before(this.#offscreen_fragment);
1704
- this.#offscreen_fragment = null;
1705
- }
1706
- }
1707
- }
1708
- /**
1709
- * Update the source that powers `$effect.pending()` inside this boundary,
1710
- * and controls when the current `pending` snippet (if any) is removed.
1711
- * Do not call from inside the class
1712
- * @param {1 | -1} d
1713
- */
1714
- update_pending_count(d) {
1715
- this.#update_pending_count(d);
1716
- this.#local_pending_count += d;
1717
- if (this.#effect_pending) {
1718
- internal_set(this.#effect_pending, this.#local_pending_count);
1719
- }
1720
- }
1721
- get_effect_pending() {
1722
- this.#effect_pending_subscriber();
1723
- return get(
1724
- /** @type {Source<number>} */
1725
- this.#effect_pending
1726
- );
1727
- }
1728
- /** @param {unknown} error */
1729
- error(error) {
1730
- var onerror = this.#props.onerror;
1731
- let failed = this.#props.failed;
1732
- if (this.#is_creating_fallback || !onerror && !failed) {
1733
- throw error;
1734
- }
1735
- if (this.#main_effect) {
1736
- destroy_effect(this.#main_effect);
1737
- this.#main_effect = null;
1738
- }
1739
- if (this.#pending_effect) {
1740
- destroy_effect(this.#pending_effect);
1741
- this.#pending_effect = null;
1742
- }
1743
- if (this.#failed_effect) {
1744
- destroy_effect(this.#failed_effect);
1745
- this.#failed_effect = null;
1746
- }
1747
- if (hydrating) {
1748
- set_hydrate_node(
1749
- /** @type {TemplateNode} */
1750
- this.#hydrate_open
1751
- );
1752
- next();
1753
- set_hydrate_node(skip_nodes());
1754
- }
1755
- var did_reset = false;
1756
- var calling_on_error = false;
1757
- const reset = () => {
1758
- if (did_reset) {
1759
- svelte_boundary_reset_noop();
1760
- return;
1761
- }
1762
- did_reset = true;
1763
- if (calling_on_error) {
1764
- svelte_boundary_reset_onerror();
1765
- }
1766
- Batch.ensure();
1767
- this.#local_pending_count = 0;
1768
- if (this.#failed_effect !== null) {
1769
- pause_effect(this.#failed_effect, () => {
1770
- this.#failed_effect = null;
1771
- });
1772
- }
1773
- this.is_pending = this.has_pending_snippet();
1774
- this.#main_effect = this.#run(() => {
1775
- this.#is_creating_fallback = false;
1776
- return branch(() => this.#children(this.#anchor));
1777
- });
1778
- if (this.#pending_count > 0) {
1779
- this.#show_pending_snippet();
1780
- } else {
1781
- this.is_pending = false;
1782
- }
1783
- };
1784
- var previous_reaction = active_reaction;
1785
- try {
1786
- set_active_reaction(null);
1787
- calling_on_error = true;
1788
- onerror?.(error, reset);
1789
- calling_on_error = false;
1790
- } catch (error2) {
1791
- invoke_error_boundary(error2, this.#effect && this.#effect.parent);
1792
- } finally {
1793
- set_active_reaction(previous_reaction);
1794
- }
1795
- if (failed) {
1796
- queue_micro_task(() => {
1797
- this.#failed_effect = this.#run(() => {
1798
- Batch.ensure();
1799
- this.#is_creating_fallback = true;
1800
- try {
1801
- return branch(() => {
1802
- failed(
1803
- this.#anchor,
1804
- () => error,
1805
- () => reset
1806
- );
1807
- });
1808
- } catch (error2) {
1809
- invoke_error_boundary(
1810
- error2,
1811
- /** @type {Effect} */
1812
- this.#effect.parent
1813
- );
1814
- return null;
1815
- } finally {
1816
- this.#is_creating_fallback = false;
1817
- }
1818
- });
1819
- });
1820
- }
1821
- }
1822
- }
1823
- function destroy_derived_effects(derived) {
1824
- var effects = derived.effects;
1825
- if (effects !== null) {
1826
- derived.effects = null;
1827
- for (var i = 0; i < effects.length; i += 1) {
1828
- destroy_effect(
1829
- /** @type {Effect} */
1830
- effects[i]
1831
- );
1832
- }
1833
- }
1834
- }
1835
- function get_derived_parent_effect(derived) {
1836
- var parent = derived.parent;
1837
- while (parent !== null) {
1838
- if ((parent.f & DERIVED) === 0) {
1839
- return (parent.f & DESTROYED) === 0 ? (
1840
- /** @type {Effect} */
1841
- parent
1842
- ) : null;
1843
- }
1844
- parent = parent.parent;
1845
- }
1846
- return null;
1847
- }
1848
- function execute_derived(derived) {
1849
- var value;
1850
- var prev_active_effect = active_effect;
1851
- set_active_effect(get_derived_parent_effect(derived));
1852
- {
1853
- try {
1854
- derived.f &= ~WAS_MARKED;
1855
- destroy_derived_effects(derived);
1856
- value = update_reaction(derived);
1857
- } finally {
1858
- set_active_effect(prev_active_effect);
1859
- }
1860
- }
1861
- return value;
1862
- }
1863
- function update_derived(derived) {
1864
- var value = execute_derived(derived);
1865
- if (!derived.equals(value)) {
1866
- derived.wv = increment_write_version();
1867
- if (!current_batch?.is_fork || derived.deps === null) {
1868
- derived.v = value;
1869
- if (derived.deps === null) {
1870
- set_signal_status(derived, CLEAN);
1871
- return;
1872
- }
1873
- }
1874
- }
1875
- if (is_destroying_effect) {
1876
- return;
1877
- }
1878
- if (batch_values !== null) {
1879
- if (effect_tracking() || current_batch?.is_fork) {
1880
- batch_values.set(derived, value);
1881
- }
1882
- } else {
1883
- update_derived_status(derived);
1884
- }
1885
- }
1886
- let eager_effects = /* @__PURE__ */ new Set();
1887
- const old_values = /* @__PURE__ */ new Map();
1888
- let eager_effects_deferred = false;
1889
- function source(v, stack) {
1890
- var signal = {
1891
- f: 0,
1892
- // TODO ideally we could skip this altogether, but it causes type errors
1893
- v,
1894
- reactions: null,
1895
- equals,
1896
- rv: 0,
1897
- wv: 0
1898
- };
1899
- return signal;
1900
- }
1901
- // @__NO_SIDE_EFFECTS__
1902
- function state(v, stack) {
1903
- const s = source(v);
1904
- push_reaction_value(s);
1905
- return s;
1906
- }
1907
- // @__NO_SIDE_EFFECTS__
1908
- function mutable_source(initial_value, immutable = false, trackable = true) {
1909
- const s = source(initial_value);
1910
- if (!immutable) {
1911
- s.equals = safe_equals;
1912
- }
1913
- return s;
1914
- }
1915
- function set(source2, value, should_proxy = false) {
1916
- if (active_reaction !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
1917
- // to ensure we error if state is set inside an inspect effect
1918
- (!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 && !current_sources?.includes(source2)) {
1919
- state_unsafe_mutation();
1920
- }
1921
- let new_value = should_proxy ? proxy(value) : value;
1922
- return internal_set(source2, new_value);
1923
- }
1924
- function internal_set(source2, value) {
1925
- if (!source2.equals(value)) {
1926
- var old_value = source2.v;
1927
- if (is_destroying_effect) {
1928
- old_values.set(source2, value);
1929
- } else {
1930
- old_values.set(source2, old_value);
1931
- }
1932
- source2.v = value;
1933
- var batch = Batch.ensure();
1934
- batch.capture(source2, old_value);
1935
- if ((source2.f & DERIVED) !== 0) {
1936
- const derived = (
1937
- /** @type {Derived} */
1938
- source2
1939
- );
1940
- if ((source2.f & DIRTY) !== 0) {
1941
- execute_derived(derived);
1942
- }
1943
- update_derived_status(derived);
1944
- }
1945
- source2.wv = increment_write_version();
1946
- mark_reactions(source2, DIRTY);
1947
- if (active_effect !== null && (active_effect.f & CLEAN) !== 0 && (active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0) {
1948
- if (untracked_writes === null) {
1949
- set_untracked_writes([source2]);
1950
- } else {
1951
- untracked_writes.push(source2);
1952
- }
1953
- }
1954
- if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) {
1955
- flush_eager_effects();
1956
- }
1957
- }
1958
- return value;
1959
- }
1960
- function flush_eager_effects() {
1961
- eager_effects_deferred = false;
1962
- var prev_is_updating_effect = is_updating_effect;
1963
- set_is_updating_effect(true);
1964
- const inspects = Array.from(eager_effects);
1965
- try {
1966
- for (const effect of inspects) {
1967
- if ((effect.f & CLEAN) !== 0) {
1968
- set_signal_status(effect, MAYBE_DIRTY);
1969
- }
1970
- if (is_dirty(effect)) {
1971
- update_effect(effect);
1972
- }
1973
- }
1974
- } finally {
1975
- set_is_updating_effect(prev_is_updating_effect);
1976
- }
1977
- eager_effects.clear();
1978
- }
1979
- function increment(source2) {
1980
- set(source2, source2.v + 1);
1981
- }
1982
- function mark_reactions(signal, status) {
1983
- var reactions = signal.reactions;
1984
- if (reactions === null) return;
1985
- var length = reactions.length;
1986
- for (var i = 0; i < length; i++) {
1987
- var reaction = reactions[i];
1988
- var flags2 = reaction.f;
1989
- var not_dirty = (flags2 & DIRTY) === 0;
1990
- if (not_dirty) {
1991
- set_signal_status(reaction, status);
1992
- }
1993
- if ((flags2 & DERIVED) !== 0) {
1994
- var derived = (
1995
- /** @type {Derived} */
1996
- reaction
1997
- );
1998
- batch_values?.delete(derived);
1999
- if ((flags2 & WAS_MARKED) === 0) {
2000
- if (flags2 & CONNECTED) {
2001
- reaction.f |= WAS_MARKED;
2002
- }
2003
- mark_reactions(derived, MAYBE_DIRTY);
2004
- }
2005
- } else if (not_dirty) {
2006
- if ((flags2 & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {
2007
- eager_block_effects.add(
2008
- /** @type {Effect} */
2009
- reaction
2010
- );
2011
- }
2012
- schedule_effect(
2013
- /** @type {Effect} */
2014
- reaction
2015
- );
2016
- }
2017
- }
2018
- }
2019
- function proxy(value) {
2020
- if (typeof value !== "object" || value === null || STATE_SYMBOL in value) {
2021
- return value;
2022
- }
2023
- const prototype = get_prototype_of(value);
2024
- if (prototype !== object_prototype && prototype !== array_prototype) {
2025
- return value;
2026
- }
2027
- var sources = /* @__PURE__ */ new Map();
2028
- var is_proxied_array = is_array(value);
2029
- var version = /* @__PURE__ */ state(0);
2030
- var parent_version = update_version;
2031
- var with_parent = (fn) => {
2032
- if (update_version === parent_version) {
2033
- return fn();
2034
- }
2035
- var reaction = active_reaction;
2036
- var version2 = update_version;
2037
- set_active_reaction(null);
2038
- set_update_version(parent_version);
2039
- var result = fn();
2040
- set_active_reaction(reaction);
2041
- set_update_version(version2);
2042
- return result;
2043
- };
2044
- if (is_proxied_array) {
2045
- sources.set("length", /* @__PURE__ */ state(
2046
- /** @type {any[]} */
2047
- value.length
2048
- ));
2049
- }
2050
- return new Proxy(
2051
- /** @type {any} */
2052
- value,
2053
- {
2054
- defineProperty(_, prop, descriptor) {
2055
- if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) {
2056
- state_descriptors_fixed();
2057
- }
2058
- var s = sources.get(prop);
2059
- if (s === void 0) {
2060
- s = with_parent(() => {
2061
- var s2 = /* @__PURE__ */ state(descriptor.value);
2062
- sources.set(prop, s2);
2063
- return s2;
2064
- });
2065
- } else {
2066
- set(s, descriptor.value, true);
2067
- }
2068
- return true;
2069
- },
2070
- deleteProperty(target, prop) {
2071
- var s = sources.get(prop);
2072
- if (s === void 0) {
2073
- if (prop in target) {
2074
- const s2 = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED));
2075
- sources.set(prop, s2);
2076
- increment(version);
2077
- }
2078
- } else {
2079
- set(s, UNINITIALIZED);
2080
- increment(version);
2081
- }
2082
- return true;
2083
- },
2084
- get(target, prop, receiver) {
2085
- if (prop === STATE_SYMBOL) {
2086
- return value;
2087
- }
2088
- var s = sources.get(prop);
2089
- var exists = prop in target;
2090
- if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
2091
- s = with_parent(() => {
2092
- var p = proxy(exists ? target[prop] : UNINITIALIZED);
2093
- var s2 = /* @__PURE__ */ state(p);
2094
- return s2;
2095
- });
2096
- sources.set(prop, s);
2097
- }
2098
- if (s !== void 0) {
2099
- var v = get(s);
2100
- return v === UNINITIALIZED ? void 0 : v;
2101
- }
2102
- return Reflect.get(target, prop, receiver);
2103
- },
2104
- getOwnPropertyDescriptor(target, prop) {
2105
- var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
2106
- if (descriptor && "value" in descriptor) {
2107
- var s = sources.get(prop);
2108
- if (s) descriptor.value = get(s);
2109
- } else if (descriptor === void 0) {
2110
- var source2 = sources.get(prop);
2111
- var value2 = source2?.v;
2112
- if (source2 !== void 0 && value2 !== UNINITIALIZED) {
2113
- return {
2114
- enumerable: true,
2115
- configurable: true,
2116
- value: value2,
2117
- writable: true
2118
- };
2119
- }
2120
- }
2121
- return descriptor;
2122
- },
2123
- has(target, prop) {
2124
- if (prop === STATE_SYMBOL) {
2125
- return true;
2126
- }
2127
- var s = sources.get(prop);
2128
- var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
2129
- if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
2130
- if (s === void 0) {
2131
- s = with_parent(() => {
2132
- var p = has ? proxy(target[prop]) : UNINITIALIZED;
2133
- var s2 = /* @__PURE__ */ state(p);
2134
- return s2;
2135
- });
2136
- sources.set(prop, s);
2137
- }
2138
- var value2 = get(s);
2139
- if (value2 === UNINITIALIZED) {
2140
- return false;
2141
- }
2142
- }
2143
- return has;
2144
- },
2145
- set(target, prop, value2, receiver) {
2146
- var s = sources.get(prop);
2147
- var has = prop in target;
2148
- if (is_proxied_array && prop === "length") {
2149
- for (var i = value2; i < /** @type {Source<number>} */
2150
- s.v; i += 1) {
2151
- var other_s = sources.get(i + "");
2152
- if (other_s !== void 0) {
2153
- set(other_s, UNINITIALIZED);
2154
- } else if (i in target) {
2155
- other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED));
2156
- sources.set(i + "", other_s);
2157
- }
2158
- }
2159
- }
2160
- if (s === void 0) {
2161
- if (!has || get_descriptor(target, prop)?.writable) {
2162
- s = with_parent(() => /* @__PURE__ */ state(void 0));
2163
- set(s, proxy(value2));
2164
- sources.set(prop, s);
2165
- }
2166
- } else {
2167
- has = s.v !== UNINITIALIZED;
2168
- var p = with_parent(() => proxy(value2));
2169
- set(s, p);
2170
- }
2171
- var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
2172
- if (descriptor?.set) {
2173
- descriptor.set.call(receiver, value2);
2174
- }
2175
- if (!has) {
2176
- if (is_proxied_array && typeof prop === "string") {
2177
- var ls = (
2178
- /** @type {Source<number>} */
2179
- sources.get("length")
2180
- );
2181
- var n = Number(prop);
2182
- if (Number.isInteger(n) && n >= ls.v) {
2183
- set(ls, n + 1);
2184
- }
2185
- }
2186
- increment(version);
2187
- }
2188
- return true;
2189
- },
2190
- ownKeys(target) {
2191
- get(version);
2192
- var own_keys = Reflect.ownKeys(target).filter((key2) => {
2193
- var source3 = sources.get(key2);
2194
- return source3 === void 0 || source3.v !== UNINITIALIZED;
2195
- });
2196
- for (var [key, source2] of sources) {
2197
- if (source2.v !== UNINITIALIZED && !(key in target)) {
2198
- own_keys.push(key);
2199
- }
2200
- }
2201
- return own_keys;
2202
- },
2203
- setPrototypeOf() {
2204
- state_prototype_fixed();
2205
- }
2206
- }
2207
- );
2208
- }
2209
- var $window;
2210
- var first_child_getter;
2211
- var next_sibling_getter;
2212
- function init_operations() {
2213
- if ($window !== void 0) {
2214
- return;
2215
- }
2216
- $window = window;
2217
- var element_prototype = Element.prototype;
2218
- var node_prototype = Node.prototype;
2219
- var text_prototype = Text.prototype;
2220
- first_child_getter = get_descriptor(node_prototype, "firstChild").get;
2221
- next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
2222
- if (is_extensible(element_prototype)) {
2223
- element_prototype.__click = void 0;
2224
- element_prototype.__className = void 0;
2225
- element_prototype.__attributes = null;
2226
- element_prototype.__style = void 0;
2227
- element_prototype.__e = void 0;
2228
- }
2229
- if (is_extensible(text_prototype)) {
2230
- text_prototype.__t = void 0;
2231
- }
2232
- }
2233
- function create_text(value = "") {
2234
- return document.createTextNode(value);
2235
- }
2236
- // @__NO_SIDE_EFFECTS__
2237
- function get_first_child(node) {
2238
- return (
2239
- /** @type {TemplateNode | null} */
2240
- first_child_getter.call(node)
2241
- );
2242
- }
2243
- // @__NO_SIDE_EFFECTS__
2244
- function get_next_sibling(node) {
2245
- return (
2246
- /** @type {TemplateNode | null} */
2247
- next_sibling_getter.call(node)
2248
- );
2249
- }
2250
- function clear_text_content(node) {
2251
- node.textContent = "";
2252
- }
2253
- function without_reactive_context(fn) {
2254
- var previous_reaction = active_reaction;
2255
- var previous_effect = active_effect;
2256
- set_active_reaction(null);
2257
- set_active_effect(null);
2258
- try {
2259
- return fn();
2260
- } finally {
2261
- set_active_reaction(previous_reaction);
2262
- set_active_effect(previous_effect);
2263
- }
2264
- }
2265
- function push_effect(effect, parent_effect) {
2266
- var parent_last = parent_effect.last;
2267
- if (parent_last === null) {
2268
- parent_effect.last = parent_effect.first = effect;
2269
- } else {
2270
- parent_last.next = effect;
2271
- effect.prev = parent_last;
2272
- parent_effect.last = effect;
2273
- }
2274
- }
2275
- function create_effect(type, fn, sync) {
2276
- var parent = active_effect;
2277
- if (parent !== null && (parent.f & INERT) !== 0) {
2278
- type |= INERT;
2279
- }
2280
- var effect = {
2281
- ctx: component_context,
2282
- deps: null,
2283
- nodes: null,
2284
- f: type | DIRTY | CONNECTED,
2285
- first: null,
2286
- fn,
2287
- last: null,
2288
- next: null,
2289
- parent,
2290
- b: parent && parent.b,
2291
- prev: null,
2292
- teardown: null,
2293
- wv: 0,
2294
- ac: null
2295
- };
2296
- if (sync) {
2297
- try {
2298
- update_effect(effect);
2299
- effect.f |= EFFECT_RAN;
2300
- } catch (e2) {
2301
- destroy_effect(effect);
2302
- throw e2;
2303
- }
2304
- } else if (fn !== null) {
2305
- schedule_effect(effect);
2306
- }
2307
- var e = effect;
2308
- if (sync && e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && // either `null`, or a singular child
2309
- (e.f & EFFECT_PRESERVED) === 0) {
2310
- e = e.first;
2311
- if ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {
2312
- e.f |= EFFECT_TRANSPARENT;
2313
- }
2314
- }
2315
- if (e !== null) {
2316
- e.parent = parent;
2317
- if (parent !== null) {
2318
- push_effect(e, parent);
2319
- }
2320
- if (active_reaction !== null && (active_reaction.f & DERIVED) !== 0 && (type & ROOT_EFFECT) === 0) {
2321
- var derived = (
2322
- /** @type {Derived} */
2323
- active_reaction
2324
- );
2325
- (derived.effects ??= []).push(e);
2326
- }
2327
- }
2328
- return effect;
2329
- }
2330
- function effect_tracking() {
2331
- return active_reaction !== null && !untracking;
2332
- }
2333
- function create_user_effect(fn) {
2334
- return create_effect(EFFECT | USER_EFFECT, fn, false);
2335
- }
2336
- function component_root(fn) {
2337
- Batch.ensure();
2338
- const effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn, true);
2339
- return (options2 = {}) => {
2340
- return new Promise((fulfil) => {
2341
- if (options2.outro) {
2342
- pause_effect(effect, () => {
2343
- destroy_effect(effect);
2344
- fulfil(void 0);
2345
- });
2346
- } else {
2347
- destroy_effect(effect);
2348
- fulfil(void 0);
2349
- }
2350
- });
2351
- };
2352
- }
2353
- function render_effect(fn, flags2 = 0) {
2354
- return create_effect(RENDER_EFFECT | flags2, fn, true);
2355
- }
2356
- function block(fn, flags2 = 0) {
2357
- var effect = create_effect(BLOCK_EFFECT | flags2, fn, true);
2358
- return effect;
2359
- }
2360
- function branch(fn) {
2361
- return create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn, true);
2362
- }
2363
- function execute_effect_teardown(effect) {
2364
- var teardown = effect.teardown;
2365
- if (teardown !== null) {
2366
- const previously_destroying_effect = is_destroying_effect;
2367
- const previous_reaction = active_reaction;
2368
- set_is_destroying_effect(true);
2369
- set_active_reaction(null);
2370
- try {
2371
- teardown.call(null);
2372
- } finally {
2373
- set_is_destroying_effect(previously_destroying_effect);
2374
- set_active_reaction(previous_reaction);
2375
- }
2376
- }
2377
- }
2378
- function destroy_effect_children(signal, remove_dom = false) {
2379
- var effect = signal.first;
2380
- signal.first = signal.last = null;
2381
- while (effect !== null) {
2382
- const controller = effect.ac;
2383
- if (controller !== null) {
2384
- without_reactive_context(() => {
2385
- controller.abort(STALE_REACTION);
2386
- });
2387
- }
2388
- var next2 = effect.next;
2389
- if ((effect.f & ROOT_EFFECT) !== 0) {
2390
- effect.parent = null;
2391
- } else {
2392
- destroy_effect(effect, remove_dom);
2393
- }
2394
- effect = next2;
2395
- }
2396
- }
2397
- function destroy_block_effect_children(signal) {
2398
- var effect = signal.first;
2399
- while (effect !== null) {
2400
- var next2 = effect.next;
2401
- if ((effect.f & BRANCH_EFFECT) === 0) {
2402
- destroy_effect(effect);
2403
- }
2404
- effect = next2;
2405
- }
2406
- }
2407
- function destroy_effect(effect, remove_dom = true) {
2408
- var removed = false;
2409
- if ((remove_dom || (effect.f & HEAD_EFFECT) !== 0) && effect.nodes !== null && effect.nodes.end !== null) {
2410
- remove_effect_dom(
2411
- effect.nodes.start,
2412
- /** @type {TemplateNode} */
2413
- effect.nodes.end
2414
- );
2415
- removed = true;
2416
- }
2417
- destroy_effect_children(effect, remove_dom && !removed);
2418
- remove_reactions(effect, 0);
2419
- set_signal_status(effect, DESTROYED);
2420
- var transitions = effect.nodes && effect.nodes.t;
2421
- if (transitions !== null) {
2422
- for (const transition of transitions) {
2423
- transition.stop();
2424
- }
2425
- }
2426
- execute_effect_teardown(effect);
2427
- var parent = effect.parent;
2428
- if (parent !== null && parent.first !== null) {
2429
- unlink_effect(effect);
2430
- }
2431
- effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = null;
2432
- }
2433
- function remove_effect_dom(node, end) {
2434
- while (node !== null) {
2435
- var next2 = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
2436
- node.remove();
2437
- node = next2;
2438
- }
2439
- }
2440
- function unlink_effect(effect) {
2441
- var parent = effect.parent;
2442
- var prev = effect.prev;
2443
- var next2 = effect.next;
2444
- if (prev !== null) prev.next = next2;
2445
- if (next2 !== null) next2.prev = prev;
2446
- if (parent !== null) {
2447
- if (parent.first === effect) parent.first = next2;
2448
- if (parent.last === effect) parent.last = prev;
2449
- }
2450
- }
2451
- function pause_effect(effect, callback, destroy = true) {
2452
- var transitions = [];
2453
- pause_children(effect, transitions, true);
2454
- var fn = () => {
2455
- if (destroy) destroy_effect(effect);
2456
- if (callback) callback();
2457
- };
2458
- var remaining = transitions.length;
2459
- if (remaining > 0) {
2460
- var check = () => --remaining || fn();
2461
- for (var transition of transitions) {
2462
- transition.out(check);
2463
- }
2464
- } else {
2465
- fn();
2466
- }
2467
- }
2468
- function pause_children(effect, transitions, local) {
2469
- if ((effect.f & INERT) !== 0) return;
2470
- effect.f ^= INERT;
2471
- var t = effect.nodes && effect.nodes.t;
2472
- if (t !== null) {
2473
- for (const transition of t) {
2474
- if (transition.is_global || local) {
2475
- transitions.push(transition);
2476
- }
2477
- }
2478
- }
2479
- var child = effect.first;
2480
- while (child !== null) {
2481
- var sibling = child.next;
2482
- var transparent = (child.f & EFFECT_TRANSPARENT) !== 0 || // If this is a branch effect without a block effect parent,
2483
- // it means the parent block effect was pruned. In that case,
2484
- // transparency information was transferred to the branch effect.
2485
- (child.f & BRANCH_EFFECT) !== 0 && (effect.f & BLOCK_EFFECT) !== 0;
2486
- pause_children(child, transitions, transparent ? local : false);
2487
- child = sibling;
2488
- }
2489
- }
2490
- function move_effect(effect, fragment) {
2491
- if (!effect.nodes) return;
2492
- var node = effect.nodes.start;
2493
- var end = effect.nodes.end;
2494
- while (node !== null) {
2495
- var next2 = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
2496
- fragment.append(node);
2497
- node = next2;
2498
- }
2499
- }
2500
- let is_updating_effect = false;
2501
- function set_is_updating_effect(value) {
2502
- is_updating_effect = value;
2503
- }
2504
- let is_destroying_effect = false;
2505
- function set_is_destroying_effect(value) {
2506
- is_destroying_effect = value;
2507
- }
2508
- let active_reaction = null;
2509
- let untracking = false;
2510
- function set_active_reaction(reaction) {
2511
- active_reaction = reaction;
2512
- }
2513
- let active_effect = null;
2514
- function set_active_effect(effect) {
2515
- active_effect = effect;
2516
- }
2517
- let current_sources = null;
2518
- function push_reaction_value(value) {
2519
- if (active_reaction !== null && true) {
2520
- if (current_sources === null) {
2521
- current_sources = [value];
2522
- } else {
2523
- current_sources.push(value);
2524
- }
2525
- }
2526
- }
2527
- let new_deps = null;
2528
- let skipped_deps = 0;
2529
- let untracked_writes = null;
2530
- function set_untracked_writes(value) {
2531
- untracked_writes = value;
2532
- }
2533
- let write_version = 1;
2534
- let read_version = 0;
2535
- let update_version = read_version;
2536
- function set_update_version(value) {
2537
- update_version = value;
2538
- }
2539
- function increment_write_version() {
2540
- return ++write_version;
2541
- }
2542
- function is_dirty(reaction) {
2543
- var flags2 = reaction.f;
2544
- if ((flags2 & DIRTY) !== 0) {
2545
- return true;
2546
- }
2547
- if (flags2 & DERIVED) {
2548
- reaction.f &= ~WAS_MARKED;
2549
- }
2550
- if ((flags2 & MAYBE_DIRTY) !== 0) {
2551
- var dependencies = (
2552
- /** @type {Value[]} */
2553
- reaction.deps
2554
- );
2555
- var length = dependencies.length;
2556
- for (var i = 0; i < length; i++) {
2557
- var dependency = dependencies[i];
2558
- if (is_dirty(
2559
- /** @type {Derived} */
2560
- dependency
2561
- )) {
2562
- update_derived(
2563
- /** @type {Derived} */
2564
- dependency
2565
- );
2566
- }
2567
- if (dependency.wv > reaction.wv) {
2568
- return true;
2569
- }
2570
- }
2571
- if ((flags2 & CONNECTED) !== 0 && // During time traveling we don't want to reset the status so that
2572
- // traversal of the graph in the other batches still happens
2573
- batch_values === null) {
2574
- set_signal_status(reaction, CLEAN);
2575
- }
2576
- }
2577
- return false;
2578
- }
2579
- function schedule_possible_effect_self_invalidation(signal, effect, root2 = true) {
2580
- var reactions = signal.reactions;
2581
- if (reactions === null) return;
2582
- if (current_sources?.includes(signal)) {
2583
- return;
2584
- }
2585
- for (var i = 0; i < reactions.length; i++) {
2586
- var reaction = reactions[i];
2587
- if ((reaction.f & DERIVED) !== 0) {
2588
- schedule_possible_effect_self_invalidation(
2589
- /** @type {Derived} */
2590
- reaction,
2591
- effect,
2592
- false
2593
- );
2594
- } else if (effect === reaction) {
2595
- if (root2) {
2596
- set_signal_status(reaction, DIRTY);
2597
- } else if ((reaction.f & CLEAN) !== 0) {
2598
- set_signal_status(reaction, MAYBE_DIRTY);
2599
- }
2600
- schedule_effect(
2601
- /** @type {Effect} */
2602
- reaction
2603
- );
2604
- }
2605
- }
2606
- }
2607
- function update_reaction(reaction) {
2608
- var previous_deps = new_deps;
2609
- var previous_skipped_deps = skipped_deps;
2610
- var previous_untracked_writes = untracked_writes;
2611
- var previous_reaction = active_reaction;
2612
- var previous_sources = current_sources;
2613
- var previous_component_context = component_context;
2614
- var previous_untracking = untracking;
2615
- var previous_update_version = update_version;
2616
- var flags2 = reaction.f;
2617
- new_deps = /** @type {null | Value[]} */
2618
- null;
2619
- skipped_deps = 0;
2620
- untracked_writes = null;
2621
- active_reaction = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;
2622
- current_sources = null;
2623
- set_component_context(reaction.ctx);
2624
- untracking = false;
2625
- update_version = ++read_version;
2626
- if (reaction.ac !== null) {
2627
- without_reactive_context(() => {
2628
- reaction.ac.abort(STALE_REACTION);
2629
- });
2630
- reaction.ac = null;
2631
- }
2632
- try {
2633
- reaction.f |= REACTION_IS_UPDATING;
2634
- var fn = (
2635
- /** @type {Function} */
2636
- reaction.fn
2637
- );
2638
- var result = fn();
2639
- var deps = reaction.deps;
2640
- if (new_deps !== null) {
2641
- var i;
2642
- remove_reactions(reaction, skipped_deps);
2643
- if (deps !== null && skipped_deps > 0) {
2644
- deps.length = skipped_deps + new_deps.length;
2645
- for (i = 0; i < new_deps.length; i++) {
2646
- deps[skipped_deps + i] = new_deps[i];
2647
- }
2648
- } else {
2649
- reaction.deps = deps = new_deps;
2650
- }
2651
- if (effect_tracking() && (reaction.f & CONNECTED) !== 0) {
2652
- for (i = skipped_deps; i < deps.length; i++) {
2653
- (deps[i].reactions ??= []).push(reaction);
2654
- }
2655
- }
2656
- } else if (deps !== null && skipped_deps < deps.length) {
2657
- remove_reactions(reaction, skipped_deps);
2658
- deps.length = skipped_deps;
2659
- }
2660
- if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0) {
2661
- for (i = 0; i < /** @type {Source[]} */
2662
- untracked_writes.length; i++) {
2663
- schedule_possible_effect_self_invalidation(
2664
- untracked_writes[i],
2665
- /** @type {Effect} */
2666
- reaction
2667
- );
2668
- }
2669
- }
2670
- if (previous_reaction !== null && previous_reaction !== reaction) {
2671
- read_version++;
2672
- if (previous_reaction.deps !== null) {
2673
- for (let i2 = 0; i2 < previous_skipped_deps; i2 += 1) {
2674
- previous_reaction.deps[i2].rv = read_version;
2675
- }
2676
- }
2677
- if (previous_deps !== null) {
2678
- for (const dep of previous_deps) {
2679
- dep.rv = read_version;
2680
- }
2681
- }
2682
- if (untracked_writes !== null) {
2683
- if (previous_untracked_writes === null) {
2684
- previous_untracked_writes = untracked_writes;
2685
- } else {
2686
- previous_untracked_writes.push(.../** @type {Source[]} */
2687
- untracked_writes);
2688
- }
2689
- }
2690
- }
2691
- if ((reaction.f & ERROR_VALUE) !== 0) {
2692
- reaction.f ^= ERROR_VALUE;
2693
- }
2694
- return result;
2695
- } catch (error) {
2696
- return handle_error(error);
2697
- } finally {
2698
- reaction.f ^= REACTION_IS_UPDATING;
2699
- new_deps = previous_deps;
2700
- skipped_deps = previous_skipped_deps;
2701
- untracked_writes = previous_untracked_writes;
2702
- active_reaction = previous_reaction;
2703
- current_sources = previous_sources;
2704
- set_component_context(previous_component_context);
2705
- untracking = previous_untracking;
2706
- update_version = previous_update_version;
2707
- }
2708
- }
2709
- function remove_reaction(signal, dependency) {
2710
- let reactions = dependency.reactions;
2711
- if (reactions !== null) {
2712
- var index = index_of.call(reactions, signal);
2713
- if (index !== -1) {
2714
- var new_length = reactions.length - 1;
2715
- if (new_length === 0) {
2716
- reactions = dependency.reactions = null;
2717
- } else {
2718
- reactions[index] = reactions[new_length];
2719
- reactions.pop();
2720
- }
2721
- }
2722
- }
2723
- if (reactions === null && (dependency.f & DERIVED) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
2724
- // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
2725
- // allows us to skip the expensive work of disconnecting and immediately reconnecting it
2726
- (new_deps === null || !new_deps.includes(dependency))) {
2727
- var derived = (
2728
- /** @type {Derived} */
2729
- dependency
2730
- );
2731
- if ((derived.f & CONNECTED) !== 0) {
2732
- derived.f ^= CONNECTED;
2733
- derived.f &= ~WAS_MARKED;
2734
- }
2735
- update_derived_status(derived);
2736
- destroy_derived_effects(derived);
2737
- remove_reactions(derived, 0);
2738
- }
2739
- }
2740
- function remove_reactions(signal, start_index) {
2741
- var dependencies = signal.deps;
2742
- if (dependencies === null) return;
2743
- for (var i = start_index; i < dependencies.length; i++) {
2744
- remove_reaction(signal, dependencies[i]);
2745
- }
2746
- }
2747
- function update_effect(effect) {
2748
- var flags2 = effect.f;
2749
- if ((flags2 & DESTROYED) !== 0) {
2750
- return;
2751
- }
2752
- set_signal_status(effect, CLEAN);
2753
- var previous_effect = active_effect;
2754
- var was_updating_effect = is_updating_effect;
2755
- active_effect = effect;
2756
- is_updating_effect = true;
2757
- try {
2758
- if ((flags2 & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {
2759
- destroy_block_effect_children(effect);
2760
- } else {
2761
- destroy_effect_children(effect);
2762
- }
2763
- execute_effect_teardown(effect);
2764
- var teardown = update_reaction(effect);
2765
- effect.teardown = typeof teardown === "function" ? teardown : null;
2766
- effect.wv = write_version;
2767
- var dep;
2768
- if (BROWSER && tracing_mode_flag && (effect.f & DIRTY) !== 0 && effect.deps !== null) ;
2769
- } finally {
2770
- is_updating_effect = was_updating_effect;
2771
- active_effect = previous_effect;
2772
- }
2773
- }
2774
- function get(signal) {
2775
- var flags2 = signal.f;
2776
- var is_derived = (flags2 & DERIVED) !== 0;
2777
- if (active_reaction !== null && !untracking) {
2778
- var destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;
2779
- if (!destroyed && !current_sources?.includes(signal)) {
2780
- var deps = active_reaction.deps;
2781
- if ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {
2782
- if (signal.rv < read_version) {
2783
- signal.rv = read_version;
2784
- if (new_deps === null && deps !== null && deps[skipped_deps] === signal) {
2785
- skipped_deps++;
2786
- } else if (new_deps === null) {
2787
- new_deps = [signal];
2788
- } else {
2789
- new_deps.push(signal);
2790
- }
2791
- }
2792
- } else {
2793
- (active_reaction.deps ??= []).push(signal);
2794
- var reactions = signal.reactions;
2795
- if (reactions === null) {
2796
- signal.reactions = [active_reaction];
2797
- } else if (!reactions.includes(active_reaction)) {
2798
- reactions.push(active_reaction);
2799
- }
2800
- }
2801
- }
2802
- }
2803
- if (is_destroying_effect && old_values.has(signal)) {
2804
- return old_values.get(signal);
2805
- }
2806
- if (is_derived) {
2807
- var derived = (
2808
- /** @type {Derived} */
2809
- signal
2810
- );
2811
- if (is_destroying_effect) {
2812
- var value = derived.v;
2813
- if ((derived.f & CLEAN) === 0 && derived.reactions !== null || depends_on_old_values(derived)) {
2814
- value = execute_derived(derived);
2815
- }
2816
- old_values.set(derived, value);
2817
- return value;
2818
- }
2819
- var should_connect = (derived.f & CONNECTED) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & CONNECTED) !== 0);
2820
- var is_new = derived.deps === null;
2821
- if (is_dirty(derived)) {
2822
- if (should_connect) {
2823
- derived.f |= CONNECTED;
2824
- }
2825
- update_derived(derived);
2826
- }
2827
- if (should_connect && !is_new) {
2828
- reconnect(derived);
2829
- }
2830
- }
2831
- if (batch_values?.has(signal)) {
2832
- return batch_values.get(signal);
2833
- }
2834
- if ((signal.f & ERROR_VALUE) !== 0) {
2835
- throw signal.v;
2836
- }
2837
- return signal.v;
2838
- }
2839
- function reconnect(derived) {
2840
- if (derived.deps === null) return;
2841
- derived.f |= CONNECTED;
2842
- for (const dep of derived.deps) {
2843
- (dep.reactions ??= []).push(derived);
2844
- if ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {
2845
- reconnect(
2846
- /** @type {Derived} */
2847
- dep
2848
- );
2849
- }
2850
- }
2851
- }
2852
- function depends_on_old_values(derived) {
2853
- if (derived.v === UNINITIALIZED) return true;
2854
- if (derived.deps === null) return false;
2855
- for (const dep of derived.deps) {
2856
- if (old_values.has(dep)) {
2857
- return true;
2858
- }
2859
- if ((dep.f & DERIVED) !== 0 && depends_on_old_values(
2860
- /** @type {Derived} */
2861
- dep
2862
- )) {
2863
- return true;
2864
- }
2865
- }
2866
- return false;
2867
- }
2868
- function untrack(fn) {
2869
- var previous_untracking = untracking;
2870
- try {
2871
- untracking = true;
2872
- return fn();
2873
- } finally {
2874
- untracking = previous_untracking;
2875
- }
2876
- }
2877
- const all_registered_events = /* @__PURE__ */ new Set();
2878
- const root_event_handles = /* @__PURE__ */ new Set();
2879
- let last_propagated_event = null;
2880
- function handle_event_propagation(event) {
2881
- var handler_element = this;
2882
- var owner_document = (
2883
- /** @type {Node} */
2884
- handler_element.ownerDocument
2885
- );
2886
- var event_name = event.type;
2887
- var path = event.composedPath?.() || [];
2888
- var current_target = (
2889
- /** @type {null | Element} */
2890
- path[0] || event.target
2891
- );
2892
- last_propagated_event = event;
2893
- var path_idx = 0;
2894
- var handled_at = last_propagated_event === event && event.__root;
2895
- if (handled_at) {
2896
- var at_idx = path.indexOf(handled_at);
2897
- if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
2898
- window)) {
2899
- event.__root = handler_element;
2900
- return;
2901
- }
2902
- var handler_idx = path.indexOf(handler_element);
2903
- if (handler_idx === -1) {
2904
- return;
2905
- }
2906
- if (at_idx <= handler_idx) {
2907
- path_idx = at_idx;
2908
- }
2909
- }
2910
- current_target = /** @type {Element} */
2911
- path[path_idx] || event.target;
2912
- if (current_target === handler_element) return;
2913
- define_property(event, "currentTarget", {
2914
- configurable: true,
2915
- get() {
2916
- return current_target || owner_document;
2917
- }
2918
- });
2919
- var previous_reaction = active_reaction;
2920
- var previous_effect = active_effect;
2921
- set_active_reaction(null);
2922
- set_active_effect(null);
2923
- try {
2924
- var throw_error;
2925
- var other_errors = [];
2926
- while (current_target !== null) {
2927
- var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */
2928
- current_target.host || null;
2929
- try {
2930
- var delegated = current_target["__" + event_name];
2931
- if (delegated != null && (!/** @type {any} */
2932
- current_target.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
2933
- // -> the target could not have been disabled because it emits the event in the first place
2934
- event.target === current_target)) {
2935
- delegated.call(current_target, event);
2936
- }
2937
- } catch (error) {
2938
- if (throw_error) {
2939
- other_errors.push(error);
2940
- } else {
2941
- throw_error = error;
2942
- }
2943
- }
2944
- if (event.cancelBubble || parent_element === handler_element || parent_element === null) {
2945
- break;
2946
- }
2947
- current_target = parent_element;
2948
- }
2949
- if (throw_error) {
2950
- for (let error of other_errors) {
2951
- queueMicrotask(() => {
2952
- throw error;
2953
- });
2954
- }
2955
- throw throw_error;
2956
- }
2957
- } finally {
2958
- event.__root = handler_element;
2959
- delete event.currentTarget;
2960
- set_active_reaction(previous_reaction);
2961
- set_active_effect(previous_effect);
2962
- }
2963
- }
2964
- function assign_nodes(start, end) {
2965
- var effect = (
2966
- /** @type {Effect} */
2967
- active_effect
2968
- );
2969
- if (effect.nodes === null) {
2970
- effect.nodes = { start, end, a: null, t: null };
2971
- }
2972
- }
2973
- function mount(component, options2) {
2974
- return _mount(component, options2);
2975
- }
2976
- function hydrate(component, options2) {
2977
- init_operations();
2978
- options2.intro = options2.intro ?? false;
2979
- const target = options2.target;
2980
- const was_hydrating = hydrating;
2981
- const previous_hydrate_node = hydrate_node;
2982
- try {
2983
- var anchor = /* @__PURE__ */ get_first_child(target);
2984
- while (anchor && (anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */
2985
- anchor.data !== HYDRATION_START)) {
2986
- anchor = /* @__PURE__ */ get_next_sibling(anchor);
2987
- }
2988
- if (!anchor) {
2989
- throw HYDRATION_ERROR;
2990
- }
2991
- set_hydrating(true);
2992
- set_hydrate_node(
2993
- /** @type {Comment} */
2994
- anchor
2995
- );
2996
- const instance = _mount(component, { ...options2, anchor });
2997
- set_hydrating(false);
2998
- return (
2999
- /** @type {Exports} */
3000
- instance
3001
- );
3002
- } catch (error) {
3003
- if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) {
3004
- throw error;
3005
- }
3006
- if (error !== HYDRATION_ERROR) {
3007
- console.warn("Failed to hydrate: ", error);
3008
- }
3009
- if (options2.recover === false) {
3010
- hydration_failed();
3011
- }
3012
- init_operations();
3013
- clear_text_content(target);
3014
- set_hydrating(false);
3015
- return mount(component, options2);
3016
- } finally {
3017
- set_hydrating(was_hydrating);
3018
- set_hydrate_node(previous_hydrate_node);
3019
- }
3020
- }
3021
- const document_listeners = /* @__PURE__ */ new Map();
3022
- function _mount(Component, { target, anchor, props = {}, events, context, intro = true }) {
3023
- init_operations();
3024
- var registered_events = /* @__PURE__ */ new Set();
3025
- var event_handle = (events2) => {
3026
- for (var i = 0; i < events2.length; i++) {
3027
- var event_name = events2[i];
3028
- if (registered_events.has(event_name)) continue;
3029
- registered_events.add(event_name);
3030
- var passive = is_passive_event(event_name);
3031
- target.addEventListener(event_name, handle_event_propagation, { passive });
3032
- var n = document_listeners.get(event_name);
3033
- if (n === void 0) {
3034
- document.addEventListener(event_name, handle_event_propagation, { passive });
3035
- document_listeners.set(event_name, 1);
3036
- } else {
3037
- document_listeners.set(event_name, n + 1);
3038
- }
3039
- }
3040
- };
3041
- event_handle(array_from(all_registered_events));
3042
- root_event_handles.add(event_handle);
3043
- var component = void 0;
3044
- var unmount2 = component_root(() => {
3045
- var anchor_node = anchor ?? target.appendChild(create_text());
3046
- boundary(
3047
- /** @type {TemplateNode} */
3048
- anchor_node,
3049
- {
3050
- pending: () => {
3051
- }
3052
- },
3053
- (anchor_node2) => {
3054
- if (context) {
3055
- push({});
3056
- var ctx = (
3057
- /** @type {ComponentContext} */
3058
- component_context
3059
- );
3060
- ctx.c = context;
3061
- }
3062
- if (events) {
3063
- props.$$events = events;
3064
- }
3065
- if (hydrating) {
3066
- assign_nodes(
3067
- /** @type {TemplateNode} */
3068
- anchor_node2,
3069
- null
3070
- );
3071
- }
3072
- component = Component(anchor_node2, props) || {};
3073
- if (hydrating) {
3074
- active_effect.nodes.end = hydrate_node;
3075
- if (hydrate_node === null || hydrate_node.nodeType !== COMMENT_NODE || /** @type {Comment} */
3076
- hydrate_node.data !== HYDRATION_END) {
3077
- hydration_mismatch();
3078
- throw HYDRATION_ERROR;
3079
- }
3080
- }
3081
- if (context) {
3082
- pop();
3083
- }
3084
- }
3085
- );
3086
- return () => {
3087
- for (var event_name of registered_events) {
3088
- target.removeEventListener(event_name, handle_event_propagation);
3089
- var n = (
3090
- /** @type {number} */
3091
- document_listeners.get(event_name)
3092
- );
3093
- if (--n === 0) {
3094
- document.removeEventListener(event_name, handle_event_propagation);
3095
- document_listeners.delete(event_name);
3096
- } else {
3097
- document_listeners.set(event_name, n);
3098
- }
3099
- }
3100
- root_event_handles.delete(event_handle);
3101
- if (anchor_node !== anchor) {
3102
- anchor_node.parentNode?.removeChild(anchor_node);
3103
- }
3104
- };
3105
- });
3106
- mounted_components.set(component, unmount2);
3107
- return component;
3108
- }
3109
- let mounted_components = /* @__PURE__ */ new WeakMap();
3110
- function unmount(component, options2) {
3111
- const fn = mounted_components.get(component);
3112
- if (fn) {
3113
- mounted_components.delete(component);
3114
- return fn(options2);
3115
- }
3116
- return Promise.resolve();
3117
- }
3118
- function asClassComponent$1(component) {
3119
- return class extends Svelte4Component {
3120
- /** @param {any} options */
3121
- constructor(options2) {
3122
- super({
3123
- component,
3124
- ...options2
3125
- });
3126
- }
3127
- };
3128
- }
3129
- class Svelte4Component {
3130
- /** @type {any} */
3131
- #events;
3132
- /** @type {Record<string, any>} */
3133
- #instance;
3134
- /**
3135
- * @param {ComponentConstructorOptions & {
3136
- * component: any;
3137
- * }} options
3138
- */
3139
- constructor(options2) {
3140
- var sources = /* @__PURE__ */ new Map();
3141
- var add_source = (key, value) => {
3142
- var s = /* @__PURE__ */ mutable_source(value, false, false);
3143
- sources.set(key, s);
3144
- return s;
3145
- };
3146
- const props = new Proxy(
3147
- { ...options2.props || {}, $$events: {} },
3148
- {
3149
- get(target, prop) {
3150
- return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
3151
- },
3152
- has(target, prop) {
3153
- if (prop === LEGACY_PROPS) return true;
3154
- get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
3155
- return Reflect.has(target, prop);
3156
- },
3157
- set(target, prop, value) {
3158
- set(sources.get(prop) ?? add_source(prop, value), value);
3159
- return Reflect.set(target, prop, value);
3160
- }
3161
- }
3162
- );
3163
- this.#instance = (options2.hydrate ? hydrate : mount)(options2.component, {
3164
- target: options2.target,
3165
- anchor: options2.anchor,
3166
- props,
3167
- context: options2.context,
3168
- intro: options2.intro ?? false,
3169
- recover: options2.recover
3170
- });
3171
- if (!options2?.props?.$$host || options2.sync === false) {
3172
- flushSync();
3173
- }
3174
- this.#events = props.$$events;
3175
- for (const key of Object.keys(this.#instance)) {
3176
- if (key === "$set" || key === "$destroy" || key === "$on") continue;
3177
- define_property(this, key, {
3178
- get() {
3179
- return this.#instance[key];
3180
- },
3181
- /** @param {any} value */
3182
- set(value) {
3183
- this.#instance[key] = value;
3184
- },
3185
- enumerable: true
3186
- });
3187
- }
3188
- this.#instance.$set = /** @param {Record<string, any>} next */
3189
- (next2) => {
3190
- Object.assign(props, next2);
3191
- };
3192
- this.#instance.$destroy = () => {
3193
- unmount(this.#instance);
3194
- };
3195
- }
3196
- /** @param {Record<string, any>} props */
3197
- $set(props) {
3198
- this.#instance.$set(props);
3199
- }
3200
- /**
3201
- * @param {string} event
3202
- * @param {(...args: any[]) => any} callback
3203
- * @returns {any}
3204
- */
3205
- $on(event, callback) {
3206
- this.#events[event] = this.#events[event] || [];
3207
- const cb = (...args) => callback.call(this, ...args);
3208
- this.#events[event].push(cb);
3209
- return () => {
3210
- this.#events[event] = this.#events[event].filter(
3211
- /** @param {any} fn */
3212
- (fn) => fn !== cb
3213
- );
3214
- };
3215
- }
3216
- $destroy() {
3217
- this.#instance.$destroy();
3218
- }
3219
- }
3220
- let read_implementation = null;
3221
- function set_read_implementation(fn) {
3222
- read_implementation = fn;
3223
- }
3224
- function asClassComponent(component) {
3225
- const component_constructor = asClassComponent$1(component);
3226
- const _render = (props, { context, csp } = {}) => {
3227
- const result = render(component, { props, context, csp });
3228
- const munged = Object.defineProperties(
3229
- /** @type {LegacyRenderResult & PromiseLike<LegacyRenderResult>} */
3230
- {},
3231
- {
3232
- css: {
3233
- value: { code: "", map: null }
3234
- },
3235
- head: {
3236
- get: () => result.head
3237
- },
3238
- html: {
3239
- get: () => result.body
3240
- },
3241
- then: {
3242
- /**
3243
- * this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
3244
- *
3245
- * @template TResult1
3246
- * @template [TResult2=never]
3247
- * @param { (value: LegacyRenderResult) => TResult1 } onfulfilled
3248
- * @param { (reason: unknown) => TResult2 } onrejected
3249
- */
3250
- value: (onfulfilled, onrejected) => {
3251
- {
3252
- const user_result = onfulfilled({
3253
- css: munged.css,
3254
- head: munged.head,
3255
- html: munged.html
3256
- });
3257
- return Promise.resolve(user_result);
3258
- }
3259
- }
3260
- }
3261
- }
3262
- );
3263
- return munged;
3264
- };
3265
- component_constructor.render = _render;
3266
- return component_constructor;
3267
- }
3268
- function Root($$renderer, $$props) {
3269
- $$renderer.component(($$renderer2) => {
3270
- let {
3271
- stores,
3272
- page,
3273
- constructors,
3274
- components = [],
3275
- form,
3276
- data_0 = null,
3277
- data_1 = null
3278
- } = $$props;
3279
- {
3280
- setContext("__svelte__", stores);
3281
- }
3282
- {
3283
- stores.page.set(page);
3284
- }
3285
- const Pyramid_1 = constructors[1];
3286
- if (constructors[1]) {
3287
- $$renderer2.push("<!--[-->");
3288
- const Pyramid_0 = constructors[0];
3289
- $$renderer2.push(`<!---->`);
3290
- Pyramid_0($$renderer2, {
3291
- data: data_0,
3292
- form,
3293
- params: page.params,
3294
- children: ($$renderer3) => {
3295
- $$renderer3.push(`<!---->`);
3296
- Pyramid_1($$renderer3, { data: data_1, form, params: page.params });
3297
- $$renderer3.push(`<!---->`);
3298
- },
3299
- $$slots: { default: true }
3300
- });
3301
- $$renderer2.push(`<!---->`);
3302
- } else {
3303
- $$renderer2.push("<!--[!-->");
3304
- const Pyramid_0 = constructors[0];
3305
- $$renderer2.push(`<!---->`);
3306
- Pyramid_0($$renderer2, { data: data_0, form, params: page.params });
3307
- $$renderer2.push(`<!---->`);
3308
- }
3309
- $$renderer2.push(`<!--]--> `);
3310
- {
3311
- $$renderer2.push("<!--[!-->");
3312
- }
3313
- $$renderer2.push(`<!--]-->`);
3314
- });
3315
- }
3316
- const root = asClassComponent(Root);
3317
- const options = {
3318
- app_template_contains_nonce: false,
3319
- async: false,
3320
- csp: { "mode": "auto", "directives": { "upgrade-insecure-requests": false, "block-all-mixed-content": false }, "reportOnly": { "upgrade-insecure-requests": false, "block-all-mixed-content": false } },
3321
- csrf_check_origin: true,
3322
- csrf_trusted_origins: [],
3323
- embedded: false,
3324
- env_public_prefix: "PUBLIC_",
3325
- env_private_prefix: "",
3326
- hash_routing: false,
3327
- hooks: null,
3328
- // added lazily, via `get_hooks`
3329
- preload_strategy: "modulepreload",
3330
- root,
3331
- service_worker: false,
3332
- service_worker_options: void 0,
3333
- templates: {
3334
- app: ({ head, body, assets, nonce, env }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n ' + head + '\n </head>\n <body data-sveltekit-preload-data="hover">\n <div style="display: contents">' + body + "</div>\n </body>\n</html>\n",
3335
- error: ({ status, message }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>' + message + `</title>
3336
-
3337
- <style>
3338
- body {
3339
- --bg: white;
3340
- --fg: #222;
3341
- --divider: #ccc;
3342
- background: var(--bg);
3343
- color: var(--fg);
3344
- font-family:
3345
- system-ui,
3346
- -apple-system,
3347
- BlinkMacSystemFont,
3348
- 'Segoe UI',
3349
- Roboto,
3350
- Oxygen,
3351
- Ubuntu,
3352
- Cantarell,
3353
- 'Open Sans',
3354
- 'Helvetica Neue',
3355
- sans-serif;
3356
- display: flex;
3357
- align-items: center;
3358
- justify-content: center;
3359
- height: 100vh;
3360
- margin: 0;
3361
- }
3362
-
3363
- .error {
3364
- display: flex;
3365
- align-items: center;
3366
- max-width: 32rem;
3367
- margin: 0 1rem;
3368
- }
3369
-
3370
- .status {
3371
- font-weight: 200;
3372
- font-size: 3rem;
3373
- line-height: 1;
3374
- position: relative;
3375
- top: -0.05rem;
3376
- }
3377
-
3378
- .message {
3379
- border-left: 1px solid var(--divider);
3380
- padding: 0 0 0 1rem;
3381
- margin: 0 0 0 1rem;
3382
- min-height: 2.5rem;
3383
- display: flex;
3384
- align-items: center;
3385
- }
3386
-
3387
- .message h1 {
3388
- font-weight: 400;
3389
- font-size: 1em;
3390
- margin: 0;
3391
- }
3392
-
3393
- @media (prefers-color-scheme: dark) {
3394
- body {
3395
- --bg: #222;
3396
- --fg: #ddd;
3397
- --divider: #666;
3398
- }
3399
- }
3400
- </style>
3401
- </head>
3402
- <body>
3403
- <div class="error">
3404
- <span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
3405
- },
3406
- version_hash: "mvydzm"
3407
- };
3408
- async function get_hooks() {
3409
- let handle;
3410
- let handleFetch;
3411
- let handleError;
3412
- let handleValidationError;
3413
- let init;
3414
- let reroute;
3415
- let transport;
3416
- return {
3417
- handle,
3418
- handleFetch,
3419
- handleError,
3420
- handleValidationError,
3421
- init,
3422
- reroute,
3423
- transport
3424
- };
3425
- }
3426
-
3427
- function with_resolvers() {
3428
- let resolve2;
3429
- let reject;
3430
- const promise = new Promise((res, rej) => {
3431
- resolve2 = res;
3432
- reject = rej;
3433
- });
3434
- return { promise, resolve: resolve2, reject };
3435
- }
3436
- const NULL_BODY_STATUS = [101, 103, 204, 205, 304];
3437
- const IN_WEBCONTAINER = !!globalThis.process?.versions?.webcontainer;
3438
- const SVELTE_KIT_ASSETS = "/_svelte_kit_assets";
3439
- const ENDPOINT_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
3440
- const PAGE_METHODS = ["GET", "POST", "HEAD"];
3441
- function negotiate(accept, types) {
3442
- const parts = [];
3443
- accept.split(",").forEach((str, i) => {
3444
- const match = /([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
3445
- if (match) {
3446
- const [, type, subtype, q = "1"] = match;
3447
- parts.push({ type, subtype, q: +q, i });
3448
- }
3449
- });
3450
- parts.sort((a, b) => {
3451
- if (a.q !== b.q) {
3452
- return b.q - a.q;
3453
- }
3454
- if (a.subtype === "*" !== (b.subtype === "*")) {
3455
- return a.subtype === "*" ? 1 : -1;
3456
- }
3457
- if (a.type === "*" !== (b.type === "*")) {
3458
- return a.type === "*" ? 1 : -1;
3459
- }
3460
- return a.i - b.i;
3461
- });
3462
- let accepted;
3463
- let min_priority = Infinity;
3464
- for (const mimetype of types) {
3465
- const [type, subtype] = mimetype.split("/");
3466
- const priority = parts.findIndex(
3467
- (part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*")
3468
- );
3469
- if (priority !== -1 && priority < min_priority) {
3470
- accepted = mimetype;
3471
- min_priority = priority;
3472
- }
3473
- }
3474
- return accepted;
3475
- }
3476
- function is_content_type(request, ...types) {
3477
- const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? "";
3478
- return types.includes(type.toLowerCase());
3479
- }
3480
- function is_form_content_type(request) {
3481
- return is_content_type(
3482
- request,
3483
- "application/x-www-form-urlencoded",
3484
- "multipart/form-data",
3485
- "text/plain",
3486
- BINARY_FORM_CONTENT_TYPE
3487
- );
3488
- }
3489
- function coalesce_to_error(err) {
3490
- return err instanceof Error || err && /** @type {any} */
3491
- err.name && /** @type {any} */
3492
- err.message ? (
3493
- /** @type {Error} */
3494
- err
3495
- ) : new Error(JSON.stringify(err));
3496
- }
3497
- function normalize_error(error2) {
3498
- return (
3499
- /** @type {import('../exports/internal/index.js').Redirect | HttpError | SvelteKitError | Error} */
3500
- error2
3501
- );
3502
- }
3503
- function get_status(error2) {
3504
- return error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500;
3505
- }
3506
- function get_message(error2) {
3507
- return error2 instanceof SvelteKitError ? error2.text : "Internal Error";
3508
- }
3509
- const escape_html_attr_dict = {
3510
- "&": "&amp;",
3511
- '"': "&quot;"
3512
- // Svelte also escapes < because the escape function could be called inside a `noscript` there
3513
- // https://github.com/sveltejs/svelte/security/advisories/GHSA-8266-84wp-wv5c
3514
- // However, that doesn't apply in SvelteKit
3515
- };
3516
- const escape_html_dict = {
3517
- "&": "&amp;",
3518
- "<": "&lt;"
3519
- };
3520
- const surrogates = (
3521
- // high surrogate without paired low surrogate
3522
- "[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]"
3523
- );
3524
- const escape_html_attr_regex = new RegExp(
3525
- `[${Object.keys(escape_html_attr_dict).join("")}]|` + surrogates,
3526
- "g"
3527
- );
3528
- const escape_html_regex = new RegExp(
3529
- `[${Object.keys(escape_html_dict).join("")}]|` + surrogates,
3530
- "g"
3531
- );
3532
- function escape_html(str, is_attr) {
3533
- const dict = is_attr ? escape_html_attr_dict : escape_html_dict;
3534
- const escaped_str = str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => {
3535
- if (match.length === 2) {
3536
- return match;
3537
- }
3538
- return dict[match] ?? `&#${match.charCodeAt(0)};`;
3539
- });
3540
- return escaped_str;
3541
- }
3542
- function method_not_allowed(mod, method) {
3543
- return text(`${method} method not allowed`, {
3544
- status: 405,
3545
- headers: {
3546
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
3547
- // "The server must generate an Allow header field in a 405 status code response"
3548
- allow: allowed_methods(mod).join(", ")
3549
- }
3550
- });
3551
- }
3552
- function allowed_methods(mod) {
3553
- const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
3554
- if ("GET" in mod && !("HEAD" in mod)) {
3555
- allowed.push("HEAD");
3556
- }
3557
- return allowed;
3558
- }
3559
- function get_global_name(options2) {
3560
- return `__sveltekit_${options2.version_hash}`;
3561
- }
3562
- function static_error_page(options2, status, message) {
3563
- let page = options2.templates.error({ status, message: escape_html(message) });
3564
- return text(page, {
3565
- headers: { "content-type": "text/html; charset=utf-8" },
3566
- status
3567
- });
3568
- }
3569
- async function handle_fatal_error(event, state, options2, error2) {
3570
- error2 = error2 instanceof HttpError ? error2 : coalesce_to_error(error2);
3571
- const status = get_status(error2);
3572
- const body2 = await handle_error_and_jsonify(event, state, options2, error2);
3573
- const type = negotiate(event.request.headers.get("accept") || "text/html", [
3574
- "application/json",
3575
- "text/html"
3576
- ]);
3577
- if (event.isDataRequest || type === "application/json") {
3578
- return json(body2, {
3579
- status
3580
- });
3581
- }
3582
- return static_error_page(options2, status, body2.message);
3583
- }
3584
- async function handle_error_and_jsonify(event, state, options2, error2) {
3585
- if (error2 instanceof HttpError) {
3586
- return { message: "Unknown Error", ...error2.body };
3587
- }
3588
- const status = get_status(error2);
3589
- const message = get_message(error2);
3590
- return await with_request_store(
3591
- { event, state },
3592
- () => options2.hooks.handleError({ error: error2, event, status, message })
3593
- ) ?? { message };
3594
- }
3595
- function redirect_response(status, location) {
3596
- const response = new Response(void 0, {
3597
- status,
3598
- headers: { location }
3599
- });
3600
- return response;
3601
- }
3602
- function clarify_devalue_error(event, error2) {
3603
- if (error2.path) {
3604
- return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error2.message} (${error2.path}). If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#Universal-hooks-transport.`;
3605
- }
3606
- if (error2.path === "") {
3607
- return `Data returned from \`load\` while rendering ${event.route.id} is not a plain object`;
3608
- }
3609
- return error2.message;
1047
+ function create_remote_key(id, payload) {
1048
+ return id + "/" + payload;
3610
1049
  }
3611
- function serialize_uses(node) {
3612
- const uses = {};
3613
- if (node.uses && node.uses.dependencies.size > 0) {
3614
- uses.dependencies = Array.from(node.uses.dependencies);
3615
- }
3616
- if (node.uses && node.uses.search_params.size > 0) {
3617
- uses.search_params = Array.from(node.uses.search_params);
3618
- }
3619
- if (node.uses && node.uses.params.size > 0) {
3620
- uses.params = Array.from(node.uses.params);
3621
- }
3622
- if (node.uses?.parent) uses.parent = 1;
3623
- if (node.uses?.route) uses.route = 1;
3624
- if (node.uses?.url) uses.url = 1;
3625
- return uses;
1050
+
1051
+ let public_env = {};
1052
+ function set_private_env(environment) {
3626
1053
  }
3627
- function has_prerendered_path(manifest, pathname) {
3628
- return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
1054
+ function set_public_env(environment) {
1055
+ public_env = environment;
3629
1056
  }
3630
- function format_server_error(status, error2, event) {
3631
- const formatted_text = `
3632
- \x1B[1;31m[${status}] ${event.request.method} ${event.url.pathname}\x1B[0m`;
3633
- if (status === 404) {
3634
- return formatted_text;
3635
- }
3636
- return `${formatted_text}
3637
- ${error2.stack}`;
1057
+ let read_implementation = null;
1058
+ function set_read_implementation(fn) {
1059
+ read_implementation = fn;
3638
1060
  }
3639
- function get_node_type(node_id) {
3640
- const parts = node_id?.split("/");
3641
- const filename = parts?.at(-1);
3642
- if (!filename) return "unknown";
3643
- const dot_parts = filename.split(".");
3644
- return dot_parts.slice(0, -1).join(".");
1061
+ const options = {
1062
+ app_template_contains_nonce: false,
1063
+ async: false,
1064
+ csp: { "mode": "auto", "directives": { "upgrade-insecure-requests": false, "block-all-mixed-content": false }, "reportOnly": { "upgrade-insecure-requests": false, "block-all-mixed-content": false } },
1065
+ csrf_check_origin: true,
1066
+ csrf_trusted_origins: [],
1067
+ embedded: false,
1068
+ env_public_prefix: "PUBLIC_",
1069
+ env_private_prefix: "",
1070
+ hash_routing: false,
1071
+ hooks: null,
1072
+ // added lazily, via `get_hooks`
1073
+ preload_strategy: "modulepreload",
1074
+ root,
1075
+ service_worker: false,
1076
+ service_worker_options: void 0,
1077
+ templates: {
1078
+ app: ({ head, body, assets, nonce, env }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n ' + head + '\n </head>\n <body data-sveltekit-preload-data="hover">\n <div style="display: contents">' + body + "</div>\n </body>\n</html>\n",
1079
+ error: ({ status, message }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>' + message + `</title>
1080
+
1081
+ <style>
1082
+ body {
1083
+ --bg: white;
1084
+ --fg: #222;
1085
+ --divider: #ccc;
1086
+ background: var(--bg);
1087
+ color: var(--fg);
1088
+ font-family:
1089
+ system-ui,
1090
+ -apple-system,
1091
+ BlinkMacSystemFont,
1092
+ 'Segoe UI',
1093
+ Roboto,
1094
+ Oxygen,
1095
+ Ubuntu,
1096
+ Cantarell,
1097
+ 'Open Sans',
1098
+ 'Helvetica Neue',
1099
+ sans-serif;
1100
+ display: flex;
1101
+ align-items: center;
1102
+ justify-content: center;
1103
+ height: 100vh;
1104
+ margin: 0;
1105
+ }
1106
+
1107
+ .error {
1108
+ display: flex;
1109
+ align-items: center;
1110
+ max-width: 32rem;
1111
+ margin: 0 1rem;
1112
+ }
1113
+
1114
+ .status {
1115
+ font-weight: 200;
1116
+ font-size: 3rem;
1117
+ line-height: 1;
1118
+ position: relative;
1119
+ top: -0.05rem;
1120
+ }
1121
+
1122
+ .message {
1123
+ border-left: 1px solid var(--divider);
1124
+ padding: 0 0 0 1rem;
1125
+ margin: 0 0 0 1rem;
1126
+ min-height: 2.5rem;
1127
+ display: flex;
1128
+ align-items: center;
1129
+ }
1130
+
1131
+ .message h1 {
1132
+ font-weight: 400;
1133
+ font-size: 1em;
1134
+ margin: 0;
1135
+ }
1136
+
1137
+ @media (prefers-color-scheme: dark) {
1138
+ body {
1139
+ --bg: #222;
1140
+ --fg: #ddd;
1141
+ --divider: #666;
1142
+ }
1143
+ }
1144
+ </style>
1145
+ </head>
1146
+ <body>
1147
+ <div class="error">
1148
+ <span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
1149
+ },
1150
+ version_hash: "1lexq3a"
1151
+ };
1152
+ async function get_hooks() {
1153
+ let handle;
1154
+ let handleFetch;
1155
+ let handleError;
1156
+ let handleValidationError;
1157
+ let init;
1158
+ let reroute;
1159
+ let transport;
1160
+ return {
1161
+ handle,
1162
+ handleFetch,
1163
+ handleError,
1164
+ handleValidationError,
1165
+ init,
1166
+ reroute,
1167
+ transport
1168
+ };
1169
+ }
1170
+
1171
+ function with_resolvers() {
1172
+ let resolve2;
1173
+ let reject;
1174
+ const promise = new Promise((res, rej) => {
1175
+ resolve2 = res;
1176
+ reject = rej;
1177
+ });
1178
+ return { promise, resolve: resolve2, reject };
3645
1179
  }
1180
+ const NULL_BODY_STATUS = [101, 103, 204, 205, 304];
1181
+ const IN_WEBCONTAINER = !!globalThis.process?.versions?.webcontainer;
3646
1182
  async function render_endpoint(event, event_state, mod, state) {
3647
1183
  const method = (
3648
1184
  /** @type {import('types').HttpMethod} */
@@ -3666,8 +1202,8 @@ async function render_endpoint(event, event_state, mod, state) {
3666
1202
  return new Response(void 0, { status: 204 });
3667
1203
  }
3668
1204
  }
3669
- event_state.is_endpoint_request = true;
3670
1205
  try {
1206
+ event_state.allows_commands = true;
3671
1207
  const response = await with_request_store(
3672
1208
  { event, state: event_state },
3673
1209
  () => handler(
@@ -3983,6 +1519,7 @@ async function call_action(event, event_state, actions) {
3983
1519
  },
3984
1520
  fn: async (current2) => {
3985
1521
  const traced_event = merge_tracing(event, current2);
1522
+ event_state.allows_commands = true;
3986
1523
  const result = await with_request_store(
3987
1524
  { event: traced_event, state: event_state },
3988
1525
  () => action(traced_event)
@@ -4024,13 +1561,14 @@ function try_serialize(data, fn, route_id) {
4024
1561
  );
4025
1562
  if (data instanceof Response) {
4026
1563
  throw new Error(
4027
- `Data returned from action inside ${route_id} is not serializable. Form actions need to return plain objects or fail(). E.g. return { success: true } or return fail(400, { message: "invalid" });`
1564
+ `Data returned from action inside ${route_id} is not serializable. Form actions need to return plain objects or fail(). E.g. return { success: true } or return fail(400, { message: "invalid" });`,
1565
+ { cause: e }
4028
1566
  );
4029
1567
  }
4030
1568
  if ("path" in error2) {
4031
1569
  let message = `Data returned from action inside ${route_id} is not serializable: ${error2.message}`;
4032
1570
  if (error2.path !== "") message += ` (data.${error2.path})`;
4033
- throw new Error(message);
1571
+ throw new Error(message, { cause: e });
4034
1572
  }
4035
1573
  throw error2;
4036
1574
  }
@@ -4094,7 +1632,6 @@ function server_data_serializer(event, event_state, options2) {
4094
1632
  options2,
4095
1633
  new Error(`Failed to serialize promise while rendering ${event.route.id}`)
4096
1634
  );
4097
- data = void 0;
4098
1635
  str = uneval([, error2], replacer);
4099
1636
  }
4100
1637
  return {
@@ -4138,7 +1675,7 @@ function server_data_serializer(event, event_state, options2) {
4138
1675
  event,
4139
1676
  /** @type {any} */
4140
1677
  e
4141
- ));
1678
+ ), { cause: e });
4142
1679
  }
4143
1680
  },
4144
1681
  get_data(csp) {
@@ -4231,7 +1768,7 @@ function server_data_serializer_json(event, event_state, options2) {
4231
1768
  event,
4232
1769
  /** @type {any} */
4233
1770
  e
4234
- ));
1771
+ ), { cause: e });
4235
1772
  }
4236
1773
  },
4237
1774
  get_data() {
@@ -4763,16 +2300,22 @@ class BaseProvider {
4763
2300
  #style_src_elem_needs_csp;
4764
2301
  /** @type {import('types').CspDirectives} */
4765
2302
  #directives;
4766
- /** @type {import('types').Csp.Source[]} */
2303
+ /** @type {Set<import('types').Csp.Source>} */
4767
2304
  #script_src;
4768
- /** @type {import('types').Csp.Source[]} */
2305
+ /** @type {Set<import('types').Csp.Source>} */
4769
2306
  #script_src_elem;
4770
- /** @type {import('types').Csp.Source[]} */
2307
+ /** @type {Set<import('types').Csp.Source>} */
4771
2308
  #style_src;
4772
- /** @type {import('types').Csp.Source[]} */
2309
+ /** @type {Set<import('types').Csp.Source>} */
4773
2310
  #style_src_attr;
4774
- /** @type {import('types').Csp.Source[]} */
2311
+ /** @type {Set<import('types').Csp.Source>} */
4775
2312
  #style_src_elem;
2313
+ /** @type {boolean} */
2314
+ script_needs_nonce;
2315
+ /** @type {boolean} */
2316
+ style_needs_nonce;
2317
+ /** @type {boolean} */
2318
+ script_needs_hash;
4776
2319
  /** @type {string} */
4777
2320
  #nonce;
4778
2321
  /**
@@ -4784,26 +2327,28 @@ class BaseProvider {
4784
2327
  this.#use_hashes = use_hashes;
4785
2328
  this.#directives = directives;
4786
2329
  const d = this.#directives;
4787
- this.#script_src = [];
4788
- this.#script_src_elem = [];
4789
- this.#style_src = [];
4790
- this.#style_src_attr = [];
4791
- this.#style_src_elem = [];
2330
+ this.#script_src = /* @__PURE__ */ new Set();
2331
+ this.#script_src_elem = /* @__PURE__ */ new Set();
2332
+ this.#style_src = /* @__PURE__ */ new Set();
2333
+ this.#style_src_attr = /* @__PURE__ */ new Set();
2334
+ this.#style_src_elem = /* @__PURE__ */ new Set();
4792
2335
  const effective_script_src = d["script-src"] || d["default-src"];
4793
2336
  const script_src_elem = d["script-src-elem"];
4794
2337
  const effective_style_src = d["style-src"] || d["default-src"];
4795
2338
  const style_src_attr = d["style-src-attr"];
4796
2339
  const style_src_elem = d["style-src-elem"];
4797
- const needs_csp = (directive) => !!directive && !directive.some((value) => value === "unsafe-inline");
4798
- this.#script_src_needs_csp = needs_csp(effective_script_src);
4799
- this.#script_src_elem_needs_csp = needs_csp(script_src_elem);
4800
- this.#style_src_needs_csp = needs_csp(effective_style_src);
4801
- this.#style_src_attr_needs_csp = needs_csp(style_src_attr);
4802
- this.#style_src_elem_needs_csp = needs_csp(style_src_elem);
2340
+ const style_needs_csp = (directive) => !!directive && !directive.some((value) => value === "unsafe-inline");
2341
+ const script_needs_csp = (directive) => !!directive && (!directive.some((value) => value === "unsafe-inline") || directive.some((value) => value === "strict-dynamic"));
2342
+ this.#script_src_needs_csp = script_needs_csp(effective_script_src);
2343
+ this.#script_src_elem_needs_csp = script_needs_csp(script_src_elem);
2344
+ this.#style_src_needs_csp = style_needs_csp(effective_style_src);
2345
+ this.#style_src_attr_needs_csp = style_needs_csp(style_src_attr);
2346
+ this.#style_src_elem_needs_csp = style_needs_csp(style_src_elem);
4803
2347
  this.#script_needs_csp = this.#script_src_needs_csp || this.#script_src_elem_needs_csp;
4804
2348
  this.#style_needs_csp = this.#style_src_needs_csp || this.#style_src_attr_needs_csp || this.#style_src_elem_needs_csp;
4805
2349
  this.script_needs_nonce = this.#script_needs_csp && !this.#use_hashes;
4806
2350
  this.style_needs_nonce = this.#style_needs_csp && !this.#use_hashes;
2351
+ this.script_needs_hash = this.#script_needs_csp && this.#use_hashes;
4807
2352
  this.#nonce = nonce;
4808
2353
  }
4809
2354
  /** @param {string} content */
@@ -4811,10 +2356,21 @@ class BaseProvider {
4811
2356
  if (!this.#script_needs_csp) return;
4812
2357
  const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
4813
2358
  if (this.#script_src_needs_csp) {
4814
- this.#script_src.push(source);
2359
+ this.#script_src.add(source);
4815
2360
  }
4816
2361
  if (this.#script_src_elem_needs_csp) {
4817
- this.#script_src_elem.push(source);
2362
+ this.#script_src_elem.add(source);
2363
+ }
2364
+ }
2365
+ /** @param {`sha256-${string}`[]} hashes */
2366
+ add_script_hashes(hashes) {
2367
+ for (const hash2 of hashes) {
2368
+ if (this.#script_src_needs_csp) {
2369
+ this.#script_src.add(hash2);
2370
+ }
2371
+ if (this.#script_src_elem_needs_csp) {
2372
+ this.#script_src_elem.add(hash2);
2373
+ }
4818
2374
  }
4819
2375
  }
4820
2376
  /** @param {string} content */
@@ -4822,19 +2378,19 @@ class BaseProvider {
4822
2378
  if (!this.#style_needs_csp) return;
4823
2379
  const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
4824
2380
  if (this.#style_src_needs_csp) {
4825
- this.#style_src.push(source);
2381
+ this.#style_src.add(source);
4826
2382
  }
4827
2383
  if (this.#style_src_attr_needs_csp) {
4828
- this.#style_src_attr.push(source);
2384
+ this.#style_src_attr.add(source);
4829
2385
  }
4830
2386
  if (this.#style_src_elem_needs_csp) {
4831
2387
  const sha256_empty_comment_hash = "sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=";
4832
2388
  const d = this.#directives;
4833
- if (d["style-src-elem"] && !d["style-src-elem"].includes(sha256_empty_comment_hash) && !this.#style_src_elem.includes(sha256_empty_comment_hash)) {
4834
- this.#style_src_elem.push(sha256_empty_comment_hash);
2389
+ if (d["style-src-elem"] && !d["style-src-elem"].includes(sha256_empty_comment_hash) && !this.#style_src_elem.has(sha256_empty_comment_hash)) {
2390
+ this.#style_src_elem.add(sha256_empty_comment_hash);
4835
2391
  }
4836
2392
  if (source !== sha256_empty_comment_hash) {
4837
- this.#style_src_elem.push(source);
2393
+ this.#style_src_elem.add(source);
4838
2394
  }
4839
2395
  }
4840
2396
  }
@@ -4844,31 +2400,31 @@ class BaseProvider {
4844
2400
  get_header(is_meta = false) {
4845
2401
  const header = [];
4846
2402
  const directives = { ...this.#directives };
4847
- if (this.#style_src.length > 0) {
2403
+ if (this.#style_src.size > 0) {
4848
2404
  directives["style-src"] = [
4849
2405
  ...directives["style-src"] || directives["default-src"] || [],
4850
2406
  ...this.#style_src
4851
2407
  ];
4852
2408
  }
4853
- if (this.#style_src_attr.length > 0) {
2409
+ if (this.#style_src_attr.size > 0) {
4854
2410
  directives["style-src-attr"] = [
4855
2411
  ...directives["style-src-attr"] || [],
4856
2412
  ...this.#style_src_attr
4857
2413
  ];
4858
2414
  }
4859
- if (this.#style_src_elem.length > 0) {
2415
+ if (this.#style_src_elem.size > 0) {
4860
2416
  directives["style-src-elem"] = [
4861
2417
  ...directives["style-src-elem"] || [],
4862
2418
  ...this.#style_src_elem
4863
2419
  ];
4864
2420
  }
4865
- if (this.#script_src.length > 0) {
2421
+ if (this.#script_src.size > 0) {
4866
2422
  directives["script-src"] = [
4867
2423
  ...directives["script-src"] || directives["default-src"] || [],
4868
2424
  ...this.#script_src
4869
2425
  ];
4870
2426
  }
4871
- if (this.#script_src_elem.length > 0) {
2427
+ if (this.#script_src_elem.size > 0) {
4872
2428
  directives["script-src-elem"] = [
4873
2429
  ...directives["script-src-elem"] || [],
4874
2430
  ...this.#script_src_elem
@@ -4942,6 +2498,9 @@ class Csp {
4942
2498
  this.csp_provider = new CspProvider(use_hashes, directives, this.nonce);
4943
2499
  this.report_only_provider = new CspReportOnlyProvider(use_hashes, reportOnly, this.nonce);
4944
2500
  }
2501
+ get script_needs_hash() {
2502
+ return this.csp_provider.script_needs_hash || this.report_only_provider.script_needs_hash;
2503
+ }
4945
2504
  get script_needs_nonce() {
4946
2505
  return this.csp_provider.script_needs_nonce || this.report_only_provider.script_needs_nonce;
4947
2506
  }
@@ -4953,6 +2512,11 @@ class Csp {
4953
2512
  this.csp_provider.add_script(content);
4954
2513
  this.report_only_provider.add_script(content);
4955
2514
  }
2515
+ /** @param {`sha256-${string}`[]} hashes */
2516
+ add_script_hashes(hashes) {
2517
+ this.csp_provider.add_script_hashes(hashes);
2518
+ this.report_only_provider.add_script_hashes(hashes);
2519
+ }
4956
2520
  /** @param {string} content */
4957
2521
  add_style(content) {
4958
2522
  this.csp_provider.add_style(content);
@@ -4990,20 +2554,9 @@ async function resolve_route(resolved_path, url, manifest) {
4990
2554
  if (!manifest._.client.routes) {
4991
2555
  return text("Server-side route resolution disabled", { status: 400 });
4992
2556
  }
4993
- let route = null;
4994
- let params = {};
4995
2557
  const matchers = await manifest._.matchers();
4996
- for (const candidate of manifest._.client.routes) {
4997
- const match = candidate.pattern.exec(resolved_path);
4998
- if (!match) continue;
4999
- const matched = exec(match, candidate.params, matchers);
5000
- if (matched) {
5001
- route = candidate;
5002
- params = decode_params(matched);
5003
- break;
5004
- }
5005
- }
5006
- return create_server_routing_response(route, params, url, manifest).response;
2558
+ const result = find_route(resolved_path, manifest._.client.routes, matchers);
2559
+ return create_server_routing_response(result?.route ?? null, result?.params ?? {}, url, manifest).response;
5007
2560
  }
5008
2561
  function create_server_routing_response(route, params, url, manifest) {
5009
2562
  const headers2 = new Headers({
@@ -5067,13 +2620,15 @@ async function render_response({
5067
2620
  const stylesheets = new Set(client.stylesheets);
5068
2621
  const fonts = new Set(client.fonts);
5069
2622
  const link_headers = /* @__PURE__ */ new Set();
5070
- const link_tags = /* @__PURE__ */ new Set();
5071
2623
  const inline_styles = /* @__PURE__ */ new Map();
5072
2624
  let rendered;
5073
2625
  const form_value = action_result?.type === "success" || action_result?.type === "failure" ? action_result.data ?? null : null;
5074
2626
  let base$1 = base;
5075
2627
  let assets$1 = assets;
5076
2628
  let base_expression = s(base);
2629
+ const csp = new Csp(options2.csp, {
2630
+ prerender: !!state.prerendering
2631
+ });
5077
2632
  {
5078
2633
  if (!state.prerendering?.fallback) {
5079
2634
  const segments = event.url.pathname.slice(base.length).split("/").slice(2);
@@ -5129,10 +2684,12 @@ async function render_response({
5129
2684
  page: props.page
5130
2685
  }
5131
2686
  ]
5132
- ])
2687
+ ]),
2688
+ csp: csp.script_needs_nonce ? { nonce: csp.nonce } : { hash: csp.script_needs_hash }
5133
2689
  };
5134
2690
  try {
5135
2691
  if (BROWSER) ;
2692
+ event_state.allows_commands = false;
5136
2693
  rendered = await with_request_store({ event, state: event_state }, async () => {
5137
2694
  if (relative) override({ base: base$1, assets: assets$1 });
5138
2695
  const maybe_promise = options2.root.render(props, render_opts);
@@ -5143,8 +2700,14 @@ async function render_response({
5143
2700
  if (options2.async) {
5144
2701
  reset();
5145
2702
  }
5146
- const { head: head2, html: html2, css } = options2.async ? await rendered2 : rendered2;
5147
- return { head: head2, html: html2, css };
2703
+ const { head: head2, html: html2, css, hashes } = (
2704
+ /** @type {ReturnType<typeof options.root.render>} */
2705
+ options2.async ? await rendered2 : rendered2
2706
+ );
2707
+ if (hashes) {
2708
+ csp.add_script_hashes(hashes.script);
2709
+ }
2710
+ return { head: head2, html: html2, css, hashes };
5148
2711
  });
5149
2712
  } finally {
5150
2713
  reset();
@@ -5154,17 +2717,20 @@ async function render_response({
5154
2717
  for (const url of node.stylesheets) stylesheets.add(url);
5155
2718
  for (const url of node.fonts) fonts.add(url);
5156
2719
  if (node.inline_styles && !client.inline) {
5157
- Object.entries(await node.inline_styles()).forEach(([k, v]) => inline_styles.set(k, v));
2720
+ Object.entries(await node.inline_styles()).forEach(([filename, css]) => {
2721
+ if (typeof css === "string") {
2722
+ inline_styles.set(filename, css);
2723
+ return;
2724
+ }
2725
+ inline_styles.set(filename, css(`${assets$1}/${app_dir}/immutable/assets`, assets$1));
2726
+ });
5158
2727
  }
5159
2728
  }
5160
2729
  } else {
5161
- rendered = { head: "", html: "", css: { code: "", map: null } };
2730
+ rendered = { head: "", html: "", css: { code: "", map: null }, hashes: { script: [] } };
5162
2731
  }
5163
- let head = "";
2732
+ const head = new Head(rendered.head, !!state.prerendering);
5164
2733
  let body2 = rendered.html;
5165
- const csp = new Csp(options2.csp, {
5166
- prerender: !!state.prerendering
5167
- });
5168
2734
  const prefixed = (path) => {
5169
2735
  if (path.startsWith("/")) {
5170
2736
  return base + path;
@@ -5174,10 +2740,9 @@ async function render_response({
5174
2740
  const style = client.inline ? client.inline?.style : Array.from(inline_styles.values()).join("\n");
5175
2741
  if (style) {
5176
2742
  const attributes = [];
5177
- if (csp.style_needs_nonce) attributes.push(` nonce="${csp.nonce}"`);
2743
+ if (csp.style_needs_nonce) attributes.push(`nonce="${csp.nonce}"`);
5178
2744
  csp.add_style(style);
5179
- head += `
5180
- <style${attributes.join("")}>${style}</style>`;
2745
+ head.add_style(style, attributes);
5181
2746
  }
5182
2747
  for (const dep of stylesheets) {
5183
2748
  const path = prefixed(dep);
@@ -5189,14 +2754,13 @@ async function render_response({
5189
2754
  link_headers.add(`<${encodeURI(path)}>; rel="preload"; as="style"; nopush`);
5190
2755
  }
5191
2756
  }
5192
- head += `
5193
- <link href="${path}" ${attributes.join(" ")}>`;
2757
+ head.add_stylesheet(path, attributes);
5194
2758
  }
5195
2759
  for (const dep of fonts) {
5196
2760
  const path = prefixed(dep);
5197
2761
  if (resolve_opts.preload({ type: "font", path })) {
5198
2762
  const ext = dep.slice(dep.lastIndexOf(".") + 1);
5199
- link_tags.add(`<link rel="preload" as="font" type="font/${ext}" href="${path}" crossorigin>`);
2763
+ head.add_link_tag(path, ['rel="preload"', 'as="font"', `type="font/${ext}"`, "crossorigin"]);
5200
2764
  link_headers.add(
5201
2765
  `<${encodeURI(path)}>; rel="preload"; as="font"; type="font/${ext}"; crossorigin; nopush`
5202
2766
  );
@@ -5222,17 +2786,12 @@ async function render_response({
5222
2786
  for (const path of included_modulepreloads) {
5223
2787
  link_headers.add(`<${encodeURI(path)}>; rel="modulepreload"; nopush`);
5224
2788
  if (options2.preload_strategy !== "modulepreload") {
5225
- head += `
5226
- <link rel="preload" as="script" crossorigin="anonymous" href="${path}">`;
2789
+ head.add_script_preload(path);
5227
2790
  } else {
5228
- link_tags.add(`<link rel="modulepreload" href="${path}">`);
2791
+ head.add_link_tag(path, ['rel="modulepreload"']);
5229
2792
  }
5230
2793
  }
5231
2794
  }
5232
- if (state.prerendering && link_tags.size > 0) {
5233
- head += Array.from(link_tags).map((tag) => `
5234
- ${tag}`).join("");
5235
- }
5236
2795
  if (manifest._.client.routes && state.prerendering && !state.prerendering.fallback) {
5237
2796
  const pathname = add_resolution_suffix(event.url.pathname);
5238
2797
  state.prerendering.dependencies.set(
@@ -5394,16 +2953,14 @@ ${indent}}`);
5394
2953
  "content-type": "text/html"
5395
2954
  });
5396
2955
  if (state.prerendering) {
5397
- const http_equiv = [];
5398
2956
  const csp_headers = csp.csp_provider.get_meta();
5399
2957
  if (csp_headers) {
5400
- http_equiv.push(csp_headers);
2958
+ head.add_http_equiv(csp_headers);
5401
2959
  }
5402
2960
  if (state.prerendering.cache) {
5403
- http_equiv.push(`<meta http-equiv="cache-control" content="${state.prerendering.cache}">`);
5404
- }
5405
- if (http_equiv.length > 0) {
5406
- head = http_equiv.join("\n") + head;
2961
+ head.add_http_equiv(
2962
+ `<meta http-equiv="cache-control" content="${state.prerendering.cache}">`
2963
+ );
5407
2964
  }
5408
2965
  } else {
5409
2966
  const csp_header = csp.csp_provider.get_header();
@@ -5418,9 +2975,8 @@ ${indent}}`);
5418
2975
  headers2.set("link", Array.from(link_headers).join(", "));
5419
2976
  }
5420
2977
  }
5421
- head += rendered.head;
5422
2978
  const html = options2.templates.app({
5423
- head,
2979
+ head: head.build(),
5424
2980
  body: body2,
5425
2981
  assets: assets$1,
5426
2982
  nonce: (
@@ -5455,6 +3011,73 @@ ${indent}}`);
5455
3011
  }
5456
3012
  );
5457
3013
  }
3014
+ class Head {
3015
+ #rendered;
3016
+ #prerendering;
3017
+ /** @type {string[]} */
3018
+ #http_equiv = [];
3019
+ /** @type {string[]} */
3020
+ #link_tags = [];
3021
+ /** @type {string[]} */
3022
+ #script_preloads = [];
3023
+ /** @type {string[]} */
3024
+ #style_tags = [];
3025
+ /** @type {string[]} */
3026
+ #stylesheet_links = [];
3027
+ /**
3028
+ * @param {string} rendered
3029
+ * @param {boolean} prerendering
3030
+ */
3031
+ constructor(rendered, prerendering) {
3032
+ this.#rendered = rendered;
3033
+ this.#prerendering = prerendering;
3034
+ }
3035
+ build() {
3036
+ return [
3037
+ ...this.#http_equiv,
3038
+ ...this.#link_tags,
3039
+ ...this.#script_preloads,
3040
+ this.#rendered,
3041
+ ...this.#style_tags,
3042
+ ...this.#stylesheet_links
3043
+ ].join("\n ");
3044
+ }
3045
+ /**
3046
+ * @param {string} style
3047
+ * @param {string[]} attributes
3048
+ */
3049
+ add_style(style, attributes) {
3050
+ this.#style_tags.push(
3051
+ `<style${attributes.length ? " " + attributes.join(" ") : ""}>${style}</style>`
3052
+ );
3053
+ }
3054
+ /**
3055
+ * @param {string} href
3056
+ * @param {string[]} attributes
3057
+ */
3058
+ add_stylesheet(href, attributes) {
3059
+ this.#stylesheet_links.push(`<link href="${href}" ${attributes.join(" ")}>`);
3060
+ }
3061
+ /** @param {string} href */
3062
+ add_script_preload(href) {
3063
+ this.#script_preloads.push(
3064
+ `<link rel="preload" as="script" crossorigin="anonymous" href="${href}">`
3065
+ );
3066
+ }
3067
+ /**
3068
+ * @param {string} href
3069
+ * @param {string[]} attributes
3070
+ */
3071
+ add_link_tag(href, attributes) {
3072
+ if (!this.#prerendering) return;
3073
+ this.#link_tags.push(`<link href="${href}" ${attributes.join(" ")}>`);
3074
+ }
3075
+ /** @param {string} tag */
3076
+ add_http_equiv(tag) {
3077
+ if (!this.#prerendering) return;
3078
+ this.#http_equiv.push(tag);
3079
+ }
3080
+ }
5458
3081
  class PageNodes {
5459
3082
  data;
5460
3083
  /**
@@ -5673,21 +3296,10 @@ async function handle_remote_call_internal(event, state, options2, manifest, id)
5673
3296
  );
5674
3297
  }
5675
3298
  const { payloads } = await event.request.json();
5676
- const args = payloads.map((payload2) => parse_remote_arg(payload2, transport));
5677
- const get_result = await with_request_store({ event, state }, () => info.run(args));
5678
- const results = await Promise.all(
5679
- args.map(async (arg, i) => {
5680
- try {
5681
- return { type: "result", data: get_result(arg, i) };
5682
- } catch (error2) {
5683
- return {
5684
- type: "error",
5685
- error: await handle_error_and_jsonify(event, state, options2, error2),
5686
- status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500
5687
- };
5688
- }
5689
- })
3299
+ const args = await Promise.all(
3300
+ payloads.map((payload2) => parse_remote_arg(payload2, transport))
5690
3301
  );
3302
+ const results = await with_request_store({ event, state }, () => info.run(args, options2));
5691
3303
  return json(
5692
3304
  /** @type {RemoteFunctionResponse} */
5693
3305
  {
@@ -5714,6 +3326,7 @@ async function handle_remote_call_internal(event, state, options2, manifest, id)
5714
3326
  );
5715
3327
  }
5716
3328
  const { data: data2, meta, form_data } = await deserialize_binary_form(event.request);
3329
+ form_client_refreshes = meta.remote_refreshes;
5717
3330
  if (additional_args && !("id" in data2)) {
5718
3331
  data2.id = JSON.parse(decodeURIComponent(additional_args));
5719
3332
  }
@@ -6129,13 +3742,16 @@ async function render_page(event, event_state, page, options2, manifest, state,
6129
3742
  data_serializer: ssr === false ? server_data_serializer(event, event_state, options2) : data_serializer
6130
3743
  });
6131
3744
  } catch (e) {
3745
+ if (e instanceof Redirect) {
3746
+ return redirect_response(e.status, e.location);
3747
+ }
6132
3748
  return await respond_with_error({
6133
3749
  event,
6134
3750
  event_state,
6135
3751
  options: options2,
6136
3752
  manifest,
6137
3753
  state,
6138
- status: 500,
3754
+ status: e instanceof HttpError ? e.status : 500,
6139
3755
  error: e,
6140
3756
  resolve_opts
6141
3757
  });
@@ -6294,7 +3910,7 @@ function requireDist() {
6294
3910
  dist.stringifyCookie = stringifyCookie;
6295
3911
  dist.stringifySetCookie = stringifySetCookie;
6296
3912
  dist.serialize = stringifySetCookie;
6297
- dist.parseSetCookie = parseSetCookie;
3913
+ dist.parseSetCookie = parseSetCookie2;
6298
3914
  dist.stringifySetCookie = stringifySetCookie;
6299
3915
  dist.serialize = stringifySetCookie;
6300
3916
  const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
@@ -6431,12 +4047,12 @@ function requireDist() {
6431
4047
  }
6432
4048
  return str;
6433
4049
  }
6434
- function parseSetCookie(str, options2) {
4050
+ function parseSetCookie2(str, options2) {
6435
4051
  const dec = options2?.decode || decode;
6436
4052
  const len = str.length;
6437
4053
  const endIdx = endIndex(str, 0, len);
6438
4054
  const eqIdx = eqIndex(str, 0, endIdx);
6439
- const setCookie2 = eqIdx === -1 ? { name: "", value: dec(valueSlice(str, 0, endIdx)) } : {
4055
+ const setCookie = eqIdx === -1 ? { name: "", value: dec(valueSlice(str, 0, endIdx)) } : {
6440
4056
  name: valueSlice(str, 0, eqIdx),
6441
4057
  value: dec(valueSlice(str, eqIdx + 1, endIdx))
6442
4058
  };
@@ -6448,37 +4064,37 @@ function requireDist() {
6448
4064
  const val = eqIdx2 === -1 ? void 0 : valueSlice(str, eqIdx2 + 1, endIdx2);
6449
4065
  switch (attr.toLowerCase()) {
6450
4066
  case "httponly":
6451
- setCookie2.httpOnly = true;
4067
+ setCookie.httpOnly = true;
6452
4068
  break;
6453
4069
  case "secure":
6454
- setCookie2.secure = true;
4070
+ setCookie.secure = true;
6455
4071
  break;
6456
4072
  case "partitioned":
6457
- setCookie2.partitioned = true;
4073
+ setCookie.partitioned = true;
6458
4074
  break;
6459
4075
  case "domain":
6460
- setCookie2.domain = val;
4076
+ setCookie.domain = val;
6461
4077
  break;
6462
4078
  case "path":
6463
- setCookie2.path = val;
4079
+ setCookie.path = val;
6464
4080
  break;
6465
4081
  case "max-age":
6466
4082
  if (val && maxAgeRegExp.test(val))
6467
- setCookie2.maxAge = Number(val);
4083
+ setCookie.maxAge = Number(val);
6468
4084
  break;
6469
4085
  case "expires":
6470
4086
  if (!val)
6471
4087
  break;
6472
4088
  const date = new Date(val);
6473
4089
  if (Number.isFinite(date.valueOf()))
6474
- setCookie2.expires = date;
4090
+ setCookie.expires = date;
6475
4091
  break;
6476
4092
  case "priority":
6477
4093
  if (!val)
6478
4094
  break;
6479
4095
  const priority = val.toLowerCase();
6480
4096
  if (priority === "low" || priority === "medium" || priority === "high") {
6481
- setCookie2.priority = priority;
4097
+ setCookie.priority = priority;
6482
4098
  }
6483
4099
  break;
6484
4100
  case "samesite":
@@ -6486,13 +4102,13 @@ function requireDist() {
6486
4102
  break;
6487
4103
  const sameSite = val.toLowerCase();
6488
4104
  if (sameSite === "lax" || sameSite === "strict" || sameSite === "none") {
6489
- setCookie2.sameSite = sameSite;
4105
+ setCookie.sameSite = sameSite;
6490
4106
  }
6491
4107
  break;
6492
4108
  }
6493
4109
  index = endIdx2 + 1;
6494
4110
  }
6495
- return setCookie2;
4111
+ return setCookie;
6496
4112
  }
6497
4113
  function endIndex(str, min, len) {
6498
4114
  const index = str.indexOf(";", min);
@@ -6694,190 +4310,193 @@ function add_cookies_to_headers(headers2, cookies) {
6694
4310
  }
6695
4311
  }
6696
4312
  }
6697
- var setCookie = { exports: {} };
6698
- var hasRequiredSetCookie;
6699
- function requireSetCookie() {
6700
- if (hasRequiredSetCookie) return setCookie.exports;
6701
- hasRequiredSetCookie = 1;
6702
- var defaultParseOptions = {
6703
- decodeValues: true,
6704
- map: false,
6705
- silent: false
6706
- };
6707
- function isForbiddenKey(key2) {
6708
- return typeof key2 !== "string" || key2 in {};
6709
- }
6710
- function createNullObj() {
6711
- return /* @__PURE__ */ Object.create(null);
4313
+ var defaultParseOptions = {
4314
+ decodeValues: true,
4315
+ map: false,
4316
+ silent: false,
4317
+ split: "auto"
4318
+ // auto = split strings but not arrays
4319
+ };
4320
+ function isForbiddenKey(key2) {
4321
+ return typeof key2 !== "string" || key2 in {};
4322
+ }
4323
+ function createNullObj() {
4324
+ return /* @__PURE__ */ Object.create(null);
4325
+ }
4326
+ function isNonEmptyString(str) {
4327
+ return typeof str === "string" && !!str.trim();
4328
+ }
4329
+ function parseString(setCookieValue, options2) {
4330
+ var parts = setCookieValue.split(";").filter(isNonEmptyString);
4331
+ var nameValuePairStr = parts.shift();
4332
+ var parsed = parseNameValuePair(nameValuePairStr);
4333
+ var name = parsed.name;
4334
+ var value = parsed.value;
4335
+ options2 = options2 ? Object.assign({}, defaultParseOptions, options2) : defaultParseOptions;
4336
+ if (isForbiddenKey(name)) {
4337
+ return null;
6712
4338
  }
6713
- function isNonEmptyString(str) {
6714
- return typeof str === "string" && !!str.trim();
4339
+ try {
4340
+ value = options2.decodeValues ? decodeURIComponent(value) : value;
4341
+ } catch (e) {
4342
+ console.error(
4343
+ "set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",
4344
+ e
4345
+ );
6715
4346
  }
6716
- function parseString(setCookieValue, options2) {
6717
- var parts = setCookieValue.split(";").filter(isNonEmptyString);
6718
- var nameValuePairStr = parts.shift();
6719
- var parsed = parseNameValuePair(nameValuePairStr);
6720
- var name = parsed.name;
6721
- var value = parsed.value;
6722
- options2 = options2 ? Object.assign({}, defaultParseOptions, options2) : defaultParseOptions;
6723
- if (isForbiddenKey(name)) {
6724
- return null;
6725
- }
6726
- try {
6727
- value = options2.decodeValues ? decodeURIComponent(value) : value;
6728
- } catch (e) {
6729
- console.error(
6730
- "set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",
6731
- e
6732
- );
4347
+ var cookie = createNullObj();
4348
+ cookie.name = name;
4349
+ cookie.value = value;
4350
+ parts.forEach(function(part) {
4351
+ var sides = part.split("=");
4352
+ var key2 = sides.shift().trimLeft().toLowerCase();
4353
+ if (isForbiddenKey(key2)) {
4354
+ return;
6733
4355
  }
6734
- var cookie = createNullObj();
6735
- cookie.name = name;
6736
- cookie.value = value;
6737
- parts.forEach(function(part) {
6738
- var sides = part.split("=");
6739
- var key2 = sides.shift().trimLeft().toLowerCase();
6740
- if (isForbiddenKey(key2)) {
6741
- return;
6742
- }
6743
- var value2 = sides.join("=");
6744
- if (key2 === "expires") {
6745
- cookie.expires = new Date(value2);
6746
- } else if (key2 === "max-age") {
6747
- var n = parseInt(value2, 10);
6748
- if (!Number.isNaN(n)) cookie.maxAge = n;
6749
- } else if (key2 === "secure") {
6750
- cookie.secure = true;
6751
- } else if (key2 === "httponly") {
6752
- cookie.httpOnly = true;
6753
- } else if (key2 === "samesite") {
6754
- cookie.sameSite = value2;
6755
- } else if (key2 === "partitioned") {
6756
- cookie.partitioned = true;
6757
- } else if (key2) {
6758
- cookie[key2] = value2;
6759
- }
6760
- });
6761
- return cookie;
6762
- }
6763
- function parseNameValuePair(nameValuePairStr) {
6764
- var name = "";
6765
- var value = "";
6766
- var nameValueArr = nameValuePairStr.split("=");
6767
- if (nameValueArr.length > 1) {
6768
- name = nameValueArr.shift();
6769
- value = nameValueArr.join("=");
6770
- } else {
6771
- value = nameValuePairStr;
4356
+ var value2 = sides.join("=");
4357
+ if (key2 === "expires") {
4358
+ cookie.expires = new Date(value2);
4359
+ } else if (key2 === "max-age") {
4360
+ var n = parseInt(value2, 10);
4361
+ if (!Number.isNaN(n)) cookie.maxAge = n;
4362
+ } else if (key2 === "secure") {
4363
+ cookie.secure = true;
4364
+ } else if (key2 === "httponly") {
4365
+ cookie.httpOnly = true;
4366
+ } else if (key2 === "samesite") {
4367
+ cookie.sameSite = value2;
4368
+ } else if (key2 === "partitioned") {
4369
+ cookie.partitioned = true;
4370
+ } else if (key2) {
4371
+ cookie[key2] = value2;
6772
4372
  }
6773
- return { name, value };
4373
+ });
4374
+ return cookie;
4375
+ }
4376
+ function parseNameValuePair(nameValuePairStr) {
4377
+ var name = "";
4378
+ var value = "";
4379
+ var nameValueArr = nameValuePairStr.split("=");
4380
+ if (nameValueArr.length > 1) {
4381
+ name = nameValueArr.shift();
4382
+ value = nameValueArr.join("=");
4383
+ } else {
4384
+ value = nameValuePairStr;
6774
4385
  }
6775
- function parse(input, options2) {
6776
- options2 = options2 ? Object.assign({}, defaultParseOptions, options2) : defaultParseOptions;
6777
- if (!input) {
6778
- if (!options2.map) {
6779
- return [];
6780
- } else {
6781
- return createNullObj();
6782
- }
6783
- }
6784
- if (input.headers) {
6785
- if (typeof input.headers.getSetCookie === "function") {
6786
- input = input.headers.getSetCookie();
6787
- } else if (input.headers["set-cookie"]) {
6788
- input = input.headers["set-cookie"];
6789
- } else {
6790
- var sch = input.headers[Object.keys(input.headers).find(function(key2) {
6791
- return key2.toLowerCase() === "set-cookie";
6792
- })];
6793
- if (!sch && input.headers.cookie && !options2.silent) {
6794
- console.warn(
6795
- "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
6796
- );
6797
- }
6798
- input = sch;
6799
- }
6800
- }
6801
- if (!Array.isArray(input)) {
6802
- input = [input];
6803
- }
4386
+ return { name, value };
4387
+ }
4388
+ function parseSetCookie(input, options2) {
4389
+ options2 = options2 ? Object.assign({}, defaultParseOptions, options2) : defaultParseOptions;
4390
+ if (!input) {
6804
4391
  if (!options2.map) {
6805
- return input.filter(isNonEmptyString).map(function(str) {
6806
- return parseString(str, options2);
6807
- }).filter(Boolean);
4392
+ return [];
6808
4393
  } else {
6809
- var cookies = createNullObj();
6810
- return input.filter(isNonEmptyString).reduce(function(cookies2, str) {
6811
- var cookie = parseString(str, options2);
6812
- if (cookie && !isForbiddenKey(cookie.name)) {
6813
- cookies2[cookie.name] = cookie;
6814
- }
6815
- return cookies2;
6816
- }, cookies);
4394
+ return createNullObj();
6817
4395
  }
6818
4396
  }
6819
- function splitCookiesString(cookiesString) {
6820
- if (Array.isArray(cookiesString)) {
6821
- return cookiesString;
6822
- }
6823
- if (typeof cookiesString !== "string") {
6824
- return [];
6825
- }
6826
- var cookiesStrings = [];
6827
- var pos = 0;
6828
- var start;
6829
- var ch;
6830
- var lastComma;
6831
- var nextStart;
6832
- var cookiesSeparatorFound;
6833
- function skipWhitespace() {
6834
- while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
6835
- pos += 1;
4397
+ if (input.headers) {
4398
+ if (typeof input.headers.getSetCookie === "function") {
4399
+ input = input.headers.getSetCookie();
4400
+ } else if (input.headers["set-cookie"]) {
4401
+ input = input.headers["set-cookie"];
4402
+ } else {
4403
+ var sch = input.headers[Object.keys(input.headers).find(function(key2) {
4404
+ return key2.toLowerCase() === "set-cookie";
4405
+ })];
4406
+ if (!sch && input.headers.cookie && !options2.silent) {
4407
+ console.warn(
4408
+ "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
4409
+ );
6836
4410
  }
6837
- return pos < cookiesString.length;
4411
+ input = sch;
6838
4412
  }
6839
- function notSpecialChar() {
4413
+ }
4414
+ var split = options2.split;
4415
+ var isArray = Array.isArray(input);
4416
+ if (split === "auto") {
4417
+ split = !isArray;
4418
+ }
4419
+ if (!isArray) {
4420
+ input = [input];
4421
+ }
4422
+ input = input.filter(isNonEmptyString);
4423
+ if (split) {
4424
+ input = input.map(splitCookiesString).flat();
4425
+ }
4426
+ if (!options2.map) {
4427
+ return input.map(function(str) {
4428
+ return parseString(str, options2);
4429
+ }).filter(Boolean);
4430
+ } else {
4431
+ var cookies = createNullObj();
4432
+ return input.reduce(function(cookies2, str) {
4433
+ var cookie = parseString(str, options2);
4434
+ if (cookie && !isForbiddenKey(cookie.name)) {
4435
+ cookies2[cookie.name] = cookie;
4436
+ }
4437
+ return cookies2;
4438
+ }, cookies);
4439
+ }
4440
+ }
4441
+ function splitCookiesString(cookiesString) {
4442
+ if (Array.isArray(cookiesString)) {
4443
+ return cookiesString;
4444
+ }
4445
+ if (typeof cookiesString !== "string") {
4446
+ return [];
4447
+ }
4448
+ var cookiesStrings = [];
4449
+ var pos = 0;
4450
+ var start;
4451
+ var ch;
4452
+ var lastComma;
4453
+ var nextStart;
4454
+ var cookiesSeparatorFound;
4455
+ function skipWhitespace() {
4456
+ while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
4457
+ pos += 1;
4458
+ }
4459
+ return pos < cookiesString.length;
4460
+ }
4461
+ function notSpecialChar() {
4462
+ ch = cookiesString.charAt(pos);
4463
+ return ch !== "=" && ch !== ";" && ch !== ",";
4464
+ }
4465
+ while (pos < cookiesString.length) {
4466
+ start = pos;
4467
+ cookiesSeparatorFound = false;
4468
+ while (skipWhitespace()) {
6840
4469
  ch = cookiesString.charAt(pos);
6841
- return ch !== "=" && ch !== ";" && ch !== ",";
6842
- }
6843
- while (pos < cookiesString.length) {
6844
- start = pos;
6845
- cookiesSeparatorFound = false;
6846
- while (skipWhitespace()) {
6847
- ch = cookiesString.charAt(pos);
6848
- if (ch === ",") {
6849
- lastComma = pos;
4470
+ if (ch === ",") {
4471
+ lastComma = pos;
4472
+ pos += 1;
4473
+ skipWhitespace();
4474
+ nextStart = pos;
4475
+ while (pos < cookiesString.length && notSpecialChar()) {
6850
4476
  pos += 1;
6851
- skipWhitespace();
6852
- nextStart = pos;
6853
- while (pos < cookiesString.length && notSpecialChar()) {
6854
- pos += 1;
6855
- }
6856
- if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
6857
- cookiesSeparatorFound = true;
6858
- pos = nextStart;
6859
- cookiesStrings.push(cookiesString.substring(start, lastComma));
6860
- start = pos;
6861
- } else {
6862
- pos = lastComma + 1;
6863
- }
4477
+ }
4478
+ if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
4479
+ cookiesSeparatorFound = true;
4480
+ pos = nextStart;
4481
+ cookiesStrings.push(cookiesString.substring(start, lastComma));
4482
+ start = pos;
6864
4483
  } else {
6865
- pos += 1;
4484
+ pos = lastComma + 1;
6866
4485
  }
4486
+ } else {
4487
+ pos += 1;
6867
4488
  }
6868
- if (!cookiesSeparatorFound || pos >= cookiesString.length) {
6869
- cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
6870
- }
6871
4489
  }
6872
- return cookiesStrings;
4490
+ if (!cookiesSeparatorFound || pos >= cookiesString.length) {
4491
+ cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
4492
+ }
6873
4493
  }
6874
- setCookie.exports = parse;
6875
- setCookie.exports.parse = parse;
6876
- setCookie.exports.parseString = parseString;
6877
- setCookie.exports.splitCookiesString = splitCookiesString;
6878
- return setCookie.exports;
4494
+ return cookiesStrings;
6879
4495
  }
6880
- var setCookieExports = /* @__PURE__ */ requireSetCookie();
4496
+ parseSetCookie.parseSetCookie = parseSetCookie;
4497
+ parseSetCookie.parse = parseSetCookie;
4498
+ parseSetCookie.parseString = parseString;
4499
+ parseSetCookie.splitCookiesString = splitCookiesString;
6881
4500
  function create_fetch({ event, options: options2, manifest, state, get_cookie_header, set_internal }) {
6882
4501
  const server_fetch = async (info, init2) => {
6883
4502
  const original_request = normalize_fetch_input(info, init2, event.url);
@@ -6899,7 +4518,8 @@ function create_fetch({ event, options: options2, manifest, state, get_cookie_he
6899
4518
  if ((request.method === "GET" || request.method === "HEAD") && (mode === "no-cors" && url.origin !== event.url.origin || url.origin === event.url.origin)) {
6900
4519
  request.headers.delete("origin");
6901
4520
  }
6902
- if (url.origin !== event.url.origin) {
4521
+ const decoded = decodeURIComponent(url.pathname);
4522
+ if (url.origin !== event.url.origin || base && decoded !== base && !decoded.startsWith(`${base}/`)) {
6903
4523
  if (`.${url.hostname}`.endsWith(`.${event.url.hostname}`) && credentials !== "omit") {
6904
4524
  const cookie = get_cookie_header(url, request.headers.get("cookie"));
6905
4525
  if (cookie) request.headers.set("cookie", cookie);
@@ -6907,7 +4527,6 @@ function create_fetch({ event, options: options2, manifest, state, get_cookie_he
6907
4527
  return fetch(request);
6908
4528
  }
6909
4529
  const prefix = assets || base;
6910
- const decoded = decodeURIComponent(url.pathname);
6911
4530
  const filename = (decoded.startsWith(prefix) ? decoded.slice(prefix.length) : decoded).slice(1);
6912
4531
  const filename_html = `${filename}/index.html`;
6913
4532
  const is_asset = manifest.assets.has(filename) || filename in manifest._.server_assets;
@@ -6957,8 +4576,8 @@ function create_fetch({ event, options: options2, manifest, state, get_cookie_he
6957
4576
  const response = await internal_fetch(request, options2, manifest, state);
6958
4577
  const set_cookie = response.headers.get("set-cookie");
6959
4578
  if (set_cookie) {
6960
- for (const str of setCookieExports.splitCookiesString(set_cookie)) {
6961
- const { name, value, ...options3 } = setCookieExports.parseString(str, {
4579
+ for (const str of splitCookiesString(set_cookie)) {
4580
+ const { name, value, ...options3 } = parseString(str, {
6962
4581
  decodeValues: false
6963
4582
  });
6964
4583
  const path = options3.path ?? (url.pathname.split("/").slice(0, -1).join("/") || "/");
@@ -7208,16 +4827,11 @@ async function internal_respond(request, options2, manifest, state) {
7208
4827
  }
7209
4828
  if (!state.prerendering?.fallback) {
7210
4829
  const matchers = await manifest._.matchers();
7211
- for (const candidate of manifest._.routes) {
7212
- const match = candidate.pattern.exec(resolved_path);
7213
- if (!match) continue;
7214
- const matched = exec(match, candidate.params, matchers);
7215
- if (matched) {
7216
- route = candidate;
7217
- event.route = { id: route.id };
7218
- event.params = decode_params(matched);
7219
- break;
7220
- }
4830
+ const result = find_route(resolved_path, manifest._.routes, matchers);
4831
+ if (result) {
4832
+ route = result.route;
4833
+ event.route = { id: route.id };
4834
+ event.params = result.params;
7221
4835
  }
7222
4836
  }
7223
4837
  let resolve_opts = {
@@ -7295,6 +4909,7 @@ async function internal_respond(request, options2, manifest, state) {
7295
4909
  current: root_span
7296
4910
  }
7297
4911
  };
4912
+ event_state.allows_commands = MUTATIVE_METHODS.includes(request.method);
7298
4913
  return await with_request_store(
7299
4914
  { event: traced_event, state: event_state },
7300
4915
  () => options2.hooks.handle({
@@ -7446,20 +5061,20 @@ async function internal_respond(request, options2, manifest, state) {
7446
5061
  resolve_opts
7447
5062
  );
7448
5063
  } else {
7449
- const allowed_methods2 = new Set(allowed_page_methods);
5064
+ const allowed_methods = new Set(allowed_page_methods);
7450
5065
  const node = await manifest._.nodes[route.page.leaf]();
7451
5066
  if (node?.server?.actions) {
7452
- allowed_methods2.add("POST");
5067
+ allowed_methods.add("POST");
7453
5068
  }
7454
5069
  if (method === "OPTIONS") {
7455
5070
  response2 = new Response(null, {
7456
5071
  status: 204,
7457
5072
  headers: {
7458
- allow: Array.from(allowed_methods2.values()).join(", ")
5073
+ allow: Array.from(allowed_methods.values()).join(", ")
7459
5074
  }
7460
5075
  });
7461
5076
  } else {
7462
- const mod = [...allowed_methods2].reduce(
5077
+ const mod = [...allowed_methods].reduce(
7463
5078
  (acc, curr) => {
7464
5079
  acc[curr] = true;
7465
5080
  return acc;