konoha-mcp 2.1.3 → 2.1.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 (367) hide show
  1. package/.agents/skills.fingerprint +1 -1
  2. package/README.md +4 -4
  3. package/apps/web/build/adapter-node.js +11 -0
  4. package/apps/web/build/client/_app/immutable/chunks/BH86Md_X.js +1 -0
  5. package/apps/web/build/client/_app/immutable/chunks/BH86Md_X.js.br +2 -0
  6. package/apps/web/build/client/_app/immutable/chunks/BH86Md_X.js.gz +0 -0
  7. package/apps/web/build/client/_app/immutable/chunks/BaNbYf_w.js +1 -0
  8. package/apps/web/build/client/_app/immutable/chunks/BaNbYf_w.js.br +0 -0
  9. package/apps/web/build/client/_app/immutable/chunks/BaNbYf_w.js.gz +0 -0
  10. package/apps/web/build/client/_app/immutable/chunks/C3-t9btS.js +1 -0
  11. package/apps/web/build/client/_app/immutable/chunks/C3-t9btS.js.br +1 -0
  12. package/apps/web/build/client/_app/immutable/chunks/C3-t9btS.js.gz +0 -0
  13. package/apps/web/build/client/_app/immutable/chunks/{Bv85lp2r.js → CBY268r4.js} +1 -1
  14. package/apps/web/build/client/_app/immutable/chunks/CBY268r4.js.br +3 -0
  15. package/apps/web/build/client/_app/immutable/chunks/CBY268r4.js.gz +0 -0
  16. package/apps/web/build/client/_app/immutable/chunks/Cg3pm-K7.js +1 -0
  17. package/apps/web/build/client/_app/immutable/chunks/Cg3pm-K7.js.br +4 -0
  18. package/apps/web/build/client/_app/immutable/chunks/Cg3pm-K7.js.gz +0 -0
  19. package/apps/web/build/client/_app/immutable/chunks/D-Kujhko.js +1 -0
  20. package/apps/web/build/client/_app/immutable/chunks/D-Kujhko.js.br +0 -0
  21. package/apps/web/build/client/_app/immutable/chunks/D-Kujhko.js.gz +0 -0
  22. package/apps/web/build/client/_app/immutable/chunks/Dek69VGa.js +1 -0
  23. package/apps/web/build/client/_app/immutable/chunks/Dek69VGa.js.br +0 -0
  24. package/apps/web/build/client/_app/immutable/chunks/Dek69VGa.js.gz +0 -0
  25. package/apps/web/build/client/_app/immutable/chunks/{CP4ze5kR.js → Dzm74gVd.js} +1 -1
  26. package/apps/web/build/client/_app/immutable/chunks/Dzm74gVd.js.br +0 -0
  27. package/apps/web/build/client/_app/immutable/chunks/Dzm74gVd.js.gz +0 -0
  28. package/apps/web/build/client/_app/immutable/chunks/Lb3VuXoN.js +2 -0
  29. package/apps/web/build/client/_app/immutable/chunks/Lb3VuXoN.js.br +0 -0
  30. package/apps/web/build/client/_app/immutable/chunks/Lb3VuXoN.js.gz +0 -0
  31. package/apps/web/build/client/_app/immutable/chunks/PrdhfbrQ.js +3 -0
  32. package/apps/web/build/client/_app/immutable/chunks/PrdhfbrQ.js.br +0 -0
  33. package/apps/web/build/client/_app/immutable/chunks/PrdhfbrQ.js.gz +0 -0
  34. package/apps/web/build/client/_app/immutable/chunks/{tFx9Vkzn.js → fbrtLByB.js} +1 -1
  35. package/apps/web/build/client/_app/immutable/chunks/fbrtLByB.js.br +0 -0
  36. package/apps/web/build/client/_app/immutable/chunks/fbrtLByB.js.gz +0 -0
  37. package/apps/web/build/client/_app/immutable/entry/app.DLayTcYu.js +2 -0
  38. package/apps/web/build/client/_app/immutable/entry/app.DLayTcYu.js.br +0 -0
  39. package/apps/web/build/client/_app/immutable/entry/app.DLayTcYu.js.gz +0 -0
  40. package/apps/web/build/client/_app/immutable/entry/start.CNV5BTCO.js +2 -0
  41. package/apps/web/build/client/_app/immutable/entry/start.CNV5BTCO.js.br +0 -0
  42. package/apps/web/build/client/_app/immutable/entry/start.CNV5BTCO.js.gz +0 -0
  43. package/apps/web/build/client/_app/immutable/nodes/{0.BV_U6rd9.js → 0.5uSjyTy0.js} +1 -1
  44. package/apps/web/build/client/_app/immutable/nodes/0.5uSjyTy0.js.br +0 -0
  45. package/apps/web/build/client/_app/immutable/nodes/0.5uSjyTy0.js.gz +0 -0
  46. package/apps/web/build/client/_app/immutable/nodes/{1.317ei_PM.js → 1.BZu6jsAH.js} +1 -1
  47. package/apps/web/build/client/_app/immutable/nodes/1.BZu6jsAH.js.br +0 -0
  48. package/apps/web/build/client/_app/immutable/nodes/1.BZu6jsAH.js.gz +0 -0
  49. package/apps/web/build/client/_app/immutable/nodes/{10.C9BHUF6_.js → 10.CZKScTFN.js} +1 -1
  50. package/apps/web/build/client/_app/immutable/nodes/10.CZKScTFN.js.br +0 -0
  51. package/apps/web/build/client/_app/immutable/nodes/10.CZKScTFN.js.gz +0 -0
  52. package/apps/web/build/client/_app/immutable/nodes/{11._7rmywnA.js → 11.DFglFW_i.js} +1 -1
  53. package/apps/web/build/client/_app/immutable/nodes/11.DFglFW_i.js.br +0 -0
  54. package/apps/web/build/client/_app/immutable/nodes/11.DFglFW_i.js.gz +0 -0
  55. package/apps/web/build/client/_app/immutable/nodes/{12.B_UJh_Cw.js → 12.CSShcv5z.js} +1 -1
  56. package/apps/web/build/client/_app/immutable/nodes/12.CSShcv5z.js.br +0 -0
  57. package/apps/web/build/client/_app/immutable/nodes/12.CSShcv5z.js.gz +0 -0
  58. package/apps/web/build/client/_app/immutable/nodes/{13.FtUj7AO8.js → 13.jWUWoBcs.js} +1 -1
  59. package/apps/web/build/client/_app/immutable/nodes/13.jWUWoBcs.js.br +0 -0
  60. package/apps/web/build/client/_app/immutable/nodes/13.jWUWoBcs.js.gz +0 -0
  61. package/apps/web/build/client/_app/immutable/nodes/{14.CsMWcbH2.js → 14.H-jSqqen.js} +1 -1
  62. package/apps/web/build/client/_app/immutable/nodes/14.H-jSqqen.js.br +0 -0
  63. package/apps/web/build/client/_app/immutable/nodes/14.H-jSqqen.js.gz +0 -0
  64. package/apps/web/build/client/_app/immutable/nodes/{15.DbSoDlZF.js → 15.CpAoyhzV.js} +1 -1
  65. package/apps/web/build/client/_app/immutable/nodes/15.CpAoyhzV.js.br +0 -0
  66. package/apps/web/build/client/_app/immutable/nodes/15.CpAoyhzV.js.gz +0 -0
  67. package/apps/web/build/client/_app/immutable/nodes/{16.BcMZYQJR.js → 16.DT_-MxCT.js} +1 -1
  68. package/apps/web/build/client/_app/immutable/nodes/16.DT_-MxCT.js.br +0 -0
  69. package/apps/web/build/client/_app/immutable/nodes/16.DT_-MxCT.js.gz +0 -0
  70. package/apps/web/build/client/_app/immutable/nodes/2.Dr646Vs5.js +1 -0
  71. package/apps/web/build/client/_app/immutable/nodes/2.Dr646Vs5.js.br +0 -0
  72. package/apps/web/build/client/_app/immutable/nodes/2.Dr646Vs5.js.gz +0 -0
  73. package/apps/web/build/client/_app/immutable/nodes/{3.Co5hy99T.js → 3.Cgc-xN3x.js} +1 -1
  74. package/apps/web/build/client/_app/immutable/nodes/3.Cgc-xN3x.js.br +0 -0
  75. package/apps/web/build/client/_app/immutable/nodes/3.Cgc-xN3x.js.gz +0 -0
  76. package/apps/web/build/client/_app/immutable/nodes/{4.Ckjmv74-.js → 4.CYJQ4bWz.js} +1 -1
  77. package/apps/web/build/client/_app/immutable/nodes/4.CYJQ4bWz.js.br +0 -0
  78. package/apps/web/build/client/_app/immutable/nodes/4.CYJQ4bWz.js.gz +0 -0
  79. package/apps/web/build/client/_app/immutable/nodes/{5.jG4rh5-7.js → 5.DbHL-3Es.js} +1 -1
  80. package/apps/web/build/client/_app/immutable/nodes/5.DbHL-3Es.js.br +0 -0
  81. package/apps/web/build/client/_app/immutable/nodes/5.DbHL-3Es.js.gz +0 -0
  82. package/apps/web/build/client/_app/immutable/nodes/{6.am-4Bf0e.js → 6.BvWH2qas.js} +1 -1
  83. package/apps/web/build/client/_app/immutable/nodes/6.BvWH2qas.js.br +0 -0
  84. package/apps/web/build/client/_app/immutable/nodes/6.BvWH2qas.js.gz +0 -0
  85. package/apps/web/build/client/_app/immutable/nodes/{7.DpWtqqaL.js → 7.CmbiPMU3.js} +1 -1
  86. package/apps/web/build/client/_app/immutable/nodes/7.CmbiPMU3.js.br +0 -0
  87. package/apps/web/build/client/_app/immutable/nodes/7.CmbiPMU3.js.gz +0 -0
  88. package/apps/web/build/client/_app/immutable/nodes/{8.CbbKDJTU.js → 8.B9897Zm9.js} +1 -1
  89. package/apps/web/build/client/_app/immutable/nodes/8.B9897Zm9.js.br +0 -0
  90. package/apps/web/build/client/_app/immutable/nodes/8.B9897Zm9.js.gz +0 -0
  91. package/apps/web/build/client/_app/immutable/nodes/{9.CB21-Q9D.js → 9.CGMmeMVC.js} +2 -2
  92. package/apps/web/build/client/_app/immutable/nodes/9.CGMmeMVC.js.br +0 -0
  93. package/apps/web/build/client/_app/immutable/nodes/9.CGMmeMVC.js.gz +0 -0
  94. package/apps/web/build/client/_app/version.json +1 -1
  95. package/apps/web/build/client/_app/version.json.br +0 -0
  96. package/apps/web/build/client/_app/version.json.gz +0 -0
  97. package/apps/web/build/handler.js +1 -2
  98. package/apps/web/build/index.js +1 -74
  99. package/apps/web/build/server/.vite/manifest.json +419 -0
  100. package/apps/web/build/server/_app/immutable/assets/_layout.CsjxL1aa.css +2 -0
  101. package/apps/web/build/server/adapter-env.js +2 -0
  102. package/apps/web/build/server/adapter-index.js +74 -0
  103. package/apps/web/build/server/adapter-index.js.map +1 -0
  104. package/apps/web/build/server/{chunks/env-RhfAqpCd.js → adapter-node-env.js} +28 -7
  105. package/apps/web/build/server/adapter-node-env.js.map +1 -0
  106. package/apps/web/build/server/adapter-node-handler.js +584 -0
  107. package/apps/web/build/server/adapter-node-handler.js.map +1 -0
  108. package/apps/web/build/server/chunks/api.js +81 -0
  109. package/apps/web/build/server/chunks/api.js.map +1 -0
  110. package/apps/web/build/server/chunks/{env-DU2WieJy.js → config.js} +2 -2
  111. package/apps/web/build/server/chunks/config.js.map +1 -0
  112. package/apps/web/build/server/chunks/exports.js +625 -0
  113. package/apps/web/build/server/chunks/exports.js.map +1 -0
  114. package/apps/web/build/server/chunks/functions.js +30 -0
  115. package/apps/web/build/server/chunks/functions.js.map +1 -0
  116. package/apps/web/build/server/chunks/index-server.js +2 -0
  117. package/apps/web/build/server/chunks/instance.js +3600 -0
  118. package/apps/web/build/server/chunks/instance.js.map +1 -0
  119. package/apps/web/build/server/chunks/internal.js +2849 -0
  120. package/apps/web/build/server/chunks/internal.js.map +1 -0
  121. package/apps/web/build/server/chunks/scrollLock.svelte.js +7 -0
  122. package/apps/web/build/server/chunks/scrollLock.svelte.js.map +1 -0
  123. package/apps/web/build/server/chunks/server-errors.js +489 -0
  124. package/apps/web/build/server/chunks/server-errors.js.map +1 -0
  125. package/apps/web/build/server/chunks/server.js +9 -0
  126. package/apps/web/build/server/chunks/server.js.map +1 -0
  127. package/apps/web/build/server/chunks/{server2-xUKEUzWG.js → server2.js} +140 -718
  128. package/apps/web/build/server/chunks/server2.js.map +1 -0
  129. package/apps/web/build/server/chunks/shared.js +84 -0
  130. package/apps/web/build/server/chunks/shared.js.map +1 -0
  131. package/apps/web/build/server/chunks/{state-C6VH2NAw.js → state.js} +5 -4
  132. package/apps/web/build/server/chunks/state.js.map +1 -0
  133. package/apps/web/build/server/chunks/{sweetAlert.svelte-BKTpmvHp.js → sweetAlert.svelte.js} +3 -3
  134. package/apps/web/build/server/chunks/sweetAlert.svelte.js.map +1 -0
  135. package/apps/web/build/server/chunks/{uiState.svelte-NgyZk5Jz.js → uiState.svelte.js} +3 -3
  136. package/apps/web/build/server/chunks/uiState.svelte.js.map +1 -0
  137. package/apps/web/build/server/chunks/uneval.js +645 -0
  138. package/apps/web/build/server/chunks/uneval.js.map +1 -0
  139. package/apps/web/build/server/entries/fallbacks/error.svelte.js +12 -0
  140. package/apps/web/build/server/entries/fallbacks/error.svelte.js.map +1 -0
  141. package/apps/web/build/server/entries/hooks.server.js +8 -0
  142. package/apps/web/build/server/entries/hooks.server.js.map +1 -0
  143. package/apps/web/build/server/entries/pages/_layout.js +7 -0
  144. package/apps/web/build/server/entries/pages/_layout.js.map +1 -0
  145. package/apps/web/build/server/{chunks/_layout.svelte-FKDEmK4m.js → entries/pages/_layout.svelte.js} +15 -8
  146. package/apps/web/build/server/entries/pages/_layout.svelte.js.map +1 -0
  147. package/apps/web/build/server/entries/pages/_page.js +9 -0
  148. package/apps/web/build/server/entries/pages/_page.js.map +1 -0
  149. package/apps/web/build/server/entries/pages/_page.svelte.js +7 -0
  150. package/apps/web/build/server/entries/pages/_page.svelte.js.map +1 -0
  151. package/apps/web/build/server/{chunks/_page.svelte-K0WRgefN.js → entries/pages/agents/_page.svelte.js} +8 -5
  152. package/apps/web/build/server/entries/pages/agents/_page.svelte.js.map +1 -0
  153. package/apps/web/build/server/{chunks/_page.svelte-BKU-UjQ2.js → entries/pages/bridges/_page.svelte.js} +9 -6
  154. package/apps/web/build/server/entries/pages/bridges/_page.svelte.js.map +1 -0
  155. package/apps/web/build/server/{chunks/_page.svelte-DBQMj6O8.js → entries/pages/clients/_page.svelte.js} +8 -5
  156. package/apps/web/build/server/entries/pages/clients/_page.svelte.js.map +1 -0
  157. package/apps/web/build/server/{chunks/_page.svelte-BQP0Z2mg.js → entries/pages/context/_page.svelte.js} +9 -6
  158. package/apps/web/build/server/entries/pages/context/_page.svelte.js.map +1 -0
  159. package/apps/web/build/server/{chunks/_page.svelte-D_bQaPtJ.js → entries/pages/dashboard/_page.svelte.js} +7 -4
  160. package/apps/web/build/server/entries/pages/dashboard/_page.svelte.js.map +1 -0
  161. package/apps/web/build/server/{chunks/_page.svelte-CxxsZeRm.js → entries/pages/detector/_page.svelte.js} +5 -3
  162. package/apps/web/build/server/entries/pages/detector/_page.svelte.js.map +1 -0
  163. package/apps/web/build/server/{chunks/_page.svelte-DJp9fAk8.js → entries/pages/docs/_page.svelte.js} +8 -5
  164. package/apps/web/build/server/entries/pages/docs/_page.svelte.js.map +1 -0
  165. package/apps/web/build/server/{chunks/_page.svelte-DFBbcBLc.js → entries/pages/doctor/_page.svelte.js} +8 -5
  166. package/apps/web/build/server/entries/pages/doctor/_page.svelte.js.map +1 -0
  167. package/apps/web/build/server/{chunks/_page.svelte-yXv2Aj6-.js → entries/pages/persona/_page.svelte.js} +9 -6
  168. package/apps/web/build/server/entries/pages/persona/_page.svelte.js.map +1 -0
  169. package/apps/web/build/server/{chunks/_page.svelte-CvH3pIDb.js → entries/pages/savings/_page.svelte.js} +7 -4
  170. package/apps/web/build/server/entries/pages/savings/_page.svelte.js.map +1 -0
  171. package/apps/web/build/server/{chunks/_page.svelte-FUbd8bWv.js → entries/pages/search/_page.svelte.js} +9 -6
  172. package/apps/web/build/server/entries/pages/search/_page.svelte.js.map +1 -0
  173. package/apps/web/build/server/{chunks/_page.svelte-Bu5RfcD4.js → entries/pages/semble/_page.svelte.js} +8 -5
  174. package/apps/web/build/server/entries/pages/semble/_page.svelte.js.map +1 -0
  175. package/apps/web/build/server/{chunks/_page.svelte-B4DKG2sO.js → entries/pages/skills/_page.svelte.js} +10 -7
  176. package/apps/web/build/server/entries/pages/skills/_page.svelte.js.map +1 -0
  177. package/apps/web/build/server/{chunks/_page.svelte-D1yHfBBh.js → entries/pages/tasks/_page.svelte.js} +8 -83
  178. package/apps/web/build/server/entries/pages/tasks/_page.svelte.js.map +1 -0
  179. package/apps/web/build/{env.js → server/env.js} +1 -1
  180. package/apps/web/build/server/handler.js +2 -0
  181. package/apps/web/build/server/index.js +68 -0
  182. package/apps/web/build/server/index.js.map +1 -0
  183. package/apps/web/build/server/manifest-full.js +149 -0
  184. package/apps/web/build/server/manifest.js +149 -0
  185. package/apps/web/build/server/nodes/0.js +10 -0
  186. package/apps/web/build/server/nodes/1.js +8 -0
  187. package/apps/web/build/server/nodes/10.js +8 -0
  188. package/apps/web/build/server/nodes/11.js +8 -0
  189. package/apps/web/build/server/nodes/12.js +8 -0
  190. package/apps/web/build/server/nodes/13.js +8 -0
  191. package/apps/web/build/server/nodes/14.js +8 -0
  192. package/apps/web/build/server/nodes/15.js +8 -0
  193. package/apps/web/build/server/nodes/16.js +8 -0
  194. package/apps/web/build/server/nodes/2.js +10 -0
  195. package/apps/web/build/server/nodes/3.js +8 -0
  196. package/apps/web/build/server/nodes/4.js +8 -0
  197. package/apps/web/build/server/nodes/5.js +8 -0
  198. package/apps/web/build/server/nodes/6.js +8 -0
  199. package/apps/web/build/server/nodes/7.js +8 -0
  200. package/apps/web/build/server/nodes/8.js +8 -0
  201. package/apps/web/build/server/nodes/9.js +8 -0
  202. package/apps/web/build/server/remote-entry.js +1565 -0
  203. package/apps/web/build/server/remote-entry.js.map +1 -0
  204. package/apps/web/build/server/server.js +151 -0
  205. package/apps/web/package.json +10 -9
  206. package/bin/cli.js +6 -6
  207. package/bin/lib/ui_commands.js +4 -3
  208. package/docs/SecurityCompliance/qa_report_2.1.5_2026-10-07.md +65 -0
  209. package/docs/SecurityCompliance/security_compliance_report_google_policy_2.1.4_2026-10-06.md +77 -0
  210. package/docs/SecurityCompliance/security_compliance_report_google_policy_2.1.5_2026-10-07.md +74 -0
  211. package/docs/SecurityCompliance/socket_baseline_2026-10-07.md +60 -0
  212. package/docs/SecurityCompliance/socket_burndown_2.1.5_2026-10-07.md +73 -0
  213. package/docs/SecurityCompliance/socket_report_2.1.5_2026-10-07.md +54 -0
  214. package/docs/architecture/TOKEN-BASELINE.md +1 -1
  215. package/package.json +6 -18
  216. package/src/antigravity_manager.js +81 -15
  217. package/src/db.js +2 -2
  218. package/src/db_agents.js +1 -1
  219. package/src/db_bridges.js +1 -1
  220. package/src/db_savings.js +1 -1
  221. package/src/db_stats.js +1 -1
  222. package/src/deploy_utils.js +4 -5
  223. package/src/doctor.js +10 -0
  224. package/src/migrate.js +1 -1
  225. package/src/persona_memory.js +1 -1
  226. package/src/sqlite_driver.js +211 -0
  227. package/src/vector_search.js +1 -1
  228. package/apps/web/build/adapter-env.js +0 -2
  229. package/apps/web/build/client/_app/immutable/chunks/Ae0obco1.js +0 -3
  230. package/apps/web/build/client/_app/immutable/chunks/Ae0obco1.js.br +0 -0
  231. package/apps/web/build/client/_app/immutable/chunks/Ae0obco1.js.gz +0 -0
  232. package/apps/web/build/client/_app/immutable/chunks/BUgOhUo6.js +0 -1
  233. package/apps/web/build/client/_app/immutable/chunks/BUgOhUo6.js.br +0 -1
  234. package/apps/web/build/client/_app/immutable/chunks/BUgOhUo6.js.gz +0 -0
  235. package/apps/web/build/client/_app/immutable/chunks/Bv85lp2r.js.br +0 -3
  236. package/apps/web/build/client/_app/immutable/chunks/Bv85lp2r.js.gz +0 -0
  237. package/apps/web/build/client/_app/immutable/chunks/CP0LAeYI.js +0 -2
  238. package/apps/web/build/client/_app/immutable/chunks/CP0LAeYI.js.br +0 -0
  239. package/apps/web/build/client/_app/immutable/chunks/CP0LAeYI.js.gz +0 -0
  240. package/apps/web/build/client/_app/immutable/chunks/CP4ze5kR.js.br +0 -0
  241. package/apps/web/build/client/_app/immutable/chunks/CP4ze5kR.js.gz +0 -0
  242. package/apps/web/build/client/_app/immutable/chunks/CV8VO5Jt.js +0 -1
  243. package/apps/web/build/client/_app/immutable/chunks/CV8VO5Jt.js.br +0 -0
  244. package/apps/web/build/client/_app/immutable/chunks/CV8VO5Jt.js.gz +0 -0
  245. package/apps/web/build/client/_app/immutable/chunks/DNVgNyBC.js +0 -1
  246. package/apps/web/build/client/_app/immutable/chunks/DNVgNyBC.js.br +0 -2
  247. package/apps/web/build/client/_app/immutable/chunks/DNVgNyBC.js.gz +0 -0
  248. package/apps/web/build/client/_app/immutable/chunks/DVr7DrHY.js +0 -1
  249. package/apps/web/build/client/_app/immutable/chunks/DVr7DrHY.js.br +0 -0
  250. package/apps/web/build/client/_app/immutable/chunks/DVr7DrHY.js.gz +0 -0
  251. package/apps/web/build/client/_app/immutable/chunks/HclGiUj8.js +0 -1
  252. package/apps/web/build/client/_app/immutable/chunks/HclGiUj8.js.br +0 -0
  253. package/apps/web/build/client/_app/immutable/chunks/HclGiUj8.js.gz +0 -0
  254. package/apps/web/build/client/_app/immutable/chunks/tFx9Vkzn.js.br +0 -0
  255. package/apps/web/build/client/_app/immutable/chunks/tFx9Vkzn.js.gz +0 -0
  256. package/apps/web/build/client/_app/immutable/entry/app.qpZh6bSp.js +0 -2
  257. package/apps/web/build/client/_app/immutable/entry/app.qpZh6bSp.js.br +0 -0
  258. package/apps/web/build/client/_app/immutable/entry/app.qpZh6bSp.js.gz +0 -0
  259. package/apps/web/build/client/_app/immutable/entry/start.CUhKN6Eq.js +0 -2
  260. package/apps/web/build/client/_app/immutable/entry/start.CUhKN6Eq.js.br +0 -2
  261. package/apps/web/build/client/_app/immutable/entry/start.CUhKN6Eq.js.gz +0 -0
  262. package/apps/web/build/client/_app/immutable/nodes/0.BV_U6rd9.js.br +0 -0
  263. package/apps/web/build/client/_app/immutable/nodes/0.BV_U6rd9.js.gz +0 -0
  264. package/apps/web/build/client/_app/immutable/nodes/1.317ei_PM.js.br +0 -1
  265. package/apps/web/build/client/_app/immutable/nodes/1.317ei_PM.js.gz +0 -0
  266. package/apps/web/build/client/_app/immutable/nodes/10.C9BHUF6_.js.br +0 -0
  267. package/apps/web/build/client/_app/immutable/nodes/10.C9BHUF6_.js.gz +0 -0
  268. package/apps/web/build/client/_app/immutable/nodes/11._7rmywnA.js.br +0 -0
  269. package/apps/web/build/client/_app/immutable/nodes/11._7rmywnA.js.gz +0 -0
  270. package/apps/web/build/client/_app/immutable/nodes/12.B_UJh_Cw.js.br +0 -0
  271. package/apps/web/build/client/_app/immutable/nodes/12.B_UJh_Cw.js.gz +0 -0
  272. package/apps/web/build/client/_app/immutable/nodes/13.FtUj7AO8.js.br +0 -0
  273. package/apps/web/build/client/_app/immutable/nodes/13.FtUj7AO8.js.gz +0 -0
  274. package/apps/web/build/client/_app/immutable/nodes/14.CsMWcbH2.js.br +0 -0
  275. package/apps/web/build/client/_app/immutable/nodes/14.CsMWcbH2.js.gz +0 -0
  276. package/apps/web/build/client/_app/immutable/nodes/15.DbSoDlZF.js.br +0 -0
  277. package/apps/web/build/client/_app/immutable/nodes/15.DbSoDlZF.js.gz +0 -0
  278. package/apps/web/build/client/_app/immutable/nodes/16.BcMZYQJR.js.br +0 -0
  279. package/apps/web/build/client/_app/immutable/nodes/16.BcMZYQJR.js.gz +0 -0
  280. package/apps/web/build/client/_app/immutable/nodes/2.Bs0YCKXY.js +0 -1
  281. package/apps/web/build/client/_app/immutable/nodes/2.Bs0YCKXY.js.br +0 -0
  282. package/apps/web/build/client/_app/immutable/nodes/2.Bs0YCKXY.js.gz +0 -0
  283. package/apps/web/build/client/_app/immutable/nodes/3.Co5hy99T.js.br +0 -0
  284. package/apps/web/build/client/_app/immutable/nodes/3.Co5hy99T.js.gz +0 -0
  285. package/apps/web/build/client/_app/immutable/nodes/4.Ckjmv74-.js.br +0 -0
  286. package/apps/web/build/client/_app/immutable/nodes/4.Ckjmv74-.js.gz +0 -0
  287. package/apps/web/build/client/_app/immutable/nodes/5.jG4rh5-7.js.br +0 -0
  288. package/apps/web/build/client/_app/immutable/nodes/5.jG4rh5-7.js.gz +0 -0
  289. package/apps/web/build/client/_app/immutable/nodes/6.am-4Bf0e.js.br +0 -0
  290. package/apps/web/build/client/_app/immutable/nodes/6.am-4Bf0e.js.gz +0 -0
  291. package/apps/web/build/client/_app/immutable/nodes/7.DpWtqqaL.js.br +0 -0
  292. package/apps/web/build/client/_app/immutable/nodes/7.DpWtqqaL.js.gz +0 -0
  293. package/apps/web/build/client/_app/immutable/nodes/8.CbbKDJTU.js.br +0 -0
  294. package/apps/web/build/client/_app/immutable/nodes/8.CbbKDJTU.js.gz +0 -0
  295. package/apps/web/build/client/_app/immutable/nodes/9.CB21-Q9D.js.br +0 -0
  296. package/apps/web/build/client/_app/immutable/nodes/9.CB21-Q9D.js.gz +0 -0
  297. package/apps/web/build/dir.js +0 -8
  298. package/apps/web/build/dir.js.map +0 -1
  299. package/apps/web/build/index.js.map +0 -1
  300. package/apps/web/build/server/chunks/0-D09zEpvl.js +0 -31
  301. package/apps/web/build/server/chunks/0-D09zEpvl.js.map +0 -1
  302. package/apps/web/build/server/chunks/1-2My56RES.js +0 -17
  303. package/apps/web/build/server/chunks/1-2My56RES.js.map +0 -1
  304. package/apps/web/build/server/chunks/10-M1HtRrZp.js +0 -17
  305. package/apps/web/build/server/chunks/10-M1HtRrZp.js.map +0 -1
  306. package/apps/web/build/server/chunks/11-BDyQuE2U.js +0 -18
  307. package/apps/web/build/server/chunks/11-BDyQuE2U.js.map +0 -1
  308. package/apps/web/build/server/chunks/12-DR3YohxS.js +0 -16
  309. package/apps/web/build/server/chunks/12-DR3YohxS.js.map +0 -1
  310. package/apps/web/build/server/chunks/13-BJri0QNV.js +0 -18
  311. package/apps/web/build/server/chunks/13-BJri0QNV.js.map +0 -1
  312. package/apps/web/build/server/chunks/14-DJhiE2DY.js +0 -17
  313. package/apps/web/build/server/chunks/14-DJhiE2DY.js.map +0 -1
  314. package/apps/web/build/server/chunks/15-CJUlxcu3.js +0 -19
  315. package/apps/web/build/server/chunks/15-CJUlxcu3.js.map +0 -1
  316. package/apps/web/build/server/chunks/16-BCncPEHV.js +0 -17
  317. package/apps/web/build/server/chunks/16-BCncPEHV.js.map +0 -1
  318. package/apps/web/build/server/chunks/2-B_JPNlak.js +0 -26
  319. package/apps/web/build/server/chunks/2-B_JPNlak.js.map +0 -1
  320. package/apps/web/build/server/chunks/3-BSOfGnYr.js +0 -17
  321. package/apps/web/build/server/chunks/3-BSOfGnYr.js.map +0 -1
  322. package/apps/web/build/server/chunks/4-DUmAi2o6.js +0 -18
  323. package/apps/web/build/server/chunks/4-DUmAi2o6.js.map +0 -1
  324. package/apps/web/build/server/chunks/5-DSM_rY93.js +0 -17
  325. package/apps/web/build/server/chunks/5-DSM_rY93.js.map +0 -1
  326. package/apps/web/build/server/chunks/6-CquXfuY3.js +0 -18
  327. package/apps/web/build/server/chunks/6-CquXfuY3.js.map +0 -1
  328. package/apps/web/build/server/chunks/7-CBNvUHPu.js +0 -16
  329. package/apps/web/build/server/chunks/7-CBNvUHPu.js.map +0 -1
  330. package/apps/web/build/server/chunks/8-BlIFjRiQ.js +0 -16
  331. package/apps/web/build/server/chunks/8-BlIFjRiQ.js.map +0 -1
  332. package/apps/web/build/server/chunks/9-sa0-Zgfq.js +0 -16
  333. package/apps/web/build/server/chunks/9-sa0-Zgfq.js.map +0 -1
  334. package/apps/web/build/server/chunks/_layout.svelte-FKDEmK4m.js.map +0 -1
  335. package/apps/web/build/server/chunks/_page.svelte-B4DKG2sO.js.map +0 -1
  336. package/apps/web/build/server/chunks/_page.svelte-BKU-UjQ2.js.map +0 -1
  337. package/apps/web/build/server/chunks/_page.svelte-BQP0Z2mg.js.map +0 -1
  338. package/apps/web/build/server/chunks/_page.svelte-Bu5RfcD4.js.map +0 -1
  339. package/apps/web/build/server/chunks/_page.svelte-CvH3pIDb.js.map +0 -1
  340. package/apps/web/build/server/chunks/_page.svelte-CxxsZeRm.js.map +0 -1
  341. package/apps/web/build/server/chunks/_page.svelte-D1yHfBBh.js.map +0 -1
  342. package/apps/web/build/server/chunks/_page.svelte-DBQMj6O8.js.map +0 -1
  343. package/apps/web/build/server/chunks/_page.svelte-DFBbcBLc.js.map +0 -1
  344. package/apps/web/build/server/chunks/_page.svelte-DJp9fAk8.js.map +0 -1
  345. package/apps/web/build/server/chunks/_page.svelte-D_bQaPtJ.js.map +0 -1
  346. package/apps/web/build/server/chunks/_page.svelte-FUbd8bWv.js.map +0 -1
  347. package/apps/web/build/server/chunks/_page.svelte-K0WRgefN.js.map +0 -1
  348. package/apps/web/build/server/chunks/_page.svelte-LJxJVjMb.js +0 -7
  349. package/apps/web/build/server/chunks/_page.svelte-LJxJVjMb.js.map +0 -1
  350. package/apps/web/build/server/chunks/_page.svelte-yXv2Aj6-.js.map +0 -1
  351. package/apps/web/build/server/chunks/env-DU2WieJy.js.map +0 -1
  352. package/apps/web/build/server/chunks/env-RhfAqpCd.js.map +0 -1
  353. package/apps/web/build/server/chunks/error.svelte-CNqmrJIT.js +0 -12
  354. package/apps/web/build/server/chunks/error.svelte-CNqmrJIT.js.map +0 -1
  355. package/apps/web/build/server/chunks/exports-DzZ-4-Dy.js +0 -327
  356. package/apps/web/build/server/chunks/exports-DzZ-4-Dy.js.map +0 -1
  357. package/apps/web/build/server/chunks/handler-CNvIc1cp.js +0 -7301
  358. package/apps/web/build/server/chunks/handler-CNvIc1cp.js.map +0 -1
  359. package/apps/web/build/server/chunks/hooks.server-DqbY7q70.js +0 -8
  360. package/apps/web/build/server/chunks/hooks.server-DqbY7q70.js.map +0 -1
  361. package/apps/web/build/server/chunks/index-server-ULRIL6sb.js +0 -2
  362. package/apps/web/build/server/chunks/rolldown-runtime-D7D4PA-g.js +0 -13
  363. package/apps/web/build/server/chunks/scrollLock.svelte-ULRIL6sb.js +0 -2
  364. package/apps/web/build/server/chunks/server2-xUKEUzWG.js.map +0 -1
  365. package/apps/web/build/server/chunks/state-C6VH2NAw.js.map +0 -1
  366. package/apps/web/build/server/chunks/sweetAlert.svelte-BKTpmvHp.js.map +0 -1
  367. package/apps/web/build/server/chunks/uiState.svelte-NgyZk5Jz.js.map +0 -1
@@ -0,0 +1,1565 @@
1
+ import { t as prerendering } from "./chunks/server.js";
2
+ import { D as get_request_store, N as MUTATIVE_METHODS, k as with_request_store, t as error } from "./chunks/exports.js";
3
+ import { $ as parse, Ct as app_dir, K as parse_remote_arg, W as create_remote_key, at as deep_set, ct as parse_form_key, et as stringify, it as create_field_proxy, k as handle_error_and_jsonify, lt as split_path, ot as flatten_issues, q as stringify_remote_arg, st as normalize_issue } from "./chunks/internal.js";
4
+ import { n as HandledHttpError, o as ValidationError } from "./chunks/shared.js";
5
+ import { A as remote_cookie_forbidden, B as remote_requested_context, D as remote_command_method, F as remote_query_live_no_value, G as server_api_unavailable, H as remote_requested_invalid_query, I as remote_query_live_not_iterable, L as remote_query_prerender, N as remote_headers_forbidden, O as remote_command_readonly, P as remote_invalid_validator, R as remote_request_property, U as remote_requested_wrong_method, V as remote_requested_invalid_limit, j as remote_cookie_path_relative, k as remote_command_render, z as remote_requested_async_validator } from "./chunks/server-errors.js";
6
+ import { n as noop } from "./chunks/functions.js";
7
+ //#region ../../node_modules/.pnpm/@sveltejs+kit@3.0.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@5.57.2_vite@8.3.3_jiti@2._2180d2dbf687eed18f260b26dab65894/node_modules/@sveltejs/kit/src/runtime/app/server/remote/shared.js
8
+ /** @import { RequestEvent } from '@sveltejs/kit' */
9
+ /** @import { MaybePromise, RequestState, RemoteInternals, RequestStore, RemoteLiveQueryUserFunctionReturnType } from 'types' */
10
+ /**
11
+ * @param {any} validate_or_fn
12
+ * @param {((arg?: any) => any) | undefined} [maybe_fn]
13
+ * @returns {(arg?: any) => MaybePromise<any>}
14
+ */
15
+ function create_validator(validate_or_fn, maybe_fn) {
16
+ if (!maybe_fn) return (arg) => {
17
+ if (arg !== void 0) error(400, "Bad Request");
18
+ };
19
+ if (validate_or_fn === "unchecked") return (arg) => arg;
20
+ if ("~standard" in validate_or_fn) return async (arg) => {
21
+ const result = await validate_or_fn["~standard"].validate(arg);
22
+ if (result.issues) throw new ValidationError(result.issues);
23
+ return result.value;
24
+ };
25
+ remote_invalid_validator();
26
+ }
27
+ /**
28
+ * In case of a single remote function call, just returns the result.
29
+ *
30
+ * In case of a full page reload, returns the response for a remote function call,
31
+ * either from the cache or by invoking the function.
32
+ * Also saves an uneval'ed version of the result for later HTML inlining for hydration.
33
+ *
34
+ * @template {MaybePromise<any>} T
35
+ * @param {RemoteInternals} internals
36
+ * @param {string} payload — the stringified raw argument (i.e. the cache key the client will use)
37
+ * @param {RequestState} state
38
+ * @param {() => Promise<T>} get_result
39
+ * @returns {Promise<T>}
40
+ */
41
+ async function get_response(internals, payload, state, get_result) {
42
+ await 0;
43
+ const cache = get_cache(internals, state);
44
+ if (!state.is_in_remote_query) get_implicit_lookup(internals, state)[payload] = get_result;
45
+ return cache[payload] ??= get_result();
46
+ }
47
+ /**
48
+ * @param {RequestEvent} event
49
+ * @param {RequestState} state
50
+ * @param {boolean} allow_cookies
51
+ * @returns {RequestStore}
52
+ */
53
+ function derive_remote_function_event(event, state, allow_cookies) {
54
+ /** @type {RequestEvent} */
55
+ const derived = {
56
+ ...event,
57
+ setHeaders: () => {
58
+ remote_headers_forbidden();
59
+ },
60
+ cookies: {
61
+ ...event.cookies,
62
+ set: (name, value, opts) => {
63
+ if (!allow_cookies) remote_cookie_forbidden({ operation: "set" });
64
+ if (opts?.path && !opts.path.startsWith("/")) remote_cookie_path_relative({ operation: "set" });
65
+ return event.cookies.set(name, value, opts);
66
+ },
67
+ delete: (name, opts) => {
68
+ if (!allow_cookies) remote_cookie_forbidden({ operation: "delete" });
69
+ if (opts?.path && !opts.path.startsWith("/")) remote_cookie_path_relative({ operation: "deleted" });
70
+ return event.cookies.delete(name, opts);
71
+ }
72
+ }
73
+ };
74
+ if (state.is_in_remote_query) for (const property of [
75
+ "url",
76
+ "params",
77
+ "route"
78
+ ]) Object.defineProperty(derived, property, {
79
+ enumerable: false,
80
+ get() {
81
+ return remote_request_property({ property });
82
+ }
83
+ });
84
+ return {
85
+ event: derived,
86
+ state: {
87
+ ...state,
88
+ is_in_remote_function: true
89
+ }
90
+ };
91
+ }
92
+ /**
93
+ * Like `with_event` but removes things from `event` you cannot see/call in remote functions, such as `setHeaders`.
94
+ * @template T
95
+ * @param {RequestEvent} event
96
+ * @param {RequestState} state
97
+ * @param {boolean} allow_cookies
98
+ * @param {() => any} get_input
99
+ * @param {(arg?: any) => T} fn
100
+ */
101
+ async function run_remote_function(event, state, allow_cookies, get_input, fn) {
102
+ const store = derive_remote_function_event(event, state, allow_cookies);
103
+ const input = await with_request_store(store, get_input);
104
+ return with_request_store(store, () => fn(input));
105
+ }
106
+ /**
107
+ * Like `with_event` but removes things from `event` you cannot see/call in remote functions, such as `setHeaders`.
108
+ * @template T
109
+ * @param {RequestEvent} event
110
+ * @param {RequestState} state
111
+ * @param {boolean} allow_cookies
112
+ * @param {() => any} get_input
113
+ * @param {(arg?: any) => RemoteLiveQueryUserFunctionReturnType<T>} fn
114
+ * @param {string} name
115
+ */
116
+ async function* run_remote_generator(event, state, allow_cookies, get_input, fn, name) {
117
+ const store = derive_remote_function_event(event, state, allow_cookies);
118
+ const input = await with_request_store(store, get_input);
119
+ const iterator = to_iterator(await with_request_store(store, () => fn(input)), name);
120
+ let done = false;
121
+ try {
122
+ while (true) {
123
+ const result = await with_request_store(store, () => iterator.next());
124
+ if (result.done) {
125
+ done = true;
126
+ return result.value;
127
+ }
128
+ yield result.value;
129
+ }
130
+ } finally {
131
+ if (!done && typeof iterator.return === "function") await with_request_store(store, () => iterator.return?.(void 0));
132
+ }
133
+ }
134
+ /**
135
+ * @template T
136
+ * @param {Awaited<RemoteLiveQueryUserFunctionReturnType<T>>} source
137
+ * @param {string} name
138
+ * @returns {Iterator<T> | AsyncIterator<T>}
139
+ */
140
+ function to_iterator(source, name) {
141
+ if ("next" in source && typeof source.next === "function") return source;
142
+ if (Symbol.asyncIterator in source && typeof source[Symbol.asyncIterator] === "function") return source[Symbol.asyncIterator]();
143
+ if (Symbol.iterator in source && typeof source[Symbol.iterator] === "function") return source[Symbol.iterator]();
144
+ remote_query_live_not_iterable({ name });
145
+ }
146
+ /**
147
+ * Note that `state` is deliberately not optional: resources that capture the request
148
+ * state at creation must pass it explicitly, because reading it from the request store
149
+ * at call time is only equivalent on runtimes with `AsyncLocalStorage` support.
150
+ * Callers without a captured state (such as the module-level `form` instance getters)
151
+ * should pass `get_request_store().state` themselves.
152
+ * @param {RemoteInternals} internals
153
+ * @param {RequestState} state
154
+ */
155
+ function get_cache(internals, state) {
156
+ let cache = state.remote.data?.get(internals);
157
+ if (cache === void 0) {
158
+ cache = {};
159
+ (state.remote.data ??= /* @__PURE__ */ new Map()).set(internals, cache);
160
+ }
161
+ return cache;
162
+ }
163
+ /**
164
+ * @param {RemoteInternals} internals
165
+ * @param {RequestState} state
166
+ */
167
+ function get_implicit_lookup(internals, state) {
168
+ let cache = state.remote.implicit?.get(internals);
169
+ if (cache === void 0) {
170
+ cache = {};
171
+ (state.remote.implicit ??= /* @__PURE__ */ new Map()).set(internals, cache);
172
+ }
173
+ return cache;
174
+ }
175
+ //#endregion
176
+ //#region ../../node_modules/.pnpm/@sveltejs+kit@3.0.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@5.57.2_vite@8.3.3_jiti@2._2180d2dbf687eed18f260b26dab65894/node_modules/@sveltejs/kit/src/runtime/app/server/remote/command.js
177
+ /** @import { RemoteCommand } from '$app/server' */
178
+ /** @import { MaybePromise, RemoteCommandInternals } from 'types' */
179
+ /** @import { StandardSchemaV1 } from '@standard-schema/spec' */
180
+ /**
181
+ * Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call.
182
+ *
183
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation.
184
+ *
185
+ * @template Output
186
+ * @overload
187
+ * @param {() => MaybePromise<Output>} fn
188
+ * @returns {RemoteCommand<void, Output>}
189
+ * @since 2.27
190
+ */
191
+ /**
192
+ * Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call.
193
+ *
194
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation.
195
+ *
196
+ * @template Input
197
+ * @template Output
198
+ * @overload
199
+ * @param {'unchecked'} validate
200
+ * @param {(arg: Input) => MaybePromise<Output>} fn
201
+ * @returns {RemoteCommand<Input, Output>}
202
+ * @since 2.27
203
+ */
204
+ /**
205
+ * Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call.
206
+ *
207
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation.
208
+ *
209
+ * @template {StandardSchemaV1} Schema
210
+ * @template Output
211
+ * @overload
212
+ * @param {Schema} validate
213
+ * @param {(arg: StandardSchemaV1.InferOutput<Schema>) => MaybePromise<Output>} fn
214
+ * @returns {RemoteCommand<StandardSchemaV1.InferInput<Schema>, Output>}
215
+ * @since 2.27
216
+ */
217
+ /**
218
+ * @template Input
219
+ * @template Output
220
+ * @param {any} validate_or_fn
221
+ * @param {(arg?: Input) => MaybePromise<Output>} [maybe_fn]
222
+ * @returns {RemoteCommand<Input, Output>}
223
+ * @since 2.27
224
+ */
225
+ /*@__NO_SIDE_EFFECTS__*/
226
+ function command(validate_or_fn, maybe_fn) {
227
+ /** @type {(arg?: Input) => MaybePromise<Output>} */
228
+ const fn = maybe_fn ?? validate_or_fn;
229
+ /** @type {(arg?: any) => MaybePromise<Input>} */
230
+ const validate = create_validator(validate_or_fn, maybe_fn);
231
+ /** @type {RemoteCommandInternals} */
232
+ const __ = {
233
+ type: "command",
234
+ id: "",
235
+ name: ""
236
+ };
237
+ /** @type {RemoteCommand<Input, Output> & { __: RemoteCommandInternals }} */
238
+ const wrapper = (arg) => {
239
+ const { event, state } = get_request_store();
240
+ if (!MUTATIVE_METHODS.includes(event.request.method) || state.is_in_remote_query || state.is_in_remote_prerender) {
241
+ if (state.is_in_remote_query || state.is_in_remote_prerender) remote_command_readonly({ name: __.name });
242
+ remote_command_method({
243
+ name: __.name,
244
+ method: event.request.method
245
+ });
246
+ }
247
+ if (state.is_in_render) remote_command_render({ name: __.name });
248
+ const promise = Promise.resolve(run_remote_function(event, state, true, () => validate(arg), fn));
249
+ promise.updates = () => {
250
+ server_api_unavailable({ name: `${__.name}(...).updates(...)` });
251
+ };
252
+ return promise;
253
+ };
254
+ Object.defineProperty(wrapper, "__", { value: __ });
255
+ Object.defineProperty(wrapper, "pending", { get: () => 0 });
256
+ return wrapper;
257
+ }
258
+ //#endregion
259
+ //#region ../../node_modules/.pnpm/@sveltejs+kit@3.0.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@5.57.2_vite@8.3.3_jiti@2._2180d2dbf687eed18f260b26dab65894/node_modules/@sveltejs/kit/src/runtime/app/server/remote/form.js
260
+ /** @import { RemoteFormInput, RemoteForm, RemoteFormInvalidField } from '$app/server' */
261
+ /** @import { InternalRemoteFormIssue, MaybePromise, HasNonOptionalBoolean, RemoteFormInternals } from 'types' */
262
+ /** @import { StandardSchemaV1 } from '@standard-schema/spec' */
263
+ /**
264
+ * Creates a form object that can be spread onto a `<form>` element.
265
+ *
266
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.
267
+ *
268
+ * @template Output
269
+ * @overload
270
+ * @param {() => MaybePromise<Output>} fn
271
+ * @returns {RemoteForm<void, Output>}
272
+ * @since 2.27
273
+ */
274
+ /**
275
+ * Creates a form object that can be spread onto a `<form>` element.
276
+ *
277
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.
278
+ *
279
+ * @template {RemoteFormInput} Input
280
+ * @template Output
281
+ * @overload
282
+ * @param {'unchecked'} validate
283
+ * @param {(data: Input, issue: RemoteFormInvalidField<Input>) => MaybePromise<Output>} fn
284
+ * @returns {RemoteForm<Input, Output>}
285
+ * @since 2.27
286
+ */
287
+ /**
288
+ * Creates a form object that can be spread onto a `<form>` element.
289
+ *
290
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.
291
+ *
292
+ * @template {StandardSchemaV1<RemoteFormInput, Record<string, any>>} Schema
293
+ * @template Output
294
+ * @overload
295
+ * @param {true extends HasNonOptionalBoolean<StandardSchemaV1.InferInput<Schema>> ? 'Error: All booleans in form schemas must be optional (e.g. `v.optional(v.boolean(), false)`) because checkbox inputs do not send a false value when unchecked.' : Schema} validate
296
+ * @param {(data: StandardSchemaV1.InferOutput<Schema>, issue: RemoteFormInvalidField<StandardSchemaV1.InferInput<Schema>>) => MaybePromise<Output>} fn
297
+ * @returns {RemoteForm<StandardSchemaV1.InferInput<Schema>, Output>}
298
+ * @since 2.27
299
+ */
300
+ /**
301
+ * @template {RemoteFormInput} Input
302
+ * @template Output
303
+ * @param {any} validate_or_fn
304
+ * @param {(data_or_issue: any, issue?: any) => MaybePromise<Output>} [maybe_fn]
305
+ * @returns {RemoteForm<Input, Output>}
306
+ * @since 2.27
307
+ */
308
+ /*@__NO_SIDE_EFFECTS__*/
309
+ function form(validate_or_fn, maybe_fn) {
310
+ /** @type {any} */
311
+ const fn = maybe_fn ?? validate_or_fn;
312
+ /** @type {StandardSchemaV1 | null} */
313
+ const schema = !maybe_fn || validate_or_fn === "unchecked" ? null : validate_or_fn;
314
+ /**
315
+ * @param {string | number | boolean} [key]
316
+ */
317
+ function create_instance(key) {
318
+ const instance = {};
319
+ instance.method = "POST";
320
+ Object.defineProperty(instance, "enhance", { value: () => {
321
+ return {
322
+ action: instance.action,
323
+ method: instance.method
324
+ };
325
+ } });
326
+ /** @type {RemoteFormInternals} */
327
+ const __ = {
328
+ type: "form",
329
+ name: "",
330
+ id: "",
331
+ fn: async (data, meta, form_data) => {
332
+ const output = {};
333
+ output.submission = true;
334
+ const { event, state } = get_request_store();
335
+ const validated = await schema?.["~standard"].validate(data);
336
+ if (meta.validate_only) return validated?.issues?.map((issue) => normalize_issue(issue, true)) ?? [];
337
+ if (validated?.issues !== void 0) handle_issues(output, validated.issues, form_data, __.id);
338
+ else {
339
+ if (validated !== void 0) data = validated.value;
340
+ const issue = create_issues();
341
+ try {
342
+ output.result = await run_remote_function(event, state, true, () => data, (data) => !maybe_fn ? fn() : fn(data, issue));
343
+ } catch (error) {
344
+ if (error instanceof ValidationError) handle_issues(output, error.issues, form_data, __.id);
345
+ else throw error;
346
+ }
347
+ }
348
+ if (!event.isRemoteRequest) {
349
+ const cache = get_cache(__, state);
350
+ cache[""] ??= output;
351
+ get_implicit_lookup(__, state)[__.key ? `${__.id}/${__.key}` : __.id] = () => cache[""];
352
+ }
353
+ return output;
354
+ }
355
+ };
356
+ Object.defineProperty(instance, "__", { value: __ });
357
+ Object.defineProperty(instance, "action", {
358
+ get: () => {
359
+ const { event, state } = get_request_store();
360
+ const search = new URLSearchParams(state.prerendering ? "" : event.url.search);
361
+ search.delete("/remote");
362
+ const query = search.toString();
363
+ const action_id = __.key ? `${__.id}/${encodeURIComponent(__.key)}` : __.id;
364
+ return `?${query ? `${query}&` : ""}/remote=${action_id}`;
365
+ },
366
+ enumerable: true
367
+ });
368
+ Object.defineProperty(instance, "fields", { get() {
369
+ return create_field_proxy({
370
+ form_id: __.id,
371
+ get: () => get_cache(__, get_request_store().state)?.[""]?.input ?? {},
372
+ set: (path, value) => {
373
+ const cache = get_cache(__, get_request_store().state);
374
+ const entry = cache[""];
375
+ if (entry?.submission) return;
376
+ if (path.length === 0) {
377
+ (cache[""] ??= {}).input = value;
378
+ return;
379
+ }
380
+ const input = entry?.input ?? {};
381
+ deep_set(input, path.map(String), value);
382
+ (cache[""] ??= {}).input = input;
383
+ },
384
+ get_issues: () => flatten_issues(get_cache(__, get_request_store().state)?.[""]?.issues ?? []),
385
+ get_touched: () => ({}),
386
+ get_dirty: () => ({})
387
+ });
388
+ } });
389
+ Object.defineProperty(instance, "result", { get() {
390
+ try {
391
+ return get_cache(__, get_request_store().state)?.[""]?.result;
392
+ } catch {
393
+ return;
394
+ }
395
+ } });
396
+ Object.defineProperty(instance, "pending", { get: () => 0 });
397
+ Object.defineProperty(instance, "submitted", { get: () => false });
398
+ Object.defineProperty(instance, "preflight", { value: () => instance });
399
+ Object.defineProperty(instance, "validate", { value: () => {
400
+ server_api_unavailable({ name: "form.validate()" });
401
+ } });
402
+ Object.defineProperty(instance, "submit", { value: () => {
403
+ server_api_unavailable({ name: "form.submit()" });
404
+ } });
405
+ Object.defineProperty(instance, "element", { get: () => null });
406
+ if (key == void 0) Object.defineProperty(instance, "for", {
407
+ /** @type {RemoteForm<any, any>['for']} */
408
+ value: (key) => {
409
+ const { state } = get_request_store();
410
+ const cache_key = __.id + "|" + JSON.stringify(key);
411
+ /** @type {RemoteForm<Input, Output> & { __: RemoteFormInternals }} */
412
+ let instance = (state.remote.forms ??= /* @__PURE__ */ new Map()).get(cache_key);
413
+ if (!instance) {
414
+ instance = create_instance(key);
415
+ instance.__.id = __.id;
416
+ instance.__.key = JSON.stringify(key);
417
+ instance.__.name = __.name;
418
+ state.remote.forms.set(cache_key, instance);
419
+ }
420
+ return instance;
421
+ } });
422
+ return instance;
423
+ }
424
+ return create_instance();
425
+ }
426
+ /**
427
+ * @param {{ issues?: InternalRemoteFormIssue[], input?: Record<string, any>, result: any }} output
428
+ * @param {readonly StandardSchemaV1.Issue[]} issues
429
+ * @param {FormData | null} form_data - null if the form is progressively enhanced
430
+ * @param {string} form_id - hash/name of the form
431
+ */
432
+ function handle_issues(output, issues, form_data, form_id) {
433
+ output.issues = issues.map((issue) => normalize_issue(issue, true));
434
+ if (form_data) {
435
+ output.input = {};
436
+ for (const field_name of form_data.keys()) {
437
+ const field = parse_form_key(form_id, field_name);
438
+ const path = split_path(field.name);
439
+ if (path.some((part) => part.startsWith("_"))) continue;
440
+ const values = form_data.getAll(field_name).filter((value) => typeof value === "string");
441
+ deep_set(output.input, path, field.is_array ? values : values[0]);
442
+ }
443
+ }
444
+ }
445
+ /**
446
+ * Creates an invalid function that can be used to imperatively mark form fields as invalid
447
+ * @returns {RemoteFormInvalidField<any>}
448
+ */
449
+ function create_issues() {
450
+ return new Proxy(
451
+ /** @param {string} message */
452
+ (message) => {
453
+ return create_issue(message);
454
+ },
455
+ { get(target, prop) {
456
+ if (typeof prop === "symbol") return target[prop];
457
+ return create_issue_proxy(prop, []);
458
+ } }
459
+ );
460
+ /**
461
+ * @param {string} message
462
+ * @param {(string | number)[]} path
463
+ * @returns {StandardSchemaV1.Issue}
464
+ */
465
+ function create_issue(message, path = []) {
466
+ return {
467
+ message,
468
+ path
469
+ };
470
+ }
471
+ /**
472
+ * Creates a proxy that builds up a path and returns a function to create an issue
473
+ * @param {string | number} key
474
+ * @param {(string | number)[]} path
475
+ */
476
+ function create_issue_proxy(key, path) {
477
+ const new_path = [...path, key];
478
+ /**
479
+ * @param {string} message
480
+ * @returns {StandardSchemaV1.Issue}
481
+ */
482
+ const issue_func = (message) => create_issue(message, new_path);
483
+ return new Proxy(issue_func, { get(target, prop) {
484
+ if (typeof prop === "symbol") return target[prop];
485
+ if (/^\d+$/.test(prop)) return create_issue_proxy(parseInt(prop, 10), new_path);
486
+ return create_issue_proxy(prop, new_path);
487
+ } });
488
+ }
489
+ }
490
+ //#endregion
491
+ //#region ../../node_modules/.pnpm/@sveltejs+kit@3.0.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@5.57.2_vite@8.3.3_jiti@2._2180d2dbf687eed18f260b26dab65894/node_modules/@sveltejs/kit/src/runtime/app/server/remote/prerender.js
492
+ /** @import { RemoteResource, RemotePrerenderFunction } from '$app/server' */
493
+ /** @import { RemoteFunctionResponse, RemotePrerenderInputsGenerator, RemotePrerenderInternals, MaybePromise } from 'types' */
494
+ /** @import { StandardSchemaV1 } from '@standard-schema/spec' */
495
+ /**
496
+ * Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call.
497
+ *
498
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation.
499
+ *
500
+ * @template Output
501
+ * @overload
502
+ * @param {() => MaybePromise<Output>} fn
503
+ * @param {{ inputs?: RemotePrerenderInputsGenerator<void>, dynamic?: boolean }} [options]
504
+ * @returns {RemotePrerenderFunction<void, Output>}
505
+ * @since 2.27
506
+ */
507
+ /**
508
+ * Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call.
509
+ *
510
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation.
511
+ *
512
+ * @template Input
513
+ * @template Output
514
+ * @overload
515
+ * @param {'unchecked'} validate
516
+ * @param {(arg: Input) => MaybePromise<Output>} fn
517
+ * @param {{ inputs?: RemotePrerenderInputsGenerator<Input>, dynamic?: boolean }} [options]
518
+ * @returns {RemotePrerenderFunction<Input, Output>}
519
+ * @since 2.27
520
+ */
521
+ /**
522
+ * Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call.
523
+ *
524
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation.
525
+ *
526
+ * @template {StandardSchemaV1} Schema
527
+ * @template Output
528
+ * @overload
529
+ * @param {Schema} schema
530
+ * @param {(arg: StandardSchemaV1.InferOutput<Schema>) => MaybePromise<Output>} fn
531
+ * @param {{ inputs?: RemotePrerenderInputsGenerator<StandardSchemaV1.InferInput<Schema>>, dynamic?: boolean }} [options]
532
+ * @returns {RemotePrerenderFunction<StandardSchemaV1.InferInput<Schema>, Output>}
533
+ * @since 2.27
534
+ */
535
+ /**
536
+ * @template Input
537
+ * @template Output
538
+ * @param {any} validate_or_fn
539
+ * @param {any} [fn_or_options]
540
+ * @param {{ inputs?: RemotePrerenderInputsGenerator<Input>, dynamic?: boolean }} [maybe_options]
541
+ * @returns {RemotePrerenderFunction<Input, Output>}
542
+ * @since 2.27
543
+ */
544
+ /*@__NO_SIDE_EFFECTS__*/
545
+ function prerender(validate_or_fn, fn_or_options, maybe_options) {
546
+ const maybe_fn = typeof fn_or_options === "function" ? fn_or_options : void 0;
547
+ /** @type {typeof maybe_options} */
548
+ const options = maybe_options ?? (maybe_fn ? void 0 : fn_or_options);
549
+ /** @type {(arg?: Input) => MaybePromise<Output>} */
550
+ const fn = maybe_fn ?? validate_or_fn;
551
+ /** @type {(arg?: any) => MaybePromise<Input>} */
552
+ const validate = create_validator(validate_or_fn, maybe_fn);
553
+ /** @type {RemotePrerenderInternals} */
554
+ const __ = {
555
+ type: "prerender",
556
+ id: "",
557
+ name: "",
558
+ has_arg: !!maybe_fn,
559
+ inputs: options?.inputs,
560
+ dynamic: options?.dynamic
561
+ };
562
+ /** @type {RemotePrerenderFunction<Input, Output> & { __: RemotePrerenderInternals }} */
563
+ const wrapper = (arg) => {
564
+ const { event, state } = get_request_store();
565
+ const payload = stringify_remote_arg(arg);
566
+ /** @type {Promise<Output> & Partial<RemoteResource<Output>>} */
567
+ const promise = get_response(__, payload, state, async () => {
568
+ const id = __.id;
569
+ const url = `/${app_dir}/remote/${id}${payload ? `/${payload}` : ""}`;
570
+ if (!state.prerendering && !event.isRemoteRequest) {
571
+ /** @type {RemoteFunctionResponse | undefined} */
572
+ let prerendered;
573
+ try {
574
+ const response = await fetch(new URL(url, event.request.url).href, { redirect: "manual" });
575
+ if (response.ok) prerendered = await response.json();
576
+ } catch {}
577
+ if (prerendered) {
578
+ if (prerendered.type === "error") throw new HandledHttpError(prerendered.error);
579
+ return parse(prerendered.data)._;
580
+ }
581
+ }
582
+ if (state.prerendering?.remote_responses.has(url)) return state.prerendering.remote_responses.get(url);
583
+ const promise = run_remote_function(event, {
584
+ ...state,
585
+ is_in_remote_prerender: true
586
+ }, false, () => validate(arg), fn);
587
+ if (state.prerendering) state.prerendering.remote_responses.set(url, promise);
588
+ const result = await promise;
589
+ if (state.prerendering) {
590
+ const body = {
591
+ type: "result",
592
+ data: stringify({ _: result })
593
+ };
594
+ state.prerendering.dependencies.set(url, {
595
+ body: JSON.stringify(body),
596
+ response: Response.json(body)
597
+ });
598
+ }
599
+ return result;
600
+ });
601
+ promise.catch(noop);
602
+ return promise;
603
+ };
604
+ Object.defineProperty(wrapper, "__", { value: __ });
605
+ return wrapper;
606
+ }
607
+ //#endregion
608
+ //#region ../../node_modules/.pnpm/@sveltejs+kit@3.0.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@5.57.2_vite@8.3.3_jiti@2._2180d2dbf687eed18f260b26dab65894/node_modules/@sveltejs/kit/src/utils/shared-iterator.js
609
+ /**
610
+ * A pull-style async iterator that fans out a single stream of values to
611
+ * multiple `for await (...)` consumers. Each subscriber gets its own
612
+ * `AsyncGenerator` whose `.next()` resolves whenever a value is pushed via
613
+ * `push(value)`. Multiple consumers see the same values without each one
614
+ * driving an independent underlying source.
615
+ *
616
+ * Backpressure is **latest-wins**: if values arrive faster than a particular
617
+ * consumer drains its iterator, only the most-recently-pushed value is kept
618
+ * pending for that subscriber. Earlier undrained values are dropped. This is
619
+ * appropriate for live data streams (reactive state replication), not for
620
+ * event logs where every value must be delivered.
621
+ *
622
+ * Lifecycle hooks are exposed via the constructor:
623
+ *
624
+ * - `start()` is called when the subscriber count transitions
625
+ * from 0 to 1 (e.g. to start a pump pulling from a real source).
626
+ * - `stop()` is called when the subscriber count transitions
627
+ * from non-zero back to 0 (e.g. to tear down that pump).
628
+ *
629
+ * Either hook may be omitted.
630
+ *
631
+ * The owner is responsible for calling `push(value)` to broadcast values,
632
+ * `done()` to signal natural completion to all subscribers, and `fail(error)`
633
+ * to broadcast a terminal error. After `done()` or `fail()`, the iterator
634
+ * rejects further `subscribe()` calls with the terminal state appropriately.
635
+ *
636
+ * @template T
637
+ */
638
+ var SharedIterator = class {
639
+ /**
640
+ * @typedef {object} Subscriber
641
+ * @property {{ value: any } | null} pending
642
+ * @property {{ error: unknown } | null} pending_error
643
+ * @property {boolean} finished
644
+ * @property {((result: IteratorResult<any, void>) => void) | null} waiting_resolve
645
+ * @property {((reason: unknown) => void) | null} waiting_reject
646
+ */
647
+ /** @type {Set<Subscriber>} */
648
+ #subscribers = /* @__PURE__ */ new Set();
649
+ /** @type {((instance: SharedIterator<T>) => (() => void)) | undefined} */
650
+ #start = void 0;
651
+ /** @type {(() => void) | undefined} */
652
+ #stop = void 0;
653
+ /** Once `done()` or `fail()` has been broadcast, no new values are accepted. */
654
+ #closed = false;
655
+ /** @type {unknown} */
656
+ #terminal_error = void 0;
657
+ /** Whether `done()` or `fail()` has been broadcast. */
658
+ get closed() {
659
+ return this.#closed;
660
+ }
661
+ /**
662
+ * @param {(instance: SharedIterator<T>) => (() => void)} [start]
663
+ */
664
+ constructor(start) {
665
+ this.#start = start;
666
+ }
667
+ /** @param {T} value */
668
+ push(value) {
669
+ if (this.#closed) return;
670
+ for (const subscriber of this.#subscribers) if (subscriber.waiting_resolve) {
671
+ const resolve = subscriber.waiting_resolve;
672
+ subscriber.waiting_resolve = null;
673
+ subscriber.waiting_reject = null;
674
+ resolve({
675
+ value,
676
+ done: false
677
+ });
678
+ } else subscriber.pending = { value };
679
+ }
680
+ /**
681
+ * Signal natural completion to all current subscribers, and to any future
682
+ * subscriber (which will receive an immediately-done iterator).
683
+ */
684
+ done() {
685
+ if (this.#closed) return;
686
+ this.#closed = true;
687
+ for (const subscriber of this.#subscribers) {
688
+ subscriber.finished = true;
689
+ if (subscriber.waiting_resolve) {
690
+ const resolve = subscriber.waiting_resolve;
691
+ subscriber.waiting_resolve = null;
692
+ subscriber.waiting_reject = null;
693
+ resolve({
694
+ value: void 0,
695
+ done: true
696
+ });
697
+ }
698
+ }
699
+ this.#subscribers.clear();
700
+ }
701
+ /**
702
+ * Broadcast a terminal error. All current subscribers will reject their
703
+ * next `.next()` call with `error`. Future subscribers will also reject
704
+ * their first `.next()`.
705
+ *
706
+ * @param {unknown} error
707
+ */
708
+ fail(error) {
709
+ if (this.#closed) return;
710
+ this.#closed = true;
711
+ this.#terminal_error = error;
712
+ for (const subscriber of this.#subscribers) {
713
+ subscriber.finished = true;
714
+ if (subscriber.waiting_reject) {
715
+ const reject = subscriber.waiting_reject;
716
+ subscriber.waiting_resolve = null;
717
+ subscriber.waiting_reject = null;
718
+ reject(error);
719
+ } else subscriber.pending_error = { error };
720
+ }
721
+ this.#subscribers.clear();
722
+ }
723
+ /**
724
+ * Subscribe to the shared stream. Returns an `AsyncGenerator<T>` that
725
+ * yields every value pushed after this call (and, if `initial_value` is
726
+ * provided, that value as the first yield).
727
+ *
728
+ * @param {{ initial_value?: { value: T } }} [options]
729
+ * `initial_value` lets the caller seed the iterator with a synchronously-
730
+ * available current value before any new pushes arrive (e.g. the
731
+ * "last-seen value" of a reactive resource). Pass it wrapped in an
732
+ * object so `undefined` can be distinguished from "no initial value".
733
+ * @returns {AsyncGenerator<T, void, void>}
734
+ */
735
+ subscribe(options) {
736
+ /** @type {Subscriber} */
737
+ const subscriber = {
738
+ pending: options?.initial_value ? { value: options.initial_value.value } : null,
739
+ pending_error: this.#closed && this.#terminal_error !== void 0 ? { error: this.#terminal_error } : null,
740
+ finished: this.#closed && this.#terminal_error === void 0,
741
+ waiting_resolve: null,
742
+ waiting_reject: null
743
+ };
744
+ if (!subscriber.finished && subscriber.pending_error === null) this.#subscribers.add(subscriber);
745
+ if (!this.#closed) this.#stop ??= this.#start?.(this);
746
+ const unsubscribe = () => {
747
+ subscriber.finished = true;
748
+ if (this.#subscribers.delete(subscriber) && this.#subscribers.size === 0) this.#stop?.();
749
+ };
750
+ /** @type {AsyncGenerator<T, void, void>} */
751
+ const iterator = {
752
+ next() {
753
+ if (subscriber.pending_error) {
754
+ const { error } = subscriber.pending_error;
755
+ subscriber.pending_error = null;
756
+ unsubscribe();
757
+ return Promise.reject(error);
758
+ }
759
+ if (subscriber.pending) {
760
+ const { value } = subscriber.pending;
761
+ subscriber.pending = null;
762
+ return Promise.resolve({
763
+ value,
764
+ done: false
765
+ });
766
+ }
767
+ if (subscriber.finished) return Promise.resolve({
768
+ value: void 0,
769
+ done: true
770
+ });
771
+ return new Promise((resolve, reject) => {
772
+ subscriber.waiting_resolve = resolve;
773
+ subscriber.waiting_reject = reject;
774
+ });
775
+ },
776
+ return(value) {
777
+ unsubscribe();
778
+ if (subscriber.waiting_resolve) {
779
+ const resolve = subscriber.waiting_resolve;
780
+ subscriber.waiting_resolve = null;
781
+ subscriber.waiting_reject = null;
782
+ resolve({
783
+ value: void 0,
784
+ done: true
785
+ });
786
+ }
787
+ return Promise.resolve({
788
+ value,
789
+ done: true
790
+ });
791
+ },
792
+ throw(error) {
793
+ unsubscribe();
794
+ if (subscriber.waiting_reject) {
795
+ const reject = subscriber.waiting_reject;
796
+ subscriber.waiting_resolve = null;
797
+ subscriber.waiting_reject = null;
798
+ reject(error);
799
+ }
800
+ return Promise.reject(error);
801
+ },
802
+ [Symbol.asyncIterator]() {
803
+ return iterator;
804
+ },
805
+ async [Symbol.asyncDispose]() {}
806
+ };
807
+ return iterator;
808
+ }
809
+ };
810
+ //#endregion
811
+ //#region ../../node_modules/.pnpm/@sveltejs+kit@3.0.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@5.57.2_vite@8.3.3_jiti@2._2180d2dbf687eed18f260b26dab65894/node_modules/@sveltejs/kit/src/runtime/app/server/remote/query.js
812
+ /** @import { RemoteLiveQuery, RemoteLiveQueryFunction, RemoteQuery, RemoteQueryFunction } from '$app/server' */
813
+ /** @import { RequestEvent } from '@sveltejs/kit' */
814
+ /** @import { RemoteInternals, MaybePromise, RequestState, RemoteQueryLiveInternals, RemoteQueryBatchInternals, RemoteQueryInternals, RemoteLiveQueryUserFunctionReturnType } from 'types' */
815
+ /** @import { StandardSchemaV1 } from '@standard-schema/spec' */
816
+ /**
817
+ * Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call.
818
+ *
819
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation.
820
+ *
821
+ * @template Output
822
+ * @overload
823
+ * @param {() => MaybePromise<Output>} fn
824
+ * @returns {RemoteQueryFunction<void, Output>}
825
+ * @since 2.27
826
+ */
827
+ /**
828
+ * Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call.
829
+ *
830
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation.
831
+ *
832
+ * @template Input
833
+ * @template Output
834
+ * @overload
835
+ * @param {'unchecked'} validate
836
+ * @param {(arg: Input) => MaybePromise<Output>} fn
837
+ * @returns {RemoteQueryFunction<Input, Output>}
838
+ * @since 2.27
839
+ */
840
+ /**
841
+ * Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call.
842
+ *
843
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation.
844
+ *
845
+ * @template {StandardSchemaV1} Schema
846
+ * @template Output
847
+ * @overload
848
+ * @param {Schema} schema
849
+ * @param {(arg: StandardSchemaV1.InferOutput<Schema>) => MaybePromise<Output>} fn
850
+ * @returns {RemoteQueryFunction<StandardSchemaV1.InferInput<Schema>, Output, StandardSchemaV1.InferOutput<Schema>>}
851
+ * @since 2.27
852
+ */
853
+ /**
854
+ * @template Input
855
+ * @template Output
856
+ * @param {any} validate_or_fn
857
+ * @param {(args?: Input) => MaybePromise<Output>} [maybe_fn]
858
+ * @returns {RemoteQueryFunction<Input, Output>}
859
+ * @since 2.27
860
+ */
861
+ /*@__NO_SIDE_EFFECTS__*/
862
+ function query(validate_or_fn, maybe_fn) {
863
+ /** @type {(arg?: Input) => Output} */
864
+ const fn = maybe_fn ?? validate_or_fn;
865
+ /** @type {(arg?: any) => MaybePromise<Input>} */
866
+ const validate = create_validator(validate_or_fn, maybe_fn);
867
+ /** @type {RemoteQueryInternals} */
868
+ const __ = {
869
+ type: "query",
870
+ id: "",
871
+ name: "",
872
+ validate,
873
+ bind(payload, validated_arg) {
874
+ const { event, state } = get_request_store();
875
+ return create_query_resource(__, payload, event, state, () => run_remote_function(event, {
876
+ ...state,
877
+ is_in_remote_query: true
878
+ }, false, () => validated_arg, fn));
879
+ }
880
+ };
881
+ /** @type {RemoteQueryFunction<Input, Output> & { __: RemoteQueryInternals }} */
882
+ const wrapper = (arg) => {
883
+ if (prerendering) remote_query_prerender({
884
+ type: "query",
885
+ name: __.name
886
+ });
887
+ const { event, state } = get_request_store();
888
+ const payload = stringify_remote_arg(arg);
889
+ return create_query_resource(__, payload, event, state, () => run_remote_function(event, {
890
+ ...state,
891
+ is_in_remote_query: true
892
+ }, false, () => validate(arg), fn));
893
+ };
894
+ Object.defineProperty(wrapper, "__", { value: __ });
895
+ return wrapper;
896
+ }
897
+ /**
898
+ * Creates a live remote query. When called from the browser, the function will be invoked on the server via a streaming `fetch` call.
899
+ *
900
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query.live) for full documentation.
901
+ *
902
+ * @template Output
903
+ * @overload
904
+ * @param {(arg: void) => RemoteLiveQueryUserFunctionReturnType<Output>} fn
905
+ * @returns {RemoteLiveQueryFunction<void, Output>}
906
+ */
907
+ /**
908
+ * @template Input
909
+ * @template Output
910
+ * @overload
911
+ * @param {'unchecked'} validate
912
+ * @param {(arg: Input) => RemoteLiveQueryUserFunctionReturnType<Output>} fn
913
+ * @returns {RemoteLiveQueryFunction<Input, Output>}
914
+ */
915
+ /**
916
+ * @template {StandardSchemaV1} Schema
917
+ * @template Output
918
+ * @overload
919
+ * @param {Schema} schema
920
+ * @param {(arg: StandardSchemaV1.InferOutput<Schema>) => RemoteLiveQueryUserFunctionReturnType<Output>} fn
921
+ * @returns {RemoteLiveQueryFunction<StandardSchemaV1.InferInput<Schema>, Output, StandardSchemaV1.InferOutput<Schema>>}
922
+ */
923
+ /**
924
+ * @template Input
925
+ * @template Output
926
+ * @param {any} validate_or_fn
927
+ * @param {(args: Input) => RemoteLiveQueryUserFunctionReturnType<Output>} [maybe_fn]
928
+ * @returns {RemoteLiveQueryFunction<Input, Output>}
929
+ */
930
+ /*@__NO_SIDE_EFFECTS__*/
931
+ function live(validate_or_fn, maybe_fn) {
932
+ /** @type {(arg: Input) => RemoteLiveQueryUserFunctionReturnType<Output>} */
933
+ const fn = maybe_fn ?? validate_or_fn;
934
+ /** @type {(arg?: any) => MaybePromise<Input>} */
935
+ const validate = create_validator(validate_or_fn, maybe_fn);
936
+ /**
937
+ * @param {any} event
938
+ * @param {any} state
939
+ * @param {any} get_input
940
+ */
941
+ const run = (event, state, get_input) => run_remote_generator(event, {
942
+ ...state,
943
+ is_in_remote_query: true
944
+ }, false, get_input, fn, __.name);
945
+ /** @type {RemoteQueryLiveInternals} */
946
+ const __ = {
947
+ type: "query_live",
948
+ id: "",
949
+ name: "",
950
+ run: (event, state, arg) => run(event, state, () => validate(arg)),
951
+ validate,
952
+ bind(payload, validated_arg) {
953
+ const { event, state } = get_request_store();
954
+ return create_live_query_resource(__, payload, event, state, () => run(event, state, () => validated_arg));
955
+ }
956
+ };
957
+ /** @type {RemoteLiveQueryFunction<Input, Output> & { __: RemoteQueryLiveInternals }} */
958
+ const wrapper = (arg) => {
959
+ if (prerendering) remote_query_prerender({
960
+ type: "query.live",
961
+ name: __.name
962
+ });
963
+ const { event, state } = get_request_store();
964
+ const payload = stringify_remote_arg(arg);
965
+ return create_live_query_resource(__, payload, event, state, () => run(event, state, () => validate(arg)));
966
+ };
967
+ Object.defineProperty(wrapper, "__", { value: __ });
968
+ return wrapper;
969
+ }
970
+ /**
971
+ * Creates a batch query function that collects multiple calls and executes them in a single request
972
+ *
973
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query.batch) for full documentation.
974
+ *
975
+ * @template Input
976
+ * @template Output
977
+ * @overload
978
+ * @param {'unchecked'} validate
979
+ * @param {(args: Input[]) => MaybePromise<(arg: Input, idx: number) => Output>} fn
980
+ * @returns {RemoteQueryFunction<Input, Output>}
981
+ * @since 2.35
982
+ */
983
+ /**
984
+ * Creates a batch query function that collects multiple calls and executes them in a single request
985
+ *
986
+ * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query.batch) for full documentation.
987
+ *
988
+ * @template {StandardSchemaV1} Schema
989
+ * @template Output
990
+ * @overload
991
+ * @param {Schema} schema
992
+ * @param {(args: StandardSchemaV1.InferOutput<Schema>[]) => MaybePromise<(arg: StandardSchemaV1.InferOutput<Schema>, idx: number) => Output>} fn
993
+ * @returns {RemoteQueryFunction<StandardSchemaV1.InferInput<Schema>, Output, StandardSchemaV1.InferOutput<Schema>>}
994
+ * @since 2.35
995
+ */
996
+ /**
997
+ * @template Input
998
+ * @template Output
999
+ * @param {any} validate_or_fn
1000
+ * @param {(args?: Input[]) => MaybePromise<(arg: Input, idx: number) => Output>} [maybe_fn]
1001
+ * @returns {RemoteQueryFunction<Input, Output>}
1002
+ * @since 2.35
1003
+ */
1004
+ /*@__NO_SIDE_EFFECTS__*/
1005
+ function batch(validate_or_fn, maybe_fn) {
1006
+ /** @type {(args?: Input[]) => MaybePromise<(arg: Input, idx: number) => Output>} */
1007
+ const fn = maybe_fn ?? validate_or_fn;
1008
+ /** @type {(arg?: any) => MaybePromise<Input>} */
1009
+ const validate = create_validator(validate_or_fn, maybe_fn);
1010
+ /**
1011
+ * Enqueues a single call into the current batch (creating one if necessary)
1012
+ * and returns a promise that resolves with the result for this entry.
1013
+ *
1014
+ * @param {string} payload — the stringified raw argument (cache key)
1015
+ * @param {() => MaybePromise<any>} get_validated — produces the validated argument for this entry
1016
+ * @returns {Promise<any>}
1017
+ */
1018
+ const enqueue = (payload, get_validated) => {
1019
+ const { event, state } = get_request_store();
1020
+ return new Promise((resolve, reject) => {
1021
+ const batches = state.remote.batches ??= /* @__PURE__ */ new Map();
1022
+ let batched = batches.get(__.id);
1023
+ if (!batched) {
1024
+ batched = /* @__PURE__ */ new Map();
1025
+ batches.set(__.id, batched);
1026
+ }
1027
+ const entry = batched.get(payload);
1028
+ if (entry) {
1029
+ entry.resolvers.push({
1030
+ resolve,
1031
+ reject
1032
+ });
1033
+ return;
1034
+ }
1035
+ batched.set(payload, {
1036
+ get_validated,
1037
+ resolvers: [{
1038
+ resolve,
1039
+ reject
1040
+ }]
1041
+ });
1042
+ if (batched.size > 1) return;
1043
+ setTimeout(async () => {
1044
+ batches.delete(__.id);
1045
+ const entries = Array.from(batched.values());
1046
+ try {
1047
+ return await run_remote_function(event, {
1048
+ ...state,
1049
+ is_in_remote_query: true
1050
+ }, false, async () => Promise.all(entries.map((entry) => entry.get_validated())), async (input) => {
1051
+ const get_result = await fn(input);
1052
+ for (let i = 0; i < entries.length; i++) try {
1053
+ const result = get_result(input[i], i);
1054
+ for (const resolver of entries[i].resolvers) resolver.resolve(result);
1055
+ } catch (error) {
1056
+ for (const resolver of entries[i].resolvers) resolver.reject(error);
1057
+ }
1058
+ });
1059
+ } catch (error) {
1060
+ for (const entry of batched.values()) for (const resolver of entry.resolvers) resolver.reject(error);
1061
+ }
1062
+ }, 0);
1063
+ });
1064
+ };
1065
+ /** @type {RemoteQueryBatchInternals} */
1066
+ const __ = {
1067
+ type: "query_batch",
1068
+ id: "",
1069
+ name: "",
1070
+ validate,
1071
+ run: async (args) => {
1072
+ const { event, state } = get_request_store();
1073
+ return run_remote_function(event, {
1074
+ ...state,
1075
+ is_in_remote_query: true
1076
+ }, false, async () => Promise.all(args.map(validate)), async (input) => {
1077
+ const get_result = await fn(input);
1078
+ return Promise.all(input.map(async (arg, i) => {
1079
+ try {
1080
+ return {
1081
+ type: "result",
1082
+ data: get_result(arg, i)
1083
+ };
1084
+ } catch (error) {
1085
+ return {
1086
+ type: "error",
1087
+ error: await handle_error_and_jsonify(event, state, error)
1088
+ };
1089
+ }
1090
+ }));
1091
+ });
1092
+ },
1093
+ bind(payload, validated_arg) {
1094
+ const { event, state } = get_request_store();
1095
+ return create_query_resource(__, payload, event, state, () => enqueue(payload, () => validated_arg));
1096
+ }
1097
+ };
1098
+ /** @type {RemoteQueryFunction<Input, Output> & { __: RemoteQueryBatchInternals }} */
1099
+ const wrapper = (arg) => {
1100
+ if (prerendering) remote_query_prerender({
1101
+ type: "query.batch",
1102
+ name: __.name
1103
+ });
1104
+ const { event, state } = get_request_store();
1105
+ const payload = stringify_remote_arg(arg);
1106
+ return create_query_resource(__, payload, event, state, () => enqueue(payload, () => validate(arg)));
1107
+ };
1108
+ Object.defineProperty(wrapper, "__", { value: __ });
1109
+ return wrapper;
1110
+ }
1111
+ /**
1112
+ * Include this value in the returned payload...
1113
+ * @param {RequestEvent} event
1114
+ * @param {RequestState} state
1115
+ * @param {RemoteInternals} internals
1116
+ * @param {string} payload
1117
+ * @param {() => Promise<any>} fn
1118
+ */
1119
+ function refresh(event, state, internals, payload, fn) {
1120
+ if (!internals.id) return;
1121
+ if (!event.isRemoteRequest && state.is_in_remote_form_or_command) return;
1122
+ const key = create_remote_key(internals.id, payload);
1123
+ (state.remote.explicit ??= /* @__PURE__ */ new Map()).set(key, {
1124
+ internals,
1125
+ fn
1126
+ });
1127
+ }
1128
+ /**
1129
+ * @param {RemoteInternals} __
1130
+ * @param {string} payload — the stringified raw argument (i.e. the cache key the client will use)
1131
+ * @param {RequestEvent} event
1132
+ * @param {RequestState} state
1133
+ * @param {() => Promise<any>} fn
1134
+ * @returns {RemoteQuery<any>}
1135
+ */
1136
+ function create_query_resource(__, payload, event, state, fn) {
1137
+ /** @type {Promise<any> | null} */
1138
+ let promise = null;
1139
+ const get_promise = () => {
1140
+ return promise ??= get_response(__, payload, state, fn);
1141
+ };
1142
+ const populate_hydratable = () => {
1143
+ if (__.id && state.is_in_render) get_promise().catch(noop);
1144
+ };
1145
+ return {
1146
+ /** @type {Promise<any>['catch']} */
1147
+ catch(onrejected) {
1148
+ return get_promise().catch(onrejected);
1149
+ },
1150
+ get current() {
1151
+ populate_hydratable();
1152
+ },
1153
+ get error() {
1154
+ populate_hydratable();
1155
+ },
1156
+ /** @type {Promise<any>['finally']} */
1157
+ finally(onfinally) {
1158
+ return get_promise().finally(onfinally);
1159
+ },
1160
+ get loading() {
1161
+ populate_hydratable();
1162
+ return true;
1163
+ },
1164
+ get ready() {
1165
+ populate_hydratable();
1166
+ return false;
1167
+ },
1168
+ refresh() {
1169
+ promise = null;
1170
+ delete get_cache(__, state)[payload];
1171
+ refresh(event, state, __, payload, get_promise);
1172
+ return Promise.resolve();
1173
+ },
1174
+ /** @param {any} value */
1175
+ set(value) {
1176
+ const p = promise = Promise.resolve(value);
1177
+ get_cache(__, state)[payload] = p;
1178
+ refresh(event, state, __, payload, () => p);
1179
+ },
1180
+ /** @type {Promise<any>['then']} */
1181
+ then(onfulfilled, onrejected) {
1182
+ return get_promise().then(onfulfilled, onrejected);
1183
+ },
1184
+ withOverride() {
1185
+ server_api_unavailable({ name: `${__.name}.withOverride()` });
1186
+ },
1187
+ get [Symbol.toStringTag]() {
1188
+ return "QueryResource";
1189
+ }
1190
+ };
1191
+ }
1192
+ /**
1193
+ * @param {RemoteQueryLiveInternals} __
1194
+ * @param {string} payload — the stringified raw argument (i.e. the cache key the client will use)
1195
+ * @param {RequestEvent} event
1196
+ * @param {RequestState} state
1197
+ * @param {() => AsyncGenerator<any, void, void>} get_generator
1198
+ * @returns {RemoteLiveQuery<any>}
1199
+ */
1200
+ function create_live_query_resource(__, payload, event, state, get_generator) {
1201
+ /** @type {Promise<any> | null} */
1202
+ let promise = null;
1203
+ const get_first_value = async () => {
1204
+ for await (const value of get_generator()) return value;
1205
+ remote_query_live_no_value({ name: __.name });
1206
+ };
1207
+ const get_promise = () => {
1208
+ return promise ??= get_response(__, payload, state, get_first_value);
1209
+ };
1210
+ const populate_hydratable = () => {
1211
+ if (__.id && state.is_in_render) get_promise().catch(noop);
1212
+ };
1213
+ return {
1214
+ /** @type {Promise<any>['catch']} */
1215
+ catch(onrejected) {
1216
+ return get_promise().catch(onrejected);
1217
+ },
1218
+ get current() {
1219
+ populate_hydratable();
1220
+ },
1221
+ get error() {
1222
+ populate_hydratable();
1223
+ },
1224
+ /** @type {Promise<any>['finally']} */
1225
+ finally(onfinally) {
1226
+ return get_promise().finally(onfinally);
1227
+ },
1228
+ get done() {
1229
+ populate_hydratable();
1230
+ return false;
1231
+ },
1232
+ get loading() {
1233
+ populate_hydratable();
1234
+ return true;
1235
+ },
1236
+ get ready() {
1237
+ populate_hydratable();
1238
+ return false;
1239
+ },
1240
+ get connected() {
1241
+ populate_hydratable();
1242
+ return false;
1243
+ },
1244
+ reconnect() {
1245
+ promise = null;
1246
+ delete get_cache(__, state)[payload];
1247
+ refresh(event, state, __, payload, get_promise);
1248
+ return Promise.resolve();
1249
+ },
1250
+ /** @type {Promise<any>['then']} */
1251
+ then(onfulfilled, onrejected) {
1252
+ return get_promise().then(onfulfilled, onrejected);
1253
+ },
1254
+ [Symbol.asyncIterator]() {
1255
+ const key = create_remote_key(__.id, payload);
1256
+ const cache = state.remote.live_iterators ??= /* @__PURE__ */ new Map();
1257
+ let cached = cache.get(key);
1258
+ if (!cached) {
1259
+ cached = create_shared_live_iterator(event.request.signal, get_generator);
1260
+ cache.set(key, cached);
1261
+ }
1262
+ return cached.subscribe();
1263
+ },
1264
+ get [Symbol.toStringTag]() {
1265
+ return "LiveQueryResource";
1266
+ }
1267
+ };
1268
+ }
1269
+ /**
1270
+ * Wraps a lazily-created live-query generator so that multiple `for await`
1271
+ * consumers within the same request share one underlying iteration. The first
1272
+ * subscriber starts the generator; values are broadcast to all subscribers
1273
+ * via a `SharedIterator`. When the last subscriber unsubscribes, the generator
1274
+ * is closed via `generator.return(undefined)`.
1275
+ *
1276
+ * If `signal` aborts (typically because the client has disconnected), the
1277
+ * pump is torn down and any in-flight `next()` calls on consumer iterators
1278
+ * resolve with `{ done: true }`, so suspended `for await` loops unwind
1279
+ * cleanly rather than leaking.
1280
+ *
1281
+ * @param {AbortSignal} signal
1282
+ * @param {() => AsyncGenerator<any, void, void>} get_generator
1283
+ */
1284
+ function create_shared_live_iterator(signal, get_generator) {
1285
+ return new SharedIterator((instance) => {
1286
+ if (signal.aborted) {
1287
+ instance.done();
1288
+ return noop;
1289
+ }
1290
+ const generator = get_generator();
1291
+ let aborted = false;
1292
+ const close = () => {
1293
+ aborted = true;
1294
+ generator.return().catch(noop);
1295
+ };
1296
+ signal.addEventListener("abort", () => (close(), instance.done()), { once: true });
1297
+ (async () => {
1298
+ try {
1299
+ while (true) {
1300
+ const result = await generator.next();
1301
+ if (result.done) {
1302
+ instance.done();
1303
+ return;
1304
+ }
1305
+ instance.push(result.value);
1306
+ }
1307
+ } catch (error) {
1308
+ if (!aborted) instance.fail(error);
1309
+ } finally {
1310
+ close();
1311
+ }
1312
+ })();
1313
+ return close;
1314
+ });
1315
+ }
1316
+ Object.defineProperty(query, "batch", {
1317
+ value: batch,
1318
+ enumerable: true
1319
+ });
1320
+ Object.defineProperty(query, "live", {
1321
+ value: live,
1322
+ enumerable: true
1323
+ });
1324
+ //#endregion
1325
+ //#region ../../node_modules/.pnpm/@sveltejs+kit@3.0.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@5.57.2_vite@8.3.3_jiti@2._2180d2dbf687eed18f260b26dab65894/node_modules/@sveltejs/kit/src/runtime/app/server/remote/requested.js
1326
+ /** @import { RemoteLiveQuery, RemoteLiveQueryFunction, RemoteQuery, RemoteQueryFunction, RequestedResult, RemoteQueryRequestedResult, RemoteLiveQueryRequestedResult } from '$app/server' */
1327
+ /** @import { MaybePromise, RemoteAnyQueryInternals } from 'types' */
1328
+ /**
1329
+ * Inside a remote `command` or `form` callback, returns an iterable
1330
+ * of `{ arg, query }` entries for the query instances the client asked to refresh, up to
1331
+ * the supplied `limit`. Each `query` is a `RemoteQuery` bound to the original
1332
+ * client-side cache key, so `refresh()` / `set()` propagate correctly even when
1333
+ * the query's schema transforms the input. `arg` is the *validated* argument,
1334
+ * i.e. the value after the schema has run (so `InferOutput<Schema>` for queries
1335
+ * declared with a Standard Schema).
1336
+ *
1337
+ * Arguments that fail validation or exceed `limit` are recorded as failures in
1338
+ * the response to the client.
1339
+ * See [Client-requested refreshes](https://svelte.dev/docs/kit/remote-functions#Single-flight-mutations-Client-requested-refreshes)
1340
+ * for usage in a remote `command` or `form`.
1341
+ *
1342
+ * @example
1343
+ * ```ts
1344
+ * import { requested } from '$app/server';
1345
+ *
1346
+ * for (const { arg, query } of requested(getPost, 5)) {
1347
+ * // `arg` is the validated argument; `query` is bound to the client's
1348
+ * // cache key. It's safe to throw away this promise -- SvelteKit will
1349
+ * // await it and forward any errors to the client.
1350
+ * void query.refresh();
1351
+ * }
1352
+ * ```
1353
+ *
1354
+ * As a shorthand for the above, you can also call `refreshAll` on the result:
1355
+ *
1356
+ * @example
1357
+ * ```ts
1358
+ * import { requested } from '$app/server';
1359
+ *
1360
+ * await requested(getPost, 5).refreshAll();
1361
+ * ```
1362
+ *
1363
+ * Works with `query.batch` as well — refreshes for individual entries are
1364
+ * collected into a single batched call.
1365
+ *
1366
+ * For live queries, the same applies, but with `reconnect` and `reconnectAll`.
1367
+ *
1368
+ * @template Input
1369
+ * @template Output
1370
+ * @template [Validated=Input]
1371
+ * @overload
1372
+ * @param {RemoteQueryFunction<Input, Output, Validated>} query
1373
+ * @param {number} limit
1374
+ * @returns {RemoteQueryRequestedResult<Validated, Output>}
1375
+ */
1376
+ /**
1377
+ * Inside a remote `command` or `form` callback, returns an iterable
1378
+ * of `{ arg, query }` entries for the live query instances the client asked to reconnect, up to
1379
+ * the supplied `limit`. Each `query` is a `RemoteLiveQuery` bound to the original
1380
+ * client-side cache key, so `reconnect()` propagates correctly even when
1381
+ * the query's schema transforms the input. `arg` is the *validated* argument.
1382
+ *
1383
+ * Arguments that fail validation or exceed `limit` are recorded as failures in
1384
+ * the response to the client.
1385
+ * See [Client-requested refreshes](https://svelte.dev/docs/kit/remote-functions#Single-flight-mutations-Client-requested-refreshes)
1386
+ * for usage in a remote `command` or `form`.
1387
+ *
1388
+ * @example
1389
+ * ```ts
1390
+ * import { requested } from '$app/server';
1391
+ *
1392
+ * for (const { query } of requested(getPost, 5)) {
1393
+ * void query.reconnect();
1394
+ * }
1395
+ * ```
1396
+ *
1397
+ * As a shorthand, you can also call `reconnectAll` on the result:
1398
+ *
1399
+ * @example
1400
+ * ```ts
1401
+ * import { requested } from '$app/server';
1402
+ *
1403
+ * await requested(getPost, 5).reconnectAll();
1404
+ * ```
1405
+ *
1406
+ * @template Input
1407
+ * @template Output
1408
+ * @template [Validated=Input]
1409
+ * @overload
1410
+ * @param {RemoteLiveQueryFunction<Input, Output, Validated>} query
1411
+ * @param {number} limit
1412
+ * @returns {RemoteLiveQueryRequestedResult<Validated, Output>}
1413
+ */
1414
+ /**
1415
+ * @template Input
1416
+ * @template Output
1417
+ * @template [Validated=Input]
1418
+ * @param {RemoteQueryFunction<Input, Output, Validated> | RemoteLiveQueryFunction<Input, Output, Validated>} query
1419
+ * @param {number} limit
1420
+ * @returns {RequestedResult<Validated, Output>}
1421
+ */
1422
+ function requested(query, limit) {
1423
+ const { event, state } = get_request_store();
1424
+ const internals = query.__;
1425
+ if (internals?.type !== "query" && internals?.type !== "query_batch" && internals?.type !== "query_live") remote_requested_invalid_query();
1426
+ const __ = internals;
1427
+ const requested = state.remote.requested;
1428
+ const payloads = requested?.get(__.id) ?? /* @__PURE__ */ new Set();
1429
+ const ignored = state.remote.ignored ??= /* @__PURE__ */ new Set();
1430
+ /** @param {string} payload */
1431
+ const consume = (payload) => {
1432
+ payloads.delete(payload);
1433
+ if (payloads.size === 0) requested?.delete(__.id);
1434
+ };
1435
+ /** @param {string} payload */
1436
+ const create_ignore = (payload) => () => {
1437
+ ignored.add(create_remote_key(__.id, payload));
1438
+ };
1439
+ if (!state.is_in_remote_form_or_command) remote_requested_context();
1440
+ const [selected, skipped] = split_limit([...payloads], limit);
1441
+ /**
1442
+ * Registers the failure exactly like `.set()` registers a value: the error record
1443
+ * is serialized to the client (putting the query there into a failed state), and
1444
+ * subsequent server-side calls of the query with the same argument reject with it.
1445
+ * @param {string} payload
1446
+ * @param {unknown} error
1447
+ */
1448
+ const record_failure = (payload, error) => {
1449
+ const promise = Promise.reject(error);
1450
+ promise.catch(noop);
1451
+ get_cache(__, state)[payload] = promise;
1452
+ refresh(event, state, __, payload, () => promise);
1453
+ };
1454
+ for (const payload of skipped) consume(payload);
1455
+ const result = {
1456
+ *[Symbol.iterator]() {
1457
+ for (const payload of selected) {
1458
+ consume(payload);
1459
+ try {
1460
+ const parsed = parse_remote_arg(payload);
1461
+ const validated = __.validate(parsed);
1462
+ if (is_thenable(validated)) remote_requested_async_validator({
1463
+ name: __.name,
1464
+ limit: String(limit)
1465
+ });
1466
+ yield {
1467
+ arg: validated,
1468
+ query: __.bind(payload, validated),
1469
+ ignore: create_ignore(payload)
1470
+ };
1471
+ } catch (error) {
1472
+ record_failure(payload, error);
1473
+ continue;
1474
+ }
1475
+ }
1476
+ },
1477
+ async *[Symbol.asyncIterator]() {
1478
+ yield* race_all(selected, async (payload) => {
1479
+ consume(payload);
1480
+ try {
1481
+ const parsed = parse_remote_arg(payload);
1482
+ const validated = await __.validate(parsed);
1483
+ return {
1484
+ arg: validated,
1485
+ query: __.bind(payload, validated),
1486
+ ignore: create_ignore(payload)
1487
+ };
1488
+ } catch (error) {
1489
+ record_failure(payload, error);
1490
+ throw new Error(`Skipping ${__.name}(${payload})`, { cause: error });
1491
+ }
1492
+ });
1493
+ },
1494
+ async refreshAll() {
1495
+ if (__.type === "query_live") remote_requested_wrong_method({
1496
+ method: "refreshAll",
1497
+ type: "live",
1498
+ replacement: "reconnectAll"
1499
+ });
1500
+ for await (const { query } of result) query.refresh();
1501
+ },
1502
+ async reconnectAll() {
1503
+ if (__.type !== "query_live") remote_requested_wrong_method({
1504
+ method: "reconnectAll",
1505
+ type: "regular",
1506
+ replacement: "refreshAll"
1507
+ });
1508
+ for await (const { query } of result) query.reconnect();
1509
+ },
1510
+ async ignoreAll() {
1511
+ for await (const { ignore } of result) ignore();
1512
+ }
1513
+ };
1514
+ return result;
1515
+ }
1516
+ /**
1517
+ * @template T
1518
+ * @param {Array<T>} array
1519
+ * @param {number} limit
1520
+ * @returns {[Array<T>, Array<T>]}
1521
+ */
1522
+ function split_limit(array, limit) {
1523
+ if (limit === Infinity) return [array, []];
1524
+ if (!Number.isInteger(limit) || limit < 0) remote_requested_invalid_limit();
1525
+ return [array.slice(0, limit), array.slice(limit)];
1526
+ }
1527
+ /**
1528
+ * @param {any} value
1529
+ * @returns {value is PromiseLike<any>}
1530
+ */
1531
+ function is_thenable(value) {
1532
+ return !!value && (typeof value === "object" || typeof value === "function") && "then" in value;
1533
+ }
1534
+ /**
1535
+ * Runs all callbacks immediately and yields resolved values in completion order.
1536
+ * If the promise rejects, it is skipped.
1537
+ *
1538
+ * @template T
1539
+ * @template R
1540
+ * @param {Array<T>} array
1541
+ * @param {(value: T) => MaybePromise<R>} fn
1542
+ * @returns {AsyncIterable<R>}
1543
+ */
1544
+ async function* race_all(array, fn) {
1545
+ /** @type {Set<Promise<{ promise: Promise<any>, value: Awaited<R> }>>} */
1546
+ const pending = /* @__PURE__ */ new Set();
1547
+ for (const value of array) {
1548
+ /** @type {Promise<{ promise: Promise<any>, value: Awaited<R> }>} */
1549
+ const promise = Promise.resolve(fn(value)).then((result) => ({
1550
+ promise,
1551
+ value: result
1552
+ }));
1553
+ promise.catch(() => pending.delete(promise));
1554
+ pending.add(promise);
1555
+ }
1556
+ while (pending.size > 0) try {
1557
+ const { promise, value } = await Promise.race(pending);
1558
+ pending.delete(promise);
1559
+ yield value;
1560
+ } catch {}
1561
+ }
1562
+ //#endregion
1563
+ export { command, form, prerender, query, requested };
1564
+
1565
+ //# sourceMappingURL=remote-entry.js.map