@deepseek-insight/dsi 0.5.5

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 (285) hide show
  1. package/LICENSE +204 -0
  2. package/README.md +98 -0
  3. package/bin/dsi.mjs +147 -0
  4. package/build/client/_app/immutable/assets/0.DqFt8jIM.css +2 -0
  5. package/build/client/_app/immutable/assets/2.YlW45hiM.css +1 -0
  6. package/build/client/_app/immutable/assets/codicon.Brq4_Ui5.ttf +0 -0
  7. package/build/client/_app/immutable/assets/editor.jjEx9u7D.css +1 -0
  8. package/build/client/_app/immutable/assets/settings-monaco.C1CMdMvw.css +1 -0
  9. package/build/client/_app/immutable/chunks/-g7BcI22.js +4 -0
  10. package/build/client/_app/immutable/chunks/08VXUWAP.js +1 -0
  11. package/build/client/_app/immutable/chunks/2irkVCIh.js +10 -0
  12. package/build/client/_app/immutable/chunks/43DmfD33.js +1 -0
  13. package/build/client/_app/immutable/chunks/6GKQw8m6.js +99 -0
  14. package/build/client/_app/immutable/chunks/6RTg0lbw.js +1 -0
  15. package/build/client/_app/immutable/chunks/9TvT6fta.js +120 -0
  16. package/build/client/_app/immutable/chunks/B1YSaoU7.js +96 -0
  17. package/build/client/_app/immutable/chunks/B2J2w5EN.js +1 -0
  18. package/build/client/_app/immutable/chunks/B5-_aFwp.js +2 -0
  19. package/build/client/_app/immutable/chunks/B8-Q2PIv.js +1 -0
  20. package/build/client/_app/immutable/chunks/B8J7ngcE.js +1 -0
  21. package/build/client/_app/immutable/chunks/B9JPFI3C.js +2 -0
  22. package/build/client/_app/immutable/chunks/BAZKJuQw.js +1 -0
  23. package/build/client/_app/immutable/chunks/BBKpNcUe.js +1 -0
  24. package/build/client/_app/immutable/chunks/BEEn4gHE.js +1 -0
  25. package/build/client/_app/immutable/chunks/BEtHBSE6.js +1 -0
  26. package/build/client/_app/immutable/chunks/BFoDCU3G.js +1 -0
  27. package/build/client/_app/immutable/chunks/BHtPwB2y.js +847 -0
  28. package/build/client/_app/immutable/chunks/BI-MrBd-.js +1 -0
  29. package/build/client/_app/immutable/chunks/BI4pMaIG.js +1 -0
  30. package/build/client/_app/immutable/chunks/BJL7RCQE.js +4 -0
  31. package/build/client/_app/immutable/chunks/BKxtCVv1.js +1 -0
  32. package/build/client/_app/immutable/chunks/BOfSXrr7.js +1 -0
  33. package/build/client/_app/immutable/chunks/BOotOW0E.js +1 -0
  34. package/build/client/_app/immutable/chunks/BTzV9O1M.js +3 -0
  35. package/build/client/_app/immutable/chunks/BW-FRVGs.js +1 -0
  36. package/build/client/_app/immutable/chunks/BWPQTe0t.js +1 -0
  37. package/build/client/_app/immutable/chunks/BYgofb2h.js +1 -0
  38. package/build/client/_app/immutable/chunks/Ba7i2nA0.js +1 -0
  39. package/build/client/_app/immutable/chunks/Bb19NAkg.js +1 -0
  40. package/build/client/_app/immutable/chunks/Bc_sGQ0U.js +1 -0
  41. package/build/client/_app/immutable/chunks/BeGwcela.js +1 -0
  42. package/build/client/_app/immutable/chunks/BeZqd5lB.js +1 -0
  43. package/build/client/_app/immutable/chunks/Beo7Z46k.js +7 -0
  44. package/build/client/_app/immutable/chunks/BhNEBkk_.js +39 -0
  45. package/build/client/_app/immutable/chunks/BifhSqXX.js +1 -0
  46. package/build/client/_app/immutable/chunks/Bjy-W4x2.js +81 -0
  47. package/build/client/_app/immutable/chunks/BlltJnm0.js +1 -0
  48. package/build/client/_app/immutable/chunks/Bn9NRi0R.js +168 -0
  49. package/build/client/_app/immutable/chunks/BnF5Jm-h.js +1 -0
  50. package/build/client/_app/immutable/chunks/Bp4uuUjI.js +3 -0
  51. package/build/client/_app/immutable/chunks/BrTsmS-o.js +57 -0
  52. package/build/client/_app/immutable/chunks/Bri6UV-V.js +1 -0
  53. package/build/client/_app/immutable/chunks/Btk-1DaX.js +1 -0
  54. package/build/client/_app/immutable/chunks/BwWrilGY.js +1 -0
  55. package/build/client/_app/immutable/chunks/Bxkupp3x.js +1 -0
  56. package/build/client/_app/immutable/chunks/Bz4Y3fRF.js +1 -0
  57. package/build/client/_app/immutable/chunks/C-OQMol4.js +1 -0
  58. package/build/client/_app/immutable/chunks/C-y9NEjX.js +1 -0
  59. package/build/client/_app/immutable/chunks/C1JXY9b5.js +30 -0
  60. package/build/client/_app/immutable/chunks/C2x7inlt.js +321 -0
  61. package/build/client/_app/immutable/chunks/C531GsRP.js +2 -0
  62. package/build/client/_app/immutable/chunks/C5TAQhFO.js +1 -0
  63. package/build/client/_app/immutable/chunks/C5_-GSwl.js +1 -0
  64. package/build/client/_app/immutable/chunks/C6lv30UQ.js +1 -0
  65. package/build/client/_app/immutable/chunks/C7h46wYY.js +1 -0
  66. package/build/client/_app/immutable/chunks/C8Ef5oNN.js +1 -0
  67. package/build/client/_app/immutable/chunks/CA_WNCsl.js +41 -0
  68. package/build/client/_app/immutable/chunks/CC2rA5mh.js +1 -0
  69. package/build/client/_app/immutable/chunks/CHdTS7qa.js +15 -0
  70. package/build/client/_app/immutable/chunks/CIPQ_RoX.js +1 -0
  71. package/build/client/_app/immutable/chunks/CJ_zvTBg.js +72 -0
  72. package/build/client/_app/immutable/chunks/CPEyWost.js +1 -0
  73. package/build/client/_app/immutable/chunks/CPgSxomx.js +1 -0
  74. package/build/client/_app/immutable/chunks/CRfGWb83.js +1 -0
  75. package/build/client/_app/immutable/chunks/CTgm3pse.js +1 -0
  76. package/build/client/_app/immutable/chunks/CVaqCwHa.js +1 -0
  77. package/build/client/_app/immutable/chunks/CWKM3f5q.js +1 -0
  78. package/build/client/_app/immutable/chunks/CWVpRRWx.js +162 -0
  79. package/build/client/_app/immutable/chunks/CXMH3UgJ.js +257 -0
  80. package/build/client/_app/immutable/chunks/CZ-RNlot.js +1 -0
  81. package/build/client/_app/immutable/chunks/CZXl7qUb.js +70 -0
  82. package/build/client/_app/immutable/chunks/C_N-eONP.js +1 -0
  83. package/build/client/_app/immutable/chunks/Cb1pwoev.js +1 -0
  84. package/build/client/_app/immutable/chunks/CcL1k2On.js +11 -0
  85. package/build/client/_app/immutable/chunks/CcWV7GYH.js +1 -0
  86. package/build/client/_app/immutable/chunks/CcwsVR0C.js +1 -0
  87. package/build/client/_app/immutable/chunks/Cd6K7Y8m.js +1 -0
  88. package/build/client/_app/immutable/chunks/CfSJPG6W.js +1 -0
  89. package/build/client/_app/immutable/chunks/CfZ7uSQe.js +38 -0
  90. package/build/client/_app/immutable/chunks/Cimd5fb3.js +1 -0
  91. package/build/client/_app/immutable/chunks/Cj-Zm41R.js +36 -0
  92. package/build/client/_app/immutable/chunks/CjZ_QSbm.js +1 -0
  93. package/build/client/_app/immutable/chunks/CkrcOjFY.js +1 -0
  94. package/build/client/_app/immutable/chunks/ClamHrr6.js +1 -0
  95. package/build/client/_app/immutable/chunks/Cm7r79vr.js +1 -0
  96. package/build/client/_app/immutable/chunks/CmbEK4CY.js +84 -0
  97. package/build/client/_app/immutable/chunks/CmvnEPtD.js +7 -0
  98. package/build/client/_app/immutable/chunks/CopQ2nXW.js +1 -0
  99. package/build/client/_app/immutable/chunks/CpzslTdj.js +1 -0
  100. package/build/client/_app/immutable/chunks/CsHVnZCH.js +1 -0
  101. package/build/client/_app/immutable/chunks/CsQS60Ue.js +1 -0
  102. package/build/client/_app/immutable/chunks/CuRJVwEq.js +1 -0
  103. package/build/client/_app/immutable/chunks/D-oSqn_W.js +1 -0
  104. package/build/client/_app/immutable/chunks/D-ptJ9y-.js +1 -0
  105. package/build/client/_app/immutable/chunks/D05T4iGw.js +1 -0
  106. package/build/client/_app/immutable/chunks/D0I62FkS.js +1 -0
  107. package/build/client/_app/immutable/chunks/D16vkywU.js +1 -0
  108. package/build/client/_app/immutable/chunks/D1qzYj9m.js +1 -0
  109. package/build/client/_app/immutable/chunks/D3hlyOfw.js +1 -0
  110. package/build/client/_app/immutable/chunks/D4gq_dik.js +1 -0
  111. package/build/client/_app/immutable/chunks/D7fX-3xy.js +1 -0
  112. package/build/client/_app/immutable/chunks/D8-5qLJg.js +231 -0
  113. package/build/client/_app/immutable/chunks/D8hlhfM3.js +1 -0
  114. package/build/client/_app/immutable/chunks/DAS1CLuE.js +24 -0
  115. package/build/client/_app/immutable/chunks/DGarjVZC.js +1 -0
  116. package/build/client/_app/immutable/chunks/DGd2pJF5.js +1 -0
  117. package/build/client/_app/immutable/chunks/DHpiXF5c.js +1 -0
  118. package/build/client/_app/immutable/chunks/DHwB1DNv.js +161 -0
  119. package/build/client/_app/immutable/chunks/DIMkf-bt.js +3 -0
  120. package/build/client/_app/immutable/chunks/DISqw1ZD.js +1 -0
  121. package/build/client/_app/immutable/chunks/DITEY8D_.js +62 -0
  122. package/build/client/_app/immutable/chunks/DL0yNkAA.js +1 -0
  123. package/build/client/_app/immutable/chunks/DL1Hc2zs.js +1 -0
  124. package/build/client/_app/immutable/chunks/DLOOos_8.js +292 -0
  125. package/build/client/_app/immutable/chunks/DMUM7wLl.js +1 -0
  126. package/build/client/_app/immutable/chunks/DPKol_4Z.js +139 -0
  127. package/build/client/_app/immutable/chunks/DS17s2tU.js +1 -0
  128. package/build/client/_app/immutable/chunks/DT7zqm-g.js +1 -0
  129. package/build/client/_app/immutable/chunks/DTj74zXo.js +1 -0
  130. package/build/client/_app/immutable/chunks/DV3o63ZY.js +1 -0
  131. package/build/client/_app/immutable/chunks/DVXVVWkX.js +129 -0
  132. package/build/client/_app/immutable/chunks/DWDfcLfy.js +206 -0
  133. package/build/client/_app/immutable/chunks/DXeGLmed.js +8 -0
  134. package/build/client/_app/immutable/chunks/DYqsupvX.js +1 -0
  135. package/build/client/_app/immutable/chunks/DZ6u0Z-K.js +1 -0
  136. package/build/client/_app/immutable/chunks/DZFCIeNp.js +1 -0
  137. package/build/client/_app/immutable/chunks/D_Lu-MrJ.js +1 -0
  138. package/build/client/_app/immutable/chunks/DauUninz.js +1 -0
  139. package/build/client/_app/immutable/chunks/DbInun42.js +1 -0
  140. package/build/client/_app/immutable/chunks/DbcKN35_.js +3 -0
  141. package/build/client/_app/immutable/chunks/DcZe4Woe.js +1 -0
  142. package/build/client/_app/immutable/chunks/DdL9SqIa.js +1 -0
  143. package/build/client/_app/immutable/chunks/De2hgUGE.js +1 -0
  144. package/build/client/_app/immutable/chunks/DezsRK8O.js +1 -0
  145. package/build/client/_app/immutable/chunks/Dg_UWGX7.js +24 -0
  146. package/build/client/_app/immutable/chunks/Dj2t5yNg.js +1 -0
  147. package/build/client/_app/immutable/chunks/DkqhCAOL.js +1 -0
  148. package/build/client/_app/immutable/chunks/DlQrSOw4.js +7 -0
  149. package/build/client/_app/immutable/chunks/DmHpPYUd.js +1 -0
  150. package/build/client/_app/immutable/chunks/Dmn-tsie.js +1 -0
  151. package/build/client/_app/immutable/chunks/DpFanUEy.js +298 -0
  152. package/build/client/_app/immutable/chunks/DqwfDHZH.js +89 -0
  153. package/build/client/_app/immutable/chunks/Dr0pcX_F.js +1 -0
  154. package/build/client/_app/immutable/chunks/DrH0SRf2.js +1 -0
  155. package/build/client/_app/immutable/chunks/DsF7k-Jl.js +1 -0
  156. package/build/client/_app/immutable/chunks/DtBGId5S.js +2 -0
  157. package/build/client/_app/immutable/chunks/DuM1hSCa.js +1 -0
  158. package/build/client/_app/immutable/chunks/Du_ODUAO.js +1 -0
  159. package/build/client/_app/immutable/chunks/DvCMcJ3P.js +1 -0
  160. package/build/client/_app/immutable/chunks/Dy-Kn_BL.js +1 -0
  161. package/build/client/_app/immutable/chunks/DzVMo6mB.js +62 -0
  162. package/build/client/_app/immutable/chunks/ESmLJICu.js +1 -0
  163. package/build/client/_app/immutable/chunks/FvmIjYaQ.js +1 -0
  164. package/build/client/_app/immutable/chunks/GBaNblmo.js +1 -0
  165. package/build/client/_app/immutable/chunks/HclGiUj8.js +1 -0
  166. package/build/client/_app/immutable/chunks/Ju5jF6hy.js +1 -0
  167. package/build/client/_app/immutable/chunks/KythIMN8.js +1 -0
  168. package/build/client/_app/immutable/chunks/LWre5GKl.js +40 -0
  169. package/build/client/_app/immutable/chunks/NEE52Syq.js +1 -0
  170. package/build/client/_app/immutable/chunks/No6lfiAw.js +1 -0
  171. package/build/client/_app/immutable/chunks/OmE6SGvs.js +106 -0
  172. package/build/client/_app/immutable/chunks/P_ok0Z_j.js +2 -0
  173. package/build/client/_app/immutable/chunks/PaZBB01u.js +1 -0
  174. package/build/client/_app/immutable/chunks/Rh9cy7xg.js +2 -0
  175. package/build/client/_app/immutable/chunks/SOo6toE5.js +1 -0
  176. package/build/client/_app/immutable/chunks/TNLUqJaC.js +1 -0
  177. package/build/client/_app/immutable/chunks/UNxFjlik.js +1 -0
  178. package/build/client/_app/immutable/chunks/UmdltqoE.js +1 -0
  179. package/build/client/_app/immutable/chunks/Z5eAx3Zn.js +1 -0
  180. package/build/client/_app/immutable/chunks/bTuwJoIa.js +1 -0
  181. package/build/client/_app/immutable/chunks/fmXr3nnJ.js +1 -0
  182. package/build/client/_app/immutable/chunks/fybaL0A-.js +1 -0
  183. package/build/client/_app/immutable/chunks/gp-XZpBa.js +3 -0
  184. package/build/client/_app/immutable/chunks/h-p5ZdY8.js +1 -0
  185. package/build/client/_app/immutable/chunks/hxYEUgOo.js +1 -0
  186. package/build/client/_app/immutable/chunks/i0VQdJtv.js +1 -0
  187. package/build/client/_app/immutable/chunks/i0X4ZdIN.js +1 -0
  188. package/build/client/_app/immutable/chunks/mVHw7KEX.js +7 -0
  189. package/build/client/_app/immutable/chunks/nDMCpPkF.js +1 -0
  190. package/build/client/_app/immutable/chunks/nr791fC2.js +1 -0
  191. package/build/client/_app/immutable/chunks/onAF5SnQ.js +1 -0
  192. package/build/client/_app/immutable/chunks/oz_6vUea.js +1 -0
  193. package/build/client/_app/immutable/chunks/qEGLx2Wc.js +78 -0
  194. package/build/client/_app/immutable/chunks/raVGrKQy.js +44 -0
  195. package/build/client/_app/immutable/chunks/sBoK_t0W.js +1 -0
  196. package/build/client/_app/immutable/chunks/sIEmSkn6.js +34 -0
  197. package/build/client/_app/immutable/chunks/wFIeY1Cf.js +88 -0
  198. package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
  199. package/build/client/_app/immutable/chunks/zpcgJjUg.js +127 -0
  200. package/build/client/_app/immutable/entry/app.B2QxMn0t.js +2 -0
  201. package/build/client/_app/immutable/entry/start.BR3A4iFi.js +1 -0
  202. package/build/client/_app/immutable/nodes/0.B_ZEZy7b.js +1 -0
  203. package/build/client/_app/immutable/nodes/1.By3Gd2cs.js +1 -0
  204. package/build/client/_app/immutable/nodes/2.1TAwiWw1.js +69 -0
  205. package/build/client/_app/immutable/workers/css.worker-DRH2OcAG.js +93 -0
  206. package/build/client/_app/immutable/workers/html.worker-DQLddT9h.js +506 -0
  207. package/build/client/_app/immutable/workers/json.worker-D_Dqrls5.js +62 -0
  208. package/build/client/_app/immutable/workers/settings-editor-worker-D9zwrD0f.js +30 -0
  209. package/build/client/_app/immutable/workers/ts.worker-DkYoA6bF.js +67738 -0
  210. package/build/client/_app/immutable/workers/yaml.worker-BTGFEDOA.js +449 -0
  211. package/build/client/_app/version.json +1 -0
  212. package/build/client/favicon.svg +7 -0
  213. package/build/env.js +70 -0
  214. package/build/handler.js +23 -0
  215. package/build/index.js +146 -0
  216. package/build/server/chunks/chunks/a2a-protocol.js-C77mVg2Q.js +52 -0
  217. package/build/server/chunks/chunks/app-config.svelte.js-Co9jacqT.js +52 -0
  218. package/build/server/chunks/chunks/config.js-BBYogCe7.js +123 -0
  219. package/build/server/chunks/chunks/db.js-DcmO3JAx.js +120 -0
  220. package/build/server/chunks/chunks/db2.js-DBltVUGg.js +717 -0
  221. package/build/server/chunks/chunks/dsh-connection.js-DwihVtk_.js +1957 -0
  222. package/build/server/chunks/chunks/dsh-events.js-BtDxaV6Q.js +706 -0
  223. package/build/server/chunks/chunks/env.js-l0sNRNKZ.js +2 -0
  224. package/build/server/chunks/chunks/exports.js-DMiPee3x.js +263 -0
  225. package/build/server/chunks/chunks/goal-projection.js-0_34t60K.js +44 -0
  226. package/build/server/chunks/chunks/image-limits.js-BMPZ55kJ.js +186 -0
  227. package/build/server/chunks/chunks/insight-config.js-CfMPTA6Z.js +352 -0
  228. package/build/server/chunks/chunks/internal.js-CQzEjdyk.js +747 -0
  229. package/build/server/chunks/chunks/internal2.js-D-DAuSVh.js +22 -0
  230. package/build/server/chunks/chunks/server.js-DoCd0fEo.js +4104 -0
  231. package/build/server/chunks/chunks/shared.js-C4-Py8s_.js +775 -0
  232. package/build/server/chunks/chunks/state.js-CpmOS0a2.js +114 -0
  233. package/build/server/chunks/chunks/uneval.js-BJ9Qq2SF.js +488 -0
  234. package/build/server/chunks/chunks/utils.js-tOWCe9Wk.js +933 -0
  235. package/build/server/chunks/chunks/watcher.js-BelxjMOP.js +473 -0
  236. package/build/server/chunks/entries/endpoints/api/a2a/_id_/_server.ts.js-B4HUNFZv.js +37 -0
  237. package/build/server/chunks/entries/endpoints/api/a2a/_server.ts.js-JDV_oqbX.js +61 -0
  238. package/build/server/chunks/entries/endpoints/api/a2a/register/_server.ts.js-Dxwc-7-5.js +99 -0
  239. package/build/server/chunks/entries/endpoints/api/config/_server.ts.js-D8i35bGH.js +35 -0
  240. package/build/server/chunks/entries/endpoints/api/dsh/directory/_server.ts.js-CeBU1G85.js +43 -0
  241. package/build/server/chunks/entries/endpoints/api/dsh/pick-directory/_server.ts.js-CyrVUxv3.js +36 -0
  242. package/build/server/chunks/entries/endpoints/api/dsh/presets/_server.ts.js-qeO_1htT.js +33 -0
  243. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/attachment/_server.ts.js-DnHffohz.js +44 -0
  244. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/cancel/_server.ts.js-fm6MFyjP.js +33 -0
  245. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/catalog/_server.ts.js-wJ9V_Ue7.js +42 -0
  246. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/command/_server.ts.js-o83L4GUY.js +85 -0
  247. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/events/_server.ts.js-DLCHSC1M.js +212 -0
  248. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/fork/_server.ts.js-Ca6NU9HO.js +58 -0
  249. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/goal/_server.ts.js-RteR85vn.js +138 -0
  250. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/history/_server.ts.js-CEKDkK7v.js +55 -0
  251. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/models/_server.ts.js-D7ziyW3d.js +35 -0
  252. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/permission/_server.ts.js-DbkD4JZb.js +92 -0
  253. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/prompt/_server.ts.js-eOLNlf1-.js +94 -0
  254. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/rename/_server.ts.js-txQRocK9.js +57 -0
  255. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/respond/_server.ts.js-D3WGYzkE.js +69 -0
  256. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/select-model/_server.ts.js-g2GtvLTs.js +69 -0
  257. package/build/server/chunks/entries/endpoints/api/dsh/sessions/_server.ts.js-17yKojU_.js +85 -0
  258. package/build/server/chunks/entries/endpoints/api/dsh/workspace-file/_server.ts.js-D16pEhvd.js +99 -0
  259. package/build/server/chunks/entries/endpoints/api/dsh/workspace-file/save/_server.ts.js-BXpZNLK8.js +110 -0
  260. package/build/server/chunks/entries/endpoints/api/dsh/workspace-file-bytes/_server.ts.js-hBlyjq-x.js +113 -0
  261. package/build/server/chunks/entries/endpoints/api/dsh/workspace-tree/_server.ts.js-KWRnsAkm.js +59 -0
  262. package/build/server/chunks/entries/endpoints/api/dsh/workspaces/_server.ts.js-DzNvvCxK.js +55 -0
  263. package/build/server/chunks/entries/endpoints/api/dsh/workspaces/_workspaceId_/delete/_server.ts.js-MK5925CY.js +45 -0
  264. package/build/server/chunks/entries/endpoints/api/dsh/workspaces/_workspaceId_/rename/_server.ts.js-w3Mo0nf7.js +63 -0
  265. package/build/server/chunks/entries/endpoints/api/prompts/_id_/_server.ts.js-CInfjM-i.js +64 -0
  266. package/build/server/chunks/entries/endpoints/api/prompts/_server.ts.js-C1lqP1OV.js +87 -0
  267. package/build/server/chunks/entries/endpoints/api/prompts/use/_server.ts.js-B36YMKMt.js +54 -0
  268. package/build/server/chunks/entries/endpoints/api/settings/_server.ts.js-CHvHNzeB.js +101 -0
  269. package/build/server/chunks/entries/pages/_error.svelte.js-BE3-BWDd.js +41 -0
  270. package/build/server/chunks/entries/pages/_layout.svelte.js-EFiihTdF.js +18 -0
  271. package/build/server/chunks/entries/pages/_layout.ts.js-CNSo-Z1U.js +22 -0
  272. package/build/server/chunks/entries/pages/_page.server.ts.js-Bk8UuUXA.js +85 -0
  273. package/build/server/chunks/entries/pages/_page.svelte.js-CfmKQYLK.js +13883 -0
  274. package/build/server/chunks/handler-BshnD4Y4.js +1735 -0
  275. package/build/server/chunks/index.js-I_pMeIwQ.js +3864 -0
  276. package/build/server/chunks/manifest.js-DwhpAk_y.js +273 -0
  277. package/build/server/chunks/nodes/0.js-DCyDo8-C.js +12 -0
  278. package/build/server/chunks/nodes/1.js-Dx7z_VWN.js +9 -0
  279. package/build/server/chunks/nodes/2.js-CLw9pxho.js +24 -0
  280. package/build/shims.js +33 -0
  281. package/package.json +65 -0
  282. package/template/.dsi/a2a.sqlite +0 -0
  283. package/template/.dsi/config.json +42 -0
  284. package/template/.dsi/prompts.sqlite +0 -0
  285. package/template/.dsi/settings.yaml +33 -0
@@ -0,0 +1,3864 @@
1
+ import { _ as __commonJSMin, o as options, s as set_private_env, a as set_public_env, g as get_hooks, p as public_env, r as read_implementation, b as set_read_implementation } from './chunks/internal.js-CQzEjdyk.js';
2
+ import { n as noop, T as TRAILING_SLASH_PARAM, I as INVALIDATED_PARAM, R as Redirect, b as get_relative_path, S as SvelteKitError, g as get_status, t as text_encoder, o as once, H as HttpError, d as normalize_error, e as create_remote_key, f as parse_remote_arg, s as stringify, h as stringify$1, A as ActionFailure, i as split_remote_key, j as base64_encode } from './chunks/shared.js-C4-Py8s_.js';
3
+ import { b as base, o as override, a as assets, r as reset, c as app_dir } from './chunks/internal2.js-D-DAuSVh.js';
4
+ import { f as format_server_error, j as json, i as is_form_content_type, t as text, h as has_prerendered_path, a as handle_fatal_error, r as redirect_response, g as get_set_cookies, n as negotiate, w as with_request_store, p as parseString, m as merge_tracing, b as method_not_allowed, s as static_error_page, c as handle_error_and_jsonify, d as get_global_name, e as create_replacer, k as serialize_uses, l as clarify_devalue_error, E as ENDPOINT_METHODS, P as PAGE_METHODS, o as get_node_type, q as isRedirect, u as escape_html, v as error, x as deserialize_binary_form } from './chunks/utils.js-tOWCe9Wk.js';
5
+ import { u as uneval } from './chunks/uneval.js-BJ9Qq2SF.js';
6
+ import { d as decode_pathname, f as find_route, n as normalize_path, a as disable_search, v as validate_layout_server_exports, b as validate_layout_exports, c as validate_page_server_exports, e as validate_page_exports, r as resolve, h as hash, m as make_trackable } from './chunks/exports.js-DMiPee3x.js';
7
+ import { S as writable, T as readable } from './chunks/server.js-DoCd0fEo.js';
8
+
9
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/utils/promise.js
10
+ /** @see https://github.com/microsoft/TypeScript/blob/904e7dd97dc8da1352c8e05d70829dff17c73214/src/lib/es2024.promise.d.ts */
11
+ /**
12
+ * @template T
13
+ * @typedef {{
14
+ * promise: Promise<T>;
15
+ * resolve: (value: T | PromiseLike<T>) => void;
16
+ * reject: (reason?: any) => void;
17
+ * }} PromiseWithResolvers<T>
18
+ */
19
+ /**
20
+ * TODO: Whenever Node >21 is minimum supported version, we can use `Promise.withResolvers` to avoid this ceremony
21
+ *
22
+ * @template T
23
+ * @returns {PromiseWithResolvers<T>}
24
+ */
25
+ function with_resolvers() {
26
+ let resolve;
27
+ let reject;
28
+ return {
29
+ promise: new Promise((res, rej) => {
30
+ resolve = res;
31
+ reject = rej;
32
+ }),
33
+ resolve,
34
+ reject
35
+ };
36
+ }
37
+ //#endregion
38
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/constants.js
39
+ var NULL_BODY_STATUS = [
40
+ 101,
41
+ 103,
42
+ 204,
43
+ 205,
44
+ 304
45
+ ];
46
+ var IN_WEBCONTAINER = !!globalThis.process?.versions?.webcontainer;
47
+ //#endregion
48
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/utils/misc.js
49
+ var s = JSON.stringify;
50
+ //#endregion
51
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/endpoint.js
52
+ /**
53
+ * @param {import('@sveltejs/kit').RequestEvent} event
54
+ * @param {import('types').RequestState} event_state
55
+ * @param {import('types').SSREndpoint} mod
56
+ * @param {import('types').SSRState} state
57
+ * @returns {Promise<Response>}
58
+ */
59
+ async function render_endpoint(event, event_state, mod, state) {
60
+ const method = event.request.method;
61
+ let handler = mod[method] || mod.fallback;
62
+ if (method === "HEAD" && !mod.HEAD && mod.GET) handler = mod.GET;
63
+ if (!handler) return method_not_allowed(mod, method);
64
+ const prerender = mod.prerender ?? state.prerender_default;
65
+ if (prerender && (mod.POST || mod.PATCH || mod.PUT || mod.DELETE)) throw new Error("Cannot prerender endpoints that have mutative methods");
66
+ if (state.prerendering && !state.prerendering.inside_reroute && !prerender) {
67
+ if (state.depth > 0) throw new Error(`${event.route.id} is not prerenderable`);
68
+ else return new Response(void 0, { status: 204 });
69
+ }
70
+ try {
71
+ const response = await with_request_store({
72
+ event,
73
+ state: event_state
74
+ }, () => handler(event));
75
+ if (!(response instanceof Response)) throw new Error(`Invalid response from route ${event.url.pathname}: handler should return a Response object`);
76
+ if (state.prerendering && (!state.prerendering.inside_reroute || prerender)) {
77
+ const cloned = new Response(response.clone().body, {
78
+ status: response.status,
79
+ statusText: response.statusText,
80
+ headers: new Headers(response.headers)
81
+ });
82
+ cloned.headers.set("x-sveltekit-prerender", String(prerender));
83
+ if (state.prerendering.inside_reroute && prerender) {
84
+ cloned.headers.set("x-sveltekit-routeid", encodeURI(event.route.id));
85
+ state.prerendering.dependencies.set(event.url.pathname, {
86
+ response: cloned,
87
+ body: null
88
+ });
89
+ } else return cloned;
90
+ }
91
+ return response;
92
+ } catch (e) {
93
+ if (e instanceof Redirect) return new Response(void 0, {
94
+ status: e.status,
95
+ headers: { location: e.location }
96
+ });
97
+ throw e;
98
+ }
99
+ }
100
+ /**
101
+ * @param {import('@sveltejs/kit').RequestEvent} event
102
+ */
103
+ function is_endpoint_request(event) {
104
+ const { method, headers } = event.request;
105
+ if (ENDPOINT_METHODS.includes(method) && !PAGE_METHODS.includes(method)) return true;
106
+ if (method === "POST" && headers.get("x-sveltekit-action") === "true") return false;
107
+ const accept = event.request.headers.get("accept") ?? "*/*";
108
+ return negotiate(accept, ["*", "text/html"]) !== "text/html";
109
+ }
110
+ //#endregion
111
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/utils/array.js
112
+ /**
113
+ * Removes nullish values from an array.
114
+ *
115
+ * @template T
116
+ * @param {Array<T>} arr
117
+ */
118
+ function compact(arr) {
119
+ return arr.filter(
120
+ /** @returns {val is NonNullable<T>} */
121
+ (val) => val != null
122
+ );
123
+ }
124
+ //#endregion
125
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/pathname.js
126
+ var DATA_SUFFIX = "/__data.json";
127
+ var HTML_DATA_SUFFIX = ".html__data.json";
128
+ /** @param {string} pathname */
129
+ function has_data_suffix(pathname) {
130
+ return pathname.endsWith(DATA_SUFFIX) || pathname.endsWith(HTML_DATA_SUFFIX);
131
+ }
132
+ /** @param {string} pathname */
133
+ function add_data_suffix(pathname) {
134
+ if (pathname.endsWith(".html")) return pathname.replace(/\.html$/, HTML_DATA_SUFFIX);
135
+ return pathname.replace(/\/$/, "") + DATA_SUFFIX;
136
+ }
137
+ /** @param {string} pathname */
138
+ function strip_data_suffix(pathname) {
139
+ if (pathname.endsWith(HTML_DATA_SUFFIX)) return pathname.slice(0, -16) + ".html";
140
+ return pathname.slice(0, -12);
141
+ }
142
+ var ROUTE_SUFFIX = "/__route.js";
143
+ /**
144
+ * @param {string} pathname
145
+ * @returns {boolean}
146
+ */
147
+ function has_resolution_suffix(pathname) {
148
+ return pathname.endsWith(ROUTE_SUFFIX);
149
+ }
150
+ /**
151
+ * Convert a regular URL to a route to send to SvelteKit's server-side route resolution endpoint
152
+ * @param {string} pathname
153
+ * @returns {string}
154
+ */
155
+ function add_resolution_suffix(pathname) {
156
+ return pathname.replace(/\/$/, "") + ROUTE_SUFFIX;
157
+ }
158
+ /**
159
+ * @param {string} pathname
160
+ * @returns {string}
161
+ */
162
+ function strip_resolution_suffix(pathname) {
163
+ return pathname.slice(0, -11);
164
+ }
165
+ //#endregion
166
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/telemetry/noop.js
167
+ /**
168
+ * @type {Span}
169
+ */
170
+ var noop_span = {
171
+ spanContext() {
172
+ return noop_span_context;
173
+ },
174
+ setAttribute() {
175
+ return this;
176
+ },
177
+ setAttributes() {
178
+ return this;
179
+ },
180
+ addEvent() {
181
+ return this;
182
+ },
183
+ setStatus() {
184
+ return this;
185
+ },
186
+ updateName() {
187
+ return this;
188
+ },
189
+ end() {
190
+ return this;
191
+ },
192
+ isRecording() {
193
+ return false;
194
+ },
195
+ recordException() {
196
+ return this;
197
+ },
198
+ addLink() {
199
+ return this;
200
+ },
201
+ addLinks() {
202
+ return this;
203
+ }
204
+ };
205
+ /**
206
+ * @type {SpanContext}
207
+ */
208
+ var noop_span_context = {
209
+ traceId: "",
210
+ spanId: "",
211
+ traceFlags: 0
212
+ };
213
+ //#endregion
214
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/telemetry/record_span.js
215
+ /** @import { RecordSpan } from 'types' */
216
+ /** @type {RecordSpan} */
217
+ async function record_span({ name, attributes, fn }) {
218
+ return fn(noop_span);
219
+ }
220
+ //#endregion
221
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/page/actions.js
222
+ /** @import { RequestEvent, ActionResult, Actions } from '@sveltejs/kit' */
223
+ /** @import { SSROptions, SSRNode, ServerNode, ServerHooks } from 'types' */
224
+ /** @param {RequestEvent} event */
225
+ function is_action_json_request(event) {
226
+ return negotiate(event.request.headers.get("accept") ?? "*/*", ["application/json", "text/html"]) === "application/json" && event.request.method === "POST";
227
+ }
228
+ /**
229
+ * @param {RequestEvent} event
230
+ * @param {import('types').RequestState} event_state
231
+ * @param {SSROptions} options
232
+ * @param {SSRNode['server'] | undefined} server
233
+ */
234
+ async function handle_action_json_request(event, event_state, options, server) {
235
+ const actions = server?.actions;
236
+ if (!actions) {
237
+ const no_actions_error = new SvelteKitError(405, "Method Not Allowed", `POST method not allowed. No form actions exist for this page`);
238
+ return action_json({
239
+ type: "error",
240
+ error: await handle_error_and_jsonify(event, event_state, options, no_actions_error)
241
+ }, {
242
+ status: no_actions_error.status,
243
+ headers: { allow: "GET" }
244
+ });
245
+ }
246
+ check_named_default_separate(actions);
247
+ try {
248
+ const data = await call_action(event, event_state, actions);
249
+ if (data instanceof ActionFailure) return action_json({
250
+ type: "failure",
251
+ status: data.status,
252
+ data: stringify_action_response(data.data, event.route.id, options.hooks.transport)
253
+ });
254
+ else return action_json({
255
+ type: "success",
256
+ status: data ? 200 : 204,
257
+ data: stringify_action_response(data, event.route.id, options.hooks.transport)
258
+ });
259
+ } catch (e) {
260
+ const err = normalize_error(e);
261
+ if (err instanceof Redirect) return action_json_redirect(err);
262
+ return action_json({
263
+ type: "error",
264
+ error: await handle_error_and_jsonify(event, event_state, options, check_incorrect_fail_use(err))
265
+ }, { status: get_status(err) });
266
+ }
267
+ }
268
+ /**
269
+ * @param {HttpError | Error} error
270
+ */
271
+ function check_incorrect_fail_use(error) {
272
+ return error instanceof ActionFailure ? /* @__PURE__ */ new Error("Cannot \"throw fail()\". Use \"return fail()\"") : error;
273
+ }
274
+ /**
275
+ * @param {Redirect} redirect
276
+ */
277
+ function action_json_redirect(redirect) {
278
+ return action_json({
279
+ type: "redirect",
280
+ status: redirect.status,
281
+ location: redirect.location
282
+ });
283
+ }
284
+ /**
285
+ * @param {ActionResult} data
286
+ * @param {ResponseInit} [init]
287
+ */
288
+ function action_json(data, init) {
289
+ return json(data, init);
290
+ }
291
+ /**
292
+ * @param {RequestEvent} event
293
+ */
294
+ function is_action_request(event) {
295
+ return event.request.method === "POST";
296
+ }
297
+ /**
298
+ * @param {RequestEvent} event
299
+ * @param {import('types').RequestState} event_state
300
+ * @param {SSRNode['server'] | undefined} server
301
+ * @returns {Promise<ActionResult>}
302
+ */
303
+ async function handle_action_request(event, event_state, server) {
304
+ const actions = server?.actions;
305
+ if (!actions) {
306
+ event.setHeaders({ allow: "GET" });
307
+ return {
308
+ type: "error",
309
+ error: new SvelteKitError(405, "Method Not Allowed", `POST method not allowed. No form actions exist for this page`)
310
+ };
311
+ }
312
+ check_named_default_separate(actions);
313
+ try {
314
+ const data = await call_action(event, event_state, actions);
315
+ if (data instanceof ActionFailure) return {
316
+ type: "failure",
317
+ status: data.status,
318
+ data: data.data
319
+ };
320
+ else return {
321
+ type: "success",
322
+ status: 200,
323
+ data
324
+ };
325
+ } catch (e) {
326
+ const err = normalize_error(e);
327
+ if (err instanceof Redirect) return {
328
+ type: "redirect",
329
+ status: err.status,
330
+ location: err.location
331
+ };
332
+ return {
333
+ type: "error",
334
+ error: check_incorrect_fail_use(err)
335
+ };
336
+ }
337
+ }
338
+ /**
339
+ * @param {Actions} actions
340
+ */
341
+ function check_named_default_separate(actions) {
342
+ if (actions.default && Object.keys(actions).length > 1) throw new Error("When using named actions, the default action cannot be used. See the docs for more info: https://svelte.dev/docs/kit/form-actions#named-actions");
343
+ }
344
+ /**
345
+ * @param {RequestEvent} event
346
+ * @param {import('types').RequestState} event_state
347
+ * @param {NonNullable<ServerNode['actions']>} actions
348
+ * @throws {Redirect | HttpError | SvelteKitError | Error}
349
+ */
350
+ async function call_action(event, event_state, actions) {
351
+ const url = new URL(event.request.url);
352
+ let name = "default";
353
+ for (const param of url.searchParams) if (param[0].startsWith("/")) {
354
+ name = param[0].slice(1);
355
+ if (name === "default") throw new Error("Cannot use reserved action name \"default\"");
356
+ break;
357
+ }
358
+ const action = actions[name];
359
+ if (!action) throw new SvelteKitError(404, "Not Found", `No action with name '${name}' found`);
360
+ if (!is_form_content_type(event.request)) throw new SvelteKitError(415, "Unsupported Media Type", `Form actions expect form-encoded data — received ${event.request.headers.get("content-type")}`);
361
+ return record_span({
362
+ name: "sveltekit.form_action",
363
+ attributes: {
364
+ "http.route": event.route.id || "unknown"
365
+ },
366
+ fn: async (current) => {
367
+ const traced_event = merge_tracing(event, current);
368
+ const result = await with_request_store({
369
+ event: traced_event,
370
+ state: event_state
371
+ }, () => action(traced_event));
372
+ if (result instanceof ActionFailure) current.setAttributes({
373
+ "sveltekit.form_action.result.type": "failure",
374
+ "sveltekit.form_action.result.status": result.status
375
+ });
376
+ return result;
377
+ }
378
+ });
379
+ }
380
+ /**
381
+ * Try to `devalue.uneval` the data object, and if it fails, return a proper Error with context
382
+ * @param {any} data
383
+ * @param {string} route_id
384
+ * @param {ServerHooks['transport']} transport
385
+ */
386
+ function uneval_action_response(data, route_id, transport) {
387
+ const replacer = create_replacer(transport);
388
+ return try_serialize(data, (value) => uneval(value, replacer), route_id);
389
+ }
390
+ /**
391
+ * Try to `devalue.stringify` the data object, and if it fails, return a proper Error with context
392
+ * @param {any} data
393
+ * @param {string} route_id
394
+ * @param {ServerHooks['transport']} transport
395
+ */
396
+ function stringify_action_response(data, route_id, transport) {
397
+ const encoders = Object.fromEntries(Object.entries(transport).map(([key, value]) => [key, value.encode]));
398
+ return try_serialize(data, (value) => stringify$1(value, encoders), route_id);
399
+ }
400
+ /**
401
+ * @param {any} data
402
+ * @param {(data: any) => string} fn
403
+ * @param {string} route_id
404
+ */
405
+ function try_serialize(data, fn, route_id) {
406
+ try {
407
+ return fn(data);
408
+ } catch (e) {
409
+ const error = e;
410
+ if (data instanceof Response) throw new Error(`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" });`, { cause: e });
411
+ if ("path" in error) {
412
+ let message = `Data returned from action inside ${route_id} is not serializable: ${error.message}`;
413
+ if (error.path !== "") message += ` (data.${error.path})`;
414
+ throw new Error(message, { cause: e });
415
+ }
416
+ throw error;
417
+ }
418
+ }
419
+ //#endregion
420
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/utils/streaming.js
421
+ /**
422
+ * Create an async iterator and a function to push values into it
423
+ * @template T
424
+ * @returns {{
425
+ * iterate: (transform?: (input: T) => T) => AsyncIterable<T>;
426
+ * add: (promise: Promise<T>) => void;
427
+ * }}
428
+ */
429
+ function create_async_iterator() {
430
+ let resolved = -1;
431
+ let returned = -1;
432
+ /** @type {import('./promise.js').PromiseWithResolvers<T>[]} */
433
+ const deferred = [];
434
+ return {
435
+ iterate: (transform = (x) => x) => {
436
+ return { [Symbol.asyncIterator]() {
437
+ return { next: async () => {
438
+ const next = deferred[++returned];
439
+ if (!next) return {
440
+ value: null,
441
+ done: true
442
+ };
443
+ return {
444
+ value: transform(await next.promise),
445
+ done: false
446
+ };
447
+ } };
448
+ } };
449
+ },
450
+ add: (promise) => {
451
+ /** @type {import('./promise.js').PromiseWithResolvers<T>} */
452
+ const next = with_resolvers();
453
+ next.promise.catch(noop);
454
+ deferred.push(next);
455
+ promise.then((value) => {
456
+ deferred[++resolved].resolve(value);
457
+ }, (error) => {
458
+ deferred[++resolved].reject(error);
459
+ });
460
+ }
461
+ };
462
+ }
463
+ //#endregion
464
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/page/data_serializer.js
465
+ /**
466
+ * If the serialized data contains promises, `chunks` will be an
467
+ * async iterable containing their resolutions
468
+ * @param {import('@sveltejs/kit').RequestEvent} event
469
+ * @param {import('types').RequestState} event_state
470
+ * @param {import('types').SSROptions} options
471
+ * @returns {import('./types.js').ServerDataSerializer}
472
+ */
473
+ function server_data_serializer(event, event_state, options) {
474
+ let promise_id = 1;
475
+ let max_nodes = -1;
476
+ const iterator = create_async_iterator();
477
+ const global = get_global_name(options);
478
+ /** @param {number} index */
479
+ function get_replacer(index) {
480
+ /** @param {any} thing */
481
+ return function replacer(thing) {
482
+ if (typeof thing?.then === "function") {
483
+ const id = promise_id++;
484
+ const promise = thing.then(
485
+ /** @param {any} data */
486
+ (data) => ({ data })
487
+ ).catch(
488
+ /** @param {any} error */
489
+ async (error) => ({ error: await handle_error_and_jsonify(event, event_state, options, error) })
490
+ ).then(
491
+ /**
492
+ * @param {{data: any; error: any}} result
493
+ */
494
+ async ({ data, error }) => {
495
+ let str;
496
+ try {
497
+ str = uneval(error ? [, error] : [data], replacer);
498
+ } catch {
499
+ error = await handle_error_and_jsonify(event, event_state, options, /* @__PURE__ */ new Error(`Failed to serialize promise while rendering ${event.route.id}`));
500
+ str = uneval([, error], replacer);
501
+ }
502
+ return {
503
+ index,
504
+ str: `${global}.resolve(${id}, ${str.includes("app.decode") ? `(app) => ${str}` : `() => ${str}`})`
505
+ };
506
+ }
507
+ );
508
+ iterator.add(promise);
509
+ return `${global}.defer(${id})`;
510
+ } else for (const key in options.hooks.transport) {
511
+ const encoded = options.hooks.transport[key].encode(thing);
512
+ if (encoded) return `app.decode('${key}', ${uneval(encoded, replacer)})`;
513
+ }
514
+ };
515
+ }
516
+ const strings = [];
517
+ return {
518
+ set_max_nodes(i) {
519
+ max_nodes = i;
520
+ },
521
+ add_node(i, node) {
522
+ try {
523
+ if (!node) {
524
+ strings[i] = "null";
525
+ return;
526
+ }
527
+ /** @type {any} */
528
+ const payload = {
529
+ type: "data",
530
+ data: node.data,
531
+ uses: serialize_uses(node)
532
+ };
533
+ if (node.slash) payload.slash = node.slash;
534
+ strings[i] = uneval(payload, get_replacer(i));
535
+ } catch (e) {
536
+ e.path = e.path.slice(1);
537
+ throw new Error(clarify_devalue_error(event, e), { cause: e });
538
+ }
539
+ },
540
+ get_data(csp) {
541
+ const open = `<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ""}>`;
542
+ const close = `<\/script>\n`;
543
+ return {
544
+ data: `[${compact(max_nodes > -1 ? strings.slice(0, max_nodes) : strings).join(",")}]`,
545
+ chunks: promise_id > 1 ? iterator.iterate(({ index, str }) => {
546
+ if (max_nodes > -1 && index >= max_nodes) return "";
547
+ return open + str + close;
548
+ }) : null
549
+ };
550
+ }
551
+ };
552
+ }
553
+ /**
554
+ * If the serialized data contains promises, `chunks` will be an
555
+ * async iterable containing their resolutions
556
+ * @param {import('@sveltejs/kit').RequestEvent} event
557
+ * @param {import('types').RequestState} event_state
558
+ * @param {import('types').SSROptions} options
559
+ * @returns {import('./types.js').ServerDataSerializerJson}
560
+ */
561
+ function server_data_serializer_json(event, event_state, options) {
562
+ let promise_id = 1;
563
+ const iterator = create_async_iterator();
564
+ const reducers = {
565
+ ...Object.fromEntries(Object.entries(options.hooks.transport).map(([key, value]) => [key, value.encode])),
566
+ /** @param {any} thing */
567
+ Promise: (thing) => {
568
+ if (typeof thing?.then !== "function") return;
569
+ const id = promise_id++;
570
+ /** @type {'data' | 'error'} */
571
+ let key = "data";
572
+ const promise = thing.catch(
573
+ /** @param {any} e */
574
+ async (e) => {
575
+ key = "error";
576
+ return handle_error_and_jsonify(event, event_state, options, e);
577
+ }
578
+ ).then(
579
+ /** @param {any} value */
580
+ async (value) => {
581
+ let str;
582
+ try {
583
+ str = stringify$1(value, reducers);
584
+ } catch {
585
+ const error = await handle_error_and_jsonify(event, event_state, options, /* @__PURE__ */ new Error(`Failed to serialize promise while rendering ${event.route.id}`));
586
+ key = "error";
587
+ str = stringify$1(error, reducers);
588
+ }
589
+ return `{"type":"chunk","id":${id},"${key}":${str}}\n`;
590
+ }
591
+ );
592
+ iterator.add(promise);
593
+ return id;
594
+ }
595
+ };
596
+ const strings = [];
597
+ return {
598
+ add_node(i, node) {
599
+ try {
600
+ if (!node) {
601
+ strings[i] = "null";
602
+ return;
603
+ }
604
+ if (node.type === "error" || node.type === "skip") {
605
+ strings[i] = JSON.stringify(node);
606
+ return;
607
+ }
608
+ strings[i] = `{"type":"data","data":${stringify$1(node.data, reducers)},"uses":${JSON.stringify(serialize_uses(node))}${node.slash ? `,"slash":${JSON.stringify(node.slash)}` : ""}}`;
609
+ } catch (e) {
610
+ e.path = "data" + e.path;
611
+ throw new Error(clarify_devalue_error(event, e), { cause: e });
612
+ }
613
+ },
614
+ get_data() {
615
+ return {
616
+ data: `{"type":"data","nodes":[${strings.join(",")}]}\n`,
617
+ chunks: promise_id > 1 ? iterator.iterate() : null
618
+ };
619
+ }
620
+ };
621
+ }
622
+ //#endregion
623
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/page/load_data.js
624
+ /**
625
+ * Calls the user's server `load` function.
626
+ * @param {{
627
+ * event: import('@sveltejs/kit').RequestEvent;
628
+ * event_state: import('types').RequestState;
629
+ * state: import('types').SSRState;
630
+ * node: import('types').SSRNode | undefined;
631
+ * parent: () => Promise<Record<string, any>>;
632
+ * }} opts
633
+ * @returns {Promise<import('types').ServerDataNode | null>}
634
+ */
635
+ async function load_server_data({ event, event_state, state, node, parent }) {
636
+ if (!node?.server) return null;
637
+ let is_tracking = true;
638
+ const uses = {
639
+ dependencies: /* @__PURE__ */ new Set(),
640
+ params: /* @__PURE__ */ new Set(),
641
+ parent: false,
642
+ route: false,
643
+ url: false,
644
+ search_params: /* @__PURE__ */ new Set()
645
+ };
646
+ const load = node.server.load;
647
+ const slash = node.server.trailingSlash;
648
+ if (!load) return {
649
+ type: "data",
650
+ data: null,
651
+ uses,
652
+ slash
653
+ };
654
+ const url = make_trackable(event.url, () => {
655
+ if (is_tracking) uses.url = true;
656
+ }, (param) => {
657
+ if (is_tracking) uses.search_params.add(param);
658
+ });
659
+ if (state.prerendering) disable_search(url);
660
+ return {
661
+ type: "data",
662
+ data: await record_span({
663
+ name: "sveltekit.load",
664
+ attributes: {
665
+ "sveltekit.load.node_id": node.server_id || "unknown",
666
+ "sveltekit.load.node_type": get_node_type(node.server_id),
667
+ "http.route": event.route.id || "unknown"
668
+ },
669
+ fn: async (current) => {
670
+ const traced_event = merge_tracing(event, current);
671
+ return await with_request_store({
672
+ event: traced_event,
673
+ state: event_state
674
+ }, () => load.call(null, {
675
+ ...traced_event,
676
+ fetch: (info, init) => {
677
+ new URL(info instanceof Request ? info.url : info, event.url);
678
+ return event.fetch(info, init);
679
+ },
680
+ /** @param {string[]} deps */
681
+ depends: (...deps) => {
682
+ for (const dep of deps) {
683
+ const { href } = new URL(dep, event.url);
684
+ uses.dependencies.add(href);
685
+ }
686
+ },
687
+ params: new Proxy(event.params, { get: (target, key) => {
688
+ if (is_tracking) uses.params.add(key);
689
+ return target[key];
690
+ } }),
691
+ parent: async () => {
692
+ if (is_tracking) uses.parent = true;
693
+ return parent();
694
+ },
695
+ route: new Proxy(event.route, { get: (target, key) => {
696
+ if (is_tracking) uses.route = true;
697
+ return target[key];
698
+ } }),
699
+ url,
700
+ untrack(fn) {
701
+ is_tracking = false;
702
+ try {
703
+ return fn();
704
+ } finally {
705
+ is_tracking = true;
706
+ }
707
+ }
708
+ }));
709
+ }
710
+ }) ?? null,
711
+ uses,
712
+ slash
713
+ };
714
+ }
715
+ /**
716
+ * Calls the user's `load` function.
717
+ * @param {{
718
+ * event: import('@sveltejs/kit').RequestEvent;
719
+ * event_state: import('types').RequestState;
720
+ * fetched: import('./types.js').Fetched[];
721
+ * node: import('types').SSRNode | undefined;
722
+ * parent: () => Promise<Record<string, any>>;
723
+ * resolve_opts: import('types').RequiredResolveOptions;
724
+ * server_data_promise: Promise<import('types').ServerDataNode | null>;
725
+ * state: import('types').SSRState;
726
+ * csr: boolean;
727
+ * }} opts
728
+ * @returns {Promise<Record<string, any | Promise<any>> | null>}
729
+ */
730
+ async function load_data({ event, event_state, fetched, node, parent, server_data_promise, state, resolve_opts, csr }) {
731
+ const server_data_node = await server_data_promise;
732
+ const load = node?.universal?.load;
733
+ if (!load) return server_data_node?.data ?? null;
734
+ return await record_span({
735
+ name: "sveltekit.load",
736
+ attributes: {
737
+ "sveltekit.load.node_id": node.universal_id || "unknown",
738
+ "sveltekit.load.node_type": get_node_type(node.universal_id),
739
+ "http.route": event.route.id || "unknown"
740
+ },
741
+ fn: async (current) => {
742
+ const traced_event = merge_tracing(event, current);
743
+ const child_state = {
744
+ ...event_state,
745
+ is_in_universal_load: true
746
+ };
747
+ return await with_request_store({
748
+ event: traced_event,
749
+ state: child_state
750
+ }, () => load.call(null, {
751
+ url: event.url,
752
+ params: event.params,
753
+ data: server_data_node?.data ?? null,
754
+ route: event.route,
755
+ fetch: create_universal_fetch(event, state, fetched, csr, resolve_opts),
756
+ setHeaders: event.setHeaders,
757
+ depends: noop,
758
+ parent,
759
+ untrack: (fn) => fn(),
760
+ tracing: traced_event.tracing
761
+ }));
762
+ }
763
+ }) ?? null;
764
+ }
765
+ /**
766
+ * @param {Pick<import('@sveltejs/kit').RequestEvent, 'fetch' | 'url' | 'request' | 'route'>} event
767
+ * @param {import('types').SSRState} state
768
+ * @param {import('./types.js').Fetched[]} fetched
769
+ * @param {boolean} csr
770
+ * @param {Pick<Required<import('@sveltejs/kit').ResolveOptions>, 'filterSerializedResponseHeaders'>} resolve_opts
771
+ * @returns {typeof fetch}
772
+ */
773
+ function create_universal_fetch(event, state, fetched, csr, resolve_opts) {
774
+ /**
775
+ * @param {URL | RequestInfo} input
776
+ * @param {RequestInit} [init]
777
+ */
778
+ const universal_fetch = async (input, init) => {
779
+ const cloned_body = input instanceof Request && input.body ? input.clone().body : null;
780
+ const cloned_headers = input instanceof Request && [...input.headers].length ? new Headers(input.headers) : init?.headers;
781
+ let response = await event.fetch(input, init);
782
+ const url = new URL(input instanceof Request ? input.url : input, event.url);
783
+ const same_origin = url.origin === event.url.origin;
784
+ /** @type {import('types').PrerenderDependency} */
785
+ let dependency;
786
+ if (same_origin) {
787
+ if (state.prerendering) {
788
+ dependency = {
789
+ response,
790
+ body: null
791
+ };
792
+ state.prerendering.dependencies.set(url.pathname, dependency);
793
+ }
794
+ } else if (url.protocol === "https:" || url.protocol === "http:") {
795
+ if ((input instanceof Request ? input.mode : init?.mode ?? "cors") === "no-cors") response = new Response("", {
796
+ status: response.status,
797
+ statusText: response.statusText,
798
+ headers: response.headers
799
+ });
800
+ else {
801
+ const acao = response.headers.get("access-control-allow-origin");
802
+ if (!acao || acao !== event.url.origin && acao !== "*") throw new Error(`CORS error: ${acao ? "Incorrect" : "No"} 'Access-Control-Allow-Origin' header is present on the requested resource`);
803
+ }
804
+ }
805
+ /** @type {ReadableStream<Uint8Array>} */
806
+ let teed_body;
807
+ const proxy = new Proxy(response, { get(response, key, receiver) {
808
+ /**
809
+ * @param {string | undefined} body
810
+ * @param {boolean} is_b64
811
+ */
812
+ async function push_fetched(body, is_b64) {
813
+ const status_number = Number(response.status);
814
+ if (isNaN(status_number)) throw new Error(`response.status is not a number. value: "${response.status}" type: ${typeof response.status}`);
815
+ fetched.push({
816
+ url: same_origin ? url.href.slice(event.url.origin.length) : url.href,
817
+ method: event.request.method,
818
+ request_body: input instanceof Request && cloned_body ? await stream_to_string(cloned_body) : init?.body,
819
+ request_headers: cloned_headers,
820
+ response_body: body,
821
+ response,
822
+ is_b64
823
+ });
824
+ }
825
+ if (key === "body") {
826
+ if (response.body === null) return null;
827
+ if (teed_body) return teed_body;
828
+ const [a, b] = response.body.tee();
829
+ (async () => {
830
+ let result = /* @__PURE__ */ new Uint8Array();
831
+ for await (const chunk of a) {
832
+ const combined = new Uint8Array(result.length + chunk.length);
833
+ combined.set(result, 0);
834
+ combined.set(chunk, result.length);
835
+ result = combined;
836
+ }
837
+ if (dependency) dependency.body = new Uint8Array(result);
838
+ push_fetched(base64_encode(result), true);
839
+ })().catch(noop);
840
+ return teed_body = b;
841
+ }
842
+ if (key === "arrayBuffer") return async () => {
843
+ const buffer = await response.arrayBuffer();
844
+ const bytes = new Uint8Array(buffer);
845
+ if (dependency) dependency.body = bytes;
846
+ if (buffer instanceof ArrayBuffer) await push_fetched(base64_encode(bytes), true);
847
+ return buffer;
848
+ };
849
+ async function text() {
850
+ const body = await response.text();
851
+ if (body === "" && NULL_BODY_STATUS.includes(response.status)) {
852
+ await push_fetched(void 0, false);
853
+ return;
854
+ }
855
+ if (!body || typeof body === "string") await push_fetched(body, false);
856
+ if (dependency) dependency.body = body;
857
+ return body;
858
+ }
859
+ if (key === "text") return text;
860
+ if (key === "json") return async () => {
861
+ const body = await text();
862
+ return body ? JSON.parse(body) : void 0;
863
+ };
864
+ const value = Reflect.get(response, key, response);
865
+ if (value instanceof Function) return Object.defineProperties(
866
+ /**
867
+ * @this {any}
868
+ */
869
+ function() {
870
+ return Reflect.apply(value, this === receiver ? response : this, arguments);
871
+ },
872
+ {
873
+ name: { value: value.name },
874
+ length: { value: value.length }
875
+ }
876
+ );
877
+ return value;
878
+ } });
879
+ if (csr) {
880
+ const get = response.headers.get;
881
+ response.headers.get = (key) => {
882
+ const lower = key.toLowerCase();
883
+ const value = get.call(response.headers, lower);
884
+ if (value && !lower.startsWith("x-sveltekit-")) {
885
+ if (!resolve_opts.filterSerializedResponseHeaders(lower, value)) throw new Error(`Failed to get response header "${lower}" — it must be included by the \`filterSerializedResponseHeaders\` option: https://svelte.dev/docs/kit/hooks#handle (at ${event.route.id})`);
886
+ }
887
+ return value;
888
+ };
889
+ }
890
+ return proxy;
891
+ };
892
+ return (input, init) => {
893
+ const response = universal_fetch(input, init);
894
+ response.catch(noop);
895
+ return response;
896
+ };
897
+ }
898
+ /**
899
+ * @param {ReadableStream<Uint8Array>} stream
900
+ */
901
+ async function stream_to_string(stream) {
902
+ let result = "";
903
+ const reader = stream.getReader();
904
+ const decoder = new TextDecoder();
905
+ while (true) {
906
+ const { done, value } = await reader.read();
907
+ if (done) {
908
+ result += decoder.decode();
909
+ break;
910
+ }
911
+ result += decoder.decode(value, { stream: true });
912
+ }
913
+ return result;
914
+ }
915
+ //#endregion
916
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/page/serialize_data.js
917
+ /**
918
+ * Inside a script element, only `<\/script` and `<!--` hold special meaning to the HTML parser.
919
+ *
920
+ * The first closes the script element, so everything after is treated as raw HTML.
921
+ * The second disables further parsing until `-->`, so the script element might be unexpectedly
922
+ * kept open up until an unrelated HTML comment in the page.
923
+ *
924
+ * U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR are escaped for the sake of pre-2018
925
+ * browsers.
926
+ *
927
+ * @see tests for unsafe parsing examples.
928
+ * @see https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements
929
+ * @see https://html.spec.whatwg.org/multipage/syntax.html#cdata-rcdata-restrictions
930
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#script-data-state
931
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#script-data-double-escaped-state
932
+ * @see https://github.com/tc39/proposal-json-superset
933
+ * @type {Record<string, string>}
934
+ */
935
+ var replacements = {
936
+ "<": "\\u003C",
937
+ "\u2028": "\\u2028",
938
+ "\u2029": "\\u2029"
939
+ };
940
+ var pattern = new RegExp(`[${Object.keys(replacements).join("")}]`, "g");
941
+ /**
942
+ * Generates a raw HTML string containing a safe script element carrying data and associated attributes.
943
+ *
944
+ * It escapes all the special characters needed to guarantee the element is unbroken, but care must
945
+ * be taken to ensure it is inserted in the document at an acceptable position for a script element,
946
+ * and that the resulting string isn't further modified.
947
+ *
948
+ * @param {import('./types.js').Fetched} fetched
949
+ * @param {(name: string, value: string) => boolean} filter
950
+ * @param {boolean} [prerendering]
951
+ * @returns {string} The raw HTML of a script element carrying the JSON payload.
952
+ * @example const html = serialize_data('/data.json', null, { foo: 'bar' });
953
+ */
954
+ function serialize_data(fetched, filter, prerendering = false) {
955
+ /** @type {Record<string, string>} */
956
+ const headers = {};
957
+ let cache_control = null;
958
+ let age = null;
959
+ let varyAny = false;
960
+ for (const [key, value] of fetched.response.headers) {
961
+ if (filter(key, value)) headers[key] = value;
962
+ if (key === "cache-control") cache_control = value;
963
+ else if (key === "age") age = value;
964
+ else if (key === "vary" && value.trim() === "*") varyAny = true;
965
+ }
966
+ const payload = {
967
+ status: fetched.response.status,
968
+ statusText: fetched.response.statusText,
969
+ headers,
970
+ body: fetched.response_body
971
+ };
972
+ const safe_payload = JSON.stringify(payload).replace(pattern, (match) => replacements[match]);
973
+ const attrs = [
974
+ "type=\"application/json\"",
975
+ "data-sveltekit-fetched",
976
+ `data-url="${escape_html(fetched.url, true)}"`
977
+ ];
978
+ if (fetched.is_b64) attrs.push("data-b64");
979
+ if (fetched.request_headers || fetched.request_body) {
980
+ /** @type {import('types').StrictBody[]} */
981
+ const values = [];
982
+ if (fetched.request_headers) values.push([...new Headers(fetched.request_headers)].join(","));
983
+ if (fetched.request_body) values.push(fetched.request_body);
984
+ attrs.push(`data-hash="${hash(...values)}"`);
985
+ }
986
+ if (!prerendering && fetched.method === "GET" && cache_control && !varyAny) {
987
+ const match = /s-maxage=(\d+)/g.exec(cache_control) ?? /max-age=(\d+)/g.exec(cache_control);
988
+ if (match) {
989
+ const ttl = +match[1] - +(age ?? "0");
990
+ attrs.push(`data-ttl="${ttl}"`);
991
+ }
992
+ }
993
+ return `<script ${attrs.join(" ")}>${safe_payload}<\/script>`;
994
+ }
995
+ //#endregion
996
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/page/crypto.js
997
+ /**
998
+ * SHA-256 hashing function adapted from https://bitwiseshiftleft.github.io/sjcl
999
+ * modified and redistributed under BSD license
1000
+ * @param {string} data
1001
+ */
1002
+ function sha256(data) {
1003
+ if (!key[0]) precompute();
1004
+ const out = init.slice(0);
1005
+ const array = encode(data);
1006
+ for (let i = 0; i < array.length; i += 16) {
1007
+ const w = array.subarray(i, i + 16);
1008
+ let tmp;
1009
+ let a;
1010
+ let b;
1011
+ let out0 = out[0];
1012
+ let out1 = out[1];
1013
+ let out2 = out[2];
1014
+ let out3 = out[3];
1015
+ let out4 = out[4];
1016
+ let out5 = out[5];
1017
+ let out6 = out[6];
1018
+ let out7 = out[7];
1019
+ for (let i = 0; i < 64; i++) {
1020
+ if (i < 16) tmp = w[i];
1021
+ else {
1022
+ a = w[i + 1 & 15];
1023
+ b = w[i + 14 & 15];
1024
+ tmp = w[i & 15] = (a >>> 7 ^ a >>> 18 ^ a >>> 3 ^ a << 25 ^ a << 14) + (b >>> 17 ^ b >>> 19 ^ b >>> 10 ^ b << 15 ^ b << 13) + w[i & 15] + w[i + 9 & 15] | 0;
1025
+ }
1026
+ tmp = tmp + out7 + (out4 >>> 6 ^ out4 >>> 11 ^ out4 >>> 25 ^ out4 << 26 ^ out4 << 21 ^ out4 << 7) + (out6 ^ out4 & (out5 ^ out6)) + key[i];
1027
+ out7 = out6;
1028
+ out6 = out5;
1029
+ out5 = out4;
1030
+ out4 = out3 + tmp | 0;
1031
+ out3 = out2;
1032
+ out2 = out1;
1033
+ out1 = out0;
1034
+ out0 = tmp + (out1 & out2 ^ out3 & (out1 ^ out2)) + (out1 >>> 2 ^ out1 >>> 13 ^ out1 >>> 22 ^ out1 << 30 ^ out1 << 19 ^ out1 << 10) | 0;
1035
+ }
1036
+ out[0] = out[0] + out0 | 0;
1037
+ out[1] = out[1] + out1 | 0;
1038
+ out[2] = out[2] + out2 | 0;
1039
+ out[3] = out[3] + out3 | 0;
1040
+ out[4] = out[4] + out4 | 0;
1041
+ out[5] = out[5] + out5 | 0;
1042
+ out[6] = out[6] + out6 | 0;
1043
+ out[7] = out[7] + out7 | 0;
1044
+ }
1045
+ const bytes = new Uint8Array(out.buffer);
1046
+ reverse_endianness(bytes);
1047
+ return btoa(String.fromCharCode(...bytes));
1048
+ }
1049
+ /** The SHA-256 initialization vector */
1050
+ var init = /* @__PURE__ */ new Uint32Array(8);
1051
+ /** The SHA-256 hash key */
1052
+ var key = /* @__PURE__ */ new Uint32Array(64);
1053
+ /** Function to precompute init and key. */
1054
+ function precompute() {
1055
+ /** @param {number} x */
1056
+ function frac(x) {
1057
+ return (x - Math.floor(x)) * 4294967296;
1058
+ }
1059
+ let prime = 2;
1060
+ for (let i = 0; i < 64; prime++) {
1061
+ let is_prime = true;
1062
+ for (let factor = 2; factor * factor <= prime; factor++) if (prime % factor === 0) {
1063
+ is_prime = false;
1064
+ break;
1065
+ }
1066
+ if (is_prime) {
1067
+ if (i < 8) init[i] = frac(prime ** (1 / 2));
1068
+ key[i] = frac(prime ** (1 / 3));
1069
+ i++;
1070
+ }
1071
+ }
1072
+ }
1073
+ /** @param {Uint8Array} bytes */
1074
+ function reverse_endianness(bytes) {
1075
+ for (let i = 0; i < bytes.length; i += 4) {
1076
+ const a = bytes[i + 0];
1077
+ const b = bytes[i + 1];
1078
+ const c = bytes[i + 2];
1079
+ const d = bytes[i + 3];
1080
+ bytes[i + 0] = d;
1081
+ bytes[i + 1] = c;
1082
+ bytes[i + 2] = b;
1083
+ bytes[i + 3] = a;
1084
+ }
1085
+ }
1086
+ /** @param {string} str */
1087
+ function encode(str) {
1088
+ const encoded = text_encoder.encode(str);
1089
+ const length = encoded.length * 8;
1090
+ const size = 512 * Math.ceil((length + 65) / 512);
1091
+ const bytes = new Uint8Array(size / 8);
1092
+ bytes.set(encoded);
1093
+ bytes[encoded.length] = 128;
1094
+ reverse_endianness(bytes);
1095
+ const words = new Uint32Array(bytes.buffer);
1096
+ words[words.length - 2] = Math.floor(length / 4294967296);
1097
+ words[words.length - 1] = length;
1098
+ return words;
1099
+ }
1100
+ //#endregion
1101
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/page/csp.js
1102
+ var array = /* @__PURE__ */ new Uint8Array(16);
1103
+ function generate_nonce() {
1104
+ crypto.getRandomValues(array);
1105
+ return btoa(String.fromCharCode(...array));
1106
+ }
1107
+ var quoted = /* @__PURE__ */ new Set([
1108
+ "self",
1109
+ "unsafe-eval",
1110
+ "unsafe-hashes",
1111
+ "unsafe-inline",
1112
+ "none",
1113
+ "strict-dynamic",
1114
+ "report-sample",
1115
+ "wasm-unsafe-eval",
1116
+ "script"
1117
+ ]);
1118
+ var crypto_pattern = /^(nonce|sha\d\d\d)-/;
1119
+ var BaseProvider = class {
1120
+ /** @type {boolean} */
1121
+ #use_hashes;
1122
+ /** @type {boolean} */
1123
+ #script_needs_csp;
1124
+ /** @type {boolean} */
1125
+ #script_src_needs_csp;
1126
+ /** @type {boolean} */
1127
+ #script_src_elem_needs_csp;
1128
+ /** @type {boolean} */
1129
+ #style_needs_csp;
1130
+ /** @type {boolean} */
1131
+ #style_src_needs_csp;
1132
+ /** @type {boolean} */
1133
+ #style_src_attr_needs_csp;
1134
+ /** @type {boolean} */
1135
+ #style_src_elem_needs_csp;
1136
+ /** @type {import('types').CspDirectives} */
1137
+ #directives;
1138
+ /** @type {Set<import('types').Csp.Source>} */
1139
+ #script_src;
1140
+ /** @type {Set<import('types').Csp.Source>} */
1141
+ #script_src_elem;
1142
+ /** @type {Set<import('types').Csp.Source>} */
1143
+ #style_src;
1144
+ /** @type {Set<import('types').Csp.Source>} */
1145
+ #style_src_attr;
1146
+ /** @type {Set<import('types').Csp.Source>} */
1147
+ #style_src_elem;
1148
+ /** @type {boolean} */
1149
+ script_needs_nonce;
1150
+ /** @type {boolean} */
1151
+ style_needs_nonce;
1152
+ /** @type {boolean} */
1153
+ script_needs_hash;
1154
+ /** @type {string} */
1155
+ #nonce;
1156
+ /**
1157
+ * @param {boolean} use_hashes
1158
+ * @param {import('types').CspDirectives} directives
1159
+ * @param {string} nonce
1160
+ */
1161
+ constructor(use_hashes, directives, nonce) {
1162
+ this.#use_hashes = use_hashes;
1163
+ this.#directives = directives;
1164
+ const d = this.#directives;
1165
+ this.#script_src = /* @__PURE__ */ new Set();
1166
+ this.#script_src_elem = /* @__PURE__ */ new Set();
1167
+ this.#style_src = /* @__PURE__ */ new Set();
1168
+ this.#style_src_attr = /* @__PURE__ */ new Set();
1169
+ this.#style_src_elem = /* @__PURE__ */ new Set();
1170
+ const effective_script_src = d["script-src"] || d["default-src"];
1171
+ const script_src_elem = d["script-src-elem"];
1172
+ const effective_style_src = d["style-src"] || d["default-src"];
1173
+ const style_src_attr = d["style-src-attr"];
1174
+ const style_src_elem = d["style-src-elem"];
1175
+ /** @param {(import('types').Csp.Source | import('types').Csp.ActionSource)[] | undefined} directive */
1176
+ const style_needs_csp = (directive) => !!directive && !directive.some((value) => value === "unsafe-inline");
1177
+ /** @param {(import('types').Csp.Source | import('types').Csp.ActionSource)[] | undefined} directive */
1178
+ const script_needs_csp = (directive) => !!directive && (!directive.some((value) => value === "unsafe-inline") || directive.some((value) => value === "strict-dynamic"));
1179
+ this.#script_src_needs_csp = script_needs_csp(effective_script_src);
1180
+ this.#script_src_elem_needs_csp = script_needs_csp(script_src_elem);
1181
+ this.#style_src_needs_csp = style_needs_csp(effective_style_src);
1182
+ this.#style_src_attr_needs_csp = style_needs_csp(style_src_attr);
1183
+ this.#style_src_elem_needs_csp = style_needs_csp(style_src_elem);
1184
+ this.#script_needs_csp = this.#script_src_needs_csp || this.#script_src_elem_needs_csp;
1185
+ this.#style_needs_csp = this.#style_src_needs_csp || this.#style_src_attr_needs_csp || this.#style_src_elem_needs_csp;
1186
+ this.script_needs_nonce = this.#script_needs_csp && !this.#use_hashes;
1187
+ this.style_needs_nonce = this.#style_needs_csp && !this.#use_hashes;
1188
+ this.script_needs_hash = this.#script_needs_csp && this.#use_hashes;
1189
+ this.#nonce = nonce;
1190
+ }
1191
+ /** @param {string} content */
1192
+ add_script(content) {
1193
+ if (!this.#script_needs_csp) return;
1194
+ /** @type {`nonce-${string}` | `sha256-${string}`} */
1195
+ const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
1196
+ if (this.#script_src_needs_csp) this.#script_src.add(source);
1197
+ if (this.#script_src_elem_needs_csp) this.#script_src_elem.add(source);
1198
+ }
1199
+ /** @param {`sha256-${string}`[]} hashes */
1200
+ add_script_hashes(hashes) {
1201
+ for (const hash of hashes) {
1202
+ if (this.#script_src_needs_csp) this.#script_src.add(hash);
1203
+ if (this.#script_src_elem_needs_csp) this.#script_src_elem.add(hash);
1204
+ }
1205
+ }
1206
+ /** @param {string} content */
1207
+ add_style(content) {
1208
+ if (!this.#style_needs_csp) return;
1209
+ /** @type {`nonce-${string}` | `sha256-${string}`} */
1210
+ const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
1211
+ if (this.#style_src_needs_csp) this.#style_src.add(source);
1212
+ if (this.#style_src_attr_needs_csp) this.#style_src_attr.add(source);
1213
+ if (this.#style_src_elem_needs_csp) {
1214
+ const sha256_empty_comment_hash = "sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=";
1215
+ const d = this.#directives;
1216
+ if (d["style-src-elem"] && !d["style-src-elem"].includes(sha256_empty_comment_hash) && !this.#style_src_elem.has(sha256_empty_comment_hash)) this.#style_src_elem.add(sha256_empty_comment_hash);
1217
+ if (source !== sha256_empty_comment_hash) this.#style_src_elem.add(source);
1218
+ }
1219
+ }
1220
+ /**
1221
+ * @param {boolean} [is_meta]
1222
+ */
1223
+ get_header(is_meta = false) {
1224
+ const header = [];
1225
+ const directives = { ...this.#directives };
1226
+ if (this.#style_src.size > 0) directives["style-src"] = [...directives["style-src"] || directives["default-src"] || [], ...this.#style_src];
1227
+ if (this.#style_src_attr.size > 0) directives["style-src-attr"] = [...directives["style-src-attr"] || [], ...this.#style_src_attr];
1228
+ if (this.#style_src_elem.size > 0) directives["style-src-elem"] = [...directives["style-src-elem"] || [], ...this.#style_src_elem];
1229
+ if (this.#script_src.size > 0) directives["script-src"] = [...directives["script-src"] || directives["default-src"] || [], ...this.#script_src];
1230
+ if (this.#script_src_elem.size > 0) directives["script-src-elem"] = [...directives["script-src-elem"] || [], ...this.#script_src_elem];
1231
+ for (const key in directives) {
1232
+ if (is_meta && (key === "frame-ancestors" || key === "report-uri" || key === "sandbox")) continue;
1233
+ const value = directives[key];
1234
+ if (!value) continue;
1235
+ const directive = [key];
1236
+ if (Array.isArray(value)) value.forEach((value) => {
1237
+ if (quoted.has(value) || crypto_pattern.test(value)) directive.push(`'${value}'`);
1238
+ else directive.push(value);
1239
+ });
1240
+ header.push(directive.join(" "));
1241
+ }
1242
+ return header.join("; ");
1243
+ }
1244
+ };
1245
+ var CspProvider = class extends BaseProvider {
1246
+ get_meta() {
1247
+ const content = this.get_header(true);
1248
+ if (!content) return;
1249
+ return `<meta http-equiv="content-security-policy" content="${escape_html(content, true)}">`;
1250
+ }
1251
+ };
1252
+ var CspReportOnlyProvider = class extends BaseProvider {
1253
+ /**
1254
+ * @param {boolean} use_hashes
1255
+ * @param {import('types').CspDirectives} directives
1256
+ * @param {string} nonce
1257
+ */
1258
+ constructor(use_hashes, directives, nonce) {
1259
+ super(use_hashes, directives, nonce);
1260
+ if (Object.values(directives).filter((v) => !!v).length > 0) {
1261
+ const has_report_to = directives["report-to"]?.length ?? false;
1262
+ const has_report_uri = directives["report-uri"]?.length ?? false;
1263
+ if (!has_report_to && !has_report_uri) throw Error("`content-security-policy-report-only` must be specified with either the `report-to` or `report-uri` directives, or both");
1264
+ }
1265
+ }
1266
+ };
1267
+ var Csp = class {
1268
+ /** @readonly */
1269
+ nonce = generate_nonce();
1270
+ /** @type {CspProvider} */
1271
+ csp_provider;
1272
+ /** @type {CspReportOnlyProvider} */
1273
+ report_only_provider;
1274
+ /**
1275
+ * @param {import('./types.js').CspConfig} config
1276
+ * @param {import('./types.js').CspOpts} opts
1277
+ */
1278
+ constructor({ mode, directives, reportOnly }, { prerender }) {
1279
+ const use_hashes = mode === "hash" || mode === "auto" && prerender;
1280
+ this.csp_provider = new CspProvider(use_hashes, directives, this.nonce);
1281
+ this.report_only_provider = new CspReportOnlyProvider(use_hashes, reportOnly, this.nonce);
1282
+ }
1283
+ get script_needs_hash() {
1284
+ return this.csp_provider.script_needs_hash || this.report_only_provider.script_needs_hash;
1285
+ }
1286
+ get script_needs_nonce() {
1287
+ return this.csp_provider.script_needs_nonce || this.report_only_provider.script_needs_nonce;
1288
+ }
1289
+ get style_needs_nonce() {
1290
+ return this.csp_provider.style_needs_nonce || this.report_only_provider.style_needs_nonce;
1291
+ }
1292
+ /** @param {string} content */
1293
+ add_script(content) {
1294
+ this.csp_provider.add_script(content);
1295
+ this.report_only_provider.add_script(content);
1296
+ }
1297
+ /** @param {`sha256-${string}`[]} hashes */
1298
+ add_script_hashes(hashes) {
1299
+ this.csp_provider.add_script_hashes(hashes);
1300
+ this.report_only_provider.add_script_hashes(hashes);
1301
+ }
1302
+ /** @param {string} content */
1303
+ add_style(content) {
1304
+ this.csp_provider.add_style(content);
1305
+ this.report_only_provider.add_style(content);
1306
+ }
1307
+ };
1308
+ //#endregion
1309
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/page/server_routing.js
1310
+ /** @import { SSRManifest } from '@sveltejs/kit' */
1311
+ /**
1312
+ * @param {import('types').SSRClientRoute} route
1313
+ * @param {URL} url
1314
+ * @param {NonNullable<SSRManifest['_']['client']>} client
1315
+ * @returns {string}
1316
+ */
1317
+ function generate_route_object(route, url, client) {
1318
+ const { errors, layouts, leaf } = route;
1319
+ const nodes = [
1320
+ ...errors,
1321
+ ...layouts.map((l) => l?.[1]),
1322
+ leaf[1]
1323
+ ].filter((n) => typeof n === "number").map((n) => `'${n}': () => ${create_client_import(client.nodes?.[n], url)}`).join(",\n ");
1324
+ /** @type {import('types').CSRRouteServer} */
1325
+ return [
1326
+ `{\n\tid: ${s(route.id)}`,
1327
+ `errors: ${s(route.errors)}`,
1328
+ `layouts: ${s(route.layouts)}`,
1329
+ `leaf: ${s(route.leaf)}`,
1330
+ `nodes: {\n\t\t${nodes}\n\t}\n}`
1331
+ ].join(",\n ");
1332
+ }
1333
+ /**
1334
+ * @param {string | undefined} import_path
1335
+ * @param {URL} url
1336
+ */
1337
+ function create_client_import(import_path, url) {
1338
+ if (!import_path) return "Promise.resolve({})";
1339
+ if (import_path[0] === "/") return `import('${import_path}')`;
1340
+ if (assets !== "") return `import('${assets}/${import_path}')`;
1341
+ let path = get_relative_path(url.pathname, `${base}/${import_path}`);
1342
+ if (path[0] !== ".") path = `./${path}`;
1343
+ return `import('${path}')`;
1344
+ }
1345
+ /**
1346
+ * @param {string} resolved_path
1347
+ * @param {URL} url
1348
+ * @param {SSRManifest} manifest
1349
+ * @returns {Promise<Response>}
1350
+ */
1351
+ async function resolve_route(resolved_path, url, manifest) {
1352
+ if (!manifest._.client?.routes) return text("Server-side route resolution disabled", { status: 400 });
1353
+ const matchers = await manifest._.matchers();
1354
+ const result = find_route(resolved_path, manifest._.client.routes, matchers);
1355
+ return create_server_routing_response(result?.route ?? null, result?.params ?? {}, url, manifest._.client).response;
1356
+ }
1357
+ /**
1358
+ * @param {import('types').SSRClientRoute | null} route
1359
+ * @param {Partial<Record<string, string>>} params
1360
+ * @param {URL} url
1361
+ * @param {NonNullable<SSRManifest['_']['client']>} client
1362
+ * @returns {{response: Response, body: string}}
1363
+ */
1364
+ function create_server_routing_response(route, params, url, client) {
1365
+ const headers = new Headers({ "content-type": "application/javascript; charset=utf-8" });
1366
+ if (route) {
1367
+ const csr_route = generate_route_object(route, url, client);
1368
+ const body = `${create_css_import(route, url, client)}\nexport const route = ${csr_route}; export const params = ${JSON.stringify(params)};`;
1369
+ return {
1370
+ response: text(body, { headers }),
1371
+ body
1372
+ };
1373
+ } else return {
1374
+ response: text("", { headers }),
1375
+ body: ""
1376
+ };
1377
+ }
1378
+ /**
1379
+ * This function generates the client-side import for the CSS files that are
1380
+ * associated with the current route. Vite takes care of that when using
1381
+ * client-side route resolution, but for server-side resolution it does
1382
+ * not know about the CSS files automatically.
1383
+ *
1384
+ * @param {import('types').SSRClientRoute} route
1385
+ * @param {URL} url
1386
+ * @param {NonNullable<SSRManifest['_']['client']>} client
1387
+ * @returns {string}
1388
+ */
1389
+ function create_css_import(route, url, client) {
1390
+ const { errors, layouts, leaf } = route;
1391
+ let css = "";
1392
+ for (const node of [
1393
+ ...errors,
1394
+ ...layouts.map((l) => l?.[1]),
1395
+ leaf[1]
1396
+ ]) {
1397
+ if (typeof node !== "number") continue;
1398
+ const node_css = client.css?.[node];
1399
+ for (const css_path of node_css ?? []) css += `'${assets || base}/${css_path}',`;
1400
+ }
1401
+ if (!css) return "";
1402
+ return `${create_client_import(client.start, url)}.then(x => x.load_css([${css}]));`;
1403
+ }
1404
+ //#endregion
1405
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/remote.js
1406
+ /** @import { ActionResult, RemoteForm, RequestEvent, SSRManifest } from '@sveltejs/kit' */
1407
+ /** @import { RemoteFormInternals, RemoteFunctionData, RemoteFunctionResponse, RemoteInternals, RequestState, SSROptions } from 'types' */
1408
+ /** @type {typeof handle_remote_call_internal} */
1409
+ async function handle_remote_call(event, state, options, manifest, id) {
1410
+ return record_span({
1411
+ name: "sveltekit.remote.call",
1412
+ attributes: { },
1413
+ fn: (current) => {
1414
+ const traced_event = merge_tracing(event, current);
1415
+ return with_request_store({
1416
+ event: traced_event,
1417
+ state
1418
+ }, () => handle_remote_call_internal(traced_event, state, options, manifest, id));
1419
+ }
1420
+ });
1421
+ }
1422
+ /**
1423
+ * @param {RequestEvent} event
1424
+ * @param {RequestState} state
1425
+ * @param {SSROptions} options
1426
+ * @param {SSRManifest} manifest
1427
+ * @param {string} id
1428
+ */
1429
+ async function handle_remote_call_internal(event, state, options, manifest, id) {
1430
+ const [hash, name, additional_args] = id.split("/");
1431
+ const remotes = manifest._.remotes;
1432
+ if (!remotes[hash]) error(404);
1433
+ const fn = (await remotes[hash]()).default[name];
1434
+ if (!fn) error(404);
1435
+ /** @type {RemoteInternals} */
1436
+ const internals = fn.__;
1437
+ const transport = options.hooks.transport;
1438
+ event.tracing.current.setAttributes({
1439
+ "sveltekit.remote.call.type": internals.type,
1440
+ "sveltekit.remote.call.name": internals.name
1441
+ });
1442
+ /** @type {HeadersInit | undefined} */
1443
+ const headers = state.prerendering ? void 0 : { "cache-control": "private, no-store" };
1444
+ try {
1445
+ /** @type {RemoteFunctionData} */
1446
+ const data = {};
1447
+ switch (internals.type) {
1448
+ case "query_live": {
1449
+ if (event.request.method !== "GET") throw new SvelteKitError(405, "Method Not Allowed", `\`query.live\` functions must be invoked via GET request, not ${event.request.method}`);
1450
+ const payload = new URL(event.request.url).searchParams.get("payload");
1451
+ const generator = internals.run(event, state, parse_remote_arg(payload, transport));
1452
+ const encoder = new TextEncoder();
1453
+ /**
1454
+ * @param {ReadableStreamDefaultController} controller
1455
+ * @param {any} payload
1456
+ */
1457
+ function send(controller, payload) {
1458
+ controller.enqueue(encoder.encode("data: " + JSON.stringify(payload) + "\n\n"));
1459
+ }
1460
+ let closed = false;
1461
+ /** @type {string | undefined} */
1462
+ let result = void 0;
1463
+ async function cancel() {
1464
+ if (closed) return;
1465
+ closed = true;
1466
+ await generator.return(void 0);
1467
+ }
1468
+ event.request.signal.addEventListener("abort", cancel, { once: true });
1469
+ return new Response(new ReadableStream({
1470
+ async pull(controller) {
1471
+ if (event.request.signal.aborted) {
1472
+ await cancel();
1473
+ controller.close();
1474
+ return;
1475
+ }
1476
+ try {
1477
+ while (true) {
1478
+ const { value, done } = await generator.next();
1479
+ if (done) {
1480
+ await cancel();
1481
+ controller.close();
1482
+ return;
1483
+ }
1484
+ if (result !== (result = stringify(value, transport))) {
1485
+ send(controller, {
1486
+ type: "result",
1487
+ result
1488
+ });
1489
+ return;
1490
+ }
1491
+ }
1492
+ } catch (error) {
1493
+ if (!event.request.signal.aborted) {
1494
+ if (error instanceof Redirect) send(controller, {
1495
+ type: "redirect",
1496
+ location: error.location
1497
+ });
1498
+ else {
1499
+ const status = error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
1500
+ send(controller, {
1501
+ type: "error",
1502
+ error: await handle_error_and_jsonify(event, state, options, error),
1503
+ status
1504
+ });
1505
+ }
1506
+ }
1507
+ await cancel();
1508
+ controller.close();
1509
+ }
1510
+ },
1511
+ cancel
1512
+ }), { headers: {
1513
+ "cache-control": "private, no-store",
1514
+ "content-type": "text/event-stream"
1515
+ } });
1516
+ }
1517
+ case "query_batch": {
1518
+ if (event.request.method !== "POST") throw new SvelteKitError(405, "Method Not Allowed", `\`query.batch\` functions must be invoked via POST request, not ${event.request.method}`);
1519
+ /** @type {{ payloads: string[] }} */
1520
+ const { payloads } = await event.request.json();
1521
+ const args = await Promise.all(payloads.map((payload) => parse_remote_arg(payload, transport)));
1522
+ data._ = await with_request_store({
1523
+ event,
1524
+ state
1525
+ }, () => internals.run(args, options));
1526
+ break;
1527
+ }
1528
+ case "form": {
1529
+ if (event.request.method !== "POST") throw new SvelteKitError(405, "Method Not Allowed", `\`form\` functions must be invoked via POST request, not ${event.request.method}`);
1530
+ if (!is_form_content_type(event.request)) throw new SvelteKitError(415, "Unsupported Media Type", `\`form\` functions expect form-encoded data — received ${event.request.headers.get("content-type")}`);
1531
+ const { data: input, meta, form_data } = await deserialize_binary_form(event.request);
1532
+ state.remote.requested = create_requested_map(meta.remote_refreshes);
1533
+ if (additional_args && !("id" in input)) input.id = JSON.parse(decodeURIComponent(additional_args));
1534
+ const fn = internals.fn;
1535
+ data._ = await with_request_store({
1536
+ event,
1537
+ state: {
1538
+ ...state,
1539
+ is_in_remote_form_or_command: true
1540
+ }
1541
+ }, () => fn(input, meta, form_data));
1542
+ if (data._.issues) return json({
1543
+ type: "result",
1544
+ data: stringify(data, transport)
1545
+ }, { headers });
1546
+ break;
1547
+ }
1548
+ case "command": {
1549
+ /** @type {{ payload: string, refreshes?: string[] }} */
1550
+ const { payload, refreshes } = await event.request.json();
1551
+ state.remote.requested = create_requested_map(refreshes);
1552
+ const arg = parse_remote_arg(payload, transport);
1553
+ data._ = await with_request_store({
1554
+ event,
1555
+ state: {
1556
+ ...state,
1557
+ is_in_remote_form_or_command: true
1558
+ }
1559
+ }, () => fn(arg));
1560
+ break;
1561
+ }
1562
+ case "prerender":
1563
+ data._ = await with_request_store({
1564
+ event,
1565
+ state
1566
+ }, () => fn(parse_remote_arg(additional_args, transport)));
1567
+ break;
1568
+ case "query": {
1569
+ const payload = new URL(event.request.url).searchParams.get("payload");
1570
+ data._ = await with_request_store({
1571
+ event,
1572
+ state
1573
+ }, () => fn(parse_remote_arg(payload, transport)));
1574
+ break;
1575
+ }
1576
+ }
1577
+ await collect_remote_data(data, event, state, options);
1578
+ return json({
1579
+ type: "result",
1580
+ data: stringify(data, transport)
1581
+ }, { headers });
1582
+ } catch (error) {
1583
+ if (error instanceof Redirect) {
1584
+ const data = await collect_remote_data({ redirect: error.location }, event, state, options);
1585
+ return json({
1586
+ type: "result",
1587
+ data: stringify(data, transport)
1588
+ }, { headers });
1589
+ }
1590
+ const status = error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
1591
+ return json({
1592
+ type: "error",
1593
+ error: await handle_error_and_jsonify(event, state, options, error),
1594
+ status
1595
+ }, {
1596
+ status: state.prerendering ? status : void 0,
1597
+ headers: { "cache-control": "private, no-store" }
1598
+ });
1599
+ }
1600
+ }
1601
+ /**
1602
+ * Collects all the query/prerender data that was retrieved
1603
+ * during the request and adds it to `data`
1604
+ * @param {RemoteFunctionData} data
1605
+ * @param {RequestEvent} event
1606
+ * @param {RequestState} state
1607
+ * @param {SSROptions} options
1608
+ */
1609
+ async function collect_remote_data(data, event, state, options) {
1610
+ /**
1611
+ *
1612
+ * @param {unknown} error
1613
+ * @returns {Promise<[status: number, error: App.Error]>}
1614
+ */
1615
+ async function convert_error(error) {
1616
+ return [error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500, await handle_error_and_jsonify(event, state, options, error)];
1617
+ }
1618
+ /** @type {Promise<any>[]} */
1619
+ const promises = [];
1620
+ if (state.remote.explicit) for (const [remote_key, { internals, promise }] of state.remote.explicit) {
1621
+ data.r = true;
1622
+ const type = internals.type === "query_live" ? "l" : internals.type[0];
1623
+ await promise.then((v) => {
1624
+ ((data[type] ??= {})[remote_key] ??= {}).v = v;
1625
+ }, async (e) => {
1626
+ if (e instanceof Redirect) return;
1627
+ ((data[type] ??= {})[remote_key] ??= {}).e = await convert_error(e);
1628
+ });
1629
+ }
1630
+ await Promise.all(promises);
1631
+ if (state.remote.implicit) for (const [internals, record] of state.remote.implicit) {
1632
+ if (!internals.id) continue;
1633
+ for (const key in record) {
1634
+ const remote_key = internals.type === "form" ? key : create_remote_key(internals.id, key);
1635
+ const type = internals.type === "query_live" ? "l" : internals.type[0];
1636
+ const promise = state.remote.data?.get(internals)?.[key] ?? record[key]();
1637
+ let resolved = true;
1638
+ await Promise.race([Promise.resolve(promise).then((v) => {
1639
+ if (resolved) ((data[type] ??= {})[remote_key] ??= {}).v = v;
1640
+ }, (e) => {
1641
+ if (e instanceof Redirect) return;
1642
+ if (resolved) promises.push(convert_error(e).then((e) => {
1643
+ ((data[type] ??= {})[remote_key] ??= {}).e = e;
1644
+ }));
1645
+ }), Promise.resolve().then(() => resolved = false)]);
1646
+ }
1647
+ }
1648
+ await Promise.all(promises);
1649
+ return data;
1650
+ }
1651
+ /**
1652
+ * @param {string[] | undefined} refreshes
1653
+ */
1654
+ function create_requested_map(refreshes) {
1655
+ /** @type {Map<string, string[]>} */
1656
+ const requested = /* @__PURE__ */ new Map();
1657
+ for (const key of refreshes ?? []) {
1658
+ const parts = split_remote_key(key);
1659
+ const existing = requested.get(parts.id);
1660
+ if (existing) existing.push(parts.payload);
1661
+ else requested.set(parts.id, [parts.payload]);
1662
+ }
1663
+ return requested;
1664
+ }
1665
+ /** @type {typeof handle_remote_form_post_internal} */
1666
+ async function handle_remote_form_post(event, state, manifest, id) {
1667
+ return record_span({
1668
+ name: "sveltekit.remote.form.post",
1669
+ attributes: { },
1670
+ fn: (current) => {
1671
+ const traced_event = merge_tracing(event, current);
1672
+ return with_request_store({
1673
+ event: traced_event,
1674
+ state
1675
+ }, () => handle_remote_form_post_internal(traced_event, state, manifest, id));
1676
+ }
1677
+ });
1678
+ }
1679
+ /**
1680
+ * @param {RequestEvent} event
1681
+ * @param {RequestState} state
1682
+ * @param {SSRManifest} manifest
1683
+ * @param {string} id
1684
+ * @returns {Promise<ActionResult>}
1685
+ */
1686
+ async function handle_remote_form_post_internal(event, state, manifest, id) {
1687
+ const [hash, name, ...rest] = id.split("/");
1688
+ const action_id = rest.join("/");
1689
+ let form = (await manifest._.remotes[hash]?.())?.default[name];
1690
+ if (!form) {
1691
+ event.setHeaders({ allow: "GET" });
1692
+ return {
1693
+ type: "error",
1694
+ error: new SvelteKitError(405, "Method Not Allowed", `POST method not allowed. No form actions exist for this page`)
1695
+ };
1696
+ }
1697
+ if (action_id) form = with_request_store({
1698
+ event,
1699
+ state
1700
+ }, () => form.for(JSON.parse(action_id)));
1701
+ try {
1702
+ const fn = form.__.fn;
1703
+ const { data, meta, form_data } = await deserialize_binary_form(event.request);
1704
+ if (action_id && !("id" in data)) data.id = JSON.parse(decodeURIComponent(action_id));
1705
+ await with_request_store({
1706
+ event,
1707
+ state: {
1708
+ ...state,
1709
+ is_in_remote_form_or_command: true
1710
+ }
1711
+ }, () => fn(data, meta, form_data));
1712
+ return {
1713
+ type: "success",
1714
+ status: 200
1715
+ };
1716
+ } catch (e) {
1717
+ const err = normalize_error(e);
1718
+ if (err instanceof Redirect) return {
1719
+ type: "redirect",
1720
+ status: err.status,
1721
+ location: err.location
1722
+ };
1723
+ return {
1724
+ type: "error",
1725
+ error: check_incorrect_fail_use(err)
1726
+ };
1727
+ }
1728
+ }
1729
+ /**
1730
+ * @param {URL} url
1731
+ */
1732
+ function get_remote_id(url) {
1733
+ return url.pathname.startsWith(`${base}/_app/remote/`) && url.pathname.replace(`${base}/_app/remote/`, "");
1734
+ }
1735
+ /**
1736
+ * @param {URL} url
1737
+ */
1738
+ function get_remote_action(url) {
1739
+ return url.searchParams.get("/remote");
1740
+ }
1741
+ //#endregion
1742
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/page/render.js
1743
+ var updated = {
1744
+ ...readable(false),
1745
+ check: () => false
1746
+ };
1747
+ /**
1748
+ * Creates the HTML response.
1749
+ * @param {{
1750
+ * branch: Array<import('./types.js').Loaded>;
1751
+ * fetched: Array<import('./types.js').Fetched>;
1752
+ * options: import('types').SSROptions;
1753
+ * manifest: import('@sveltejs/kit').SSRManifest;
1754
+ * state: import('types').SSRState;
1755
+ * page_config: { ssr: boolean; csr: boolean };
1756
+ * status: number;
1757
+ * error: App.Error | null;
1758
+ * event: import('@sveltejs/kit').RequestEvent;
1759
+ * event_state: import('types').RequestState;
1760
+ * resolve_opts: import('types').RequiredResolveOptions;
1761
+ * action_result?: import('@sveltejs/kit').ActionResult;
1762
+ * data_serializer: import('./types.js').ServerDataSerializer;
1763
+ * error_components?: Array<import('types').SSRComponent | undefined>
1764
+ * }} opts
1765
+ */
1766
+ async function render_response({ branch, fetched, options, manifest, state, page_config, status, error = null, event, event_state, resolve_opts, action_result, data_serializer, error_components }) {
1767
+ if (state.prerendering) {
1768
+ if (options.csp.mode === "nonce") throw new Error("Cannot use prerendering if config.kit.csp.mode === \"nonce\"");
1769
+ if (options.app_template_contains_nonce) throw new Error("Cannot use prerendering if page template contains %sveltekit.nonce%");
1770
+ }
1771
+ const { client } = manifest._;
1772
+ const modulepreloads = new Set(client?.imports);
1773
+ const stylesheets = new Set(client?.stylesheets);
1774
+ const fonts = new Set(client?.fonts);
1775
+ /**
1776
+ * The value of the Link header that is added to the response when not prerendering
1777
+ * @type {Set<string>}
1778
+ */
1779
+ const link_headers = /* @__PURE__ */ new Set();
1780
+ /** @type {Map<string, string>} */
1781
+ const inline_styles = /* @__PURE__ */ new Map();
1782
+ /** @type {ReturnType<typeof options.root.render>} */
1783
+ let rendered;
1784
+ const form_value = action_result?.type === "success" || action_result?.type === "failure" ? action_result.data ?? null : null;
1785
+ /** @type {string} */
1786
+ let base$1 = base;
1787
+ /** @type {string} */
1788
+ let assets$1 = assets;
1789
+ /**
1790
+ * An expression that will evaluate in the client to determine the resolved base path.
1791
+ * We use a relative path when possible to support IPFS, the internet archive, etc.
1792
+ */
1793
+ let base_expression = s(base);
1794
+ const csp = new Csp(options.csp, { prerender: !!state.prerendering });
1795
+ if (!state.prerendering?.fallback) {
1796
+ base$1 = (event.isDataRequest ? add_data_suffix(event.url.pathname) : event.url.pathname).slice(base.length).split("/").slice(2).map(() => "..").join("/") || ".";
1797
+ base_expression = `new URL(${s(base$1)}, location).pathname.slice(0, -1)`;
1798
+ if (!assets || assets[0] === "/" && assets !== "/_svelte_kit_assets") assets$1 = base$1;
1799
+ } else if (options.hash_routing) base_expression = "new URL('.', location).pathname.slice(0, -1)";
1800
+ if (page_config.ssr) {
1801
+ /** @type {Record<string, any>} */
1802
+ const props = {
1803
+ stores: {
1804
+ page: writable(null),
1805
+ navigating: writable(null),
1806
+ updated
1807
+ },
1808
+ constructors: await Promise.all(branch.map(({ node }) => {
1809
+ if (!node.component) throw new Error(`Missing +page.svelte component for route ${event.route.id}`);
1810
+ return node.component();
1811
+ })),
1812
+ form: form_value
1813
+ };
1814
+ if (error_components) {
1815
+ if (error) props.error = error;
1816
+ props.errors = error_components;
1817
+ }
1818
+ let data = {};
1819
+ for (let i = 0; i < branch.length; i += 1) {
1820
+ data = {
1821
+ ...data,
1822
+ ...branch[i].data
1823
+ };
1824
+ props[`data_${i}`] = data;
1825
+ }
1826
+ props.page = {
1827
+ error,
1828
+ params: event.params,
1829
+ route: event.route,
1830
+ status,
1831
+ url: event.url,
1832
+ data,
1833
+ form: form_value,
1834
+ state: {}
1835
+ };
1836
+ const render_opts = {
1837
+ context: /* @__PURE__ */ new Map([["__request__", { page: props.page }]]),
1838
+ csp: csp.script_needs_nonce ? { nonce: csp.nonce } : { hash: csp.script_needs_hash },
1839
+ transformError: error_components ? async (e) => {
1840
+ if (isRedirect(e)) throw e;
1841
+ const transformed = await handle_error_and_jsonify(event, event_state, options, e);
1842
+ props.page.error = props.error = error = transformed;
1843
+ props.page.status = status = get_status(e);
1844
+ return transformed;
1845
+ } : void 0
1846
+ };
1847
+ try {
1848
+ const state = {
1849
+ ...event_state,
1850
+ is_in_render: true
1851
+ };
1852
+ rendered = await with_request_store({
1853
+ event,
1854
+ state
1855
+ }, async () => {
1856
+ override({
1857
+ base: base$1,
1858
+ assets: assets$1
1859
+ });
1860
+ const maybe_promise = options.root.render(props, render_opts);
1861
+ const rendered = options.async && "then" in maybe_promise ? maybe_promise.then((r) => r) : maybe_promise;
1862
+ if (options.async) reset();
1863
+ const { head, html, css, hashes } = options.async ? await rendered : rendered;
1864
+ if (hashes) csp.add_script_hashes(hashes.script);
1865
+ return {
1866
+ head,
1867
+ html,
1868
+ css,
1869
+ hashes
1870
+ };
1871
+ });
1872
+ } finally {
1873
+ reset();
1874
+ }
1875
+ } else rendered = {
1876
+ head: "",
1877
+ html: "",
1878
+ css: {
1879
+ code: "",
1880
+ map: null
1881
+ },
1882
+ hashes: { script: [] }
1883
+ };
1884
+ for (const { node } of branch) {
1885
+ for (const url of node.imports) modulepreloads.add(url);
1886
+ for (const url of node.stylesheets) stylesheets.add(url);
1887
+ for (const url of node.fonts) fonts.add(url);
1888
+ if (node.inline_styles && !client?.inline) Object.entries(await node.inline_styles()).forEach(([filename, css]) => {
1889
+ if (typeof css === "string") {
1890
+ inline_styles.set(filename, css);
1891
+ return;
1892
+ }
1893
+ inline_styles.set(filename, css(`${assets$1}/${app_dir}/immutable/assets`, assets$1));
1894
+ });
1895
+ }
1896
+ const head = new Head(rendered.head, !!state.prerendering);
1897
+ let body = rendered.html;
1898
+ /** @param {string} path */
1899
+ const prefixed = (path) => {
1900
+ if (path.startsWith("/")) return base + path;
1901
+ return `${assets$1}/${path}`;
1902
+ };
1903
+ const style = client?.inline ? client.inline?.style : Array.from(inline_styles.values()).join("\n");
1904
+ if (style) {
1905
+ const attributes = [];
1906
+ if (csp.style_needs_nonce) attributes.push(`nonce="${csp.nonce}"`);
1907
+ csp.add_style(style);
1908
+ head.add_style(style, attributes);
1909
+ }
1910
+ for (const dep of stylesheets) {
1911
+ const path = prefixed(dep);
1912
+ const attributes = ["rel=\"stylesheet\""];
1913
+ if (inline_styles.has(dep)) attributes.push("disabled", "media=\"(max-width: 0)\"");
1914
+ else if (resolve_opts.preload({
1915
+ type: "css",
1916
+ path
1917
+ })) link_headers.add(`<${encodeURI(path)}>; rel="preload"; as="style"; nopush`);
1918
+ head.add_stylesheet(path, attributes);
1919
+ }
1920
+ for (const dep of fonts) {
1921
+ const path = prefixed(dep);
1922
+ if (resolve_opts.preload({
1923
+ type: "font",
1924
+ path
1925
+ })) {
1926
+ const ext = dep.slice(dep.lastIndexOf(".") + 1);
1927
+ head.add_link_tag(path, [
1928
+ "rel=\"preload\"",
1929
+ "as=\"font\"",
1930
+ `type="font/${ext}"`,
1931
+ "crossorigin"
1932
+ ]);
1933
+ link_headers.add(`<${encodeURI(path)}>; rel="preload"; as="font"; type="font/${ext}"; crossorigin; nopush`);
1934
+ }
1935
+ }
1936
+ const global = get_global_name(options);
1937
+ const { data, chunks } = data_serializer.get_data(csp);
1938
+ if (page_config.ssr && page_config.csr) body += `\n\t\t\t${fetched.map((item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, !!state.prerendering)).join("\n ")}`;
1939
+ if (page_config.csr && client) {
1940
+ const route = client.routes?.find((r) => r.id === event.route.id) ?? null;
1941
+ const load_env_eagerly = client.uses_env_dynamic_public && !!state.prerendering;
1942
+ if (load_env_eagerly) modulepreloads.add(`${app_dir}/env.js`);
1943
+ if (!client.inline) {
1944
+ const included_modulepreloads = Array.from(modulepreloads, (dep) => prefixed(dep)).filter((path) => resolve_opts.preload({
1945
+ type: "js",
1946
+ path
1947
+ }));
1948
+ for (const path of included_modulepreloads) {
1949
+ link_headers.add(`<${encodeURI(path)}>; rel="modulepreload"; nopush`);
1950
+ if (options.preload_strategy !== "modulepreload") head.add_script_preload(path);
1951
+ else head.add_link_tag(path, ["rel=\"modulepreload\""]);
1952
+ }
1953
+ }
1954
+ if (client.routes && state.prerendering && !state.prerendering.fallback) {
1955
+ const pathname = add_resolution_suffix(event.url.pathname);
1956
+ state.prerendering.dependencies.set(pathname, create_server_routing_response(route, event.params, new URL(pathname, event.url), client));
1957
+ }
1958
+ const blocks = [];
1959
+ const properties = [`base: ${base_expression}`];
1960
+ if (assets) properties.push(`assets: ${s(assets)}`);
1961
+ if (client.uses_env_dynamic_public) properties.push(`env: ${load_env_eagerly ? "null" : s(public_env)}`);
1962
+ if (chunks) {
1963
+ blocks.push("const deferred = new Map();");
1964
+ properties.push(`defer: (id) => new Promise((fulfil, reject) => {
1965
+ deferred.set(id, { fulfil, reject });
1966
+ })`);
1967
+ let app_declaration = "";
1968
+ if (Object.keys(options.hooks.transport).length > 0) {
1969
+ if (client.inline) app_declaration = `const app = ${global}.app.app;`;
1970
+ else if (client.app) app_declaration = `const app = await import(${s(prefixed(client.app))});`;
1971
+ else app_declaration = `const { app } = await import(${s(prefixed(client.start))});`;
1972
+ }
1973
+ const prelude = app_declaration ? `${app_declaration}
1974
+ const [data, error] = fn(app);` : `const [data, error] = fn();`;
1975
+ properties.push(`resolve: async (id, fn) => {
1976
+ ${prelude}
1977
+
1978
+ const try_to_resolve = () => {
1979
+ if (!deferred.has(id)) {
1980
+ setTimeout(try_to_resolve, 0);
1981
+ return;
1982
+ }
1983
+ const { fulfil, reject } = deferred.get(id);
1984
+ deferred.delete(id);
1985
+ if (error) reject(error);
1986
+ else fulfil(data);
1987
+ }
1988
+ try_to_resolve();
1989
+ }`);
1990
+ }
1991
+ blocks.push(`${global} = {
1992
+ ${properties.join(",\n ")}
1993
+ };`);
1994
+ const args = ["element"];
1995
+ blocks.push("const element = document.currentScript.parentElement;");
1996
+ if (page_config.ssr) {
1997
+ const serialized = {
1998
+ form: "null",
1999
+ error: "null"
2000
+ };
2001
+ if (form_value) serialized.form = uneval_action_response(form_value, event.route.id, options.hooks.transport);
2002
+ if (error) serialized.error = uneval(error);
2003
+ const hydrate = [
2004
+ `node_ids: [${branch.map(({ node }) => node.index).join(", ")}]`,
2005
+ `data: ${data}`,
2006
+ `form: ${serialized.form}`,
2007
+ `error: ${serialized.error}`
2008
+ ];
2009
+ if (status !== 200) hydrate.push(`status: ${status}`);
2010
+ if (client.routes) {
2011
+ if (route) {
2012
+ const stringified = generate_route_object(route, event.url, client).replaceAll("\n", "\n ");
2013
+ hydrate.push(`params: ${uneval(event.params)}`, `server_route: ${stringified}`);
2014
+ }
2015
+ } else if (options.embedded) hydrate.push(`params: ${uneval(event.params)}`, `route: ${s(event.route)}`);
2016
+ const indent = " ".repeat(load_env_eagerly ? 7 : 6);
2017
+ args.push(`{\n${indent}\t${hydrate.join(`,\n${indent}\t`)}\n${indent}}`);
2018
+ }
2019
+ const remote_data = await collect_remote_data({}, event, event_state, options);
2020
+ const serialized_data = Object.keys(remote_data).length > 0 ? `${global}.data = ${uneval(remote_data, create_replacer(options.hooks.transport))};\n\n\t\t\t\t\t\t` : "";
2021
+ const boot = client.inline ? `${client.inline.script}
2022
+
2023
+ ${serialized_data}${global}.app.start(${args.join(", ")});` : client.app ? `Promise.all([
2024
+ import(${s(prefixed(client.start))}),
2025
+ import(${s(prefixed(client.app))})
2026
+ ]).then(([kit, app]) => {
2027
+ ${serialized_data}kit.start(app, ${args.join(", ")});
2028
+ });` : `import(${s(prefixed(client.start))}).then((app) => {
2029
+ ${serialized_data}app.start(${args.join(", ")})
2030
+ });`;
2031
+ if (load_env_eagerly) blocks.push(`import(${s(`${base$1}/${app_dir}/env.js`)}).then(({ env }) => {
2032
+ ${global}.env = env;
2033
+
2034
+ ${boot.replace(/\n/g, "\n ")}
2035
+ });`);
2036
+ else blocks.push(boot);
2037
+ if (options.service_worker) {
2038
+ let opts = "";
2039
+ if (options.service_worker_options != null) opts = `, ${s({ ...options.service_worker_options })}`;
2040
+ blocks.push(`if ('serviceWorker' in navigator) {
2041
+ const script_url = '${prefixed("service-worker.js")}';
2042
+ const policy = globalThis?.window?.trustedTypes?.createPolicy(
2043
+ 'sveltekit-trusted-url',
2044
+ { createScriptURL(url) { return url; } }
2045
+ );
2046
+ const sanitised = policy?.createScriptURL(script_url) ?? script_url;
2047
+ addEventListener('load', function () {
2048
+ navigator.serviceWorker.register(sanitised${opts});
2049
+ });
2050
+ }`);
2051
+ }
2052
+ const init_app = `
2053
+ {
2054
+ ${blocks.join("\n\n ")}
2055
+ }
2056
+ `;
2057
+ csp.add_script(init_app);
2058
+ body += `\n\t\t\t<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ""}>${init_app}<\/script>\n\t\t`;
2059
+ }
2060
+ const headers = new Headers({
2061
+ "x-sveltekit-page": "true",
2062
+ "content-type": "text/html"
2063
+ });
2064
+ if (state.prerendering) {
2065
+ const csp_headers = csp.csp_provider.get_meta();
2066
+ if (csp_headers) head.add_http_equiv(csp_headers);
2067
+ if (state.prerendering.cache) head.add_http_equiv(`<meta http-equiv="cache-control" content="${state.prerendering.cache}">`);
2068
+ } else {
2069
+ const csp_header = csp.csp_provider.get_header();
2070
+ if (csp_header) headers.set("content-security-policy", csp_header);
2071
+ const report_only_header = csp.report_only_provider.get_header();
2072
+ if (report_only_header) headers.set("content-security-policy-report-only", report_only_header);
2073
+ if (link_headers.size) headers.set("link", Array.from(link_headers).join(", "));
2074
+ }
2075
+ const html = options.templates.app({
2076
+ head: head.build(),
2077
+ body,
2078
+ assets: assets$1,
2079
+ nonce: csp.nonce,
2080
+ env: public_env
2081
+ });
2082
+ const transformed = await resolve_opts.transformPageChunk({
2083
+ html,
2084
+ done: true
2085
+ }) || "";
2086
+ if (!chunks) headers.set("etag", `"${hash(transformed)}"`);
2087
+ return !chunks ? text(transformed, {
2088
+ status,
2089
+ headers
2090
+ }) : new Response(new ReadableStream({
2091
+ async start(controller) {
2092
+ controller.enqueue(text_encoder.encode(transformed + "\n"));
2093
+ for await (const chunk of chunks) if (chunk.length) controller.enqueue(text_encoder.encode(chunk));
2094
+ controller.close();
2095
+ },
2096
+ type: "bytes"
2097
+ }), { headers });
2098
+ }
2099
+ var Head = class {
2100
+ #rendered;
2101
+ #prerendering;
2102
+ /** @type {string[]} */
2103
+ #http_equiv = [];
2104
+ /** @type {string[]} */
2105
+ #link_tags = [];
2106
+ /** @type {string[]} */
2107
+ #script_preloads = [];
2108
+ /** @type {string[]} */
2109
+ #style_tags = [];
2110
+ /** @type {string[]} */
2111
+ #stylesheet_links = [];
2112
+ /**
2113
+ * @param {string} rendered
2114
+ * @param {boolean} prerendering
2115
+ */
2116
+ constructor(rendered, prerendering) {
2117
+ this.#rendered = rendered;
2118
+ this.#prerendering = prerendering;
2119
+ }
2120
+ build() {
2121
+ return [
2122
+ ...this.#http_equiv,
2123
+ ...this.#link_tags,
2124
+ ...this.#script_preloads,
2125
+ this.#rendered,
2126
+ ...this.#style_tags,
2127
+ ...this.#stylesheet_links
2128
+ ].join("\n ");
2129
+ }
2130
+ /**
2131
+ * @param {string} style
2132
+ * @param {string[]} attributes
2133
+ */
2134
+ add_style(style, attributes) {
2135
+ this.#style_tags.push(`<style${attributes.length ? " " + attributes.join(" ") : ""}>${style}</style>`);
2136
+ }
2137
+ /**
2138
+ * @param {string} href
2139
+ * @param {string[]} attributes
2140
+ */
2141
+ add_stylesheet(href, attributes) {
2142
+ this.#stylesheet_links.push(`<link href="${href}" ${attributes.join(" ")}>`);
2143
+ }
2144
+ /** @param {string} href */
2145
+ add_script_preload(href) {
2146
+ this.#script_preloads.push(`<link rel="preload" as="script" crossorigin="anonymous" href="${href}">`);
2147
+ }
2148
+ /**
2149
+ * @param {string} href
2150
+ * @param {string[]} attributes
2151
+ */
2152
+ add_link_tag(href, attributes) {
2153
+ if (!this.#prerendering) return;
2154
+ this.#link_tags.push(`<link href="${href}" ${attributes.join(" ")}>`);
2155
+ }
2156
+ /** @param {string} tag */
2157
+ add_http_equiv(tag) {
2158
+ if (!this.#prerendering) return;
2159
+ this.#http_equiv.push(tag);
2160
+ }
2161
+ };
2162
+ //#endregion
2163
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/utils/page_nodes.js
2164
+ var PageNodes = class {
2165
+ /** All layout nodes and the page node, if any */
2166
+ data;
2167
+ /**
2168
+ * @param {Array<import('types').SSRNode | undefined>} nodes
2169
+ */
2170
+ constructor(nodes) {
2171
+ this.data = nodes;
2172
+ }
2173
+ layouts() {
2174
+ return this.data.slice(0, -1);
2175
+ }
2176
+ page() {
2177
+ return this.data.at(-1);
2178
+ }
2179
+ validate() {
2180
+ for (const layout of this.layouts()) if (layout) {
2181
+ validate_layout_server_exports(layout.server, layout.server_id);
2182
+ validate_layout_exports(layout.universal, layout.universal_id);
2183
+ }
2184
+ const page = this.page();
2185
+ if (page) {
2186
+ validate_page_server_exports(page.server, page.server_id);
2187
+ validate_page_exports(page.universal, page.universal_id);
2188
+ }
2189
+ }
2190
+ /**
2191
+ * @template {'prerender' | 'ssr' | 'csr' | 'trailingSlash'} Option
2192
+ * @param {Option} option
2193
+ * @returns {Value | undefined}
2194
+ */
2195
+ #get_option(option) {
2196
+ /** @typedef {(import('types').UniversalNode | import('types').ServerNode)[Option]} Value */
2197
+ return this.data.reduce((value, node) => {
2198
+ return node?.universal?.[option] ?? node?.server?.[option] ?? value;
2199
+ }, void 0);
2200
+ }
2201
+ csr() {
2202
+ return this.#get_option("csr") ?? true;
2203
+ }
2204
+ ssr() {
2205
+ return this.#get_option("ssr") ?? true;
2206
+ }
2207
+ prerender() {
2208
+ return this.#get_option("prerender") ?? false;
2209
+ }
2210
+ trailing_slash() {
2211
+ return this.#get_option("trailingSlash") ?? "never";
2212
+ }
2213
+ get_config() {
2214
+ /** @type {any} */
2215
+ let current = {};
2216
+ for (const node of this.data) {
2217
+ if (!node?.universal?.config && !node?.server?.config) continue;
2218
+ current = {
2219
+ ...current,
2220
+ ...node?.universal?.config,
2221
+ ...node?.server?.config
2222
+ };
2223
+ }
2224
+ return Object.keys(current).length ? current : void 0;
2225
+ }
2226
+ should_prerender_data() {
2227
+ return this.data.some((node) => node?.server?.load || node?.server?.trailingSlash !== void 0);
2228
+ }
2229
+ };
2230
+ //#endregion
2231
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/page/respond_with_error.js
2232
+ /**
2233
+ * @typedef {import('./types.js').Loaded} Loaded
2234
+ */
2235
+ /**
2236
+ * @param {{
2237
+ * event: import('@sveltejs/kit').RequestEvent;
2238
+ * event_state: import('types').RequestState;
2239
+ * options: import('types').SSROptions;
2240
+ * manifest: import('@sveltejs/kit').SSRManifest;
2241
+ * state: import('types').SSRState;
2242
+ * status: number;
2243
+ * error: unknown;
2244
+ * resolve_opts: import('types').RequiredResolveOptions;
2245
+ * }} opts
2246
+ */
2247
+ async function respond_with_error({ event, event_state, options, manifest, state, status, error, resolve_opts }) {
2248
+ if (event.request.headers.get("x-sveltekit-error")) return static_error_page(
2249
+ options,
2250
+ status,
2251
+ /** @type {Error} */
2252
+ error.message
2253
+ );
2254
+ /** @type {import('./types.js').Fetched[]} */
2255
+ const fetched = [];
2256
+ try {
2257
+ const branch = [];
2258
+ const default_layout = await manifest._.nodes[0]();
2259
+ const nodes = new PageNodes([default_layout]);
2260
+ const ssr = nodes.ssr();
2261
+ const csr = nodes.csr();
2262
+ const data_serializer = server_data_serializer(event, event_state, options);
2263
+ if (ssr) {
2264
+ state.error = true;
2265
+ const server_data_promise = load_server_data({
2266
+ event,
2267
+ event_state,
2268
+ state,
2269
+ node: default_layout,
2270
+ parent: async () => ({})
2271
+ });
2272
+ const server_data = await server_data_promise;
2273
+ data_serializer.add_node(0, server_data);
2274
+ const data = await load_data({
2275
+ event,
2276
+ event_state,
2277
+ fetched,
2278
+ node: default_layout,
2279
+ parent: async () => ({}),
2280
+ resolve_opts,
2281
+ server_data_promise,
2282
+ state,
2283
+ csr
2284
+ });
2285
+ branch.push({
2286
+ node: default_layout,
2287
+ server_data,
2288
+ data
2289
+ }, {
2290
+ node: await manifest._.nodes[1](),
2291
+ data: null,
2292
+ server_data: null
2293
+ });
2294
+ }
2295
+ return await render_response({
2296
+ options,
2297
+ manifest,
2298
+ state,
2299
+ page_config: {
2300
+ ssr,
2301
+ csr
2302
+ },
2303
+ status,
2304
+ error: await handle_error_and_jsonify(event, event_state, options, error),
2305
+ branch,
2306
+ error_components: [],
2307
+ fetched,
2308
+ event,
2309
+ event_state,
2310
+ resolve_opts,
2311
+ data_serializer
2312
+ });
2313
+ } catch (e) {
2314
+ if (e instanceof Redirect) return redirect_response(e.status, e.location);
2315
+ return static_error_page(options, get_status(e), (await handle_error_and_jsonify(event, event_state, options, e)).message);
2316
+ }
2317
+ }
2318
+ //#endregion
2319
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/page/index.js
2320
+ /** @import { ActionResult, RequestEvent, SSRManifest } from '@sveltejs/kit' */
2321
+ /** @import { PageNodeIndexes, RequestState, RequiredResolveOptions, ServerDataNode, SSRComponent, SSRNode, SSROptions, SSRState } from 'types' */
2322
+ /**
2323
+ * The maximum request depth permitted before assuming we're stuck in an infinite loop
2324
+ */
2325
+ var MAX_DEPTH = 10;
2326
+ /**
2327
+ * @param {RequestEvent} event
2328
+ * @param {RequestState} event_state
2329
+ * @param {PageNodeIndexes} page
2330
+ * @param {SSROptions} options
2331
+ * @param {SSRManifest} manifest
2332
+ * @param {SSRState} state
2333
+ * @param {import('../../../utils/page_nodes.js').PageNodes} nodes
2334
+ * @param {RequiredResolveOptions} resolve_opts
2335
+ * @returns {Promise<Response>}
2336
+ */
2337
+ async function render_page(event, event_state, page, options, manifest, state, nodes, resolve_opts) {
2338
+ if (state.depth > MAX_DEPTH) return text(`Not found: ${event.url.pathname}`, { status: 404 });
2339
+ if (is_action_json_request(event)) return handle_action_json_request(event, event_state, options, (await manifest._.nodes[page.leaf]())?.server);
2340
+ try {
2341
+ const leaf_node = nodes.page();
2342
+ let status = 200;
2343
+ /** @type {ActionResult | undefined} */
2344
+ let action_result = void 0;
2345
+ if (is_action_request(event)) {
2346
+ const remote_id = get_remote_action(event.url);
2347
+ if (remote_id) action_result = await handle_remote_form_post(event, event_state, manifest, remote_id);
2348
+ else action_result = await handle_action_request(event, event_state, leaf_node.server);
2349
+ if (action_result?.type === "redirect") return redirect_response(action_result.status, action_result.location);
2350
+ if (action_result?.type === "error") status = get_status(action_result.error);
2351
+ if (action_result?.type === "failure") status = action_result.status;
2352
+ }
2353
+ const should_prerender = nodes.prerender();
2354
+ if (should_prerender) {
2355
+ if (leaf_node.server?.actions) throw new Error("Cannot prerender pages with actions");
2356
+ } else if (state.prerendering) return new Response(void 0, { status: 204 });
2357
+ state.prerender_default = should_prerender;
2358
+ const should_prerender_data = nodes.should_prerender_data();
2359
+ const data_pathname = add_data_suffix(event.url.pathname);
2360
+ /** @type {import('./types.js').Fetched[]} */
2361
+ const fetched = [];
2362
+ const ssr = nodes.ssr();
2363
+ const csr = nodes.csr();
2364
+ if (ssr === false && !(state.prerendering && should_prerender_data)) return await render_response({
2365
+ branch: compact(nodes.data).map((node) => {
2366
+ return {
2367
+ node,
2368
+ data: null,
2369
+ server_data: null
2370
+ };
2371
+ }),
2372
+ fetched,
2373
+ page_config: {
2374
+ ssr: false,
2375
+ csr
2376
+ },
2377
+ status,
2378
+ error: null,
2379
+ event,
2380
+ event_state,
2381
+ options,
2382
+ manifest,
2383
+ state,
2384
+ resolve_opts,
2385
+ data_serializer: server_data_serializer(event, event_state, options)
2386
+ });
2387
+ /** @type {Array<import('./types.js').Loaded | null>} */
2388
+ const branch = [];
2389
+ /** @type {Error | null} */
2390
+ let load_error = null;
2391
+ const data_serializer = server_data_serializer(event, event_state, options);
2392
+ const data_serializer_json = state.prerendering && should_prerender_data ? server_data_serializer_json(event, event_state, options) : null;
2393
+ /** @type {Array<Promise<ServerDataNode | null>>} */
2394
+ const server_promises = nodes.data.map((node, i) => {
2395
+ if (load_error) throw load_error;
2396
+ return Promise.resolve().then(async () => {
2397
+ try {
2398
+ if (node === leaf_node && action_result?.type === "error") throw action_result.error;
2399
+ const server_data = await load_server_data({
2400
+ event,
2401
+ event_state,
2402
+ state,
2403
+ node,
2404
+ parent: async () => {
2405
+ /** @type {Record<string, any>} */
2406
+ const data = {};
2407
+ for (let j = 0; j < i; j += 1) {
2408
+ const parent = await server_promises[j];
2409
+ if (parent) Object.assign(data, parent.data);
2410
+ }
2411
+ return data;
2412
+ }
2413
+ });
2414
+ if (node) data_serializer.add_node(i, server_data);
2415
+ data_serializer_json?.add_node(i, server_data);
2416
+ return server_data;
2417
+ } catch (e) {
2418
+ load_error = e;
2419
+ throw load_error;
2420
+ }
2421
+ });
2422
+ });
2423
+ /** @type {Array<Promise<Record<string, any> | null>>} */
2424
+ const load_promises = nodes.data.map((node, i) => {
2425
+ if (load_error) throw load_error;
2426
+ return Promise.resolve().then(async () => {
2427
+ try {
2428
+ return await load_data({
2429
+ event,
2430
+ event_state,
2431
+ fetched,
2432
+ node,
2433
+ parent: async () => {
2434
+ const data = {};
2435
+ for (let j = 0; j < i; j += 1) Object.assign(data, await load_promises[j]);
2436
+ return data;
2437
+ },
2438
+ resolve_opts,
2439
+ server_data_promise: server_promises[i],
2440
+ state,
2441
+ csr
2442
+ });
2443
+ } catch (e) {
2444
+ load_error = e;
2445
+ throw load_error;
2446
+ }
2447
+ });
2448
+ });
2449
+ for (const p of server_promises) p.catch(noop);
2450
+ for (const p of load_promises) p.catch(noop);
2451
+ for (let i = 0; i < nodes.data.length; i += 1) {
2452
+ const node = nodes.data[i];
2453
+ if (node) try {
2454
+ const server_data = await server_promises[i];
2455
+ const data = await load_promises[i];
2456
+ branch.push({
2457
+ node,
2458
+ server_data,
2459
+ data
2460
+ });
2461
+ } catch (e) {
2462
+ const err = normalize_error(e);
2463
+ if (err instanceof Redirect) {
2464
+ if (state.prerendering && should_prerender_data) {
2465
+ const body = JSON.stringify({
2466
+ type: "redirect",
2467
+ location: err.location
2468
+ });
2469
+ state.prerendering.dependencies.set(data_pathname, {
2470
+ response: text(body),
2471
+ body
2472
+ });
2473
+ }
2474
+ return redirect_response(err.status, err.location);
2475
+ }
2476
+ const status = get_status(err);
2477
+ const error = await handle_error_and_jsonify(event, event_state, options, err);
2478
+ while (i--) if (page.errors[i]) {
2479
+ const index = page.errors[i];
2480
+ const node = await manifest._.nodes[index]();
2481
+ let j = i;
2482
+ while (!branch[j]) j -= 1;
2483
+ data_serializer.set_max_nodes(j + 1);
2484
+ const layouts = compact(branch.slice(0, j + 1));
2485
+ const nodes = new PageNodes(layouts.map((layout) => layout.node));
2486
+ const error_branch = layouts.concat({
2487
+ node,
2488
+ data: null,
2489
+ server_data: null
2490
+ });
2491
+ return await render_response({
2492
+ event,
2493
+ event_state,
2494
+ options,
2495
+ manifest,
2496
+ state,
2497
+ resolve_opts,
2498
+ page_config: {
2499
+ ssr: nodes.ssr(),
2500
+ csr: nodes.csr()
2501
+ },
2502
+ status,
2503
+ error,
2504
+ error_components: await load_error_components(options, ssr, error_branch, page, manifest),
2505
+ branch: error_branch,
2506
+ fetched,
2507
+ data_serializer
2508
+ });
2509
+ }
2510
+ return static_error_page(options, status, error.message);
2511
+ }
2512
+ else branch.push(null);
2513
+ }
2514
+ if (state.prerendering && data_serializer_json) {
2515
+ let { data, chunks } = data_serializer_json.get_data();
2516
+ if (chunks) for await (const chunk of chunks) data += chunk;
2517
+ state.prerendering.dependencies.set(data_pathname, {
2518
+ response: text(data),
2519
+ body: data
2520
+ });
2521
+ }
2522
+ return await render_response({
2523
+ event,
2524
+ event_state,
2525
+ options,
2526
+ manifest,
2527
+ state,
2528
+ resolve_opts,
2529
+ page_config: {
2530
+ csr,
2531
+ ssr
2532
+ },
2533
+ status,
2534
+ error: null,
2535
+ branch: compact(branch),
2536
+ action_result,
2537
+ fetched,
2538
+ data_serializer: !ssr ? server_data_serializer(event, event_state, options) : data_serializer,
2539
+ error_components: await load_error_components(options, ssr, branch, page, manifest)
2540
+ });
2541
+ } catch (e) {
2542
+ if (e instanceof Redirect) return redirect_response(e.status, e.location);
2543
+ return await respond_with_error({
2544
+ event,
2545
+ event_state,
2546
+ options,
2547
+ manifest,
2548
+ state,
2549
+ status: e instanceof HttpError ? e.status : 500,
2550
+ error: e,
2551
+ resolve_opts
2552
+ });
2553
+ }
2554
+ }
2555
+ /**
2556
+ *
2557
+ * @param {SSROptions} options
2558
+ * @param {boolean} ssr
2559
+ * @param {Array<import('./types.js').Loaded | null>} branch
2560
+ * @param {PageNodeIndexes} page
2561
+ * @param {SSRManifest} manifest
2562
+ */
2563
+ async function load_error_components(options, ssr, branch, page, manifest) {
2564
+ /** @type {Array<SSRComponent | undefined> | undefined} */
2565
+ let error_components;
2566
+ if (options.server_error_boundaries && ssr) {
2567
+ let last_idx = -1;
2568
+ error_components = await Promise.all(branch.map((b, i) => {
2569
+ if (i === 0) return void 0;
2570
+ if (!b) return null;
2571
+ i--;
2572
+ while (i > last_idx + 1 && page.errors[i] === void 0) i -= 1;
2573
+ last_idx = i;
2574
+ const idx = page.errors[i];
2575
+ if (idx == null) return void 0;
2576
+ return manifest._.nodes[idx]?.().then((e) => e.component?.()).catch(() => void 0);
2577
+ }).filter((e) => e !== null));
2578
+ }
2579
+ return error_components;
2580
+ }
2581
+ //#endregion
2582
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/data/index.js
2583
+ /**
2584
+ * @param {import('@sveltejs/kit').RequestEvent} event
2585
+ * @param {import('types').RequestState} event_state
2586
+ * @param {import('types').SSRRoute} route
2587
+ * @param {import('types').SSROptions} options
2588
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
2589
+ * @param {import('types').SSRState} state
2590
+ * @param {boolean[] | undefined} invalidated_data_nodes
2591
+ * @param {import('types').TrailingSlash} trailing_slash
2592
+ * @returns {Promise<Response>}
2593
+ */
2594
+ async function render_data(event, event_state, route, options, manifest, state, invalidated_data_nodes, trailing_slash) {
2595
+ if (!route.page) return new Response(void 0, { status: 404 });
2596
+ try {
2597
+ const node_ids = [...route.page.layouts, route.page.leaf];
2598
+ const invalidated = invalidated_data_nodes ?? node_ids.map(() => true);
2599
+ let aborted = false;
2600
+ const url = new URL(event.url);
2601
+ url.pathname = normalize_path(url.pathname, trailing_slash);
2602
+ const new_event = {
2603
+ ...event,
2604
+ url
2605
+ };
2606
+ const functions = node_ids.map((n, i) => {
2607
+ return once(async () => {
2608
+ try {
2609
+ if (aborted) return { type: "skip" };
2610
+ const node = n == void 0 ? n : await manifest._.nodes[n]();
2611
+ return load_server_data({
2612
+ event: new_event,
2613
+ event_state,
2614
+ state,
2615
+ node,
2616
+ parent: async () => {
2617
+ /** @type {Record<string, any>} */
2618
+ const data = {};
2619
+ for (let j = 0; j < i; j += 1) {
2620
+ const parent = await functions[j]();
2621
+ if (parent) Object.assign(data, parent.data);
2622
+ }
2623
+ return data;
2624
+ }
2625
+ });
2626
+ } catch (e) {
2627
+ aborted = true;
2628
+ throw e;
2629
+ }
2630
+ });
2631
+ });
2632
+ const promises = functions.map(async (fn, i) => {
2633
+ if (!invalidated[i]) return { type: "skip" };
2634
+ return fn();
2635
+ });
2636
+ let length = promises.length;
2637
+ const nodes = await Promise.all(promises.map((p, i) => p.catch(async (error) => {
2638
+ if (error instanceof Redirect) throw error;
2639
+ length = Math.min(length, i + 1);
2640
+ return {
2641
+ type: "error",
2642
+ error: await handle_error_and_jsonify(event, event_state, options, error),
2643
+ status: error instanceof HttpError || error instanceof SvelteKitError ? error.status : void 0
2644
+ };
2645
+ })));
2646
+ const data_serializer = server_data_serializer_json(event, event_state, options);
2647
+ for (let i = 0; i < nodes.length; i++) data_serializer.add_node(i, nodes[i]);
2648
+ const { data, chunks } = data_serializer.get_data();
2649
+ if (!chunks) return json_response(data);
2650
+ return new Response(new ReadableStream({
2651
+ async start(controller) {
2652
+ controller.enqueue(text_encoder.encode(data));
2653
+ for await (const chunk of chunks) controller.enqueue(text_encoder.encode(chunk));
2654
+ controller.close();
2655
+ },
2656
+ type: "bytes"
2657
+ }), { headers: {
2658
+ "content-type": "text/sveltekit-data",
2659
+ "cache-control": "private, no-store"
2660
+ } });
2661
+ } catch (e) {
2662
+ const error = normalize_error(e);
2663
+ if (error instanceof Redirect) return redirect_json_response(error);
2664
+ else return json_response(await handle_error_and_jsonify(event, event_state, options, error), 500);
2665
+ }
2666
+ }
2667
+ /**
2668
+ * @param {Record<string, any> | string} json
2669
+ * @param {number} [status]
2670
+ */
2671
+ function json_response(json, status = 200) {
2672
+ return text(typeof json === "string" ? json : JSON.stringify(json), {
2673
+ status,
2674
+ headers: {
2675
+ "content-type": "application/json",
2676
+ "cache-control": "private, no-store"
2677
+ }
2678
+ });
2679
+ }
2680
+ /**
2681
+ * @param {Redirect} redirect
2682
+ */
2683
+ function redirect_json_response(redirect) {
2684
+ return json_response({
2685
+ type: "redirect",
2686
+ location: redirect.location
2687
+ });
2688
+ }
2689
+ /*!
2690
+ * cookie
2691
+ * Copyright(c) 2012-2014 Roman Shtylman
2692
+ * Copyright(c) 2015 Douglas Christopher Wilson
2693
+ * MIT Licensed
2694
+ */
2695
+ //#endregion
2696
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/cookie.js
2697
+ var import_cookie = (/* @__PURE__ */ __commonJSMin(((exports) => {
2698
+ /**
2699
+ * Module exports.
2700
+ * @public
2701
+ */
2702
+ exports.parse = parse;
2703
+ exports.serialize = serialize;
2704
+ /**
2705
+ * Module variables.
2706
+ * @private
2707
+ */
2708
+ var __toString = Object.prototype.toString;
2709
+ var __hasOwnProperty = Object.prototype.hasOwnProperty;
2710
+ /**
2711
+ * RegExp to match cookie-name in RFC 6265 sec 4.1.1
2712
+ * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
2713
+ * which has been replaced by the token definition in RFC 7230 appendix B.
2714
+ *
2715
+ * cookie-name = token
2716
+ * token = 1*tchar
2717
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" /
2718
+ * "*" / "+" / "-" / "." / "^" / "_" /
2719
+ * "`" / "|" / "~" / DIGIT / ALPHA
2720
+ */
2721
+ var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
2722
+ /**
2723
+ * RegExp to match cookie-value in RFC 6265 sec 4.1.1
2724
+ *
2725
+ * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
2726
+ * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
2727
+ * ; US-ASCII characters excluding CTLs,
2728
+ * ; whitespace DQUOTE, comma, semicolon,
2729
+ * ; and backslash
2730
+ */
2731
+ var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
2732
+ /**
2733
+ * RegExp to match domain-value in RFC 6265 sec 4.1.1
2734
+ *
2735
+ * domain-value = <subdomain>
2736
+ * ; defined in [RFC1034], Section 3.5, as
2737
+ * ; enhanced by [RFC1123], Section 2.1
2738
+ * <subdomain> = <label> | <subdomain> "." <label>
2739
+ * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
2740
+ * Labels must be 63 characters or less.
2741
+ * 'let-dig' not 'letter' in the first char, per RFC1123
2742
+ * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
2743
+ * <let-dig-hyp> = <let-dig> | "-"
2744
+ * <let-dig> = <letter> | <digit>
2745
+ * <letter> = any one of the 52 alphabetic characters A through Z in
2746
+ * upper case and a through z in lower case
2747
+ * <digit> = any one of the ten digits 0 through 9
2748
+ *
2749
+ * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
2750
+ *
2751
+ * > (Note that a leading %x2E ("."), if present, is ignored even though that
2752
+ * character is not permitted, but a trailing %x2E ("."), if present, will
2753
+ * cause the user agent to ignore the attribute.)
2754
+ */
2755
+ var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
2756
+ /**
2757
+ * RegExp to match path-value in RFC 6265 sec 4.1.1
2758
+ *
2759
+ * path-value = <any CHAR except CTLs or ";">
2760
+ * CHAR = %x01-7F
2761
+ * ; defined in RFC 5234 appendix B.1
2762
+ */
2763
+ var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
2764
+ /**
2765
+ * Parse a cookie header.
2766
+ *
2767
+ * Parse the given cookie header string into an object
2768
+ * The object has the various cookies as keys(names) => values
2769
+ *
2770
+ * @param {string} str
2771
+ * @param {object} [opt]
2772
+ * @return {object}
2773
+ * @public
2774
+ */
2775
+ function parse(str, opt) {
2776
+ if (typeof str !== "string") throw new TypeError("argument str must be a string");
2777
+ var obj = {};
2778
+ var len = str.length;
2779
+ if (len < 2) return obj;
2780
+ var dec = opt && opt.decode || decode;
2781
+ var index = 0;
2782
+ var eqIdx = 0;
2783
+ var endIdx = 0;
2784
+ do {
2785
+ eqIdx = str.indexOf("=", index);
2786
+ if (eqIdx === -1) break;
2787
+ endIdx = str.indexOf(";", index);
2788
+ if (endIdx === -1) endIdx = len;
2789
+ else if (eqIdx > endIdx) {
2790
+ index = str.lastIndexOf(";", eqIdx - 1) + 1;
2791
+ continue;
2792
+ }
2793
+ var keyStartIdx = startIndex(str, index, eqIdx);
2794
+ var keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
2795
+ var key = str.slice(keyStartIdx, keyEndIdx);
2796
+ if (!__hasOwnProperty.call(obj, key)) {
2797
+ var valStartIdx = startIndex(str, eqIdx + 1, endIdx);
2798
+ var valEndIdx = endIndex(str, endIdx, valStartIdx);
2799
+ if (str.charCodeAt(valStartIdx) === 34 && str.charCodeAt(valEndIdx - 1) === 34) {
2800
+ valStartIdx++;
2801
+ valEndIdx--;
2802
+ }
2803
+ obj[key] = tryDecode(str.slice(valStartIdx, valEndIdx), dec);
2804
+ }
2805
+ index = endIdx + 1;
2806
+ } while (index < len);
2807
+ return obj;
2808
+ }
2809
+ function startIndex(str, index, max) {
2810
+ do {
2811
+ var code = str.charCodeAt(index);
2812
+ if (code !== 32 && code !== 9) return index;
2813
+ } while (++index < max);
2814
+ return max;
2815
+ }
2816
+ function endIndex(str, index, min) {
2817
+ while (index > min) {
2818
+ var code = str.charCodeAt(--index);
2819
+ if (code !== 32 && code !== 9) return index + 1;
2820
+ }
2821
+ return min;
2822
+ }
2823
+ /**
2824
+ * Serialize data into a cookie header.
2825
+ *
2826
+ * Serialize a name value pair into a cookie string suitable for
2827
+ * http headers. An optional options object specifies cookie parameters.
2828
+ *
2829
+ * serialize('foo', 'bar', { httpOnly: true })
2830
+ * => "foo=bar; httpOnly"
2831
+ *
2832
+ * @param {string} name
2833
+ * @param {string} val
2834
+ * @param {object} [opt]
2835
+ * @return {string}
2836
+ * @public
2837
+ */
2838
+ function serialize(name, val, opt) {
2839
+ var enc = opt && opt.encode || encodeURIComponent;
2840
+ if (typeof enc !== "function") throw new TypeError("option encode is invalid");
2841
+ if (!cookieNameRegExp.test(name)) throw new TypeError("argument name is invalid");
2842
+ var value = enc(val);
2843
+ if (!cookieValueRegExp.test(value)) throw new TypeError("argument val is invalid");
2844
+ var str = name + "=" + value;
2845
+ if (!opt) return str;
2846
+ if (null != opt.maxAge) {
2847
+ var maxAge = Math.floor(opt.maxAge);
2848
+ if (!isFinite(maxAge)) throw new TypeError("option maxAge is invalid");
2849
+ str += "; Max-Age=" + maxAge;
2850
+ }
2851
+ if (opt.domain) {
2852
+ if (!domainValueRegExp.test(opt.domain)) throw new TypeError("option domain is invalid");
2853
+ str += "; Domain=" + opt.domain;
2854
+ }
2855
+ if (opt.path) {
2856
+ if (!pathValueRegExp.test(opt.path)) throw new TypeError("option path is invalid");
2857
+ str += "; Path=" + opt.path;
2858
+ }
2859
+ if (opt.expires) {
2860
+ var expires = opt.expires;
2861
+ if (!isDate(expires) || isNaN(expires.valueOf())) throw new TypeError("option expires is invalid");
2862
+ str += "; Expires=" + expires.toUTCString();
2863
+ }
2864
+ if (opt.httpOnly) str += "; HttpOnly";
2865
+ if (opt.secure) str += "; Secure";
2866
+ if (opt.partitioned) str += "; Partitioned";
2867
+ if (opt.priority) switch (typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority) {
2868
+ case "low":
2869
+ str += "; Priority=Low";
2870
+ break;
2871
+ case "medium":
2872
+ str += "; Priority=Medium";
2873
+ break;
2874
+ case "high":
2875
+ str += "; Priority=High";
2876
+ break;
2877
+ default: throw new TypeError("option priority is invalid");
2878
+ }
2879
+ if (opt.sameSite) switch (typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite) {
2880
+ case true:
2881
+ str += "; SameSite=Strict";
2882
+ break;
2883
+ case "lax":
2884
+ str += "; SameSite=Lax";
2885
+ break;
2886
+ case "strict":
2887
+ str += "; SameSite=Strict";
2888
+ break;
2889
+ case "none":
2890
+ str += "; SameSite=None";
2891
+ break;
2892
+ default: throw new TypeError("option sameSite is invalid");
2893
+ }
2894
+ return str;
2895
+ }
2896
+ /**
2897
+ * URL-decode string value. Optimized to skip native call when no %.
2898
+ *
2899
+ * @param {string} str
2900
+ * @returns {string}
2901
+ */
2902
+ function decode(str) {
2903
+ return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
2904
+ }
2905
+ /**
2906
+ * Determine if value is a Date.
2907
+ *
2908
+ * @param {*} val
2909
+ * @private
2910
+ */
2911
+ function isDate(val) {
2912
+ return __toString.call(val) === "[object Date]";
2913
+ }
2914
+ /**
2915
+ * Try decoding a string using a decoding function.
2916
+ *
2917
+ * @param {string} str
2918
+ * @param {function} decode
2919
+ * @private
2920
+ */
2921
+ function tryDecode(str, decode) {
2922
+ try {
2923
+ return decode(str);
2924
+ } catch (e) {
2925
+ return str;
2926
+ }
2927
+ }
2928
+ })))();
2929
+ var INVALID_COOKIE_CHARACTER_REGEX = /[\x00-\x1F\x7F()<>@,;:"/[\]?={} \t]/;
2930
+ /** @param {import('./page/types.js').Cookie['options']} options */
2931
+ function validate_options(options) {
2932
+ if (options?.path === void 0) throw new Error("You must specify a `path` when setting, deleting or serializing cookies");
2933
+ }
2934
+ /**
2935
+ * Generates a unique key for a cookie based on its domain, path, and name in
2936
+ * the format: `<domain>/<path>?<name>`.
2937
+ * If domain is undefined, it will be omitted.
2938
+ * For example: `/?name`, `example.com/foo?name`.
2939
+ *
2940
+ * @param {string | undefined} domain
2941
+ * @param {string} path
2942
+ * @param {string} name
2943
+ * @returns {string}
2944
+ */
2945
+ function generate_cookie_key(domain, path, name) {
2946
+ return `${domain || ""}${path}?${encodeURIComponent(name)}`;
2947
+ }
2948
+ /**
2949
+ * @param {Request} request
2950
+ * @param {URL} url
2951
+ */
2952
+ function get_cookies(request, url) {
2953
+ const header = request.headers.get("cookie") ?? "";
2954
+ const initial_cookies = (0, import_cookie.parse)(header, { decode: (value) => value });
2955
+ /** @type {string | undefined} */
2956
+ let normalized_url;
2957
+ /** @type {Map<string, import('./page/types.js').Cookie>} */
2958
+ const new_cookies = /* @__PURE__ */ new Map();
2959
+ /** @type {import('cookie').CookieSerializeOptions} */
2960
+ const defaults = {
2961
+ httpOnly: true,
2962
+ sameSite: "lax",
2963
+ secure: url.hostname === "localhost" && url.protocol === "http:" ? false : true
2964
+ };
2965
+ /** @type {import('@sveltejs/kit').Cookies} */
2966
+ const cookies = {
2967
+ /**
2968
+ * @param {string} name
2969
+ * @param {import('cookie').CookieParseOptions} [opts]
2970
+ */
2971
+ get(name, opts) {
2972
+ const best_match = Array.from(new_cookies.values()).filter((c) => {
2973
+ return c.name === name && domain_matches(url.hostname, c.options.domain) && path_matches(url.pathname, c.options.path);
2974
+ }).sort((a, b) => b.options.path.length - a.options.path.length)[0];
2975
+ if (best_match) return best_match.options.maxAge === 0 ? void 0 : best_match.value;
2976
+ return (0, import_cookie.parse)(header, { decode: opts?.decode })[name];
2977
+ },
2978
+ /**
2979
+ * @param {import('cookie').CookieParseOptions} [opts]
2980
+ */
2981
+ getAll(opts) {
2982
+ const cookies = (0, import_cookie.parse)(header, { decode: opts?.decode });
2983
+ const lookup = /* @__PURE__ */ new Map();
2984
+ for (const c of new_cookies.values()) if (domain_matches(url.hostname, c.options.domain) && path_matches(url.pathname, c.options.path)) {
2985
+ const existing = lookup.get(c.name);
2986
+ if (!existing || c.options.path.length > existing.options.path.length) lookup.set(c.name, c);
2987
+ }
2988
+ for (const c of lookup.values()) cookies[c.name] = c.value;
2989
+ return Object.entries(cookies).map(([name, value]) => ({
2990
+ name,
2991
+ value
2992
+ }));
2993
+ },
2994
+ /**
2995
+ * @param {string} name
2996
+ * @param {string} value
2997
+ * @param {import('./page/types.js').Cookie['options']} options
2998
+ */
2999
+ set(name, value, options) {
3000
+ const illegal_characters = name.match(INVALID_COOKIE_CHARACTER_REGEX);
3001
+ if (illegal_characters) console.warn(`The cookie name "${name}" will be invalid in SvelteKit 3.0 as it contains ${illegal_characters.join(" and ")}. See RFC 2616 for more details https://datatracker.ietf.org/doc/html/rfc2616#section-2.2`);
3002
+ validate_options(options);
3003
+ set_internal(name, value, {
3004
+ ...defaults,
3005
+ ...options
3006
+ });
3007
+ },
3008
+ /**
3009
+ * @param {string} name
3010
+ * @param {import('./page/types.js').Cookie['options']} options
3011
+ */
3012
+ delete(name, options) {
3013
+ validate_options(options);
3014
+ cookies.set(name, "", {
3015
+ ...options,
3016
+ maxAge: 0
3017
+ });
3018
+ },
3019
+ /**
3020
+ * @param {string} name
3021
+ * @param {string} value
3022
+ * @param {import('./page/types.js').Cookie['options']} options
3023
+ */
3024
+ serialize(name, value, options) {
3025
+ validate_options(options);
3026
+ let path = options.path;
3027
+ if (!options.domain || options.domain === url.hostname) {
3028
+ if (!normalized_url) throw new Error("Cannot serialize cookies until after the route is determined");
3029
+ path = resolve(normalized_url, path);
3030
+ }
3031
+ return (0, import_cookie.serialize)(name, value, {
3032
+ ...defaults,
3033
+ ...options,
3034
+ path
3035
+ });
3036
+ }
3037
+ };
3038
+ /**
3039
+ * @param {URL} destination
3040
+ * @param {string | null} header
3041
+ */
3042
+ function get_cookie_header(destination, header) {
3043
+ /** @type {Record<string, string>} */
3044
+ const combined_cookies = { ...initial_cookies };
3045
+ for (const cookie of new_cookies.values()) {
3046
+ if (!domain_matches(destination.hostname, cookie.options.domain)) continue;
3047
+ if (!path_matches(destination.pathname, cookie.options.path)) continue;
3048
+ const encoder = cookie.options.encode || encodeURIComponent;
3049
+ combined_cookies[cookie.name] = encoder(cookie.value);
3050
+ }
3051
+ if (header) {
3052
+ const parsed = (0, import_cookie.parse)(header, { decode: (value) => value });
3053
+ for (const name in parsed) combined_cookies[name] = parsed[name];
3054
+ }
3055
+ return Object.entries(combined_cookies).map(([name, value]) => `${name}=${value}`).join("; ");
3056
+ }
3057
+ /** @type {Array<() => void>} */
3058
+ const internal_queue = [];
3059
+ /**
3060
+ * @param {string} name
3061
+ * @param {string} value
3062
+ * @param {import('./page/types.js').Cookie['options']} options
3063
+ */
3064
+ function set_internal(name, value, options) {
3065
+ if (!normalized_url) {
3066
+ internal_queue.push(() => set_internal(name, value, options));
3067
+ return;
3068
+ }
3069
+ let path = options.path;
3070
+ if (!options.domain || options.domain === url.hostname) path = resolve(normalized_url, path);
3071
+ const cookie_key = generate_cookie_key(options.domain, path, name);
3072
+ const cookie = {
3073
+ name,
3074
+ value,
3075
+ options: {
3076
+ ...options,
3077
+ path
3078
+ }
3079
+ };
3080
+ new_cookies.set(cookie_key, cookie);
3081
+ }
3082
+ /**
3083
+ * @param {import('types').TrailingSlash} trailing_slash
3084
+ */
3085
+ function set_trailing_slash(trailing_slash) {
3086
+ normalized_url = normalize_path(url.pathname, trailing_slash);
3087
+ internal_queue.forEach((fn) => fn());
3088
+ }
3089
+ return {
3090
+ cookies,
3091
+ new_cookies,
3092
+ get_cookie_header,
3093
+ set_internal,
3094
+ set_trailing_slash
3095
+ };
3096
+ }
3097
+ /**
3098
+ * @param {string} hostname
3099
+ * @param {string} [constraint]
3100
+ */
3101
+ function domain_matches(hostname, constraint) {
3102
+ if (!constraint) return true;
3103
+ const normalized = constraint[0] === "." ? constraint.slice(1) : constraint;
3104
+ if (hostname === normalized) return true;
3105
+ return hostname.endsWith("." + normalized);
3106
+ }
3107
+ /**
3108
+ * @param {string} path
3109
+ * @param {string} [constraint]
3110
+ */
3111
+ function path_matches(path, constraint) {
3112
+ if (!constraint) return true;
3113
+ const normalized = constraint.endsWith("/") ? constraint.slice(0, -1) : constraint;
3114
+ if (path === normalized) return true;
3115
+ return path.startsWith(normalized + "/");
3116
+ }
3117
+ /**
3118
+ * @param {Headers} headers
3119
+ * @param {MapIterator<import('./page/types.js').Cookie>} cookies
3120
+ */
3121
+ function add_cookies_to_headers(headers, cookies) {
3122
+ for (const new_cookie of cookies) {
3123
+ const { name, value, options } = new_cookie;
3124
+ headers.append("set-cookie", (0, import_cookie.serialize)(name, value, options));
3125
+ if (options.path.endsWith(".html")) {
3126
+ const path = add_data_suffix(options.path);
3127
+ headers.append("set-cookie", (0, import_cookie.serialize)(name, value, {
3128
+ ...options,
3129
+ path
3130
+ }));
3131
+ }
3132
+ }
3133
+ }
3134
+ //#endregion
3135
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/fetch.js
3136
+ /**
3137
+ * @param {{
3138
+ * event: import('@sveltejs/kit').RequestEvent;
3139
+ * options: import('types').SSROptions;
3140
+ * manifest: import('@sveltejs/kit').SSRManifest;
3141
+ * state: import('types').SSRState;
3142
+ * get_cookie_header: (url: URL, header: string | null) => string;
3143
+ * set_internal: (name: string, value: string, opts: import('./page/types.js').Cookie['options']) => void;
3144
+ * }} opts
3145
+ * @returns {typeof fetch}
3146
+ */
3147
+ function create_fetch({ event, options, manifest, state, get_cookie_header, set_internal }) {
3148
+ /**
3149
+ * @type {typeof fetch}
3150
+ */
3151
+ const server_fetch = async (info, init) => {
3152
+ const original_request = normalize_fetch_input(info, init, event.url);
3153
+ let mode = (info instanceof Request ? info.mode : init?.mode) ?? "cors";
3154
+ let credentials = (info instanceof Request ? info.credentials : init?.credentials) ?? "same-origin";
3155
+ return options.hooks.handleFetch({
3156
+ event,
3157
+ request: original_request,
3158
+ fetch: async (info, init) => {
3159
+ const request = normalize_fetch_input(info, init, event.url);
3160
+ const url = new URL(request.url);
3161
+ if (!request.headers.has("origin")) request.headers.set("origin", event.url.origin);
3162
+ if (info !== original_request) {
3163
+ mode = (info instanceof Request ? info.mode : init?.mode) ?? "cors";
3164
+ credentials = (info instanceof Request ? info.credentials : init?.credentials) ?? "same-origin";
3165
+ }
3166
+ if ((request.method === "GET" || request.method === "HEAD") && (mode === "no-cors" && url.origin !== event.url.origin || url.origin === event.url.origin)) request.headers.delete("origin");
3167
+ const decoded = decodeURIComponent(url.pathname);
3168
+ if (url.origin !== event.url.origin || base && decoded !== base && !decoded.startsWith(`${base}/`)) {
3169
+ if (`.${url.hostname}`.endsWith(`.${event.url.hostname}`) && credentials !== "omit") {
3170
+ const cookie = get_cookie_header(url, request.headers.get("cookie"));
3171
+ if (cookie) request.headers.set("cookie", cookie);
3172
+ }
3173
+ return fetch(request);
3174
+ }
3175
+ const prefix = assets || base;
3176
+ const filename = (decoded.startsWith(prefix) ? decoded.slice(prefix.length) : decoded).slice(1);
3177
+ const filename_html = `${filename}/index.html`;
3178
+ const is_asset = manifest.assets.has(filename) || filename in manifest._.server_assets;
3179
+ const is_asset_html = manifest.assets.has(filename_html) || filename_html in manifest._.server_assets;
3180
+ if (is_asset || is_asset_html) {
3181
+ const file = is_asset ? filename : filename_html;
3182
+ if (state.read) {
3183
+ const type = is_asset ? manifest.mimeTypes[filename.slice(filename.lastIndexOf("."))] : "text/html";
3184
+ return new Response(state.read(file), { headers: type ? { "content-type": type } : {} });
3185
+ } else if (read_implementation && file in manifest._.server_assets) {
3186
+ const length = manifest._.server_assets[file];
3187
+ const type = manifest.mimeTypes[file.slice(file.lastIndexOf("."))];
3188
+ return new Response(read_implementation(file), { headers: {
3189
+ "Content-Length": "" + length,
3190
+ "Content-Type": type
3191
+ } });
3192
+ }
3193
+ return await fetch(request);
3194
+ }
3195
+ if (has_prerendered_path(manifest, base + decoded)) return await fetch(request);
3196
+ if (credentials !== "omit") {
3197
+ const cookie = get_cookie_header(url, request.headers.get("cookie"));
3198
+ if (cookie) request.headers.set("cookie", cookie);
3199
+ const authorization = event.request.headers.get("authorization");
3200
+ if (authorization && !request.headers.has("authorization")) request.headers.set("authorization", authorization);
3201
+ }
3202
+ if (!request.headers.has("accept")) request.headers.set("accept", "*/*");
3203
+ if (!request.headers.has("accept-language")) request.headers.set("accept-language", event.request.headers.get("accept-language"));
3204
+ const response = await internal_fetch(request, options, manifest, state);
3205
+ for (const str of get_set_cookies(response.headers)) {
3206
+ const { name, value, ...options } = parseString(str, { decodeValues: false });
3207
+ set_internal(name, value, {
3208
+ path: options.path ?? (url.pathname.split("/").slice(0, -1).join("/") || "/"),
3209
+ encode: (value) => value,
3210
+ ...options
3211
+ });
3212
+ }
3213
+ return response;
3214
+ }
3215
+ });
3216
+ };
3217
+ return (input, init) => {
3218
+ const response = server_fetch(input, init);
3219
+ response.catch(noop);
3220
+ return response;
3221
+ };
3222
+ }
3223
+ /**
3224
+ * @param {RequestInfo | URL} info
3225
+ * @param {RequestInit | undefined} init
3226
+ * @param {URL} url
3227
+ */
3228
+ function normalize_fetch_input(info, init, url) {
3229
+ if (info instanceof Request) return info;
3230
+ return new Request(typeof info === "string" ? new URL(info, url) : info, init);
3231
+ }
3232
+ /**
3233
+ * @param {Request} request
3234
+ * @param {import('types').SSROptions} options
3235
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
3236
+ * @param {import('types').SSRState} state
3237
+ * @returns {Promise<Response>}
3238
+ */
3239
+ async function internal_fetch(request, options, manifest, state) {
3240
+ if (request.signal) {
3241
+ if (request.signal.aborted) throw new DOMException("The operation was aborted.", "AbortError");
3242
+ let remove_abort_listener = noop;
3243
+ /** @type {Promise<never>} */
3244
+ const abort_promise = new Promise((_, reject) => {
3245
+ const on_abort = () => {
3246
+ reject(new DOMException("The operation was aborted.", "AbortError"));
3247
+ };
3248
+ request.signal.addEventListener("abort", on_abort, { once: true });
3249
+ remove_abort_listener = () => request.signal.removeEventListener("abort", on_abort);
3250
+ });
3251
+ const result = await Promise.race([respond(request, options, manifest, {
3252
+ ...state,
3253
+ depth: state.depth + 1
3254
+ }), abort_promise]);
3255
+ remove_abort_listener();
3256
+ return result;
3257
+ } else return await respond(request, options, manifest, {
3258
+ ...state,
3259
+ depth: state.depth + 1
3260
+ });
3261
+ }
3262
+ //#endregion
3263
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/env_module.js
3264
+ /** @type {string} */
3265
+ var payload;
3266
+ /** @type {string} */
3267
+ var etag;
3268
+ /** @type {Headers} */
3269
+ var headers;
3270
+ /**
3271
+ * @param {Request} request
3272
+ * @returns {Response}
3273
+ */
3274
+ function get_public_env(request) {
3275
+ const script = request.url.endsWith(".script.js");
3276
+ payload ??= uneval(public_env);
3277
+ etag ??= `W/${Date.now()}`;
3278
+ headers ??= new Headers({
3279
+ "content-type": "application/javascript; charset=utf-8",
3280
+ etag
3281
+ });
3282
+ if (request.headers.get("if-none-match") === etag) return new Response(void 0, {
3283
+ status: 304,
3284
+ headers
3285
+ });
3286
+ if (script) return new Response(`globalThis.__sveltekit_sw={env:${payload}}`, { headers });
3287
+ return new Response(`export const env=${payload}`, { headers });
3288
+ }
3289
+ //#endregion
3290
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/respond.js
3291
+ /** @import { RequestState, SSRNode } from 'types' */
3292
+ /** @type {import('types').RequiredResolveOptions['transformPageChunk']} */
3293
+ var default_transform = ({ html }) => html;
3294
+ /** @type {import('types').RequiredResolveOptions['filterSerializedResponseHeaders']} */
3295
+ var default_filter = () => false;
3296
+ /** @type {import('types').RequiredResolveOptions['preload']} */
3297
+ var default_preload = ({ type }) => type === "js" || type === "css";
3298
+ var page_methods = /* @__PURE__ */ new Set([
3299
+ "GET",
3300
+ "HEAD",
3301
+ "POST"
3302
+ ]);
3303
+ var allowed_page_methods = /* @__PURE__ */ new Set([
3304
+ "GET",
3305
+ "HEAD",
3306
+ "OPTIONS"
3307
+ ]);
3308
+ var respond = propagate_context(internal_respond);
3309
+ /**
3310
+ * @param {Request} request
3311
+ * @param {import('types').SSROptions} options
3312
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
3313
+ * @param {import('types').SSRState} state
3314
+ * @returns {Promise<Response>}
3315
+ */
3316
+ async function internal_respond(request, options, manifest, state) {
3317
+ /** URL but stripped from the potential `/__data.json` suffix and its search param */
3318
+ const url = new URL(request.url);
3319
+ const is_route_resolution_request = has_resolution_suffix(url.pathname);
3320
+ const is_data_request = has_data_suffix(url.pathname);
3321
+ const remote_id = get_remote_id(url);
3322
+ {
3323
+ const request_origin = request.headers.get("origin");
3324
+ if (remote_id) {
3325
+ if (request.method !== "GET" && request_origin !== url.origin) return json({ message: "Cross-site remote requests are forbidden" }, { status: 403 });
3326
+ } else if (options.csrf_check_origin) {
3327
+ if (is_form_content_type(request) && (request.method === "POST" || request.method === "PUT" || request.method === "PATCH" || request.method === "DELETE") && request_origin !== url.origin && (!request_origin || !options.csrf_trusted_origins.includes(request_origin))) {
3328
+ const message = `Cross-site ${request.method} form submissions are forbidden`;
3329
+ const opts = { status: 403 };
3330
+ if (request.headers.get("accept") === "application/json") return json({ message }, opts);
3331
+ return text(message, opts);
3332
+ }
3333
+ }
3334
+ }
3335
+ if (options.hash_routing && url.pathname !== base + "/" && url.pathname !== "/[fallback]") return text("Not found", { status: 404 });
3336
+ /** @type {boolean[] | undefined} */
3337
+ let invalidated_data_nodes;
3338
+ if (is_route_resolution_request)
3339
+ /**
3340
+ * If the request is for a route resolution, first modify the URL, then continue as normal
3341
+ * for path resolution, then return the route object as a JS file.
3342
+ */
3343
+ url.pathname = strip_resolution_suffix(url.pathname);
3344
+ else if (is_data_request) {
3345
+ url.pathname = strip_data_suffix(url.pathname) + (url.searchParams.get("x-sveltekit-trailing-slash") === "1" ? "/" : "") || "/";
3346
+ url.searchParams.delete(TRAILING_SLASH_PARAM);
3347
+ invalidated_data_nodes = url.searchParams.get(INVALIDATED_PARAM)?.split("").map((node) => node === "1");
3348
+ url.searchParams.delete(INVALIDATED_PARAM);
3349
+ } else if (remote_id) {
3350
+ url.pathname = request.headers.get("x-sveltekit-pathname") ?? base;
3351
+ url.search = request.headers.get("x-sveltekit-search") ?? "";
3352
+ }
3353
+ /** @type {Record<string, string>} */
3354
+ const headers = {};
3355
+ const { cookies, new_cookies, get_cookie_header, set_internal, set_trailing_slash } = get_cookies(request, url);
3356
+ /** @type {RequestState} */
3357
+ const event_state = {
3358
+ prerendering: state.prerendering,
3359
+ transport: options.hooks.transport,
3360
+ handleValidationError: options.hooks.handleValidationError,
3361
+ tracing: { record_span },
3362
+ remote: {
3363
+ data: null,
3364
+ explicit: null,
3365
+ implicit: null,
3366
+ forms: null,
3367
+ requested: null,
3368
+ batches: null,
3369
+ live_iterators: null
3370
+ },
3371
+ is_in_remote_function: false,
3372
+ is_in_remote_form_or_command: false,
3373
+ is_in_remote_query: false,
3374
+ is_in_render: false,
3375
+ is_in_universal_load: false
3376
+ };
3377
+ /** @type {import('@sveltejs/kit').RequestEvent} */
3378
+ const event = {
3379
+ cookies,
3380
+ fetch: null,
3381
+ getClientAddress: state.getClientAddress || (() => {
3382
+ throw new Error(`@sveltejs/adapter-node does not specify getClientAddress. Please raise an issue`);
3383
+ }),
3384
+ locals: {},
3385
+ params: {},
3386
+ platform: state.platform,
3387
+ request,
3388
+ route: { id: null },
3389
+ setHeaders: (new_headers) => {
3390
+ for (const key in new_headers) {
3391
+ const lower = key.toLowerCase();
3392
+ const value = new_headers[key];
3393
+ if (lower === "set-cookie") throw new Error("Use `event.cookies.set(name, value, options)` instead of `event.setHeaders` to set cookies");
3394
+ else if (lower in headers) {
3395
+ if (lower === "server-timing") headers[lower] += ", " + value;
3396
+ else throw new Error(`"${key}" header is already set`);
3397
+ } else {
3398
+ headers[lower] = value;
3399
+ if (state.prerendering && lower === "cache-control") state.prerendering.cache = value;
3400
+ }
3401
+ }
3402
+ },
3403
+ url,
3404
+ isDataRequest: is_data_request,
3405
+ isSubRequest: state.depth > 0,
3406
+ isRemoteRequest: !!remote_id
3407
+ };
3408
+ event.fetch = create_fetch({
3409
+ event,
3410
+ options,
3411
+ manifest,
3412
+ state,
3413
+ get_cookie_header,
3414
+ set_internal
3415
+ });
3416
+ if (state.emulator?.platform) event.platform = await state.emulator.platform({
3417
+ config: {},
3418
+ prerender: !!state.prerendering?.fallback
3419
+ });
3420
+ /** @type {string | null} */
3421
+ let resolved_path = url.pathname;
3422
+ if (!remote_id) {
3423
+ const prerendering_reroute_state = state.prerendering?.inside_reroute;
3424
+ try {
3425
+ if (state.prerendering) state.prerendering.inside_reroute = true;
3426
+ resolved_path = await options.hooks.reroute({
3427
+ url: new URL(url),
3428
+ fetch: event.fetch
3429
+ }) ?? url.pathname;
3430
+ } catch {
3431
+ return text("Internal Server Error", { status: 500 });
3432
+ } finally {
3433
+ if (state.prerendering) state.prerendering.inside_reroute = prerendering_reroute_state;
3434
+ }
3435
+ }
3436
+ /** @type {import('types').RequiredResolveOptions} */
3437
+ let resolve_opts = {
3438
+ transformPageChunk: default_transform,
3439
+ filterSerializedResponseHeaders: default_filter,
3440
+ preload: default_preload
3441
+ };
3442
+ /** @type {import('types').TrailingSlash} */
3443
+ let trailing_slash = "never";
3444
+ /** @type {PageNodes | undefined} */
3445
+ let page_nodes;
3446
+ try {
3447
+ resolved_path = decode_pathname(resolved_path);
3448
+ } catch {
3449
+ resolved_path = null;
3450
+ return await handle();
3451
+ }
3452
+ if (resolved_path !== decode_pathname(url.pathname) && !state.prerendering?.fallback && has_prerendered_path(manifest, resolved_path)) {
3453
+ const url = new URL(request.url);
3454
+ url.pathname = is_data_request ? add_data_suffix(resolved_path) : is_route_resolution_request ? add_resolution_suffix(resolved_path) : resolved_path;
3455
+ try {
3456
+ const response = await fetch(url, request);
3457
+ const headers = new Headers(response.headers);
3458
+ if (headers.has("content-encoding")) {
3459
+ headers.delete("content-encoding");
3460
+ headers.delete("content-length");
3461
+ }
3462
+ return new Response(response.body, {
3463
+ headers,
3464
+ status: response.status,
3465
+ statusText: response.statusText
3466
+ });
3467
+ } catch (error) {
3468
+ return await handle_fatal_error(event, event_state, options, error);
3469
+ }
3470
+ }
3471
+ /** @type {import('types').SSRRoute | null} */
3472
+ let route = null;
3473
+ if (base && !state.prerendering?.fallback) {
3474
+ if (!resolved_path.startsWith(base)) return text("Not found", { status: 404 });
3475
+ resolved_path = resolved_path.slice(base.length) || "/";
3476
+ }
3477
+ if (is_route_resolution_request) return resolve_route(resolved_path, new URL(request.url), manifest);
3478
+ if (resolved_path === `/_app/env.js` || resolved_path === `/_app/env.script.js`) return get_public_env(request);
3479
+ if (!remote_id && resolved_path.startsWith(`/_app`)) {
3480
+ const headers = new Headers();
3481
+ headers.set("cache-control", "public, max-age=0, must-revalidate");
3482
+ return text("Not found", {
3483
+ status: 404,
3484
+ headers
3485
+ });
3486
+ }
3487
+ if (!state.prerendering?.fallback) {
3488
+ const matchers = await manifest._.matchers();
3489
+ const result = find_route(resolved_path, manifest._.routes, matchers);
3490
+ if (result) {
3491
+ route = result.route;
3492
+ event.route = { id: route.id };
3493
+ event.params = result.params;
3494
+ }
3495
+ }
3496
+ try {
3497
+ page_nodes = route?.page ? new PageNodes(await load_page_nodes(route.page, manifest)) : void 0;
3498
+ if (route && !remote_id) {
3499
+ if (url.pathname === base || url.pathname === base + "/") trailing_slash = "always";
3500
+ else if (page_nodes) trailing_slash = page_nodes.trailing_slash();
3501
+ else if (route.endpoint) trailing_slash = (await route.endpoint()).trailingSlash ?? "never";
3502
+ if (!is_data_request) {
3503
+ const normalized = normalize_path(url.pathname, trailing_slash);
3504
+ if (normalized !== url.pathname && !state.prerendering?.fallback) return new Response(void 0, {
3505
+ status: 308,
3506
+ headers: {
3507
+ "x-sveltekit-normalize": "1",
3508
+ location: (normalized.startsWith("//") ? url.origin + normalized : normalized) + (url.search === "?" ? "" : url.search)
3509
+ }
3510
+ });
3511
+ }
3512
+ if (state.before_handle || state.emulator?.platform) {
3513
+ let config = {};
3514
+ /** @type {import('types').PrerenderOption} */
3515
+ let prerender = false;
3516
+ if (route.endpoint) {
3517
+ const node = await route.endpoint();
3518
+ config = node.config ?? config;
3519
+ prerender = node.prerender ?? prerender;
3520
+ } else if (page_nodes) {
3521
+ config = page_nodes.get_config() ?? config;
3522
+ prerender = page_nodes.prerender();
3523
+ }
3524
+ if (state.emulator?.platform) event.platform = await state.emulator.platform({
3525
+ config,
3526
+ prerender
3527
+ });
3528
+ if (state.before_handle) return await state.before_handle(event, config, prerender, handle);
3529
+ }
3530
+ }
3531
+ return await handle();
3532
+ } catch (e) {
3533
+ if (e instanceof Redirect) try {
3534
+ const response = is_data_request || remote_id ? redirect_json_response(e) : route?.page && is_action_json_request(event) ? action_json_redirect(e) : redirect_response(e.status, e.location);
3535
+ add_cookies_to_headers(response.headers, new_cookies.values());
3536
+ return response;
3537
+ } catch (err) {
3538
+ return await handle_fatal_error(event, event_state, options, err);
3539
+ }
3540
+ return await handle_fatal_error(event, event_state, options, e);
3541
+ }
3542
+ async function handle() {
3543
+ set_trailing_slash(trailing_slash);
3544
+ if (state.prerendering && !state.prerendering.fallback && !state.prerendering.inside_reroute) disable_search(url);
3545
+ const response = await record_span({
3546
+ name: "sveltekit.handle.root",
3547
+ attributes: {
3548
+ "http.route": event.route.id || "unknown",
3549
+ "http.method": event.request.method,
3550
+ "http.url": event.url.href,
3551
+ "sveltekit.is_sub_request": event.isSubRequest
3552
+ },
3553
+ fn: async (root_span) => {
3554
+ const traced_event = {
3555
+ ...event,
3556
+ tracing: {
3557
+ enabled: false,
3558
+ root: root_span,
3559
+ current: root_span
3560
+ }
3561
+ };
3562
+ return await with_request_store({
3563
+ event: traced_event,
3564
+ state: event_state
3565
+ }, () => options.hooks.handle({
3566
+ event: traced_event,
3567
+ resolve: (event, opts) => {
3568
+ return record_span({
3569
+ name: "sveltekit.resolve",
3570
+ attributes: { "http.route": event.route.id || "unknown" },
3571
+ fn: (resolve_span) => {
3572
+ return with_request_store(null, () => resolve(merge_tracing(event, resolve_span), page_nodes, opts).then((response) => {
3573
+ for (const key in headers) {
3574
+ const value = headers[key];
3575
+ response.headers.set(key, value);
3576
+ }
3577
+ add_cookies_to_headers(response.headers, new_cookies.values());
3578
+ if (state.prerendering && event.route.id !== null) response.headers.set("x-sveltekit-routeid", encodeURI(event.route.id));
3579
+ resolve_span.setAttributes({
3580
+ "http.response.status_code": response.status,
3581
+ "http.response.body.size": response.headers.get("content-length") || "unknown"
3582
+ });
3583
+ return response;
3584
+ }));
3585
+ }
3586
+ });
3587
+ }
3588
+ }));
3589
+ }
3590
+ });
3591
+ if (response.status === 200 && response.headers.has("etag")) {
3592
+ let if_none_match_value = request.headers.get("if-none-match");
3593
+ if (if_none_match_value?.startsWith("W/\"")) if_none_match_value = if_none_match_value.substring(2);
3594
+ const etag = response.headers.get("etag");
3595
+ if (if_none_match_value === etag) {
3596
+ const headers = new Headers({ etag });
3597
+ for (const key of [
3598
+ "cache-control",
3599
+ "content-location",
3600
+ "date",
3601
+ "expires",
3602
+ "vary"
3603
+ ]) {
3604
+ const value = response.headers.get(key);
3605
+ if (value) headers.set(key, value);
3606
+ }
3607
+ for (const cookie of get_set_cookies(response.headers)) headers.append("set-cookie", cookie);
3608
+ return new Response(void 0, {
3609
+ status: 304,
3610
+ headers
3611
+ });
3612
+ }
3613
+ }
3614
+ if (is_data_request && response.status >= 300 && response.status <= 308) {
3615
+ const location = response.headers.get("location");
3616
+ if (location) return redirect_json_response(new Redirect(response.status, location));
3617
+ }
3618
+ return response;
3619
+ }
3620
+ /**
3621
+ * @param {import('@sveltejs/kit').RequestEvent} event
3622
+ * @param {PageNodes | undefined} page_nodes
3623
+ * @param {import('@sveltejs/kit').ResolveOptions} [opts]
3624
+ */
3625
+ async function resolve(event, page_nodes, opts) {
3626
+ try {
3627
+ if (opts) resolve_opts = {
3628
+ transformPageChunk: opts.transformPageChunk || default_transform,
3629
+ filterSerializedResponseHeaders: opts.filterSerializedResponseHeaders || default_filter,
3630
+ preload: opts.preload || default_preload
3631
+ };
3632
+ if (resolved_path === null) return await respond_with_error({
3633
+ event,
3634
+ event_state,
3635
+ options,
3636
+ manifest,
3637
+ state,
3638
+ status: 400,
3639
+ error: new SvelteKitError(400, "Malformed URI", `Failed to decode URI: ${event.url.pathname}`),
3640
+ resolve_opts
3641
+ });
3642
+ if (options.hash_routing || state.prerendering?.fallback) return await render_response({
3643
+ event,
3644
+ event_state,
3645
+ options,
3646
+ manifest,
3647
+ state,
3648
+ page_config: {
3649
+ ssr: false,
3650
+ csr: true
3651
+ },
3652
+ status: 200,
3653
+ error: null,
3654
+ branch: [{
3655
+ node: await manifest._.nodes[0](),
3656
+ data: null,
3657
+ server_data: null
3658
+ }],
3659
+ fetched: [],
3660
+ resolve_opts,
3661
+ data_serializer: server_data_serializer(event, event_state, options)
3662
+ });
3663
+ if (remote_id) return await handle_remote_call(event, event_state, options, manifest, remote_id);
3664
+ if (route) {
3665
+ const method = event.request.method;
3666
+ /** @type {Response} */
3667
+ let response;
3668
+ if (is_data_request) response = await render_data(event, event_state, route, options, manifest, state, invalidated_data_nodes, trailing_slash);
3669
+ else if (route.endpoint && (!route.page || !state.prerendering && is_endpoint_request(event))) response = await render_endpoint(event, event_state, await route.endpoint(), state);
3670
+ else if (route.page) {
3671
+ if (!page_nodes) throw new Error("page_nodes not found. This should never happen");
3672
+ else if (page_methods.has(method)) response = await render_page(event, event_state, route.page, options, manifest, state, page_nodes, resolve_opts);
3673
+ else {
3674
+ const allowed_methods = new Set(allowed_page_methods);
3675
+ if ((await manifest._.nodes[route.page.leaf]())?.server?.actions) allowed_methods.add("POST");
3676
+ if (method === "OPTIONS") response = new Response(null, {
3677
+ status: 204,
3678
+ headers: { allow: Array.from(allowed_methods.values()).join(", ") }
3679
+ });
3680
+ else {
3681
+ const mod = [...allowed_methods].reduce((acc, curr) => {
3682
+ acc[curr] = true;
3683
+ return acc;
3684
+ }, {});
3685
+ response = method_not_allowed(mod, method);
3686
+ }
3687
+ }
3688
+ } else throw new Error("Route is neither page nor endpoint. This should never happen");
3689
+ if (request.method === "GET" && route.page && route.endpoint) {
3690
+ const vary = response.headers.get("vary")?.split(",")?.map((v) => v.trim().toLowerCase());
3691
+ if (!(vary?.includes("accept") || vary?.includes("*"))) {
3692
+ response = new Response(response.body, {
3693
+ status: response.status,
3694
+ statusText: response.statusText,
3695
+ headers: new Headers(response.headers)
3696
+ });
3697
+ response.headers.append("Vary", "Accept");
3698
+ }
3699
+ }
3700
+ return response;
3701
+ }
3702
+ if (state.error && event.isSubRequest) {
3703
+ const headers = new Headers(request.headers);
3704
+ headers.set("x-sveltekit-error", "true");
3705
+ return await fetch(request, { headers });
3706
+ }
3707
+ if (state.error) return text("Internal Server Error", { status: 500 });
3708
+ if (state.depth === 0) return await respond_with_error({
3709
+ event,
3710
+ event_state,
3711
+ options,
3712
+ manifest,
3713
+ state,
3714
+ status: 404,
3715
+ error: new SvelteKitError(404, "Not Found", `Not found: ${event.url.pathname}`),
3716
+ resolve_opts
3717
+ });
3718
+ if (state.prerendering) return text("not found", { status: 404 });
3719
+ const response = await fetch(request);
3720
+ return new Response(response.body, response);
3721
+ } catch (e) {
3722
+ return await handle_fatal_error(event, event_state, options, e);
3723
+ } finally {
3724
+ event.cookies.set = () => {
3725
+ throw new Error("Cannot use `cookies.set(...)` after the response has been generated");
3726
+ };
3727
+ event.setHeaders = () => {
3728
+ throw new Error("Cannot use `setHeaders(...)` after the response has been generated");
3729
+ };
3730
+ }
3731
+ }
3732
+ }
3733
+ /**
3734
+ * @param {import('types').PageNodeIndexes} page
3735
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
3736
+ */
3737
+ function load_page_nodes(page, manifest) {
3738
+ return Promise.all([...page.layouts.map((n) => n == void 0 ? n : manifest._.nodes[n]()), manifest._.nodes[page.leaf]()]);
3739
+ }
3740
+ /**
3741
+ * It's likely that, in a distributed system, there are spans starting outside the SvelteKit server -- eg.
3742
+ * started on the frontend client, or in a service that calls the SvelteKit server. There are standardized
3743
+ * ways to represent this context in HTTP headers, so we can extract that context and run our tracing inside of it
3744
+ * so that when our traces are exported, they are associated with the correct parent context.
3745
+ * @param {typeof internal_respond} fn
3746
+ * @returns {typeof internal_respond}
3747
+ */
3748
+ function propagate_context(fn) {
3749
+ return async (req, ...rest) => {
3750
+ return fn(req, ...rest);
3751
+ };
3752
+ }
3753
+ //#endregion
3754
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/utils/env.js
3755
+ /**
3756
+ * @param {Record<string, string>} env
3757
+ * @param {string} allowed
3758
+ * @param {string} disallowed
3759
+ * @returns {Record<string, string>}
3760
+ */
3761
+ function filter_env(env, allowed, disallowed) {
3762
+ return Object.fromEntries(Object.entries(env).filter(([k]) => k.startsWith(allowed) && (disallowed === "" || !k.startsWith(disallowed))));
3763
+ }
3764
+ //#endregion
3765
+ //#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.56.10_vite@8.2.2_@type_516d88433e8c68d15ca595d506c600a7/node_modules/@sveltejs/kit/src/runtime/server/index.js
3766
+ /** @import { PromiseWithResolvers } from '../../utils/promise.js' */
3767
+ /** @type {Promise<any>} */
3768
+ var init_promise;
3769
+ /** @type {Promise<void> | null} */
3770
+ var current = null;
3771
+ var Server = class {
3772
+ /** @type {import('types').SSROptions} */
3773
+ #options;
3774
+ /** @type {import('@sveltejs/kit').SSRManifest} */
3775
+ #manifest;
3776
+ /** @param {import('@sveltejs/kit').SSRManifest} manifest */
3777
+ constructor(manifest) {
3778
+ /** @type {import('types').SSROptions} */
3779
+ this.#options = options;
3780
+ this.#manifest = manifest;
3781
+ if (IN_WEBCONTAINER) {
3782
+ const respond = this.respond.bind(this);
3783
+ /** @type {typeof respond} */
3784
+ this.respond = async (...args) => {
3785
+ const { promise, resolve } = with_resolvers();
3786
+ const previous = current;
3787
+ current = promise;
3788
+ await previous;
3789
+ return respond(...args).finally(resolve);
3790
+ };
3791
+ }
3792
+ }
3793
+ /**
3794
+ * @param {import('@sveltejs/kit').ServerInitOptions} opts
3795
+ */
3796
+ async init({ env, read }) {
3797
+ const { env_public_prefix, env_private_prefix } = this.#options;
3798
+ set_private_env(filter_env(env, env_private_prefix, env_public_prefix));
3799
+ set_public_env(filter_env(env, env_public_prefix, env_private_prefix));
3800
+ if (read) {
3801
+ /** @param {string} file */
3802
+ const wrapped_read = (file) => {
3803
+ const result = read(file);
3804
+ if (result instanceof ReadableStream) return result;
3805
+ else return new ReadableStream({ async start(controller) {
3806
+ try {
3807
+ const stream = await Promise.resolve(result);
3808
+ if (!stream) {
3809
+ controller.close();
3810
+ return;
3811
+ }
3812
+ const reader = stream.getReader();
3813
+ while (true) {
3814
+ const { done, value } = await reader.read();
3815
+ if (done) break;
3816
+ controller.enqueue(value);
3817
+ }
3818
+ controller.close();
3819
+ } catch (error) {
3820
+ controller.error(error);
3821
+ }
3822
+ } });
3823
+ };
3824
+ set_read_implementation(wrapped_read);
3825
+ }
3826
+ await (init_promise ??= (async () => {
3827
+ try {
3828
+ const module = await get_hooks();
3829
+ this.#options.hooks = {
3830
+ handle: module.handle || (({ event, resolve }) => resolve(event)),
3831
+ handleError: module.handleError || (({ status, error, event }) => {
3832
+ const error_message = format_server_error(status, error, event);
3833
+ console.error(error_message);
3834
+ }),
3835
+ handleFetch: module.handleFetch || (({ request, fetch }) => fetch(request)),
3836
+ handleValidationError: module.handleValidationError || (({ issues }) => {
3837
+ console.error("Remote function schema validation failed:", issues);
3838
+ return { message: "Bad Request" };
3839
+ }),
3840
+ reroute: module.reroute || noop,
3841
+ transport: module.transport || {}
3842
+ };
3843
+ module.transport && Object.fromEntries(Object.entries(module.transport).map(([k, v]) => [k, v.decode]));
3844
+ if (module.init) await module.init();
3845
+ } catch (e) {
3846
+ throw e;
3847
+ }
3848
+ })());
3849
+ }
3850
+ /**
3851
+ * @param {Request} request
3852
+ * @param {import('types').RequestOptions} options
3853
+ */
3854
+ async respond(request, options) {
3855
+ return respond(request, this.#options, this.#manifest, {
3856
+ ...options,
3857
+ error: false,
3858
+ depth: 0
3859
+ });
3860
+ }
3861
+ };
3862
+
3863
+ export { Server as S };
3864
+ //# sourceMappingURL=index.js-I_pMeIwQ.js.map