@ignix-social/editor 0.1.0

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 (586) hide show
  1. package/LICENSE +190 -0
  2. package/NOTICE +54 -0
  3. package/README.md +23 -0
  4. package/bin/ignix-editor.mjs +8 -0
  5. package/package.json +53 -0
  6. package/patches/index.mjs +53 -0
  7. package/scripts/build-ffmpeg-macos.sh +35 -0
  8. package/scripts/build-whisper-macos.sh +21 -0
  9. package/scripts/vendor.mjs +41 -0
  10. package/skills/ignix-editor/SKILL.md +132 -0
  11. package/src/audio.mjs +31 -0
  12. package/src/binaries.json +46 -0
  13. package/src/binaries.mjs +83 -0
  14. package/src/cli.mjs +254 -0
  15. package/src/prepare.mjs +74 -0
  16. package/src/runtime/ignix-frame.js +92 -0
  17. package/src/transcribe.mjs +71 -0
  18. package/src/validate.mjs +71 -0
  19. package/templates/blank/index.html +41 -0
  20. package/vendor/hyperframes/README.md +181 -0
  21. package/vendor/hyperframes/UPSTREAM.json +12 -0
  22. package/vendor/hyperframes/bin/hyperframes-localize-fonts.mjs +12 -0
  23. package/vendor/hyperframes/bin/hyperframes.mjs +11 -0
  24. package/vendor/hyperframes/dist/add-LR3ZR2A5.js +79 -0
  25. package/vendor/hyperframes/dist/agentPromptGenerator-VIIPZCJ3.js +143 -0
  26. package/vendor/hyperframes/dist/animatedGifPrep-P2T6YM7Z.js +34 -0
  27. package/vendor/hyperframes/dist/asset-BE2DOV72.js +26 -0
  28. package/vendor/hyperframes/dist/assetCataloger-VBLPHX24.js +340 -0
  29. package/vendor/hyperframes/dist/auth-RCQB2ZT7.js +60 -0
  30. package/vendor/hyperframes/dist/autoUpdate-RJAX3DAZ.js +268 -0
  31. package/vendor/hyperframes/dist/backgroundChecks-H2LCUIMJ.js +61 -0
  32. package/vendor/hyperframes/dist/backgroundChecksWorker.js +26 -0
  33. package/vendor/hyperframes/dist/batchRender-FT7AP7XH.js +355 -0
  34. package/vendor/hyperframes/dist/beat-analyzer.global.js +338 -0
  35. package/vendor/hyperframes/dist/beats-Y2EOP72P.js +309 -0
  36. package/vendor/hyperframes/dist/benchmark-MZ7GY3JW.js +231 -0
  37. package/vendor/hyperframes/dist/browser-HUTAMRQE.js +237 -0
  38. package/vendor/hyperframes/dist/bundleWithLocalizedFonts-5QOPOB5D.js +52 -0
  39. package/vendor/hyperframes/dist/capture-RLZA6EMR.js +4079 -0
  40. package/vendor/hyperframes/dist/capture-SZZ4IYJK.js +290 -0
  41. package/vendor/hyperframes/dist/captureFile-LYOJOUIE.js +15 -0
  42. package/vendor/hyperframes/dist/captureTimeout-PA4FYWT5.js +27 -0
  43. package/vendor/hyperframes/dist/catalog-KYU55EWR.js +1001 -0
  44. package/vendor/hyperframes/dist/check-TCG4PXLR.js +1697 -0
  45. package/vendor/hyperframes/dist/checkBrowser-RPMO4OW5.js +1032 -0
  46. package/vendor/hyperframes/dist/chunk-2EAXUCCE.js +88 -0
  47. package/vendor/hyperframes/dist/chunk-2EGFTPWD.js +1077 -0
  48. package/vendor/hyperframes/dist/chunk-2PSPARWP.js +6058 -0
  49. package/vendor/hyperframes/dist/chunk-2YN64IN5.js +5747 -0
  50. package/vendor/hyperframes/dist/chunk-3GXQPCJC.js +682 -0
  51. package/vendor/hyperframes/dist/chunk-3ZP5DXE7.js +15 -0
  52. package/vendor/hyperframes/dist/chunk-4NWOGZZS.js +1990 -0
  53. package/vendor/hyperframes/dist/chunk-4PFZPP2N.js +587 -0
  54. package/vendor/hyperframes/dist/chunk-4THIAPBL.js +128 -0
  55. package/vendor/hyperframes/dist/chunk-4YYJOFKS.js +28 -0
  56. package/vendor/hyperframes/dist/chunk-54HJ63Q2.js +29 -0
  57. package/vendor/hyperframes/dist/chunk-5ETJX6WM.js +89 -0
  58. package/vendor/hyperframes/dist/chunk-5IAKAQA7.js +389 -0
  59. package/vendor/hyperframes/dist/chunk-5Z63TBTX.js +37 -0
  60. package/vendor/hyperframes/dist/chunk-6BEFEWFB.js +25 -0
  61. package/vendor/hyperframes/dist/chunk-6CSYCFQV.js +68 -0
  62. package/vendor/hyperframes/dist/chunk-6CTIGJY7.js +154 -0
  63. package/vendor/hyperframes/dist/chunk-7HG4BFIN.js +93 -0
  64. package/vendor/hyperframes/dist/chunk-7JZ4FXP2.js +118 -0
  65. package/vendor/hyperframes/dist/chunk-A2Z4Z4VL.js +2961 -0
  66. package/vendor/hyperframes/dist/chunk-AMKC3AXA.js +25 -0
  67. package/vendor/hyperframes/dist/chunk-AVUUN2XD.js +4847 -0
  68. package/vendor/hyperframes/dist/chunk-AWDFDFI3.js +46 -0
  69. package/vendor/hyperframes/dist/chunk-AWNBM3MZ.js +94 -0
  70. package/vendor/hyperframes/dist/chunk-BXCMXMJQ.js +73 -0
  71. package/vendor/hyperframes/dist/chunk-BZ56MTDX.js +6 -0
  72. package/vendor/hyperframes/dist/chunk-CFKU7HTK.js +171 -0
  73. package/vendor/hyperframes/dist/chunk-CWPVM2QV.js +308 -0
  74. package/vendor/hyperframes/dist/chunk-DPVXBVLL.js +31292 -0
  75. package/vendor/hyperframes/dist/chunk-DQBY7FRR.js +397 -0
  76. package/vendor/hyperframes/dist/chunk-E6RPWJVC.js +213 -0
  77. package/vendor/hyperframes/dist/chunk-EISRN4E6.js +294 -0
  78. package/vendor/hyperframes/dist/chunk-EOVYQ3IG.js +143 -0
  79. package/vendor/hyperframes/dist/chunk-F3WZGU7C.js +479 -0
  80. package/vendor/hyperframes/dist/chunk-FCSIGXXP.js +366 -0
  81. package/vendor/hyperframes/dist/chunk-FI4I7CME.js +56 -0
  82. package/vendor/hyperframes/dist/chunk-FLWXXDNS.js +15 -0
  83. package/vendor/hyperframes/dist/chunk-GK4AIFIH.js +11171 -0
  84. package/vendor/hyperframes/dist/chunk-GMECXFAN.js +57 -0
  85. package/vendor/hyperframes/dist/chunk-GULOKZLI.js +155 -0
  86. package/vendor/hyperframes/dist/chunk-H4YZZ2VQ.js +68 -0
  87. package/vendor/hyperframes/dist/chunk-H6QMKUYA.js +477 -0
  88. package/vendor/hyperframes/dist/chunk-HBBJFK6I.js +273 -0
  89. package/vendor/hyperframes/dist/chunk-HRUGC23L.js +212 -0
  90. package/vendor/hyperframes/dist/chunk-HVW7ABXD.js +19 -0
  91. package/vendor/hyperframes/dist/chunk-HW6OYASV.js +344 -0
  92. package/vendor/hyperframes/dist/chunk-HWKCIWQT.js +3578 -0
  93. package/vendor/hyperframes/dist/chunk-I465DBM6.js +1214 -0
  94. package/vendor/hyperframes/dist/chunk-IGLEPPTN.js +24 -0
  95. package/vendor/hyperframes/dist/chunk-IGNAAHS3.js +433 -0
  96. package/vendor/hyperframes/dist/chunk-IHFUKJOR.js +85 -0
  97. package/vendor/hyperframes/dist/chunk-IQ3OUQ5Z.js +213 -0
  98. package/vendor/hyperframes/dist/chunk-ISN5GRYI.js +20 -0
  99. package/vendor/hyperframes/dist/chunk-IUZFXWSV.js +446 -0
  100. package/vendor/hyperframes/dist/chunk-JH556Q42.js +647 -0
  101. package/vendor/hyperframes/dist/chunk-JTHMTOMQ.js +601 -0
  102. package/vendor/hyperframes/dist/chunk-K2EQN4VU.js +405 -0
  103. package/vendor/hyperframes/dist/chunk-K2FTXJYH.js +16044 -0
  104. package/vendor/hyperframes/dist/chunk-K4WIOZFP.js +32 -0
  105. package/vendor/hyperframes/dist/chunk-K4WKGXRC.js +18 -0
  106. package/vendor/hyperframes/dist/chunk-KBJUXVOJ.js +172 -0
  107. package/vendor/hyperframes/dist/chunk-KC5XXX3X.js +590 -0
  108. package/vendor/hyperframes/dist/chunk-KNU5COPB.js +29 -0
  109. package/vendor/hyperframes/dist/chunk-KZI44OPA.js +185 -0
  110. package/vendor/hyperframes/dist/chunk-L3YOGIPG.js +48 -0
  111. package/vendor/hyperframes/dist/chunk-LAOCA3MQ.js +189 -0
  112. package/vendor/hyperframes/dist/chunk-LCSMOLGX.js +312 -0
  113. package/vendor/hyperframes/dist/chunk-LFGJWOVA.js +61 -0
  114. package/vendor/hyperframes/dist/chunk-LHSR3M4M.js +498 -0
  115. package/vendor/hyperframes/dist/chunk-LYNI3FOL.js +123 -0
  116. package/vendor/hyperframes/dist/chunk-M2WBOQ2Q.js +54 -0
  117. package/vendor/hyperframes/dist/chunk-MRF4AMKD.js +104 -0
  118. package/vendor/hyperframes/dist/chunk-MWB3ZIFM.js +852 -0
  119. package/vendor/hyperframes/dist/chunk-NGKM64BP.js +39 -0
  120. package/vendor/hyperframes/dist/chunk-NXMYHJAL.js +43 -0
  121. package/vendor/hyperframes/dist/chunk-OAF4XJOW.js +192 -0
  122. package/vendor/hyperframes/dist/chunk-OFQWTKPW.js +117 -0
  123. package/vendor/hyperframes/dist/chunk-P6LJ4Y32.js +4662 -0
  124. package/vendor/hyperframes/dist/chunk-PBN6GBJE.js +108 -0
  125. package/vendor/hyperframes/dist/chunk-PDAMK4Q5.js +28 -0
  126. package/vendor/hyperframes/dist/chunk-PFCFR3KZ.js +20 -0
  127. package/vendor/hyperframes/dist/chunk-PJ3HDUCY.js +108 -0
  128. package/vendor/hyperframes/dist/chunk-PMRBLBUP.js +152 -0
  129. package/vendor/hyperframes/dist/chunk-PPQUYWTW.js +240 -0
  130. package/vendor/hyperframes/dist/chunk-Q5X2B5WT.js +29 -0
  131. package/vendor/hyperframes/dist/chunk-Q7IU7MOR.js +351 -0
  132. package/vendor/hyperframes/dist/chunk-QC4FJVLM.js +371 -0
  133. package/vendor/hyperframes/dist/chunk-QNYYOUU3.js +1318 -0
  134. package/vendor/hyperframes/dist/chunk-RDNNAKEP.js +161 -0
  135. package/vendor/hyperframes/dist/chunk-RMHUQGRK.js +657 -0
  136. package/vendor/hyperframes/dist/chunk-RQVDTPGD.js +6 -0
  137. package/vendor/hyperframes/dist/chunk-RVCWIIZ7.js +68 -0
  138. package/vendor/hyperframes/dist/chunk-S3D6GE5W.js +72 -0
  139. package/vendor/hyperframes/dist/chunk-S3S4TGEH.js +424 -0
  140. package/vendor/hyperframes/dist/chunk-S7NPLFWV.js +11395 -0
  141. package/vendor/hyperframes/dist/chunk-SHB5VDMH.js +51 -0
  142. package/vendor/hyperframes/dist/chunk-TCLGPL65.js +860 -0
  143. package/vendor/hyperframes/dist/chunk-THXFSPLV.js +40 -0
  144. package/vendor/hyperframes/dist/chunk-TJSTGSAW.js +354 -0
  145. package/vendor/hyperframes/dist/chunk-TQFG7HTI.js +1024 -0
  146. package/vendor/hyperframes/dist/chunk-TVCRUG2S.js +265 -0
  147. package/vendor/hyperframes/dist/chunk-TWWSYAKJ.js +24 -0
  148. package/vendor/hyperframes/dist/chunk-U7CZBDMV.js +27 -0
  149. package/vendor/hyperframes/dist/chunk-UEZXMWG3.js +139 -0
  150. package/vendor/hyperframes/dist/chunk-UYEZTK4U.js +61 -0
  151. package/vendor/hyperframes/dist/chunk-VC76R6W2.js +27 -0
  152. package/vendor/hyperframes/dist/chunk-VFCKXTBB.js +159 -0
  153. package/vendor/hyperframes/dist/chunk-VWG7OQKU.js +22 -0
  154. package/vendor/hyperframes/dist/chunk-VXVRPIJA.js +105 -0
  155. package/vendor/hyperframes/dist/chunk-WBLXWOYK.js +15 -0
  156. package/vendor/hyperframes/dist/chunk-WERLJGIC.js +20 -0
  157. package/vendor/hyperframes/dist/chunk-WMQNIQDJ.js +2057 -0
  158. package/vendor/hyperframes/dist/chunk-WPHMNO44.js +4528 -0
  159. package/vendor/hyperframes/dist/chunk-X5HWXQPU.js +113 -0
  160. package/vendor/hyperframes/dist/chunk-X7MTZ4T2.js +6 -0
  161. package/vendor/hyperframes/dist/chunk-XH4DSOS5.js +59 -0
  162. package/vendor/hyperframes/dist/chunk-XS4EJSKU.js +23 -0
  163. package/vendor/hyperframes/dist/chunk-XT5P4QMO.js +181 -0
  164. package/vendor/hyperframes/dist/chunk-XT7X6QCP.js +6 -0
  165. package/vendor/hyperframes/dist/chunk-XUHOIDKG.js +6 -0
  166. package/vendor/hyperframes/dist/chunk-XUXGIA7H.js +485 -0
  167. package/vendor/hyperframes/dist/chunk-XZABUQTX.js +113 -0
  168. package/vendor/hyperframes/dist/chunk-Y6W4DVPS.js +356 -0
  169. package/vendor/hyperframes/dist/chunk-YEIFI443.js +44 -0
  170. package/vendor/hyperframes/dist/chunk-YQZNILVH.js +375 -0
  171. package/vendor/hyperframes/dist/chunk-Z27A7NUB.js +65 -0
  172. package/vendor/hyperframes/dist/chunk-Z6B37SNM.js +3081 -0
  173. package/vendor/hyperframes/dist/chunk-ZJUKFZ2P.js +10954 -0
  174. package/vendor/hyperframes/dist/chunk-ZKDMAOFU.js +32 -0
  175. package/vendor/hyperframes/dist/chunk-ZMXUQLI2.js +17219 -0
  176. package/vendor/hyperframes/dist/chunk-ZTZ7NCJT.js +58 -0
  177. package/vendor/hyperframes/dist/chunk-ZTZA4UWZ.js +108 -0
  178. package/vendor/hyperframes/dist/clean-W57E5YQ3.js +293 -0
  179. package/vendor/hyperframes/dist/cli.js +495 -0
  180. package/vendor/hyperframes/dist/cloud-FFTJGZ24.js +70 -0
  181. package/vendor/hyperframes/dist/cloudrun-AJUTHUEA.js +763 -0
  182. package/vendor/hyperframes/dist/colors-HKWSZCGK.js +15 -0
  183. package/vendor/hyperframes/dist/commands/contrast-audit.browser.js +459 -0
  184. package/vendor/hyperframes/dist/commands/layout-audit.browser.js +2102 -0
  185. package/vendor/hyperframes/dist/commands/motion-sample.browser.js +74 -0
  186. package/vendor/hyperframes/dist/commands/motion-signature.browser.js +374 -0
  187. package/vendor/hyperframes/dist/compare-AYCTT55F.js +421 -0
  188. package/vendor/hyperframes/dist/compiler-QO36EXLS.js +121 -0
  189. package/vendor/hyperframes/dist/component-VFFR2O7T.js +176 -0
  190. package/vendor/hyperframes/dist/compositions-QTVN3U2A.js +228 -0
  191. package/vendor/hyperframes/dist/contactSheet-27SRU7A4.js +22 -0
  192. package/vendor/hyperframes/dist/delete-ZAKYCB7I.js +114 -0
  193. package/vendor/hyperframes/dist/deploy-MX76RZ36.js +101 -0
  194. package/vendor/hyperframes/dist/destroy-H2TZBYHH.js +42 -0
  195. package/vendor/hyperframes/dist/deterministicFonts-HAEMV4TM.js +50 -0
  196. package/vendor/hyperframes/dist/dist-EWXJGN63.js +129 -0
  197. package/vendor/hyperframes/dist/dist-FNNGCKFS.js +29 -0
  198. package/vendor/hyperframes/dist/dist-S3PJNPXQ.js +392 -0
  199. package/vendor/hyperframes/dist/docker/Dockerfile.render +65 -0
  200. package/vendor/hyperframes/dist/docs/compositions.md +67 -0
  201. package/vendor/hyperframes/dist/docs/data-attributes.md +27 -0
  202. package/vendor/hyperframes/dist/docs/examples.md +19 -0
  203. package/vendor/hyperframes/dist/docs/gsap.md +26 -0
  204. package/vendor/hyperframes/dist/docs/rendering.md +35 -0
  205. package/vendor/hyperframes/dist/docs/troubleshooting.md +29 -0
  206. package/vendor/hyperframes/dist/docs-QAPJEGLS.js +131 -0
  207. package/vendor/hyperframes/dist/doctor-AI7C3FON.js +67 -0
  208. package/vendor/hyperframes/dist/dom-IROKGVJI.js +14 -0
  209. package/vendor/hyperframes/dist/dotEnv-AECLXQSO.js +14 -0
  210. package/vendor/hyperframes/dist/events-7LALYNKZ.js +92 -0
  211. package/vendor/hyperframes/dist/events-FQY3HGKZ.js +88 -0
  212. package/vendor/hyperframes/dist/feedback-WCMDMSTK.js +472 -0
  213. package/vendor/hyperframes/dist/ffmpeg-QIUFEFTY.js +35 -0
  214. package/vendor/hyperframes/dist/figma-64WY462P.js +63 -0
  215. package/vendor/hyperframes/dist/fontData.generated-NXAOI4GH.js +13 -0
  216. package/vendor/hyperframes/dist/fontLocalizeCli.js +132 -0
  217. package/vendor/hyperframes/dist/get-FPOMJMZB.js +103 -0
  218. package/vendor/hyperframes/dist/gpuPolicy-2ZUZE5D6.js +38 -0
  219. package/vendor/hyperframes/dist/grade-compare-E2CKPST4.js +647 -0
  220. package/vendor/hyperframes/dist/gsapParser-DIYYX6JT.js +2846 -0
  221. package/vendor/hyperframes/dist/gsapParserAcorn-E3GEIRZB.js +28 -0
  222. package/vendor/hyperframes/dist/help-YRQIDDML.js +197 -0
  223. package/vendor/hyperframes/dist/history-PP5NDRV3.js +571 -0
  224. package/vendor/hyperframes/dist/hyperframe-runtime.js +1081 -0
  225. package/vendor/hyperframes/dist/hyperframe.manifest.json +22 -0
  226. package/vendor/hyperframes/dist/hyperframe.runtime.iife.js +1081 -0
  227. package/vendor/hyperframes/dist/hyperframes-player.global.js +474 -0
  228. package/vendor/hyperframes/dist/hyperframes-slideshow.global.js +149 -0
  229. package/vendor/hyperframes/dist/info-SEX3B7JL.js +153 -0
  230. package/vendor/hyperframes/dist/init-U3AKHO5B.js +1147 -0
  231. package/vendor/hyperframes/dist/inspect-Q3K6EDEK.js +97 -0
  232. package/vendor/hyperframes/dist/installer-K6O5WF44.js +37 -0
  233. package/vendor/hyperframes/dist/keyframes-DC64JCI3.js +2602 -0
  234. package/vendor/hyperframes/dist/lambda-D7UMN4DJ.js +451 -0
  235. package/vendor/hyperframes/dist/layout-XSPPDHOO.js +86 -0
  236. package/vendor/hyperframes/dist/lib-TPG2ZMAX.js +128 -0
  237. package/vendor/hyperframes/dist/lint-7DQZE7L3.js +164 -0
  238. package/vendor/hyperframes/dist/lintProject-OHBBM3DJ.js +27 -0
  239. package/vendor/hyperframes/dist/list-4K5MVDQX.js +162 -0
  240. package/vendor/hyperframes/dist/login-NTX4OWXL.js +377 -0
  241. package/vendor/hyperframes/dist/logout-Q654A3SI.js +100 -0
  242. package/vendor/hyperframes/dist/manager-67P2XFXQ.js +34 -0
  243. package/vendor/hyperframes/dist/manager-CT3D67CG.js +38 -0
  244. package/vendor/hyperframes/dist/manager-GFN75DM4.js +30 -0
  245. package/vendor/hyperframes/dist/media-treatment-5FYAOPNL.js +972 -0
  246. package/vendor/hyperframes/dist/media-use-4XXGABIL.js +113 -0
  247. package/vendor/hyperframes/dist/models-C4E4IWJD.js +137 -0
  248. package/vendor/hyperframes/dist/motionShot-S4MIGMT5.js +614 -0
  249. package/vendor/hyperframes/dist/normalize-O76AC4HE.js +333 -0
  250. package/vendor/hyperframes/dist/normalize-audio-CSFTXLXD.js +276 -0
  251. package/vendor/hyperframes/dist/open-2ZD6BHZG.js +115 -0
  252. package/vendor/hyperframes/dist/pipeline-TNGWUZQC.js +54 -0
  253. package/vendor/hyperframes/dist/play-CTMUXX6E.js +349 -0
  254. package/vendor/hyperframes/dist/policies-FSDZVS2E.js +292 -0
  255. package/vendor/hyperframes/dist/preflight-SMNV6RW2.js +45 -0
  256. package/vendor/hyperframes/dist/present-WQVHV5CR.js +350 -0
  257. package/vendor/hyperframes/dist/preview-JOJXTH75.js +1820 -0
  258. package/vendor/hyperframes/dist/producer-ECLEN5RP.js +13 -0
  259. package/vendor/hyperframes/dist/progress-FBIEEB7Y.js +73 -0
  260. package/vendor/hyperframes/dist/projectConfig-HYJMJ5BY.js +56 -0
  261. package/vendor/hyperframes/dist/publication-HQ5Y3KBM.js +29 -0
  262. package/vendor/hyperframes/dist/publish-VHDYQASC.js +430 -0
  263. package/vendor/hyperframes/dist/refresh-K24ETHMA.js +53 -0
  264. package/vendor/hyperframes/dist/remove-background-W2YX2NVH.js +253 -0
  265. package/vendor/hyperframes/dist/render-AO5VX3YI.js +177 -0
  266. package/vendor/hyperframes/dist/render-LNO62LEL.js +2367 -0
  267. package/vendor/hyperframes/dist/render-TTQI7TGN.js +796 -0
  268. package/vendor/hyperframes/dist/render-batch-YH7CTWNY.js +284 -0
  269. package/vendor/hyperframes/dist/renderCancellation-JPIHE47X.js +35 -0
  270. package/vendor/hyperframes/dist/renderSetupWorker.js +79 -0
  271. package/vendor/hyperframes/dist/resolver-IZ647GBZ.js +38 -0
  272. package/vendor/hyperframes/dist/runtimeVersion.js +18 -0
  273. package/vendor/hyperframes/dist/screenshotCapture-ECBTLCU6.js +179 -0
  274. package/vendor/hyperframes/dist/shaderTransitionWorker.js +44 -0
  275. package/vendor/hyperframes/dist/sherpa-KKLNW6U2.js +314 -0
  276. package/vendor/hyperframes/dist/sherpaWorker.js +77 -0
  277. package/vendor/hyperframes/dist/sites-TNVKZS73.js +52 -0
  278. package/vendor/hyperframes/dist/skill-ZHVLH7KX.js +15 -0
  279. package/vendor/hyperframes/dist/skills/hyperframes/SKILL.md +152 -0
  280. package/vendor/hyperframes/dist/skills/hyperframes/references/brief-contract.md +108 -0
  281. package/vendor/hyperframes/dist/skills/hyperframes/references/brief-format.md +72 -0
  282. package/vendor/hyperframes/dist/skills/hyperframes/references/capability-menu.md +47 -0
  283. package/vendor/hyperframes/dist/skills/hyperframes/references/frame-worker-core.md +80 -0
  284. package/vendor/hyperframes/dist/skills/hyperframes/references/intent-interview.md +73 -0
  285. package/vendor/hyperframes/dist/skills/hyperframes/references/pitch-round.md +40 -0
  286. package/vendor/hyperframes/dist/skills/hyperframes/references/plugin-installation.md +43 -0
  287. package/vendor/hyperframes/dist/skills/hyperframes/references/production-loop.md +26 -0
  288. package/vendor/hyperframes/dist/skills/hyperframes/references/review-loop.md +37 -0
  289. package/vendor/hyperframes/dist/skills/hyperframes/references/route-briefs.md +11 -0
  290. package/vendor/hyperframes/dist/skills/hyperframes/references/routes/embedded-captions.md +11 -0
  291. package/vendor/hyperframes/dist/skills/hyperframes/references/routes/faceless-explainer.md +12 -0
  292. package/vendor/hyperframes/dist/skills/hyperframes/references/routes/general-video.md +12 -0
  293. package/vendor/hyperframes/dist/skills/hyperframes/references/routes/motion-graphics.md +11 -0
  294. package/vendor/hyperframes/dist/skills/hyperframes/references/routes/music-to-video.md +12 -0
  295. package/vendor/hyperframes/dist/skills/hyperframes/references/routes/pr-to-video.md +28 -0
  296. package/vendor/hyperframes/dist/skills/hyperframes/references/routes/product-launch-video.md +13 -0
  297. package/vendor/hyperframes/dist/skills/hyperframes/references/routes/remotion-to-hyperframes.md +9 -0
  298. package/vendor/hyperframes/dist/skills/hyperframes/references/routes/slideshow.md +11 -0
  299. package/vendor/hyperframes/dist/skills/hyperframes/references/routes/talking-head-recut.md +11 -0
  300. package/vendor/hyperframes/dist/skills/hyperframes/references/script-format.md +52 -0
  301. package/vendor/hyperframes/dist/skills/hyperframes/references/skill-lifecycle.md +35 -0
  302. package/vendor/hyperframes/dist/skills/hyperframes/references/storyboard-format.md +99 -0
  303. package/vendor/hyperframes/dist/skills/hyperframes/references/subagent-dispatch.md +35 -0
  304. package/vendor/hyperframes/dist/skills/hyperframes/references/workflow-catalog.md +10 -0
  305. package/vendor/hyperframes/dist/skills/hyperframes/scripts/lib/frame-packets-core.mjs +194 -0
  306. package/vendor/hyperframes/dist/skills/hyperframes/scripts/plugin-cli.mjs +88 -0
  307. package/vendor/hyperframes/dist/skills/hyperframes/scripts/plugin-cli.test.mjs +117 -0
  308. package/vendor/hyperframes/dist/skills/hyperframes-cli/SKILL.md +189 -0
  309. package/vendor/hyperframes/dist/skills/hyperframes-cli/references/beats.md +19 -0
  310. package/vendor/hyperframes/dist/skills/hyperframes-cli/references/cloud.md +163 -0
  311. package/vendor/hyperframes/dist/skills/hyperframes-cli/references/cloudrun.md +62 -0
  312. package/vendor/hyperframes/dist/skills/hyperframes-cli/references/compare-and-batch.md +105 -0
  313. package/vendor/hyperframes/dist/skills/hyperframes-cli/references/doctor-browser.md +57 -0
  314. package/vendor/hyperframes/dist/skills/hyperframes-cli/references/init-and-scaffold.md +74 -0
  315. package/vendor/hyperframes/dist/skills/hyperframes-cli/references/lambda.md +185 -0
  316. package/vendor/hyperframes/dist/skills/hyperframes-cli/references/lint-validate-inspect.md +132 -0
  317. package/vendor/hyperframes/dist/skills/hyperframes-cli/references/preview-render.md +193 -0
  318. package/vendor/hyperframes/dist/skills/hyperframes-cli/references/upgrade-info-misc.md +134 -0
  319. package/vendor/hyperframes/dist/skills/media-use/SKILL.md +100 -0
  320. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/CREDITS.md +35 -0
  321. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/chime.mp3 +0 -0
  322. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/click-soft.mp3 +0 -0
  323. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/click.mp3 +0 -0
  324. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/error.mp3 +0 -0
  325. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/glitch-1.mp3 +0 -0
  326. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/glitch-2.mp3 +0 -0
  327. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/glitch-3.mp3 +0 -0
  328. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/impact-bass-1.mp3 +0 -0
  329. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/impact-bass-2.mp3 +0 -0
  330. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/key-press.mp3 +0 -0
  331. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/manifest.json +97 -0
  332. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/notification.mp3 +0 -0
  333. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/ping.mp3 +0 -0
  334. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/pop.mp3 +0 -0
  335. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/riser.mp3 +0 -0
  336. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/sparkle.mp3 +0 -0
  337. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/typing.mp3 +0 -0
  338. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/whoosh-cinematic.mp3 +0 -0
  339. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/whoosh-short.mp3 +0 -0
  340. package/vendor/hyperframes/dist/skills/media-use/audio/assets/sfx/whoosh.mp3 +0 -0
  341. package/vendor/hyperframes/dist/skills/media-use/audio/references/bgm.md +76 -0
  342. package/vendor/hyperframes/dist/skills/media-use/audio/references/captions/authoring.md +163 -0
  343. package/vendor/hyperframes/dist/skills/media-use/audio/references/captions/motion.md +87 -0
  344. package/vendor/hyperframes/dist/skills/media-use/audio/references/captions/transcript-handling.md +97 -0
  345. package/vendor/hyperframes/dist/skills/media-use/audio/references/remove-background.md +143 -0
  346. package/vendor/hyperframes/dist/skills/media-use/audio/references/requirements.md +29 -0
  347. package/vendor/hyperframes/dist/skills/media-use/audio/references/sfx.md +42 -0
  348. package/vendor/hyperframes/dist/skills/media-use/audio/references/transcribe.md +52 -0
  349. package/vendor/hyperframes/dist/skills/media-use/audio/references/tts-to-captions.md +35 -0
  350. package/vendor/hyperframes/dist/skills/media-use/audio/references/tts.md +260 -0
  351. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/audio.mjs +311 -0
  352. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/audio.test.mjs +159 -0
  353. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/gemini-pipeline.test.mjs +131 -0
  354. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/heygen-tts.mjs +122 -0
  355. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/heygen-tts.test.mjs +38 -0
  356. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/heygen-voice.mjs +98 -0
  357. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/heygen-voice.test.mjs +233 -0
  358. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/audio-meta.mjs +39 -0
  359. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/audio-meta.test.mjs +136 -0
  360. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/bgm-volume.mjs +4 -0
  361. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/bgm.mjs +257 -0
  362. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/bgm.test.mjs +74 -0
  363. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/concurrency.mjs +14 -0
  364. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/concurrency.test.mjs +41 -0
  365. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/gemini-auth.mjs +43 -0
  366. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/gemini-auth.py +52 -0
  367. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/gemini-auth.test.mjs +86 -0
  368. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/gemini-auth_test.py +90 -0
  369. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/gemini-tts.mjs +122 -0
  370. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/gemini-tts.test.mjs +243 -0
  371. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/heygen.mjs +197 -0
  372. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/heygen.test.mjs +185 -0
  373. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/media-record.mjs +114 -0
  374. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/media-record.test.mjs +205 -0
  375. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/python.mjs +77 -0
  376. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/python.test.mjs +136 -0
  377. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/sfx.mjs +165 -0
  378. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/sfx.test.mjs +121 -0
  379. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/tts.mjs +389 -0
  380. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/tts.spawn.test.mjs +158 -0
  381. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lib/tts.test.mjs +230 -0
  382. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/lyria-recipe.py +136 -0
  383. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/wait-bgm.mjs +175 -0
  384. package/vendor/hyperframes/dist/skills/media-use/audio/scripts/wait-bgm.test.mjs +108 -0
  385. package/vendor/hyperframes/dist/skills/media-use/luts/README.md +28 -0
  386. package/vendor/hyperframes/dist/skills/media-use/luts/index.json +57 -0
  387. package/vendor/hyperframes/dist/skills/media-use/references/audio.md +20 -0
  388. package/vendor/hyperframes/dist/skills/media-use/references/grading.md +160 -0
  389. package/vendor/hyperframes/dist/skills/media-use/references/media-treatment-recipes.md +929 -0
  390. package/vendor/hyperframes/dist/skills/media-use/references/media-treatments.md +202 -0
  391. package/vendor/hyperframes/dist/skills/media-use/references/memory.md +37 -0
  392. package/vendor/hyperframes/dist/skills/media-use/references/meta.md +61 -0
  393. package/vendor/hyperframes/dist/skills/media-use/references/operations.md +327 -0
  394. package/vendor/hyperframes/dist/skills/media-use/references/resolve.md +150 -0
  395. package/vendor/hyperframes/dist/skills/media-use/references/setup-providers.md +80 -0
  396. package/vendor/hyperframes/dist/skills/media-use/references/telemetry-dashboard.md +49 -0
  397. package/vendor/hyperframes/dist/skills/media-use/scripts/audio-duck.mjs +113 -0
  398. package/vendor/hyperframes/dist/skills/media-use/scripts/compatibility.test.mjs +96 -0
  399. package/vendor/hyperframes/dist/skills/media-use/scripts/dither.mjs +328 -0
  400. package/vendor/hyperframes/dist/skills/media-use/scripts/dither.test.mjs +176 -0
  401. package/vendor/hyperframes/dist/skills/media-use/scripts/eval.mjs +369 -0
  402. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/adopt.mjs +128 -0
  403. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/adopt.test.mjs +95 -0
  404. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/bgm-provider.mjs +20 -0
  405. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/brand-provider.mjs +59 -0
  406. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/bundled-sfx-provider.mjs +119 -0
  407. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/bundled-sfx-provider.test.mjs +139 -0
  408. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/cache.mjs +148 -0
  409. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/candidates.mjs +91 -0
  410. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/candidates.test.mjs +155 -0
  411. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/codex-provider.mjs +161 -0
  412. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/codex-provider.test.mjs +34 -0
  413. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/config-lock.d.mts +3 -0
  414. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/config-lock.mjs +45 -0
  415. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/config-lock.test.mjs +79 -0
  416. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/coverage.test.mjs +136 -0
  417. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/cube-build.mjs +181 -0
  418. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/cube-build.test.mjs +80 -0
  419. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/cube-validate.mjs +198 -0
  420. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/cube-validate.test.mjs +125 -0
  421. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/cutlist.mjs +184 -0
  422. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/cutlist.test.mjs +162 -0
  423. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/duck.mjs +95 -0
  424. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/duck.test.mjs +153 -0
  425. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/error-diffusion.mjs +230 -0
  426. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/error-diffusion.test.mjs +102 -0
  427. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/ff-binaries.mjs +37 -0
  428. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/freeze.mjs +72 -0
  429. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/freeze.test.mjs +138 -0
  430. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/grade-analyzer.mjs +265 -0
  431. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/grade-analyzer.test.mjs +285 -0
  432. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/heygen-cli.mjs +191 -0
  433. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/heygen-cli.test.mjs +301 -0
  434. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/heygen-search.mjs +45 -0
  435. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/heygen-search.test.mjs +49 -0
  436. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/heygen-video-provider.mjs +138 -0
  437. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/heygen-video-provider.test.mjs +435 -0
  438. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/image-provider.mjs +44 -0
  439. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/index-gen.mjs +63 -0
  440. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/local-media-search.mjs +32 -0
  441. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/local-models.mjs +318 -0
  442. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/local-models.test.mjs +220 -0
  443. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/local-run.mjs +78 -0
  444. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/local-run.test.mjs +121 -0
  445. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/logo-provider.mjs +244 -0
  446. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/logo-provider.test.mjs +298 -0
  447. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/ltx-video-provider.mjs +94 -0
  448. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/ltx-video-provider.test.mjs +316 -0
  449. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/lut-preset-provider.mjs +271 -0
  450. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/lut-preset-provider.test.mjs +199 -0
  451. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/manifest.d.mts +19 -0
  452. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/manifest.mjs +279 -0
  453. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/manifest.test.mjs +397 -0
  454. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/match.mjs +47 -0
  455. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/media-fetch.mjs +85 -0
  456. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/media-fetch.test.mjs +197 -0
  457. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/media-home.mjs +20 -0
  458. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/media-home.test.mjs +61 -0
  459. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/media-search.d.mts +9 -0
  460. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/media-search.mjs +107 -0
  461. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/mflux-provider.mjs +128 -0
  462. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/mflux-provider.test.mjs +174 -0
  463. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/misses.mjs +49 -0
  464. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/misses.test.mjs +89 -0
  465. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/npx-sync.mjs +31 -0
  466. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/npx-sync.test.mjs +50 -0
  467. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/parakeet-words.mjs +27 -0
  468. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/parakeet-words.test.mjs +44 -0
  469. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/prefs-store.mjs +180 -0
  470. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/prefs-store.test.mjs +189 -0
  471. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/probe.mjs +41 -0
  472. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/probe.test.mjs +148 -0
  473. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/providers.mjs +5 -0
  474. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/recipe-store.mjs +367 -0
  475. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/recipe-store.test.mjs +367 -0
  476. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/registry.mjs +212 -0
  477. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/registry.test.mjs +262 -0
  478. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/search.mjs +24 -0
  479. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/search.test.mjs +32 -0
  480. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/sfx-provider.mjs +23 -0
  481. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/specs.mjs +132 -0
  482. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/specs.test.mjs +157 -0
  483. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/stats.mjs +117 -0
  484. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/stats.test.mjs +165 -0
  485. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/svg-sanitize.mjs +21 -0
  486. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/telemetry.mjs +210 -0
  487. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/telemetry.test.mjs +437 -0
  488. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/test-home.test.mjs +10 -0
  489. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/transcriptCutFade.mjs +21 -0
  490. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/transcriptCutFade.test.mjs +33 -0
  491. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/tts-local-provider.mjs +94 -0
  492. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/tts-local-provider.test.mjs +72 -0
  493. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/usage.mjs +57 -0
  494. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/usage.test.mjs +54 -0
  495. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/voice-provider.mjs +57 -0
  496. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/voice-provider.test.mjs +46 -0
  497. package/vendor/hyperframes/dist/skills/media-use/scripts/lib/words.mjs +18 -0
  498. package/vendor/hyperframes/dist/skills/media-use/scripts/prefs.mjs +70 -0
  499. package/vendor/hyperframes/dist/skills/media-use/scripts/recipe.mjs +103 -0
  500. package/vendor/hyperframes/dist/skills/media-use/scripts/resolve-plugin.test.mjs +62 -0
  501. package/vendor/hyperframes/dist/skills/media-use/scripts/resolve.mjs +1369 -0
  502. package/vendor/hyperframes/dist/skills/media-use/scripts/transcribe.mjs +194 -0
  503. package/vendor/hyperframes/dist/skills/media-use/scripts/transcribe.test.mjs +112 -0
  504. package/vendor/hyperframes/dist/skills/media-use/scripts/transcript-cut.mjs +270 -0
  505. package/vendor/hyperframes/dist/skills/media-use/scripts/transcript-cut.test.mjs +117 -0
  506. package/vendor/hyperframes/dist/skills-MJ2J4GEM.js +808 -0
  507. package/vendor/hyperframes/dist/skillsUpdateCheck-TKTYQN5R.js +26 -0
  508. package/vendor/hyperframes/dist/slideshow-EJ4IMY6P.js +24 -0
  509. package/vendor/hyperframes/dist/snapshot-KIVDUUMN.js +875 -0
  510. package/vendor/hyperframes/dist/src-6YQBJGWR.js +202 -0
  511. package/vendor/hyperframes/dist/src-PVYUYV3M.js +471 -0
  512. package/vendor/hyperframes/dist/state-KAXGHF77.js +26 -0
  513. package/vendor/hyperframes/dist/staticProjectServer-7EU666GS.js +49 -0
  514. package/vendor/hyperframes/dist/status-YM52BQ6S.js +311 -0
  515. package/vendor/hyperframes/dist/studio/assets/hyperframes-player-Cp8e_Zst.js +473 -0
  516. package/vendor/hyperframes/dist/studio/assets/index-BX3KHhGX.js +71 -0
  517. package/vendor/hyperframes/dist/studio/assets/index-CASEBNy2.js +1 -0
  518. package/vendor/hyperframes/dist/studio/assets/index-D11atkBt.css +1 -0
  519. package/vendor/hyperframes/dist/studio/assets/index-DMTt9nTf.js +531 -0
  520. package/vendor/hyperframes/dist/studio/assets/index-oE1pOdAy.js +399 -0
  521. package/vendor/hyperframes/dist/studio/chunk-5VSXRGIX.js +948 -0
  522. package/vendor/hyperframes/dist/studio/chunk-5VSXRGIX.js.map +1 -0
  523. package/vendor/hyperframes/dist/studio/chunk-7UQWVN52.js +938 -0
  524. package/vendor/hyperframes/dist/studio/chunk-7UQWVN52.js.map +1 -0
  525. package/vendor/hyperframes/dist/studio/chunk-EEXSYY5F.js +190 -0
  526. package/vendor/hyperframes/dist/studio/chunk-EEXSYY5F.js.map +1 -0
  527. package/vendor/hyperframes/dist/studio/chunk-FOEID72M.js +1441 -0
  528. package/vendor/hyperframes/dist/studio/chunk-FOEID72M.js.map +1 -0
  529. package/vendor/hyperframes/dist/studio/chunk-PZ5AY32C.js +10 -0
  530. package/vendor/hyperframes/dist/studio/chunk-PZ5AY32C.js.map +1 -0
  531. package/vendor/hyperframes/dist/studio/chunk-TDWGXBUT.js +1103 -0
  532. package/vendor/hyperframes/dist/studio/chunk-TDWGXBUT.js.map +1 -0
  533. package/vendor/hyperframes/dist/studio/domEditingLayers-IEVLO54Z.js +47 -0
  534. package/vendor/hyperframes/dist/studio/domEditingLayers-IEVLO54Z.js.map +1 -0
  535. package/vendor/hyperframes/dist/studio/favicon.svg +14 -0
  536. package/vendor/hyperframes/dist/studio/icons/timeline/audio.svg +7 -0
  537. package/vendor/hyperframes/dist/studio/icons/timeline/captions.svg +5 -0
  538. package/vendor/hyperframes/dist/studio/icons/timeline/composition.svg +12 -0
  539. package/vendor/hyperframes/dist/studio/icons/timeline/image.svg +18 -0
  540. package/vendor/hyperframes/dist/studio/icons/timeline/music.svg +10 -0
  541. package/vendor/hyperframes/dist/studio/icons/timeline/text.svg +3 -0
  542. package/vendor/hyperframes/dist/studio/index.css +165 -0
  543. package/vendor/hyperframes/dist/studio/index.css.map +1 -0
  544. package/vendor/hyperframes/dist/studio/index.d.ts +4296 -0
  545. package/vendor/hyperframes/dist/studio/index.html +23 -0
  546. package/vendor/hyperframes/dist/studio/index.js +99693 -0
  547. package/vendor/hyperframes/dist/studio/index.js.map +1 -0
  548. package/vendor/hyperframes/dist/studio/player.d.ts +30 -0
  549. package/vendor/hyperframes/dist/studio/player.js +10 -0
  550. package/vendor/hyperframes/dist/studio/player.js.map +1 -0
  551. package/vendor/hyperframes/dist/studio/styles/tailwind-preset.d.ts +39 -0
  552. package/vendor/hyperframes/dist/studio/styles/tailwind-preset.js +50 -0
  553. package/vendor/hyperframes/dist/studio/styles/tailwind-preset.js.map +1 -0
  554. package/vendor/hyperframes/dist/studio/styles.css +1 -0
  555. package/vendor/hyperframes/dist/studio/ui.d.ts +296 -0
  556. package/vendor/hyperframes/dist/studio/ui.js +66 -0
  557. package/vendor/hyperframes/dist/studio/ui.js.map +1 -0
  558. package/vendor/hyperframes/dist/studio-api-PNQZRPX5.js +136 -0
  559. package/vendor/hyperframes/dist/studioSelectionClient-IUUPKUHZ.js +25 -0
  560. package/vendor/hyperframes/dist/studioServer-UWRBPIOJ.js +1457 -0
  561. package/vendor/hyperframes/dist/synthesize-K62TIZWI.js +182 -0
  562. package/vendor/hyperframes/dist/system-EZYZNUFD.js +44 -0
  563. package/vendor/hyperframes/dist/telemetry-2YC4SGQU.js +144 -0
  564. package/vendor/hyperframes/dist/telemetry-QMYM4WME.js +95 -0
  565. package/vendor/hyperframes/dist/templates/_shared/AGENTS.md +107 -0
  566. package/vendor/hyperframes/dist/templates/_shared/CLAUDE.md +107 -0
  567. package/vendor/hyperframes/dist/templates/blank/index.html +55 -0
  568. package/vendor/hyperframes/dist/templates/from-file/index.html +75 -0
  569. package/vendor/hyperframes/dist/templates/warm-grain/compositions/captions.html +154 -0
  570. package/vendor/hyperframes/dist/templates/warm-grain/compositions/graphics.html +162 -0
  571. package/vendor/hyperframes/dist/templates/warm-grain/compositions/intro.html +87 -0
  572. package/vendor/hyperframes/dist/templates/warm-grain/index.html +264 -0
  573. package/vendor/hyperframes/dist/templates/warm-grain/registry-item.json +34 -0
  574. package/vendor/hyperframes/dist/timeline-77Z3BBQM.js +1377 -0
  575. package/vendor/hyperframes/dist/tokens-OBGTYE4Z.js +92 -0
  576. package/vendor/hyperframes/dist/transcribe-7NVFHCGA.js +387 -0
  577. package/vendor/hyperframes/dist/transcribe-BNSJRR4M.js +62 -0
  578. package/vendor/hyperframes/dist/tts-P3LIPIL5.js +234 -0
  579. package/vendor/hyperframes/dist/updateCheck-UDWIJ4ZQ.js +39 -0
  580. package/vendor/hyperframes/dist/upgrade-CT3CPO3E.js +231 -0
  581. package/vendor/hyperframes/dist/urlDownloader-H6WRI2UE.js +39 -0
  582. package/vendor/hyperframes/dist/usage-EC3KFUIJ.js +2139 -0
  583. package/vendor/hyperframes/dist/validate-65QDZJWZ.js +70 -0
  584. package/vendor/hyperframes/dist/video-FGSGKRSV.js +261 -0
  585. package/vendor/hyperframes/dist/workspaceBuildCheck-TOLGAI4T.js +133 -0
  586. package/vendor/hyperframes/package.json +80 -0
@@ -0,0 +1,4662 @@
1
+ import { createRequire as __hf_createRequire } from "node:module";
2
+ import { fileURLToPath as __hf_fileURLToPath } from "node:url";
3
+ import { dirname as __hf_dirname } from "node:path";
4
+ var require = __hf_createRequire(import.meta.url);
5
+ var __filename = __hf_fileURLToPath(import.meta.url);
6
+ var __dirname = __hf_dirname(__filename);
7
+ import {
8
+ __commonJS
9
+ } from "./chunk-M2WBOQ2Q.js";
10
+
11
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js
12
+ var require_code = __commonJS({
13
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js"(exports) {
14
+ "use strict";
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
17
+ var _CodeOrName = class {
18
+ };
19
+ exports._CodeOrName = _CodeOrName;
20
+ exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
21
+ var Name = class extends _CodeOrName {
22
+ constructor(s) {
23
+ super();
24
+ if (!exports.IDENTIFIER.test(s))
25
+ throw new Error("CodeGen: name must be a valid identifier");
26
+ this.str = s;
27
+ }
28
+ toString() {
29
+ return this.str;
30
+ }
31
+ emptyStr() {
32
+ return false;
33
+ }
34
+ get names() {
35
+ return { [this.str]: 1 };
36
+ }
37
+ };
38
+ exports.Name = Name;
39
+ var _Code = class extends _CodeOrName {
40
+ constructor(code) {
41
+ super();
42
+ this._items = typeof code === "string" ? [code] : code;
43
+ }
44
+ toString() {
45
+ return this.str;
46
+ }
47
+ emptyStr() {
48
+ if (this._items.length > 1)
49
+ return false;
50
+ const item = this._items[0];
51
+ return item === "" || item === '""';
52
+ }
53
+ get str() {
54
+ var _a;
55
+ return (_a = this._str) !== null && _a !== void 0 ? _a : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
56
+ }
57
+ get names() {
58
+ var _a;
59
+ return (_a = this._names) !== null && _a !== void 0 ? _a : this._names = this._items.reduce((names, c) => {
60
+ if (c instanceof Name)
61
+ names[c.str] = (names[c.str] || 0) + 1;
62
+ return names;
63
+ }, {});
64
+ }
65
+ };
66
+ exports._Code = _Code;
67
+ exports.nil = new _Code("");
68
+ function _(strs, ...args) {
69
+ const code = [strs[0]];
70
+ let i = 0;
71
+ while (i < args.length) {
72
+ addCodeArg(code, args[i]);
73
+ code.push(strs[++i]);
74
+ }
75
+ return new _Code(code);
76
+ }
77
+ exports._ = _;
78
+ var plus = new _Code("+");
79
+ function str(strs, ...args) {
80
+ const expr = [safeStringify(strs[0])];
81
+ let i = 0;
82
+ while (i < args.length) {
83
+ expr.push(plus);
84
+ addCodeArg(expr, args[i]);
85
+ expr.push(plus, safeStringify(strs[++i]));
86
+ }
87
+ optimize(expr);
88
+ return new _Code(expr);
89
+ }
90
+ exports.str = str;
91
+ function addCodeArg(code, arg) {
92
+ if (arg instanceof _Code)
93
+ code.push(...arg._items);
94
+ else if (arg instanceof Name)
95
+ code.push(arg);
96
+ else
97
+ code.push(interpolate(arg));
98
+ }
99
+ exports.addCodeArg = addCodeArg;
100
+ function optimize(expr) {
101
+ let i = 1;
102
+ while (i < expr.length - 1) {
103
+ if (expr[i] === plus) {
104
+ const res = mergeExprItems(expr[i - 1], expr[i + 1]);
105
+ if (res !== void 0) {
106
+ expr.splice(i - 1, 3, res);
107
+ continue;
108
+ }
109
+ expr[i++] = "+";
110
+ }
111
+ i++;
112
+ }
113
+ }
114
+ function mergeExprItems(a, b) {
115
+ if (b === '""')
116
+ return a;
117
+ if (a === '""')
118
+ return b;
119
+ if (typeof a == "string") {
120
+ if (b instanceof Name || a[a.length - 1] !== '"')
121
+ return;
122
+ if (typeof b != "string")
123
+ return `${a.slice(0, -1)}${b}"`;
124
+ if (b[0] === '"')
125
+ return a.slice(0, -1) + b.slice(1);
126
+ return;
127
+ }
128
+ if (typeof b == "string" && b[0] === '"' && !(a instanceof Name))
129
+ return `"${a}${b.slice(1)}`;
130
+ return;
131
+ }
132
+ function strConcat(c1, c2) {
133
+ return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}`;
134
+ }
135
+ exports.strConcat = strConcat;
136
+ function interpolate(x) {
137
+ return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify(Array.isArray(x) ? x.join(",") : x);
138
+ }
139
+ function stringify(x) {
140
+ return new _Code(safeStringify(x));
141
+ }
142
+ exports.stringify = stringify;
143
+ function safeStringify(x) {
144
+ return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
145
+ }
146
+ exports.safeStringify = safeStringify;
147
+ function getProperty(key) {
148
+ return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]`;
149
+ }
150
+ exports.getProperty = getProperty;
151
+ function getEsmExportName(key) {
152
+ if (typeof key == "string" && exports.IDENTIFIER.test(key)) {
153
+ return new _Code(`${key}`);
154
+ }
155
+ throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
156
+ }
157
+ exports.getEsmExportName = getEsmExportName;
158
+ function regexpCode(rx) {
159
+ return new _Code(rx.toString());
160
+ }
161
+ exports.regexpCode = regexpCode;
162
+ }
163
+ });
164
+
165
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js
166
+ var require_scope = __commonJS({
167
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js"(exports) {
168
+ "use strict";
169
+ Object.defineProperty(exports, "__esModule", { value: true });
170
+ exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
171
+ var code_1 = require_code();
172
+ var ValueError = class extends Error {
173
+ constructor(name) {
174
+ super(`CodeGen: "code" for ${name} not defined`);
175
+ this.value = name.value;
176
+ }
177
+ };
178
+ var UsedValueState;
179
+ (function(UsedValueState2) {
180
+ UsedValueState2[UsedValueState2["Started"] = 0] = "Started";
181
+ UsedValueState2[UsedValueState2["Completed"] = 1] = "Completed";
182
+ })(UsedValueState || (exports.UsedValueState = UsedValueState = {}));
183
+ exports.varKinds = {
184
+ const: new code_1.Name("const"),
185
+ let: new code_1.Name("let"),
186
+ var: new code_1.Name("var")
187
+ };
188
+ var Scope = class {
189
+ constructor({ prefixes, parent } = {}) {
190
+ this._names = {};
191
+ this._prefixes = prefixes;
192
+ this._parent = parent;
193
+ }
194
+ toName(nameOrPrefix) {
195
+ return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix);
196
+ }
197
+ name(prefix) {
198
+ return new code_1.Name(this._newName(prefix));
199
+ }
200
+ _newName(prefix) {
201
+ const ng = this._names[prefix] || this._nameGroup(prefix);
202
+ return `${prefix}${ng.index++}`;
203
+ }
204
+ _nameGroup(prefix) {
205
+ var _a, _b;
206
+ if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
207
+ throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
208
+ }
209
+ return this._names[prefix] = { prefix, index: 0 };
210
+ }
211
+ };
212
+ exports.Scope = Scope;
213
+ var ValueScopeName = class extends code_1.Name {
214
+ constructor(prefix, nameStr) {
215
+ super(nameStr);
216
+ this.prefix = prefix;
217
+ }
218
+ setValue(value, { property, itemIndex }) {
219
+ this.value = value;
220
+ this.scopePath = (0, code_1._)`.${new code_1.Name(property)}[${itemIndex}]`;
221
+ }
222
+ };
223
+ exports.ValueScopeName = ValueScopeName;
224
+ var line = (0, code_1._)`\n`;
225
+ var ValueScope = class extends Scope {
226
+ constructor(opts) {
227
+ super(opts);
228
+ this._values = {};
229
+ this._scope = opts.scope;
230
+ this.opts = { ...opts, _n: opts.lines ? line : code_1.nil };
231
+ }
232
+ get() {
233
+ return this._scope;
234
+ }
235
+ name(prefix) {
236
+ return new ValueScopeName(prefix, this._newName(prefix));
237
+ }
238
+ value(nameOrPrefix, value) {
239
+ var _a;
240
+ if (value.ref === void 0)
241
+ throw new Error("CodeGen: ref must be passed in value");
242
+ const name = this.toName(nameOrPrefix);
243
+ const { prefix } = name;
244
+ const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref;
245
+ let vs = this._values[prefix];
246
+ if (vs) {
247
+ const _name = vs.get(valueKey);
248
+ if (_name)
249
+ return _name;
250
+ } else {
251
+ vs = this._values[prefix] = /* @__PURE__ */ new Map();
252
+ }
253
+ vs.set(valueKey, name);
254
+ const s = this._scope[prefix] || (this._scope[prefix] = []);
255
+ const itemIndex = s.length;
256
+ s[itemIndex] = value.ref;
257
+ name.setValue(value, { property: prefix, itemIndex });
258
+ return name;
259
+ }
260
+ getValue(prefix, keyOrRef) {
261
+ const vs = this._values[prefix];
262
+ if (!vs)
263
+ return;
264
+ return vs.get(keyOrRef);
265
+ }
266
+ scopeRefs(scopeName, values = this._values) {
267
+ return this._reduceValues(values, (name) => {
268
+ if (name.scopePath === void 0)
269
+ throw new Error(`CodeGen: name "${name}" has no value`);
270
+ return (0, code_1._)`${scopeName}${name.scopePath}`;
271
+ });
272
+ }
273
+ scopeCode(values = this._values, usedValues, getCode) {
274
+ return this._reduceValues(values, (name) => {
275
+ if (name.value === void 0)
276
+ throw new Error(`CodeGen: name "${name}" has no value`);
277
+ return name.value.code;
278
+ }, usedValues, getCode);
279
+ }
280
+ _reduceValues(values, valueCode, usedValues = {}, getCode) {
281
+ let code = code_1.nil;
282
+ for (const prefix in values) {
283
+ const vs = values[prefix];
284
+ if (!vs)
285
+ continue;
286
+ const nameSet = usedValues[prefix] = usedValues[prefix] || /* @__PURE__ */ new Map();
287
+ vs.forEach((name) => {
288
+ if (nameSet.has(name))
289
+ return;
290
+ nameSet.set(name, UsedValueState.Started);
291
+ let c = valueCode(name);
292
+ if (c) {
293
+ const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;
294
+ code = (0, code_1._)`${code}${def} ${name} = ${c};${this.opts._n}`;
295
+ } else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(name)) {
296
+ code = (0, code_1._)`${code}${c}${this.opts._n}`;
297
+ } else {
298
+ throw new ValueError(name);
299
+ }
300
+ nameSet.set(name, UsedValueState.Completed);
301
+ });
302
+ }
303
+ return code;
304
+ }
305
+ };
306
+ exports.ValueScope = ValueScope;
307
+ }
308
+ });
309
+
310
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js
311
+ var require_codegen = __commonJS({
312
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js"(exports) {
313
+ "use strict";
314
+ Object.defineProperty(exports, "__esModule", { value: true });
315
+ exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
316
+ var code_1 = require_code();
317
+ var scope_1 = require_scope();
318
+ var code_2 = require_code();
319
+ Object.defineProperty(exports, "_", { enumerable: true, get: function() {
320
+ return code_2._;
321
+ } });
322
+ Object.defineProperty(exports, "str", { enumerable: true, get: function() {
323
+ return code_2.str;
324
+ } });
325
+ Object.defineProperty(exports, "strConcat", { enumerable: true, get: function() {
326
+ return code_2.strConcat;
327
+ } });
328
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function() {
329
+ return code_2.nil;
330
+ } });
331
+ Object.defineProperty(exports, "getProperty", { enumerable: true, get: function() {
332
+ return code_2.getProperty;
333
+ } });
334
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function() {
335
+ return code_2.stringify;
336
+ } });
337
+ Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function() {
338
+ return code_2.regexpCode;
339
+ } });
340
+ Object.defineProperty(exports, "Name", { enumerable: true, get: function() {
341
+ return code_2.Name;
342
+ } });
343
+ var scope_2 = require_scope();
344
+ Object.defineProperty(exports, "Scope", { enumerable: true, get: function() {
345
+ return scope_2.Scope;
346
+ } });
347
+ Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function() {
348
+ return scope_2.ValueScope;
349
+ } });
350
+ Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function() {
351
+ return scope_2.ValueScopeName;
352
+ } });
353
+ Object.defineProperty(exports, "varKinds", { enumerable: true, get: function() {
354
+ return scope_2.varKinds;
355
+ } });
356
+ exports.operators = {
357
+ GT: new code_1._Code(">"),
358
+ GTE: new code_1._Code(">="),
359
+ LT: new code_1._Code("<"),
360
+ LTE: new code_1._Code("<="),
361
+ EQ: new code_1._Code("==="),
362
+ NEQ: new code_1._Code("!=="),
363
+ NOT: new code_1._Code("!"),
364
+ OR: new code_1._Code("||"),
365
+ AND: new code_1._Code("&&"),
366
+ ADD: new code_1._Code("+")
367
+ };
368
+ var Node = class {
369
+ optimizeNodes() {
370
+ return this;
371
+ }
372
+ optimizeNames(_names, _constants) {
373
+ return this;
374
+ }
375
+ };
376
+ var Def = class extends Node {
377
+ constructor(varKind, name, rhs) {
378
+ super();
379
+ this.varKind = varKind;
380
+ this.name = name;
381
+ this.rhs = rhs;
382
+ }
383
+ render({ es5, _n }) {
384
+ const varKind = es5 ? scope_1.varKinds.var : this.varKind;
385
+ const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
386
+ return `${varKind} ${this.name}${rhs};` + _n;
387
+ }
388
+ optimizeNames(names, constants) {
389
+ if (!names[this.name.str])
390
+ return;
391
+ if (this.rhs)
392
+ this.rhs = optimizeExpr(this.rhs, names, constants);
393
+ return this;
394
+ }
395
+ get names() {
396
+ return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {};
397
+ }
398
+ };
399
+ var Assign = class extends Node {
400
+ constructor(lhs, rhs, sideEffects) {
401
+ super();
402
+ this.lhs = lhs;
403
+ this.rhs = rhs;
404
+ this.sideEffects = sideEffects;
405
+ }
406
+ render({ _n }) {
407
+ return `${this.lhs} = ${this.rhs};` + _n;
408
+ }
409
+ optimizeNames(names, constants) {
410
+ if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
411
+ return;
412
+ this.rhs = optimizeExpr(this.rhs, names, constants);
413
+ return this;
414
+ }
415
+ get names() {
416
+ const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names };
417
+ return addExprNames(names, this.rhs);
418
+ }
419
+ };
420
+ var AssignOp = class extends Assign {
421
+ constructor(lhs, op, rhs, sideEffects) {
422
+ super(lhs, rhs, sideEffects);
423
+ this.op = op;
424
+ }
425
+ render({ _n }) {
426
+ return `${this.lhs} ${this.op}= ${this.rhs};` + _n;
427
+ }
428
+ };
429
+ var Label = class extends Node {
430
+ constructor(label) {
431
+ super();
432
+ this.label = label;
433
+ this.names = {};
434
+ }
435
+ render({ _n }) {
436
+ return `${this.label}:` + _n;
437
+ }
438
+ };
439
+ var Break = class extends Node {
440
+ constructor(label) {
441
+ super();
442
+ this.label = label;
443
+ this.names = {};
444
+ }
445
+ render({ _n }) {
446
+ const label = this.label ? ` ${this.label}` : "";
447
+ return `break${label};` + _n;
448
+ }
449
+ };
450
+ var Throw = class extends Node {
451
+ constructor(error) {
452
+ super();
453
+ this.error = error;
454
+ }
455
+ render({ _n }) {
456
+ return `throw ${this.error};` + _n;
457
+ }
458
+ get names() {
459
+ return this.error.names;
460
+ }
461
+ };
462
+ var AnyCode = class extends Node {
463
+ constructor(code) {
464
+ super();
465
+ this.code = code;
466
+ }
467
+ render({ _n }) {
468
+ return `${this.code};` + _n;
469
+ }
470
+ optimizeNodes() {
471
+ return `${this.code}` ? this : void 0;
472
+ }
473
+ optimizeNames(names, constants) {
474
+ this.code = optimizeExpr(this.code, names, constants);
475
+ return this;
476
+ }
477
+ get names() {
478
+ return this.code instanceof code_1._CodeOrName ? this.code.names : {};
479
+ }
480
+ };
481
+ var ParentNode = class extends Node {
482
+ constructor(nodes = []) {
483
+ super();
484
+ this.nodes = nodes;
485
+ }
486
+ render(opts) {
487
+ return this.nodes.reduce((code, n) => code + n.render(opts), "");
488
+ }
489
+ optimizeNodes() {
490
+ const { nodes } = this;
491
+ let i = nodes.length;
492
+ while (i--) {
493
+ const n = nodes[i].optimizeNodes();
494
+ if (Array.isArray(n))
495
+ nodes.splice(i, 1, ...n);
496
+ else if (n)
497
+ nodes[i] = n;
498
+ else
499
+ nodes.splice(i, 1);
500
+ }
501
+ return nodes.length > 0 ? this : void 0;
502
+ }
503
+ optimizeNames(names, constants) {
504
+ const { nodes } = this;
505
+ let i = nodes.length;
506
+ while (i--) {
507
+ const n = nodes[i];
508
+ if (n.optimizeNames(names, constants))
509
+ continue;
510
+ subtractNames(names, n.names);
511
+ nodes.splice(i, 1);
512
+ }
513
+ return nodes.length > 0 ? this : void 0;
514
+ }
515
+ get names() {
516
+ return this.nodes.reduce((names, n) => addNames(names, n.names), {});
517
+ }
518
+ };
519
+ var BlockNode = class extends ParentNode {
520
+ render(opts) {
521
+ return "{" + opts._n + super.render(opts) + "}" + opts._n;
522
+ }
523
+ };
524
+ var Root = class extends ParentNode {
525
+ };
526
+ var Else = class extends BlockNode {
527
+ };
528
+ Else.kind = "else";
529
+ var If = class _If extends BlockNode {
530
+ constructor(condition, nodes) {
531
+ super(nodes);
532
+ this.condition = condition;
533
+ }
534
+ render(opts) {
535
+ let code = `if(${this.condition})` + super.render(opts);
536
+ if (this.else)
537
+ code += "else " + this.else.render(opts);
538
+ return code;
539
+ }
540
+ optimizeNodes() {
541
+ super.optimizeNodes();
542
+ const cond = this.condition;
543
+ if (cond === true)
544
+ return this.nodes;
545
+ let e = this.else;
546
+ if (e) {
547
+ const ns = e.optimizeNodes();
548
+ e = this.else = Array.isArray(ns) ? new Else(ns) : ns;
549
+ }
550
+ if (e) {
551
+ if (cond === false)
552
+ return e instanceof _If ? e : e.nodes;
553
+ if (this.nodes.length)
554
+ return this;
555
+ return new _If(not(cond), e instanceof _If ? [e] : e.nodes);
556
+ }
557
+ if (cond === false || !this.nodes.length)
558
+ return void 0;
559
+ return this;
560
+ }
561
+ optimizeNames(names, constants) {
562
+ var _a;
563
+ this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
564
+ if (!(super.optimizeNames(names, constants) || this.else))
565
+ return;
566
+ this.condition = optimizeExpr(this.condition, names, constants);
567
+ return this;
568
+ }
569
+ get names() {
570
+ const names = super.names;
571
+ addExprNames(names, this.condition);
572
+ if (this.else)
573
+ addNames(names, this.else.names);
574
+ return names;
575
+ }
576
+ };
577
+ If.kind = "if";
578
+ var For = class extends BlockNode {
579
+ };
580
+ For.kind = "for";
581
+ var ForLoop = class extends For {
582
+ constructor(iteration) {
583
+ super();
584
+ this.iteration = iteration;
585
+ }
586
+ render(opts) {
587
+ return `for(${this.iteration})` + super.render(opts);
588
+ }
589
+ optimizeNames(names, constants) {
590
+ if (!super.optimizeNames(names, constants))
591
+ return;
592
+ this.iteration = optimizeExpr(this.iteration, names, constants);
593
+ return this;
594
+ }
595
+ get names() {
596
+ return addNames(super.names, this.iteration.names);
597
+ }
598
+ };
599
+ var ForRange = class extends For {
600
+ constructor(varKind, name, from, to) {
601
+ super();
602
+ this.varKind = varKind;
603
+ this.name = name;
604
+ this.from = from;
605
+ this.to = to;
606
+ }
607
+ render(opts) {
608
+ const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;
609
+ const { name, from, to } = this;
610
+ return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts);
611
+ }
612
+ get names() {
613
+ const names = addExprNames(super.names, this.from);
614
+ return addExprNames(names, this.to);
615
+ }
616
+ };
617
+ var ForIter = class extends For {
618
+ constructor(loop, varKind, name, iterable) {
619
+ super();
620
+ this.loop = loop;
621
+ this.varKind = varKind;
622
+ this.name = name;
623
+ this.iterable = iterable;
624
+ }
625
+ render(opts) {
626
+ return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
627
+ }
628
+ optimizeNames(names, constants) {
629
+ if (!super.optimizeNames(names, constants))
630
+ return;
631
+ this.iterable = optimizeExpr(this.iterable, names, constants);
632
+ return this;
633
+ }
634
+ get names() {
635
+ return addNames(super.names, this.iterable.names);
636
+ }
637
+ };
638
+ var Func = class extends BlockNode {
639
+ constructor(name, args, async) {
640
+ super();
641
+ this.name = name;
642
+ this.args = args;
643
+ this.async = async;
644
+ }
645
+ render(opts) {
646
+ const _async = this.async ? "async " : "";
647
+ return `${_async}function ${this.name}(${this.args})` + super.render(opts);
648
+ }
649
+ };
650
+ Func.kind = "func";
651
+ var Return = class extends ParentNode {
652
+ render(opts) {
653
+ return "return " + super.render(opts);
654
+ }
655
+ };
656
+ Return.kind = "return";
657
+ var Try = class extends BlockNode {
658
+ render(opts) {
659
+ let code = "try" + super.render(opts);
660
+ if (this.catch)
661
+ code += this.catch.render(opts);
662
+ if (this.finally)
663
+ code += this.finally.render(opts);
664
+ return code;
665
+ }
666
+ optimizeNodes() {
667
+ var _a, _b;
668
+ super.optimizeNodes();
669
+ (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes();
670
+ (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
671
+ return this;
672
+ }
673
+ optimizeNames(names, constants) {
674
+ var _a, _b;
675
+ super.optimizeNames(names, constants);
676
+ (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
677
+ (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
678
+ return this;
679
+ }
680
+ get names() {
681
+ const names = super.names;
682
+ if (this.catch)
683
+ addNames(names, this.catch.names);
684
+ if (this.finally)
685
+ addNames(names, this.finally.names);
686
+ return names;
687
+ }
688
+ };
689
+ var Catch = class extends BlockNode {
690
+ constructor(error) {
691
+ super();
692
+ this.error = error;
693
+ }
694
+ render(opts) {
695
+ return `catch(${this.error})` + super.render(opts);
696
+ }
697
+ };
698
+ Catch.kind = "catch";
699
+ var Finally = class extends BlockNode {
700
+ render(opts) {
701
+ return "finally" + super.render(opts);
702
+ }
703
+ };
704
+ Finally.kind = "finally";
705
+ var CodeGen = class {
706
+ constructor(extScope, opts = {}) {
707
+ this._values = {};
708
+ this._blockStarts = [];
709
+ this._constants = {};
710
+ this.opts = { ...opts, _n: opts.lines ? "\n" : "" };
711
+ this._extScope = extScope;
712
+ this._scope = new scope_1.Scope({ parent: extScope });
713
+ this._nodes = [new Root()];
714
+ }
715
+ toString() {
716
+ return this._root.render(this.opts);
717
+ }
718
+ // returns unique name in the internal scope
719
+ name(prefix) {
720
+ return this._scope.name(prefix);
721
+ }
722
+ // reserves unique name in the external scope
723
+ scopeName(prefix) {
724
+ return this._extScope.name(prefix);
725
+ }
726
+ // reserves unique name in the external scope and assigns value to it
727
+ scopeValue(prefixOrName, value) {
728
+ const name = this._extScope.value(prefixOrName, value);
729
+ const vs = this._values[name.prefix] || (this._values[name.prefix] = /* @__PURE__ */ new Set());
730
+ vs.add(name);
731
+ return name;
732
+ }
733
+ getScopeValue(prefix, keyOrRef) {
734
+ return this._extScope.getValue(prefix, keyOrRef);
735
+ }
736
+ // return code that assigns values in the external scope to the names that are used internally
737
+ // (same names that were returned by gen.scopeName or gen.scopeValue)
738
+ scopeRefs(scopeName) {
739
+ return this._extScope.scopeRefs(scopeName, this._values);
740
+ }
741
+ scopeCode() {
742
+ return this._extScope.scopeCode(this._values);
743
+ }
744
+ _def(varKind, nameOrPrefix, rhs, constant) {
745
+ const name = this._scope.toName(nameOrPrefix);
746
+ if (rhs !== void 0 && constant)
747
+ this._constants[name.str] = rhs;
748
+ this._leafNode(new Def(varKind, name, rhs));
749
+ return name;
750
+ }
751
+ // `const` declaration (`var` in es5 mode)
752
+ const(nameOrPrefix, rhs, _constant) {
753
+ return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant);
754
+ }
755
+ // `let` declaration with optional assignment (`var` in es5 mode)
756
+ let(nameOrPrefix, rhs, _constant) {
757
+ return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant);
758
+ }
759
+ // `var` declaration with optional assignment
760
+ var(nameOrPrefix, rhs, _constant) {
761
+ return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant);
762
+ }
763
+ // assignment code
764
+ assign(lhs, rhs, sideEffects) {
765
+ return this._leafNode(new Assign(lhs, rhs, sideEffects));
766
+ }
767
+ // `+=` code
768
+ add(lhs, rhs) {
769
+ return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs));
770
+ }
771
+ // appends passed SafeExpr to code or executes Block
772
+ code(c) {
773
+ if (typeof c == "function")
774
+ c();
775
+ else if (c !== code_1.nil)
776
+ this._leafNode(new AnyCode(c));
777
+ return this;
778
+ }
779
+ // returns code for object literal for the passed argument list of key-value pairs
780
+ object(...keyValues) {
781
+ const code = ["{"];
782
+ for (const [key, value] of keyValues) {
783
+ if (code.length > 1)
784
+ code.push(",");
785
+ code.push(key);
786
+ if (key !== value || this.opts.es5) {
787
+ code.push(":");
788
+ (0, code_1.addCodeArg)(code, value);
789
+ }
790
+ }
791
+ code.push("}");
792
+ return new code_1._Code(code);
793
+ }
794
+ // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
795
+ if(condition, thenBody, elseBody) {
796
+ this._blockNode(new If(condition));
797
+ if (thenBody && elseBody) {
798
+ this.code(thenBody).else().code(elseBody).endIf();
799
+ } else if (thenBody) {
800
+ this.code(thenBody).endIf();
801
+ } else if (elseBody) {
802
+ throw new Error('CodeGen: "else" body without "then" body');
803
+ }
804
+ return this;
805
+ }
806
+ // `else if` clause - invalid without `if` or after `else` clauses
807
+ elseIf(condition) {
808
+ return this._elseNode(new If(condition));
809
+ }
810
+ // `else` clause - only valid after `if` or `else if` clauses
811
+ else() {
812
+ return this._elseNode(new Else());
813
+ }
814
+ // end `if` statement (needed if gen.if was used only with condition)
815
+ endIf() {
816
+ return this._endBlockNode(If, Else);
817
+ }
818
+ _for(node, forBody) {
819
+ this._blockNode(node);
820
+ if (forBody)
821
+ this.code(forBody).endFor();
822
+ return this;
823
+ }
824
+ // a generic `for` clause (or statement if `forBody` is passed)
825
+ for(iteration, forBody) {
826
+ return this._for(new ForLoop(iteration), forBody);
827
+ }
828
+ // `for` statement for a range of values
829
+ forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
830
+ const name = this._scope.toName(nameOrPrefix);
831
+ return this._for(new ForRange(varKind, name, from, to), () => forBody(name));
832
+ }
833
+ // `for-of` statement (in es5 mode replace with a normal for loop)
834
+ forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
835
+ const name = this._scope.toName(nameOrPrefix);
836
+ if (this.opts.es5) {
837
+ const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable);
838
+ return this.forRange("_i", 0, (0, code_1._)`${arr}.length`, (i) => {
839
+ this.var(name, (0, code_1._)`${arr}[${i}]`);
840
+ forBody(name);
841
+ });
842
+ }
843
+ return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name));
844
+ }
845
+ // `for-in` statement.
846
+ // With option `ownProperties` replaced with a `for-of` loop for object keys
847
+ forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) {
848
+ if (this.opts.ownProperties) {
849
+ return this.forOf(nameOrPrefix, (0, code_1._)`Object.keys(${obj})`, forBody);
850
+ }
851
+ const name = this._scope.toName(nameOrPrefix);
852
+ return this._for(new ForIter("in", varKind, name, obj), () => forBody(name));
853
+ }
854
+ // end `for` loop
855
+ endFor() {
856
+ return this._endBlockNode(For);
857
+ }
858
+ // `label` statement
859
+ label(label) {
860
+ return this._leafNode(new Label(label));
861
+ }
862
+ // `break` statement
863
+ break(label) {
864
+ return this._leafNode(new Break(label));
865
+ }
866
+ // `return` statement
867
+ return(value) {
868
+ const node = new Return();
869
+ this._blockNode(node);
870
+ this.code(value);
871
+ if (node.nodes.length !== 1)
872
+ throw new Error('CodeGen: "return" should have one node');
873
+ return this._endBlockNode(Return);
874
+ }
875
+ // `try` statement
876
+ try(tryBody, catchCode, finallyCode) {
877
+ if (!catchCode && !finallyCode)
878
+ throw new Error('CodeGen: "try" without "catch" and "finally"');
879
+ const node = new Try();
880
+ this._blockNode(node);
881
+ this.code(tryBody);
882
+ if (catchCode) {
883
+ const error = this.name("e");
884
+ this._currNode = node.catch = new Catch(error);
885
+ catchCode(error);
886
+ }
887
+ if (finallyCode) {
888
+ this._currNode = node.finally = new Finally();
889
+ this.code(finallyCode);
890
+ }
891
+ return this._endBlockNode(Catch, Finally);
892
+ }
893
+ // `throw` statement
894
+ throw(error) {
895
+ return this._leafNode(new Throw(error));
896
+ }
897
+ // start self-balancing block
898
+ block(body, nodeCount) {
899
+ this._blockStarts.push(this._nodes.length);
900
+ if (body)
901
+ this.code(body).endBlock(nodeCount);
902
+ return this;
903
+ }
904
+ // end the current self-balancing block
905
+ endBlock(nodeCount) {
906
+ const len = this._blockStarts.pop();
907
+ if (len === void 0)
908
+ throw new Error("CodeGen: not in self-balancing block");
909
+ const toClose = this._nodes.length - len;
910
+ if (toClose < 0 || nodeCount !== void 0 && toClose !== nodeCount) {
911
+ throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`);
912
+ }
913
+ this._nodes.length = len;
914
+ return this;
915
+ }
916
+ // `function` heading (or definition if funcBody is passed)
917
+ func(name, args = code_1.nil, async, funcBody) {
918
+ this._blockNode(new Func(name, args, async));
919
+ if (funcBody)
920
+ this.code(funcBody).endFunc();
921
+ return this;
922
+ }
923
+ // end function definition
924
+ endFunc() {
925
+ return this._endBlockNode(Func);
926
+ }
927
+ optimize(n = 1) {
928
+ while (n-- > 0) {
929
+ this._root.optimizeNodes();
930
+ this._root.optimizeNames(this._root.names, this._constants);
931
+ }
932
+ }
933
+ _leafNode(node) {
934
+ this._currNode.nodes.push(node);
935
+ return this;
936
+ }
937
+ _blockNode(node) {
938
+ this._currNode.nodes.push(node);
939
+ this._nodes.push(node);
940
+ }
941
+ _endBlockNode(N1, N2) {
942
+ const n = this._currNode;
943
+ if (n instanceof N1 || N2 && n instanceof N2) {
944
+ this._nodes.pop();
945
+ return this;
946
+ }
947
+ throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`);
948
+ }
949
+ _elseNode(node) {
950
+ const n = this._currNode;
951
+ if (!(n instanceof If)) {
952
+ throw new Error('CodeGen: "else" without "if"');
953
+ }
954
+ this._currNode = n.else = node;
955
+ return this;
956
+ }
957
+ get _root() {
958
+ return this._nodes[0];
959
+ }
960
+ get _currNode() {
961
+ const ns = this._nodes;
962
+ return ns[ns.length - 1];
963
+ }
964
+ set _currNode(node) {
965
+ const ns = this._nodes;
966
+ ns[ns.length - 1] = node;
967
+ }
968
+ };
969
+ exports.CodeGen = CodeGen;
970
+ function addNames(names, from) {
971
+ for (const n in from)
972
+ names[n] = (names[n] || 0) + (from[n] || 0);
973
+ return names;
974
+ }
975
+ function addExprNames(names, from) {
976
+ return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
977
+ }
978
+ function optimizeExpr(expr, names, constants) {
979
+ if (expr instanceof code_1.Name)
980
+ return replaceName(expr);
981
+ if (!canOptimize(expr))
982
+ return expr;
983
+ return new code_1._Code(expr._items.reduce((items, c) => {
984
+ if (c instanceof code_1.Name)
985
+ c = replaceName(c);
986
+ if (c instanceof code_1._Code)
987
+ items.push(...c._items);
988
+ else
989
+ items.push(c);
990
+ return items;
991
+ }, []));
992
+ function replaceName(n) {
993
+ const c = constants[n.str];
994
+ if (c === void 0 || names[n.str] !== 1)
995
+ return n;
996
+ delete names[n.str];
997
+ return c;
998
+ }
999
+ function canOptimize(e) {
1000
+ return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== void 0);
1001
+ }
1002
+ }
1003
+ function subtractNames(names, from) {
1004
+ for (const n in from)
1005
+ names[n] = (names[n] || 0) - (from[n] || 0);
1006
+ }
1007
+ function not(x) {
1008
+ return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._)`!${par(x)}`;
1009
+ }
1010
+ exports.not = not;
1011
+ var andCode = mappend(exports.operators.AND);
1012
+ function and(...args) {
1013
+ return args.reduce(andCode);
1014
+ }
1015
+ exports.and = and;
1016
+ var orCode = mappend(exports.operators.OR);
1017
+ function or(...args) {
1018
+ return args.reduce(orCode);
1019
+ }
1020
+ exports.or = or;
1021
+ function mappend(op) {
1022
+ return (x, y) => x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._)`${par(x)} ${op} ${par(y)}`;
1023
+ }
1024
+ function par(x) {
1025
+ return x instanceof code_1.Name ? x : (0, code_1._)`(${x})`;
1026
+ }
1027
+ }
1028
+ });
1029
+
1030
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/util.js
1031
+ var require_util = __commonJS({
1032
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/util.js"(exports) {
1033
+ "use strict";
1034
+ Object.defineProperty(exports, "__esModule", { value: true });
1035
+ exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0;
1036
+ var codegen_1 = require_codegen();
1037
+ var code_1 = require_code();
1038
+ function toHash(arr) {
1039
+ const hash = {};
1040
+ for (const item of arr)
1041
+ hash[item] = true;
1042
+ return hash;
1043
+ }
1044
+ exports.toHash = toHash;
1045
+ function alwaysValidSchema(it, schema) {
1046
+ if (typeof schema == "boolean")
1047
+ return schema;
1048
+ if (Object.keys(schema).length === 0)
1049
+ return true;
1050
+ checkUnknownRules(it, schema);
1051
+ return !schemaHasRules(schema, it.self.RULES.all);
1052
+ }
1053
+ exports.alwaysValidSchema = alwaysValidSchema;
1054
+ function checkUnknownRules(it, schema = it.schema) {
1055
+ const { opts, self } = it;
1056
+ if (!opts.strictSchema)
1057
+ return;
1058
+ if (typeof schema === "boolean")
1059
+ return;
1060
+ const rules = self.RULES.keywords;
1061
+ for (const key in schema) {
1062
+ if (!rules[key])
1063
+ checkStrictMode(it, `unknown keyword: "${key}"`);
1064
+ }
1065
+ }
1066
+ exports.checkUnknownRules = checkUnknownRules;
1067
+ function schemaHasRules(schema, rules) {
1068
+ if (typeof schema == "boolean")
1069
+ return !schema;
1070
+ for (const key in schema)
1071
+ if (rules[key])
1072
+ return true;
1073
+ return false;
1074
+ }
1075
+ exports.schemaHasRules = schemaHasRules;
1076
+ function schemaHasRulesButRef(schema, RULES) {
1077
+ if (typeof schema == "boolean")
1078
+ return !schema;
1079
+ for (const key in schema)
1080
+ if (key !== "$ref" && RULES.all[key])
1081
+ return true;
1082
+ return false;
1083
+ }
1084
+ exports.schemaHasRulesButRef = schemaHasRulesButRef;
1085
+ function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) {
1086
+ if (!$data) {
1087
+ if (typeof schema == "number" || typeof schema == "boolean")
1088
+ return schema;
1089
+ if (typeof schema == "string")
1090
+ return (0, codegen_1._)`${schema}`;
1091
+ }
1092
+ return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
1093
+ }
1094
+ exports.schemaRefOrVal = schemaRefOrVal;
1095
+ function unescapeFragment(str) {
1096
+ return unescapeJsonPointer(decodeURIComponent(str));
1097
+ }
1098
+ exports.unescapeFragment = unescapeFragment;
1099
+ function escapeFragment(str) {
1100
+ return encodeURIComponent(escapeJsonPointer(str));
1101
+ }
1102
+ exports.escapeFragment = escapeFragment;
1103
+ function escapeJsonPointer(str) {
1104
+ if (typeof str == "number")
1105
+ return `${str}`;
1106
+ return str.replace(/~/g, "~0").replace(/\//g, "~1");
1107
+ }
1108
+ exports.escapeJsonPointer = escapeJsonPointer;
1109
+ function unescapeJsonPointer(str) {
1110
+ return str.replace(/~1/g, "/").replace(/~0/g, "~");
1111
+ }
1112
+ exports.unescapeJsonPointer = unescapeJsonPointer;
1113
+ function eachItem(xs, f) {
1114
+ if (Array.isArray(xs)) {
1115
+ for (const x of xs)
1116
+ f(x);
1117
+ } else {
1118
+ f(xs);
1119
+ }
1120
+ }
1121
+ exports.eachItem = eachItem;
1122
+ function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName }) {
1123
+ return (gen, from, to, toName) => {
1124
+ const res = to === void 0 ? from : to instanceof codegen_1.Name ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1.Name ? (mergeToName(gen, to, from), from) : mergeValues(from, to);
1125
+ return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res;
1126
+ };
1127
+ }
1128
+ exports.mergeEvaluated = {
1129
+ props: makeMergeEvaluated({
1130
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true && ${from} !== undefined`, () => {
1131
+ gen.if((0, codegen_1._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._)`${to} || {}`).code((0, codegen_1._)`Object.assign(${to}, ${from})`));
1132
+ }),
1133
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true`, () => {
1134
+ if (from === true) {
1135
+ gen.assign(to, true);
1136
+ } else {
1137
+ gen.assign(to, (0, codegen_1._)`${to} || {}`);
1138
+ setEvaluated(gen, to, from);
1139
+ }
1140
+ }),
1141
+ mergeValues: (from, to) => from === true ? true : { ...from, ...to },
1142
+ resultToName: evaluatedPropsToName
1143
+ }),
1144
+ items: makeMergeEvaluated({
1145
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
1146
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._)`${to} > ${from} ? ${to} : ${from}`)),
1147
+ mergeValues: (from, to) => from === true ? true : Math.max(from, to),
1148
+ resultToName: (gen, items) => gen.var("items", items)
1149
+ })
1150
+ };
1151
+ function evaluatedPropsToName(gen, ps) {
1152
+ if (ps === true)
1153
+ return gen.var("props", true);
1154
+ const props = gen.var("props", (0, codegen_1._)`{}`);
1155
+ if (ps !== void 0)
1156
+ setEvaluated(gen, props, ps);
1157
+ return props;
1158
+ }
1159
+ exports.evaluatedPropsToName = evaluatedPropsToName;
1160
+ function setEvaluated(gen, props, ps) {
1161
+ Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._)`${props}${(0, codegen_1.getProperty)(p)}`, true));
1162
+ }
1163
+ exports.setEvaluated = setEvaluated;
1164
+ var snippets = {};
1165
+ function useFunc(gen, f) {
1166
+ return gen.scopeValue("func", {
1167
+ ref: f,
1168
+ code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code))
1169
+ });
1170
+ }
1171
+ exports.useFunc = useFunc;
1172
+ var Type;
1173
+ (function(Type2) {
1174
+ Type2[Type2["Num"] = 0] = "Num";
1175
+ Type2[Type2["Str"] = 1] = "Str";
1176
+ })(Type || (exports.Type = Type = {}));
1177
+ function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
1178
+ if (dataProp instanceof codegen_1.Name) {
1179
+ const isNumber = dataPropType === Type.Num;
1180
+ return jsPropertySyntax ? isNumber ? (0, codegen_1._)`"[" + ${dataProp} + "]"` : (0, codegen_1._)`"['" + ${dataProp} + "']"` : isNumber ? (0, codegen_1._)`"/" + ${dataProp}` : (0, codegen_1._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
1181
+ }
1182
+ return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
1183
+ }
1184
+ exports.getErrorPath = getErrorPath;
1185
+ function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
1186
+ if (!mode)
1187
+ return;
1188
+ msg = `strict mode: ${msg}`;
1189
+ if (mode === true)
1190
+ throw new Error(msg);
1191
+ it.self.logger.warn(msg);
1192
+ }
1193
+ exports.checkStrictMode = checkStrictMode;
1194
+ }
1195
+ });
1196
+
1197
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/names.js
1198
+ var require_names = __commonJS({
1199
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/names.js"(exports) {
1200
+ "use strict";
1201
+ Object.defineProperty(exports, "__esModule", { value: true });
1202
+ var codegen_1 = require_codegen();
1203
+ var names = {
1204
+ // validation function arguments
1205
+ data: new codegen_1.Name("data"),
1206
+ // data passed to validation function
1207
+ // args passed from referencing schema
1208
+ valCxt: new codegen_1.Name("valCxt"),
1209
+ // validation/data context - should not be used directly, it is destructured to the names below
1210
+ instancePath: new codegen_1.Name("instancePath"),
1211
+ parentData: new codegen_1.Name("parentData"),
1212
+ parentDataProperty: new codegen_1.Name("parentDataProperty"),
1213
+ rootData: new codegen_1.Name("rootData"),
1214
+ // root data - same as the data passed to the first/top validation function
1215
+ dynamicAnchors: new codegen_1.Name("dynamicAnchors"),
1216
+ // used to support recursiveRef and dynamicRef
1217
+ // function scoped variables
1218
+ vErrors: new codegen_1.Name("vErrors"),
1219
+ // null or array of validation errors
1220
+ errors: new codegen_1.Name("errors"),
1221
+ // counter of validation errors
1222
+ this: new codegen_1.Name("this"),
1223
+ // "globals"
1224
+ self: new codegen_1.Name("self"),
1225
+ scope: new codegen_1.Name("scope"),
1226
+ // JTD serialize/parse name for JSON string and position
1227
+ json: new codegen_1.Name("json"),
1228
+ jsonPos: new codegen_1.Name("jsonPos"),
1229
+ jsonLen: new codegen_1.Name("jsonLen"),
1230
+ jsonPart: new codegen_1.Name("jsonPart")
1231
+ };
1232
+ exports.default = names;
1233
+ }
1234
+ });
1235
+
1236
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js
1237
+ var require_errors = __commonJS({
1238
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js"(exports) {
1239
+ "use strict";
1240
+ Object.defineProperty(exports, "__esModule", { value: true });
1241
+ exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
1242
+ var codegen_1 = require_codegen();
1243
+ var util_1 = require_util();
1244
+ var names_1 = require_names();
1245
+ exports.keywordError = {
1246
+ message: ({ keyword }) => (0, codegen_1.str)`must pass "${keyword}" keyword validation`
1247
+ };
1248
+ exports.keyword$DataError = {
1249
+ message: ({ keyword, schemaType }) => schemaType ? (0, codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)`
1250
+ };
1251
+ function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) {
1252
+ const { it } = cxt;
1253
+ const { gen, compositeRule, allErrors } = it;
1254
+ const errObj = errorObjectCode(cxt, error, errorPaths);
1255
+ if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : compositeRule || allErrors) {
1256
+ addError(gen, errObj);
1257
+ } else {
1258
+ returnErrors(it, (0, codegen_1._)`[${errObj}]`);
1259
+ }
1260
+ }
1261
+ exports.reportError = reportError;
1262
+ function reportExtraError(cxt, error = exports.keywordError, errorPaths) {
1263
+ const { it } = cxt;
1264
+ const { gen, compositeRule, allErrors } = it;
1265
+ const errObj = errorObjectCode(cxt, error, errorPaths);
1266
+ addError(gen, errObj);
1267
+ if (!(compositeRule || allErrors)) {
1268
+ returnErrors(it, names_1.default.vErrors);
1269
+ }
1270
+ }
1271
+ exports.reportExtraError = reportExtraError;
1272
+ function resetErrorsCount(gen, errsCount) {
1273
+ gen.assign(names_1.default.errors, errsCount);
1274
+ gen.if((0, codegen_1._)`${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._)`${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null)));
1275
+ }
1276
+ exports.resetErrorsCount = resetErrorsCount;
1277
+ function extendErrors({ gen, keyword, schemaValue, data, errsCount, it }) {
1278
+ if (errsCount === void 0)
1279
+ throw new Error("ajv implementation error");
1280
+ const err = gen.name("err");
1281
+ gen.forRange("i", errsCount, names_1.default.errors, (i) => {
1282
+ gen.const(err, (0, codegen_1._)`${names_1.default.vErrors}[${i}]`);
1283
+ gen.if((0, codegen_1._)`${err}.instancePath === undefined`, () => gen.assign((0, codegen_1._)`${err}.instancePath`, (0, codegen_1.strConcat)(names_1.default.instancePath, it.errorPath)));
1284
+ gen.assign((0, codegen_1._)`${err}.schemaPath`, (0, codegen_1.str)`${it.errSchemaPath}/${keyword}`);
1285
+ if (it.opts.verbose) {
1286
+ gen.assign((0, codegen_1._)`${err}.schema`, schemaValue);
1287
+ gen.assign((0, codegen_1._)`${err}.data`, data);
1288
+ }
1289
+ });
1290
+ }
1291
+ exports.extendErrors = extendErrors;
1292
+ function addError(gen, errObj) {
1293
+ const err = gen.const("err", errObj);
1294
+ gen.if((0, codegen_1._)`${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._)`[${err}]`), (0, codegen_1._)`${names_1.default.vErrors}.push(${err})`);
1295
+ gen.code((0, codegen_1._)`${names_1.default.errors}++`);
1296
+ }
1297
+ function returnErrors(it, errs) {
1298
+ const { gen, validateName, schemaEnv } = it;
1299
+ if (schemaEnv.$async) {
1300
+ gen.throw((0, codegen_1._)`new ${it.ValidationError}(${errs})`);
1301
+ } else {
1302
+ gen.assign((0, codegen_1._)`${validateName}.errors`, errs);
1303
+ gen.return(false);
1304
+ }
1305
+ }
1306
+ var E = {
1307
+ keyword: new codegen_1.Name("keyword"),
1308
+ schemaPath: new codegen_1.Name("schemaPath"),
1309
+ // also used in JTD errors
1310
+ params: new codegen_1.Name("params"),
1311
+ propertyName: new codegen_1.Name("propertyName"),
1312
+ message: new codegen_1.Name("message"),
1313
+ schema: new codegen_1.Name("schema"),
1314
+ parentSchema: new codegen_1.Name("parentSchema")
1315
+ };
1316
+ function errorObjectCode(cxt, error, errorPaths) {
1317
+ const { createErrors } = cxt.it;
1318
+ if (createErrors === false)
1319
+ return (0, codegen_1._)`{}`;
1320
+ return errorObject(cxt, error, errorPaths);
1321
+ }
1322
+ function errorObject(cxt, error, errorPaths = {}) {
1323
+ const { gen, it } = cxt;
1324
+ const keyValues = [
1325
+ errorInstancePath(it, errorPaths),
1326
+ errorSchemaPath(cxt, errorPaths)
1327
+ ];
1328
+ extraErrorProps(cxt, error, keyValues);
1329
+ return gen.object(...keyValues);
1330
+ }
1331
+ function errorInstancePath({ errorPath }, { instancePath }) {
1332
+ const instPath = instancePath ? (0, codegen_1.str)`${errorPath}${(0, util_1.getErrorPath)(instancePath, util_1.Type.Str)}` : errorPath;
1333
+ return [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, instPath)];
1334
+ }
1335
+ function errorSchemaPath({ keyword, it: { errSchemaPath } }, { schemaPath, parentSchema }) {
1336
+ let schPath = parentSchema ? errSchemaPath : (0, codegen_1.str)`${errSchemaPath}/${keyword}`;
1337
+ if (schemaPath) {
1338
+ schPath = (0, codegen_1.str)`${schPath}${(0, util_1.getErrorPath)(schemaPath, util_1.Type.Str)}`;
1339
+ }
1340
+ return [E.schemaPath, schPath];
1341
+ }
1342
+ function extraErrorProps(cxt, { params, message }, keyValues) {
1343
+ const { keyword, data, schemaValue, it } = cxt;
1344
+ const { opts, propertyName, topSchemaRef, schemaPath } = it;
1345
+ keyValues.push([E.keyword, keyword], [E.params, typeof params == "function" ? params(cxt) : params || (0, codegen_1._)`{}`]);
1346
+ if (opts.messages) {
1347
+ keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]);
1348
+ }
1349
+ if (opts.verbose) {
1350
+ keyValues.push([E.schema, schemaValue], [E.parentSchema, (0, codegen_1._)`${topSchemaRef}${schemaPath}`], [names_1.default.data, data]);
1351
+ }
1352
+ if (propertyName)
1353
+ keyValues.push([E.propertyName, propertyName]);
1354
+ }
1355
+ }
1356
+ });
1357
+
1358
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js
1359
+ var require_boolSchema = __commonJS({
1360
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js"(exports) {
1361
+ "use strict";
1362
+ Object.defineProperty(exports, "__esModule", { value: true });
1363
+ exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0;
1364
+ var errors_1 = require_errors();
1365
+ var codegen_1 = require_codegen();
1366
+ var names_1 = require_names();
1367
+ var boolError = {
1368
+ message: "boolean schema is false"
1369
+ };
1370
+ function topBoolOrEmptySchema(it) {
1371
+ const { gen, schema, validateName } = it;
1372
+ if (schema === false) {
1373
+ falseSchemaError(it, false);
1374
+ } else if (typeof schema == "object" && schema.$async === true) {
1375
+ gen.return(names_1.default.data);
1376
+ } else {
1377
+ gen.assign((0, codegen_1._)`${validateName}.errors`, null);
1378
+ gen.return(true);
1379
+ }
1380
+ }
1381
+ exports.topBoolOrEmptySchema = topBoolOrEmptySchema;
1382
+ function boolOrEmptySchema(it, valid) {
1383
+ const { gen, schema } = it;
1384
+ if (schema === false) {
1385
+ gen.var(valid, false);
1386
+ falseSchemaError(it);
1387
+ } else {
1388
+ gen.var(valid, true);
1389
+ }
1390
+ }
1391
+ exports.boolOrEmptySchema = boolOrEmptySchema;
1392
+ function falseSchemaError(it, overrideAllErrors) {
1393
+ const { gen, data } = it;
1394
+ const cxt = {
1395
+ gen,
1396
+ keyword: "false schema",
1397
+ data,
1398
+ schema: false,
1399
+ schemaCode: false,
1400
+ schemaValue: false,
1401
+ params: {},
1402
+ it
1403
+ };
1404
+ (0, errors_1.reportError)(cxt, boolError, void 0, overrideAllErrors);
1405
+ }
1406
+ }
1407
+ });
1408
+
1409
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js
1410
+ var require_rules = __commonJS({
1411
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js"(exports) {
1412
+ "use strict";
1413
+ Object.defineProperty(exports, "__esModule", { value: true });
1414
+ exports.getRules = exports.isJSONType = void 0;
1415
+ var _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"];
1416
+ var jsonTypes = new Set(_jsonTypes);
1417
+ function isJSONType(x) {
1418
+ return typeof x == "string" && jsonTypes.has(x);
1419
+ }
1420
+ exports.isJSONType = isJSONType;
1421
+ function getRules() {
1422
+ const groups = {
1423
+ number: { type: "number", rules: [] },
1424
+ string: { type: "string", rules: [] },
1425
+ array: { type: "array", rules: [] },
1426
+ object: { type: "object", rules: [] }
1427
+ };
1428
+ return {
1429
+ types: { ...groups, integer: true, boolean: true, null: true },
1430
+ rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object],
1431
+ post: { rules: [] },
1432
+ all: {},
1433
+ keywords: {}
1434
+ };
1435
+ }
1436
+ exports.getRules = getRules;
1437
+ }
1438
+ });
1439
+
1440
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js
1441
+ var require_applicability = __commonJS({
1442
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js"(exports) {
1443
+ "use strict";
1444
+ Object.defineProperty(exports, "__esModule", { value: true });
1445
+ exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;
1446
+ function schemaHasRulesForType({ schema, self }, type) {
1447
+ const group = self.RULES.types[type];
1448
+ return group && group !== true && shouldUseGroup(schema, group);
1449
+ }
1450
+ exports.schemaHasRulesForType = schemaHasRulesForType;
1451
+ function shouldUseGroup(schema, group) {
1452
+ return group.rules.some((rule) => shouldUseRule(schema, rule));
1453
+ }
1454
+ exports.shouldUseGroup = shouldUseGroup;
1455
+ function shouldUseRule(schema, rule) {
1456
+ var _a;
1457
+ return schema[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== void 0));
1458
+ }
1459
+ exports.shouldUseRule = shouldUseRule;
1460
+ }
1461
+ });
1462
+
1463
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js
1464
+ var require_dataType = __commonJS({
1465
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js"(exports) {
1466
+ "use strict";
1467
+ Object.defineProperty(exports, "__esModule", { value: true });
1468
+ exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0;
1469
+ var rules_1 = require_rules();
1470
+ var applicability_1 = require_applicability();
1471
+ var errors_1 = require_errors();
1472
+ var codegen_1 = require_codegen();
1473
+ var util_1 = require_util();
1474
+ var DataType;
1475
+ (function(DataType2) {
1476
+ DataType2[DataType2["Correct"] = 0] = "Correct";
1477
+ DataType2[DataType2["Wrong"] = 1] = "Wrong";
1478
+ })(DataType || (exports.DataType = DataType = {}));
1479
+ function getSchemaTypes(schema) {
1480
+ const types = getJSONTypes(schema.type);
1481
+ const hasNull = types.includes("null");
1482
+ if (hasNull) {
1483
+ if (schema.nullable === false)
1484
+ throw new Error("type: null contradicts nullable: false");
1485
+ } else {
1486
+ if (!types.length && schema.nullable !== void 0) {
1487
+ throw new Error('"nullable" cannot be used without "type"');
1488
+ }
1489
+ if (schema.nullable === true)
1490
+ types.push("null");
1491
+ }
1492
+ return types;
1493
+ }
1494
+ exports.getSchemaTypes = getSchemaTypes;
1495
+ function getJSONTypes(ts) {
1496
+ const types = Array.isArray(ts) ? ts : ts ? [ts] : [];
1497
+ if (types.every(rules_1.isJSONType))
1498
+ return types;
1499
+ throw new Error("type must be JSONType or JSONType[]: " + types.join(","));
1500
+ }
1501
+ exports.getJSONTypes = getJSONTypes;
1502
+ function coerceAndCheckDataType(it, types) {
1503
+ const { gen, data, opts } = it;
1504
+ const coerceTo = coerceToTypes(types, opts.coerceTypes);
1505
+ const checkTypes = types.length > 0 && !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0]));
1506
+ if (checkTypes) {
1507
+ const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong);
1508
+ gen.if(wrongType, () => {
1509
+ if (coerceTo.length)
1510
+ coerceData(it, types, coerceTo);
1511
+ else
1512
+ reportTypeError(it);
1513
+ });
1514
+ }
1515
+ return checkTypes;
1516
+ }
1517
+ exports.coerceAndCheckDataType = coerceAndCheckDataType;
1518
+ var COERCIBLE = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
1519
+ function coerceToTypes(types, coerceTypes) {
1520
+ return coerceTypes ? types.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : [];
1521
+ }
1522
+ function coerceData(it, types, coerceTo) {
1523
+ const { gen, data, opts } = it;
1524
+ const dataType = gen.let("dataType", (0, codegen_1._)`typeof ${data}`);
1525
+ const coerced = gen.let("coerced", (0, codegen_1._)`undefined`);
1526
+ if (opts.coerceTypes === "array") {
1527
+ gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1._)`${data}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data}`).if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)));
1528
+ }
1529
+ gen.if((0, codegen_1._)`${coerced} !== undefined`);
1530
+ for (const t of coerceTo) {
1531
+ if (COERCIBLE.has(t) || t === "array" && opts.coerceTypes === "array") {
1532
+ coerceSpecificType(t);
1533
+ }
1534
+ }
1535
+ gen.else();
1536
+ reportTypeError(it);
1537
+ gen.endIf();
1538
+ gen.if((0, codegen_1._)`${coerced} !== undefined`, () => {
1539
+ gen.assign(data, coerced);
1540
+ assignParentData(it, coerced);
1541
+ });
1542
+ function coerceSpecificType(t) {
1543
+ switch (t) {
1544
+ case "string":
1545
+ gen.elseIf((0, codegen_1._)`${dataType} == "number" || ${dataType} == "boolean"`).assign(coerced, (0, codegen_1._)`"" + ${data}`).elseIf((0, codegen_1._)`${data} === null`).assign(coerced, (0, codegen_1._)`""`);
1546
+ return;
1547
+ case "number":
1548
+ gen.elseIf((0, codegen_1._)`${dataType} == "boolean" || ${data} === null
1549
+ || (${dataType} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1._)`+${data}`);
1550
+ return;
1551
+ case "integer":
1552
+ gen.elseIf((0, codegen_1._)`${dataType} === "boolean" || ${data} === null
1553
+ || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1._)`+${data}`);
1554
+ return;
1555
+ case "boolean":
1556
+ gen.elseIf((0, codegen_1._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
1557
+ return;
1558
+ case "null":
1559
+ gen.elseIf((0, codegen_1._)`${data} === "" || ${data} === 0 || ${data} === false`);
1560
+ gen.assign(coerced, null);
1561
+ return;
1562
+ case "array":
1563
+ gen.elseIf((0, codegen_1._)`${dataType} === "string" || ${dataType} === "number"
1564
+ || ${dataType} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1._)`[${data}]`);
1565
+ }
1566
+ }
1567
+ }
1568
+ function assignParentData({ gen, parentData, parentDataProperty }, expr) {
1569
+ gen.if((0, codegen_1._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1._)`${parentData}[${parentDataProperty}]`, expr));
1570
+ }
1571
+ function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
1572
+ const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
1573
+ let cond;
1574
+ switch (dataType) {
1575
+ case "null":
1576
+ return (0, codegen_1._)`${data} ${EQ} null`;
1577
+ case "array":
1578
+ cond = (0, codegen_1._)`Array.isArray(${data})`;
1579
+ break;
1580
+ case "object":
1581
+ cond = (0, codegen_1._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
1582
+ break;
1583
+ case "integer":
1584
+ cond = numCond((0, codegen_1._)`!(${data} % 1) && !isNaN(${data})`);
1585
+ break;
1586
+ case "number":
1587
+ cond = numCond();
1588
+ break;
1589
+ default:
1590
+ return (0, codegen_1._)`typeof ${data} ${EQ} ${dataType}`;
1591
+ }
1592
+ return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
1593
+ function numCond(_cond = codegen_1.nil) {
1594
+ return (0, codegen_1.and)((0, codegen_1._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._)`isFinite(${data})` : codegen_1.nil);
1595
+ }
1596
+ }
1597
+ exports.checkDataType = checkDataType;
1598
+ function checkDataTypes(dataTypes, data, strictNums, correct) {
1599
+ if (dataTypes.length === 1) {
1600
+ return checkDataType(dataTypes[0], data, strictNums, correct);
1601
+ }
1602
+ let cond;
1603
+ const types = (0, util_1.toHash)(dataTypes);
1604
+ if (types.array && types.object) {
1605
+ const notObj = (0, codegen_1._)`typeof ${data} != "object"`;
1606
+ cond = types.null ? notObj : (0, codegen_1._)`!${data} || ${notObj}`;
1607
+ delete types.null;
1608
+ delete types.array;
1609
+ delete types.object;
1610
+ } else {
1611
+ cond = codegen_1.nil;
1612
+ }
1613
+ if (types.number)
1614
+ delete types.integer;
1615
+ for (const t in types)
1616
+ cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));
1617
+ return cond;
1618
+ }
1619
+ exports.checkDataTypes = checkDataTypes;
1620
+ var typeError = {
1621
+ message: ({ schema }) => `must be ${schema}`,
1622
+ params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._)`{type: ${schema}}` : (0, codegen_1._)`{type: ${schemaValue}}`
1623
+ };
1624
+ function reportTypeError(it) {
1625
+ const cxt = getTypeErrorContext(it);
1626
+ (0, errors_1.reportError)(cxt, typeError);
1627
+ }
1628
+ exports.reportTypeError = reportTypeError;
1629
+ function getTypeErrorContext(it) {
1630
+ const { gen, data, schema } = it;
1631
+ const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type");
1632
+ return {
1633
+ gen,
1634
+ keyword: "type",
1635
+ data,
1636
+ schema: schema.type,
1637
+ schemaCode,
1638
+ schemaValue: schemaCode,
1639
+ parentSchema: schema,
1640
+ params: {},
1641
+ it
1642
+ };
1643
+ }
1644
+ }
1645
+ });
1646
+
1647
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js
1648
+ var require_defaults = __commonJS({
1649
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js"(exports) {
1650
+ "use strict";
1651
+ Object.defineProperty(exports, "__esModule", { value: true });
1652
+ exports.assignDefaults = void 0;
1653
+ var codegen_1 = require_codegen();
1654
+ var util_1 = require_util();
1655
+ function assignDefaults(it, ty) {
1656
+ const { properties, items } = it.schema;
1657
+ if (ty === "object" && properties) {
1658
+ for (const key in properties) {
1659
+ assignDefault(it, key, properties[key].default);
1660
+ }
1661
+ } else if (ty === "array" && Array.isArray(items)) {
1662
+ items.forEach((sch, i) => assignDefault(it, i, sch.default));
1663
+ }
1664
+ }
1665
+ exports.assignDefaults = assignDefaults;
1666
+ function assignDefault(it, prop, defaultValue) {
1667
+ const { gen, compositeRule, data, opts } = it;
1668
+ if (defaultValue === void 0)
1669
+ return;
1670
+ const childData = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(prop)}`;
1671
+ if (compositeRule) {
1672
+ (0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`);
1673
+ return;
1674
+ }
1675
+ let condition = (0, codegen_1._)`${childData} === undefined`;
1676
+ if (opts.useDefaults === "empty") {
1677
+ condition = (0, codegen_1._)`${condition} || ${childData} === null || ${childData} === ""`;
1678
+ }
1679
+ gen.if(condition, (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
1680
+ }
1681
+ }
1682
+ });
1683
+
1684
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js
1685
+ var require_code2 = __commonJS({
1686
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js"(exports) {
1687
+ "use strict";
1688
+ Object.defineProperty(exports, "__esModule", { value: true });
1689
+ exports.validateUnion = exports.validateArray = exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.isOwnProperty = exports.hasPropFunc = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = void 0;
1690
+ var codegen_1 = require_codegen();
1691
+ var util_1 = require_util();
1692
+ var names_1 = require_names();
1693
+ var util_2 = require_util();
1694
+ function checkReportMissingProp(cxt, prop) {
1695
+ const { gen, data, it } = cxt;
1696
+ gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
1697
+ cxt.setParams({ missingProperty: (0, codegen_1._)`${prop}` }, true);
1698
+ cxt.error();
1699
+ });
1700
+ }
1701
+ exports.checkReportMissingProp = checkReportMissingProp;
1702
+ function checkMissingProp({ gen, data, it: { opts } }, properties, missing) {
1703
+ return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._)`${missing} = ${prop}`)));
1704
+ }
1705
+ exports.checkMissingProp = checkMissingProp;
1706
+ function reportMissingProp(cxt, missing) {
1707
+ cxt.setParams({ missingProperty: missing }, true);
1708
+ cxt.error();
1709
+ }
1710
+ exports.reportMissingProp = reportMissingProp;
1711
+ function hasPropFunc(gen) {
1712
+ return gen.scopeValue("func", {
1713
+ // eslint-disable-next-line @typescript-eslint/unbound-method
1714
+ ref: Object.prototype.hasOwnProperty,
1715
+ code: (0, codegen_1._)`Object.prototype.hasOwnProperty`
1716
+ });
1717
+ }
1718
+ exports.hasPropFunc = hasPropFunc;
1719
+ function isOwnProperty(gen, data, property) {
1720
+ return (0, codegen_1._)`${hasPropFunc(gen)}.call(${data}, ${property})`;
1721
+ }
1722
+ exports.isOwnProperty = isOwnProperty;
1723
+ function propertyInData(gen, data, property, ownProperties) {
1724
+ const cond = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(property)} !== undefined`;
1725
+ return ownProperties ? (0, codegen_1._)`${cond} && ${isOwnProperty(gen, data, property)}` : cond;
1726
+ }
1727
+ exports.propertyInData = propertyInData;
1728
+ function noPropertyInData(gen, data, property, ownProperties) {
1729
+ const cond = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(property)} === undefined`;
1730
+ return ownProperties ? (0, codegen_1.or)(cond, (0, codegen_1.not)(isOwnProperty(gen, data, property))) : cond;
1731
+ }
1732
+ exports.noPropertyInData = noPropertyInData;
1733
+ function allSchemaProperties(schemaMap) {
1734
+ return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [];
1735
+ }
1736
+ exports.allSchemaProperties = allSchemaProperties;
1737
+ function schemaProperties(it, schemaMap) {
1738
+ return allSchemaProperties(schemaMap).filter((p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p]));
1739
+ }
1740
+ exports.schemaProperties = schemaProperties;
1741
+ function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
1742
+ const dataAndSchema = passSchema ? (0, codegen_1._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
1743
+ const valCxt = [
1744
+ [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, errorPath)],
1745
+ [names_1.default.parentData, it.parentData],
1746
+ [names_1.default.parentDataProperty, it.parentDataProperty],
1747
+ [names_1.default.rootData, names_1.default.rootData]
1748
+ ];
1749
+ if (it.opts.dynamicRef)
1750
+ valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]);
1751
+ const args = (0, codegen_1._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
1752
+ return context !== codegen_1.nil ? (0, codegen_1._)`${func}.call(${context}, ${args})` : (0, codegen_1._)`${func}(${args})`;
1753
+ }
1754
+ exports.callValidateCode = callValidateCode;
1755
+ var newRegExp = (0, codegen_1._)`new RegExp`;
1756
+ function usePattern({ gen, it: { opts } }, pattern) {
1757
+ const u = opts.unicodeRegExp ? "u" : "";
1758
+ const { regExp } = opts.code;
1759
+ const rx = regExp(pattern, u);
1760
+ return gen.scopeValue("pattern", {
1761
+ key: rx.toString(),
1762
+ ref: rx,
1763
+ code: (0, codegen_1._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})`
1764
+ });
1765
+ }
1766
+ exports.usePattern = usePattern;
1767
+ function validateArray(cxt) {
1768
+ const { gen, data, keyword, it } = cxt;
1769
+ const valid = gen.name("valid");
1770
+ if (it.allErrors) {
1771
+ const validArr = gen.let("valid", true);
1772
+ validateItems(() => gen.assign(validArr, false));
1773
+ return validArr;
1774
+ }
1775
+ gen.var(valid, true);
1776
+ validateItems(() => gen.break());
1777
+ return valid;
1778
+ function validateItems(notValid) {
1779
+ const len = gen.const("len", (0, codegen_1._)`${data}.length`);
1780
+ gen.forRange("i", 0, len, (i) => {
1781
+ cxt.subschema({
1782
+ keyword,
1783
+ dataProp: i,
1784
+ dataPropType: util_1.Type.Num
1785
+ }, valid);
1786
+ gen.if((0, codegen_1.not)(valid), notValid);
1787
+ });
1788
+ }
1789
+ }
1790
+ exports.validateArray = validateArray;
1791
+ function validateUnion(cxt) {
1792
+ const { gen, schema, keyword, it } = cxt;
1793
+ if (!Array.isArray(schema))
1794
+ throw new Error("ajv implementation error");
1795
+ const alwaysValid = schema.some((sch) => (0, util_1.alwaysValidSchema)(it, sch));
1796
+ if (alwaysValid && !it.opts.unevaluated)
1797
+ return;
1798
+ const valid = gen.let("valid", false);
1799
+ const schValid = gen.name("_valid");
1800
+ gen.block(() => schema.forEach((_sch, i) => {
1801
+ const schCxt = cxt.subschema({
1802
+ keyword,
1803
+ schemaProp: i,
1804
+ compositeRule: true
1805
+ }, schValid);
1806
+ gen.assign(valid, (0, codegen_1._)`${valid} || ${schValid}`);
1807
+ const merged = cxt.mergeValidEvaluated(schCxt, schValid);
1808
+ if (!merged)
1809
+ gen.if((0, codegen_1.not)(valid));
1810
+ }));
1811
+ cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
1812
+ }
1813
+ exports.validateUnion = validateUnion;
1814
+ }
1815
+ });
1816
+
1817
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js
1818
+ var require_keyword = __commonJS({
1819
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js"(exports) {
1820
+ "use strict";
1821
+ Object.defineProperty(exports, "__esModule", { value: true });
1822
+ exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = void 0;
1823
+ var codegen_1 = require_codegen();
1824
+ var names_1 = require_names();
1825
+ var code_1 = require_code2();
1826
+ var errors_1 = require_errors();
1827
+ function macroKeywordCode(cxt, def) {
1828
+ const { gen, keyword, schema, parentSchema, it } = cxt;
1829
+ const macroSchema = def.macro.call(it.self, schema, parentSchema, it);
1830
+ const schemaRef = useKeyword(gen, keyword, macroSchema);
1831
+ if (it.opts.validateSchema !== false)
1832
+ it.self.validateSchema(macroSchema, true);
1833
+ const valid = gen.name("valid");
1834
+ cxt.subschema({
1835
+ schema: macroSchema,
1836
+ schemaPath: codegen_1.nil,
1837
+ errSchemaPath: `${it.errSchemaPath}/${keyword}`,
1838
+ topSchemaRef: schemaRef,
1839
+ compositeRule: true
1840
+ }, valid);
1841
+ cxt.pass(valid, () => cxt.error(true));
1842
+ }
1843
+ exports.macroKeywordCode = macroKeywordCode;
1844
+ function funcKeywordCode(cxt, def) {
1845
+ var _a;
1846
+ const { gen, keyword, schema, parentSchema, $data, it } = cxt;
1847
+ checkAsyncKeyword(it, def);
1848
+ const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
1849
+ const validateRef = useKeyword(gen, keyword, validate);
1850
+ const valid = gen.let("valid");
1851
+ cxt.block$data(valid, validateKeyword);
1852
+ cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);
1853
+ function validateKeyword() {
1854
+ if (def.errors === false) {
1855
+ assignValid();
1856
+ if (def.modifying)
1857
+ modifyData(cxt);
1858
+ reportErrs(() => cxt.error());
1859
+ } else {
1860
+ const ruleErrs = def.async ? validateAsync() : validateSync();
1861
+ if (def.modifying)
1862
+ modifyData(cxt);
1863
+ reportErrs(() => addErrs(cxt, ruleErrs));
1864
+ }
1865
+ }
1866
+ function validateAsync() {
1867
+ const ruleErrs = gen.let("ruleErrs", null);
1868
+ gen.try(() => assignValid((0, codegen_1._)`await `), (e) => gen.assign(valid, false).if((0, codegen_1._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._)`${e}.errors`), () => gen.throw(e)));
1869
+ return ruleErrs;
1870
+ }
1871
+ function validateSync() {
1872
+ const validateErrs = (0, codegen_1._)`${validateRef}.errors`;
1873
+ gen.assign(validateErrs, null);
1874
+ assignValid(codegen_1.nil);
1875
+ return validateErrs;
1876
+ }
1877
+ function assignValid(_await = def.async ? (0, codegen_1._)`await ` : codegen_1.nil) {
1878
+ const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self;
1879
+ const passSchema = !("compile" in def && !$data || def.schema === false);
1880
+ gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
1881
+ }
1882
+ function reportErrs(errors) {
1883
+ var _a2;
1884
+ gen.if((0, codegen_1.not)((_a2 = def.valid) !== null && _a2 !== void 0 ? _a2 : valid), errors);
1885
+ }
1886
+ }
1887
+ exports.funcKeywordCode = funcKeywordCode;
1888
+ function modifyData(cxt) {
1889
+ const { gen, data, it } = cxt;
1890
+ gen.if(it.parentData, () => gen.assign(data, (0, codegen_1._)`${it.parentData}[${it.parentDataProperty}]`));
1891
+ }
1892
+ function addErrs(cxt, errs) {
1893
+ const { gen } = cxt;
1894
+ gen.if((0, codegen_1._)`Array.isArray(${errs})`, () => {
1895
+ gen.assign(names_1.default.vErrors, (0, codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`).assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
1896
+ (0, errors_1.extendErrors)(cxt);
1897
+ }, () => cxt.error());
1898
+ }
1899
+ function checkAsyncKeyword({ schemaEnv }, def) {
1900
+ if (def.async && !schemaEnv.$async)
1901
+ throw new Error("async keyword in sync schema");
1902
+ }
1903
+ function useKeyword(gen, keyword, result) {
1904
+ if (result === void 0)
1905
+ throw new Error(`keyword "${keyword}" failed to compile`);
1906
+ return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) });
1907
+ }
1908
+ function validSchemaType(schema, schemaType, allowUndefined = false) {
1909
+ return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema) : st === "object" ? schema && typeof schema == "object" && !Array.isArray(schema) : typeof schema == st || allowUndefined && typeof schema == "undefined");
1910
+ }
1911
+ exports.validSchemaType = validSchemaType;
1912
+ function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) {
1913
+ if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) {
1914
+ throw new Error("ajv implementation error");
1915
+ }
1916
+ const deps = def.dependencies;
1917
+ if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {
1918
+ throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`);
1919
+ }
1920
+ if (def.validateSchema) {
1921
+ const valid = def.validateSchema(schema[keyword]);
1922
+ if (!valid) {
1923
+ const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def.validateSchema.errors);
1924
+ if (opts.validateSchema === "log")
1925
+ self.logger.error(msg);
1926
+ else
1927
+ throw new Error(msg);
1928
+ }
1929
+ }
1930
+ }
1931
+ exports.validateKeywordUsage = validateKeywordUsage;
1932
+ }
1933
+ });
1934
+
1935
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js
1936
+ var require_subschema = __commonJS({
1937
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js"(exports) {
1938
+ "use strict";
1939
+ Object.defineProperty(exports, "__esModule", { value: true });
1940
+ exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0;
1941
+ var codegen_1 = require_codegen();
1942
+ var util_1 = require_util();
1943
+ function getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
1944
+ if (keyword !== void 0 && schema !== void 0) {
1945
+ throw new Error('both "keyword" and "schema" passed, only one allowed');
1946
+ }
1947
+ if (keyword !== void 0) {
1948
+ const sch = it.schema[keyword];
1949
+ return schemaProp === void 0 ? {
1950
+ schema: sch,
1951
+ schemaPath: (0, codegen_1._)`${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}`,
1952
+ errSchemaPath: `${it.errSchemaPath}/${keyword}`
1953
+ } : {
1954
+ schema: sch[schemaProp],
1955
+ schemaPath: (0, codegen_1._)`${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}${(0, codegen_1.getProperty)(schemaProp)}`,
1956
+ errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`
1957
+ };
1958
+ }
1959
+ if (schema !== void 0) {
1960
+ if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
1961
+ throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
1962
+ }
1963
+ return {
1964
+ schema,
1965
+ schemaPath,
1966
+ topSchemaRef,
1967
+ errSchemaPath
1968
+ };
1969
+ }
1970
+ throw new Error('either "keyword" or "schema" must be passed');
1971
+ }
1972
+ exports.getSubschema = getSubschema;
1973
+ function extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {
1974
+ if (data !== void 0 && dataProp !== void 0) {
1975
+ throw new Error('both "data" and "dataProp" passed, only one allowed');
1976
+ }
1977
+ const { gen } = it;
1978
+ if (dataProp !== void 0) {
1979
+ const { errorPath, dataPathArr, opts } = it;
1980
+ const nextData = gen.let("data", (0, codegen_1._)`${it.data}${(0, codegen_1.getProperty)(dataProp)}`, true);
1981
+ dataContextProps(nextData);
1982
+ subschema.errorPath = (0, codegen_1.str)`${errorPath}${(0, util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
1983
+ subschema.parentDataProperty = (0, codegen_1._)`${dataProp}`;
1984
+ subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty];
1985
+ }
1986
+ if (data !== void 0) {
1987
+ const nextData = data instanceof codegen_1.Name ? data : gen.let("data", data, true);
1988
+ dataContextProps(nextData);
1989
+ if (propertyName !== void 0)
1990
+ subschema.propertyName = propertyName;
1991
+ }
1992
+ if (dataTypes)
1993
+ subschema.dataTypes = dataTypes;
1994
+ function dataContextProps(_nextData) {
1995
+ subschema.data = _nextData;
1996
+ subschema.dataLevel = it.dataLevel + 1;
1997
+ subschema.dataTypes = [];
1998
+ it.definedProperties = /* @__PURE__ */ new Set();
1999
+ subschema.parentData = it.data;
2000
+ subschema.dataNames = [...it.dataNames, _nextData];
2001
+ }
2002
+ }
2003
+ exports.extendSubschemaData = extendSubschemaData;
2004
+ function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
2005
+ if (compositeRule !== void 0)
2006
+ subschema.compositeRule = compositeRule;
2007
+ if (createErrors !== void 0)
2008
+ subschema.createErrors = createErrors;
2009
+ if (allErrors !== void 0)
2010
+ subschema.allErrors = allErrors;
2011
+ subschema.jtdDiscriminator = jtdDiscriminator;
2012
+ subschema.jtdMetadata = jtdMetadata;
2013
+ }
2014
+ exports.extendSubschemaMode = extendSubschemaMode;
2015
+ }
2016
+ });
2017
+
2018
+ // ../../node_modules/.bun/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
2019
+ var require_fast_deep_equal = __commonJS({
2020
+ "../../node_modules/.bun/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports, module) {
2021
+ "use strict";
2022
+ module.exports = function equal(a, b) {
2023
+ if (a === b) return true;
2024
+ if (a && b && typeof a == "object" && typeof b == "object") {
2025
+ if (a.constructor !== b.constructor) return false;
2026
+ var length, i, keys;
2027
+ if (Array.isArray(a)) {
2028
+ length = a.length;
2029
+ if (length != b.length) return false;
2030
+ for (i = length; i-- !== 0; )
2031
+ if (!equal(a[i], b[i])) return false;
2032
+ return true;
2033
+ }
2034
+ if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
2035
+ if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
2036
+ if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
2037
+ keys = Object.keys(a);
2038
+ length = keys.length;
2039
+ if (length !== Object.keys(b).length) return false;
2040
+ for (i = length; i-- !== 0; )
2041
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
2042
+ for (i = length; i-- !== 0; ) {
2043
+ var key = keys[i];
2044
+ if (!equal(a[key], b[key])) return false;
2045
+ }
2046
+ return true;
2047
+ }
2048
+ return a !== a && b !== b;
2049
+ };
2050
+ }
2051
+ });
2052
+
2053
+ // ../../node_modules/.bun/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js
2054
+ var require_json_schema_traverse = __commonJS({
2055
+ "../../node_modules/.bun/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js"(exports, module) {
2056
+ "use strict";
2057
+ var traverse = module.exports = function(schema, opts, cb) {
2058
+ if (typeof opts == "function") {
2059
+ cb = opts;
2060
+ opts = {};
2061
+ }
2062
+ cb = opts.cb || cb;
2063
+ var pre = typeof cb == "function" ? cb : cb.pre || function() {
2064
+ };
2065
+ var post = cb.post || function() {
2066
+ };
2067
+ _traverse(opts, pre, post, schema, "", schema);
2068
+ };
2069
+ traverse.keywords = {
2070
+ additionalItems: true,
2071
+ items: true,
2072
+ contains: true,
2073
+ additionalProperties: true,
2074
+ propertyNames: true,
2075
+ not: true,
2076
+ if: true,
2077
+ then: true,
2078
+ else: true
2079
+ };
2080
+ traverse.arrayKeywords = {
2081
+ items: true,
2082
+ allOf: true,
2083
+ anyOf: true,
2084
+ oneOf: true
2085
+ };
2086
+ traverse.propsKeywords = {
2087
+ $defs: true,
2088
+ definitions: true,
2089
+ properties: true,
2090
+ patternProperties: true,
2091
+ dependencies: true
2092
+ };
2093
+ traverse.skipKeywords = {
2094
+ default: true,
2095
+ enum: true,
2096
+ const: true,
2097
+ required: true,
2098
+ maximum: true,
2099
+ minimum: true,
2100
+ exclusiveMaximum: true,
2101
+ exclusiveMinimum: true,
2102
+ multipleOf: true,
2103
+ maxLength: true,
2104
+ minLength: true,
2105
+ pattern: true,
2106
+ format: true,
2107
+ maxItems: true,
2108
+ minItems: true,
2109
+ uniqueItems: true,
2110
+ maxProperties: true,
2111
+ minProperties: true
2112
+ };
2113
+ function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
2114
+ if (schema && typeof schema == "object" && !Array.isArray(schema)) {
2115
+ pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
2116
+ for (var key in schema) {
2117
+ var sch = schema[key];
2118
+ if (Array.isArray(sch)) {
2119
+ if (key in traverse.arrayKeywords) {
2120
+ for (var i = 0; i < sch.length; i++)
2121
+ _traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key, schema, i);
2122
+ }
2123
+ } else if (key in traverse.propsKeywords) {
2124
+ if (sch && typeof sch == "object") {
2125
+ for (var prop in sch)
2126
+ _traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
2127
+ }
2128
+ } else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords)) {
2129
+ _traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema);
2130
+ }
2131
+ }
2132
+ post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
2133
+ }
2134
+ }
2135
+ function escapeJsonPtr(str) {
2136
+ return str.replace(/~/g, "~0").replace(/\//g, "~1");
2137
+ }
2138
+ }
2139
+ });
2140
+
2141
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js
2142
+ var require_resolve = __commonJS({
2143
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js"(exports) {
2144
+ "use strict";
2145
+ Object.defineProperty(exports, "__esModule", { value: true });
2146
+ exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = void 0;
2147
+ var util_1 = require_util();
2148
+ var equal = require_fast_deep_equal();
2149
+ var traverse = require_json_schema_traverse();
2150
+ var SIMPLE_INLINED = /* @__PURE__ */ new Set([
2151
+ "type",
2152
+ "format",
2153
+ "pattern",
2154
+ "maxLength",
2155
+ "minLength",
2156
+ "maxProperties",
2157
+ "minProperties",
2158
+ "maxItems",
2159
+ "minItems",
2160
+ "maximum",
2161
+ "minimum",
2162
+ "uniqueItems",
2163
+ "multipleOf",
2164
+ "required",
2165
+ "enum",
2166
+ "const"
2167
+ ]);
2168
+ function inlineRef(schema, limit = true) {
2169
+ if (typeof schema == "boolean")
2170
+ return true;
2171
+ if (limit === true)
2172
+ return !hasRef(schema);
2173
+ if (!limit)
2174
+ return false;
2175
+ return countKeys(schema) <= limit;
2176
+ }
2177
+ exports.inlineRef = inlineRef;
2178
+ var REF_KEYWORDS = /* @__PURE__ */ new Set([
2179
+ "$ref",
2180
+ "$recursiveRef",
2181
+ "$recursiveAnchor",
2182
+ "$dynamicRef",
2183
+ "$dynamicAnchor"
2184
+ ]);
2185
+ function hasRef(schema) {
2186
+ for (const key in schema) {
2187
+ if (REF_KEYWORDS.has(key))
2188
+ return true;
2189
+ const sch = schema[key];
2190
+ if (Array.isArray(sch) && sch.some(hasRef))
2191
+ return true;
2192
+ if (typeof sch == "object" && hasRef(sch))
2193
+ return true;
2194
+ }
2195
+ return false;
2196
+ }
2197
+ function countKeys(schema) {
2198
+ let count = 0;
2199
+ for (const key in schema) {
2200
+ if (key === "$ref")
2201
+ return Infinity;
2202
+ count++;
2203
+ if (SIMPLE_INLINED.has(key))
2204
+ continue;
2205
+ if (typeof schema[key] == "object") {
2206
+ (0, util_1.eachItem)(schema[key], (sch) => count += countKeys(sch));
2207
+ }
2208
+ if (count === Infinity)
2209
+ return Infinity;
2210
+ }
2211
+ return count;
2212
+ }
2213
+ function getFullPath(resolver, id = "", normalize) {
2214
+ if (normalize !== false)
2215
+ id = normalizeId(id);
2216
+ const p = resolver.parse(id);
2217
+ return _getFullPath(resolver, p);
2218
+ }
2219
+ exports.getFullPath = getFullPath;
2220
+ function _getFullPath(resolver, p) {
2221
+ const serialized = resolver.serialize(p);
2222
+ return serialized.split("#")[0] + "#";
2223
+ }
2224
+ exports._getFullPath = _getFullPath;
2225
+ var TRAILING_SLASH_HASH = /#\/?$/;
2226
+ function normalizeId(id) {
2227
+ return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
2228
+ }
2229
+ exports.normalizeId = normalizeId;
2230
+ function resolveUrl(resolver, baseId, id) {
2231
+ id = normalizeId(id);
2232
+ return resolver.resolve(baseId, id);
2233
+ }
2234
+ exports.resolveUrl = resolveUrl;
2235
+ var ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
2236
+ function getSchemaRefs(schema, baseId) {
2237
+ if (typeof schema == "boolean")
2238
+ return {};
2239
+ const { schemaId, uriResolver } = this.opts;
2240
+ const schId = normalizeId(schema[schemaId] || baseId);
2241
+ const baseIds = { "": schId };
2242
+ const pathPrefix = getFullPath(uriResolver, schId, false);
2243
+ const localRefs = {};
2244
+ const schemaRefs = /* @__PURE__ */ new Set();
2245
+ traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
2246
+ if (parentJsonPtr === void 0)
2247
+ return;
2248
+ const fullPath = pathPrefix + jsonPtr;
2249
+ let innerBaseId = baseIds[parentJsonPtr];
2250
+ if (typeof sch[schemaId] == "string")
2251
+ innerBaseId = addRef.call(this, sch[schemaId]);
2252
+ addAnchor.call(this, sch.$anchor);
2253
+ addAnchor.call(this, sch.$dynamicAnchor);
2254
+ baseIds[jsonPtr] = innerBaseId;
2255
+ function addRef(ref) {
2256
+ const _resolve = this.opts.uriResolver.resolve;
2257
+ ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref);
2258
+ if (schemaRefs.has(ref))
2259
+ throw ambiguos(ref);
2260
+ schemaRefs.add(ref);
2261
+ let schOrRef = this.refs[ref];
2262
+ if (typeof schOrRef == "string")
2263
+ schOrRef = this.refs[schOrRef];
2264
+ if (typeof schOrRef == "object") {
2265
+ checkAmbiguosRef(sch, schOrRef.schema, ref);
2266
+ } else if (ref !== normalizeId(fullPath)) {
2267
+ if (ref[0] === "#") {
2268
+ checkAmbiguosRef(sch, localRefs[ref], ref);
2269
+ localRefs[ref] = sch;
2270
+ } else {
2271
+ this.refs[ref] = fullPath;
2272
+ }
2273
+ }
2274
+ return ref;
2275
+ }
2276
+ function addAnchor(anchor) {
2277
+ if (typeof anchor == "string") {
2278
+ if (!ANCHOR.test(anchor))
2279
+ throw new Error(`invalid anchor "${anchor}"`);
2280
+ addRef.call(this, `#${anchor}`);
2281
+ }
2282
+ }
2283
+ });
2284
+ return localRefs;
2285
+ function checkAmbiguosRef(sch1, sch2, ref) {
2286
+ if (sch2 !== void 0 && !equal(sch1, sch2))
2287
+ throw ambiguos(ref);
2288
+ }
2289
+ function ambiguos(ref) {
2290
+ return new Error(`reference "${ref}" resolves to more than one schema`);
2291
+ }
2292
+ }
2293
+ exports.getSchemaRefs = getSchemaRefs;
2294
+ }
2295
+ });
2296
+
2297
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js
2298
+ var require_validate = __commonJS({
2299
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js"(exports) {
2300
+ "use strict";
2301
+ Object.defineProperty(exports, "__esModule", { value: true });
2302
+ exports.getData = exports.KeywordCxt = exports.validateFunctionCode = void 0;
2303
+ var boolSchema_1 = require_boolSchema();
2304
+ var dataType_1 = require_dataType();
2305
+ var applicability_1 = require_applicability();
2306
+ var dataType_2 = require_dataType();
2307
+ var defaults_1 = require_defaults();
2308
+ var keyword_1 = require_keyword();
2309
+ var subschema_1 = require_subschema();
2310
+ var codegen_1 = require_codegen();
2311
+ var names_1 = require_names();
2312
+ var resolve_1 = require_resolve();
2313
+ var util_1 = require_util();
2314
+ var errors_1 = require_errors();
2315
+ function validateFunctionCode(it) {
2316
+ if (isSchemaObj(it)) {
2317
+ checkKeywords(it);
2318
+ if (schemaCxtHasRules(it)) {
2319
+ topSchemaObjCode(it);
2320
+ return;
2321
+ }
2322
+ }
2323
+ validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
2324
+ }
2325
+ exports.validateFunctionCode = validateFunctionCode;
2326
+ function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
2327
+ if (opts.code.es5) {
2328
+ gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
2329
+ gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(schema, opts)}`);
2330
+ destructureValCxtES5(gen, opts);
2331
+ gen.code(body);
2332
+ });
2333
+ } else {
2334
+ gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
2335
+ }
2336
+ }
2337
+ function destructureValCxt(opts) {
2338
+ return (0, codegen_1._)`{${names_1.default.instancePath}="", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? (0, codegen_1._)`, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`;
2339
+ }
2340
+ function destructureValCxtES5(gen, opts) {
2341
+ gen.if(names_1.default.valCxt, () => {
2342
+ gen.var(names_1.default.instancePath, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.instancePath}`);
2343
+ gen.var(names_1.default.parentData, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.parentData}`);
2344
+ gen.var(names_1.default.parentDataProperty, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.parentDataProperty}`);
2345
+ gen.var(names_1.default.rootData, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.rootData}`);
2346
+ if (opts.dynamicRef)
2347
+ gen.var(names_1.default.dynamicAnchors, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`);
2348
+ }, () => {
2349
+ gen.var(names_1.default.instancePath, (0, codegen_1._)`""`);
2350
+ gen.var(names_1.default.parentData, (0, codegen_1._)`undefined`);
2351
+ gen.var(names_1.default.parentDataProperty, (0, codegen_1._)`undefined`);
2352
+ gen.var(names_1.default.rootData, names_1.default.data);
2353
+ if (opts.dynamicRef)
2354
+ gen.var(names_1.default.dynamicAnchors, (0, codegen_1._)`{}`);
2355
+ });
2356
+ }
2357
+ function topSchemaObjCode(it) {
2358
+ const { schema, opts, gen } = it;
2359
+ validateFunction(it, () => {
2360
+ if (opts.$comment && schema.$comment)
2361
+ commentKeyword(it);
2362
+ checkNoDefault(it);
2363
+ gen.let(names_1.default.vErrors, null);
2364
+ gen.let(names_1.default.errors, 0);
2365
+ if (opts.unevaluated)
2366
+ resetEvaluated(it);
2367
+ typeAndKeywords(it);
2368
+ returnResults(it);
2369
+ });
2370
+ return;
2371
+ }
2372
+ function resetEvaluated(it) {
2373
+ const { gen, validateName } = it;
2374
+ it.evaluated = gen.const("evaluated", (0, codegen_1._)`${validateName}.evaluated`);
2375
+ gen.if((0, codegen_1._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._)`${it.evaluated}.props`, (0, codegen_1._)`undefined`));
2376
+ gen.if((0, codegen_1._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._)`${it.evaluated}.items`, (0, codegen_1._)`undefined`));
2377
+ }
2378
+ function funcSourceUrl(schema, opts) {
2379
+ const schId = typeof schema == "object" && schema[opts.schemaId];
2380
+ return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._)`/*# sourceURL=${schId} */` : codegen_1.nil;
2381
+ }
2382
+ function subschemaCode(it, valid) {
2383
+ if (isSchemaObj(it)) {
2384
+ checkKeywords(it);
2385
+ if (schemaCxtHasRules(it)) {
2386
+ subSchemaObjCode(it, valid);
2387
+ return;
2388
+ }
2389
+ }
2390
+ (0, boolSchema_1.boolOrEmptySchema)(it, valid);
2391
+ }
2392
+ function schemaCxtHasRules({ schema, self }) {
2393
+ if (typeof schema == "boolean")
2394
+ return !schema;
2395
+ for (const key in schema)
2396
+ if (self.RULES.all[key])
2397
+ return true;
2398
+ return false;
2399
+ }
2400
+ function isSchemaObj(it) {
2401
+ return typeof it.schema != "boolean";
2402
+ }
2403
+ function subSchemaObjCode(it, valid) {
2404
+ const { schema, gen, opts } = it;
2405
+ if (opts.$comment && schema.$comment)
2406
+ commentKeyword(it);
2407
+ updateContext(it);
2408
+ checkAsyncSchema(it);
2409
+ const errsCount = gen.const("_errs", names_1.default.errors);
2410
+ typeAndKeywords(it, errsCount);
2411
+ gen.var(valid, (0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
2412
+ }
2413
+ function checkKeywords(it) {
2414
+ (0, util_1.checkUnknownRules)(it);
2415
+ checkRefsAndKeywords(it);
2416
+ }
2417
+ function typeAndKeywords(it, errsCount) {
2418
+ if (it.opts.jtd)
2419
+ return schemaKeywords(it, [], false, errsCount);
2420
+ const types = (0, dataType_1.getSchemaTypes)(it.schema);
2421
+ const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types);
2422
+ schemaKeywords(it, types, !checkedTypes, errsCount);
2423
+ }
2424
+ function checkRefsAndKeywords(it) {
2425
+ const { schema, errSchemaPath, opts, self } = it;
2426
+ if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self.RULES)) {
2427
+ self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
2428
+ }
2429
+ }
2430
+ function checkNoDefault(it) {
2431
+ const { schema, opts } = it;
2432
+ if (schema.default !== void 0 && opts.useDefaults && opts.strictSchema) {
2433
+ (0, util_1.checkStrictMode)(it, "default is ignored in the schema root");
2434
+ }
2435
+ }
2436
+ function updateContext(it) {
2437
+ const schId = it.schema[it.opts.schemaId];
2438
+ if (schId)
2439
+ it.baseId = (0, resolve_1.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
2440
+ }
2441
+ function checkAsyncSchema(it) {
2442
+ if (it.schema.$async && !it.schemaEnv.$async)
2443
+ throw new Error("async schema in sync schema");
2444
+ }
2445
+ function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
2446
+ const msg = schema.$comment;
2447
+ if (opts.$comment === true) {
2448
+ gen.code((0, codegen_1._)`${names_1.default.self}.logger.log(${msg})`);
2449
+ } else if (typeof opts.$comment == "function") {
2450
+ const schemaPath = (0, codegen_1.str)`${errSchemaPath}/$comment`;
2451
+ const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
2452
+ gen.code((0, codegen_1._)`${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
2453
+ }
2454
+ }
2455
+ function returnResults(it) {
2456
+ const { gen, schemaEnv, validateName, ValidationError, opts } = it;
2457
+ if (schemaEnv.$async) {
2458
+ gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${ValidationError}(${names_1.default.vErrors})`));
2459
+ } else {
2460
+ gen.assign((0, codegen_1._)`${validateName}.errors`, names_1.default.vErrors);
2461
+ if (opts.unevaluated)
2462
+ assignEvaluated(it);
2463
+ gen.return((0, codegen_1._)`${names_1.default.errors} === 0`);
2464
+ }
2465
+ }
2466
+ function assignEvaluated({ gen, evaluated, props, items }) {
2467
+ if (props instanceof codegen_1.Name)
2468
+ gen.assign((0, codegen_1._)`${evaluated}.props`, props);
2469
+ if (items instanceof codegen_1.Name)
2470
+ gen.assign((0, codegen_1._)`${evaluated}.items`, items);
2471
+ }
2472
+ function schemaKeywords(it, types, typeErrors, errsCount) {
2473
+ const { gen, schema, data, allErrors, opts, self } = it;
2474
+ const { RULES } = self;
2475
+ if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) {
2476
+ gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
2477
+ return;
2478
+ }
2479
+ if (!opts.jtd)
2480
+ checkStrictTypes(it, types);
2481
+ gen.block(() => {
2482
+ for (const group of RULES.rules)
2483
+ groupKeywords(group);
2484
+ groupKeywords(RULES.post);
2485
+ });
2486
+ function groupKeywords(group) {
2487
+ if (!(0, applicability_1.shouldUseGroup)(schema, group))
2488
+ return;
2489
+ if (group.type) {
2490
+ gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
2491
+ iterateKeywords(it, group);
2492
+ if (types.length === 1 && types[0] === group.type && typeErrors) {
2493
+ gen.else();
2494
+ (0, dataType_2.reportTypeError)(it);
2495
+ }
2496
+ gen.endIf();
2497
+ } else {
2498
+ iterateKeywords(it, group);
2499
+ }
2500
+ if (!allErrors)
2501
+ gen.if((0, codegen_1._)`${names_1.default.errors} === ${errsCount || 0}`);
2502
+ }
2503
+ }
2504
+ function iterateKeywords(it, group) {
2505
+ const { gen, schema, opts: { useDefaults } } = it;
2506
+ if (useDefaults)
2507
+ (0, defaults_1.assignDefaults)(it, group.type);
2508
+ gen.block(() => {
2509
+ for (const rule of group.rules) {
2510
+ if ((0, applicability_1.shouldUseRule)(schema, rule)) {
2511
+ keywordCode(it, rule.keyword, rule.definition, group.type);
2512
+ }
2513
+ }
2514
+ });
2515
+ }
2516
+ function checkStrictTypes(it, types) {
2517
+ if (it.schemaEnv.meta || !it.opts.strictTypes)
2518
+ return;
2519
+ checkContextTypes(it, types);
2520
+ if (!it.opts.allowUnionTypes)
2521
+ checkMultipleTypes(it, types);
2522
+ checkKeywordTypes(it, it.dataTypes);
2523
+ }
2524
+ function checkContextTypes(it, types) {
2525
+ if (!types.length)
2526
+ return;
2527
+ if (!it.dataTypes.length) {
2528
+ it.dataTypes = types;
2529
+ return;
2530
+ }
2531
+ types.forEach((t) => {
2532
+ if (!includesType(it.dataTypes, t)) {
2533
+ strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
2534
+ }
2535
+ });
2536
+ narrowSchemaTypes(it, types);
2537
+ }
2538
+ function checkMultipleTypes(it, ts) {
2539
+ if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
2540
+ strictTypesError(it, "use allowUnionTypes to allow union type keyword");
2541
+ }
2542
+ }
2543
+ function checkKeywordTypes(it, ts) {
2544
+ const rules = it.self.RULES.all;
2545
+ for (const keyword in rules) {
2546
+ const rule = rules[keyword];
2547
+ if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) {
2548
+ const { type } = rule.definition;
2549
+ if (type.length && !type.some((t) => hasApplicableType(ts, t))) {
2550
+ strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`);
2551
+ }
2552
+ }
2553
+ }
2554
+ }
2555
+ function hasApplicableType(schTs, kwdT) {
2556
+ return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
2557
+ }
2558
+ function includesType(ts, t) {
2559
+ return ts.includes(t) || t === "integer" && ts.includes("number");
2560
+ }
2561
+ function narrowSchemaTypes(it, withTypes) {
2562
+ const ts = [];
2563
+ for (const t of it.dataTypes) {
2564
+ if (includesType(withTypes, t))
2565
+ ts.push(t);
2566
+ else if (withTypes.includes("integer") && t === "number")
2567
+ ts.push("integer");
2568
+ }
2569
+ it.dataTypes = ts;
2570
+ }
2571
+ function strictTypesError(it, msg) {
2572
+ const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
2573
+ msg += ` at "${schemaPath}" (strictTypes)`;
2574
+ (0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes);
2575
+ }
2576
+ var KeywordCxt = class {
2577
+ constructor(it, def, keyword) {
2578
+ (0, keyword_1.validateKeywordUsage)(it, def, keyword);
2579
+ this.gen = it.gen;
2580
+ this.allErrors = it.allErrors;
2581
+ this.keyword = keyword;
2582
+ this.data = it.data;
2583
+ this.schema = it.schema[keyword];
2584
+ this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data;
2585
+ this.schemaValue = (0, util_1.schemaRefOrVal)(it, this.schema, keyword, this.$data);
2586
+ this.schemaType = def.schemaType;
2587
+ this.parentSchema = it.schema;
2588
+ this.params = {};
2589
+ this.it = it;
2590
+ this.def = def;
2591
+ if (this.$data) {
2592
+ this.schemaCode = it.gen.const("vSchema", getData(this.$data, it));
2593
+ } else {
2594
+ this.schemaCode = this.schemaValue;
2595
+ if (!(0, keyword_1.validSchemaType)(this.schema, def.schemaType, def.allowUndefined)) {
2596
+ throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`);
2597
+ }
2598
+ }
2599
+ if ("code" in def ? def.trackErrors : def.errors !== false) {
2600
+ this.errsCount = it.gen.const("_errs", names_1.default.errors);
2601
+ }
2602
+ }
2603
+ result(condition, successAction, failAction) {
2604
+ this.failResult((0, codegen_1.not)(condition), successAction, failAction);
2605
+ }
2606
+ failResult(condition, successAction, failAction) {
2607
+ this.gen.if(condition);
2608
+ if (failAction)
2609
+ failAction();
2610
+ else
2611
+ this.error();
2612
+ if (successAction) {
2613
+ this.gen.else();
2614
+ successAction();
2615
+ if (this.allErrors)
2616
+ this.gen.endIf();
2617
+ } else {
2618
+ if (this.allErrors)
2619
+ this.gen.endIf();
2620
+ else
2621
+ this.gen.else();
2622
+ }
2623
+ }
2624
+ pass(condition, failAction) {
2625
+ this.failResult((0, codegen_1.not)(condition), void 0, failAction);
2626
+ }
2627
+ fail(condition) {
2628
+ if (condition === void 0) {
2629
+ this.error();
2630
+ if (!this.allErrors)
2631
+ this.gen.if(false);
2632
+ return;
2633
+ }
2634
+ this.gen.if(condition);
2635
+ this.error();
2636
+ if (this.allErrors)
2637
+ this.gen.endIf();
2638
+ else
2639
+ this.gen.else();
2640
+ }
2641
+ fail$data(condition) {
2642
+ if (!this.$data)
2643
+ return this.fail(condition);
2644
+ const { schemaCode } = this;
2645
+ this.fail((0, codegen_1._)`${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`);
2646
+ }
2647
+ error(append, errorParams, errorPaths) {
2648
+ if (errorParams) {
2649
+ this.setParams(errorParams);
2650
+ this._error(append, errorPaths);
2651
+ this.setParams({});
2652
+ return;
2653
+ }
2654
+ this._error(append, errorPaths);
2655
+ }
2656
+ _error(append, errorPaths) {
2657
+ ;
2658
+ (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths);
2659
+ }
2660
+ $dataError() {
2661
+ (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError);
2662
+ }
2663
+ reset() {
2664
+ if (this.errsCount === void 0)
2665
+ throw new Error('add "trackErrors" to keyword definition');
2666
+ (0, errors_1.resetErrorsCount)(this.gen, this.errsCount);
2667
+ }
2668
+ ok(cond) {
2669
+ if (!this.allErrors)
2670
+ this.gen.if(cond);
2671
+ }
2672
+ setParams(obj, assign) {
2673
+ if (assign)
2674
+ Object.assign(this.params, obj);
2675
+ else
2676
+ this.params = obj;
2677
+ }
2678
+ block$data(valid, codeBlock, $dataValid = codegen_1.nil) {
2679
+ this.gen.block(() => {
2680
+ this.check$data(valid, $dataValid);
2681
+ codeBlock();
2682
+ });
2683
+ }
2684
+ check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) {
2685
+ if (!this.$data)
2686
+ return;
2687
+ const { gen, schemaCode, schemaType, def } = this;
2688
+ gen.if((0, codegen_1.or)((0, codegen_1._)`${schemaCode} === undefined`, $dataValid));
2689
+ if (valid !== codegen_1.nil)
2690
+ gen.assign(valid, true);
2691
+ if (schemaType.length || def.validateSchema) {
2692
+ gen.elseIf(this.invalid$data());
2693
+ this.$dataError();
2694
+ if (valid !== codegen_1.nil)
2695
+ gen.assign(valid, false);
2696
+ }
2697
+ gen.else();
2698
+ }
2699
+ invalid$data() {
2700
+ const { gen, schemaCode, schemaType, def, it } = this;
2701
+ return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema());
2702
+ function wrong$DataType() {
2703
+ if (schemaType.length) {
2704
+ if (!(schemaCode instanceof codegen_1.Name))
2705
+ throw new Error("ajv implementation error");
2706
+ const st = Array.isArray(schemaType) ? schemaType : [schemaType];
2707
+ return (0, codegen_1._)`${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
2708
+ }
2709
+ return codegen_1.nil;
2710
+ }
2711
+ function invalid$DataSchema() {
2712
+ if (def.validateSchema) {
2713
+ const validateSchemaRef = gen.scopeValue("validate$data", { ref: def.validateSchema });
2714
+ return (0, codegen_1._)`!${validateSchemaRef}(${schemaCode})`;
2715
+ }
2716
+ return codegen_1.nil;
2717
+ }
2718
+ }
2719
+ subschema(appl, valid) {
2720
+ const subschema = (0, subschema_1.getSubschema)(this.it, appl);
2721
+ (0, subschema_1.extendSubschemaData)(subschema, this.it, appl);
2722
+ (0, subschema_1.extendSubschemaMode)(subschema, appl);
2723
+ const nextContext = { ...this.it, ...subschema, items: void 0, props: void 0 };
2724
+ subschemaCode(nextContext, valid);
2725
+ return nextContext;
2726
+ }
2727
+ mergeEvaluated(schemaCxt, toName) {
2728
+ const { it, gen } = this;
2729
+ if (!it.opts.unevaluated)
2730
+ return;
2731
+ if (it.props !== true && schemaCxt.props !== void 0) {
2732
+ it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
2733
+ }
2734
+ if (it.items !== true && schemaCxt.items !== void 0) {
2735
+ it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
2736
+ }
2737
+ }
2738
+ mergeValidEvaluated(schemaCxt, valid) {
2739
+ const { it, gen } = this;
2740
+ if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
2741
+ gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name));
2742
+ return true;
2743
+ }
2744
+ }
2745
+ };
2746
+ exports.KeywordCxt = KeywordCxt;
2747
+ function keywordCode(it, keyword, def, ruleType) {
2748
+ const cxt = new KeywordCxt(it, def, keyword);
2749
+ if ("code" in def) {
2750
+ def.code(cxt, ruleType);
2751
+ } else if (cxt.$data && def.validate) {
2752
+ (0, keyword_1.funcKeywordCode)(cxt, def);
2753
+ } else if ("macro" in def) {
2754
+ (0, keyword_1.macroKeywordCode)(cxt, def);
2755
+ } else if (def.compile || def.validate) {
2756
+ (0, keyword_1.funcKeywordCode)(cxt, def);
2757
+ }
2758
+ }
2759
+ var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
2760
+ var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
2761
+ function getData($data, { dataLevel, dataNames, dataPathArr }) {
2762
+ let jsonPointer;
2763
+ let data;
2764
+ if ($data === "")
2765
+ return names_1.default.rootData;
2766
+ if ($data[0] === "/") {
2767
+ if (!JSON_POINTER.test($data))
2768
+ throw new Error(`Invalid JSON-pointer: ${$data}`);
2769
+ jsonPointer = $data;
2770
+ data = names_1.default.rootData;
2771
+ } else {
2772
+ const matches = RELATIVE_JSON_POINTER.exec($data);
2773
+ if (!matches)
2774
+ throw new Error(`Invalid JSON-pointer: ${$data}`);
2775
+ const up = +matches[1];
2776
+ jsonPointer = matches[2];
2777
+ if (jsonPointer === "#") {
2778
+ if (up >= dataLevel)
2779
+ throw new Error(errorMsg("property/index", up));
2780
+ return dataPathArr[dataLevel - up];
2781
+ }
2782
+ if (up > dataLevel)
2783
+ throw new Error(errorMsg("data", up));
2784
+ data = dataNames[dataLevel - up];
2785
+ if (!jsonPointer)
2786
+ return data;
2787
+ }
2788
+ let expr = data;
2789
+ const segments = jsonPointer.split("/");
2790
+ for (const segment of segments) {
2791
+ if (segment) {
2792
+ data = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`;
2793
+ expr = (0, codegen_1._)`${expr} && ${data}`;
2794
+ }
2795
+ }
2796
+ return expr;
2797
+ function errorMsg(pointerType, up) {
2798
+ return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
2799
+ }
2800
+ }
2801
+ exports.getData = getData;
2802
+ }
2803
+ });
2804
+
2805
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js
2806
+ var require_validation_error = __commonJS({
2807
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js"(exports) {
2808
+ "use strict";
2809
+ Object.defineProperty(exports, "__esModule", { value: true });
2810
+ var ValidationError = class extends Error {
2811
+ constructor(errors) {
2812
+ super("validation failed");
2813
+ this.errors = errors;
2814
+ this.ajv = this.validation = true;
2815
+ }
2816
+ };
2817
+ exports.default = ValidationError;
2818
+ }
2819
+ });
2820
+
2821
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js
2822
+ var require_ref_error = __commonJS({
2823
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js"(exports) {
2824
+ "use strict";
2825
+ Object.defineProperty(exports, "__esModule", { value: true });
2826
+ var resolve_1 = require_resolve();
2827
+ var MissingRefError = class extends Error {
2828
+ constructor(resolver, baseId, ref, msg) {
2829
+ super(msg || `can't resolve reference ${ref} from id ${baseId}`);
2830
+ this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref);
2831
+ this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef));
2832
+ }
2833
+ };
2834
+ exports.default = MissingRefError;
2835
+ }
2836
+ });
2837
+
2838
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/index.js
2839
+ var require_compile = __commonJS({
2840
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/index.js"(exports) {
2841
+ "use strict";
2842
+ Object.defineProperty(exports, "__esModule", { value: true });
2843
+ exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0;
2844
+ var codegen_1 = require_codegen();
2845
+ var validation_error_1 = require_validation_error();
2846
+ var names_1 = require_names();
2847
+ var resolve_1 = require_resolve();
2848
+ var util_1 = require_util();
2849
+ var validate_1 = require_validate();
2850
+ var SchemaEnv = class {
2851
+ constructor(env) {
2852
+ var _a;
2853
+ this.refs = {};
2854
+ this.dynamicAnchors = {};
2855
+ let schema;
2856
+ if (typeof env.schema == "object")
2857
+ schema = env.schema;
2858
+ this.schema = env.schema;
2859
+ this.schemaId = env.schemaId;
2860
+ this.root = env.root || this;
2861
+ this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
2862
+ this.schemaPath = env.schemaPath;
2863
+ this.localRefs = env.localRefs;
2864
+ this.meta = env.meta;
2865
+ this.$async = schema === null || schema === void 0 ? void 0 : schema.$async;
2866
+ this.refs = {};
2867
+ }
2868
+ };
2869
+ exports.SchemaEnv = SchemaEnv;
2870
+ function compileSchema(sch) {
2871
+ const _sch = getCompilingSchema.call(this, sch);
2872
+ if (_sch)
2873
+ return _sch;
2874
+ const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId);
2875
+ const { es5, lines } = this.opts.code;
2876
+ const { ownProperties } = this.opts;
2877
+ const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });
2878
+ let _ValidationError;
2879
+ if (sch.$async) {
2880
+ _ValidationError = gen.scopeValue("Error", {
2881
+ ref: validation_error_1.default,
2882
+ code: (0, codegen_1._)`require("ajv/dist/runtime/validation_error").default`
2883
+ });
2884
+ }
2885
+ const validateName = gen.scopeName("validate");
2886
+ sch.validateName = validateName;
2887
+ const schemaCxt = {
2888
+ gen,
2889
+ allErrors: this.opts.allErrors,
2890
+ data: names_1.default.data,
2891
+ parentData: names_1.default.parentData,
2892
+ parentDataProperty: names_1.default.parentDataProperty,
2893
+ dataNames: [names_1.default.data],
2894
+ dataPathArr: [codegen_1.nil],
2895
+ // TODO can its length be used as dataLevel if nil is removed?
2896
+ dataLevel: 0,
2897
+ dataTypes: [],
2898
+ definedProperties: /* @__PURE__ */ new Set(),
2899
+ topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) } : { ref: sch.schema }),
2900
+ validateName,
2901
+ ValidationError: _ValidationError,
2902
+ schema: sch.schema,
2903
+ schemaEnv: sch,
2904
+ rootId,
2905
+ baseId: sch.baseId || rootId,
2906
+ schemaPath: codegen_1.nil,
2907
+ errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"),
2908
+ errorPath: (0, codegen_1._)`""`,
2909
+ opts: this.opts,
2910
+ self: this
2911
+ };
2912
+ let sourceCode;
2913
+ try {
2914
+ this._compilations.add(sch);
2915
+ (0, validate_1.validateFunctionCode)(schemaCxt);
2916
+ gen.optimize(this.opts.code.optimize);
2917
+ const validateCode = gen.toString();
2918
+ sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`;
2919
+ if (this.opts.code.process)
2920
+ sourceCode = this.opts.code.process(sourceCode, sch);
2921
+ const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
2922
+ const validate = makeValidate(this, this.scope.get());
2923
+ this.scope.value(validateName, { ref: validate });
2924
+ validate.errors = null;
2925
+ validate.schema = sch.schema;
2926
+ validate.schemaEnv = sch;
2927
+ if (sch.$async)
2928
+ validate.$async = true;
2929
+ if (this.opts.code.source === true) {
2930
+ validate.source = { validateName, validateCode, scopeValues: gen._values };
2931
+ }
2932
+ if (this.opts.unevaluated) {
2933
+ const { props, items } = schemaCxt;
2934
+ validate.evaluated = {
2935
+ props: props instanceof codegen_1.Name ? void 0 : props,
2936
+ items: items instanceof codegen_1.Name ? void 0 : items,
2937
+ dynamicProps: props instanceof codegen_1.Name,
2938
+ dynamicItems: items instanceof codegen_1.Name
2939
+ };
2940
+ if (validate.source)
2941
+ validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);
2942
+ }
2943
+ sch.validate = validate;
2944
+ return sch;
2945
+ } catch (e) {
2946
+ delete sch.validate;
2947
+ delete sch.validateName;
2948
+ if (sourceCode)
2949
+ this.logger.error("Error compiling schema, function code:", sourceCode);
2950
+ throw e;
2951
+ } finally {
2952
+ this._compilations.delete(sch);
2953
+ }
2954
+ }
2955
+ exports.compileSchema = compileSchema;
2956
+ function resolveRef(root, baseId, ref) {
2957
+ var _a;
2958
+ ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
2959
+ const schOrFunc = root.refs[ref];
2960
+ if (schOrFunc)
2961
+ return schOrFunc;
2962
+ let _sch = resolve.call(this, root, ref);
2963
+ if (_sch === void 0) {
2964
+ const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
2965
+ const { schemaId } = this.opts;
2966
+ if (schema)
2967
+ _sch = new SchemaEnv({ schema, schemaId, root, baseId });
2968
+ }
2969
+ if (_sch === void 0)
2970
+ return;
2971
+ return root.refs[ref] = inlineOrCompile.call(this, _sch);
2972
+ }
2973
+ exports.resolveRef = resolveRef;
2974
+ function inlineOrCompile(sch) {
2975
+ if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs))
2976
+ return sch.schema;
2977
+ return sch.validate ? sch : compileSchema.call(this, sch);
2978
+ }
2979
+ function getCompilingSchema(schEnv) {
2980
+ for (const sch of this._compilations) {
2981
+ if (sameSchemaEnv(sch, schEnv))
2982
+ return sch;
2983
+ }
2984
+ }
2985
+ exports.getCompilingSchema = getCompilingSchema;
2986
+ function sameSchemaEnv(s1, s2) {
2987
+ return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
2988
+ }
2989
+ function resolve(root, ref) {
2990
+ let sch;
2991
+ while (typeof (sch = this.refs[ref]) == "string")
2992
+ ref = sch;
2993
+ return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
2994
+ }
2995
+ function resolveSchema(root, ref) {
2996
+ const p = this.opts.uriResolver.parse(ref);
2997
+ const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p);
2998
+ let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, void 0);
2999
+ if (Object.keys(root.schema).length > 0 && refPath === baseId) {
3000
+ return getJsonPointer.call(this, p, root);
3001
+ }
3002
+ const id = (0, resolve_1.normalizeId)(refPath);
3003
+ const schOrRef = this.refs[id] || this.schemas[id];
3004
+ if (typeof schOrRef == "string") {
3005
+ const sch = resolveSchema.call(this, root, schOrRef);
3006
+ if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object")
3007
+ return;
3008
+ return getJsonPointer.call(this, p, sch);
3009
+ }
3010
+ if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object")
3011
+ return;
3012
+ if (!schOrRef.validate)
3013
+ compileSchema.call(this, schOrRef);
3014
+ if (id === (0, resolve_1.normalizeId)(ref)) {
3015
+ const { schema } = schOrRef;
3016
+ const { schemaId } = this.opts;
3017
+ const schId = schema[schemaId];
3018
+ if (schId)
3019
+ baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
3020
+ return new SchemaEnv({ schema, schemaId, root, baseId });
3021
+ }
3022
+ return getJsonPointer.call(this, p, schOrRef);
3023
+ }
3024
+ exports.resolveSchema = resolveSchema;
3025
+ var PREVENT_SCOPE_CHANGE = /* @__PURE__ */ new Set([
3026
+ "properties",
3027
+ "patternProperties",
3028
+ "enum",
3029
+ "dependencies",
3030
+ "definitions"
3031
+ ]);
3032
+ function getJsonPointer(parsedRef, { baseId, schema, root }) {
3033
+ var _a;
3034
+ if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/")
3035
+ return;
3036
+ for (const part of parsedRef.fragment.slice(1).split("/")) {
3037
+ if (typeof schema === "boolean")
3038
+ return;
3039
+ const partSchema = schema[(0, util_1.unescapeFragment)(part)];
3040
+ if (partSchema === void 0)
3041
+ return;
3042
+ schema = partSchema;
3043
+ const schId = typeof schema === "object" && schema[this.opts.schemaId];
3044
+ if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
3045
+ baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
3046
+ }
3047
+ }
3048
+ let env;
3049
+ if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) {
3050
+ const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref);
3051
+ env = resolveSchema.call(this, root, $ref);
3052
+ }
3053
+ const { schemaId } = this.opts;
3054
+ env = env || new SchemaEnv({ schema, schemaId, root, baseId });
3055
+ if (env.schema !== env.root.schema)
3056
+ return env;
3057
+ return void 0;
3058
+ }
3059
+ }
3060
+ });
3061
+
3062
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/refs/data.json
3063
+ var require_data = __commonJS({
3064
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/refs/data.json"(exports, module) {
3065
+ module.exports = {
3066
+ $id: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
3067
+ description: "Meta-schema for $data reference (JSON AnySchema extension proposal)",
3068
+ type: "object",
3069
+ required: ["$data"],
3070
+ properties: {
3071
+ $data: {
3072
+ type: "string",
3073
+ anyOf: [{ format: "relative-json-pointer" }, { format: "json-pointer" }]
3074
+ }
3075
+ },
3076
+ additionalProperties: false
3077
+ };
3078
+ }
3079
+ });
3080
+
3081
+ // ../../node_modules/.bun/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js
3082
+ var require_utils = __commonJS({
3083
+ "../../node_modules/.bun/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js"(exports, module) {
3084
+ "use strict";
3085
+ var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3086
+ var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
3087
+ var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3088
+ var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3089
+ var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
3090
+ function stringArrayToHexStripped(input) {
3091
+ let acc = "";
3092
+ let code = 0;
3093
+ let i = 0;
3094
+ for (i = 0; i < input.length; i++) {
3095
+ code = input[i].charCodeAt(0);
3096
+ if (code === 48) {
3097
+ continue;
3098
+ }
3099
+ if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {
3100
+ return "";
3101
+ }
3102
+ acc += input[i];
3103
+ break;
3104
+ }
3105
+ for (i += 1; i < input.length; i++) {
3106
+ code = input[i].charCodeAt(0);
3107
+ if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {
3108
+ return "";
3109
+ }
3110
+ acc += input[i];
3111
+ }
3112
+ return acc;
3113
+ }
3114
+ var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
3115
+ function consumeIsZone(buffer) {
3116
+ buffer.length = 0;
3117
+ return true;
3118
+ }
3119
+ function consumeHextets(buffer, address, output) {
3120
+ if (buffer.length) {
3121
+ const hex = stringArrayToHexStripped(buffer);
3122
+ if (hex !== "") {
3123
+ address.push(hex);
3124
+ } else {
3125
+ output.error = true;
3126
+ return false;
3127
+ }
3128
+ buffer.length = 0;
3129
+ }
3130
+ return true;
3131
+ }
3132
+ function getIPV6(input) {
3133
+ let tokenCount = 0;
3134
+ const output = { error: false, address: "", zone: "" };
3135
+ const address = [];
3136
+ const buffer = [];
3137
+ let endipv6Encountered = false;
3138
+ let endIpv6 = false;
3139
+ let consume = consumeHextets;
3140
+ for (let i = 0; i < input.length; i++) {
3141
+ const cursor = input[i];
3142
+ if (cursor === "[" || cursor === "]") {
3143
+ continue;
3144
+ }
3145
+ if (cursor === ":") {
3146
+ if (endipv6Encountered === true) {
3147
+ endIpv6 = true;
3148
+ }
3149
+ if (!consume(buffer, address, output)) {
3150
+ break;
3151
+ }
3152
+ if (++tokenCount > 7) {
3153
+ output.error = true;
3154
+ break;
3155
+ }
3156
+ if (i > 0 && input[i - 1] === ":") {
3157
+ endipv6Encountered = true;
3158
+ }
3159
+ address.push(":");
3160
+ continue;
3161
+ } else if (cursor === "%") {
3162
+ if (!consume(buffer, address, output)) {
3163
+ break;
3164
+ }
3165
+ consume = consumeIsZone;
3166
+ } else {
3167
+ buffer.push(cursor);
3168
+ continue;
3169
+ }
3170
+ }
3171
+ if (buffer.length) {
3172
+ if (consume === consumeIsZone) {
3173
+ output.zone = buffer.join("");
3174
+ } else if (endIpv6) {
3175
+ address.push(buffer.join(""));
3176
+ } else {
3177
+ address.push(stringArrayToHexStripped(buffer));
3178
+ }
3179
+ }
3180
+ output.address = address.join("");
3181
+ return output;
3182
+ }
3183
+ function normalizeIPv6(host) {
3184
+ if (findToken(host, ":") < 2) {
3185
+ return { host, isIPV6: false };
3186
+ }
3187
+ const ipv6 = getIPV6(host);
3188
+ if (!ipv6.error) {
3189
+ let newHost = ipv6.address;
3190
+ let escapedHost = ipv6.address;
3191
+ if (ipv6.zone) {
3192
+ newHost += "%" + ipv6.zone;
3193
+ escapedHost += "%25" + ipv6.zone;
3194
+ }
3195
+ return { host: newHost, isIPV6: true, escapedHost };
3196
+ } else {
3197
+ return { host, isIPV6: false };
3198
+ }
3199
+ }
3200
+ function findToken(str, token) {
3201
+ let ind = 0;
3202
+ for (let i = 0; i < str.length; i++) {
3203
+ if (str[i] === token) ind++;
3204
+ }
3205
+ return ind;
3206
+ }
3207
+ function removeDotSegments(path) {
3208
+ let input = path;
3209
+ const output = [];
3210
+ let nextSlash = -1;
3211
+ let len = 0;
3212
+ while (len = input.length) {
3213
+ if (len === 1) {
3214
+ if (input === ".") {
3215
+ break;
3216
+ } else if (input === "/") {
3217
+ output.push("/");
3218
+ break;
3219
+ } else {
3220
+ output.push(input);
3221
+ break;
3222
+ }
3223
+ } else if (len === 2) {
3224
+ if (input[0] === ".") {
3225
+ if (input[1] === ".") {
3226
+ break;
3227
+ } else if (input[1] === "/") {
3228
+ input = input.slice(2);
3229
+ continue;
3230
+ }
3231
+ } else if (input[0] === "/") {
3232
+ if (input[1] === "." || input[1] === "/") {
3233
+ output.push("/");
3234
+ break;
3235
+ }
3236
+ }
3237
+ } else if (len === 3) {
3238
+ if (input === "/..") {
3239
+ if (output.length !== 0) {
3240
+ output.pop();
3241
+ }
3242
+ output.push("/");
3243
+ break;
3244
+ }
3245
+ }
3246
+ if (input[0] === ".") {
3247
+ if (input[1] === ".") {
3248
+ if (input[2] === "/") {
3249
+ input = input.slice(3);
3250
+ continue;
3251
+ }
3252
+ } else if (input[1] === "/") {
3253
+ input = input.slice(2);
3254
+ continue;
3255
+ }
3256
+ } else if (input[0] === "/") {
3257
+ if (input[1] === ".") {
3258
+ if (input[2] === "/") {
3259
+ input = input.slice(2);
3260
+ continue;
3261
+ } else if (input[2] === ".") {
3262
+ if (input[3] === "/") {
3263
+ input = input.slice(3);
3264
+ if (output.length !== 0) {
3265
+ output.pop();
3266
+ }
3267
+ continue;
3268
+ }
3269
+ }
3270
+ }
3271
+ }
3272
+ if ((nextSlash = input.indexOf("/", 1)) === -1) {
3273
+ output.push(input);
3274
+ break;
3275
+ } else {
3276
+ output.push(input.slice(0, nextSlash));
3277
+ input = input.slice(nextSlash);
3278
+ }
3279
+ }
3280
+ return output.join("");
3281
+ }
3282
+ var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3283
+ var HOST_DELIM_RE = /[@/?#:]/g;
3284
+ var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
3285
+ function reescapeHostDelimiters(host, isIP) {
3286
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
3287
+ re.lastIndex = 0;
3288
+ return host.replace(re, (ch) => HOST_DELIMS[ch]);
3289
+ }
3290
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
3291
+ if (input.indexOf("%") === -1) {
3292
+ return input;
3293
+ }
3294
+ let output = "";
3295
+ for (let i = 0; i < input.length; i++) {
3296
+ if (input[i] === "%" && i + 2 < input.length) {
3297
+ const hex = input.slice(i + 1, i + 3);
3298
+ if (isHexPair(hex)) {
3299
+ const normalizedHex = hex.toUpperCase();
3300
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3301
+ if (decodeUnreserved && isUnreserved(decoded)) {
3302
+ output += decoded;
3303
+ } else {
3304
+ output += "%" + normalizedHex;
3305
+ }
3306
+ i += 2;
3307
+ continue;
3308
+ }
3309
+ }
3310
+ output += input[i];
3311
+ }
3312
+ return output;
3313
+ }
3314
+ function normalizePathEncoding(input) {
3315
+ let output = "";
3316
+ for (let i = 0; i < input.length; i++) {
3317
+ if (input[i] === "%" && i + 2 < input.length) {
3318
+ const hex = input.slice(i + 1, i + 3);
3319
+ if (isHexPair(hex)) {
3320
+ const normalizedHex = hex.toUpperCase();
3321
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3322
+ if (decoded !== "." && isUnreserved(decoded)) {
3323
+ output += decoded;
3324
+ } else {
3325
+ output += "%" + normalizedHex;
3326
+ }
3327
+ i += 2;
3328
+ continue;
3329
+ }
3330
+ }
3331
+ if (isPathCharacter(input[i])) {
3332
+ output += input[i];
3333
+ } else {
3334
+ output += escape(input[i]);
3335
+ }
3336
+ }
3337
+ return output;
3338
+ }
3339
+ function escapePreservingEscapes(input) {
3340
+ let output = "";
3341
+ for (let i = 0; i < input.length; i++) {
3342
+ if (input[i] === "%" && i + 2 < input.length) {
3343
+ const hex = input.slice(i + 1, i + 3);
3344
+ if (isHexPair(hex)) {
3345
+ output += "%" + hex.toUpperCase();
3346
+ i += 2;
3347
+ continue;
3348
+ }
3349
+ }
3350
+ output += escape(input[i]);
3351
+ }
3352
+ return output;
3353
+ }
3354
+ function recomposeAuthority(component) {
3355
+ const uriTokens = [];
3356
+ if (component.userinfo !== void 0) {
3357
+ uriTokens.push(component.userinfo);
3358
+ uriTokens.push("@");
3359
+ }
3360
+ if (component.host !== void 0) {
3361
+ let host = unescape(component.host);
3362
+ if (!isIPv4(host)) {
3363
+ const ipV6res = normalizeIPv6(host);
3364
+ if (ipV6res.isIPV6 === true) {
3365
+ host = `[${ipV6res.escapedHost}]`;
3366
+ } else {
3367
+ host = reescapeHostDelimiters(host, false);
3368
+ }
3369
+ }
3370
+ uriTokens.push(host);
3371
+ }
3372
+ if (typeof component.port === "number" || typeof component.port === "string") {
3373
+ uriTokens.push(":");
3374
+ uriTokens.push(String(component.port));
3375
+ }
3376
+ return uriTokens.length ? uriTokens.join("") : void 0;
3377
+ }
3378
+ module.exports = {
3379
+ nonSimpleDomain,
3380
+ recomposeAuthority,
3381
+ reescapeHostDelimiters,
3382
+ normalizePercentEncoding,
3383
+ normalizePathEncoding,
3384
+ escapePreservingEscapes,
3385
+ removeDotSegments,
3386
+ isIPv4,
3387
+ isUUID,
3388
+ normalizeIPv6,
3389
+ stringArrayToHexStripped
3390
+ };
3391
+ }
3392
+ });
3393
+
3394
+ // ../../node_modules/.bun/fast-uri@3.1.2/node_modules/fast-uri/lib/schemes.js
3395
+ var require_schemes = __commonJS({
3396
+ "../../node_modules/.bun/fast-uri@3.1.2/node_modules/fast-uri/lib/schemes.js"(exports, module) {
3397
+ "use strict";
3398
+ var { isUUID } = require_utils();
3399
+ var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
3400
+ var supportedSchemeNames = (
3401
+ /** @type {const} */
3402
+ [
3403
+ "http",
3404
+ "https",
3405
+ "ws",
3406
+ "wss",
3407
+ "urn",
3408
+ "urn:uuid"
3409
+ ]
3410
+ );
3411
+ function isValidSchemeName(name) {
3412
+ return supportedSchemeNames.indexOf(
3413
+ /** @type {*} */
3414
+ name
3415
+ ) !== -1;
3416
+ }
3417
+ function wsIsSecure(wsComponent) {
3418
+ if (wsComponent.secure === true) {
3419
+ return true;
3420
+ } else if (wsComponent.secure === false) {
3421
+ return false;
3422
+ } else if (wsComponent.scheme) {
3423
+ return wsComponent.scheme.length === 3 && (wsComponent.scheme[0] === "w" || wsComponent.scheme[0] === "W") && (wsComponent.scheme[1] === "s" || wsComponent.scheme[1] === "S") && (wsComponent.scheme[2] === "s" || wsComponent.scheme[2] === "S");
3424
+ } else {
3425
+ return false;
3426
+ }
3427
+ }
3428
+ function httpParse(component) {
3429
+ if (!component.host) {
3430
+ component.error = component.error || "HTTP URIs must have a host.";
3431
+ }
3432
+ return component;
3433
+ }
3434
+ function httpSerialize(component) {
3435
+ const secure = String(component.scheme).toLowerCase() === "https";
3436
+ if (component.port === (secure ? 443 : 80) || component.port === "") {
3437
+ component.port = void 0;
3438
+ }
3439
+ if (!component.path) {
3440
+ component.path = "/";
3441
+ }
3442
+ return component;
3443
+ }
3444
+ function wsParse(wsComponent) {
3445
+ wsComponent.secure = wsIsSecure(wsComponent);
3446
+ wsComponent.resourceName = (wsComponent.path || "/") + (wsComponent.query ? "?" + wsComponent.query : "");
3447
+ wsComponent.path = void 0;
3448
+ wsComponent.query = void 0;
3449
+ return wsComponent;
3450
+ }
3451
+ function wsSerialize(wsComponent) {
3452
+ if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === "") {
3453
+ wsComponent.port = void 0;
3454
+ }
3455
+ if (typeof wsComponent.secure === "boolean") {
3456
+ wsComponent.scheme = wsComponent.secure ? "wss" : "ws";
3457
+ wsComponent.secure = void 0;
3458
+ }
3459
+ if (wsComponent.resourceName) {
3460
+ const [path, query] = wsComponent.resourceName.split("?");
3461
+ wsComponent.path = path && path !== "/" ? path : void 0;
3462
+ wsComponent.query = query;
3463
+ wsComponent.resourceName = void 0;
3464
+ }
3465
+ wsComponent.fragment = void 0;
3466
+ return wsComponent;
3467
+ }
3468
+ function urnParse(urnComponent, options) {
3469
+ if (!urnComponent.path) {
3470
+ urnComponent.error = "URN can not be parsed";
3471
+ return urnComponent;
3472
+ }
3473
+ const matches = urnComponent.path.match(URN_REG);
3474
+ if (matches) {
3475
+ const scheme = options.scheme || urnComponent.scheme || "urn";
3476
+ urnComponent.nid = matches[1].toLowerCase();
3477
+ urnComponent.nss = matches[2];
3478
+ const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`;
3479
+ const schemeHandler = getSchemeHandler(urnScheme);
3480
+ urnComponent.path = void 0;
3481
+ if (schemeHandler) {
3482
+ urnComponent = schemeHandler.parse(urnComponent, options);
3483
+ }
3484
+ } else {
3485
+ urnComponent.error = urnComponent.error || "URN can not be parsed.";
3486
+ }
3487
+ return urnComponent;
3488
+ }
3489
+ function urnSerialize(urnComponent, options) {
3490
+ if (urnComponent.nid === void 0) {
3491
+ throw new Error("URN without nid cannot be serialized");
3492
+ }
3493
+ const scheme = options.scheme || urnComponent.scheme || "urn";
3494
+ const nid = urnComponent.nid.toLowerCase();
3495
+ const urnScheme = `${scheme}:${options.nid || nid}`;
3496
+ const schemeHandler = getSchemeHandler(urnScheme);
3497
+ if (schemeHandler) {
3498
+ urnComponent = schemeHandler.serialize(urnComponent, options);
3499
+ }
3500
+ const uriComponent = urnComponent;
3501
+ const nss = urnComponent.nss;
3502
+ uriComponent.path = `${nid || options.nid}:${nss}`;
3503
+ options.skipEscape = true;
3504
+ return uriComponent;
3505
+ }
3506
+ function urnuuidParse(urnComponent, options) {
3507
+ const uuidComponent = urnComponent;
3508
+ uuidComponent.uuid = uuidComponent.nss;
3509
+ uuidComponent.nss = void 0;
3510
+ if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) {
3511
+ uuidComponent.error = uuidComponent.error || "UUID is not valid.";
3512
+ }
3513
+ return uuidComponent;
3514
+ }
3515
+ function urnuuidSerialize(uuidComponent) {
3516
+ const urnComponent = uuidComponent;
3517
+ urnComponent.nss = (uuidComponent.uuid || "").toLowerCase();
3518
+ return urnComponent;
3519
+ }
3520
+ var http = (
3521
+ /** @type {SchemeHandler} */
3522
+ {
3523
+ scheme: "http",
3524
+ domainHost: true,
3525
+ parse: httpParse,
3526
+ serialize: httpSerialize
3527
+ }
3528
+ );
3529
+ var https = (
3530
+ /** @type {SchemeHandler} */
3531
+ {
3532
+ scheme: "https",
3533
+ domainHost: http.domainHost,
3534
+ parse: httpParse,
3535
+ serialize: httpSerialize
3536
+ }
3537
+ );
3538
+ var ws = (
3539
+ /** @type {SchemeHandler} */
3540
+ {
3541
+ scheme: "ws",
3542
+ domainHost: true,
3543
+ parse: wsParse,
3544
+ serialize: wsSerialize
3545
+ }
3546
+ );
3547
+ var wss = (
3548
+ /** @type {SchemeHandler} */
3549
+ {
3550
+ scheme: "wss",
3551
+ domainHost: ws.domainHost,
3552
+ parse: ws.parse,
3553
+ serialize: ws.serialize
3554
+ }
3555
+ );
3556
+ var urn = (
3557
+ /** @type {SchemeHandler} */
3558
+ {
3559
+ scheme: "urn",
3560
+ parse: urnParse,
3561
+ serialize: urnSerialize,
3562
+ skipNormalize: true
3563
+ }
3564
+ );
3565
+ var urnuuid = (
3566
+ /** @type {SchemeHandler} */
3567
+ {
3568
+ scheme: "urn:uuid",
3569
+ parse: urnuuidParse,
3570
+ serialize: urnuuidSerialize,
3571
+ skipNormalize: true
3572
+ }
3573
+ );
3574
+ var SCHEMES = (
3575
+ /** @type {Record<SchemeName, SchemeHandler>} */
3576
+ {
3577
+ http,
3578
+ https,
3579
+ ws,
3580
+ wss,
3581
+ urn,
3582
+ "urn:uuid": urnuuid
3583
+ }
3584
+ );
3585
+ Object.setPrototypeOf(SCHEMES, null);
3586
+ function getSchemeHandler(scheme) {
3587
+ return scheme && (SCHEMES[
3588
+ /** @type {SchemeName} */
3589
+ scheme
3590
+ ] || SCHEMES[
3591
+ /** @type {SchemeName} */
3592
+ scheme.toLowerCase()
3593
+ ]) || void 0;
3594
+ }
3595
+ module.exports = {
3596
+ wsIsSecure,
3597
+ SCHEMES,
3598
+ isValidSchemeName,
3599
+ getSchemeHandler
3600
+ };
3601
+ }
3602
+ });
3603
+
3604
+ // ../../node_modules/.bun/fast-uri@3.1.2/node_modules/fast-uri/index.js
3605
+ var require_fast_uri = __commonJS({
3606
+ "../../node_modules/.bun/fast-uri@3.1.2/node_modules/fast-uri/index.js"(exports, module) {
3607
+ "use strict";
3608
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3609
+ var { SCHEMES, getSchemeHandler } = require_schemes();
3610
+ function normalize(uri, options) {
3611
+ if (typeof uri === "string") {
3612
+ uri = /** @type {T} */
3613
+ normalizeString(uri, options);
3614
+ } else if (typeof uri === "object") {
3615
+ uri = /** @type {T} */
3616
+ parse(serialize(uri, options), options);
3617
+ }
3618
+ return uri;
3619
+ }
3620
+ function resolve(baseURI, relativeURI, options) {
3621
+ const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3622
+ const resolved = resolveComponent(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
3623
+ schemelessOptions.skipEscape = true;
3624
+ return serialize(resolved, schemelessOptions);
3625
+ }
3626
+ function resolveComponent(base, relative, options, skipNormalization) {
3627
+ const target = {};
3628
+ if (!skipNormalization) {
3629
+ base = parse(serialize(base, options), options);
3630
+ relative = parse(serialize(relative, options), options);
3631
+ }
3632
+ options = options || {};
3633
+ if (!options.tolerant && relative.scheme) {
3634
+ target.scheme = relative.scheme;
3635
+ target.userinfo = relative.userinfo;
3636
+ target.host = relative.host;
3637
+ target.port = relative.port;
3638
+ target.path = removeDotSegments(relative.path || "");
3639
+ target.query = relative.query;
3640
+ } else {
3641
+ if (relative.userinfo !== void 0 || relative.host !== void 0 || relative.port !== void 0) {
3642
+ target.userinfo = relative.userinfo;
3643
+ target.host = relative.host;
3644
+ target.port = relative.port;
3645
+ target.path = removeDotSegments(relative.path || "");
3646
+ target.query = relative.query;
3647
+ } else {
3648
+ if (!relative.path) {
3649
+ target.path = base.path;
3650
+ if (relative.query !== void 0) {
3651
+ target.query = relative.query;
3652
+ } else {
3653
+ target.query = base.query;
3654
+ }
3655
+ } else {
3656
+ if (relative.path[0] === "/") {
3657
+ target.path = removeDotSegments(relative.path);
3658
+ } else {
3659
+ if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
3660
+ target.path = "/" + relative.path;
3661
+ } else if (!base.path) {
3662
+ target.path = relative.path;
3663
+ } else {
3664
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
3665
+ }
3666
+ target.path = removeDotSegments(target.path);
3667
+ }
3668
+ target.query = relative.query;
3669
+ }
3670
+ target.userinfo = base.userinfo;
3671
+ target.host = base.host;
3672
+ target.port = base.port;
3673
+ }
3674
+ target.scheme = base.scheme;
3675
+ }
3676
+ target.fragment = relative.fragment;
3677
+ return target;
3678
+ }
3679
+ function equal(uriA, uriB, options) {
3680
+ const normalizedA = normalizeComparableURI(uriA, options);
3681
+ const normalizedB = normalizeComparableURI(uriB, options);
3682
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
3683
+ }
3684
+ function serialize(cmpts, opts) {
3685
+ const component = {
3686
+ host: cmpts.host,
3687
+ scheme: cmpts.scheme,
3688
+ userinfo: cmpts.userinfo,
3689
+ port: cmpts.port,
3690
+ path: cmpts.path,
3691
+ query: cmpts.query,
3692
+ nid: cmpts.nid,
3693
+ nss: cmpts.nss,
3694
+ uuid: cmpts.uuid,
3695
+ fragment: cmpts.fragment,
3696
+ reference: cmpts.reference,
3697
+ resourceName: cmpts.resourceName,
3698
+ secure: cmpts.secure,
3699
+ error: ""
3700
+ };
3701
+ const options = Object.assign({}, opts);
3702
+ const uriTokens = [];
3703
+ const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
3704
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3705
+ if (component.path !== void 0) {
3706
+ if (!options.skipEscape) {
3707
+ component.path = escapePreservingEscapes(component.path);
3708
+ if (component.scheme !== void 0) {
3709
+ component.path = component.path.split("%3A").join(":");
3710
+ }
3711
+ } else {
3712
+ component.path = normalizePercentEncoding(component.path);
3713
+ }
3714
+ }
3715
+ if (options.reference !== "suffix" && component.scheme) {
3716
+ uriTokens.push(component.scheme, ":");
3717
+ }
3718
+ const authority = recomposeAuthority(component);
3719
+ if (authority !== void 0) {
3720
+ if (options.reference !== "suffix") {
3721
+ uriTokens.push("//");
3722
+ }
3723
+ uriTokens.push(authority);
3724
+ if (component.path && component.path[0] !== "/") {
3725
+ uriTokens.push("/");
3726
+ }
3727
+ }
3728
+ if (component.path !== void 0) {
3729
+ let s = component.path;
3730
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
3731
+ s = removeDotSegments(s);
3732
+ }
3733
+ if (authority === void 0 && s[0] === "/" && s[1] === "/") {
3734
+ s = "/%2F" + s.slice(2);
3735
+ }
3736
+ uriTokens.push(s);
3737
+ }
3738
+ if (component.query !== void 0) {
3739
+ uriTokens.push("?", component.query);
3740
+ }
3741
+ if (component.fragment !== void 0) {
3742
+ uriTokens.push("#", component.fragment);
3743
+ }
3744
+ return uriTokens.join("");
3745
+ }
3746
+ var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
3747
+ function getParseError(parsed, matches) {
3748
+ if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
3749
+ return 'URI path must start with "/" when authority is present.';
3750
+ }
3751
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
3752
+ return "URI port is malformed.";
3753
+ }
3754
+ return void 0;
3755
+ }
3756
+ function parseWithStatus(uri, opts) {
3757
+ const options = Object.assign({}, opts);
3758
+ const parsed = {
3759
+ scheme: void 0,
3760
+ userinfo: void 0,
3761
+ host: "",
3762
+ port: void 0,
3763
+ path: "",
3764
+ query: void 0,
3765
+ fragment: void 0
3766
+ };
3767
+ let malformedAuthorityOrPort = false;
3768
+ let isIP = false;
3769
+ if (options.reference === "suffix") {
3770
+ if (options.scheme) {
3771
+ uri = options.scheme + ":" + uri;
3772
+ } else {
3773
+ uri = "//" + uri;
3774
+ }
3775
+ }
3776
+ const matches = uri.match(URI_PARSE);
3777
+ if (matches) {
3778
+ parsed.scheme = matches[1];
3779
+ parsed.userinfo = matches[3];
3780
+ parsed.host = matches[4];
3781
+ parsed.port = parseInt(matches[5], 10);
3782
+ parsed.path = matches[6] || "";
3783
+ parsed.query = matches[7];
3784
+ parsed.fragment = matches[8];
3785
+ if (isNaN(parsed.port)) {
3786
+ parsed.port = matches[5];
3787
+ }
3788
+ const parseError = getParseError(parsed, matches);
3789
+ if (parseError !== void 0) {
3790
+ parsed.error = parsed.error || parseError;
3791
+ malformedAuthorityOrPort = true;
3792
+ }
3793
+ if (parsed.host) {
3794
+ const ipv4result = isIPv4(parsed.host);
3795
+ if (ipv4result === false) {
3796
+ const ipv6result = normalizeIPv6(parsed.host);
3797
+ parsed.host = ipv6result.host.toLowerCase();
3798
+ isIP = ipv6result.isIPV6;
3799
+ } else {
3800
+ isIP = true;
3801
+ }
3802
+ }
3803
+ if (parsed.scheme === void 0 && parsed.userinfo === void 0 && parsed.host === void 0 && parsed.port === void 0 && parsed.query === void 0 && !parsed.path) {
3804
+ parsed.reference = "same-document";
3805
+ } else if (parsed.scheme === void 0) {
3806
+ parsed.reference = "relative";
3807
+ } else if (parsed.fragment === void 0) {
3808
+ parsed.reference = "absolute";
3809
+ } else {
3810
+ parsed.reference = "uri";
3811
+ }
3812
+ if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) {
3813
+ parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
3814
+ }
3815
+ const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
3816
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
3817
+ if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
3818
+ try {
3819
+ parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
3820
+ } catch (e) {
3821
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
3822
+ }
3823
+ }
3824
+ }
3825
+ if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
3826
+ if (uri.indexOf("%") !== -1) {
3827
+ if (parsed.scheme !== void 0) {
3828
+ parsed.scheme = unescape(parsed.scheme);
3829
+ }
3830
+ if (parsed.host !== void 0) {
3831
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
3832
+ }
3833
+ }
3834
+ if (parsed.path) {
3835
+ parsed.path = normalizePathEncoding(parsed.path);
3836
+ }
3837
+ if (parsed.fragment) {
3838
+ try {
3839
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3840
+ } catch {
3841
+ parsed.error = parsed.error || "URI malformed";
3842
+ }
3843
+ }
3844
+ }
3845
+ if (schemeHandler && schemeHandler.parse) {
3846
+ schemeHandler.parse(parsed, options);
3847
+ }
3848
+ } else {
3849
+ parsed.error = parsed.error || "URI can not be parsed.";
3850
+ }
3851
+ return { parsed, malformedAuthorityOrPort };
3852
+ }
3853
+ function parse(uri, opts) {
3854
+ return parseWithStatus(uri, opts).parsed;
3855
+ }
3856
+ function normalizeString(uri, opts) {
3857
+ return normalizeStringWithStatus(uri, opts).normalized;
3858
+ }
3859
+ function normalizeStringWithStatus(uri, opts) {
3860
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
3861
+ return {
3862
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
3863
+ malformedAuthorityOrPort
3864
+ };
3865
+ }
3866
+ function normalizeComparableURI(uri, opts) {
3867
+ if (typeof uri === "string") {
3868
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
3869
+ return malformedAuthorityOrPort ? void 0 : normalized;
3870
+ }
3871
+ if (typeof uri === "object") {
3872
+ return serialize(uri, opts);
3873
+ }
3874
+ }
3875
+ var fastUri = {
3876
+ SCHEMES,
3877
+ normalize,
3878
+ resolve,
3879
+ resolveComponent,
3880
+ equal,
3881
+ serialize,
3882
+ parse
3883
+ };
3884
+ module.exports = fastUri;
3885
+ module.exports.default = fastUri;
3886
+ module.exports.fastUri = fastUri;
3887
+ }
3888
+ });
3889
+
3890
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js
3891
+ var require_uri = __commonJS({
3892
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js"(exports) {
3893
+ "use strict";
3894
+ Object.defineProperty(exports, "__esModule", { value: true });
3895
+ var uri = require_fast_uri();
3896
+ uri.code = 'require("ajv/dist/runtime/uri").default';
3897
+ exports.default = uri;
3898
+ }
3899
+ });
3900
+
3901
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/core.js
3902
+ var require_core = __commonJS({
3903
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/core.js"(exports) {
3904
+ "use strict";
3905
+ Object.defineProperty(exports, "__esModule", { value: true });
3906
+ exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
3907
+ var validate_1 = require_validate();
3908
+ Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
3909
+ return validate_1.KeywordCxt;
3910
+ } });
3911
+ var codegen_1 = require_codegen();
3912
+ Object.defineProperty(exports, "_", { enumerable: true, get: function() {
3913
+ return codegen_1._;
3914
+ } });
3915
+ Object.defineProperty(exports, "str", { enumerable: true, get: function() {
3916
+ return codegen_1.str;
3917
+ } });
3918
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function() {
3919
+ return codegen_1.stringify;
3920
+ } });
3921
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function() {
3922
+ return codegen_1.nil;
3923
+ } });
3924
+ Object.defineProperty(exports, "Name", { enumerable: true, get: function() {
3925
+ return codegen_1.Name;
3926
+ } });
3927
+ Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
3928
+ return codegen_1.CodeGen;
3929
+ } });
3930
+ var validation_error_1 = require_validation_error();
3931
+ var ref_error_1 = require_ref_error();
3932
+ var rules_1 = require_rules();
3933
+ var compile_1 = require_compile();
3934
+ var codegen_2 = require_codegen();
3935
+ var resolve_1 = require_resolve();
3936
+ var dataType_1 = require_dataType();
3937
+ var util_1 = require_util();
3938
+ var $dataRefSchema = require_data();
3939
+ var uri_1 = require_uri();
3940
+ var defaultRegExp = (str, flags) => new RegExp(str, flags);
3941
+ defaultRegExp.code = "new RegExp";
3942
+ var META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
3943
+ var EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
3944
+ "validate",
3945
+ "serialize",
3946
+ "parse",
3947
+ "wrapper",
3948
+ "root",
3949
+ "schema",
3950
+ "keyword",
3951
+ "pattern",
3952
+ "formats",
3953
+ "validate$data",
3954
+ "func",
3955
+ "obj",
3956
+ "Error"
3957
+ ]);
3958
+ var removedOptions = {
3959
+ errorDataPath: "",
3960
+ format: "`validateFormats: false` can be used instead.",
3961
+ nullable: '"nullable" keyword is supported by default.',
3962
+ jsonPointers: "Deprecated jsPropertySyntax can be used instead.",
3963
+ extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.",
3964
+ missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.",
3965
+ processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`",
3966
+ sourceCode: "Use option `code: {source: true}`",
3967
+ strictDefaults: "It is default now, see option `strict`.",
3968
+ strictKeywords: "It is default now, see option `strict`.",
3969
+ uniqueItems: '"uniqueItems" keyword is always validated.',
3970
+ unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",
3971
+ cache: "Map is used as cache, schema object as key.",
3972
+ serialize: "Map is used as cache, schema object as key.",
3973
+ ajvErrors: "It is default now."
3974
+ };
3975
+ var deprecatedOptions = {
3976
+ ignoreKeywordsWithRef: "",
3977
+ jsPropertySyntax: "",
3978
+ unicode: '"minLength"/"maxLength" account for unicode characters by default.'
3979
+ };
3980
+ var MAX_EXPRESSION = 200;
3981
+ function requiredOptions(o) {
3982
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
3983
+ const s = o.strict;
3984
+ const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
3985
+ const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
3986
+ const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
3987
+ const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
3988
+ return {
3989
+ strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true,
3990
+ strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true,
3991
+ strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log",
3992
+ strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log",
3993
+ strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false,
3994
+ code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp },
3995
+ loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION,
3996
+ loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,
3997
+ meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true,
3998
+ messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true,
3999
+ inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true,
4000
+ schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id",
4001
+ addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true,
4002
+ validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true,
4003
+ validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true,
4004
+ unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true,
4005
+ int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true,
4006
+ uriResolver
4007
+ };
4008
+ }
4009
+ var Ajv = class {
4010
+ constructor(opts = {}) {
4011
+ this.schemas = {};
4012
+ this.refs = {};
4013
+ this.formats = /* @__PURE__ */ Object.create(null);
4014
+ this._compilations = /* @__PURE__ */ new Set();
4015
+ this._loading = {};
4016
+ this._cache = /* @__PURE__ */ new Map();
4017
+ opts = this.opts = { ...opts, ...requiredOptions(opts) };
4018
+ const { es5, lines } = this.opts.code;
4019
+ this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines });
4020
+ this.logger = getLogger(opts.logger);
4021
+ const formatOpt = opts.validateFormats;
4022
+ opts.validateFormats = false;
4023
+ this.RULES = (0, rules_1.getRules)();
4024
+ checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED");
4025
+ checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn");
4026
+ this._metaOpts = getMetaSchemaOptions.call(this);
4027
+ if (opts.formats)
4028
+ addInitialFormats.call(this);
4029
+ this._addVocabularies();
4030
+ this._addDefaultMetaSchema();
4031
+ if (opts.keywords)
4032
+ addInitialKeywords.call(this, opts.keywords);
4033
+ if (typeof opts.meta == "object")
4034
+ this.addMetaSchema(opts.meta);
4035
+ addInitialSchemas.call(this);
4036
+ opts.validateFormats = formatOpt;
4037
+ }
4038
+ _addVocabularies() {
4039
+ this.addKeyword("$async");
4040
+ }
4041
+ _addDefaultMetaSchema() {
4042
+ const { $data, meta, schemaId } = this.opts;
4043
+ let _dataRefSchema = $dataRefSchema;
4044
+ if (schemaId === "id") {
4045
+ _dataRefSchema = { ...$dataRefSchema };
4046
+ _dataRefSchema.id = _dataRefSchema.$id;
4047
+ delete _dataRefSchema.$id;
4048
+ }
4049
+ if (meta && $data)
4050
+ this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);
4051
+ }
4052
+ defaultMeta() {
4053
+ const { meta, schemaId } = this.opts;
4054
+ return this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : void 0;
4055
+ }
4056
+ validate(schemaKeyRef, data) {
4057
+ let v;
4058
+ if (typeof schemaKeyRef == "string") {
4059
+ v = this.getSchema(schemaKeyRef);
4060
+ if (!v)
4061
+ throw new Error(`no schema with key or ref "${schemaKeyRef}"`);
4062
+ } else {
4063
+ v = this.compile(schemaKeyRef);
4064
+ }
4065
+ const valid = v(data);
4066
+ if (!("$async" in v))
4067
+ this.errors = v.errors;
4068
+ return valid;
4069
+ }
4070
+ compile(schema, _meta) {
4071
+ const sch = this._addSchema(schema, _meta);
4072
+ return sch.validate || this._compileSchemaEnv(sch);
4073
+ }
4074
+ compileAsync(schema, meta) {
4075
+ if (typeof this.opts.loadSchema != "function") {
4076
+ throw new Error("options.loadSchema should be a function");
4077
+ }
4078
+ const { loadSchema } = this.opts;
4079
+ return runCompileAsync.call(this, schema, meta);
4080
+ async function runCompileAsync(_schema, _meta) {
4081
+ await loadMetaSchema.call(this, _schema.$schema);
4082
+ const sch = this._addSchema(_schema, _meta);
4083
+ return sch.validate || _compileAsync.call(this, sch);
4084
+ }
4085
+ async function loadMetaSchema($ref) {
4086
+ if ($ref && !this.getSchema($ref)) {
4087
+ await runCompileAsync.call(this, { $ref }, true);
4088
+ }
4089
+ }
4090
+ async function _compileAsync(sch) {
4091
+ try {
4092
+ return this._compileSchemaEnv(sch);
4093
+ } catch (e) {
4094
+ if (!(e instanceof ref_error_1.default))
4095
+ throw e;
4096
+ checkLoaded.call(this, e);
4097
+ await loadMissingSchema.call(this, e.missingSchema);
4098
+ return _compileAsync.call(this, sch);
4099
+ }
4100
+ }
4101
+ function checkLoaded({ missingSchema: ref, missingRef }) {
4102
+ if (this.refs[ref]) {
4103
+ throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`);
4104
+ }
4105
+ }
4106
+ async function loadMissingSchema(ref) {
4107
+ const _schema = await _loadSchema.call(this, ref);
4108
+ if (!this.refs[ref])
4109
+ await loadMetaSchema.call(this, _schema.$schema);
4110
+ if (!this.refs[ref])
4111
+ this.addSchema(_schema, ref, meta);
4112
+ }
4113
+ async function _loadSchema(ref) {
4114
+ const p = this._loading[ref];
4115
+ if (p)
4116
+ return p;
4117
+ try {
4118
+ return await (this._loading[ref] = loadSchema(ref));
4119
+ } finally {
4120
+ delete this._loading[ref];
4121
+ }
4122
+ }
4123
+ }
4124
+ // Adds schema to the instance
4125
+ addSchema(schema, key, _meta, _validateSchema = this.opts.validateSchema) {
4126
+ if (Array.isArray(schema)) {
4127
+ for (const sch of schema)
4128
+ this.addSchema(sch, void 0, _meta, _validateSchema);
4129
+ return this;
4130
+ }
4131
+ let id;
4132
+ if (typeof schema === "object") {
4133
+ const { schemaId } = this.opts;
4134
+ id = schema[schemaId];
4135
+ if (id !== void 0 && typeof id != "string") {
4136
+ throw new Error(`schema ${schemaId} must be string`);
4137
+ }
4138
+ }
4139
+ key = (0, resolve_1.normalizeId)(key || id);
4140
+ this._checkUnique(key);
4141
+ this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
4142
+ return this;
4143
+ }
4144
+ // Add schema that will be used to validate other schemas
4145
+ // options in META_IGNORE_OPTIONS are alway set to false
4146
+ addMetaSchema(schema, key, _validateSchema = this.opts.validateSchema) {
4147
+ this.addSchema(schema, key, true, _validateSchema);
4148
+ return this;
4149
+ }
4150
+ // Validate schema against its meta-schema
4151
+ validateSchema(schema, throwOrLogError) {
4152
+ if (typeof schema == "boolean")
4153
+ return true;
4154
+ let $schema;
4155
+ $schema = schema.$schema;
4156
+ if ($schema !== void 0 && typeof $schema != "string") {
4157
+ throw new Error("$schema must be a string");
4158
+ }
4159
+ $schema = $schema || this.opts.defaultMeta || this.defaultMeta();
4160
+ if (!$schema) {
4161
+ this.logger.warn("meta-schema not available");
4162
+ this.errors = null;
4163
+ return true;
4164
+ }
4165
+ const valid = this.validate($schema, schema);
4166
+ if (!valid && throwOrLogError) {
4167
+ const message = "schema is invalid: " + this.errorsText();
4168
+ if (this.opts.validateSchema === "log")
4169
+ this.logger.error(message);
4170
+ else
4171
+ throw new Error(message);
4172
+ }
4173
+ return valid;
4174
+ }
4175
+ // Get compiled schema by `key` or `ref`.
4176
+ // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
4177
+ getSchema(keyRef) {
4178
+ let sch;
4179
+ while (typeof (sch = getSchEnv.call(this, keyRef)) == "string")
4180
+ keyRef = sch;
4181
+ if (sch === void 0) {
4182
+ const { schemaId } = this.opts;
4183
+ const root = new compile_1.SchemaEnv({ schema: {}, schemaId });
4184
+ sch = compile_1.resolveSchema.call(this, root, keyRef);
4185
+ if (!sch)
4186
+ return;
4187
+ this.refs[keyRef] = sch;
4188
+ }
4189
+ return sch.validate || this._compileSchemaEnv(sch);
4190
+ }
4191
+ // Remove cached schema(s).
4192
+ // If no parameter is passed all schemas but meta-schemas are removed.
4193
+ // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
4194
+ // Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
4195
+ removeSchema(schemaKeyRef) {
4196
+ if (schemaKeyRef instanceof RegExp) {
4197
+ this._removeAllSchemas(this.schemas, schemaKeyRef);
4198
+ this._removeAllSchemas(this.refs, schemaKeyRef);
4199
+ return this;
4200
+ }
4201
+ switch (typeof schemaKeyRef) {
4202
+ case "undefined":
4203
+ this._removeAllSchemas(this.schemas);
4204
+ this._removeAllSchemas(this.refs);
4205
+ this._cache.clear();
4206
+ return this;
4207
+ case "string": {
4208
+ const sch = getSchEnv.call(this, schemaKeyRef);
4209
+ if (typeof sch == "object")
4210
+ this._cache.delete(sch.schema);
4211
+ delete this.schemas[schemaKeyRef];
4212
+ delete this.refs[schemaKeyRef];
4213
+ return this;
4214
+ }
4215
+ case "object": {
4216
+ const cacheKey = schemaKeyRef;
4217
+ this._cache.delete(cacheKey);
4218
+ let id = schemaKeyRef[this.opts.schemaId];
4219
+ if (id) {
4220
+ id = (0, resolve_1.normalizeId)(id);
4221
+ delete this.schemas[id];
4222
+ delete this.refs[id];
4223
+ }
4224
+ return this;
4225
+ }
4226
+ default:
4227
+ throw new Error("ajv.removeSchema: invalid parameter");
4228
+ }
4229
+ }
4230
+ // add "vocabulary" - a collection of keywords
4231
+ addVocabulary(definitions) {
4232
+ for (const def of definitions)
4233
+ this.addKeyword(def);
4234
+ return this;
4235
+ }
4236
+ addKeyword(kwdOrDef, def) {
4237
+ let keyword;
4238
+ if (typeof kwdOrDef == "string") {
4239
+ keyword = kwdOrDef;
4240
+ if (typeof def == "object") {
4241
+ this.logger.warn("these parameters are deprecated, see docs for addKeyword");
4242
+ def.keyword = keyword;
4243
+ }
4244
+ } else if (typeof kwdOrDef == "object" && def === void 0) {
4245
+ def = kwdOrDef;
4246
+ keyword = def.keyword;
4247
+ if (Array.isArray(keyword) && !keyword.length) {
4248
+ throw new Error("addKeywords: keyword must be string or non-empty array");
4249
+ }
4250
+ } else {
4251
+ throw new Error("invalid addKeywords parameters");
4252
+ }
4253
+ checkKeyword.call(this, keyword, def);
4254
+ if (!def) {
4255
+ (0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd));
4256
+ return this;
4257
+ }
4258
+ keywordMetaschema.call(this, def);
4259
+ const definition = {
4260
+ ...def,
4261
+ type: (0, dataType_1.getJSONTypes)(def.type),
4262
+ schemaType: (0, dataType_1.getJSONTypes)(def.schemaType)
4263
+ };
4264
+ (0, util_1.eachItem)(keyword, definition.type.length === 0 ? (k) => addRule.call(this, k, definition) : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)));
4265
+ return this;
4266
+ }
4267
+ getKeyword(keyword) {
4268
+ const rule = this.RULES.all[keyword];
4269
+ return typeof rule == "object" ? rule.definition : !!rule;
4270
+ }
4271
+ // Remove keyword
4272
+ removeKeyword(keyword) {
4273
+ const { RULES } = this;
4274
+ delete RULES.keywords[keyword];
4275
+ delete RULES.all[keyword];
4276
+ for (const group of RULES.rules) {
4277
+ const i = group.rules.findIndex((rule) => rule.keyword === keyword);
4278
+ if (i >= 0)
4279
+ group.rules.splice(i, 1);
4280
+ }
4281
+ return this;
4282
+ }
4283
+ // Add format
4284
+ addFormat(name, format) {
4285
+ if (typeof format == "string")
4286
+ format = new RegExp(format);
4287
+ this.formats[name] = format;
4288
+ return this;
4289
+ }
4290
+ errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
4291
+ if (!errors || errors.length === 0)
4292
+ return "No errors";
4293
+ return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text, msg) => text + separator + msg);
4294
+ }
4295
+ $dataMetaSchema(metaSchema, keywordsJsonPointers) {
4296
+ const rules = this.RULES.all;
4297
+ metaSchema = JSON.parse(JSON.stringify(metaSchema));
4298
+ for (const jsonPointer of keywordsJsonPointers) {
4299
+ const segments = jsonPointer.split("/").slice(1);
4300
+ let keywords = metaSchema;
4301
+ for (const seg of segments)
4302
+ keywords = keywords[seg];
4303
+ for (const key in rules) {
4304
+ const rule = rules[key];
4305
+ if (typeof rule != "object")
4306
+ continue;
4307
+ const { $data } = rule.definition;
4308
+ const schema = keywords[key];
4309
+ if ($data && schema)
4310
+ keywords[key] = schemaOrData(schema);
4311
+ }
4312
+ }
4313
+ return metaSchema;
4314
+ }
4315
+ _removeAllSchemas(schemas, regex) {
4316
+ for (const keyRef in schemas) {
4317
+ const sch = schemas[keyRef];
4318
+ if (!regex || regex.test(keyRef)) {
4319
+ if (typeof sch == "string") {
4320
+ delete schemas[keyRef];
4321
+ } else if (sch && !sch.meta) {
4322
+ this._cache.delete(sch.schema);
4323
+ delete schemas[keyRef];
4324
+ }
4325
+ }
4326
+ }
4327
+ }
4328
+ _addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
4329
+ let id;
4330
+ const { schemaId } = this.opts;
4331
+ if (typeof schema == "object") {
4332
+ id = schema[schemaId];
4333
+ } else {
4334
+ if (this.opts.jtd)
4335
+ throw new Error("schema must be object");
4336
+ else if (typeof schema != "boolean")
4337
+ throw new Error("schema must be object or boolean");
4338
+ }
4339
+ let sch = this._cache.get(schema);
4340
+ if (sch !== void 0)
4341
+ return sch;
4342
+ baseId = (0, resolve_1.normalizeId)(id || baseId);
4343
+ const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
4344
+ sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs });
4345
+ this._cache.set(sch.schema, sch);
4346
+ if (addSchema && !baseId.startsWith("#")) {
4347
+ if (baseId)
4348
+ this._checkUnique(baseId);
4349
+ this.refs[baseId] = sch;
4350
+ }
4351
+ if (validateSchema)
4352
+ this.validateSchema(schema, true);
4353
+ return sch;
4354
+ }
4355
+ _checkUnique(id) {
4356
+ if (this.schemas[id] || this.refs[id]) {
4357
+ throw new Error(`schema with key or id "${id}" already exists`);
4358
+ }
4359
+ }
4360
+ _compileSchemaEnv(sch) {
4361
+ if (sch.meta)
4362
+ this._compileMetaSchema(sch);
4363
+ else
4364
+ compile_1.compileSchema.call(this, sch);
4365
+ if (!sch.validate)
4366
+ throw new Error("ajv implementation error");
4367
+ return sch.validate;
4368
+ }
4369
+ _compileMetaSchema(sch) {
4370
+ const currentOpts = this.opts;
4371
+ this.opts = this._metaOpts;
4372
+ try {
4373
+ compile_1.compileSchema.call(this, sch);
4374
+ } finally {
4375
+ this.opts = currentOpts;
4376
+ }
4377
+ }
4378
+ };
4379
+ Ajv.ValidationError = validation_error_1.default;
4380
+ Ajv.MissingRefError = ref_error_1.default;
4381
+ exports.default = Ajv;
4382
+ function checkOptions(checkOpts, options, msg, log = "error") {
4383
+ for (const key in checkOpts) {
4384
+ const opt = key;
4385
+ if (opt in options)
4386
+ this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
4387
+ }
4388
+ }
4389
+ function getSchEnv(keyRef) {
4390
+ keyRef = (0, resolve_1.normalizeId)(keyRef);
4391
+ return this.schemas[keyRef] || this.refs[keyRef];
4392
+ }
4393
+ function addInitialSchemas() {
4394
+ const optsSchemas = this.opts.schemas;
4395
+ if (!optsSchemas)
4396
+ return;
4397
+ if (Array.isArray(optsSchemas))
4398
+ this.addSchema(optsSchemas);
4399
+ else
4400
+ for (const key in optsSchemas)
4401
+ this.addSchema(optsSchemas[key], key);
4402
+ }
4403
+ function addInitialFormats() {
4404
+ for (const name in this.opts.formats) {
4405
+ const format = this.opts.formats[name];
4406
+ if (format)
4407
+ this.addFormat(name, format);
4408
+ }
4409
+ }
4410
+ function addInitialKeywords(defs) {
4411
+ if (Array.isArray(defs)) {
4412
+ this.addVocabulary(defs);
4413
+ return;
4414
+ }
4415
+ this.logger.warn("keywords option as map is deprecated, pass array");
4416
+ for (const keyword in defs) {
4417
+ const def = defs[keyword];
4418
+ if (!def.keyword)
4419
+ def.keyword = keyword;
4420
+ this.addKeyword(def);
4421
+ }
4422
+ }
4423
+ function getMetaSchemaOptions() {
4424
+ const metaOpts = { ...this.opts };
4425
+ for (const opt of META_IGNORE_OPTIONS)
4426
+ delete metaOpts[opt];
4427
+ return metaOpts;
4428
+ }
4429
+ var noLogs = { log() {
4430
+ }, warn() {
4431
+ }, error() {
4432
+ } };
4433
+ function getLogger(logger) {
4434
+ if (logger === false)
4435
+ return noLogs;
4436
+ if (logger === void 0)
4437
+ return console;
4438
+ if (logger.log && logger.warn && logger.error)
4439
+ return logger;
4440
+ throw new Error("logger must implement log, warn and error methods");
4441
+ }
4442
+ var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
4443
+ function checkKeyword(keyword, def) {
4444
+ const { RULES } = this;
4445
+ (0, util_1.eachItem)(keyword, (kwd) => {
4446
+ if (RULES.keywords[kwd])
4447
+ throw new Error(`Keyword ${kwd} is already defined`);
4448
+ if (!KEYWORD_NAME.test(kwd))
4449
+ throw new Error(`Keyword ${kwd} has invalid name`);
4450
+ });
4451
+ if (!def)
4452
+ return;
4453
+ if (def.$data && !("code" in def || "validate" in def)) {
4454
+ throw new Error('$data keyword must have "code" or "validate" function');
4455
+ }
4456
+ }
4457
+ function addRule(keyword, definition, dataType) {
4458
+ var _a;
4459
+ const post = definition === null || definition === void 0 ? void 0 : definition.post;
4460
+ if (dataType && post)
4461
+ throw new Error('keyword with "post" flag cannot have "type"');
4462
+ const { RULES } = this;
4463
+ let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType);
4464
+ if (!ruleGroup) {
4465
+ ruleGroup = { type: dataType, rules: [] };
4466
+ RULES.rules.push(ruleGroup);
4467
+ }
4468
+ RULES.keywords[keyword] = true;
4469
+ if (!definition)
4470
+ return;
4471
+ const rule = {
4472
+ keyword,
4473
+ definition: {
4474
+ ...definition,
4475
+ type: (0, dataType_1.getJSONTypes)(definition.type),
4476
+ schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType)
4477
+ }
4478
+ };
4479
+ if (definition.before)
4480
+ addBeforeRule.call(this, ruleGroup, rule, definition.before);
4481
+ else
4482
+ ruleGroup.rules.push(rule);
4483
+ RULES.all[keyword] = rule;
4484
+ (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));
4485
+ }
4486
+ function addBeforeRule(ruleGroup, rule, before) {
4487
+ const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
4488
+ if (i >= 0) {
4489
+ ruleGroup.rules.splice(i, 0, rule);
4490
+ } else {
4491
+ ruleGroup.rules.push(rule);
4492
+ this.logger.warn(`rule ${before} is not defined`);
4493
+ }
4494
+ }
4495
+ function keywordMetaschema(def) {
4496
+ let { metaSchema } = def;
4497
+ if (metaSchema === void 0)
4498
+ return;
4499
+ if (def.$data && this.opts.$data)
4500
+ metaSchema = schemaOrData(metaSchema);
4501
+ def.validateSchema = this.compile(metaSchema, true);
4502
+ }
4503
+ var $dataRef = {
4504
+ $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
4505
+ };
4506
+ function schemaOrData(schema) {
4507
+ return { anyOf: [schema, $dataRef] };
4508
+ }
4509
+ }
4510
+ });
4511
+
4512
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js
4513
+ var require_types = __commonJS({
4514
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js"(exports) {
4515
+ "use strict";
4516
+ Object.defineProperty(exports, "__esModule", { value: true });
4517
+ exports.DiscrError = void 0;
4518
+ var DiscrError;
4519
+ (function(DiscrError2) {
4520
+ DiscrError2["Tag"] = "tag";
4521
+ DiscrError2["Mapping"] = "mapping";
4522
+ })(DiscrError || (exports.DiscrError = DiscrError = {}));
4523
+ }
4524
+ });
4525
+
4526
+ // ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js
4527
+ var require_ref = __commonJS({
4528
+ "../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js"(exports) {
4529
+ "use strict";
4530
+ Object.defineProperty(exports, "__esModule", { value: true });
4531
+ exports.callRef = exports.getValidate = void 0;
4532
+ var ref_error_1 = require_ref_error();
4533
+ var code_1 = require_code2();
4534
+ var codegen_1 = require_codegen();
4535
+ var names_1 = require_names();
4536
+ var compile_1 = require_compile();
4537
+ var util_1 = require_util();
4538
+ var def = {
4539
+ keyword: "$ref",
4540
+ schemaType: "string",
4541
+ code(cxt) {
4542
+ const { gen, schema: $ref, it } = cxt;
4543
+ const { baseId, schemaEnv: env, validateName, opts, self } = it;
4544
+ const { root } = env;
4545
+ if (($ref === "#" || $ref === "#/") && baseId === root.baseId)
4546
+ return callRootRef();
4547
+ const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref);
4548
+ if (schOrEnv === void 0)
4549
+ throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref);
4550
+ if (schOrEnv instanceof compile_1.SchemaEnv)
4551
+ return callValidate(schOrEnv);
4552
+ return inlineRefSchema(schOrEnv);
4553
+ function callRootRef() {
4554
+ if (env === root)
4555
+ return callRef(cxt, validateName, env, env.$async);
4556
+ const rootName = gen.scopeValue("root", { ref: root });
4557
+ return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root, root.$async);
4558
+ }
4559
+ function callValidate(sch) {
4560
+ const v = getValidate(cxt, sch);
4561
+ callRef(cxt, v, sch, sch.$async);
4562
+ }
4563
+ function inlineRefSchema(sch) {
4564
+ const schName = gen.scopeValue("schema", opts.code.source === true ? { ref: sch, code: (0, codegen_1.stringify)(sch) } : { ref: sch });
4565
+ const valid = gen.name("valid");
4566
+ const schCxt = cxt.subschema({
4567
+ schema: sch,
4568
+ dataTypes: [],
4569
+ schemaPath: codegen_1.nil,
4570
+ topSchemaRef: schName,
4571
+ errSchemaPath: $ref
4572
+ }, valid);
4573
+ cxt.mergeEvaluated(schCxt);
4574
+ cxt.ok(valid);
4575
+ }
4576
+ }
4577
+ };
4578
+ function getValidate(cxt, sch) {
4579
+ const { gen } = cxt;
4580
+ return sch.validate ? gen.scopeValue("validate", { ref: sch.validate }) : (0, codegen_1._)`${gen.scopeValue("wrapper", { ref: sch })}.validate`;
4581
+ }
4582
+ exports.getValidate = getValidate;
4583
+ function callRef(cxt, v, sch, $async) {
4584
+ const { gen, it } = cxt;
4585
+ const { allErrors, schemaEnv: env, opts } = it;
4586
+ const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil;
4587
+ if ($async)
4588
+ callAsyncRef();
4589
+ else
4590
+ callSyncRef();
4591
+ function callAsyncRef() {
4592
+ if (!env.$async)
4593
+ throw new Error("async schema referenced by sync schema");
4594
+ const valid = gen.let("valid");
4595
+ gen.try(() => {
4596
+ gen.code((0, codegen_1._)`await ${(0, code_1.callValidateCode)(cxt, v, passCxt)}`);
4597
+ addEvaluatedFrom(v);
4598
+ if (!allErrors)
4599
+ gen.assign(valid, true);
4600
+ }, (e) => {
4601
+ gen.if((0, codegen_1._)`!(${e} instanceof ${it.ValidationError})`, () => gen.throw(e));
4602
+ addErrorsFrom(e);
4603
+ if (!allErrors)
4604
+ gen.assign(valid, false);
4605
+ });
4606
+ cxt.ok(valid);
4607
+ }
4608
+ function callSyncRef() {
4609
+ cxt.result((0, code_1.callValidateCode)(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v));
4610
+ }
4611
+ function addErrorsFrom(source) {
4612
+ const errs = (0, codegen_1._)`${source}.errors`;
4613
+ gen.assign(names_1.default.vErrors, (0, codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`);
4614
+ gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
4615
+ }
4616
+ function addEvaluatedFrom(source) {
4617
+ var _a;
4618
+ if (!it.opts.unevaluated)
4619
+ return;
4620
+ const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated;
4621
+ if (it.props !== true) {
4622
+ if (schEvaluated && !schEvaluated.dynamicProps) {
4623
+ if (schEvaluated.props !== void 0) {
4624
+ it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props);
4625
+ }
4626
+ } else {
4627
+ const props = gen.var("props", (0, codegen_1._)`${source}.evaluated.props`);
4628
+ it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name);
4629
+ }
4630
+ }
4631
+ if (it.items !== true) {
4632
+ if (schEvaluated && !schEvaluated.dynamicItems) {
4633
+ if (schEvaluated.items !== void 0) {
4634
+ it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items);
4635
+ }
4636
+ } else {
4637
+ const items = gen.var("items", (0, codegen_1._)`${source}.evaluated.items`);
4638
+ it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name);
4639
+ }
4640
+ }
4641
+ }
4642
+ }
4643
+ exports.callRef = callRef;
4644
+ exports.default = def;
4645
+ }
4646
+ });
4647
+
4648
+ export {
4649
+ require_codegen,
4650
+ require_util,
4651
+ require_names,
4652
+ require_dataType,
4653
+ require_code2 as require_code,
4654
+ require_fast_deep_equal,
4655
+ require_validate,
4656
+ require_validation_error,
4657
+ require_ref_error,
4658
+ require_compile,
4659
+ require_core,
4660
+ require_ref,
4661
+ require_types
4662
+ };