memindex 0.0.0-stage → 1.0.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 (247) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.claude-plugin/marketplace.json +17 -0
  3. package/.claude-plugin/plugin.json +24 -0
  4. package/.codex-plugin/plugin.json +46 -0
  5. package/.qoder-plugin/plugin.json +15 -0
  6. package/LICENSE +202 -0
  7. package/NOTICE +8 -0
  8. package/README.md +123 -2
  9. package/dist/bug-report/index.js +248 -0
  10. package/dist/npx-cli/index.js +10465 -0
  11. package/dist/opencode-plugin/index.js +79 -0
  12. package/dist/pi-extension/LICENSE.txt +21 -0
  13. package/dist/pi-extension/TYPEBOX-LICENSE.txt +23 -0
  14. package/dist/pi-extension/TYPEBOX-PROVENANCE.json +13 -0
  15. package/dist/pi-extension/UPSTREAM-LICENSE.txt +202 -0
  16. package/dist/pi-extension/UPSTREAM-NOTICE.txt +8 -0
  17. package/dist/pi-extension/index.js +13 -0
  18. package/integrations/dsh/LICENSE +220 -0
  19. package/integrations/dsh/NOTICE +11 -0
  20. package/integrations/dsh/THIRD-PARTY-LICENSES.txt +233 -0
  21. package/integrations/dsh/cordis.patch.yml +2 -0
  22. package/integrations/dsh/lib/index.js +85 -0
  23. package/integrations/dsh/package.json +22 -0
  24. package/integrations/dsh/transcript-schema.json +59 -0
  25. package/integrations/hermes/memindex/README.md +61 -0
  26. package/integrations/hermes/memindex/__init__.py +234 -0
  27. package/integrations/hermes/memindex/client.py +622 -0
  28. package/integrations/hermes/memindex/plugin.yaml +8 -0
  29. package/integrations/omp/README.md +109 -0
  30. package/integrations/omp/hooks/memindex.ts +273 -0
  31. package/integrations/openclaw/Dockerfile.e2e +46 -0
  32. package/integrations/openclaw/SKILL.md +432 -0
  33. package/integrations/openclaw/TESTING.md +279 -0
  34. package/integrations/openclaw/dist/index.js +21 -0
  35. package/integrations/openclaw/e2e-verify.sh +222 -0
  36. package/integrations/openclaw/install.sh +1815 -0
  37. package/integrations/openclaw/openclaw.plugin.json +105 -0
  38. package/integrations/openclaw/package.json +21 -0
  39. package/integrations/openclaw/skills/agent-cost-report/CHECKSUMS.txt +50 -0
  40. package/integrations/openclaw/skills/agent-cost-report/SKILL.md +241 -0
  41. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/__init__.py +1 -0
  42. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/behavior.py +303 -0
  43. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/classify.py +83 -0
  44. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/costs.py +119 -0
  45. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/devices.py +88 -0
  46. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/evidence.py +160 -0
  47. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/labels.py +115 -0
  48. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/measure.py +89 -0
  49. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/mistakes.py +310 -0
  50. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/patterns.py +391 -0
  51. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/period.py +98 -0
  52. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/prices.py +95 -0
  53. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/render.py +586 -0
  54. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/rollup.py +355 -0
  55. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/rules.json +4 -0
  56. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/rules.py +76 -0
  57. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/sample.py +45 -0
  58. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/snapshot.py +53 -0
  59. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/sync.py +79 -0
  60. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/transcripts.py +126 -0
  61. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/wins.py +341 -0
  62. package/integrations/openclaw/skills/agent-cost-report/scripts/acr.py +219 -0
  63. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/_db.py +49 -0
  64. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/_paths.py +9 -0
  65. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/codex/sessions/2026/09/18/rollout-codex-1.jsonl +4 -0
  66. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/make_report_fixtures.py +46 -0
  67. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/prices_sample.json +6 -0
  68. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-a/sess-aaaa.jsonl +8 -0
  69. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-b/sess-bbbb.jsonl +1 -0
  70. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-1day.json +823 -0
  71. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-30day.json +2213 -0
  72. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-7day.json +1252 -0
  73. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-empty.json +536 -0
  74. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-session.json +662 -0
  75. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_behavior.py +299 -0
  76. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_devices.py +99 -0
  77. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_labels.py +96 -0
  78. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_measure.py +120 -0
  79. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_pdf_windows.py +54 -0
  80. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_period.py +137 -0
  81. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_prices.py +126 -0
  82. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_render.py +238 -0
  83. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_render_encoding.py +70 -0
  84. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_rollup.py +263 -0
  85. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_snapshot.py +63 -0
  86. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_sync.py +52 -0
  87. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_transcript_encoding.py +109 -0
  88. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_transcripts.py +151 -0
  89. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_wins.py +222 -0
  90. package/integrations/openclaw/src/index.test.ts +1247 -0
  91. package/integrations/openclaw/src/index.ts +1173 -0
  92. package/integrations/openclaw/test-e2e.sh +40 -0
  93. package/integrations/openclaw/test-install.sh +2022 -0
  94. package/integrations/openclaw/test-sse-consumer.js +98 -0
  95. package/integrations/openclaw/tsconfig.json +27 -0
  96. package/integrations/pi/THIRD-PARTY-LICENSE.txt +21 -0
  97. package/integrations/pi/TYPEBOX-LICENSE.txt +23 -0
  98. package/integrations/pi/TYPEBOX-PROVENANCE.json +13 -0
  99. package/package.json +224 -4
  100. package/plugin/.claude-plugin/plugin.json +24 -0
  101. package/plugin/.codex-plugin/plugin.json +46 -0
  102. package/plugin/.mcp.json +12 -0
  103. package/plugin/.qoder-plugin/plugin.json +15 -0
  104. package/plugin/bun.lock +161 -0
  105. package/plugin/hooks/bugfixes-2026-01-10.md +92 -0
  106. package/plugin/hooks/codex-hooks.json +79 -0
  107. package/plugin/hooks/hooks.json +134 -0
  108. package/plugin/hooks/qoder-hooks.json +97 -0
  109. package/plugin/hooks/qoder-repo-hooks.json +97 -0
  110. package/plugin/modes/code--ar.json +24 -0
  111. package/plugin/modes/code--bn.json +24 -0
  112. package/plugin/modes/code--chill.json +8 -0
  113. package/plugin/modes/code--cs.json +24 -0
  114. package/plugin/modes/code--da.json +24 -0
  115. package/plugin/modes/code--de.json +24 -0
  116. package/plugin/modes/code--el.json +24 -0
  117. package/plugin/modes/code--es.json +24 -0
  118. package/plugin/modes/code--fi.json +24 -0
  119. package/plugin/modes/code--fr.json +24 -0
  120. package/plugin/modes/code--he.json +24 -0
  121. package/plugin/modes/code--hi.json +24 -0
  122. package/plugin/modes/code--hu.json +24 -0
  123. package/plugin/modes/code--id.json +24 -0
  124. package/plugin/modes/code--it.json +24 -0
  125. package/plugin/modes/code--ja.json +24 -0
  126. package/plugin/modes/code--ko.json +24 -0
  127. package/plugin/modes/code--nl.json +24 -0
  128. package/plugin/modes/code--no.json +24 -0
  129. package/plugin/modes/code--pl.json +24 -0
  130. package/plugin/modes/code--pt-br.json +24 -0
  131. package/plugin/modes/code--ro.json +24 -0
  132. package/plugin/modes/code--ru.json +24 -0
  133. package/plugin/modes/code--sv.json +24 -0
  134. package/plugin/modes/code--th.json +24 -0
  135. package/plugin/modes/code--tr.json +24 -0
  136. package/plugin/modes/code--uk.json +24 -0
  137. package/plugin/modes/code--ur.json +25 -0
  138. package/plugin/modes/code--vi.json +24 -0
  139. package/plugin/modes/code--zh.json +24 -0
  140. package/plugin/modes/code.json +146 -0
  141. package/plugin/package.json +76 -0
  142. package/plugin/qoder.mcp.json +12 -0
  143. package/plugin/scripts/bun-runner.js +305 -0
  144. package/plugin/scripts/context-generator.cjs +125 -0
  145. package/plugin/scripts/context-generator.cjs.map +6 -0
  146. package/plugin/scripts/mcp-server.cjs +337 -0
  147. package/plugin/scripts/mcp-server.cjs.map +6 -0
  148. package/plugin/scripts/qoder-hook-launcher.cjs +114 -0
  149. package/plugin/scripts/server-service.cjs +10305 -0
  150. package/plugin/scripts/server-service.cjs.map +6 -0
  151. package/plugin/scripts/statusline-counts.js +42 -0
  152. package/plugin/scripts/transcript-watcher.cjs +59 -0
  153. package/plugin/scripts/transcript-watcher.cjs.map +6 -0
  154. package/plugin/scripts/version-check.js +399 -0
  155. package/plugin/scripts/worker-service.cjs +3196 -0
  156. package/plugin/scripts/worker-service.cjs.map +6 -0
  157. package/plugin/scripts/worker-wrapper.cjs +2 -0
  158. package/plugin/skills/agent-cost-report/CHECKSUMS.txt +50 -0
  159. package/plugin/skills/agent-cost-report/SKILL.md +241 -0
  160. package/plugin/skills/agent-cost-report/scripts/acr/__init__.py +1 -0
  161. package/plugin/skills/agent-cost-report/scripts/acr/behavior.py +303 -0
  162. package/plugin/skills/agent-cost-report/scripts/acr/classify.py +83 -0
  163. package/plugin/skills/agent-cost-report/scripts/acr/costs.py +119 -0
  164. package/plugin/skills/agent-cost-report/scripts/acr/devices.py +88 -0
  165. package/plugin/skills/agent-cost-report/scripts/acr/evidence.py +160 -0
  166. package/plugin/skills/agent-cost-report/scripts/acr/labels.py +115 -0
  167. package/plugin/skills/agent-cost-report/scripts/acr/measure.py +89 -0
  168. package/plugin/skills/agent-cost-report/scripts/acr/mistakes.py +310 -0
  169. package/plugin/skills/agent-cost-report/scripts/acr/patterns.py +391 -0
  170. package/plugin/skills/agent-cost-report/scripts/acr/period.py +98 -0
  171. package/plugin/skills/agent-cost-report/scripts/acr/prices.py +95 -0
  172. package/plugin/skills/agent-cost-report/scripts/acr/render.py +586 -0
  173. package/plugin/skills/agent-cost-report/scripts/acr/rollup.py +355 -0
  174. package/plugin/skills/agent-cost-report/scripts/acr/rules.json +4 -0
  175. package/plugin/skills/agent-cost-report/scripts/acr/rules.py +76 -0
  176. package/plugin/skills/agent-cost-report/scripts/acr/sample.py +45 -0
  177. package/plugin/skills/agent-cost-report/scripts/acr/snapshot.py +53 -0
  178. package/plugin/skills/agent-cost-report/scripts/acr/sync.py +79 -0
  179. package/plugin/skills/agent-cost-report/scripts/acr/transcripts.py +126 -0
  180. package/plugin/skills/agent-cost-report/scripts/acr/wins.py +341 -0
  181. package/plugin/skills/agent-cost-report/scripts/acr.py +219 -0
  182. package/plugin/skills/agent-cost-report/scripts/tests/_db.py +49 -0
  183. package/plugin/skills/agent-cost-report/scripts/tests/_paths.py +9 -0
  184. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/codex/sessions/2026/09/18/rollout-codex-1.jsonl +4 -0
  185. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/make_report_fixtures.py +46 -0
  186. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/prices_sample.json +6 -0
  187. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-a/sess-aaaa.jsonl +8 -0
  188. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-b/sess-bbbb.jsonl +1 -0
  189. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-1day.json +823 -0
  190. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-30day.json +2213 -0
  191. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-7day.json +1252 -0
  192. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-empty.json +536 -0
  193. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-session.json +662 -0
  194. package/plugin/skills/agent-cost-report/scripts/tests/test_behavior.py +299 -0
  195. package/plugin/skills/agent-cost-report/scripts/tests/test_devices.py +99 -0
  196. package/plugin/skills/agent-cost-report/scripts/tests/test_labels.py +96 -0
  197. package/plugin/skills/agent-cost-report/scripts/tests/test_measure.py +120 -0
  198. package/plugin/skills/agent-cost-report/scripts/tests/test_pdf_windows.py +54 -0
  199. package/plugin/skills/agent-cost-report/scripts/tests/test_period.py +137 -0
  200. package/plugin/skills/agent-cost-report/scripts/tests/test_prices.py +126 -0
  201. package/plugin/skills/agent-cost-report/scripts/tests/test_render.py +238 -0
  202. package/plugin/skills/agent-cost-report/scripts/tests/test_render_encoding.py +70 -0
  203. package/plugin/skills/agent-cost-report/scripts/tests/test_rollup.py +263 -0
  204. package/plugin/skills/agent-cost-report/scripts/tests/test_snapshot.py +63 -0
  205. package/plugin/skills/agent-cost-report/scripts/tests/test_sync.py +52 -0
  206. package/plugin/skills/agent-cost-report/scripts/tests/test_transcript_encoding.py +109 -0
  207. package/plugin/skills/agent-cost-report/scripts/tests/test_transcripts.py +151 -0
  208. package/plugin/skills/agent-cost-report/scripts/tests/test_wins.py +222 -0
  209. package/plugin/skills/babysit/SKILL.md +87 -0
  210. package/plugin/skills/design-is/SKILL.md +312 -0
  211. package/plugin/skills/do/SKILL.md +45 -0
  212. package/plugin/skills/handoff/SKILL.md +121 -0
  213. package/plugin/skills/how-it-works/SKILL.md +22 -0
  214. package/plugin/skills/how-it-works/onboarding-explainer.md +17 -0
  215. package/plugin/skills/knowledge-agent/SKILL.md +80 -0
  216. package/plugin/skills/learn-codebase/SKILL.md +21 -0
  217. package/plugin/skills/make-plan/SKILL.md +67 -0
  218. package/plugin/skills/mem-search/SKILL.md +93 -0
  219. package/plugin/skills/mode-creator/SKILL.md +122 -0
  220. package/plugin/skills/mode-creator/evals/evals.json +23 -0
  221. package/plugin/skills/mode-creator/references/mode-authoring.md +94 -0
  222. package/plugin/skills/mode-creator/scripts/install-mode.mjs +244 -0
  223. package/plugin/skills/oh-my-issues/SKILL.md +226 -0
  224. package/plugin/skills/pathfinder/SKILL.md +111 -0
  225. package/plugin/skills/screenpipe/SKILL.md +78 -0
  226. package/plugin/skills/screenpipe/screenpipe.mjs +196 -0
  227. package/plugin/skills/smart-explore/SKILL.md +193 -0
  228. package/plugin/skills/standup/SKILL.md +142 -0
  229. package/plugin/skills/standup/agent-brief.md +47 -0
  230. package/plugin/skills/standup/standup.mjs +586 -0
  231. package/plugin/skills/timeline-report/SKILL.md +211 -0
  232. package/plugin/skills/weekly-digests/SKILL.md +262 -0
  233. package/plugin/skills/what-the/SKILL.md +6 -0
  234. package/plugin/skills/wowerpoint/SKILL.md +205 -0
  235. package/plugin/sqlite/SessionStore.js +1135 -0
  236. package/plugin/sqlite/SessionStore.js.map +6 -0
  237. package/plugin/sqlite/observations/files.js +13 -0
  238. package/plugin/sqlite/observations/files.js.map +6 -0
  239. package/plugin/ui/assets/fonts/monaspace-radon-var.woff +0 -0
  240. package/plugin/ui/assets/fonts/monaspace-radon-var.woff2 +0 -0
  241. package/plugin/ui/icon-thick-completed.svg +8 -0
  242. package/plugin/ui/icon-thick-investigated.svg +8 -0
  243. package/plugin/ui/icon-thick-learned.svg +12 -0
  244. package/plugin/ui/icon-thick-next-steps.svg +8 -0
  245. package/plugin/ui/tv.html +506 -0
  246. package/plugin/ui/viewer-bundle.js +68 -0
  247. package/plugin/ui/viewer.html +2709 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Husni Adil Makmur
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,23 @@
1
+ TypeBox
2
+
3
+ The MIT License (MIT)
4
+
5
+ Copyright (c) 2017-2026 Haydn Paterson
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ {
2
+ "schema": "memindex.pi.typebox-attribution.v1",
3
+ "name": "typebox",
4
+ "version": "1.1.24",
5
+ "license": "MIT",
6
+ "licenseFile": "TYPEBOX-LICENSE.txt",
7
+ "licenseSha256": "e8a7cc256941a26ba8234f04390165243a4d42f74fd6491934140605bf7eae2d",
8
+ "packageJsonSha256": "abcd4ed84049ca96fc14169210d4e3e567a10d26a304d206bf666b9f043075aa",
9
+ "resolvedEntry": "build/index.mjs",
10
+ "source": "https://github.com/sinclairzx81/typebox/tree/1.1.24",
11
+ "licenseSource": "https://github.com/sinclairzx81/typebox/blob/1.1.24/license",
12
+ "buildBinding": "Release build checks the resolved package and license and aliases the Pi import to that same entry."
13
+ }
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,8 @@
1
+ Claude-Mem
2
+ Copyright 2026 Alex Newman
3
+
4
+ This product includes software developed for the Claude-Mem project.
5
+
6
+ Licensed under the Apache License, Version 2.0.
7
+
8
+ If other attributions are required by dependencies or included code, add them here.
@@ -0,0 +1,13 @@
1
+ /*! Pi memory design and text extraction: Copyright (c) 2026 Husni Adil Makmur. MIT: LICENSE.txt. Upstream Apache-2.0: UPSTREAM-LICENSE.txt and UPSTREAM-NOTICE.txt. Bundled TypeBox MIT: TYPEBOX-LICENSE.txt and TYPEBOX-PROVENANCE.json. All files are beside this extension. */
2
+ var ud=Object.defineProperty;var qt=(e,t)=>{for(var r in t)ud(e,r,{get:t[r],enumerable:!0})};var p={};qt(p,{Assign:()=>cd,Clone:()=>xr,Create:()=>Wd,Discard:()=>Xd,Metrics:()=>ve,Update:()=>Zd});var ve={assign:0,create:0,clone:0,discard:0,update:0};function cd(e,t){return ve.assign+=1,{...e,...t}}var s={};qt(s,{Entries:()=>qd,EntriesRegExp:()=>jd,Every:()=>Cd,EveryAll:()=>Md,GraphemeCount:()=>wd,HasPropertyKey:()=>Sd,IsArray:()=>fr,IsAsyncIterator:()=>yd,IsBigInt:()=>lr,IsBoolean:()=>Va,IsClassInstance:()=>Od,IsConstructor:()=>gd,IsDeepEqual:()=>ta,IsEqual:()=>L,IsFunction:()=>Ja,IsGreaterEqualThan:()=>Xa,IsGreaterThan:()=>Td,IsInteger:()=>Qn,IsIterator:()=>$d,IsLessEqualThan:()=>Wa,IsLessThan:()=>Ed,IsMaxLength:()=>Rd,IsMinLength:()=>vd,IsMultipleOf:()=>kd,IsNull:()=>pn,IsNumber:()=>un,IsObject:()=>Tt,IsObjectNotArray:()=>bd,IsString:()=>At,IsSymbol:()=>hd,IsUndefined:()=>ea,IsValueLike:()=>Pd,Keys:()=>mn,Symbols:()=>Ad,Values:()=>Ld});function Ze(e,t,r){return e>=t&&e<=r}function Ka(e){return Ze(e,127462,127487)}function dd(e){return Ze(e,65024,65039)}function ld(e){return Ze(e,768,879)||Ze(e,6832,6911)||Ze(e,7616,7679)||Ze(e,65056,65071)}function sn(e){return e>65535?2:1}function Ga(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(ld(r)||dd(r))t+=sn(r);else break}return t}function Yn(e,t){let r=e.codePointAt(t),n=t+sn(r);for(n=Ga(e,n);n<e.length-1&&e[n]==="\u200D";){let a=e.codePointAt(n+1);n+=1+sn(a),n=Ga(e,n)}return Ka(r)&&n<e.length&&Ka(e.codePointAt(n))&&(n+=sn(e.codePointAt(n))),n}function _a(e){return Ze(e,55296,56319)||Ze(e,768,879)||e===8205}function za(e){let t=0,r=0;for(;r<e.length;)r=Yn(e,r),t++;return t}function fd(e,t){if(t===0)return!0;let r=0,n=0;for(;n<e.length;)if(n=Yn(e,n),r++,r>=t)return!0;return!1}function xd(e,t){let r=0,n=0;for(;n<e.length;)if(n=Yn(e,n),r++,r>t)return!1;return!0}function Ba(e,t){if(t===0)return!0;let r=0;for(;r<e.length;){if(_a(e.charCodeAt(r)))return fd(e,t);if(r++,r>=t)return!0}return!1}function Ha(e,t){let r=0;for(;r<e.length;){if(_a(e.charCodeAt(r)))return xd(e,t);if(r++,r>t)return!1}return!0}function fr(e){return Array.isArray(e)}function yd(e){return Tt(e)&&Symbol.asyncIterator in e}function lr(e){return L(typeof e,"bigint")}function Va(e){return L(typeof e,"boolean")}function gd(e){if(ea(e)||!Ja(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Ja(e){return L(typeof e,"function")}function Qn(e){return Number.isInteger(e)}function $d(e){return Tt(e)&&Symbol.iterator in e}function pn(e){return L(e,null)}function un(e){return Number.isFinite(e)}function bd(e){return Tt(e)&&!fr(e)}function Tt(e){return L(typeof e,"object")&&!pn(e)}function At(e){return L(typeof e,"string")}function hd(e){return L(typeof e,"symbol")}function ea(e){return L(e,void 0)}function L(e,t){return e===t}function Td(e,t){return e>t}function Ed(e,t){return e<t}function Wa(e,t){return e<=t}function Xa(e,t){return e>=t}function kd(e,t){if(lr(e)||lr(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!un(e)||Qn(e)&&1/t%1===0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t))<r}function Od(e){if(!Tt(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return pn(t)?!1:L(typeof t.constructor,"function")&&!(L(t.constructor,globalThis.Object)||L(t.constructor.name,"Object"))}function Pd(e){return lr(e)||Va(e)||pn(e)||un(e)||At(e)||ea(e)}function wd(e){return za(e)}function Rd(e,t){return Ha(e,t)}function vd(e,t){return Ba(e,t)}function Cd(e,t,r){for(let n=t;n<e.length;n++)if(!r(e[n],n))return!1;return!0}function Md(e,t,r){let n=!0;for(let a=t;a<e.length;a++)r(e[a],a)||(n=!1);return n}function Sd(e,t){return L(t,"__proto__")||L(t,"constructor")?Object.prototype.hasOwnProperty.call(e,t):t in e}function jd(e){return mn(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function qd(e){return Object.entries(e)}function mn(e){return Object.getOwnPropertyNames(e)}function Ad(e){return Object.getOwnPropertySymbols(e)}function Ld(e){return Object.values(e)}function Nd(e,t){if(!Tt(t))return!1;let r=mn(e);return L(r.length,mn(t).length)&&r.every(n=>ta(e[n],t[n]))}function Fd(e,t){return fr(t)&&L(e.length,t.length)&&e.every((r,n)=>ta(e[n],t[n]))}function ta(e,t){return fr(e)?Fd(e,t):Tt(e)?Nd(e,t):L(e,t)}function Kd(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~guard")}function Gd(e){return e.map(t=>ra(t))}function _d(e){let t={},r=Object.getOwnPropertyDescriptors(e);for(let n of Object.keys(r)){let a=r[n];s.HasPropertyKey(a,"value")&&Object.defineProperty(t,n,{...a,value:ra(a.value)})}return t}function zd(e){return new RegExp(e.source,e.flags)}function ra(e){return e instanceof RegExp?zd(e):Kd(e)?e:s.IsArray(e)?Gd(e):s.IsObject(e)?_d(e):e}function xr(e){return ve.clone+=1,ra(e)}var Be={};qt(Be,{Get:()=>Vd,Reset:()=>Bd,Set:()=>Hd});var Ye={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1};function Bd(){Ye.immutableTypes=!1,Ye.maxErrors=8,Ye.useAcceleration=!0,Ye.exactOptionalPropertyTypes=!1,Ye.enumerableKind=!1,Ye.correctiveParse=!1}function Hd(e){for(let t of s.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(Ye,t,{value:r})}}function Vd(){return Ye}function Jd(e,t){for(let r of Object.keys(t))Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:!1,value:t[r]});return e}function Ya(e,t){return{...e,...t}}function Wd(e,t,r={}){ve.create+=1;let n=Be.Get(),a=Ya(t,r),i=n.enumerableKind?Ya(a,e):Jd(a,e);return n.immutableTypes?Object.freeze(i):i}function Xd(e,t){ve.discard+=1;let r={},n=Object.getOwnPropertyDescriptors(xr(e)),a=new Set(t);for(let i of Object.keys(n))a.has(i)||Object.defineProperty(r,i,n[i]);return r}function Zd(e,t,r){ve.update+=1;let n=Be.Get(),a=xr(e);for(let i of Object.keys(t))Object.defineProperty(a,i,{configurable:!0,writable:!0,enumerable:n.enumerableKind,value:t[i]});for(let i of Object.keys(r))Object.defineProperty(a,i,{configurable:!0,enumerable:!0,writable:!0,value:r[i]});return a}function f(e,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function k(e){return s.IsObject(e)}function Qa(e){return p.Create({"~kind":"OptionalAddAction"},{type:e},{})}function eo(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"OptionalAddAction")&&k(e.type)}function to(e){return p.Create({"~kind":"OptionalRemoveAction"},{type:e},{})}function ro(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"OptionalRemoveAction")&&k(e.type)}function no(e){return p.Create({"~kind":"ReadonlyAddAction"},{type:e},{})}function ao(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"ReadonlyAddAction")&&k(e.type)}function oo(e){return p.Create({"~kind":"ReadonlyRemoveAction"},{type:e},{})}function so(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"ReadonlyRemoveAction")&&k(e.type)}function $(e,t,r){return p.Create({"~kind":"Deferred"},{action:e,parameters:t,options:r},{})}function Qe(e){return f(e,"Deferred")}function na(e){return p.Update(e,{"~immutable":!0},{})}function et(e){return na(e)}function Et(e){return k(e)&&s.HasPropertyKey(e,"~immutable")}function Lt(e){return p.Discard(e,["~optional"])}function xe(e){return p.Update(e,{"~optional":!0},{})}function cn(e){return xe(e)}function pe(e){return k(e)&&s.HasPropertyKey(e,"~optional")}function dn(e){return p.Discard(e,["~readonly"])}function Ie(e){return p.Update(e,{"~readonly":!0},{})}function ln(e){return Ie(e)}function kt(e){return k(e)&&s.HasPropertyKey(e,"~readonly")}function Ce(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function z(e){return f(e,"Array")}function fn(e){return p.Discard(e,["~kind","type","items"])}function Ae(e,t){return p.Create({"~kind":"AsyncIterator"},{type:"asyncIterator",iteratorItems:e},t)}function ge(e){return f(e,"AsyncIterator")}function io(e){return p.Discard(e,["~kind","type","iteratorItems"])}function mo(e){return{enumerable:Be.Get().enumerableKind,writable:!1,configurable:!1,value:e}}var xn=class{constructor(){globalThis.Object.defineProperty(this,"~kind",mo("Base")),globalThis.Object.defineProperty(this,"~guard",mo({check:t=>this.Check(t),errors:t=>this.Errors(t)}))}Check(t){return!0}Errors(t){return[]}Convert(t){return t}Clean(t){return t}Default(t){return t}Create(){throw new Error("Create not implemented")}Clone(){throw Error("Clone not implemented")}};function In(e){return f(e,"Base")}function tt(e,t,r={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function ae(e){return f(e,"Constructor")}function po(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function rt(e,t,r={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function oe(e){return f(e,"Function")}function uo(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function He(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function X(e){return f(e,"Ref")}function nt(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Nt(e){return f(e,"Generic")}function Ft(e){return p.Create({"~kind":"Any"},{},e)}function Z(e){return f(e,"Any")}var co="(?!)";function S(e){return p.Create({"~kind":"Never"},{not:{}},e)}function at(e){return f(e,"Never")}function lo(e){return s.Keys(e).filter(t=>!pe(e[t]))}function fo(e){return s.Keys(e)}function yn(e){return s.Values(e)}function E(e,t={}){let r=lo(e),n=r.length>0?{required:r}:{};return p.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function F(e){return f(e,"Object")}function xo(e){return p.Discard(e,["~kind","type","properties","required"])}function O(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function y(e){return f(e,"Union")}function Io(e){return p.Discard(e,["~kind","anyOf"])}function ue(e){return p.Create({"~kind":"Unknown"},{},e)}function re(e){return f(e,"Unknown")}function Le(e,t,r){let n=s.Keys(e).reduce((a,i)=>({...a,[i]:p.Update(e[i],{},{$id:i})}),{});return p.Create({"~kind":"Cyclic"},{$defs:n,$ref:t},r)}function se(e){return f(e,"Cyclic")}var ot={};qt(ot,{Match:()=>Yd});function Yd(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Ir(...e){let[t,r]=ot.Match(e,{2:(n,a)=>[n,a,a],1:n=>[n,ue(),ue()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function V(e){return f(e,"Infer")}function yo(e){return s.IsObjectNotArray(e)}function go(e){return s.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function $o(e,t){let r=yo(e)?go(e):e;return p.Create({"~kind":"Enum"},{enum:r},t)}function ie(e){return f(e,"Enum")}function Te(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function M(e){return f(e,"Intersect")}function bo(e){return p.Discard(e,["~kind","allOf"])}function K(){throw new Error("Unreachable")}var ho;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(ho||(ho={}));var ih=BigInt("14695981039346656037"),[mh,ph]=[BigInt("1099511628211"),BigInt("18446744073709551616")],uh=Array.from({length:256}).map((e,t)=>BigInt(t)),To=new Float64Array(1),ch=new DataView(To.buffer),dh=new Uint8Array(To.buffer);var lh=new TextEncoder;var yr=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=gn(r)?m=>this.decode(r["~codec"].decode(m)):this.decode,a=gn(r)?m=>r["~codec"].encode(t(m)):t,i={decode:n,encode:a};return p.Update(this.type,{"~codec":i},{})}},gr=class{constructor(t){this.type=t}Decode(t){return new yr(this.type,t)}};function $n(e){return new gr(e)}function ko(e,t){return $n(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Oo(e,t){return $n(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function gn(e){return k(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function rl(e,t){let r=aa(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":r},{})}function Po(e,t,r="error"){return rl(e,{refine:t,message:r})}function aa(e){return k(e)&&s.HasPropertyKey(e,"~refine")}var wo="-?(?:0|[1-9][0-9]*)n";function $r(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function Ne(e){return f(e,"BigInt")}function bn(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Oe(e){return f(e,"Boolean")}function br(e){return p.Create({"~kind":"Identifier"},{name:e})}function Ro(e){return f(e,"Identifier")}var hn="-?(?:0|[1-9][0-9]*)";function Ot(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function ce(e){return f(e,"Integer")}function Fe(e,t){return p.Create({"~kind":"Iterator"},{type:"iterator",iteratorItems:e},t)}function $e(e){return f(e,"Iterator")}function vo(e){return p.Discard(e,["~kind","type","iteratorItems"])}var oa=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function nl(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new oa(e)})()}function q(e,t){return p.Create({"~kind":"Literal"},{type:nl(e),const:e},t)}function Tn(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function En(e){return D(e)&&s.IsNumber(e.const)}function kn(e){return D(e)&&s.IsString(e.const)}function D(e){return f(e,"Literal")}function st(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Dt(e){return f(e,"Null")}var On="-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?";function be(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function Y(e){return f(e,"Number")}function Ut(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function it(e){return f(e,"Symbol")}function Pt(...e){let[t,r,n]=ot.Match(e,{3:(a,i,m)=>[a,i,m],2:(a,i)=>[a,i,i],1:a=>[a,ue(),ue()]});return p.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function Co(e){return f(e,"Parameter")}function De(e,t){return p.Create({"~kind":"Promise"},{type:"promise",item:e},t)}function de(e){return f(e,"Promise")}function Mo(e){return p.Discard(e,["~kind","type","item"])}var Pn=".*";function Pe(e){return p.Create({"~kind":"String"},{type:"string"},e)}function le(e){return f(e,"String")}function hr(e){let t=So(e);return s.IsEqual(t.length,2)?t[0]:[]}function al(e){return!0}function jo(e){let[t,...r]=e;return k(t)?ol(t)?jo(r):!1:!0}function qo(e){return s.IsEqual(e.length,0)?!1:jo(e)}function ol(e){return y(e)?qo(e.anyOf):D(e)?al(e.const):!1}function wn(e){return qo(e)}function Rn(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Ao(e,t,r=[]){let[n,...a]=e;return s.IsString(n)?Ao(a,t,[...r,`${n}${t}`]):r}function sl(e,t){return s.IsEqual(e.length,0)?[`${t}`]:Ao(e,t)}function Lo(e,t,r=[]){let[n,...a]=t;return k(n)?Lo(e,a,[...r,...No(e,n)]):r}function No(e,t){return y(t)?Lo(e,t.anyOf):D(t)?sl(e,t.const):K()}function Fo(e,t){let[r,...n]=t;return k(r)?Fo(No(e,r),n):e}function il(e){return e.map(t=>q(t))}function ml(e){let t=Fo([],e),r=il(t);return O(r)}function pl(e){return s.IsEqual(e.length,0)?K():s.IsEqual(e.length,1)&&D(e[0])?e[0]:ml(e)}function sa(e){let t=hr(e);return s.IsEqual(t.length,0)?Pe():wn(t)?pl(t):Rn(e)}function he(e){let t=sa(e);return Q(t)?Pe():t}function ye(e,t){let r="object",n={[e]:t};return p.Create({"~kind":"Record"},{type:r,patternProperties:n})}var Kt=`^${hn}$`,Gt=`^${On}$`,Me=`^${Pn}$`;function Tr(e,t,r={}){return $("Record",[e,t],r)}function ul(e,t,r={}){return g({},Tr(e,t,r))}function vn(e,t,r={}){return ul(e,t,r)}function Do(e,t){return ye(e,t)}function _t(e){return s.Keys(e.patternProperties)[0]}function zt(e){let t=_t(e);return s.IsEqual(t,Me)?Pe():s.IsEqual(t,Kt)?Ot():s.IsEqual(t,Gt)?be():sa(t)}function Ue(e){return e.patternProperties[_t(e)]}function we(e){return f(e,"Record")}function wt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function mt(e){return f(e,"Rest")}function Cn(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function Uo(e){return f(e,"This")}function ee(e,t={}){let[r,n,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:r,minItems:n},t)}function U(e){return f(e,"Tuple")}function Ko(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Bt(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Ht(e){return f(e,"Undefined")}function Go(e){return p.Create({"~kind":"Unsafe"},{},e)}function _o(e){return f(e,"Unsafe")}function Mn(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Ke(e){return f(e,"Void")}function dl(e,t){return s.IsEqual(e,"Array")?Ce(t[0]):s.IsEqual(e,"AsyncIterator")?Ae(t[0]):s.IsEqual(e,"Iterator")?Fe(t[0]):s.IsEqual(e,"Promise")?De(t[0]):s.IsEqual(e,"Awaited")?Gr(t[0]):s.IsEqual(e,"Capitalize")?Or(t[0]):s.IsEqual(e,"ConstructorParameters")?Cr(t[0]):s.IsEqual(e,"Evaluate")?ma(t[0]):s.IsEqual(e,"Exclude")?Mr(t[0],t[1]):s.IsEqual(e,"Extract")?Sr(t[0],t[1]):s.IsEqual(e,"Index")?Wt(t[0],t[1]):s.IsEqual(e,"InstanceType")?jr(t[0]):s.IsEqual(e,"Lowercase")?Pr(t[0]):s.IsEqual(e,"NonNullable")?qr(t[0]):s.IsEqual(e,"Omit")?Ar(t[0],t[1]):s.IsEqual(e,"Options")?Zt(t[0],t[1]):s.IsEqual(e,"Parameters")?Lr(t[0]):s.IsEqual(e,"Partial")?Nr(t[0]):s.IsEqual(e,"Pick")?Fr(t[0],t[1]):s.IsEqual(e,"Readonly")?Dr(t[0]):s.IsEqual(e,"KeyOf")?Xt(t[0]):s.IsEqual(e,"Record")?Tr(t[0],t[1]):s.IsEqual(e,"Required")?Ur(t[0]):s.IsEqual(e,"ReturnType")?Kr(t[0]):s.IsEqual(e,"Uncapitalize")?wr(t[0]):s.IsEqual(e,"Uppercase")?Rr(t[0]):kr(He(e),t)}function Rt(){throw Error("Unreachable")}var ll=(e,t=[])=>e.reduce((r,n)=>s.IsArray(n)&&s.IsEqual(n.length,2)?[...r,n[0]]:[...r,n],[]),Ve=e=>{let[t,r]=e;return ll([...t,...r])};function Jo(e){return Pt(e[0],e[2],e[4])}function Wo(e){return Pt(e[0],e[2],e[2])}function Xo(e){return Pt(e[0],ue(),e[2])}function Zo(e){return Pt(e,ue(),ue())}function Yo(e){return Ve(e)}function Qo(e){return e[1]}function es(e){return Ve(e)}function ts(e){return e[1]}function rs(e){return dl(e[0],e[1])}function ns(e){return null}function as(e){return Pe()}function os(e){return be()}function ss(e){return bn()}function is(e){return Bt()}function ms(e){return st()}function ps(e){return Ot()}function us(e){return $r()}function cs(e){return ue()}function ds(e){return Ft()}function ls(e){return E({})}function fs(e){return S()}function xs(e){return Ut()}function Is(e){return Mn()}function ys(e){return Cn()}function gs(e){return e[1]}function $s(e){return q(e)}function bs(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function hs(e){return e[1]}function Ts(e){return Er(e)}function Es(e){return q(BigInt(e))}function ks(e){return q(s.IsEqual(e,"true"))}function Os(e){return q(parseFloat(e))}function Ps(e){return q(e)}function ws(e){return e.length>0}function Rs(e){return e.reduce((t,r)=>s.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function vs(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Cs(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}var zo=(e,t)=>t.reduce((r,n)=>{let a=n;return s.IsEqual(a.length,1)?Wt(r,a[0]):s.IsEqual(a.length,0)?Ce(r):Rt()},e),Bo=(e,t)=>s.IsEqual(t.length,3)?vr(e,t[0],t[1],t[2]):e;function Ms(e){let[t,r,n,a]=e;return Bo(t?Xt(zo(r,n)):zo(r,n),a)}function ia(e,t){return s.IsEqual(t.length,3)?(()=>{let[r,n,a]=t,i=ia(n,a);if(s.IsEqual(r,"&"))return M(i)?Te([e,...i.allOf]):Te([e,i]);if(s.IsEqual(r,"|"))return y(i)?O([e,...i.anyOf]):O([e,i]);Rt()})():e}function Ss(e){let[t,r]=e;return ia(t,r)}function js(e){let[t,r]=e;return ia(t,r)}function qs(e){return na(e[1])}function As(e){return e[1]}function Ls(e){return nt(e[0],e[2])}function Ns(e){return s.IsEqual(e.length,4)?Ir(e[1],e[3]):s.IsEqual(e.length,2)?Ir(e[1],ue()):Rt()}function Fs(e){return`${e}`}function Ds(e){return ce(e[3])?Kt:Y(e[3])?Gt:it(e[3])?Me:le(e[3])?Me:Rt()}function Us(e){return e.length>0}function Ks(e){return e.length>0}function Gs(e){let[t,r,n,a,i]=e;return{[r]:t&&n?Ie(xe(i)):t&&!n?Ie(i):!t&&n?xe(i):i}}function _s(e){return Ve(e)}function zs(e){return e.reduce((t,r)=>s.HasPropertyKey(r,Kt)||s.HasPropertyKey(r,Gt)||s.HasPropertyKey(r,Me)?[t[0],p.Assign(t[1],r)]:[p.Assign(t[0],r),t[1]],[{},{}])}function Bs(e){return zs(e[1])}function Hs(e){let[t,r]=e,n=s.IsEqual(s.Keys(r).length,0)?{}:{patternProperties:r};return E(t,n)}function Vs(e){return s.IsEqual(e.length,5)?Ie(xe(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?Ie(e[3]):xe(e[3]):Rt()}function Js(e){return Ie(xe(e[1]))}function Ws(e){return Ie(e[1])}function Xs(e){return xe(e[0])}function Zs(e){return s.IsEqual(e.length,2)?wt(e[1]):s.IsEqual(e.length,1)?e[0]:Rt()}function Ys(e){return Ve(e)}function Qs(e){return ee(e[1])}function ei(e){return Ie(xe(e[4]))}function ti(e){return Ie(e[3])}function ri(e){return xe(e[3])}function ni(e){return e[2]}function ai(e){return s.IsEqual(e.length,2)?wt(e[1]):s.IsEqual(e.length,1)?e[0]:Rt()}function oi(e){return Ve(e)}function si(e){return rt(e[1],e[4])}function ii(e){return tt(e[2],e[5])}function Ho(e,t){return s.IsEqual(e,"remove")?oo(t):s.IsEqual(e,"add")?no(t):t}function mi(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function Vo(e,t){return s.IsEqual(e,"remove")?to(t):s.IsEqual(e,"add")?Qa(t):t}function pi(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function ui(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function ci(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?Vt(br(e[3]),e[5],e[6][0],Ho(e[1],Vo(e[8],e[10]))):Vt(br(e[3]),e[5],He(e[3]),Ho(e[1],Vo(e[8],e[10])))}function di(e){return He(e)}function li(e){return Zt(e[2],e[4])}function fi(e){return parseFloat(e)}function xi(e){return s.IsEqual(e,"true")}function Ii(e){return null}function yi(e){return{[e[0]]:e[2]}}function gi(e){return Ve(e)}function fl(e){return e.reduce((t,r)=>p.Assign(t,r),{})}function $i(e){return fl(e[1])}function bi(e){return Ve(e)}function hi(e){return e[1]}function Ti(e){return $r()}function Ei(e){return Pe()}function ki(e){return be()}function Oi(e){return Ot()}function Pi(e){return S()}function wi(e){return q(e)}function Ri(e){return O(e[1])}function vi(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Ci(e){return[e[0],...e[1]]}function Mi(e){return e[1]}function Si(e){return Ve(e)}function ji(e){return s.IsEqual(e.length,2)?e[1]:[]}function qi(e){let t=e[2],r=e[3],[n,a]=e[4],i=s.IsEqual(s.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:nt(t,Jt(r,n,i))}}function Ai(e){let t=e[2],[r,n]=e[3],a=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:Jt(t,r,a)}}function Li(e){return{[e[1]]:nt(e[2],e[4])}}function Ni(e){return{[e[1]]:e[3]}}function Fi(e){return null}function Di(e){return zs(Ve(e))}function Ui(e){return e[1]}function Ki(e){let t=e[0],r=e[1];return pa(p.Assign(t,r[0]))}function _r(e){return L(e.length,2)}function w(e,t,r){return _r(e)?t(e[0],e[1]):r()}function yl(e,t){return L(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function G(e,t){for(let r=0;r<e.length;r++){let n=yl(e[r],t);if(_r(n))return n}return[]}function ua(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var Gi=[...ua(97,122),...ua(65,90)],ca="0",da=ua(49,57),Yt=[ca,...da],_i=" ",Qt=`
3
+ `;var pt="_",Sn=".",zi="$",jn="-";var Bi="//",Hi="/*",$l="*/";function Vi(e){let t=e.indexOf($l);return L(t,-1)?"":e.slice(t+2)}function Ji(e){let t=e.indexOf(Qt);return L(t,-1)?"":e.slice(t)}function bl(e){return e.replace(/^[ \t\r\f\v]+/,"")}function qn(e){let t=bl(e);return t.startsWith(Hi)?qn(Vi(t.slice(2))):t.startsWith(Bi)?qn(Ji(t.slice(2))):t}function ne(e){let t=e.trimStart();return t.startsWith(Hi)?ne(Vi(t.slice(2))):t.startsWith(Bi)?ne(Ji(t.slice(2))):t}function An(e,t){return w(G([e],t),(r,n)=>[r,n],()=>["",t])}function hl(e,t){return e.includes(t)}function er(e,t,r,n=""){return w(G(e,r),(a,i)=>hl(t,a)?er(e,t,i,n):er(e,t,i,`${n}${a}`),()=>[n,r])}function Tl(e){return G(da,e)}var El=[...Yt,pt];function kl(e){return er(El,[pt],e)}function Ol(e){return w(G([ca],e),(t,r)=>[t,r],()=>w(Tl(e),(t,r)=>w(kl(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[]))}function Ln(e){return Ol(ne(e))}function Pl(e){return An(jn,e)}function wl(e){return w(Pl(e),(t,r)=>w(Ln(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function Wi(e){return wl(ne(e))}function Rl(e){return w(Wi(e),(t,r)=>w(G(["n"],r),(n,a)=>[`${t}`,a],()=>[]),()=>[])}function Xi(e){return Rl(e)}function la(e,t){return G([e],t)}function u(e,t){return L(e,"")?["",t]:e.startsWith(Qt)?la(e,qn(t)):e.startsWith(_i)?la(e,t):la(e,ne(t))}var Zi=[...Gi,pt,zi];function vl(e){return G(Zi,e)}var Cl=[...Zi,...Yt];function Yi(e,t=""){return w(G(Cl,e),(r,n)=>Yi(n,`${t}${r}`),()=>[t,e])}function Ml(e){return w(vl(e),(t,r)=>w(Yi(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function B(e){return Ml(ne(e))}var Sl=[...Yt,pt];function jl(e){return _r(G([Sn],e))}function Qi(e){return w(er(Sl,[pt],e),(t,r)=>L(t,"")?[]:[t,r],()=>[])}function ql(e){return w(G([Sn],e),(t,r)=>w(Qi(r),(n,a)=>[`0${t}${n}`,a],()=>[]),()=>[])}function Al(e){return w(Ln(e),(t,r)=>w(G([Sn],r),(n,a)=>w(Qi(a),(i,m)=>[`${t}${n}${i}`,m],()=>[`${t}`,a]),()=>[`${t}`,r]),()=>[])}function Ll(e){return jl(e)?ql(e):Al(e)}function em(e){return Ll(ne(e))}function Nl(e){return An(jn,e)}function Fl(e){return w(Nl(e),(t,r)=>w(em(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function Nn(e){return Fl(ne(e))}function Dl(e){return L(e,"")?[]:[e.slice(0,1),e.slice(1)]}function tm(e,t){let[r,...n]=e;return At(r)?t.startsWith(r)?!0:tm(n,t):!1}function ut(e,t,r=""){return w(Dl(t),(n,a)=>tm(e,t)?[r,t]:ut(e,a,`${r}${n}`),()=>[])}function Ul(e,t,r){return w(G([e],r),(n,a)=>w(ut([t],a),(i,m)=>w(G([t],m),(c,l)=>[`${i}`,l],()=>[]),()=>[]),()=>[])}function Kl(e,t,r){return w(G([e],r),(n,a)=>w(ut([Qt,t],a),(i,m)=>w(G([t],m),(c,l)=>[`${i}`,l],()=>[]),()=>[]),()=>[])}function rm(e,t,r,n){return r?Ul(e,t,ne(n)):Kl(e,t,ne(n))}function Gl(e,t){return G(e,t)}function _l(e,t){return rm(e,e,!1,t)}function zl(e,t){return w(Gl(e,t),(r,n)=>_l(r,`${r}${n}`),()=>[])}function Fn(e,t){return zl(e,ne(t))}function nm(e,t){return w(ut(e,t),(r,n)=>L(r,"")?[]:[r,n],()=>[])}var o=(e,t,r=()=>[])=>e.length===2?t(e):r(),Hl=e=>o(o(B(e),([t,r])=>o(u("extends",r),([n,a])=>o(A(a),([i,m])=>o(u("=",m),([c,l])=>o(A(l),([v,j])=>[[t,n,i,c,v],j]))))),([t,r])=>[Jo(t),r]),Vl=e=>o(o(B(e),([t,r])=>o(u("extends",r),([n,a])=>o(A(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Wo(t),r]),Jl=e=>o(o(B(e),([t,r])=>o(u("=",r),([n,a])=>o(A(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Xo(t),r]),Wl=e=>o(B(e),([t,r])=>[Zo(t),r]),sm=e=>o(o(Hl(e),([t,r])=>[t,r],()=>o(Vl(e),([t,r])=>[t,r],()=>o(Jl(e),([t,r])=>[t,r],()=>o(Wl(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),im=(e,t=[])=>o(o(sm(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>im(n,[...t,r]),()=>[t,e]),Xl=e=>o(o(im(e),([t,r])=>o(o(o(sm(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Yo(t),r]),Ia=e=>o(o(u("<",e),([t,r])=>o(Xl(r),([n,a])=>o(u(">",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Qo(t),r]),mm=(e,t=[])=>o(o(A(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>mm(n,[...t,r]),()=>[t,e]),Zl=e=>o(o(mm(e),([t,r])=>o(o(o(A(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[es(t),r]),Yl=e=>o(o(u("<",e),([t,r])=>o(Zl(r),([n,a])=>o(u(">",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[ts(t),r]),Ql=e=>o(o(B(e),([t,r])=>o(Yl(r),([n,a])=>[[t,n],a])),([t,r])=>[rs(t),r]),pm=e=>o(o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[ns(t),r]),um=e=>o(u("string",e),([t,r])=>[as(t),r]),cm=e=>o(u("number",e),([t,r])=>[os(t),r]),ef=e=>o(u("boolean",e),([t,r])=>[ss(t),r]),tf=e=>o(u("undefined",e),([t,r])=>[is(t),r]),rf=e=>o(u("null",e),([t,r])=>[ms(t),r]),dm=e=>o(u("integer",e),([t,r])=>[ps(t),r]),nf=e=>o(u("bigint",e),([t,r])=>[us(t),r]),af=e=>o(u("unknown",e),([t,r])=>[cs(t),r]),of=e=>o(u("any",e),([t,r])=>[ds(t),r]),sf=e=>o(u("object",e),([t,r])=>[ls(t),r]),mf=e=>o(u("never",e),([t,r])=>[fs(t),r]),lm=e=>o(u("symbol",e),([t,r])=>[xs(t),r]),pf=e=>o(u("void",e),([t,r])=>[Is(t),r]),uf=e=>o(u("this",e),([t,r])=>[ys(t),r]),cf=e=>o(o(um(e),([t,r])=>[t,r],()=>o(cm(e),([t,r])=>[t,r],()=>o(ef(e),([t,r])=>[t,r],()=>o(tf(e),([t,r])=>[t,r],()=>o(rf(e),([t,r])=>[t,r],()=>o(dm(e),([t,r])=>[t,r],()=>o(nf(e),([t,r])=>[t,r],()=>o(af(e),([t,r])=>[t,r],()=>o(of(e),([t,r])=>[t,r],()=>o(sf(e),([t,r])=>[t,r],()=>o(mf(e),([t,r])=>[t,r],()=>o(lm(e),([t,r])=>[t,r],()=>o(pf(e),([t,r])=>[t,r],()=>o(uf(e),([t,r])=>[t,r],()=>[])))))))))))))),([t,r])=>[t,r]),df=e=>o(o(u("${",e),([t,r])=>o(A(r),([n,a])=>o(u("}",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[gs(t),r]),fa=e=>o(ut(["${","`"],e),([t,r])=>[$s(t),r]),fm=e=>o(o(o(fa(e),([t,r])=>o(df(r),([n,a])=>o(fm(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>o(o(fa(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(fa(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[bs(t),r]),ya=e=>o(o(u("`",e),([t,r])=>o(fm(r),([n,a])=>o(u("`",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[hs(t),r]),lf=e=>o(ya(e),([t,r])=>[Ts(t),r]),ff=e=>o(Xi(e),([t,r])=>[Es(t),r]),xf=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[ks(t),r]),If=e=>o(Nn(e),([t,r])=>[Os(t),r]),yf=e=>o(Fn(["'",'"'],e),([t,r])=>[Ps(t),r]),gf=e=>o(o(ff(e),([t,r])=>[t,r],()=>o(xf(e),([t,r])=>[t,r],()=>o(If(e),([t,r])=>[t,r],()=>o(yf(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),$f=e=>o(o(o(u("keyof",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[ws(t),r]),xm=(e,t=[])=>o(o(o(u("[",e),([r,n])=>o(A(n),([a,i])=>o(u("]",i),([m,c])=>[[r,a,m],c]))),([r,n])=>[r,n],()=>o(o(u("[",e),([r,n])=>o(u("]",n),([a,i])=>[[r,a],i])),([r,n])=>[r,n],()=>[])),([r,n])=>xm(n,[...t,r]),()=>[t,e]),bf=e=>o(xm(e),([t,r])=>[Rs(t),r]),hf=e=>o(o(o(u("extends",e),([t,r])=>o(A(r),([n,a])=>o(u("?",a),([i,m])=>o(A(m),([c,l])=>o(u(":",l),([v,j])=>o(A(j),([b,C])=>[[t,n,i,c,v,b],C])))))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[vs(t),r]),Tf=e=>o(o(o(u("(",e),([t,r])=>o(A(r),([n,a])=>o(u(")",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>o(cf(e),([t,r])=>[t,r],()=>o(qf(e),([t,r])=>[t,r],()=>o(Uf(e),([t,r])=>[t,r],()=>o(lf(e),([t,r])=>[t,r],()=>o(gf(e),([t,r])=>[t,r],()=>o(Hf(e),([t,r])=>[t,r],()=>o(Bf(e),([t,r])=>[t,r],()=>o(Xf(e),([t,r])=>[t,r],()=>o(Yf(e),([t,r])=>[t,r],()=>o(Ql(e),([t,r])=>[t,r],()=>o(Zf(e),([t,r])=>[t,r],()=>[])))))))))))),([t,r])=>[Cs(t),r]),Im=e=>o(o($f(e),([t,r])=>o(Tf(r),([n,a])=>o(bf(a),([i,m])=>o(hf(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[Ms(t),r]),ym=e=>o(o(o(u("&",e),([t,r])=>o(Im(r),([n,a])=>o(ym(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),gm=e=>o(o(Im(e),([t,r])=>o(ym(r),([n,a])=>[[t,n],a])),([t,r])=>[Ss(t),r]),$m=e=>o(o(o(u("|",e),([t,r])=>o(gm(r),([n,a])=>o($m(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Dn=e=>o(o(gm(e),([t,r])=>o($m(r),([n,a])=>[[t,n],a])),([t,r])=>[js(t),r]),Ef=e=>o(o(u("readonly",e),([t,r])=>o(Dn(r),([n,a])=>[[t,n],a])),([t,r])=>[qs(t),r]),kf=e=>o(o(u("|",e),([t,r])=>o(Dn(r),([n,a])=>[[t,n],a])),([t,r])=>[As(t),r]),Of=e=>o(o(Ia(e),([t,r])=>o(u("=",r),([n,a])=>o(A(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Ls(t),r]),Pf=e=>o(o(o(u("infer",e),([t,r])=>o(B(r),([n,a])=>o(u("extends",a),([i,m])=>o(Dn(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[t,r],()=>o(o(u("infer",e),([t,r])=>o(B(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>[])),([t,r])=>[Ns(t),r]),A=e=>o(o(Pf(e),([t,r])=>[t,r],()=>o(kf(e),([t,r])=>[t,r],()=>o(Ef(e),([t,r])=>[t,r],()=>o(Dn(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),wf=e=>o(Nn(e),([t,r])=>[Fs(t),r]),Rf=e=>o(B(e),([t,r])=>[t,r]),vf=e=>o(Fn(["'",'"'],e),([t,r])=>[t,r]),Cf=e=>o(o(u("[",e),([t,r])=>o(B(r),([n,a])=>o(u(":",a),([i,m])=>o(o(dm(m),([c,l])=>[c,l],()=>o(cm(m),([c,l])=>[c,l],()=>o(um(m),([c,l])=>[c,l],()=>o(lm(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([v,j])=>[[t,n,i,c,v],j]))))),([t,r])=>[Ds(t),r]),bm=e=>o(o(wf(e),([t,r])=>[t,r],()=>o(Rf(e),([t,r])=>[t,r],()=>o(vf(e),([t,r])=>[t,r],()=>o(Cf(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Mf=e=>o(o(o(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Us(t),r]),Sf=e=>o(o(o(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Ks(t),r]),hm=e=>o(o(Mf(e),([t,r])=>o(bm(r),([n,a])=>o(Sf(a),([i,m])=>o(u(":",m),([c,l])=>o(A(l),([v,j])=>[[t,n,i,c,v],j]))))),([t,r])=>[Gs(t),r]),Tm=e=>o(o(o(u(",",e),([t,r])=>o(u(`
4
+ `,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>o(u(`
5
+ `,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(",",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(`
6
+ `,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),Em=(e,t=[])=>o(o(hm(e),([r,n])=>o(Tm(n),([a,i])=>[[r,a],i])),([r,n])=>Em(n,[...t,r]),()=>[t,e]),jf=e=>o(o(Em(e),([t,r])=>o(o(o(hm(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[_s(t),r]),ga=e=>o(o(u("{",e),([t,r])=>o(jf(r),([n,a])=>o(u("}",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Bs(t),r]),qf=e=>o(ga(e),([t,r])=>[Hs(t),r]),Af=e=>o(o(o(B(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([i,m])=>o(u("readonly",m),([c,l])=>o(A(l),([v,j])=>[[t,n,i,c,v],j]))))),([t,r])=>[t,r],()=>o(o(B(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([i,m])=>o(A(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[t,r],()=>o(o(B(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([i,m])=>o(A(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[t,r],()=>o(o(B(e),([t,r])=>o(u(":",r),([n,a])=>o(A(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>[])))),([t,r])=>[Vs(t),r]),Lf=e=>o(o(u("readonly",e),([t,r])=>o(A(r),([n,a])=>o(u("?",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Js(t),r]),Nf=e=>o(o(u("readonly",e),([t,r])=>o(A(r),([n,a])=>[[t,n],a])),([t,r])=>[Ws(t),r]),Ff=e=>o(o(A(e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[Xs(t),r]),am=e=>o(o(Af(e),([t,r])=>[t,r],()=>o(Lf(e),([t,r])=>[t,r],()=>o(Nf(e),([t,r])=>[t,r],()=>o(Ff(e),([t,r])=>[t,r],()=>o(A(e),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),km=e=>o(o(o(u("...",e),([t,r])=>o(am(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(am(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[Zs(t),r]),Om=(e,t=[])=>o(o(km(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>Om(n,[...t,r]),()=>[t,e]),Df=e=>o(o(Om(e),([t,r])=>o(o(o(km(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Ys(t),r]),Uf=e=>o(o(u("[",e),([t,r])=>o(Df(r),([n,a])=>o(u("]",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Qs(t),r]),Kf=e=>o(o(B(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([i,m])=>o(u("readonly",m),([c,l])=>o(A(l),([v,j])=>[[t,n,i,c,v],j]))))),([t,r])=>[ei(t),r]),Gf=e=>o(o(B(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([i,m])=>o(A(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[ti(t),r]),_f=e=>o(o(B(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([i,m])=>o(A(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[ri(t),r]),zf=e=>o(o(B(e),([t,r])=>o(u(":",r),([n,a])=>o(A(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[ni(t),r]),om=e=>o(o(Kf(e),([t,r])=>[t,r],()=>o(Gf(e),([t,r])=>[t,r],()=>o(_f(e),([t,r])=>[t,r],()=>o(zf(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Pm=e=>o(o(o(u("...",e),([t,r])=>o(om(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(om(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[ai(t),r]),wm=(e,t=[])=>o(o(Pm(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>wm(n,[...t,r]),()=>[t,e]),Rm=e=>o(o(wm(e),([t,r])=>o(o(o(Pm(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[oi(t),r]),Bf=e=>o(o(u("(",e),([t,r])=>o(Rm(r),([n,a])=>o(u(")",a),([i,m])=>o(u("=>",m),([c,l])=>o(A(l),([v,j])=>[[t,n,i,c,v],j]))))),([t,r])=>[si(t),r]),Hf=e=>o(o(u("new",e),([t,r])=>o(u("(",r),([n,a])=>o(Rm(a),([i,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([v,j])=>o(A(j),([b,C])=>[[t,n,i,c,v,b],C])))))),([t,r])=>[ii(t),r]),Vf=e=>o(o(o(u("+",e),([t,r])=>o(u("readonly",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("-",e),([t,r])=>o(u("readonly",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[mi(t),r]),Jf=e=>o(o(o(u("+",e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("-",e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[pi(t),r]),Wf=e=>o(o(o(u("as",e),([t,r])=>o(A(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[ui(t),r]),Xf=e=>o(o(u("{",e),([t,r])=>o(Vf(r),([n,a])=>o(u("[",a),([i,m])=>o(B(m),([c,l])=>o(u("in",l),([v,j])=>o(A(j),([b,C])=>o(Wf(C),([x,J])=>o(u("]",J),([Re,Xe])=>o(Jf(Xe),([$t,bt])=>o(u(":",bt),([St,jt])=>o(A(jt),([te,ke])=>o(pm(ke),([dr,ht])=>o(u("}",ht),([md,pd])=>[[t,n,i,c,v,b,x,Re,$t,St,te,dr,md],pd]))))))))))))),([t,r])=>[ci(t),r]),Zf=e=>o(B(e),([t,r])=>[di(t),r]),Yf=e=>o(o(u("Options",e),([t,r])=>o(u("<",r),([n,a])=>o(A(a),([i,m])=>o(u(",",m),([c,l])=>o(Mm(l),([v,j])=>o(u(">",j),([b,C])=>[[t,n,i,c,v,b],C])))))),([t,r])=>[li(t),r]),Qf=e=>o(Nn(e),([t,r])=>[fi(t),r]),ex=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[xi(t),r]),tx=e=>o(Fn(['"',"'"],e),([t,r])=>[t,r]),rx=e=>o(u("null",e),([t,r])=>[Ii(t),r]),vm=e=>o(o(bm(e),([t,r])=>o(u(":",r),([n,a])=>o($a(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[yi(t),r]),Cm=(e,t=[])=>o(o(vm(e),([r,n])=>o(Tm(n),([a,i])=>[[r,a],i])),([r,n])=>Cm(n,[...t,r]),()=>[t,e]),nx=e=>o(o(Cm(e),([t,r])=>o(o(o(vm(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[gi(t),r]),Mm=e=>o(o(u("{",e),([t,r])=>o(nx(r),([n,a])=>o(u("}",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[$i(t),r]),Sm=(e,t=[])=>o(o($a(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>Sm(n,[...t,r]),()=>[t,e]),ax=e=>o(o(Sm(e),([t,r])=>o(o(o($a(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[bi(t),r]),ox=e=>o(o(u("[",e),([t,r])=>o(ax(r),([n,a])=>o(u("]",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[hi(t),r]),$a=e=>o(o(Qf(e),([t,r])=>[t,r],()=>o(ex(e),([t,r])=>[t,r],()=>o(tx(e),([t,r])=>[t,r],()=>o(rx(e),([t,r])=>[t,r],()=>o(Mm(e),([t,r])=>[t,r],()=>o(ox(e),([t,r])=>[t,r],()=>[])))))),([t,r])=>[t,r]),sx=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,r])=>[Ti(t),r]),ix=e=>o(u(".*",e),([t,r])=>[Ei(t),r]),mx=e=>o(u("-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?",e),([t,r])=>[ki(t),r]),px=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,r])=>[Oi(t),r]),ux=e=>o(u("(?!)",e),([t,r])=>[Pi(t),r]),cx=e=>o(nm(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,r])=>[wi(t),r]),dx=e=>o(o(sx(e),([t,r])=>[t,r],()=>o(ix(e),([t,r])=>[t,r],()=>o(mx(e),([t,r])=>[t,r],()=>o(px(e),([t,r])=>[t,r],()=>o(ux(e),([t,r])=>[t,r],()=>o(lx(e),([t,r])=>[t,r],()=>o(cx(e),([t,r])=>[t,r],()=>[]))))))),([t,r])=>[t,r]),lx=e=>o(o(u("(",e),([t,r])=>o(ba(r),([n,a])=>o(u(")",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Ri(t),r]),jm=e=>o(o(o(xa(e),([t,r])=>o(u("|",r),([n,a])=>o(jm(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>o(o(xa(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[]))),([t,r])=>[vi(t),r]),xa=e=>o(o(dx(e),([t,r])=>o(ba(r),([n,a])=>[[t,n],a])),([t,r])=>[Ci(t),r]),ba=e=>o(o(jm(e),([t,r])=>[t,r],()=>o(xa(e),([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),So=e=>o(o(u("^",e),([t,r])=>o(ba(r),([n,a])=>o(u("$",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Mi(t),r]),qm=(e,t=[])=>o(o(A(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>qm(n,[...t,r]),()=>[t,e]),fx=e=>o(o(qm(e),([t,r])=>o(o(o(A(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Si(t),r]),Am=e=>o(o(o(u("extends",e),([t,r])=>o(fx(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[ji(t),r]),xx=e=>o(o(u("interface",e),([t,r])=>o(B(r),([n,a])=>o(Ia(a),([i,m])=>o(Am(m),([c,l])=>o(ga(l),([v,j])=>[[t,n,i,c,v],j]))))),([t,r])=>[qi(t),r]),Ix=e=>o(o(u("interface",e),([t,r])=>o(B(r),([n,a])=>o(Am(a),([i,m])=>o(ga(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[Ai(t),r]),yx=e=>o(o(u("type",e),([t,r])=>o(B(r),([n,a])=>o(Ia(a),([i,m])=>o(u("=",m),([c,l])=>o(A(l),([v,j])=>[[t,n,i,c,v],j]))))),([t,r])=>[Li(t),r]),gx=e=>o(o(u("type",e),([t,r])=>o(B(r),([n,a])=>o(u("=",a),([i,m])=>o(A(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[Ni(t),r]),$x=e=>o(o(o(u("export",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Fi(t),r]),bx=e=>o(o(o(u(";",e),([t,r])=>o(u(`
7
+ `,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(`
8
+ `,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]),Lm=(e,t=[])=>o(o(ha(e),([r,n])=>o(bx(n),([a,i])=>[[r,a],i])),([r,n])=>Lm(n,[...t,r]),()=>[t,e]),hx=e=>o(o(Lm(e),([t,r])=>o(o(o(ha(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Di(t),r]),ha=e=>o(o($x(e),([t,r])=>o(o(xx(r),([n,a])=>[n,a],()=>o(Ix(r),([n,a])=>[n,a],()=>o(yx(r),([n,a])=>[n,a],()=>o(gx(r),([n,a])=>[n,a],()=>[])))),([n,a])=>o(pm(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Ui(t),r]),Tx=e=>o(o(ha(e),([t,r])=>o(hx(r),([n,a])=>[[t,n],a])),([t,r])=>[Ki(t),r]),Nm=e=>o(o(Tx(e),([t,r])=>[t,r],()=>o(Of(e),([t,r])=>[t,r],()=>o(A(e),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]);function Fm(e){let t=ya(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:K()}function Er(e,t={}){return $("TemplateLiteral",[e],t)}function Dm(e){return g({},Er(e,{}))}function kx(e){let t=Fm(e);return Dm(t)}function Um(e,t={}){let r=s.IsString(e)?kx(e):Dm(e);return p.Update(r,{},t)}function Q(e){return f(e,"TemplateLiteral")}var h={};qt(h,{ExtendsFalse:()=>P,ExtendsTrue:()=>I,ExtendsUnion:()=>Ta,IsExtendsFalse:()=>Ox,IsExtendsTrue:()=>Gm,IsExtendsTrueLike:()=>tr,IsExtendsUnion:()=>Km,Match:()=>W,TakeLeft:()=>fe});function Ta(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Km(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function I(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function Gm(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function P(){return p.Create({"~kind":"ExtendsFalse"},{})}function Ox(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function tr(e){return Km(e)||Gm(e)}function W(e,t,r){return tr(e)?t(e.inferred):r()}function fe(e,t,r){return s.IsEqual(e.length,0)?r():t(e[0],e.slice(1))}function Px(e){return s.IsString(e)||s.IsNumber(e)?q(e):s.IsNull(e)?st():S()}function Se(e){return e.map(r=>Px(r))}function zr(e){let t=Se(e);return O(t)}function _m(e){return zr(e.enum)}function wx(e,t,r,n){return W(N(e,r,n),a=>I(p.Assign(p.Assign(e,a),{[t]:r})),()=>P())}function Rx(e,t){return I(e)}function vx(e,t,r){let n=zr(r);return N(e,t,n)}function zm(e,t,r){return fe(r,(n,a)=>W(N(e,t,n),i=>zm(i,t,a),()=>P()),()=>I(e))}function Cx(e,t,r){let n=he(r);return N(e,t,n)}function Bm(e,t,r){return fe(r,(n,a)=>W(N(e,t,n),i=>I(i),()=>Bm(e,t,a)),()=>P())}function R(e,t,r){return Z(r)?Rx(e,t):ie(r)?vx(e,t,r.enum):V(r)?wx(e,r.name,t,r.extends):M(r)?zm(e,t,r.allOf):Q(r)?Cx(e,t,r.pattern):y(r)?Bm(e,t,r.anyOf):re(r)?I(e):P()}function Hm(e,t,r){return V(r)?R(e,t,r):Z(r)?I(e):re(r)?I(e):Ta(e)}function Mx(e,t){let r=Et(e),n=Et(t);return r&&n||!r&&n?!0:!(r&&!n)}function Vm(e,t,r,n){return z(n)?Mx(t,n)?N(e,r,n.items):P():R(e,t,n)}function Jm(e,t,r){return ge(r)?N(e,t,r.iteratorItems):R(e,Ae(t),r)}function Wm(e,t,r){return Ne(r)?I(e):R(e,t,r)}function Xm(e,t,r){return Oe(r)?I(e):R(e,t,r)}function Sx(e,t,r,n,a){let i=V(n)?t:n,m=V(n)?n:t,c=pe(t),l=pe(n);return!c&&l?P():W(N(e,i,m),v=>Br(v,r,a),()=>P())}function jx(e,t,r,n){return fe(n,(a,i)=>Sx(e,t,r,a,i),()=>pe(t)?I(e):P())}function qx(e,t,r){return fe(t,(n,a)=>jx(e,n,a,r),()=>I(e))}function Br(e,t,r){return qx(e,t,r)}function Un(e,t,r){return Ke(r)?I(e):N(e,t,r)}function Zm(e,t,r,n){return Z(n)?I(e):re(n)?I(e):ae(n)?W(Br(e,t,n.parameters),a=>Un(a,r,n.instanceType),()=>P()):P()}function Ym(e,t,r){return N(e,_m(t),r)}function Qm(e,t,r,n){return Z(n)?I(e):re(n)?I(e):oe(n)?W(Br(e,t,n.parameters),a=>Un(a,r,n.returnType),()=>P()):P()}function ep(e,t,r){return ce(r)?I(e):Y(r)?I(e):R(e,t,r)}function tp(e,t,r){let n=_(t);return N(e,n,r)}function rp(e,t,r){return $e(r)?N(e,t,r.iteratorItems):R(e,Fe(t),r)}function Kn(e,t,r){return t===r?I(e):P()}function Ax(e,t,r){return D(r)?Kn(e,t,r.const):Ne(r)?I(e):R(e,q(t),r)}function Lx(e,t,r){return D(r)?Kn(e,t,r.const):Oe(r)?I(e):R(e,q(t),r)}function Nx(e,t,r){return D(r)?Kn(e,t,r.const):Y(r)?I(e):R(e,q(t),r)}function Fx(e,t,r){return D(r)?Kn(e,t,r.const):le(r)?I(e):R(e,q(t),r)}function np(e,t,r){return s.IsBigInt(t.const)?Ax(e,t.const,r):s.IsBoolean(t.const)?Lx(e,t.const,r):s.IsNumber(t.const)?Nx(e,t.const,r):s.IsString(t.const)?Fx(e,t.const,r):K()}function ap(e,t,r){return V(r)?R(e,t,r):I(e)}function op(e,t,r){return Dt(r)?I(e):R(e,t,r)}function sp(e,t,r){return Y(r)?I(e):R(e,t,r)}function Dx(e,t,r){return pe(t)?pe(r)?I(e):P():I(e)}function Ux(e,t,r){return V(r)&&at(r.extends)?P():W(N(e,t,r),n=>Dx(n,t,r),()=>P())}function Kx(e,t){return e.reduce((r,n)=>n in t?tr(t[n])?{...r,...t[n].inferred}:K():K(),{})}function Gx(e,t,r){let n={};for(let m of s.Keys(r))n[m]=m in t?Ux({},t[m],r[m]):pe(r[m])?V(r[m])?I(p.Assign(e,{[r[m].name]:r[m].extends})):I(e):P();let a=s.Values(n).every(m=>tr(m)),i=a?Kx(s.Keys(n),n):{};return a?I(i):P()}function _x(e,t,r){let n=Gx(e,t,r);return tr(n)?I(p.Assign(e,n.inferred)):P()}function zx(e,t,r){return _x(e,t,r)}function ip(e,t,r){return F(r)?zx(e,t,r.properties):R(e,E(t),r)}function mp(e,t,r){return de(r)?N(e,t,r.item):R(e,De(t),r)}function pp(e,t,r){return le(r)?I(e):R(e,t,r)}function up(e,t,r){return it(r)?I(e):R(e,t,r)}function cp(e,t,r){let n=he(t);return N(e,n,r)}function Ea(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Hr(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"name")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"Inferrable")&&s.IsString(e.name)&&s.IsObject(e.type)}function ka(e){return mt(e)?V(e.items)?z(e.items.extends)?Ea(e.items.name,e.items.extends.items):re(e.items.extends)?Ea(e.items.name,e.items.extends):void 0:K():void 0}function Gn(e){return V(e)?Ea(e.name,e.extends):void 0}function Oa(e,t,r=[]){return fe(e,(n,a)=>W(N({},n,t),()=>Oa(a,t,[...r,n]),()=>{}),()=>r)}function dp(e,t,r,n){let a=Oa(r,n);return s.IsArray(a)?I(p.Assign(e,{[t]:ee(a)})):P()}function _n(e,t,r,n){let a=Oa(r,n);return s.IsArray(a)?I(p.Assign(e,{[t]:O(a)})):P()}function Bx(e){return[...e].reverse()}function Pa(e,t){return t?Bx(e):e}function Hx(e){let t=e.length>0?e[0]:void 0,r=k(t)?ka(t):void 0;return k(r)}function Vx(e,t,r,n,a,i){return W(N(e,r,a),m=>lp(m,t,n,i),()=>P())}function Jx(e,t,r,n,a){let i=ka(n);return Hr(i)?dp(e,i.name,Pa(r,t),i.type):fe(r,(m,c)=>Vx(e,t,m,c,n,a),()=>P())}function Wx(e,t,r,n){return fe(n,(a,i)=>Jx(e,t,r,a,i),()=>s.IsEqual(r.length,0)?I(e):P())}function lp(e,t,r,n){return Wx(e,t,r,n)}function Xx(e,t,r){let n=zn(e,{callstack:[]},r),a=Hx(n);return lp(e,a,Pa(t,a),Pa(n,a))}function fp(e,t,r){let n=Gn(r);return Hr(n)?_n(e,n.name,t,n.type):fe(t,(a,i)=>W(N(e,a,r),m=>fp(m,i,r),()=>P()),()=>I(e))}function xp(e,t,r){let n=zn(e,{callstack:[]},t);return U(r)?Xx(e,n,r.items):z(r)?fp(e,n,r.items):R(e,ee(n),r)}function Ip(e,t,r){return Ke(r)?I(e):Ht(r)?I(e):R(e,t,r)}function yp(e,t,r){return fe(r,(n,a)=>W(N(e,t,n),i=>I(i),()=>yp(e,t,a)),()=>P())}function wa(e,t,r){return fe(t,(n,a)=>W(yp(e,n,r),i=>wa(i,a,r),()=>P()),()=>I(e))}function gp(e,t,r){let n=Gn(r);return Hr(n)?_n(e,n.name,t,n.type):y(r)?wa(e,t,r.anyOf):wa(e,t,[r])}function $p(e,t,r){return V(r)?R(e,t,r):Z(r)?I(e):re(r)?I(e):P()}function bp(e,t,r){return Ke(r)?I(e):R(e,t,r)}function N(e,t,r){return Z(t)?Hm(e,t,r):z(t)?Vm(e,t,t.items,r):ge(t)?Jm(e,t.iteratorItems,r):Ne(t)?Wm(e,t,r):Oe(t)?Xm(e,t,r):ae(t)?Zm(e,t.parameters,t.instanceType,r):ie(t)?Ym(e,t,r):oe(t)?Qm(e,t.parameters,t.returnType,r):ce(t)?ep(e,t,r):M(t)?tp(e,t.allOf,r):$e(t)?rp(e,t.iteratorItems,r):D(t)?np(e,t,r):at(t)?ap(e,t,r):Dt(t)?op(e,t,r):Y(t)?sp(e,t,r):F(t)?ip(e,t.properties,r):de(t)?mp(e,t.item,r):le(t)?pp(e,t,r):it(t)?up(e,t,r):Q(t)?cp(e,t.pattern,r):U(t)?xp(e,t.items,r):Ht(t)?Ip(e,t,r):y(t)?gp(e,t.anyOf,r):re(t)?$p(e,t,r):Ke(t)?bp(e,t,r):P()}function Jt(e,t,r={}){return $("Interface",[e,t],r)}function rr(e){return k(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function hp(e,t,r={}){return g({},Jt(e,t,r))}function Zx(e,t,r){return e.includes(r)?!0:ct([...e,r],t,t[r])}function Tp(e,t,r){let n=yn(r);return vt(e,t,n)}function vt(e,t,r){let[n,...a]=r;return k(n)?ct(e,t,n)?!0:vt(e,t,a):!1}function ct(e,t,r){return X(r)?Zx(e,t,r.$ref):z(r)?ct(e,t,r.items):ge(r)?ct(e,t,r.iteratorItems):ae(r)?vt(e,t,[...r.parameters,r.instanceType]):oe(r)?vt(e,t,[...r.parameters,r.returnType]):rr(r)?Tp(e,t,r.parameters[1]):M(r)?vt(e,t,r.allOf):$e(r)?ct(e,t,r.iteratorItems):F(r)?Tp(e,t,r.properties):de(r)?ct(e,t,r.item):y(r)?vt(e,t,r.anyOf):U(r)?vt(e,t,r.items):we(r)?ct(e,t,Ue(r)):!1}function Bn(e,t,r){return ct(e,t,r)}function Yx(e,t){return t.reduce((r,n)=>n in e?Bn([n],e,e[n])?[...r,n]:r:K(),[])}function Ep(e){let t=fo(e);return Yx(e,t)}function Qx(e,t,r){return r.includes(t)?r:t in e?dt(e,e[t],[...r,t]):K()}function kp(e,t,r){let n=yn(t);return nr(e,n,r)}function nr(e,t,r){return t.reduce((n,a)=>dt(e,a,n),r)}function dt(e,t,r){return X(t)?Qx(e,t.$ref,r):z(t)?dt(e,t.items,r):ge(t)?dt(e,t.iteratorItems,r):ae(t)?nr(e,[...t.parameters,t.instanceType],r):oe(t)?nr(e,[...t.parameters,t.returnType],r):rr(t)?kp(e,t.parameters[1],r):M(t)?nr(e,t.allOf,r):$e(t)?dt(e,t.iteratorItems,r):F(t)?kp(e,t.properties,r):de(t)?dt(e,t.item,r):y(t)?nr(e,t.anyOf,r):U(t)?nr(e,t.items,r):we(t)?dt(e,Ue(t),r):r}function Op(e,t,r){return dt(e,r,[t])}function eI(e){return Ft()}function tI(e){return s.Keys(e).reduce((t,r)=>({...t,[r]:Ge(e[r])}),{})}function Vr(e){return e.reduce((t,r)=>[...t,Ge(r)],[])}function Ge(e){return X(e)?eI(e.$ref):z(e)?Ce(Ge(e.items),fn(e)):ge(e)?Ae(Ge(e.iteratorItems)):ae(e)?tt(Vr(e.parameters),Ge(e.instanceType)):oe(e)?rt(Vr(e.parameters),Ge(e.returnType)):M(e)?Te(Vr(e.allOf)):$e(e)?Fe(Ge(e.iteratorItems)):F(e)?E(tI(e.properties)):de(e)?De(Ge(e.item)):we(e)?vn(zt(e),Ge(Ue(e))):y(e)?O(Vr(e.anyOf)):U(e)?ee(Vr(e.items)):e}function rI(e,t){return t in e?Ge(e[t]):ue()}function Pp(e){return rI(e.$defs,e.$ref)}function Ra(e){return e.reduceRight((r,n,a)=>({[a]:n,...r}),{})}function wp(e){let t=Ra(e.items);return E(t)}function nI(e,t){return kt(e)?!!kt(t):!1}function aI(e,t){return pe(e)?!!pe(t):!1}function oI(e,t){let r=nI(e,t),n=aI(e,t),a=_([e,t]),i=dn(Lt(a));return r&&n?Ie(xe(i)):r&&!n?Ie(i):!r&&n?xe(i):i}function sI(e,t,r){return r in e?r in t?oI(e[r],t[r]):e[r]:r in t?t[r]:S()}function iI(e,t){return[...new Set([...s.Keys(t),...s.Keys(e)])].reduce((n,a)=>({...n,[a]:sI(e,t,a)}),{})}function Rp(e){return F(e)?e.properties:U(e)?Ra(e.items):K()}function vp(e,t){let r=Rp(e),n=Rp(t),a=iI(r,n);return E(a)}function Cp(e,t){let r=Zr(e,t);return s.IsEqual(r,Wr)?e:s.IsEqual(r,Xr)||s.IsEqual(r,Jr)?t:S()}function Mp(e){return F(e)||U(e)}function mI(e,t){let r=y(e),n=y(t);return r||n}function pI(e,t){let r=Ct(e),n=Ct(t),a=mI(r,n),i=Mp(r),m=Mp(n);return a?_([r,n]):i&&m?vp(r,n):i&&!m?r:!i&&m?n:Cp(r,n)}function Sp(e,t,r=[]){let[n,...a]=t;return s.IsUndefined(n)?r.length===0?[e]:r:Sp(e,a,[...r,pI(e,n)])}function jp(e,t,r=[]){let[n,...a]=e;return k(n)?jp(a,t,[...r,...Yr([n],t)]):r}function Yr(e,t=[]){let[r,...n]=e;return k(r)?y(r)?Yr(n,jp(r.anyOf,t)):Yr(n,Sp(r,t)):t}function _(e){let t=Yr(e);return va(t)}function je(e){return va(e)}function Ct(e){return M(e)?_(e.allOf):y(e)?je(e.anyOf):e}function Mt(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?S():O(e)}function uI(e,t,r){let n=Ee(e,{callstack:[]},t),a=Qr({},{callstack:[]},r);return _([...n,E(a)])}function cI(e,t){return s.Keys(e).filter(n=>t.includes(n)).reduce((n,a)=>{let i=e[a],m=rr(i)?uI(e,i.parameters[0],i.parameters[1]):i;return{...n,[a]:m}},{})}function qp(e,t,r){let n=Op(e,t,r),a=cI(e,n);return Le(a,t)}function Ap(e,t){return t in e?X(e[t])?Ap(e,e[t].$ref):e[t]:S()}function _e(e,t){return Ap(e,t)}function Lp(e){return se(e)?Pp(e):e}function me(e,t,r){let n=Lp(t),a=Lp(r);return N(e,n,a)}var Jr="equal",dI="disjoint",Wr="left-inside",Xr="right-inside";function Zr(e,t){let r=[re(e)?h.ExtendsFalse():me({},e,t),re(e)?h.ExtendsTrue({}):me({},t,e)];return h.IsExtendsTrueLike(r[0])&&h.IsExtendsTrueLike(r[1])?Jr:h.IsExtendsTrueLike(r[0])&&h.IsExtendsFalse(r[1])?Wr:h.IsExtendsFalse(r[0])&&h.IsExtendsTrueLike(r[1])?Xr:dI}function lI(e){return y(e)?Je(e.anyOf):[e]}function Je(e){return e.reduce((t,r)=>[...t,...lI(r)],[])}function fI(e,t){return t.filter(r=>Zr(e,r)!==Xr)}function xI(e,t){let r=t.some(n=>{let a=Zr(e,n);return s.IsEqual(a,Wr)||s.IsEqual(a,Jr)});return s.IsEqual(r,!1)}function II(e,t){let r=Ct(e);return Z(r)?[r]:xI(r,t)?[...fI(r,t),r]:t}function yI(e){return e.reduce((t,r)=>F(r)?[...t,r]:at(r)?t:II(r,t),[])}function va(e){let t=yI(e),r=Je(t);return r.length===0?S():r.length===1?r[0]:O(r)}function gI(e,t,r,n){let a=d(e,t,r);return p.Update(Ct(a),{},n)}function Np(e,t,r,n){return gI(e,t,r,n)}function en(e,t=[]){return Qe(e)&&s.IsEqual(e.action,"Conditional")?X(e.parameters[0])?en(e.parameters[2],en(e.parameters[3],[...t,e.parameters[0].$ref])):en(e.parameters[2],en(e.parameters[3],t)):Qe(e)&&s.IsEqual(e.action,"Mapped")&&Qe(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&X(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function $I(e,t){return e.reduce((r,n)=>[...r,t.includes(n.name)],[])}function Up(e,t,r=[]){let[n,...a]=e,[i,...m]=t;return s.IsGreaterThan(e.length,0)&&s.IsGreaterThan(t.length,0)?Up(a,m,[...r,[i,n]]):r}function bI(e){return y(e)?[...e.anyOf]:[e]}function hI(e,t){return e.reduce((r,n)=>[...r,[...n,t]],[])}function Fp(e,t){return t.reduce((r,n)=>[...r,...hI(e,n)],[])}function Dp(e){return e.reduce((t,r)=>s.IsEqual(r[0],!0)?Fp(t,bI(r[1])):Fp(t,[r[1]]),[[]])}function Kp(e,t,r){let n=en(r),a=$I(e,n),i=Up(t,a);return Qe(r)&&s.IsEqual(r.action,"Conditional")||Qe(r)&&s.IsEqual(r.action,"Mapped")?Dp(i):[t]}function TI(){return["(not-resolvable)",S()]}function EI(){return["(not-generic)",S()]}function kI(e,t,r){return[e,nt(t,r)]}function OI(e,t,r){return t in e?Gp(e,t,e[t],r):TI()}function Gp(e,t,r,n){return Nt(r)?kI(t,r.parameters,r.expression):X(r)?OI(e,r.$ref,n):EI()}function _p(e,t,r){return Gp(e,"(anonymous)",t,r)}function PI(e,t,r){if(V(t)||ar(t)||h.IsExtendsTrueLike(me({},t,r)))return;let n={parameter:e,expect:r,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:n})}function zp(e,t,r,n,a){let i=d(e,t,a);return PI(r,i,n),p.Assign(e,{[r]:i})}function wI(e,t,r,n,a){let i=d(e,t,r.extends),m=d(e,t,r.equals),[c,...l]=a;return k(c)?Ca(zp(e,t,r.name,i,c),t,n,l):Ca(zp(e,t,r.name,i,m),t,n,[])}function Ca(e,t,r,n){let[a,...i]=r;return k(a)?wI(e,t,a,i,n):e}function Bp(e,t,r,n){return Ca(e,t,r,n)}function RI(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function vI(e,t){return s.IsEqual(RI(e),t)}function CI(e,t,r,n,a,i){let m=Bp(e,t,n,i),c=d(m,{callstack:[...t.callstack,r.$ref]},a);return d(e,t,c)}function MI(e,t,r,n,a,i){return i.reduce((m,c)=>[...m,CI(e,t,r,n,a,c)],[])}function SI(e,t,r,n,a,i){let m=Kp(n,i,a),c=MI(e,t,r,n,a,m);return s.IsEqual(c.length,1)?c[0]:je(c)}function Hn(e,t,r,n){let a=Ee(e,t,n),i=_p(e,r,n),m=i[0],c=i[1];return Nt(c)?vI(t,m)?kr(He(m),a):SI(e,t,He(m),c.parameters,c.expression,a):kr(r,a)}function kr(e,t){return p.Create({"~kind":"Call"},{target:e,arguments:t},{})}function Hp(e,t){return Hn({},{callstack:[]},e,t)}function ar(e){return f(e,"Call")}function Vp(e){return de(e)?Vp(e.item):e}function jI(e,t,r,n){let a=d(e,t,r);return p.Update(Vp(a),{},n)}function Jp(e,t,r,n){return T(e,[r])?jI(e,t,r,n):Gr(r,n)}function Wp(e,t){return e(t)}function Xp(e,t){return s.IsString(t)?q(Wp(e,t)):q(t)}function Zp(e,t){let r=he(t);return We(e,r)}function Yp(e,t){let r=t.map(n=>We(e,n));return O(r)}function We(e,t){return D(t)?Xp(e,t.const):Q(t)?Zp(e,t.pattern):y(t)?Yp(e,t.anyOf):t}function Or(e,t={}){return $("Capitalize",[e],t)}function Qp(e,t={}){return g({},Or(e,t))}function Pr(e,t={}){return $("Lowercase",[e],t)}function eu(e,t={}){return g({},Pr(e,t))}function wr(e,t={}){return $("Uncapitalize",[e],t)}function tu(e,t={}){return g({},wr(e,t))}function Rr(e,t={}){return $("Uppercase",[e],t)}function ru(e,t={}){return g({},Rr(e,t))}var qI=e=>e[0].toUpperCase()+e.slice(1),AI=e=>e.toLowerCase(),LI=e=>e[0].toLowerCase()+e.slice(1),NI=e=>e.toUpperCase();function FI(e,t,r,n){let a=d(e,t,r);return p.Update(We(qI,a),{},n)}function nu(e,t,r,n){return T(e,[r])?FI(e,t,r,n):Or(r,n)}function DI(e,t,r,n){let a=d(e,t,r);return p.Update(We(AI,a),{},n)}function au(e,t,r,n){return T(e,[r])?DI(e,t,r,n):Pr(r,n)}function UI(e,t,r,n){let a=d(e,t,r);return p.Update(We(LI,a),{},n)}function ou(e,t,r,n){return T(e,[r])?UI(e,t,r,n):wr(r,n)}function KI(e,t,r,n){let a=d(e,t,r);return p.Update(We(NI,a),{},n)}function su(e,t,r,n){return T(e,[r])?KI(e,t,r,n):Rr(r,n)}function vr(e,t,r,n,a={}){return $("Conditional",[e,t,r,n],a)}function iu(e,t,r,n,a={}){return g({},vr(e,t,r,n,a))}function GI(e,t,r,n,a,i,m){let c=d(e,t,r),l=d(e,t,n),v=me(e,c,l);return p.Update(h.IsExtendsUnion(v)?O([d(v.inferred,t,a),d(e,t,i)]):h.IsExtendsTrue(v)?d(v.inferred,t,a):d(e,t,i),{},m)}function mu(e,t,r,n,a,i,m){return T(e,[r,n])?GI(e,t,r,n,a,i,m):vr(r,n,a,i,m)}function Cr(e,t={}){return $("ConstructorParameters",[e],t)}function pu(e,t={}){return g({},Cr(e,t))}function _I(e){return ae(e)?d({},{callstack:[]},ee(e.parameters)):S()}function zI(e,t,r,n){let a=d(e,t,r);return p.Update(_I(a),{},n)}function uu(e,t,r,n){return T(e,[r])?zI(e,t,r,n):Cr(r,n)}function Mr(e,t,r={}){return $("Exclude",[e,t],r)}function cu(e,t,r={}){return g({},Mr(e,t,r))}function du(e,t){return e.reduce((r,n)=>[...r,...lu(n,t)],[])}function lu(e,t){let r=me({},e,t);return h.IsExtendsTrueLike(r)?[]:[e]}function BI(e,t){let r=ie(e)?du(Se(e.enum),t):y(e)?du(Je(e.anyOf),t):lu(e,t);return je(r)}function HI(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return p.Update(BI(i,m),{},a)}function Vn(e,t,r,n,a){return T(e,[r,n])?HI(e,t,r,n,a):Mr(r,n,a)}function Sr(e,t,r={}){return $("Extract",[e,t],r)}function fu(e,t,r={}){return g({},Sr(e,t,r))}function xu(e,t){return e.reduce((r,n)=>[...r,...Iu(n,t)],[])}function Iu(e,t){let r=me({},e,t);return h.IsExtendsTrueLike(r)?[e]:[]}function VI(e,t){let r=ie(e)?xu(Se(e.enum),t):y(e)?xu(Je(e.anyOf),t):Iu(e,t);return je(r)}function JI(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return p.Update(VI(i,m),{},a)}function yu(e,t,r,n,a){return T(e,[r,n])?JI(e,t,r,n,a):Sr(r,n,a)}var WI=new RegExp("^(?:0|[1-9][0-9]*)$");function or(e){let t=`${e}`;return WI.test(t)?parseInt(t):e}function XI(e){return q(or(e))}function gu(e){return e.map(t=>$u(t))}function $u(e){return M(e)?Te(gu(e.allOf)):y(e)?O(gu(e.anyOf)):D(e)?XI(e.const):e}function bu(e,t){let r=$u(t),n=me({},r,be());return h.IsExtendsTrueLike(n)?e:D(t)&&s.IsEqual(t.const,"length")?be():S()}function hu(e,t){let r=_e(e,t);return ze(r)}function Jn(e){return e.reduce((t,r)=>[...t,...ze(r)],[])}function Tu(e){let t=Se(e);return Jn(t)}function Eu(e){let t=_(e);return ze(t)}function ku(e){return[`${e}`]}function Ou(e){let t=he(e);return ze(t)}function ze(e){return se(e)?hu(e.$defs,e.$ref):ie(e)?Tu(e.enum):M(e)?Eu(e.allOf):D(e)?ku(e.const):Q(e)?Ou(e.pattern):y(e)?Jn(e.anyOf):[]}function sr(e){return ze(e)}function ZI(e,t){return t in e?[e[t]]:[]}function YI(e,t){return t.reduce((r,n)=>[...r,...ZI(e,n)],[])}function Pu(e,t){let r=sr(t),n=YI(e,r);return je(n)}function QI(e){return q(or(e))}function wu(e){return e.map(t=>Ma(t))}function Ma(e){return M(e)?Te(wu(e.allOf)):y(e)?O(wu(e.anyOf)):D(e)?QI(e.const):e}function ey(e,t){return e.reduceRight((r,n,a)=>{let i=me({},q(a),t);return h.IsExtendsTrueLike(i)?[n,...r]:r},[])}function ty(e,t){let r=Ma(t),n=ey(e,r);return Mt(n)}function ry(e){return Mt(e)}function Ru(e,t){return D(t)&&s.IsEqual(t.const,"length")?q(e.length):Y(t)||ce(t)?ry(e):ty(e,t)}function ny(e){return e.reduce((t,r)=>Tn(r)?[...t,q(r)]:t,[])}function ir(e){let t=ny(e);return O(t)}function Wt(e,t,r={}){return $("Index",[e,t],r)}function vu(e,t,r={}){let n=s.IsArray(t)?ir(t):t;return g({},Wt(e,n,r))}function Cu(e,t){let r=_e(e,t);return qe(r)}function ay(e,t){let r=s.Keys(e).filter(j=>!s.HasPropertyKey(t,j)),n=s.Keys(t).filter(j=>!s.HasPropertyKey(e,j)),a=s.Keys(e).filter(j=>s.HasPropertyKey(t,j)),i=r.reduce((j,b)=>({...j,[b]:e[b]}),{}),m=n.reduce((j,b)=>({...j,[b]:t[b]}),{}),c=a.reduce((j,b)=>({...j,[b]:_([e[b],t[b]])}),{}),l=p.Assign(i,m);return p.Assign(l,c)}function Mu(e){return e.reduce((t,r)=>ay(t,qe(r)),{})}function Su(e){let t=wp(ee(e));return qe(t)}function oy(e,t){return s.Keys(e).filter(a=>a in t).reduce((a,i)=>({...a,[i]:je([e[i],t[i]])}),{})}function ju(e,t){let[r,...n]=e;return k(r)?ju(n,oy(t,qe(r))):t}function qu(e){let[t,...r]=e;return k(t)?ju(r,qe(t)):K()}function qe(e){return se(e)?Cu(e.$defs,e.$ref):M(e)?Mu(e.allOf):y(e)?qu(e.anyOf):U(e)?Su(e.items):F(e)?e.properties:{}}function mr(e){let t=qe(e);return E(t)}function sy(e){return se(e)||M(e)||y(e)?mr(e):e}function iy(e,t){let r=sy(e);return z(r)?bu(r.items,t):F(r)?Pu(r.properties,t):U(r)?Ru(r.items,t):S()}function my(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return p.Update(iy(i,m),{},a)}function Au(e,t,r,n,a){return T(e,[r,n])?my(e,t,r,n,a):Wt(r,n,a)}function jr(e,t={}){return $("InstanceType",[e],t)}function Lu(e,t={}){return g({},jr(e,t))}function py(e){return ae(e)?e.instanceType:S()}function uy(e,t,r,n){let a=d(e,t,r);return p.Update(py(a),{},n)}function Nu(e,t,r,n={}){return T(e,[r])?uy(e,t,r,n):jr(r,n)}function cy(e,t,r,n,a){let i=Ee(e,{callstack:[]},r),m=Qr(e,{callstack:[]},n),c=_([...i,E(m)]);return p.Update(c,{},a)}function Fu(e,t,r,n,a){return T(e,r)?cy(e,t,r,n,a):Jt(r,n,a)}function Xt(e,t={}){return $("KeyOf",[e],t)}function Du(e,t={}){return g({},Xt(e,t))}function Uu(){return O([be(),Pe(),Ut()])}function Ku(e){return be()}function dy(e){return e.reduce((r,n)=>Tn(n)?[...r,q(or(n))]:K(),[])}function Gu(e){let t=s.Keys(e),r=dy(t);return Mt(r)}function _u(e){return zt(e)}function zu(e){let t=e.map((r,n)=>q(n));return Mt(t)}function ly(e){return se(e)||M(e)||y(e)?mr(e):e}function fy(e){let t=ly(e);return Z(t)?Uu():z(t)?Ku(t.items):F(t)?Gu(t.properties):we(t)?_u(t):U(t)?zu(t.items):S()}function xy(e,t,r,n){let a=d(e,t,r);return p.Update(fy(a),{},n)}function Bu(e,t,r,n){return T(e,[r])?xy(e,t,r,n):Xt(r,n)}function Vt(e,t,r,n,a={}){return $("Mapped",[e,t,r,n],a)}function Hu(e,t,r,n,a={}){return g({},Vt(e,t,r,n,a))}function Iy(e){let t=he(e);return Sa(t)}function Vu(e){return e.reduce((t,r)=>[...t,...Sa(r)],[])}function Sa(e){return ie(e)?Vu(Se(e.enum)):kn(e)||En(e)?[e]:Q(e)?Iy(e.pattern):y(e)?Vu(e.anyOf):[e]}function Ju(e){return Sa(e)}function yy(e){return Q(e)?he(e.pattern):e}function gy(e,t,r,n,a,i){let m=p.Assign(e,{[r.name]:n}),c=d(m,t,a),l=yy(c),v=d(m,t,i);return En(l)||kn(l)?{[l.const]:v}:{}}function $y(e,t,r,n,a,i){return n.reduce((m,c)=>[...m,gy(e,t,r,c,a,i)],[])}function by(e){return e.reduce((t,r)=>[...t,E(r)],[])}function hy(e,t,r,n,a,i){let m=Ju(n),c=$y(e,t,r,m,a,i),l=by(c);return _(l)}function Ty(e,t,r,n,a,i,m){let c=d(e,t,n);return p.Update(hy(e,t,r,c,a,i),{},m)}function Wu(e,t,r,n,a,i,m){return T(e,[n])?Ty(e,t,r,n,a,i,m):Vt(r,n,a,i,m)}function Ey(e,t){return s.Keys(e).filter(n=>t.includes(n)).reduce((n,a)=>({...n,[a]:qp(e,a,e[a])}),{})}function ky(e,t){return s.Keys(e).filter(n=>!t.includes(n)).reduce((n,a)=>({...n,[a]:d(e,{callstack:[]},e[a])}),{})}function Oy(e,t){let r=Ep(e),n=Ey(e,r),a=ky(e,r),i={...n,...a};return p.Update(i,{},t)}function Xu(e,t,r,n){let a=p.Assign(e,r);return Oy(a,n)}function qr(e,t={}){return $("NonNullable",[e],t)}function Zu(e,t={}){return g({},qr(e,t))}function Py(e){let t=O([st(),Bt()]);return Vn({},{callstack:[]},e,t,{})}function wy(e,t,r,n){let a=d(e,t,r);return p.Update(Py(a),{},n)}function Yu(e,t,r,n){return T(e,[r])?wy(e,t,r,n):qr(r,n)}function Wn(e){let t=mr(e);return F(t)?t.properties:K()}function Ar(e,t,r={}){return $("Omit",[e,t],r)}function Qu(e,t,r={}){let n=s.IsArray(t)?ir(t):t;return g({},Ar(e,n,r))}function Ry(e,t){return s.Keys(e).reduce((n,a)=>t.includes(a)?n:{...n,[a]:e[a]},{})}function vy(e,t){let r=Wn(e),n=sr(t),a=Ry(r,n);return E(a)}function Cy(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return p.Update(vy(i,m),{},a)}function ec(e,t,r,n,a){return T(e,[r,n])?Cy(e,t,r,n,a):Ar(r,n,a)}function Zt(e,t){return $("Options",[e,t],{})}function tc(e,t){return g({},Zt(e,t))}function My(e,t,r,n){let a=d(e,t,r);return p.Update(a,{},n)}function rc(e,t,r,n){return T(e,[r])?My(e,t,r,n):Zt(r,n)}function Lr(e,t={}){return $("Parameters",[e],t)}function nc(e,t={}){return g({},Lr(e,t))}function Sy(e){return oe(e)?d({},{callstack:[]},ee(e.parameters)):S()}function jy(e,t,r,n){let a=d(e,t,r);return p.Update(Sy(a),{},n)}function ac(e,t,r,n){return T(e,[r])?jy(e,t,r,n):Lr(r,n)}function Nr(e,t={}){return $("Partial",[e],t)}function oc(e,t={}){return g({},Nr(e,t))}function sc(e,t){let r=_e(e,t),n=lt(r);return Le(p.Assign(e,{[t]:n}),t)}function ic(e){let t=e.map(r=>lt(r));return _(t)}function mc(e){let t=e.map(r=>lt(r));return O(t)}function pc(e){let t=s.Keys(e).reduce((n,a)=>({...n,[a]:cn(e[a])}),{});return E(t)}function lt(e){return se(e)?sc(e.$defs,e.$ref):M(e)?ic(e.allOf):y(e)?mc(e.anyOf):F(e)?pc(e.properties):E({})}function qy(e,t,r,n){let a=d(e,t,r);return p.Update(lt(a),{},n)}function uc(e,t,r,n){return T(e,[r])?qy(e,t,r,n):Nr(r,n)}function Fr(e,t,r={}){return $("Pick",[e,t],r)}function cc(e,t,r={}){let n=s.IsArray(t)?ir(t):t;return g({},Fr(e,n,r))}function Ay(e,t){return s.Keys(e).reduce((n,a)=>t.includes(a)?p.Assign(n,{[a]:e[a]}):n,{})}function Ly(e,t){let r=Wn(e),n=sr(t),a=Ay(r,n);return E(a)}function Ny(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return p.Update(Ly(i,m),{},a)}function dc(e,t,r,n,a){return T(e,[r,n])?Ny(e,t,r,n,a):Fr(r,n,a)}function Dr(e,t={}){return $("ReadonlyType",[e],t)}function lc(e,t={}){return g({},Dr(e,t))}function fc(e){return et(Ce(e))}function xc(e,t){let r=_e(e,t),n=ft(r);return Le(p.Assign(e,{[t]:n}),t)}function Ic(e){let t=e.map(r=>ft(r));return _(t)}function yc(e){let t=s.Keys(e).reduce((n,a)=>({...n,[a]:ln(e[a])}),{});return E(t)}function gc(e){return et(ee(e))}function $c(e){let t=e.map(r=>ft(r));return O(t)}function ft(e){return z(e)?fc(e.items):se(e)?xc(e.$defs,e.$ref):M(e)?Ic(e.allOf):F(e)?yc(e.properties):U(e)?gc(e.items):y(e)?$c(e.anyOf):e}function Fy(e,t,r,n){let a=d(e,t,r);return p.Update(ft(a),{},n)}function bc(e,t,r,n){return T(e,[r])?Fy(e,t,r,n):Dr(r,n)}function hc(e){return ye(Me,e)}function Tc(e){return E({true:e,false:e})}function Ec(e,t){let r=zr(e);return xt(r,t)}function kc(e,t){return ye(Kt,t)}function Oc(e,t){let r=_(e);return xt(r,t)}function Pc(e,t){return s.IsString(e)||s.IsNumber(e)?E({[e]:t}):s.IsEqual(e,!1)?E({false:t}):s.IsEqual(e,!0)?E({true:t}):E({})}function wc(e,t){return ye(Gt,t)}function Rc(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?ye(e.pattern.toString(),t):ye(Me,t)}function vc(e,t){let r=hr(e);return wn(r)?xt(he(e),t):ye(e,t)}function Dy(e){return e.some(t=>le(t)||Y(t)||ce(t))}function Uy(e,t){return s.IsEqual(Dy(e),!0)?ye(Me,t):void 0}function Ky(e,t){return e.reduce((r,n)=>D(n)&&(s.IsString(n.const)||s.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function Gy(e,t){let r=Ky(e,t);return E(r)}function Cc(e,t){let r=Je(e),n=Uy(r,t);return k(n)?n:Gy(r,t)}function xt(e,t){return Z(e)?hc(t):Oe(e)?Tc(t):ie(e)?Ec(e.enum,t):ce(e)?kc(e,t):M(e)?Oc(e.allOf,t):D(e)?Pc(e.const,t):Y(e)?wc(e,t):y(e)?Cc(e.anyOf,t):le(e)?Rc(e,t):Q(e)?vc(e.pattern,t):E({})}function _y(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return p.Update(xt(i,m),{},a)}function Mc(e,t,r,n,a){return T(e,[r])?_y(e,t,r,n,a):Tr(r,n,a)}function Sc(e,t,r,n){return n in e?Bn([n],e,e[n])?r:d(e,t,e[n]):r}function jc(e,t){let r=_e(e,t),n=It(r);return Le(p.Assign(e,{[t]:n}),t)}function qc(e){let t=e.map(r=>It(r));return _(t)}function Ac(e){let t=e.map(r=>It(r));return O(t)}function Lc(e){let t=s.Keys(e).reduce((n,a)=>({...n,[a]:Lt(e[a])}),{});return E(t)}function It(e){return se(e)?jc(e.$defs,e.$ref):M(e)?qc(e.allOf):y(e)?Ac(e.anyOf):F(e)?Lc(e.properties):E({})}function Ur(e,t={}){return $("Required",[e],t)}function Nc(e,t={}){return g({},Ur(e,t))}function zy(e,t,r,n){let a=d(e,t,r);return p.Update(It(a),{},n)}function Fc(e,t,r,n){return T(e,[r])?zy(e,t,r,n):Ur(r,n)}function Kr(e,t={}){return $("ReturnType",[e],t)}function Dc(e,t={}){return g({},Kr(e,t))}function By(e){return oe(e)?e.returnType:S()}function Hy(e,t,r,n){let a=d(e,t,r);return p.Update(By(a),{},n)}function Uc(e,t,r,n){return T(e,[r])?Hy(e,t,r,n):Kr(r,n)}function Vy(e){return e.join("|")}function Jy(e){return e.slice(1,e.length-1)}function Wy(e,t,r){return yt(t,`${r}${e}`)}function Xy(e,t){return yt(e,`${t}${wo}`)}function Zy(e,t){return yt(e,`${t}${hn}`)}function Yy(e,t){return yt(e,`${t}${On}`)}function Qy(e,t){return qa(O([q("false"),q("true")]),e,t)}function eg(e,t){return yt(e,`${t}${Pn}`)}function tg(e,t,r){return yt(t,`${r}${Jy(e)}`)}function rg(e,t,r){let n=Se(e);return ja(n,t,r)}function ja(e,t,r,n=[]){let[a,...i]=e;return k(a)?ja(i,t,r,[...n,qa(a,[],"")]):yt(t,`${r}(${Vy(n)})`)}function qa(e,t,r){return ie(e)?rg(e.enum,t,r):ce(e)?Zy(t,r):D(e)?Wy(e.const,t,r):Ne(e)?Xy(t,r):Oe(e)?Qy(t,r):Y(e)?Yy(t,r):le(e)?eg(t,r):Q(e)?tg(e.pattern,t,r):y(e)?ja(e.anyOf,t,r):co}function yt(e,t){let[r,...n]=e;return k(r)?qa(r,n,t):t}function ng(e){return`^${yt(e,"")}$`}function Kc(e){let t=ng(e);return Rn(t)}function ag(e,t,r,n){let a=Ee(e,t,r);return p.Update(Kc(a),{},n)}function Gc(e,t,r,n){return T(e,r)?ag(e,t,r,n):Er(r,n)}function og(e){return mt(e)?U(e.items)?Aa(e.items.items):V(e.items)?[e]:X(e.items)?[e]:[S()]:[e]}function Aa(e){return e.reduce((r,n)=>[...r,...og(n)],[])}function sg(e,t){return t in e}function ig(e,t){return M(t)?T(e,t.allOf):y(t)?T(e,t.anyOf):X(t)?sg(e,t.$ref):!0}function T(e,t){let[r,...n]=t;return k(r)?ig(e,r)?T(e,n):!1:!0}function tn(e,t,r){return so(e)?tn(e.type,"remove",r):ro(e)?tn(e.type,t,"remove"):ao(e)?tn(e.type,"add",r):eo(e)?tn(e.type,t,"add"):[e,t,r]}function mg(e,t){return s.IsEqual(e,"remove")?dn(t):s.IsEqual(e,"add")?Ie(t):t}function pg(e,t){return s.IsEqual(e,"remove")?Lt(t):s.IsEqual(e,"add")?xe(t):t}function Qr(e,t,r){return s.Keys(r).reduce((n,a)=>({...n,[a]:d(e,t,r[a])}),{})}function zn(e,t,r){let n=Ee(e,t,r);return Aa(n)}function Ee(e,t,r){return r.map(n=>d(e,t,n))}function ug(e,t,r,n,a){return s.IsEqual(r,"Awaited")?Jp(e,t,n[0],a):s.IsEqual(r,"Capitalize")?nu(e,t,n[0],a):s.IsEqual(r,"Conditional")?mu(e,t,n[0],n[1],n[2],n[3],a):s.IsEqual(r,"ConstructorParameters")?uu(e,t,n[0],a):s.IsEqual(r,"Evaluate")?Np(e,t,n[0],a):s.IsEqual(r,"Exclude")?Vn(e,t,n[0],n[1],a):s.IsEqual(r,"Extract")?yu(e,t,n[0],n[1],a):s.IsEqual(r,"Index")?Au(e,t,n[0],n[1],a):s.IsEqual(r,"InstanceType")?Nu(e,t,n[0],a):s.IsEqual(r,"Interface")?Fu(e,t,n[0],n[1],a):s.IsEqual(r,"KeyOf")?Bu(e,t,n[0],a):s.IsEqual(r,"Lowercase")?au(e,t,n[0],a):s.IsEqual(r,"Mapped")?Wu(e,t,n[0],n[1],n[2],n[3],a):s.IsEqual(r,"Module")?Xu(e,t,n[0],a):s.IsEqual(r,"NonNullable")?Yu(e,t,n[0],a):s.IsEqual(r,"Pick")?dc(e,t,n[0],n[1],a):s.IsEqual(r,"Options")?rc(e,t,n[0],n[1]):s.IsEqual(r,"Parameters")?ac(e,t,n[0],a):s.IsEqual(r,"Partial")?uc(e,t,n[0],a):s.IsEqual(r,"Omit")?ec(e,t,n[0],n[1],a):s.IsEqual(r,"ReadonlyType")?bc(e,t,n[0],a):s.IsEqual(r,"Record")?Mc(e,t,n[0],n[1],a):s.IsEqual(r,"Required")?Fc(e,t,n[0],a):s.IsEqual(r,"ReturnType")?Uc(e,t,n[0],a):s.IsEqual(r,"TemplateLiteral")?Gc(e,t,n[0],a):s.IsEqual(r,"Uncapitalize")?ou(e,t,n[0],a):s.IsEqual(r,"Uppercase")?su(e,t,n[0],a):$(r,n,a)}function d(e,t,r){let n=Et(r),a=tn(r,kt(r)?"add":"none",pe(r)?"add":"none"),i=In(a[0])?a[0].Clone():a[0],m=X(i)?Sc(e,t,i,i.$ref):z(i)?Ce(d(e,t,i.items),fn(i)):ge(i)?Ae(d(e,t,i.iteratorItems),io(i)):ar(i)?Hn(e,t,i.target,i.arguments):ae(i)?tt(Ee(e,t,i.parameters),d(e,t,i.instanceType),po(i)):Qe(i)?ug(e,t,i.action,i.parameters,i.options):oe(i)?rt(Ee(e,t,i.parameters),d(e,t,i.returnType),uo(i)):M(i)?Te(Ee(e,t,i.allOf),bo(i)):$e(i)?Fe(d(e,t,i.iteratorItems),vo(i)):F(i)?E(Qr(e,t,i.properties),xo(i)):de(i)?De(d(e,t,i.item),Mo(i)):we(i)?Do(_t(i),d(e,t,Ue(i))):mt(i)?wt(d(e,t,i.items)):U(i)?ee(zn(e,t,i.items),Ko(i)):y(i)?O(Ee(e,t,i.anyOf),Io(i)):i,c=n?et(m):m;return mg(a[1],pg(a[2],c))}function g(e,t){return d(e,{callstack:[]},t)}function Gr(e,t={}){return $("Awaited",[e],t)}function _c(e,t={}){return g({},Gr(e,t))}function ma(e,t={}){return $("Evaluate",[e],t)}function zc(e,t={}){return g({},ma(e,t))}function pa(e,t={}){return $("Module",[e],t)}function Bc(e,t={}){return g({},pa(e,t))}function Hc(...e){let[t,r,n]=ot.Match(e,{2:(m,c)=>s.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=Nm(r),i=s.IsArray(a)&&s.IsEqual(a.length,2)?d(t,{callstack:[]},a[0]):S();return p.Update(i,{},n)}var H={};qt(H,{Any:()=>Ft,Array:()=>Ce,AsyncIterator:()=>Ae,Awaited:()=>_c,Base:()=>xn,BigInt:()=>$r,Boolean:()=>bn,Call:()=>Hp,Capitalize:()=>Qp,Codec:()=>$n,Conditional:()=>iu,Constructor:()=>tt,ConstructorParameters:()=>pu,Cyclic:()=>Le,Decode:()=>ko,DecodeBuilder:()=>gr,Encode:()=>Oo,EncodeBuilder:()=>yr,Enum:()=>$o,Evaluate:()=>zc,Exclude:()=>cu,Extends:()=>me,ExtendsResult:()=>h,Extract:()=>fu,Function:()=>rt,Generic:()=>nt,Identifier:()=>br,Immutable:()=>et,Index:()=>vu,Infer:()=>Ir,InstanceType:()=>Lu,Instantiate:()=>g,Integer:()=>Ot,Interface:()=>hp,Intersect:()=>Te,IsAny:()=>Z,IsArray:()=>z,IsAsyncIterator:()=>ge,IsBase:()=>In,IsBigInt:()=>Ne,IsBoolean:()=>Oe,IsCall:()=>ar,IsCodec:()=>gn,IsConstructor:()=>ae,IsCyclic:()=>se,IsEnum:()=>ie,IsFunction:()=>oe,IsGeneric:()=>Nt,IsIdentifier:()=>Ro,IsImmutable:()=>Et,IsInfer:()=>V,IsInteger:()=>ce,IsIntersect:()=>M,IsIterator:()=>$e,IsKind:()=>f,IsLiteral:()=>D,IsNever:()=>at,IsNull:()=>Dt,IsNumber:()=>Y,IsObject:()=>F,IsOptional:()=>pe,IsParameter:()=>Co,IsPromise:()=>de,IsReadonly:()=>kt,IsRecord:()=>we,IsRef:()=>X,IsRefine:()=>aa,IsRest:()=>mt,IsSchema:()=>k,IsString:()=>le,IsSymbol:()=>it,IsTemplateLiteral:()=>Q,IsThis:()=>Uo,IsTuple:()=>U,IsUndefined:()=>Ht,IsUnion:()=>y,IsUnknown:()=>re,IsUnsafe:()=>_o,IsVoid:()=>Ke,Iterator:()=>Fe,KeyOf:()=>Du,Literal:()=>q,Lowercase:()=>eu,Mapped:()=>Hu,Module:()=>Bc,Never:()=>S,NonNullable:()=>Zu,Null:()=>st,Number:()=>be,Object:()=>E,Omit:()=>Qu,Optional:()=>cn,Options:()=>tc,Parameter:()=>Pt,Parameters:()=>nc,Partial:()=>oc,Pick:()=>cc,Promise:()=>De,Readonly:()=>ln,ReadonlyType:()=>lc,Record:()=>vn,RecordKey:()=>zt,RecordKeyAsPattern:()=>_t,RecordValue:()=>Ue,Ref:()=>He,Refine:()=>Po,Required:()=>Nc,Rest:()=>wt,ReturnType:()=>Dc,Script:()=>Hc,String:()=>Pe,Symbol:()=>Ut,TemplateLiteral:()=>Um,This:()=>Cn,Tuple:()=>ee,Uncapitalize:()=>tu,Undefined:()=>Bt,Union:()=>O,Unknown:()=>ue,Unsafe:()=>Go,Uppercase:()=>ru,Void:()=>Mn});import{existsSync as ad,readFileSync as _g}from"node:fs";import{homedir as sd}from"node:os";import{join as cr}from"node:path";import{spawn as zg}from"node:child_process";var cg=new Set(["ECONNREFUSED","ConnectionRefused"]);function La(e,t){if(!e||typeof e!="object"||t.has(e))return!1;if(t.add(e),e instanceof Error&&e.message.includes("ECONNREFUSED"))return!0;let r=e;return typeof r.code=="string"&&cg.has(r.code)||La(r.cause,t)?!0:Array.isArray(r.errors)&&r.errors.some(n=>La(n,t))}function Vc(e){return La(e,new Set)?!0:e instanceof Error&&e.message.includes("ECONNREFUSED")}import{homedir as dg}from"os";import{join as lg}from"path";function pr(e,t=process.platform,r=dg()){return typeof e!="string"||e.length===0?e:e==="~"?r:e.startsWith("~/")||t==="win32"&&e.startsWith("~\\")?lg(r,e.slice(2)):e}var ur="MEMINDEX_",fg="AGENT_MEM_",rn=[fg];function Xn(e){return e.startsWith(ur)||rn.some(t=>e.startsWith(t))}function Na(e){if(!e.startsWith(ur))return[];let t=e.slice(ur.length);return rn.map(r=>r+t)}function xg(e=process.env){for(let t of rn)for(let r of Object.keys(e)){if(!r.startsWith(t))continue;let n=ur+r.slice(t.length);e[n]===void 0&&(e[n]=e[r])}}function Jc(e){let t=null;for(let r of rn)for(let n of Object.keys(e)){if(!n.startsWith(r))continue;let a=ur+n.slice(r.length);(t??e)[a]===void 0&&(t??={...e},t[a]=e[n])}return t??e}xg();import{randomBytes as Zc}from"node:crypto";import{constants as Yc,openSync as ed,closeSync as td,readFileSync as Sg,writeFileSync as jg,fstatSync as qg,fchmodSync as Ag,fsyncSync as Lg,linkSync as Ng,unlinkSync as Fg,mkdirSync as Dg}from"node:fs";import{join as Da}from"node:path";import{join as gt,dirname as hg,basename as Tg}from"path";import{homedir as Xc}from"os";import{existsSync as Eg,mkdirSync as VV}from"fs";import{fileURLToPath as kg}from"url";import{closeSync as kV,existsSync as OV,fsyncSync as PV,lstatSync as wV,mkdirSync as RV,openSync as vV,readFileSync as Ig,readlinkSync as CV,realpathSync as MV,renameSync as SV,statSync as jV,unlinkSync as qV,writeSync as AV}from"fs";var bV=Promise.resolve();var NV=process.platform==="win32";function yg(e){return e.replace(/^\uFEFF/,"")}function gg(e){return JSON.parse(yg(e))}function Fa(e){return gg(Ig(e,"utf-8"))}var $g=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function bg(e){let t=e.env;return $g(t)&&Object.keys(t).some(Xn)?"nested":"flat"}function Wc(e){return bg(e)==="nested"?e.env:e}function Og(){return typeof __dirname<"u"?__dirname:hg(kg(import.meta.url))}var e3=Og();function Pg(e){let t=process.env.MEMINDEX_TEST_FORBIDDEN_DATA_DIR;if(t&&e===t)throw new Error(`A test resolved the real data folder ${e}. Point MEMINDEX_DATA_DIR at a temporary directory (and pass env: process.env to any child process the test starts).`);return e}function nn(){return Pg(wg())}function wg(){if(process.env.MEMINDEX_DATA_DIR)return pr(process.env.MEMINDEX_DATA_DIR);let e=gt(Xc(),".memindex"),t=gt(e,"settings.json");try{if(Eg(t)){let r=Fa(t);if(r===null||typeof r!="object"||Array.isArray(r))return e;let n=Jc(Wc(r));if(typeof n.MEMINDEX_DATA_DIR=="string"&&n.MEMINDEX_DATA_DIR)return pr(n.MEMINDEX_DATA_DIR)}}catch{}return e}var Zn=nn(),Rg=gt(Xc(),".claude"),vg=process.env.CLAUDE_CONFIG_DIR||Rg,t3=gt(vg,"plugins","marketplaces","memindex"),r3=gt(Zn,"logs"),n3=gt(Zn,"settings.json"),Cg="memindex.db";var a3=gt(Zn,Cg),Mg=gt(Zn,"observer-sessions"),o3=Tg(Mg);var Ug="X-Memindex-Secret",rd="worker-secret",Kg=/^[a-f0-9]{64}$/;function Qc(e=nn()){let t=ed(Da(e,rd),Yc.O_RDONLY|(Yc.O_NOFOLLOW??0));try{let r=qg(t);if(!r.isFile()||process.getuid&&r.uid!==process.getuid()||process.platform!=="win32"&&(r.mode&63)!==0)throw new Error("Worker secret must be an owner-only file");let n=Sg(t,"utf8");if(!Kg.test(n))throw new Error("Invalid worker secret");return n}finally{td(t)}}function Gg(e=nn()){Dg(e,{recursive:!0,mode:448});let t=Da(e,rd);try{return Qc(e)}catch(a){if(a.code!=="ENOENT")throw a}let r=Da(e,`.worker-secret-${Zc(16).toString("hex")}`),n=ed(r,"wx",384);try{Ag(n,384),jg(n,Zc(32).toString("hex")),Lg(n)}finally{td(n)}try{try{Ng(r,t)}catch(a){if(a.code!=="EEXIST")throw a}}finally{Fg(r)}return Qc(e)}function nd(e,t=nn()){if(!["POST","PUT","PATCH","DELETE"].includes((e.method??"GET").toUpperCase()))return e;let r=new Headers(e.headers);return r.set(Ug,Gg(t)),{...e,headers:r,redirect:"error"}}var Ua=5e3;function od(){let e=pr(process.env.MEMINDEX_DATA_DIR||process.env.AGENT_MEM_DATA_DIR||cr(sd(),".memindex")),t={};try{let c=JSON.parse(_g(cr(e,"settings.json"),"utf8").replace(/^\uFEFF/,"")),l=c?.env;t=l&&typeof l=="object"&&!Array.isArray(l)&&Object.keys(l).some(Xn)?l:c??{}}catch{}let r=c=>typeof t[c]=="string"&&t[c]?String(t[c]):"",n=(c,l)=>process.env[c]||Na(c).map(v=>process.env[v]).find(Boolean)||r(c)||Na(c).map(r).find(Boolean)||l,a=n("MEMINDEX_WORKER_HOST","127.0.0.1"),i=a==="localhost"?"127.0.0.1":a,m=n("MEMINDEX_WORKER_PORT",String(38700+(process.getuid?.()??77)%100));return"http://"+(i.includes(":")&&!i.startsWith("[")?"["+i+"]":i)+":"+m}var an;function Bg(){if(an)return an;let e=cr(process.env.CLAUDE_CONFIG_DIR||cr(sd(),".claude"),"plugins","marketplaces","memindex"),t=cr(e,"plugin","scripts","bun-runner.js"),r=cr(e,"plugin","scripts","worker-service.cjs");return!ad(t)||!ad(r)?Promise.reject(new Error("Run npx memindex install to install the worker.")):(an=new Promise((a,i)=>{let m=zg(process.execPath,[t,r,"start"],{stdio:"ignore",windowsHide:!0,timeout:15e3});m.once("error",i),m.once("close",c=>c===0?a():i(new Error("memindex worker could not start")))}).finally(()=>{an=void 0}),an)}function id(){let e=od();return{reset(){e=od()},async ready(){try{let t=await fetch(e+"/api/health",{signal:AbortSignal.timeout(Ua)});if(t.ok)return;throw new Error("memindex health check returned "+t.status)}catch(t){if(!Vc(t))throw t;await Bg()}},async request(t,r={}){let n=await fetch(e+t,nd({...r,signal:r.signal?AbortSignal.any([r.signal,AbortSignal.timeout(Ua)]):AbortSignal.timeout(Ua)}));if(!n.ok)throw new Error("memindex "+t+" returned "+n.status);return n},async post(t,r){return this.request(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r)})}}}function on(e){return typeof e=="string"?e:Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&t.type==="text"&&typeof t.text=="string").map(t=>t.text).join(`
9
+ `):""}function Hg(e){let t=id(),r,n=!1,a=(b,C)=>{!n&&b.hasUI&&b.ui&&(b.ui.notify("MemIndex is unavailable. Run npx memindex doctor. "+String(C),"warning"),n=!0)},i=(b,C,x)=>(b.queue=b.queue.then(x).catch(J=>a(C,J)),b.queue),m=async(b,C)=>{let x=C.sessionManager.getSessionId();if(!x||!C.cwd){r=void 0;return}let J={id:x,cwd:C.cwd,memory:"",anchored:!1,excluded:!1,queue:Promise.resolve(),lastAssistant:"",needsSummary:!1,initialized:!1};r=J,n=!1,t.reset();try{await t.ready();let Re=new URLSearchParams({cwd:J.cwd,platform_source:"pi"});J.memory=(await(await t.request("/api/context/inject?"+Re)).text()).trim()}catch(Re){a(C,Re)}};e.on("session_start",m),e.on("session_switch",m),e.on("session_fork",m);let c=(b,C)=>{let x=r;if(x)return i(x,C,async()=>{x.entryId=void 0,x.initialized=!1,x.anchored=!1,x.excluded=!0,x.needsSummary=!1,x.lastAssistant=""})};e.on("before_agent_start",c),e.on("session_tree",c),e.on("context_with_system",async(b,C)=>{let x=r,J=b.messages;if(!x)return;if(!Array.isArray(J)||J[0]?.role!=="system"||typeof J[0].content!="string"){await c(b,C);return}let Re=J[0].content,Xe=[...J].reverse().find(te=>te.role==="user"),$t=on(Xe?.content),bt=()=>{if(r!==x||C.sessionManager.getSessionId()!==x.id||C.cwd!==x.cwd||typeof C.sessionManager.getBranch!="function")return;let te=C.sessionManager.getBranch();if(!Array.isArray(te))return;let ke=[...te].reverse().find(dr=>dr.type==="message"&&dr.message?.role==="user");if(!(!ke||typeof ke.id!="string"||!/^[^\s\x00-\x1f\x7f]{1,256}$/.test(ke.id)||!Xe||typeof Xe.timestamp!="number"||!Number.isFinite(Xe.timestamp)||ke.message?.timestamp!==Xe.timestamp||on(ke.message.content)!==$t))return ke};if(await i(x,C,async()=>{try{let te=bt();if(!te||!$t.trim()){x.anchored=!1,x.excluded=!0,x.initialized=!1;return}if(x.entryId!==te.id&&(x.entryId=te.id,x.initialized=!1,x.anchored=!1,x.excluded=!0,x.needsSummary=!1,x.lastAssistant=""),x.initialized)return;if((await(await t.request("/api/sessions/native-prompt-capability")).json()).nativePromptId!==1)throw new Error("Upgrade the worker for native Pi prompt capture.");if(bt()?.id!==te.id)return;let ht=await(await t.post("/api/sessions/init",{contentSessionId:x.id,cwd:x.cwd,prompt:$t,platformSource:"pi",nativePromptId:te.id})).json();if(bt()?.id!==te.id)return;if(ht.skipped===!0&&ht.reason!=="duplicate"){x.initialized=!0,x.excluded=!0;return}if(ht.nativePromptId!==te.id||typeof ht.sessionDbId!="number")throw new Error("The worker did not acknowledge the persisted Pi user-entry ID.");x.initialized=!0,x.anchored=ht.nativePromptCurrent===!0,x.excluded=!x.anchored,x.needsSummary=x.anchored}catch(te){throw x.anchored=!1,x.excluded=!0,x.initialized=!1,te}}),r!==x||!x.anchored||x.excluded||!x.memory)return;let[St,...jt]=J;return{messages:[{...St,content:Re+`
10
+
11
+ <memindex-context>
12
+ `+x.memory+`
13
+ </memindex-context>`},...jt]}}),e.on("tool_result",(b,C)=>{let x=r;if(!x||!b.toolName||b.toolName.startsWith("mem_"))return;let J=on(b.content);return i(x,C,async()=>{!x.anchored||x.excluded||await t.post("/api/sessions/observations",{contentSessionId:x.id,cwd:x.cwd,platformSource:"pi",tool_name:b.toolName,tool_input:b.input,tool_response:J.slice(0,1e5),tool_use_id:b.toolCallId})})}),e.on("message_end",b=>{r&&b.message?.role==="assistant"&&(r.lastAssistant=on(b.message.content))});let l=(b,C)=>{let x=r;if(x)return i(x,C,async()=>{!x.anchored||x.excluded||!x.needsSummary||(await t.post("/api/sessions/summarize",{contentSessionId:x.id,cwd:x.cwd,platformSource:"pi",last_assistant_message:x.lastAssistant}),x.needsSummary=!1)})};e.on("agent_end",l),e.on("session_before_compact",l),e.on("session_shutdown",(b,C)=>l(b,C));let v=(b,C,x,J,Re)=>{e.registerTool({name:b,label:C,description:x,parameters:J,async execute(Xe,$t,bt){try{let jt=await(await Re($t,bt)).text(),te=jt;try{let ke=JSON.parse(jt);Array.isArray(ke.content)&&(te=on(ke.content))}catch{}return{content:[{type:"text",text:te}],details:{}}}catch(St){return{content:[{type:"text",text:"Memory request failed: "+String(St)}],details:{}}}}})},j=H.Optional(H.Integer({minimum:1,maximum:50}));v("mem_search","Memory search","Search memory for an index of IDs; use timeline, then fetch only useful observations.",H.Object({query:H.String(),limit:j}),(b,C)=>{let x=new URLSearchParams({query:String(b.query),limit:String(b.limit??10)});return t.request("/api/search?"+x,{signal:C})}),v("mem_timeline","Memory timeline","Inspect the neighborhood of an observation ID or search query. Supply anchor or query.",H.Object({anchor:H.Optional(H.Union([H.Integer(),H.String()])),query:H.Optional(H.String()),depth_before:H.Optional(H.Integer({minimum:0,maximum:50})),depth_after:H.Optional(H.Integer({minimum:0,maximum:50})),project:H.Optional(H.String())}),(b,C)=>{if(b.anchor===void 0==(b.query===void 0))throw new Error("Supply exactly one of anchor or query.");let x=new URLSearchParams(Object.entries(b).filter(([,J])=>J!==void 0).map(([J,Re])=>[J,String(Re)]));return t.request("/api/timeline?"+x,{signal:C})}),v("mem_get_observations","Memory observations","Fetch full records for IDs found by mem_search.",H.Object({ids:H.Array(H.Integer({minimum:1}),{minItems:1,maxItems:100})}),(b,C)=>t.request("/api/observations/batch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b),signal:C}))}export{Hg as default,on as extractTextContent};