@herbertgao/pi-extensions 2026.10.1 → 2026.10.2

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 (707) hide show
  1. package/README.md +13 -9
  2. package/THIRD_PARTY_NOTICES.md +2 -2
  3. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-audit.md +2 -2
  4. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-debt.md +2 -2
  5. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-gain.md +1 -1
  6. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-help.md +1 -1
  7. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-review.md +2 -2
  8. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail.md +1 -1
  9. package/node_modules/@dietrichgebert/ponytail/.qoder/rules/ponytail.md +21 -21
  10. package/node_modules/@dietrichgebert/ponytail/.qoder-plugin/plugin.json +1 -1
  11. package/node_modules/@dietrichgebert/ponytail/AGENTS.md +21 -21
  12. package/node_modules/@dietrichgebert/ponytail/README.md +68 -72
  13. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-activate.js +7 -0
  14. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-instructions.js +30 -30
  15. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-map.js +103 -0
  16. package/node_modules/@dietrichgebert/ponytail/package.json +2 -2
  17. package/node_modules/@dietrichgebert/ponytail/skills/ponytail/SKILL.md +33 -101
  18. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-audit/SKILL.md +89 -32
  19. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-debt/SKILL.md +13 -12
  20. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-gain/SKILL.md +17 -16
  21. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-help/SKILL.md +9 -10
  22. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-review/SKILL.md +96 -57
  23. package/node_modules/@herbertgao/pi-agency/LICENSE +21 -0
  24. package/node_modules/@herbertgao/pi-agency/README.md +40 -0
  25. package/node_modules/@herbertgao/pi-agency/package.json +53 -0
  26. package/node_modules/@herbertgao/pi-agency/src/index.ts +441 -0
  27. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +12 -12
  28. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +30 -6
  29. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +15 -9
  30. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +27 -9
  31. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +4 -1
  32. package/node_modules/@herbertgao/pi-cc-extensions/package.json +2 -2
  33. package/node_modules/@narumitw/pi-caffeinate/package.json +3 -3
  34. package/node_modules/@tifan/pi-mermaid-open/package.json +5 -1
  35. package/node_modules/@tifan/pi-mermaid-open/src/index.ts +26 -9
  36. package/node_modules/@tifan/pi-recap/package.json +1 -1
  37. package/node_modules/@tifan/pi-recap/src/index.ts +104 -20
  38. package/node_modules/@tifan/pi-recap/src/models.ts +46 -4
  39. package/node_modules/pi-antigravity/README.md +23 -2
  40. package/node_modules/pi-antigravity/package.json +5 -3
  41. package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +3 -2
  42. package/node_modules/pi-antigravity/src/features/generate-image.ts +72 -0
  43. package/node_modules/pi-antigravity/src/features/google-search.ts +71 -0
  44. package/node_modules/pi-antigravity/src/image/image.ts +86 -47
  45. package/node_modules/pi-antigravity/src/image/native.ts +69 -0
  46. package/node_modules/pi-antigravity/src/index.ts +52 -137
  47. package/node_modules/pi-antigravity/src/search/search.ts +130 -31
  48. package/node_modules/pi-antigravity/src/stream/stream.ts +162 -113
  49. package/node_modules/pi-antigravity/src/types/enums.ts +1 -0
  50. package/node_modules/pi-antigravity/src/types/types.ts +1 -1
  51. package/node_modules/pi-antigravity/src/utils/security.ts +47 -1
  52. package/node_modules/pi-antigravity/src/utils/util.ts +38 -6
  53. package/node_modules/pi-lens/CHANGELOG.md +1064 -0
  54. package/node_modules/pi-lens/README.md +115 -25
  55. package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +6 -2
  56. package/node_modules/pi-lens/dist/chunk-22AVIGXS.js +560 -0
  57. package/node_modules/pi-lens/dist/chunk-27BBHSZC.js +106 -0
  58. package/node_modules/pi-lens/dist/chunk-2BEMIWEW.js +51 -0
  59. package/node_modules/pi-lens/dist/chunk-2EECBNC5.js +89 -0
  60. package/node_modules/pi-lens/dist/chunk-34U7PLGE.js +23 -0
  61. package/node_modules/pi-lens/dist/chunk-3I5QFT3N.js +181 -0
  62. package/node_modules/pi-lens/dist/chunk-3MED75HT.js +37 -0
  63. package/node_modules/pi-lens/dist/chunk-47D2BO4S.js +87 -0
  64. package/node_modules/pi-lens/dist/chunk-4RERDEXR.js +348 -0
  65. package/node_modules/pi-lens/dist/chunk-4W2PLC4J.js +27 -0
  66. package/node_modules/pi-lens/dist/chunk-52H5B5TC.js +202 -0
  67. package/node_modules/pi-lens/dist/chunk-54B42YRX.js +27 -0
  68. package/node_modules/pi-lens/dist/chunk-5RXBNSW2.js +266 -0
  69. package/node_modules/pi-lens/dist/chunk-5THXD6X5.js +201 -0
  70. package/node_modules/pi-lens/dist/chunk-5W3R6LFT.js +24 -0
  71. package/node_modules/pi-lens/dist/chunk-5ZEJHV35.js +341 -0
  72. package/node_modules/pi-lens/dist/chunk-6P62QVEA.js +118 -0
  73. package/node_modules/pi-lens/dist/chunk-6QIUX4EP.js +459 -0
  74. package/node_modules/pi-lens/dist/chunk-6VCD4VKZ.js +78 -0
  75. package/node_modules/pi-lens/dist/chunk-7F72PXY2.js +326 -0
  76. package/node_modules/pi-lens/dist/chunk-7FBF7NPR.js +998 -0
  77. package/node_modules/pi-lens/dist/chunk-7U2IDNXN.js +37 -0
  78. package/node_modules/pi-lens/dist/chunk-ABBOA7UD.js +157 -0
  79. package/node_modules/pi-lens/dist/chunk-AHDW3GPE.js +50 -0
  80. package/node_modules/pi-lens/dist/chunk-AJ3QXTRQ.js +756 -0
  81. package/node_modules/pi-lens/dist/chunk-AJVLWNFN.js +1610 -0
  82. package/node_modules/pi-lens/dist/chunk-AJXODZY6.js +112 -0
  83. package/node_modules/pi-lens/dist/chunk-ARFCXG7S.js +84 -0
  84. package/node_modules/pi-lens/dist/chunk-AS44CFQ4.js +708 -0
  85. package/node_modules/pi-lens/dist/chunk-AWE5TMPO.js +38 -0
  86. package/node_modules/pi-lens/dist/chunk-B3I2UUT4.js +4692 -0
  87. package/node_modules/pi-lens/dist/chunk-BRJKOBZP.js +331 -0
  88. package/node_modules/pi-lens/dist/chunk-BW5KFIQC.js +59 -0
  89. package/node_modules/pi-lens/dist/chunk-C2AUYXQH.js +149 -0
  90. package/node_modules/pi-lens/dist/chunk-CGGAIP7J.js +29 -0
  91. package/node_modules/pi-lens/dist/chunk-D6QS3U6M.js +30 -0
  92. package/node_modules/pi-lens/dist/chunk-DFVMIKMQ.js +349 -0
  93. package/node_modules/pi-lens/dist/chunk-DIULIWKU.js +169 -0
  94. package/node_modules/pi-lens/dist/chunk-DQ2NZ7C4.js +2317 -0
  95. package/node_modules/pi-lens/dist/chunk-E2WFBRHM.js +213 -0
  96. package/node_modules/pi-lens/dist/chunk-E4MAEDPM.js +50 -0
  97. package/node_modules/pi-lens/dist/chunk-EOKRQ3SA.js +30 -0
  98. package/node_modules/pi-lens/dist/chunk-F3AU2TMM.js +2626 -0
  99. package/node_modules/pi-lens/dist/chunk-F3P7VQ7H.js +170 -0
  100. package/node_modules/pi-lens/dist/chunk-FC4RP4I2.js +12 -0
  101. package/node_modules/pi-lens/dist/chunk-FJNKANOS.js +32 -0
  102. package/node_modules/pi-lens/dist/chunk-GUOGVTCQ.js +146 -0
  103. package/node_modules/pi-lens/dist/chunk-GVXA6CCE.js +18 -0
  104. package/node_modules/pi-lens/dist/chunk-HHYAELLJ.js +2334 -0
  105. package/node_modules/pi-lens/dist/chunk-HMFXILPV.js +83 -0
  106. package/node_modules/pi-lens/dist/chunk-HVUZXSWK.js +421 -0
  107. package/node_modules/pi-lens/dist/chunk-HWBZIGMJ.js +62 -0
  108. package/node_modules/pi-lens/dist/chunk-I3R7GKDR.js +17 -0
  109. package/node_modules/pi-lens/dist/chunk-I7SPGOWI.js +55 -0
  110. package/node_modules/pi-lens/dist/chunk-IIXOAGHR.js +38 -0
  111. package/node_modules/pi-lens/dist/chunk-IVP5KAB7.js +2250 -0
  112. package/node_modules/pi-lens/dist/chunk-IXEBJSUE.js +22 -0
  113. package/node_modules/pi-lens/dist/chunk-JOLITGCC.js +27 -0
  114. package/node_modules/pi-lens/dist/chunk-K6VYLB2U.js +145 -0
  115. package/node_modules/pi-lens/dist/chunk-LJDODBBZ.js +78 -0
  116. package/node_modules/pi-lens/dist/chunk-LNAKEO63.js +78 -0
  117. package/node_modules/pi-lens/dist/chunk-LSMJ6KBE.js +4139 -0
  118. package/node_modules/pi-lens/dist/chunk-LW6XKDZQ.js +5565 -0
  119. package/node_modules/pi-lens/dist/chunk-N3YQJI6O.js +899 -0
  120. package/node_modules/pi-lens/dist/chunk-NABLC7W3.js +148 -0
  121. package/node_modules/pi-lens/dist/chunk-NKOUFPQF.js +659 -0
  122. package/node_modules/pi-lens/dist/chunk-NL5GLMFI.js +211 -0
  123. package/node_modules/pi-lens/dist/chunk-NMABWBZN.js +327 -0
  124. package/node_modules/pi-lens/dist/chunk-NTHH2J74.js +27 -0
  125. package/node_modules/pi-lens/dist/chunk-NTUJEGDZ.js +59 -0
  126. package/node_modules/pi-lens/dist/chunk-NXL4FFQQ.js +47 -0
  127. package/node_modules/pi-lens/dist/chunk-NXPS2L6U.js +466 -0
  128. package/node_modules/pi-lens/dist/chunk-O5WILGMI.js +42 -0
  129. package/node_modules/pi-lens/dist/chunk-O6TQT6RI.js +48 -0
  130. package/node_modules/pi-lens/dist/chunk-OAXNDZJ7.js +323 -0
  131. package/node_modules/pi-lens/dist/chunk-ODEEOXPH.js +44 -0
  132. package/node_modules/pi-lens/dist/chunk-OQGFCZJ4.js +4533 -0
  133. package/node_modules/pi-lens/dist/chunk-ORTMY4Q4.js +282 -0
  134. package/node_modules/pi-lens/dist/chunk-OS32RNR2.js +442 -0
  135. package/node_modules/pi-lens/dist/chunk-PAK6IDME.js +189 -0
  136. package/node_modules/pi-lens/dist/chunk-PWFHBTSF.js +406 -0
  137. package/node_modules/pi-lens/dist/chunk-Q5U6FMDI.js +2352 -0
  138. package/node_modules/pi-lens/dist/chunk-QOZXJ4NA.js +3364 -0
  139. package/node_modules/pi-lens/dist/chunk-QYF5S6P6.js +45 -0
  140. package/node_modules/pi-lens/dist/chunk-RIISMHKN.js +36 -0
  141. package/node_modules/pi-lens/dist/chunk-RPD4ZSB7.js +25 -0
  142. package/node_modules/pi-lens/dist/chunk-RPD5K5NC.js +79 -0
  143. package/node_modules/pi-lens/dist/chunk-RUOG5D2C.js +262 -0
  144. package/node_modules/pi-lens/dist/chunk-T4ERT73Y.js +599 -0
  145. package/node_modules/pi-lens/dist/chunk-T6D4Q4AQ.js +54 -0
  146. package/node_modules/pi-lens/dist/chunk-TGPXLY2J.js +391 -0
  147. package/node_modules/pi-lens/dist/chunk-TLGFBM3F.js +12116 -0
  148. package/node_modules/pi-lens/dist/chunk-TO6WL3GM.js +88 -0
  149. package/node_modules/pi-lens/dist/chunk-TT22N74J.js +517 -0
  150. package/node_modules/pi-lens/dist/chunk-TVN5N6GY.js +21216 -0
  151. package/node_modules/pi-lens/dist/chunk-U3VGR4VU.js +308 -0
  152. package/node_modules/pi-lens/dist/chunk-UK3CMEAL.js +1250 -0
  153. package/node_modules/pi-lens/dist/chunk-UOPVJQ4N.js +103 -0
  154. package/node_modules/pi-lens/dist/chunk-UXVNL3D7.js +23 -0
  155. package/node_modules/pi-lens/dist/chunk-UY752QSN.js +45 -0
  156. package/node_modules/pi-lens/dist/chunk-V5PXFSZK.js +188 -0
  157. package/node_modules/pi-lens/dist/chunk-V7R425XG.js +398 -0
  158. package/node_modules/pi-lens/dist/chunk-VCSRSYLF.js +81 -0
  159. package/node_modules/pi-lens/dist/chunk-VD4JQCQC.js +162 -0
  160. package/node_modules/pi-lens/dist/chunk-VDBPVIKD.js +62 -0
  161. package/node_modules/pi-lens/dist/chunk-VHQLPIRJ.js +114 -0
  162. package/node_modules/pi-lens/dist/chunk-VN2AXLEX.js +5414 -0
  163. package/node_modules/pi-lens/dist/chunk-VNMT7C64.js +478 -0
  164. package/node_modules/pi-lens/dist/chunk-WONERJTP.js +309 -0
  165. package/node_modules/pi-lens/dist/chunk-XECLWQZN.js +85 -0
  166. package/node_modules/pi-lens/dist/chunk-XIMYZ3JA.js +27 -0
  167. package/node_modules/pi-lens/dist/chunk-XK4CIILI.js +144 -0
  168. package/node_modules/pi-lens/dist/chunk-Y4T27COV.js +562 -0
  169. package/node_modules/pi-lens/dist/chunk-YGVYKNSN.js +1860 -0
  170. package/node_modules/pi-lens/dist/chunk-YLF3PPT5.js +308 -0
  171. package/node_modules/pi-lens/dist/chunk-YSNFMJKN.js +14 -0
  172. package/node_modules/pi-lens/dist/chunk-Z3CCVDUB.js +76 -0
  173. package/node_modules/pi-lens/dist/chunk-Z54ZSOBZ.js +61 -0
  174. package/node_modules/pi-lens/dist/chunk-ZAWW3AF6.js +97 -0
  175. package/node_modules/pi-lens/dist/chunk-ZMOL6RQC.js +167 -0
  176. package/node_modules/pi-lens/dist/index.js +16456 -8335
  177. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +186 -232
  178. package/node_modules/pi-lens/dist/mcp/cli.js +137 -98
  179. package/node_modules/pi-lens/dist/mcp/server.js +22589 -1573
  180. package/node_modules/pi-lens/dist/mcp/worker.js +97 -38
  181. package/node_modules/pi-lens/dist/probes/installer.js +135 -0
  182. package/node_modules/pi-lens/dist/workers/project-snapshot-persist-worker.js +22 -0
  183. package/node_modules/pi-lens/dist/workers/review-graph-persist-worker.js +15 -0
  184. package/node_modules/pi-lens/docs/agent-guide.md +13 -4
  185. package/node_modules/pi-lens/docs/agent-tools.md +42 -0
  186. package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +3 -2
  187. package/node_modules/pi-lens/docs/configuration.md +20 -1
  188. package/node_modules/pi-lens/docs/environment-variables.md +52 -2
  189. package/node_modules/pi-lens/docs/features.md +8 -4
  190. package/node_modules/pi-lens/docs/globalconfig.md +1 -0
  191. package/node_modules/pi-lens/docs/io-bridge-v2-migration.md +94 -0
  192. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +36 -4
  193. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +124 -0
  194. package/node_modules/pi-lens/docs/mcp.md +21 -5
  195. package/node_modules/pi-lens/docs/merge-queue-rollout.md +77 -0
  196. package/node_modules/pi-lens/docs/pi-lens-fixer.md +156 -88
  197. package/node_modules/pi-lens/docs/pi-lens-investigator.md +74 -26
  198. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +694 -0
  199. package/node_modules/pi-lens/docs/pi-lens-monitor.md +73 -7
  200. package/node_modules/pi-lens/docs/pi-lens-retro.md +6 -4
  201. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +188 -48
  202. package/node_modules/pi-lens/docs/pi-lens-subagent.md +246 -45
  203. package/node_modules/pi-lens/docs/pi-lens-warden.md +18 -7
  204. package/node_modules/pi-lens/docs/public-api-stability.md +55 -0
  205. package/node_modules/pi-lens/docs/release-qa-baseline.md +84 -17
  206. package/node_modules/pi-lens/docs/rfcs/3654-unified-io-bridge-v2.md +316 -0
  207. package/node_modules/pi-lens/docs/servercapabilities.md +53 -49
  208. package/node_modules/pi-lens/docs/settings.md +1 -0
  209. package/node_modules/pi-lens/docs/usage.md +5 -1
  210. package/node_modules/pi-lens/grammars/tree-sitter-bash.wasm +0 -0
  211. package/node_modules/pi-lens/grammars/tree-sitter-bash.wasm.json +3 -3
  212. package/node_modules/pi-lens/package.json +18 -6
  213. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/advisory-registry-subset-test.yml +41 -0
  214. package/node_modules/pi-lens/rules/ast-grep-rules/rules/advisory-registry-subset.yml +50 -0
  215. package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +1275 -62
  216. package/node_modules/pi-lens/scripts/download-grammars.js +5 -0
  217. package/node_modules/pi-lens/scripts/grammars.lock.json +6 -1
  218. package/node_modules/pi-lens/scripts/install-selftest.mjs +33 -34
  219. package/node_modules/pi-lens/scripts/lib/host-provided-deps.mjs +13 -4
  220. package/node_modules/pi-lens/scripts/lib/web-tree-sitter-dir.mjs +18 -0
  221. package/package.json +15 -10
  222. package/node_modules/@dietrichgebert/ponytail/README.es.md +0 -212
  223. package/node_modules/@dietrichgebert/ponytail/README.ja.md +0 -212
  224. package/node_modules/@dietrichgebert/ponytail/README.ko.md +0 -212
  225. package/node_modules/@dietrichgebert/ponytail/README.zh-CN.md +0 -212
  226. package/node_modules/pi-lens/dist/clients/actionable-warnings-logger.js +0 -35
  227. package/node_modules/pi-lens/dist/clients/actionable-warnings.js +0 -1610
  228. package/node_modules/pi-lens/dist/clients/advisory-provenance.js +0 -593
  229. package/node_modules/pi-lens/dist/clients/agent-behavior-client.js +0 -147
  230. package/node_modules/pi-lens/dist/clients/agent-nudge.js +0 -325
  231. package/node_modules/pi-lens/dist/clients/analysed-root.js +0 -1
  232. package/node_modules/pi-lens/dist/clients/ast-grep-client.js +0 -731
  233. package/node_modules/pi-lens/dist/clients/ast-grep-rule-manager.js +0 -146
  234. package/node_modules/pi-lens/dist/clients/ast-grep-tool-logger.js +0 -118
  235. package/node_modules/pi-lens/dist/clients/ast-grep-types.js +0 -10
  236. package/node_modules/pi-lens/dist/clients/ast-grep-yaml-synth.js +0 -154
  237. package/node_modules/pi-lens/dist/clients/atomic-write-staging.js +0 -75
  238. package/node_modules/pi-lens/dist/clients/atomic-write.js +0 -189
  239. package/node_modules/pi-lens/dist/clients/availability-probe-flight.js +0 -12
  240. package/node_modules/pi-lens/dist/clients/bash-file-access.js +0 -1056
  241. package/node_modules/pi-lens/dist/clients/biome-client.js +0 -357
  242. package/node_modules/pi-lens/dist/clients/blocker-freshness.js +0 -837
  243. package/node_modules/pi-lens/dist/clients/blocker-past-eof.js +0 -129
  244. package/node_modules/pi-lens/dist/clients/bootstrap.js +0 -569
  245. package/node_modules/pi-lens/dist/clients/bounded-cache.js +0 -190
  246. package/node_modules/pi-lens/dist/clients/bounded-pid-file-lock.js +0 -202
  247. package/node_modules/pi-lens/dist/clients/bounded-telemetry.js +0 -295
  248. package/node_modules/pi-lens/dist/clients/build-identity.js +0 -95
  249. package/node_modules/pi-lens/dist/clients/bundled-resource-health.js +0 -113
  250. package/node_modules/pi-lens/dist/clients/bus-events-logger.js +0 -105
  251. package/node_modules/pi-lens/dist/clients/bus-publish.js +0 -171
  252. package/node_modules/pi-lens/dist/clients/cache/rule-cache.js +0 -190
  253. package/node_modules/pi-lens/dist/clients/cache-manager.js +0 -524
  254. package/node_modules/pi-lens/dist/clients/cache-observability.js +0 -1313
  255. package/node_modules/pi-lens/dist/clients/call-graph.js +0 -852
  256. package/node_modules/pi-lens/dist/clients/cargo-manifest.js +0 -422
  257. package/node_modules/pi-lens/dist/clients/cascade-budget.js +0 -196
  258. package/node_modules/pi-lens/dist/clients/cascade-format.js +0 -315
  259. package/node_modules/pi-lens/dist/clients/cascade-logger.js +0 -31
  260. package/node_modules/pi-lens/dist/clients/cascade-types.js +0 -9
  261. package/node_modules/pi-lens/dist/clients/child-unref.js +0 -124
  262. package/node_modules/pi-lens/dist/clients/code-quality-warnings.js +0 -286
  263. package/node_modules/pi-lens/dist/clients/codebase-model.js +0 -173
  264. package/node_modules/pi-lens/dist/clients/collateral-test-role.js +0 -40
  265. package/node_modules/pi-lens/dist/clients/complexity-client.js +0 -462
  266. package/node_modules/pi-lens/dist/clients/config-core/deny.js +0 -221
  267. package/node_modules/pi-lens/dist/clients/config-core/index.js +0 -50
  268. package/node_modules/pi-lens/dist/clients/config-core/merge.js +0 -357
  269. package/node_modules/pi-lens/dist/clients/config-core/normalize.js +0 -340
  270. package/node_modules/pi-lens/dist/clients/config-core/process-spec.js +0 -248
  271. package/node_modules/pi-lens/dist/clients/config-core/provenance.js +0 -164
  272. package/node_modules/pi-lens/dist/clients/config-core/records.js +0 -218
  273. package/node_modules/pi-lens/dist/clients/config-core/resolve.js +0 -125
  274. package/node_modules/pi-lens/dist/clients/config-core/safe-object.js +0 -78
  275. package/node_modules/pi-lens/dist/clients/config-core/schema.js +0 -165
  276. package/node_modules/pi-lens/dist/clients/config-diagnostic-codes.js +0 -285
  277. package/node_modules/pi-lens/dist/clients/config-locations.js +0 -388
  278. package/node_modules/pi-lens/dist/clients/config-resolve.js +0 -798
  279. package/node_modules/pi-lens/dist/clients/config-schema.js +0 -251
  280. package/node_modules/pi-lens/dist/clients/config-warn.js +0 -407
  281. package/node_modules/pi-lens/dist/clients/console-guard-install.js +0 -26
  282. package/node_modules/pi-lens/dist/clients/cooperative-budget.js +0 -42
  283. package/node_modules/pi-lens/dist/clients/dead-code-client.js +0 -510
  284. package/node_modules/pi-lens/dist/clients/dead-code-logger.js +0 -30
  285. package/node_modules/pi-lens/dist/clients/deadline-utils.js +0 -280
  286. package/node_modules/pi-lens/dist/clients/debug-handles.js +0 -211
  287. package/node_modules/pi-lens/dist/clients/debug-heap.js +0 -174
  288. package/node_modules/pi-lens/dist/clients/deferred-lsp-work.js +0 -106
  289. package/node_modules/pi-lens/dist/clients/degradation-ledger.js +0 -426
  290. package/node_modules/pi-lens/dist/clients/demoted-finding-render.js +0 -169
  291. package/node_modules/pi-lens/dist/clients/dependency-checker.js +0 -885
  292. package/node_modules/pi-lens/dist/clients/deps/ast-grep-napi.js +0 -22
  293. package/node_modules/pi-lens/dist/clients/deps/js-yaml.js +0 -9
  294. package/node_modules/pi-lens/dist/clients/deps/minimatch.js +0 -4
  295. package/node_modules/pi-lens/dist/clients/deps/pi-tui.js +0 -14
  296. package/node_modules/pi-lens/dist/clients/deps/typebox.js +0 -14
  297. package/node_modules/pi-lens/dist/clients/deps/vscode-jsonrpc.js +0 -1
  298. package/node_modules/pi-lens/dist/clients/deps/web-tree-sitter.js +0 -24
  299. package/node_modules/pi-lens/dist/clients/diagnostic-dispositions.js +0 -630
  300. package/node_modules/pi-lens/dist/clients/diagnostic-line-freshness.js +0 -305
  301. package/node_modules/pi-lens/dist/clients/diagnostic-logger.js +0 -73
  302. package/node_modules/pi-lens/dist/clients/diagnostic-tracker.js +0 -105
  303. package/node_modules/pi-lens/dist/clients/diagnostics-publish.js +0 -230
  304. package/node_modules/pi-lens/dist/clients/dispatch/ast-grep-catalog.js +0 -65
  305. package/node_modules/pi-lens/dist/clients/dispatch/auxiliary-lsp.js +0 -343
  306. package/node_modules/pi-lens/dist/clients/dispatch/collect-later-tier.js +0 -35
  307. package/node_modules/pi-lens/dist/clients/dispatch/diagnostic-taxonomy.js +0 -66
  308. package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +0 -1269
  309. package/node_modules/pi-lens/dist/clients/dispatch/fact-provider-types.js +0 -1
  310. package/node_modules/pi-lens/dist/clients/dispatch/fact-rule-runner.js +0 -17
  311. package/node_modules/pi-lens/dist/clients/dispatch/fact-runner.js +0 -30
  312. package/node_modules/pi-lens/dist/clients/dispatch/fact-scheduler.js +0 -68
  313. package/node_modules/pi-lens/dist/clients/dispatch/fact-store.js +0 -377
  314. package/node_modules/pi-lens/dist/clients/dispatch/facts/comment-facts.js +0 -22
  315. package/node_modules/pi-lens/dist/clients/dispatch/facts/file-content.js +0 -19
  316. package/node_modules/pi-lens/dist/clients/dispatch/facts/function-facts.js +0 -348
  317. package/node_modules/pi-lens/dist/clients/dispatch/facts/import-facts.js +0 -204
  318. package/node_modules/pi-lens/dist/clients/dispatch/facts/tree-sitter-facts.js +0 -34
  319. package/node_modules/pi-lens/dist/clients/dispatch/facts/try-catch-facts.js +0 -119
  320. package/node_modules/pi-lens/dist/clients/dispatch/finding-policy.js +0 -339
  321. package/node_modules/pi-lens/dist/clients/dispatch/indent-detect.js +0 -417
  322. package/node_modules/pi-lens/dist/clients/dispatch/inline-suppressions.js +0 -89
  323. package/node_modules/pi-lens/dist/clients/dispatch/integration.js +0 -2377
  324. package/node_modules/pi-lens/dist/clients/dispatch/lazy.js +0 -11
  325. package/node_modules/pi-lens/dist/clients/dispatch/pending-runner-findings.js +0 -87
  326. package/node_modules/pi-lens/dist/clients/dispatch/plan.js +0 -278
  327. package/node_modules/pi-lens/dist/clients/dispatch/priorities.js +0 -20
  328. package/node_modules/pi-lens/dist/clients/dispatch/rule-id-normalize.js +0 -50
  329. package/node_modules/pi-lens/dist/clients/dispatch/rule-ignores.js +0 -69
  330. package/node_modules/pi-lens/dist/clients/dispatch/rule-policy.js +0 -135
  331. package/node_modules/pi-lens/dist/clients/dispatch/rules/async-noise.js +0 -40
  332. package/node_modules/pi-lens/dist/clients/dispatch/rules/async-unnecessary-wrapper.js +0 -27
  333. package/node_modules/pi-lens/dist/clients/dispatch/rules/cors-wildcard.js +0 -54
  334. package/node_modules/pi-lens/dist/clients/dispatch/rules/error-obscuring.js +0 -32
  335. package/node_modules/pi-lens/dist/clients/dispatch/rules/error-swallowing.js +0 -31
  336. package/node_modules/pi-lens/dist/clients/dispatch/rules/framework-call-noise.js +0 -67
  337. package/node_modules/pi-lens/dist/clients/dispatch/rules/high-complexity.js +0 -72
  338. package/node_modules/pi-lens/dist/clients/dispatch/rules/high-fan-out.js +0 -74
  339. package/node_modules/pi-lens/dist/clients/dispatch/rules/high-import-coupling.js +0 -37
  340. package/node_modules/pi-lens/dist/clients/dispatch/rules/missing-error-propagation.js +0 -62
  341. package/node_modules/pi-lens/dist/clients/dispatch/rules/no-commented-credentials.js +0 -52
  342. package/node_modules/pi-lens/dist/clients/dispatch/rules/pass-through-wrappers.js +0 -42
  343. package/node_modules/pi-lens/dist/clients/dispatch/rules/placeholder-comments.js +0 -40
  344. package/node_modules/pi-lens/dist/clients/dispatch/rules/unsafe-boundary.js +0 -126
  345. package/node_modules/pi-lens/dist/clients/dispatch/runner-context.js +0 -52
  346. package/node_modules/pi-lens/dist/clients/dispatch/runners/actionlint.js +0 -111
  347. package/node_modules/pi-lens/dist/clients/dispatch/runners/ast-grep-napi.js +0 -1196
  348. package/node_modules/pi-lens/dist/clients/dispatch/runners/biome-check.js +0 -296
  349. package/node_modules/pi-lens/dist/clients/dispatch/runners/cpp-check.js +0 -219
  350. package/node_modules/pi-lens/dist/clients/dispatch/runners/credo.js +0 -82
  351. package/node_modules/pi-lens/dist/clients/dispatch/runners/cue-vet.js +0 -416
  352. package/node_modules/pi-lens/dist/clients/dispatch/runners/dart-analyze.js +0 -183
  353. package/node_modules/pi-lens/dist/clients/dispatch/runners/detekt.js +0 -176
  354. package/node_modules/pi-lens/dist/clients/dispatch/runners/dotnet-build.js +0 -164
  355. package/node_modules/pi-lens/dist/clients/dispatch/runners/elixir-check.js +0 -195
  356. package/node_modules/pi-lens/dist/clients/dispatch/runners/eslint.js +0 -137
  357. package/node_modules/pi-lens/dist/clients/dispatch/runners/fact-rules.js +0 -29
  358. package/node_modules/pi-lens/dist/clients/dispatch/runners/fish-indent.js +0 -69
  359. package/node_modules/pi-lens/dist/clients/dispatch/runners/gleam-check.js +0 -167
  360. package/node_modules/pi-lens/dist/clients/dispatch/runners/go-vet.js +0 -104
  361. package/node_modules/pi-lens/dist/clients/dispatch/runners/golangci-lint.js +0 -135
  362. package/node_modules/pi-lens/dist/clients/dispatch/runners/hadolint.js +0 -91
  363. package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-lint.js +0 -171
  364. package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-render.js +0 -940
  365. package/node_modules/pi-lens/dist/clients/dispatch/runners/htmlhint.js +0 -117
  366. package/node_modules/pi-lens/dist/clients/dispatch/runners/index.js +0 -108
  367. package/node_modules/pi-lens/dist/clients/dispatch/runners/javac.js +0 -99
  368. package/node_modules/pi-lens/dist/clients/dispatch/runners/ktlint.js +0 -110
  369. package/node_modules/pi-lens/dist/clients/dispatch/runners/lsp.js +0 -379
  370. package/node_modules/pi-lens/dist/clients/dispatch/runners/markdownlint.js +0 -167
  371. package/node_modules/pi-lens/dist/clients/dispatch/runners/mypy.js +0 -102
  372. package/node_modules/pi-lens/dist/clients/dispatch/runners/oxlint.js +0 -414
  373. package/node_modules/pi-lens/dist/clients/dispatch/runners/php-lint.js +0 -85
  374. package/node_modules/pi-lens/dist/clients/dispatch/runners/phpstan.js +0 -120
  375. package/node_modules/pi-lens/dist/clients/dispatch/runners/prisma-validate.js +0 -62
  376. package/node_modules/pi-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +0 -445
  377. package/node_modules/pi-lens/dist/clients/dispatch/runners/pyright.js +0 -169
  378. package/node_modules/pi-lens/dist/clients/dispatch/runners/rubocop.js +0 -99
  379. package/node_modules/pi-lens/dist/clients/dispatch/runners/ruff.js +0 -88
  380. package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +0 -256
  381. package/node_modules/pi-lens/dist/clients/dispatch/runners/shellcheck.js +0 -173
  382. package/node_modules/pi-lens/dist/clients/dispatch/runners/shfmt.js +0 -102
  383. package/node_modules/pi-lens/dist/clients/dispatch/runners/spellcheck.js +0 -128
  384. package/node_modules/pi-lens/dist/clients/dispatch/runners/spotbugs.js +0 -259
  385. package/node_modules/pi-lens/dist/clients/dispatch/runners/sqlfluff.js +0 -183
  386. package/node_modules/pi-lens/dist/clients/dispatch/runners/stylelint.js +0 -166
  387. package/node_modules/pi-lens/dist/clients/dispatch/runners/swiftlint.js +0 -163
  388. package/node_modules/pi-lens/dist/clients/dispatch/runners/taplo.js +0 -174
  389. package/node_modules/pi-lens/dist/clients/dispatch/runners/terragrunt.js +0 -168
  390. package/node_modules/pi-lens/dist/clients/dispatch/runners/tflint.js +0 -125
  391. package/node_modules/pi-lens/dist/clients/dispatch/runners/tree-sitter.js +0 -643
  392. package/node_modules/pi-lens/dist/clients/dispatch/runners/trivy-config.js +0 -253
  393. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/availability-policy.js +0 -496
  394. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +0 -90
  395. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +0 -95
  396. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/lazy-installer.js +0 -274
  397. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +0 -1701
  398. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/spawn-outcome.js +0 -101
  399. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/tool-failure.js +0 -235
  400. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +0 -169
  401. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils.js +0 -15
  402. package/node_modules/pi-lens/dist/clients/dispatch/runners/vale.js +0 -128
  403. package/node_modules/pi-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +0 -242
  404. package/node_modules/pi-lens/dist/clients/dispatch/runners/yamllint.js +0 -95
  405. package/node_modules/pi-lens/dist/clients/dispatch/runners/zig-check.js +0 -79
  406. package/node_modules/pi-lens/dist/clients/dispatch/suppress-writer.js +0 -79
  407. package/node_modules/pi-lens/dist/clients/dispatch/tool-profile.js +0 -30
  408. package/node_modules/pi-lens/dist/clients/dispatch/types.js +0 -21
  409. package/node_modules/pi-lens/dist/clients/dispatch/utils/format-utils.js +0 -45
  410. package/node_modules/pi-lens/dist/clients/dispatch/utils/lsp-diagnostics.js +0 -35
  411. package/node_modules/pi-lens/dist/clients/disposition-logger.js +0 -32
  412. package/node_modules/pi-lens/dist/clients/disposition-publish.js +0 -124
  413. package/node_modules/pi-lens/dist/clients/durable-store.js +0 -97
  414. package/node_modules/pi-lens/dist/clients/effective-config.js +0 -415
  415. package/node_modules/pi-lens/dist/clients/env-utils.js +0 -83
  416. package/node_modules/pi-lens/dist/clients/error-class.js +0 -23
  417. package/node_modules/pi-lens/dist/clients/eval-timestamp.js +0 -17
  418. package/node_modules/pi-lens/dist/clients/event-loop-hold.js +0 -274
  419. package/node_modules/pi-lens/dist/clients/event-loop-monitor.js +0 -250
  420. package/node_modules/pi-lens/dist/clients/extension-log.js +0 -504
  421. package/node_modules/pi-lens/dist/clients/extension-mode.js +0 -73
  422. package/node_modules/pi-lens/dist/clients/feature-hints.js +0 -103
  423. package/node_modules/pi-lens/dist/clients/file-kinds.js +0 -412
  424. package/node_modules/pi-lens/dist/clients/file-role.js +0 -134
  425. package/node_modules/pi-lens/dist/clients/file-time.js +0 -160
  426. package/node_modules/pi-lens/dist/clients/file-utils.js +0 -1032
  427. package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +0 -494
  428. package/node_modules/pi-lens/dist/clients/finding-identity.js +0 -88
  429. package/node_modules/pi-lens/dist/clients/fix-worklog.js +0 -103
  430. package/node_modules/pi-lens/dist/clients/format-events-publish.js +0 -343
  431. package/node_modules/pi-lens/dist/clients/format-service.js +0 -222
  432. package/node_modules/pi-lens/dist/clients/formatters-lazy.js +0 -9
  433. package/node_modules/pi-lens/dist/clients/formatters.js +0 -2032
  434. package/node_modules/pi-lens/dist/clients/freshness-cadence.js +0 -17
  435. package/node_modules/pi-lens/dist/clients/freshness.js +0 -38
  436. package/node_modules/pi-lens/dist/clients/generated-artifacts.js +0 -394
  437. package/node_modules/pi-lens/dist/clients/generation-guard.js +0 -215
  438. package/node_modules/pi-lens/dist/clients/git-guard.js +0 -1136
  439. package/node_modules/pi-lens/dist/clients/git-tracked-ignore.js +0 -243
  440. package/node_modules/pi-lens/dist/clients/gitleaks-client.js +0 -509
  441. package/node_modules/pi-lens/dist/clients/go-client.js +0 -104
  442. package/node_modules/pi-lens/dist/clients/govulncheck-client.js +0 -605
  443. package/node_modules/pi-lens/dist/clients/gradle-ktfmt-style.js +0 -348
  444. package/node_modules/pi-lens/dist/clients/grammar-source.js +0 -465
  445. package/node_modules/pi-lens/dist/clients/gzip-stage-write.js +0 -135
  446. package/node_modules/pi-lens/dist/clients/hashline-anchor.js +0 -424
  447. package/node_modules/pi-lens/dist/clients/hook-budgets.js +0 -76
  448. package/node_modules/pi-lens/dist/clients/host-edit-normalize.js +0 -140
  449. package/node_modules/pi-lens/dist/clients/host-ports.js +0 -39
  450. package/node_modules/pi-lens/dist/clients/indent-retarget.js +0 -154
  451. package/node_modules/pi-lens/dist/clients/inline-blocker-dispositions.js +0 -186
  452. package/node_modules/pi-lens/dist/clients/install-diagnostics.js +0 -156
  453. package/node_modules/pi-lens/dist/clients/installer/index.js +0 -5416
  454. package/node_modules/pi-lens/dist/clients/installer/managed-tool-refresh-session.js +0 -58
  455. package/node_modules/pi-lens/dist/clients/installer/managed-tool-refresh.js +0 -783
  456. package/node_modules/pi-lens/dist/clients/instance-reaper-state.js +0 -7
  457. package/node_modules/pi-lens/dist/clients/instance-reaper.js +0 -1137
  458. package/node_modules/pi-lens/dist/clients/instance-registry-lock.js +0 -145
  459. package/node_modules/pi-lens/dist/clients/instance-registry.js +0 -773
  460. package/node_modules/pi-lens/dist/clients/jscpd-client.js +0 -378
  461. package/node_modules/pi-lens/dist/clients/json-cache-read.js +0 -65
  462. package/node_modules/pi-lens/dist/clients/knip-client.js +0 -788
  463. package/node_modules/pi-lens/dist/clients/language-policy.js +0 -252
  464. package/node_modules/pi-lens/dist/clients/language-profile.js +0 -361
  465. package/node_modules/pi-lens/dist/clients/language-registry.js +0 -603
  466. package/node_modules/pi-lens/dist/clients/latency-logger.js +0 -727
  467. package/node_modules/pi-lens/dist/clients/lazy-import.js +0 -21
  468. package/node_modules/pi-lens/dist/clients/ledger-bounds.js +0 -54
  469. package/node_modules/pi-lens/dist/clients/lens-config.js +0 -404
  470. package/node_modules/pi-lens/dist/clients/lens-engine.js +0 -358
  471. package/node_modules/pi-lens/dist/clients/lens-events.js +0 -125
  472. package/node_modules/pi-lens/dist/clients/lens-flag-registry.js +0 -467
  473. package/node_modules/pi-lens/dist/clients/lens-map.js +0 -1156
  474. package/node_modules/pi-lens/dist/clients/live-bus-emitter.js +0 -74
  475. package/node_modules/pi-lens/dist/clients/log-cleanup.js +0 -222
  476. package/node_modules/pi-lens/dist/clients/lsp/aggregation.js +0 -178
  477. package/node_modules/pi-lens/dist/clients/lsp/cascade-tier.js +0 -421
  478. package/node_modules/pi-lens/dist/clients/lsp/client.js +0 -4593
  479. package/node_modules/pi-lens/dist/clients/lsp/config.js +0 -691
  480. package/node_modules/pi-lens/dist/clients/lsp/content-limits.js +0 -41
  481. package/node_modules/pi-lens/dist/clients/lsp/diagnostic-binding.js +0 -225
  482. package/node_modules/pi-lens/dist/clients/lsp/document-drift.js +0 -467
  483. package/node_modules/pi-lens/dist/clients/lsp/edits.js +0 -1219
  484. package/node_modules/pi-lens/dist/clients/lsp/index.js +0 -8305
  485. package/node_modules/pi-lens/dist/clients/lsp/inferred-project.js +0 -216
  486. package/node_modules/pi-lens/dist/clients/lsp/jvm-runtime.js +0 -298
  487. package/node_modules/pi-lens/dist/clients/lsp/language.js +0 -63
  488. package/node_modules/pi-lens/dist/clients/lsp/launch.js +0 -746
  489. package/node_modules/pi-lens/dist/clients/lsp/lombok.js +0 -158
  490. package/node_modules/pi-lens/dist/clients/lsp/path-utils.js +0 -5
  491. package/node_modules/pi-lens/dist/clients/lsp/pending-aux-coverage.js +0 -251
  492. package/node_modules/pi-lens/dist/clients/lsp/position-encoding.js +0 -61
  493. package/node_modules/pi-lens/dist/clients/lsp/ruby-drive-dirs.js +0 -83
  494. package/node_modules/pi-lens/dist/clients/lsp/server.js +0 -3290
  495. package/node_modules/pi-lens/dist/clients/lsp/session-roots.js +0 -192
  496. package/node_modules/pi-lens/dist/clients/lsp/spawn-history.js +0 -17
  497. package/node_modules/pi-lens/dist/clients/lsp/sync-kind.js +0 -56
  498. package/node_modules/pi-lens/dist/clients/lsp/tsserver-sync.js +0 -332
  499. package/node_modules/pi-lens/dist/clients/lsp/wait-policy/capability-snapshot.js +0 -1
  500. package/node_modules/pi-lens/dist/clients/lsp/wait-policy/classification.js +0 -85
  501. package/node_modules/pi-lens/dist/clients/lsp/wait-policy/index.js +0 -10
  502. package/node_modules/pi-lens/dist/clients/lsp/wait-policy/strategies.js +0 -392
  503. package/node_modules/pi-lens/dist/clients/lsp/watch-queue.js +0 -61
  504. package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +0 -639
  505. package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-session.js +0 -30
  506. package/node_modules/pi-lens/dist/clients/lsp/workspace-sweep-hold.js +0 -184
  507. package/node_modules/pi-lens/dist/clients/lsp-budget.js +0 -186
  508. package/node_modules/pi-lens/dist/clients/lsp-document-symbols.js +0 -110
  509. package/node_modules/pi-lens/dist/clients/lsp-lazy.js +0 -9
  510. package/node_modules/pi-lens/dist/clients/lsp-mutation.js +0 -396
  511. package/node_modules/pi-lens/dist/clients/lsp-status.js +0 -59
  512. package/node_modules/pi-lens/dist/clients/map-with-concurrency.js +0 -40
  513. package/node_modules/pi-lens/dist/clients/mcp/analyze.js +0 -420
  514. package/node_modules/pi-lens/dist/clients/mcp/host-shim.js +0 -31
  515. package/node_modules/pi-lens/dist/clients/mcp/ipc.js +0 -523
  516. package/node_modules/pi-lens/dist/clients/mcp/review.js +0 -197
  517. package/node_modules/pi-lens/dist/clients/mcp/session.js +0 -412
  518. package/node_modules/pi-lens/dist/clients/memory-sampler.js +0 -208
  519. package/node_modules/pi-lens/dist/clients/message-end-attribution.js +0 -30
  520. package/node_modules/pi-lens/dist/clients/metrics-client.js +0 -107
  521. package/node_modules/pi-lens/dist/clients/metrics-history.js +0 -327
  522. package/node_modules/pi-lens/dist/clients/middle-man-analysis.js +0 -263
  523. package/node_modules/pi-lens/dist/clients/model-provider.js +0 -53
  524. package/node_modules/pi-lens/dist/clients/module-report-lsp.js +0 -189
  525. package/node_modules/pi-lens/dist/clients/module-report.js +0 -2150
  526. package/node_modules/pi-lens/dist/clients/mutating-tool.js +0 -651
  527. package/node_modules/pi-lens/dist/clients/mutation-attribution.js +0 -368
  528. package/node_modules/pi-lens/dist/clients/mutation-bridge.js +0 -240
  529. package/node_modules/pi-lens/dist/clients/ndjson-logger.js +0 -734
  530. package/node_modules/pi-lens/dist/clients/observed-mutation-sources.js +0 -101
  531. package/node_modules/pi-lens/dist/clients/observed-mutation.js +0 -1253
  532. package/node_modules/pi-lens/dist/clients/oldtext-autopatch.js +0 -128
  533. package/node_modules/pi-lens/dist/clients/opaque-mutation-scan.js +0 -496
  534. package/node_modules/pi-lens/dist/clients/opengrep-client.js +0 -333
  535. package/node_modules/pi-lens/dist/clients/opengrep-config.js +0 -76
  536. package/node_modules/pi-lens/dist/clients/package-manager.js +0 -607
  537. package/node_modules/pi-lens/dist/clients/package-root.js +0 -38
  538. package/node_modules/pi-lens/dist/clients/partial-edit-apply.js +0 -439
  539. package/node_modules/pi-lens/dist/clients/path-attribution-telemetry.js +0 -43
  540. package/node_modules/pi-lens/dist/clients/path-keyed-map.js +0 -108
  541. package/node_modules/pi-lens/dist/clients/path-utils.js +0 -1244
  542. package/node_modules/pi-lens/dist/clients/performance-report.js +0 -331
  543. package/node_modules/pi-lens/dist/clients/persist-debounce.js +0 -70
  544. package/node_modules/pi-lens/dist/clients/persistent-reverify.js +0 -271
  545. package/node_modules/pi-lens/dist/clients/php-cs-fixer-config.js +0 -119
  546. package/node_modules/pi-lens/dist/clients/pipeline.js +0 -1480
  547. package/node_modules/pi-lens/dist/clients/post-autofix-notice.js +0 -37
  548. package/node_modules/pi-lens/dist/clients/print-mode.js +0 -21
  549. package/node_modules/pi-lens/dist/clients/probe-home-state.js +0 -228
  550. package/node_modules/pi-lens/dist/clients/process-bridge.js +0 -66
  551. package/node_modules/pi-lens/dist/clients/process-singletons.js +0 -210
  552. package/node_modules/pi-lens/dist/clients/process-snapshot.js +0 -68
  553. package/node_modules/pi-lens/dist/clients/project-changes.js +0 -181
  554. package/node_modules/pi-lens/dist/clients/project-conventions.js +0 -171
  555. package/node_modules/pi-lens/dist/clients/project-diagnostics/cache.js +0 -137
  556. package/node_modules/pi-lens/dist/clients/project-diagnostics/extractors.js +0 -109
  557. package/node_modules/pi-lens/dist/clients/project-diagnostics/fresh-fetch.js +0 -668
  558. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +0 -118
  559. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/dead-code.js +0 -47
  560. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +0 -40
  561. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/govulncheck.js +0 -34
  562. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +0 -38
  563. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +0 -47
  564. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +0 -48
  565. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +0 -40
  566. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +0 -127
  567. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/trivy.js +0 -81
  568. package/node_modules/pi-lens/dist/clients/project-diagnostics/scanner.js +0 -520
  569. package/node_modules/pi-lens/dist/clients/project-diagnostics/types.js +0 -1
  570. package/node_modules/pi-lens/dist/clients/project-lens-config.js +0 -807
  571. package/node_modules/pi-lens/dist/clients/project-report.js +0 -701
  572. package/node_modules/pi-lens/dist/clients/project-scale.js +0 -237
  573. package/node_modules/pi-lens/dist/clients/project-scan-policy.js +0 -11
  574. package/node_modules/pi-lens/dist/clients/project-snapshot-fingerprint.js +0 -48
  575. package/node_modules/pi-lens/dist/clients/project-snapshot-persist-worker.js +0 -20
  576. package/node_modules/pi-lens/dist/clients/project-snapshot.js +0 -1653
  577. package/node_modules/pi-lens/dist/clients/project-trust.js +0 -181
  578. package/node_modules/pi-lens/dist/clients/python-environment.js +0 -217
  579. package/node_modules/pi-lens/dist/clients/python-provenance.js +0 -639
  580. package/node_modules/pi-lens/dist/clients/quiet-window-config.js +0 -47
  581. package/node_modules/pi-lens/dist/clients/quiet-window.js +0 -236
  582. package/node_modules/pi-lens/dist/clients/read-bridge.js +0 -139
  583. package/node_modules/pi-lens/dist/clients/read-expansion.js +0 -266
  584. package/node_modules/pi-lens/dist/clients/read-guard-logger.js +0 -251
  585. package/node_modules/pi-lens/dist/clients/read-guard-tool-lines.js +0 -1306
  586. package/node_modules/pi-lens/dist/clients/read-guard.js +0 -1561
  587. package/node_modules/pi-lens/dist/clients/recent-touches.js +0 -240
  588. package/node_modules/pi-lens/dist/clients/redact/secrets.js +0 -449
  589. package/node_modules/pi-lens/dist/clients/resource-sampler.js +0 -628
  590. package/node_modules/pi-lens/dist/clients/reverse-deps.js +0 -270
  591. package/node_modules/pi-lens/dist/clients/review-graph/builder.js +0 -5126
  592. package/node_modules/pi-lens/dist/clients/review-graph/format.js +0 -33
  593. package/node_modules/pi-lens/dist/clients/review-graph/git-identity.js +0 -163
  594. package/node_modules/pi-lens/dist/clients/review-graph/import-resolvers.js +0 -481
  595. package/node_modules/pi-lens/dist/clients/review-graph/persist-worker.js +0 -10
  596. package/node_modules/pi-lens/dist/clients/review-graph/query.js +0 -244
  597. package/node_modules/pi-lens/dist/clients/review-graph/revision-drift.js +0 -21
  598. package/node_modules/pi-lens/dist/clients/review-graph/service.js +0 -96
  599. package/node_modules/pi-lens/dist/clients/review-graph/shared-extraction-ir.js +0 -82
  600. package/node_modules/pi-lens/dist/clients/review-graph/symbol-id.js +0 -103
  601. package/node_modules/pi-lens/dist/clients/review-graph/tsconfig-paths.js +0 -299
  602. package/node_modules/pi-lens/dist/clients/review-graph/types.js +0 -1
  603. package/node_modules/pi-lens/dist/clients/review-graph/workspace-modules.js +0 -449
  604. package/node_modules/pi-lens/dist/clients/review-graph-logger.js +0 -81
  605. package/node_modules/pi-lens/dist/clients/ruff-client.js +0 -179
  606. package/node_modules/pi-lens/dist/clients/rules-scanner.js +0 -131
  607. package/node_modules/pi-lens/dist/clients/run-duration.js +0 -55
  608. package/node_modules/pi-lens/dist/clients/runtime-agent-end.js +0 -746
  609. package/node_modules/pi-lens/dist/clients/runtime-config.js +0 -77
  610. package/node_modules/pi-lens/dist/clients/runtime-context.js +0 -211
  611. package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +0 -1324
  612. package/node_modules/pi-lens/dist/clients/runtime-session.js +0 -2485
  613. package/node_modules/pi-lens/dist/clients/runtime-tool-call.js +0 -1295
  614. package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +0 -2049
  615. package/node_modules/pi-lens/dist/clients/runtime-turn.js +0 -3767
  616. package/node_modules/pi-lens/dist/clients/rust-client.js +0 -97
  617. package/node_modules/pi-lens/dist/clients/safe-spawn.js +0 -2357
  618. package/node_modules/pi-lens/dist/clients/sanitize.js +0 -286
  619. package/node_modules/pi-lens/dist/clients/scan-utils.js +0 -25
  620. package/node_modules/pi-lens/dist/clients/scratch-tree-policy.js +0 -165
  621. package/node_modules/pi-lens/dist/clients/search-read-registration.js +0 -94
  622. package/node_modules/pi-lens/dist/clients/secret-findings.js +0 -114
  623. package/node_modules/pi-lens/dist/clients/security-scan-client.js +0 -352
  624. package/node_modules/pi-lens/dist/clients/session-event-guard.js +0 -297
  625. package/node_modules/pi-lens/dist/clients/session-lifecycle.js +0 -484
  626. package/node_modules/pi-lens/dist/clients/session-start-observability.js +0 -94
  627. package/node_modules/pi-lens/dist/clients/session-state-store.js +0 -101
  628. package/node_modules/pi-lens/dist/clients/session-summary.js +0 -15
  629. package/node_modules/pi-lens/dist/clients/sessionstart-logger.js +0 -27
  630. package/node_modules/pi-lens/dist/clients/sg-runner.js +0 -876
  631. package/node_modules/pi-lens/dist/clients/sgconfig.js +0 -347
  632. package/node_modules/pi-lens/dist/clients/shared-checkout-guard.js +0 -338
  633. package/node_modules/pi-lens/dist/clients/single-flight.js +0 -158
  634. package/node_modules/pi-lens/dist/clients/situational-tool-telemetry.js +0 -108
  635. package/node_modules/pi-lens/dist/clients/skills-resolver.js +0 -141
  636. package/node_modules/pi-lens/dist/clients/slow-fs.js +0 -138
  637. package/node_modules/pi-lens/dist/clients/smells-rollup.js +0 -231
  638. package/node_modules/pi-lens/dist/clients/source-filter.js +0 -596
  639. package/node_modules/pi-lens/dist/clients/source-walker.js +0 -211
  640. package/node_modules/pi-lens/dist/clients/spawn-output-cap.js +0 -120
  641. package/node_modules/pi-lens/dist/clients/spawn-timeout-cooldown.js +0 -110
  642. package/node_modules/pi-lens/dist/clients/stale-marker.js +0 -17
  643. package/node_modules/pi-lens/dist/clients/startup-scan.js +0 -400
  644. package/node_modules/pi-lens/dist/clients/startup-timing.js +0 -130
  645. package/node_modules/pi-lens/dist/clients/string-utils.js +0 -33
  646. package/node_modules/pi-lens/dist/clients/subagent-mode.js +0 -111
  647. package/node_modules/pi-lens/dist/clients/symbol-containment.js +0 -24
  648. package/node_modules/pi-lens/dist/clients/symbol-types.js +0 -5
  649. package/node_modules/pi-lens/dist/clients/test-runner-client.js +0 -2507
  650. package/node_modules/pi-lens/dist/clients/test-runner-delivery.js +0 -287
  651. package/node_modules/pi-lens/dist/clients/todo-scanner.js +0 -229
  652. package/node_modules/pi-lens/dist/clients/tool-agreement.js +0 -423
  653. package/node_modules/pi-lens/dist/clients/tool-config.js +0 -249
  654. package/node_modules/pi-lens/dist/clients/tool-cwd.js +0 -270
  655. package/node_modules/pi-lens/dist/clients/tool-definition.js +0 -47
  656. package/node_modules/pi-lens/dist/clients/tool-event.js +0 -105
  657. package/node_modules/pi-lens/dist/clients/tool-policy.js +0 -2755
  658. package/node_modules/pi-lens/dist/clients/tool-probe.js +0 -53
  659. package/node_modules/pi-lens/dist/clients/tool-render.js +0 -156
  660. package/node_modules/pi-lens/dist/clients/tool-set-policy.js +0 -118
  661. package/node_modules/pi-lens/dist/clients/tree-sitter-cache.js +0 -364
  662. package/node_modules/pi-lens/dist/clients/tree-sitter-client.js +0 -4195
  663. package/node_modules/pi-lens/dist/clients/tree-sitter-logger.js +0 -100
  664. package/node_modules/pi-lens/dist/clients/tree-sitter-navigator.js +0 -269
  665. package/node_modules/pi-lens/dist/clients/tree-sitter-query-loader.js +0 -569
  666. package/node_modules/pi-lens/dist/clients/tree-sitter-shared.js +0 -158
  667. package/node_modules/pi-lens/dist/clients/tree-sitter-symbol-extractor.js +0 -1265
  668. package/node_modules/pi-lens/dist/clients/trivy-client.js +0 -467
  669. package/node_modules/pi-lens/dist/clients/tui-fit.js +0 -50
  670. package/node_modules/pi-lens/dist/clients/turn-context.js +0 -52
  671. package/node_modules/pi-lens/dist/clients/turn-end/lane.js +0 -51
  672. package/node_modules/pi-lens/dist/clients/turn-end/lanes/govulncheck.js +0 -112
  673. package/node_modules/pi-lens/dist/clients/turn-end/lanes/secrets.js +0 -204
  674. package/node_modules/pi-lens/dist/clients/turn-summary-render.js +0 -72
  675. package/node_modules/pi-lens/dist/clients/turn-summary.js +0 -132
  676. package/node_modules/pi-lens/dist/clients/typos-config.js +0 -29
  677. package/node_modules/pi-lens/dist/clients/user-notify.js +0 -51
  678. package/node_modules/pi-lens/dist/clients/vanished-instance-marker.js +0 -57
  679. package/node_modules/pi-lens/dist/clients/warm-attach.js +0 -305
  680. package/node_modules/pi-lens/dist/clients/widget-state.js +0 -1808
  681. package/node_modules/pi-lens/dist/clients/word-index-logger.js +0 -49
  682. package/node_modules/pi-lens/dist/clients/word-index-store.js +0 -459
  683. package/node_modules/pi-lens/dist/clients/word-index.js +0 -2080
  684. package/node_modules/pi-lens/dist/clients/workspace-topology.js +0 -443
  685. package/node_modules/pi-lens/dist/clients/write-ordering-guard.js +0 -65
  686. package/node_modules/pi-lens/dist/clients/zizmor-config.js +0 -340
  687. package/node_modules/pi-lens/dist/i18n.js +0 -69
  688. package/node_modules/pi-lens/dist/mcp/build-staleness.js +0 -124
  689. package/node_modules/pi-lens/dist/scripts/lib/process-scan.mjs +0 -583
  690. package/node_modules/pi-lens/dist/scripts/lib/skills-predicate.mjs +0 -129
  691. package/node_modules/pi-lens/dist/scripts/lib/web-tree-sitter-dir.mjs +0 -123
  692. package/node_modules/pi-lens/dist/tools/activate-tools.js +0 -87
  693. package/node_modules/pi-lens/dist/tools/ast-grep-outline.js +0 -137
  694. package/node_modules/pi-lens/dist/tools/ast-grep-replace.js +0 -244
  695. package/node_modules/pi-lens/dist/tools/ast-grep-search.js +0 -762
  696. package/node_modules/pi-lens/dist/tools/effective-config.js +0 -90
  697. package/node_modules/pi-lens/dist/tools/lens-diagnostic-mark.js +0 -375
  698. package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +0 -2571
  699. package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +0 -1745
  700. package/node_modules/pi-lens/dist/tools/lsp-navigation.js +0 -1367
  701. package/node_modules/pi-lens/dist/tools/lsp-structured-output.js +0 -294
  702. package/node_modules/pi-lens/dist/tools/module-report.js +0 -382
  703. package/node_modules/pi-lens/dist/tools/project-report.js +0 -86
  704. package/node_modules/pi-lens/dist/tools/render-compact.js +0 -374
  705. package/node_modules/pi-lens/dist/tools/scan-progress.js +0 -53
  706. package/node_modules/pi-lens/dist/tools/shared.js +0 -29
  707. package/node_modules/pi-lens/dist/tools/symbol-search.js +0 -155
@@ -0,0 +1,3364 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ __export
4
+ } from "./chunk-NXL4FFQQ.js";
5
+
6
+ // dist/clients/package-root.js
7
+ import * as fs from "node:fs";
8
+ import * as path from "node:path";
9
+ import { fileURLToPath } from "node:url";
10
+ var packageRootCache = /* @__PURE__ */ new Map();
11
+ function getPackageRoot(importMetaUrl) {
12
+ const cached = packageRootCache.get(importMetaUrl);
13
+ if (cached)
14
+ return cached;
15
+ let current = path.dirname(fileURLToPath(importMetaUrl));
16
+ while (true) {
17
+ if (fs.existsSync(path.join(current, "package.json"))) {
18
+ packageRootCache.set(importMetaUrl, current);
19
+ return current;
20
+ }
21
+ const parent = path.dirname(current);
22
+ if (parent === current) {
23
+ packageRootCache.set(importMetaUrl, current);
24
+ return current;
25
+ }
26
+ current = parent;
27
+ }
28
+ }
29
+ function resolvePackagePath(importMetaUrl, ...segments) {
30
+ return path.join(getPackageRoot(importMetaUrl), ...segments);
31
+ }
32
+
33
+ // node_modules/js-yaml/dist/js-yaml.mjs
34
+ var js_yaml_exports = {};
35
+ __export(js_yaml_exports, {
36
+ CHOMPING_CLIP: () => CHOMPING_CLIP,
37
+ CHOMPING_KEEP: () => CHOMPING_KEEP,
38
+ CHOMPING_MODE: () => CHOMPING_MODE,
39
+ CHOMPING_STRIP: () => CHOMPING_STRIP,
40
+ COLLECTION_STYLE: () => COLLECTION_STYLE,
41
+ COLLECTION_STYLE_BLOCK: () => COLLECTION_STYLE_BLOCK,
42
+ COLLECTION_STYLE_FLOW: () => COLLECTION_STYLE_FLOW,
43
+ CORE_SCHEMA: () => CORE_SCHEMA,
44
+ DEFAULT_SCALAR_STYLE_RULES: () => DEFAULT_SCALAR_STYLE_RULES,
45
+ DUMP_SCHEMA: () => DUMP_SCHEMA,
46
+ EVENT_ALIAS: () => EVENT_ALIAS,
47
+ EVENT_DOCUMENT: () => EVENT_DOCUMENT,
48
+ EVENT_ID: () => EVENT_ID,
49
+ EVENT_MAPPING: () => EVENT_MAPPING,
50
+ EVENT_POP: () => EVENT_POP,
51
+ EVENT_SCALAR: () => EVENT_SCALAR,
52
+ EVENT_SEQUENCE: () => EVENT_SEQUENCE,
53
+ FAILSAFE_SCHEMA: () => FAILSAFE_SCHEMA,
54
+ JSON_SCHEMA: () => JSON_SCHEMA,
55
+ NOT_RESOLVED: () => NOT_RESOLVED,
56
+ SCALAR_STYLE: () => SCALAR_STYLE,
57
+ SCALAR_STYLE_DOUBLE_QUOTED: () => SCALAR_STYLE_DOUBLE_QUOTED,
58
+ SCALAR_STYLE_FOLDED_BLOCK: () => SCALAR_STYLE_FOLDED_BLOCK,
59
+ SCALAR_STYLE_LITERAL_BLOCK: () => SCALAR_STYLE_LITERAL_BLOCK,
60
+ SCALAR_STYLE_PLAIN: () => SCALAR_STYLE_PLAIN,
61
+ SCALAR_STYLE_SINGLE_QUOTED: () => SCALAR_STYLE_SINGLE_QUOTED,
62
+ Schema: () => Schema,
63
+ VISIT_BREAK: () => VISIT_BREAK,
64
+ VISIT_SKIP: () => VISIT_SKIP,
65
+ YAML11_SCHEMA: () => YAML11_SCHEMA,
66
+ YAMLException: () => YAMLException,
67
+ binaryTag: () => binaryTag,
68
+ boolCoreTag: () => boolCoreTag,
69
+ boolJsonTag: () => boolJsonTag,
70
+ boolYaml11Tag: () => boolYaml11Tag,
71
+ constructFromEvents: () => constructFromEvents,
72
+ defineMappingTag: () => defineMappingTag,
73
+ defineScalarTag: () => defineScalarTag,
74
+ defineSequenceTag: () => defineSequenceTag,
75
+ dump: () => dump,
76
+ eventsToAst: () => eventsToAst,
77
+ floatCoreTag: () => floatCoreTag,
78
+ floatJsonTag: () => floatJsonTag,
79
+ floatYaml11Tag: () => floatYaml11Tag,
80
+ getScalarValue: () => getScalarValue,
81
+ intCoreTag: () => intCoreTag,
82
+ intJsonTag: () => intJsonTag,
83
+ intYaml11Tag: () => intYaml11Tag,
84
+ jsToAst: () => jsToAst,
85
+ legacyMapTag: () => legacyMapTag,
86
+ load: () => load,
87
+ loadAll: () => loadAll,
88
+ mapTag: () => mapTag,
89
+ mergeTag: () => mergeTag,
90
+ nullCoreTag: () => nullCoreTag,
91
+ nullJsonTag: () => nullJsonTag,
92
+ nullYaml11Tag: () => nullYaml11Tag,
93
+ omapTag: () => omapTag,
94
+ pairsTag: () => pairsTag,
95
+ parseEvents: () => parseEvents,
96
+ present: () => present,
97
+ realMapTag: () => realMapTag,
98
+ seqTag: () => seqTag,
99
+ setTag: () => setTag,
100
+ strTag: () => strTag,
101
+ timestampTag: () => timestampTag,
102
+ visit: () => visit
103
+ });
104
+ var NOT_RESOLVED = /* @__PURE__ */ Symbol("NOT_RESOLVED");
105
+ function defineScalarTag(tagName, options) {
106
+ return {
107
+ tagName,
108
+ nodeKind: "scalar",
109
+ implicit: options.implicit ?? false,
110
+ matchByTagPrefix: options.matchByTagPrefix ?? false,
111
+ implicitFirstChars: options.implicitFirstChars ?? null,
112
+ resolve: options.resolve,
113
+ identify: options.identify,
114
+ represent: options.represent ?? ((data) => String(data)),
115
+ representTagName: options.representTagName ?? (() => tagName)
116
+ };
117
+ }
118
+ function defineSequenceTag(tagName, options) {
119
+ const carrierIsResult = options.finalize === void 0;
120
+ return {
121
+ tagName,
122
+ nodeKind: "sequence",
123
+ implicit: false,
124
+ matchByTagPrefix: options.matchByTagPrefix ?? false,
125
+ create: options.create,
126
+ addItem: options.addItem,
127
+ finalize: options.finalize ?? ((carrier) => carrier),
128
+ carrierIsResult,
129
+ identify: options.identify,
130
+ represent: options.represent ?? ((data) => data),
131
+ representTagName: options.representTagName ?? (() => tagName)
132
+ };
133
+ }
134
+ function defineMappingTag(tagName, options) {
135
+ const carrierIsResult = options.finalize === void 0;
136
+ return {
137
+ tagName,
138
+ nodeKind: "mapping",
139
+ implicit: false,
140
+ matchByTagPrefix: options.matchByTagPrefix ?? false,
141
+ create: options.create,
142
+ addPair: options.addPair,
143
+ has: options.has,
144
+ keys: options.keys,
145
+ get: options.get,
146
+ finalize: options.finalize ?? ((carrier) => carrier),
147
+ carrierIsResult,
148
+ identify: options.identify,
149
+ represent: options.represent ?? ((data) => data),
150
+ representTagName: options.representTagName ?? (() => tagName)
151
+ };
152
+ }
153
+ var strTag = defineScalarTag("tag:yaml.org,2002:str", {
154
+ resolve: (source) => source,
155
+ identify: (data) => typeof data === "string"
156
+ });
157
+ var NULL_VALUES$1 = [
158
+ "",
159
+ "~",
160
+ "null",
161
+ "Null",
162
+ "NULL"
163
+ ];
164
+ var nullCoreTag = defineScalarTag("tag:yaml.org,2002:null", {
165
+ implicit: true,
166
+ implicitFirstChars: [
167
+ "",
168
+ "~",
169
+ "n",
170
+ "N"
171
+ ],
172
+ resolve: (source) => {
173
+ if (NULL_VALUES$1.indexOf(source) !== -1) return null;
174
+ return NOT_RESOLVED;
175
+ },
176
+ identify: (object) => object === null,
177
+ represent: () => "null"
178
+ });
179
+ var nullJsonTag = defineScalarTag("tag:yaml.org,2002:null", {
180
+ implicit: true,
181
+ implicitFirstChars: ["n"],
182
+ resolve: (source, isExplicit) => {
183
+ if (source === "null" || isExplicit && source === "") return null;
184
+ return NOT_RESOLVED;
185
+ },
186
+ identify: (object) => object === null,
187
+ represent: () => "null"
188
+ });
189
+ var NULL_VALUES = [
190
+ "",
191
+ "~",
192
+ "null",
193
+ "Null",
194
+ "NULL"
195
+ ];
196
+ var nullYaml11Tag = defineScalarTag("tag:yaml.org,2002:null", {
197
+ implicit: true,
198
+ implicitFirstChars: [
199
+ "",
200
+ "~",
201
+ "n",
202
+ "N"
203
+ ],
204
+ resolve: (source) => {
205
+ if (NULL_VALUES.indexOf(source) !== -1) return null;
206
+ return NOT_RESOLVED;
207
+ },
208
+ identify: (object) => object === null,
209
+ represent: () => "null"
210
+ });
211
+ var TRUE_VALUES$2 = [
212
+ "true",
213
+ "True",
214
+ "TRUE"
215
+ ];
216
+ var FALSE_VALUES$2 = [
217
+ "false",
218
+ "False",
219
+ "FALSE"
220
+ ];
221
+ var boolCoreTag = defineScalarTag("tag:yaml.org,2002:bool", {
222
+ implicit: true,
223
+ implicitFirstChars: [
224
+ "t",
225
+ "T",
226
+ "f",
227
+ "F"
228
+ ],
229
+ resolve: (source) => {
230
+ if (TRUE_VALUES$2.indexOf(source) !== -1) return true;
231
+ if (FALSE_VALUES$2.indexOf(source) !== -1) return false;
232
+ return NOT_RESOLVED;
233
+ },
234
+ identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
235
+ represent: (object) => object ? "true" : "false"
236
+ });
237
+ var TRUE_VALUES$1 = ["true"];
238
+ var FALSE_VALUES$1 = ["false"];
239
+ var boolJsonTag = defineScalarTag("tag:yaml.org,2002:bool", {
240
+ implicit: true,
241
+ implicitFirstChars: ["t", "f"],
242
+ resolve: (source) => {
243
+ if (TRUE_VALUES$1.indexOf(source) !== -1) return true;
244
+ if (FALSE_VALUES$1.indexOf(source) !== -1) return false;
245
+ return NOT_RESOLVED;
246
+ },
247
+ identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
248
+ represent: (object) => object ? "true" : "false"
249
+ });
250
+ var TRUE_VALUES = [
251
+ "true",
252
+ "True",
253
+ "TRUE",
254
+ "y",
255
+ "Y",
256
+ "yes",
257
+ "Yes",
258
+ "YES",
259
+ "on",
260
+ "On",
261
+ "ON"
262
+ ];
263
+ var FALSE_VALUES = [
264
+ "false",
265
+ "False",
266
+ "FALSE",
267
+ "n",
268
+ "N",
269
+ "no",
270
+ "No",
271
+ "NO",
272
+ "off",
273
+ "Off",
274
+ "OFF"
275
+ ];
276
+ var boolYaml11Tag = defineScalarTag("tag:yaml.org,2002:bool", {
277
+ implicit: true,
278
+ implicitFirstChars: [
279
+ "y",
280
+ "Y",
281
+ "n",
282
+ "N",
283
+ "t",
284
+ "T",
285
+ "f",
286
+ "F",
287
+ "o",
288
+ "O"
289
+ ],
290
+ resolve: (source) => {
291
+ if (TRUE_VALUES.indexOf(source) !== -1) return true;
292
+ if (FALSE_VALUES.indexOf(source) !== -1) return false;
293
+ return NOT_RESOLVED;
294
+ },
295
+ identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
296
+ represent: (object) => object ? "true" : "false"
297
+ });
298
+ var YAML_INTEGER_IMPLICIT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
299
+ var YAML_INTEGER_EXPLICIT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
300
+ function parseYamlInteger$2(source) {
301
+ let value = source;
302
+ let sign = 1;
303
+ if (value[0] === "-" || value[0] === "+") {
304
+ if (value[0] === "-") sign = -1;
305
+ value = value.slice(1);
306
+ }
307
+ if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
308
+ if (value.startsWith("0o")) return sign * parseInt(value.slice(2), 8);
309
+ if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
310
+ return sign * parseInt(value, 10);
311
+ }
312
+ function resolveYamlInteger$2(source, isExplicit) {
313
+ if (isExplicit) {
314
+ if (!YAML_INTEGER_EXPLICIT_PATTERN$1.test(source)) return NOT_RESOLVED;
315
+ } else if (!YAML_INTEGER_IMPLICIT_PATTERN$1.test(source)) return NOT_RESOLVED;
316
+ const result = parseYamlInteger$2(source);
317
+ return Number.isFinite(result) ? result : NOT_RESOLVED;
318
+ }
319
+ var intCoreTag = defineScalarTag("tag:yaml.org,2002:int", {
320
+ implicit: true,
321
+ implicitFirstChars: [
322
+ "-",
323
+ "+",
324
+ ..."0123456789"
325
+ ],
326
+ resolve: resolveYamlInteger$2,
327
+ identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
328
+ represent: (object) => object.toString(10)
329
+ });
330
+ var YAML_INTEGER_IMPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^-?(?:0|[1-9][0-9]*)$");
331
+ var YAML_INTEGER_EXPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
332
+ function parseYamlInteger$1(source) {
333
+ let value = source;
334
+ let sign = 1;
335
+ if (value[0] === "-" || value[0] === "+") {
336
+ if (value[0] === "-") sign = -1;
337
+ value = value.slice(1);
338
+ }
339
+ if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
340
+ if (value.startsWith("0o")) return sign * parseInt(value.slice(2), 8);
341
+ if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
342
+ return sign * parseInt(value, 10);
343
+ }
344
+ function resolveYamlInteger$1(source, isExplicit) {
345
+ if (isExplicit) {
346
+ if (!YAML_INTEGER_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
347
+ } else if (!YAML_INTEGER_IMPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
348
+ const result = parseYamlInteger$1(source);
349
+ return Number.isFinite(result) ? result : NOT_RESOLVED;
350
+ }
351
+ var intJsonTag = defineScalarTag("tag:yaml.org,2002:int", {
352
+ implicit: true,
353
+ implicitFirstChars: ["-", ..."0123456789"],
354
+ resolve: resolveYamlInteger$1,
355
+ identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
356
+ represent: (object) => object.toString(10)
357
+ });
358
+ var YAML_INTEGER_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");
359
+ function parseYamlInteger(source) {
360
+ let value = source.replace(/_/g, "");
361
+ let sign = 1;
362
+ if (value[0] === "-" || value[0] === "+") {
363
+ if (value[0] === "-") sign = -1;
364
+ value = value.slice(1);
365
+ }
366
+ if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
367
+ if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
368
+ if (value.includes(":")) {
369
+ let result = 0;
370
+ for (const part of value.split(":")) result = result * 60 + Number(part);
371
+ return sign * result;
372
+ }
373
+ if (value !== "0" && value[0] === "0") return sign * parseInt(value, 8);
374
+ return sign * parseInt(value, 10);
375
+ }
376
+ function resolveYamlInteger(source) {
377
+ if (!YAML_INTEGER_PATTERN.test(source)) return NOT_RESOLVED;
378
+ const result = parseYamlInteger(source);
379
+ return Number.isFinite(result) ? result : NOT_RESOLVED;
380
+ }
381
+ var intYaml11Tag = defineScalarTag("tag:yaml.org,2002:int", {
382
+ implicit: true,
383
+ implicitFirstChars: [
384
+ "-",
385
+ "+",
386
+ ..."0123456789"
387
+ ],
388
+ resolve: resolveYamlInteger,
389
+ identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
390
+ represent: (object) => object.toString(10)
391
+ });
392
+ var YAML_FLOAT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
393
+ var YAML_FLOAT_SPECIAL_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
394
+ function resolveYamlFloat$2(source) {
395
+ if (!YAML_FLOAT_PATTERN$1.test(source)) return NOT_RESOLVED;
396
+ let value = source.toLowerCase();
397
+ const sign = value[0] === "-" ? -1 : 1;
398
+ if ("+-".includes(value[0])) value = value.slice(1);
399
+ if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
400
+ if (value === ".nan") return NaN;
401
+ const result = sign * parseFloat(value);
402
+ if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN$1.test(source)) return result;
403
+ return NOT_RESOLVED;
404
+ }
405
+ function representYamlFloat$2(object) {
406
+ if (isNaN(object)) return ".nan";
407
+ if (object === Number.POSITIVE_INFINITY) return ".inf";
408
+ if (object === Number.NEGATIVE_INFINITY) return "-.inf";
409
+ if (Object.is(object, -0)) return "-0.0";
410
+ const result = object.toString(10);
411
+ return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
412
+ }
413
+ var floatCoreTag = defineScalarTag("tag:yaml.org,2002:float", {
414
+ implicit: true,
415
+ implicitFirstChars: [
416
+ "-",
417
+ "+",
418
+ ".",
419
+ ..."0123456789"
420
+ ],
421
+ resolve: resolveYamlFloat$2,
422
+ identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
423
+ represent: representYamlFloat$2
424
+ });
425
+ var YAML_FLOAT_IMPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$");
426
+ var YAML_FLOAT_EXPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
427
+ function resolveYamlFloat$1(source, isExplicit) {
428
+ if (isExplicit) {
429
+ if (!YAML_FLOAT_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
430
+ let value = source.toLowerCase();
431
+ const sign = value[0] === "-" ? -1 : 1;
432
+ if ("+-".includes(value[0])) value = value.slice(1);
433
+ if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
434
+ if (value === ".nan") return NaN;
435
+ const result2 = sign * parseFloat(value);
436
+ return Number.isFinite(result2) ? result2 : NOT_RESOLVED;
437
+ }
438
+ if (!YAML_FLOAT_IMPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
439
+ const result = Number(source);
440
+ if (Number.isFinite(result)) return result;
441
+ return NOT_RESOLVED;
442
+ }
443
+ function representYamlFloat$1(object) {
444
+ if (isNaN(object)) return ".nan";
445
+ if (object === Number.POSITIVE_INFINITY) return ".inf";
446
+ if (object === Number.NEGATIVE_INFINITY) return "-.inf";
447
+ if (Object.is(object, -0)) return "-0.0";
448
+ const result = object.toString(10);
449
+ return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
450
+ }
451
+ var floatJsonTag = defineScalarTag("tag:yaml.org,2002:float", {
452
+ implicit: true,
453
+ implicitFirstChars: ["-", ..."0123456789"],
454
+ resolve: resolveYamlFloat$1,
455
+ identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
456
+ represent: representYamlFloat$1
457
+ });
458
+ var YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
459
+ var YAML_FLOAT_SPECIAL_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
460
+ function resolveYamlFloat(source) {
461
+ if (!YAML_FLOAT_PATTERN.test(source)) return NOT_RESOLVED;
462
+ let value = source.toLowerCase().replace(/_/g, "");
463
+ const sign = value[0] === "-" ? -1 : 1;
464
+ if ("+-".includes(value[0])) value = value.slice(1);
465
+ if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
466
+ if (value === ".nan") return NaN;
467
+ let result = 0;
468
+ if (value.includes(":")) {
469
+ for (const part of value.split(":")) result = result * 60 + Number(part);
470
+ result *= sign;
471
+ } else result = sign * parseFloat(value);
472
+ if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN.test(source)) return result;
473
+ return NOT_RESOLVED;
474
+ }
475
+ function representYamlFloat(object) {
476
+ if (isNaN(object)) return ".nan";
477
+ if (object === Number.POSITIVE_INFINITY) return ".inf";
478
+ if (object === Number.NEGATIVE_INFINITY) return "-.inf";
479
+ if (Object.is(object, -0)) return "-0.0";
480
+ const result = object.toString(10);
481
+ return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
482
+ }
483
+ var floatYaml11Tag = defineScalarTag("tag:yaml.org,2002:float", {
484
+ implicit: true,
485
+ implicitFirstChars: [
486
+ "-",
487
+ "+",
488
+ ".",
489
+ ..."0123456789"
490
+ ],
491
+ resolve: resolveYamlFloat,
492
+ identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
493
+ represent: representYamlFloat
494
+ });
495
+ var mergeTag = defineScalarTag("tag:yaml.org,2002:merge", {
496
+ implicit: true,
497
+ implicitFirstChars: ["<"],
498
+ resolve: (source, isExplicit) => {
499
+ if (source === "<<" || isExplicit && source === "") return "<<";
500
+ return NOT_RESOLVED;
501
+ },
502
+ identify: () => false
503
+ });
504
+ var BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/;
505
+ function resolveYamlBinary(source) {
506
+ const input = source.replace(/\s/g, "");
507
+ if (input.length % 4 !== 0 || !BASE64_PATTERN.test(input)) return NOT_RESOLVED;
508
+ const binary = atob(input);
509
+ const result = new Uint8Array(binary.length);
510
+ for (let index = 0; index < binary.length; index++) result[index] = binary.charCodeAt(index);
511
+ return result;
512
+ }
513
+ function representYamlBinary(object) {
514
+ let binary = "";
515
+ for (let index = 0; index < object.length; index++) binary += String.fromCharCode(object[index]);
516
+ return btoa(binary);
517
+ }
518
+ var binaryTag = defineScalarTag("tag:yaml.org,2002:binary", {
519
+ resolve: resolveYamlBinary,
520
+ identify: (object) => Object.prototype.toString.call(object) === "[object Uint8Array]",
521
+ represent: representYamlBinary
522
+ });
523
+ var YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
524
+ var YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
525
+ function makeUtcDate(year, month, day, hour = 0, minute = 0, second = 0, fraction = 0) {
526
+ const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
527
+ date.setUTCFullYear(year, month, day);
528
+ return date;
529
+ }
530
+ function resolveYamlTimestamp(source) {
531
+ let match = YAML_DATE_REGEXP.exec(source);
532
+ if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(source);
533
+ if (match === null) return NOT_RESOLVED;
534
+ const year = +match[1];
535
+ const month = +match[2] - 1;
536
+ const day = +match[3];
537
+ if (!match[4]) {
538
+ const date2 = makeUtcDate(year, month, day);
539
+ if (date2.getUTCFullYear() !== year || date2.getUTCMonth() !== month || date2.getUTCDate() !== day) return NOT_RESOLVED;
540
+ return date2;
541
+ }
542
+ const hour = +match[4];
543
+ const minute = +match[5];
544
+ const second = +match[6];
545
+ let fraction = 0;
546
+ if (hour > 23 || minute > 59 || second > 59) return NOT_RESOLVED;
547
+ if (match[7]) {
548
+ let value = match[7].slice(0, 3);
549
+ while (value.length < 3) value += "0";
550
+ fraction = +value;
551
+ }
552
+ const date = makeUtcDate(year, month, day, hour, minute, second, fraction);
553
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
554
+ if (match[9]) {
555
+ const offsetHour = +match[10];
556
+ const offsetMinute = +(match[11] || 0);
557
+ if (offsetHour > 23 || offsetMinute > 59) return NOT_RESOLVED;
558
+ const offset = (offsetHour * 60 + offsetMinute) * 6e4;
559
+ date.setTime(date.getTime() - (match[9] === "-" ? -offset : offset));
560
+ }
561
+ return date;
562
+ }
563
+ var timestampTag = defineScalarTag("tag:yaml.org,2002:timestamp", {
564
+ implicit: true,
565
+ implicitFirstChars: [..."0123456789"],
566
+ resolve: resolveYamlTimestamp,
567
+ identify: (object) => object instanceof Date,
568
+ represent: (object) => object.toISOString()
569
+ });
570
+ var seqTag = defineSequenceTag("tag:yaml.org,2002:seq", {
571
+ create: () => [],
572
+ addItem: (container, item) => {
573
+ container.push(item);
574
+ },
575
+ identify: Array.isArray
576
+ });
577
+ function isPlainObject(data) {
578
+ if (data === null || typeof data !== "object" || Array.isArray(data)) return false;
579
+ const prototype = Object.getPrototypeOf(data);
580
+ return prototype === null || prototype === Object.prototype;
581
+ }
582
+ function pick(object, keys) {
583
+ const result = {};
584
+ for (const key of keys) if (object[key] !== void 0) result[key] = object[key];
585
+ return result;
586
+ }
587
+ var omapTag = defineSequenceTag("tag:yaml.org,2002:omap", {
588
+ create: () => ({
589
+ list: [],
590
+ seen: /* @__PURE__ */ new Set()
591
+ }),
592
+ addItem: (carrier, item) => {
593
+ let key;
594
+ if (item instanceof Map) {
595
+ if (item.size !== 1) return "cannot resolve an ordered map item";
596
+ key = item.keys().next().value;
597
+ } else if (isPlainObject(item)) {
598
+ const itemKeys = Object.keys(item);
599
+ if (itemKeys.length !== 1) return "cannot resolve an ordered map item";
600
+ key = itemKeys[0];
601
+ } else return "cannot resolve an ordered map item";
602
+ if (carrier.seen.has(key)) return "duplicate key in ordered map";
603
+ carrier.seen.add(key);
604
+ carrier.list.push(item);
605
+ return "";
606
+ },
607
+ finalize: (carrier) => carrier.list,
608
+ identify: () => false
609
+ });
610
+ var pairsTag = defineSequenceTag("tag:yaml.org,2002:pairs", {
611
+ create: () => [],
612
+ addItem: (container, item) => {
613
+ if (item instanceof Map) {
614
+ if (item.size !== 1) return "cannot resolve a pairs item";
615
+ container.push(item.entries().next().value);
616
+ return "";
617
+ }
618
+ if (Object.prototype.toString.call(item) !== "[object Object]") return "cannot resolve a pairs item";
619
+ const object = item;
620
+ const keys = Object.keys(object);
621
+ if (keys.length !== 1) return "cannot resolve a pairs item";
622
+ container.push([keys[0], object[keys[0]]]);
623
+ return "";
624
+ },
625
+ identify: () => false
626
+ });
627
+ var mapTag = defineMappingTag("tag:yaml.org,2002:map", {
628
+ create: () => ({}),
629
+ identify: isPlainObject,
630
+ represent: (o) => {
631
+ const map = /* @__PURE__ */ new Map();
632
+ for (const key of Object.keys(o)) map.set(key, o[key]);
633
+ return map;
634
+ },
635
+ addPair: (container, key, value) => {
636
+ if (key !== null && typeof key === "object") return "object-based map does not support complex keys";
637
+ const normalizedKey = String(key);
638
+ if (normalizedKey === "__proto__") Object.defineProperty(container, normalizedKey, {
639
+ value,
640
+ enumerable: true,
641
+ configurable: true,
642
+ writable: true
643
+ });
644
+ else container[normalizedKey] = value;
645
+ return "";
646
+ },
647
+ has: (container, key) => {
648
+ if (key !== null && typeof key === "object") return false;
649
+ return Object.prototype.hasOwnProperty.call(container, String(key));
650
+ },
651
+ keys: (container) => Object.keys(container),
652
+ get: (container, key) => {
653
+ const normalizedKey = String(key);
654
+ if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
655
+ return container[normalizedKey];
656
+ }
657
+ });
658
+ var setTag = defineMappingTag("tag:yaml.org,2002:set", {
659
+ create: () => /* @__PURE__ */ new Set(),
660
+ identify: (data) => data instanceof Set,
661
+ represent: (data) => {
662
+ const map = /* @__PURE__ */ new Map();
663
+ for (const key of data) map.set(key, null);
664
+ return map;
665
+ },
666
+ addPair: (container, key, value) => {
667
+ if (value !== null) return "cannot resolve a set item";
668
+ container.add(key);
669
+ return "";
670
+ },
671
+ has: (container, key) => container.has(key),
672
+ keys: (container) => container.keys(),
673
+ get: () => null
674
+ });
675
+ function createTagDefinitionMap() {
676
+ return {
677
+ scalar: /* @__PURE__ */ Object.create(null),
678
+ sequence: /* @__PURE__ */ Object.create(null),
679
+ mapping: /* @__PURE__ */ Object.create(null)
680
+ };
681
+ }
682
+ function createTagDefinitionListMap() {
683
+ return {
684
+ scalar: [],
685
+ sequence: [],
686
+ mapping: []
687
+ };
688
+ }
689
+ function compileTags(tags) {
690
+ const result = [];
691
+ for (const tag of tags) {
692
+ let index = result.length;
693
+ for (let previousIndex = 0; previousIndex < result.length; previousIndex++) {
694
+ const previous = result[previousIndex];
695
+ if (previous.nodeKind === tag.nodeKind && previous.tagName === tag.tagName && previous.matchByTagPrefix === tag.matchByTagPrefix) {
696
+ index = previousIndex;
697
+ break;
698
+ }
699
+ }
700
+ result[index] = tag;
701
+ }
702
+ return result;
703
+ }
704
+ var Schema = class Schema2 {
705
+ tags;
706
+ /** @internal */
707
+ implicitScalarTags;
708
+ /**
709
+ * Dispatch implicit scalar resolvers by `source.charAt(0)`. Each bucket holds
710
+ * the resolvers that may match that key, in schema order; a key absent from
711
+ * the map uses
712
+ * {@link Schema.implicitScalarAnyFirstChar}
713
+ * (resolvers that declared no first-char constraint, so they apply to any
714
+ * first character).
715
+ */
716
+ implicitScalarByFirstChar;
717
+ implicitScalarAnyFirstChar;
718
+ /**
719
+ * The default scalar tag (`!!str`), resolved once so the composer's fallback
720
+ * for unresolved plain scalars avoids a keyed lookup per scalar.
721
+ *
722
+ * @internal
723
+ */
724
+ defaultScalarTag;
725
+ /**
726
+ * The default container tags (`!!seq` / `!!map`), used by the dumper: when a
727
+ * value is identified by its default tag, the tag is implicit and not
728
+ * printed. Undefined if the schema does not define them (then such values
729
+ * can't be dumped).
730
+ *
731
+ * @internal
732
+ */
733
+ defaultSequenceTag;
734
+ /** @internal */
735
+ defaultMappingTag;
736
+ exact;
737
+ prefix;
738
+ constructor(tags) {
739
+ const compiledTags = compileTags(tags);
740
+ const implicitScalarTags = [];
741
+ const exact = createTagDefinitionMap();
742
+ const prefix = createTagDefinitionListMap();
743
+ for (const tag of compiledTags) {
744
+ if (tag.nodeKind === "scalar" && tag.implicit) {
745
+ if (tag.matchByTagPrefix) throw new Error("Implicit scalar tags cannot match by tag prefix");
746
+ implicitScalarTags.push(tag);
747
+ }
748
+ switch (tag.nodeKind) {
749
+ case "scalar":
750
+ if (tag.matchByTagPrefix) prefix.scalar.push(tag);
751
+ else exact.scalar[tag.tagName] = tag;
752
+ break;
753
+ case "sequence":
754
+ if (tag.matchByTagPrefix) prefix.sequence.push(tag);
755
+ else exact.sequence[tag.tagName] = tag;
756
+ break;
757
+ case "mapping":
758
+ if (tag.matchByTagPrefix) prefix.mapping.push(tag);
759
+ else exact.mapping[tag.tagName] = tag;
760
+ break;
761
+ }
762
+ }
763
+ const implicitScalarAnyFirstChar = implicitScalarTags.filter((tag) => tag.implicitFirstChars === null);
764
+ const keys = /* @__PURE__ */ new Set();
765
+ for (const tag of implicitScalarTags) if (tag.implicitFirstChars !== null) for (const key of tag.implicitFirstChars) keys.add(key);
766
+ const implicitScalarByFirstChar = /* @__PURE__ */ new Map();
767
+ for (const key of keys) implicitScalarByFirstChar.set(key, implicitScalarTags.filter((tag) => tag.implicitFirstChars === null || tag.implicitFirstChars.indexOf(key) !== -1));
768
+ const defaultScalarTag = exact.scalar["tag:yaml.org,2002:str"];
769
+ if (!defaultScalarTag) throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");
770
+ this.tags = compiledTags;
771
+ this.implicitScalarTags = implicitScalarTags;
772
+ this.implicitScalarByFirstChar = implicitScalarByFirstChar;
773
+ this.implicitScalarAnyFirstChar = implicitScalarAnyFirstChar;
774
+ this.defaultScalarTag = defaultScalarTag;
775
+ this.defaultSequenceTag = exact.sequence["tag:yaml.org,2002:seq"];
776
+ this.defaultMappingTag = exact.mapping["tag:yaml.org,2002:map"];
777
+ this.exact = exact;
778
+ this.prefix = prefix;
779
+ }
780
+ /** @internal */
781
+ lookupScalarTag(tagName) {
782
+ const exactTag = this.exact.scalar[tagName];
783
+ if (exactTag) return exactTag;
784
+ for (const tag of this.prefix.scalar) if (tagName.startsWith(tag.tagName)) return tag;
785
+ }
786
+ /** @internal */
787
+ lookupSequenceTag(tagName) {
788
+ const exactTag = this.exact.sequence[tagName];
789
+ if (exactTag) return exactTag;
790
+ for (const tag of this.prefix.sequence) if (tagName.startsWith(tag.tagName)) return tag;
791
+ }
792
+ /** @internal */
793
+ lookupMappingTag(tagName) {
794
+ const exactTag = this.exact.mapping[tagName];
795
+ if (exactTag) return exactTag;
796
+ for (const tag of this.prefix.mapping) if (tagName.startsWith(tag.tagName)) return tag;
797
+ }
798
+ /** @internal */
799
+ resolveImplicitScalarTag(source) {
800
+ const candidates = this.implicitScalarByFirstChar.get(source.charAt(0)) ?? this.implicitScalarAnyFirstChar;
801
+ for (const tag2 of candidates) {
802
+ const value = tag2.resolve(source, false, tag2.tagName);
803
+ if (value !== NOT_RESOLVED) return {
804
+ value,
805
+ tag: tag2
806
+ };
807
+ }
808
+ const tag = this.defaultScalarTag;
809
+ return {
810
+ value: tag.resolve(source, false, tag.tagName),
811
+ tag
812
+ };
813
+ }
814
+ /**
815
+ * Creates a new schema with the specified tags added. If a tag already
816
+ * exists, it is replaced by the specified tag.
817
+ *
818
+ * @example
819
+ *
820
+ * ```javascript
821
+ * import { CORE_SCHEMA, mergeTag, realMapTag } from 'js-yaml'
822
+ *
823
+ * const schema = CORE_SCHEMA.withTags(mergeTag, realMapTag)
824
+ * ```
825
+ */
826
+ withTags(...tags) {
827
+ let flatTags = [];
828
+ for (const tag of tags) flatTags = flatTags.concat(tag);
829
+ return new Schema2([...this.tags, ...flatTags]);
830
+ }
831
+ };
832
+ var FAILSAFE_SCHEMA = new Schema([
833
+ strTag,
834
+ seqTag,
835
+ mapTag
836
+ ]);
837
+ var JSON_SCHEMA = new Schema([
838
+ ...FAILSAFE_SCHEMA.tags,
839
+ nullJsonTag,
840
+ boolJsonTag,
841
+ intJsonTag,
842
+ floatJsonTag
843
+ ]);
844
+ var CORE_SCHEMA = new Schema([
845
+ ...FAILSAFE_SCHEMA.tags,
846
+ nullCoreTag,
847
+ boolCoreTag,
848
+ intCoreTag,
849
+ floatCoreTag
850
+ ]);
851
+ var YAML11_SCHEMA = new Schema([
852
+ ...FAILSAFE_SCHEMA.tags,
853
+ nullYaml11Tag,
854
+ boolYaml11Tag,
855
+ intYaml11Tag,
856
+ floatYaml11Tag,
857
+ timestampTag,
858
+ mergeTag,
859
+ binaryTag,
860
+ omapTag,
861
+ pairsTag,
862
+ setTag
863
+ ]);
864
+ var DUMP_SCHEMA = YAML11_SCHEMA.withTags({
865
+ ...intYaml11Tag,
866
+ resolve: (source, isExplicit, tagName) => {
867
+ const result = intYaml11Tag.resolve(source, isExplicit, tagName);
868
+ return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result;
869
+ }
870
+ }, {
871
+ ...floatYaml11Tag,
872
+ resolve: (source, isExplicit, tagName) => {
873
+ const result = floatYaml11Tag.resolve(source, isExplicit, tagName);
874
+ return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result;
875
+ }
876
+ });
877
+ var realMapTag = defineMappingTag("tag:yaml.org,2002:map", {
878
+ create: () => /* @__PURE__ */ new Map(),
879
+ addPair: (container, key, value) => {
880
+ container.set(key, value);
881
+ return "";
882
+ },
883
+ has: (container, key) => container.has(key),
884
+ keys: (container) => container.keys(),
885
+ get: (container, key) => container.get(key),
886
+ identify: (data) => data instanceof Map || isPlainObject(data),
887
+ represent: (data) => {
888
+ if (data instanceof Map) return data;
889
+ const map = /* @__PURE__ */ new Map();
890
+ const obj = data;
891
+ for (const key of Object.keys(obj)) map.set(key, obj[key]);
892
+ return map;
893
+ }
894
+ });
895
+ function normalizeKey(key) {
896
+ if (Array.isArray(key)) {
897
+ const array = Array.prototype.slice.call(key);
898
+ for (let index = 0; index < array.length; index++) {
899
+ if (Array.isArray(array[index])) return null;
900
+ if (typeof array[index] === "object" && Object.prototype.toString.call(array[index]) === "[object Object]") array[index] = "[object Object]";
901
+ }
902
+ return String(array);
903
+ }
904
+ if (typeof key === "object" && Object.prototype.toString.call(key) === "[object Object]") return "[object Object]";
905
+ return String(key);
906
+ }
907
+ var legacyMapTag = defineMappingTag("tag:yaml.org,2002:map", {
908
+ create: () => ({}),
909
+ identify: isPlainObject,
910
+ represent: (o) => {
911
+ const map = /* @__PURE__ */ new Map();
912
+ for (const key of Object.keys(o)) map.set(key, o[key]);
913
+ return map;
914
+ },
915
+ addPair: (container, key, value) => {
916
+ const normalizedKey = normalizeKey(key);
917
+ if (normalizedKey === null) return "nested arrays are not supported inside keys";
918
+ if (normalizedKey === "__proto__") Object.defineProperty(container, normalizedKey, {
919
+ value,
920
+ enumerable: true,
921
+ configurable: true,
922
+ writable: true
923
+ });
924
+ else container[normalizedKey] = value;
925
+ return "";
926
+ },
927
+ has: (container, key) => {
928
+ const normalizedKey = normalizeKey(key);
929
+ return normalizedKey !== null && Object.prototype.hasOwnProperty.call(container, normalizedKey);
930
+ },
931
+ keys: (container) => Object.keys(container),
932
+ get: (container, key) => {
933
+ const normalizedKey = String(key);
934
+ if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
935
+ return container[normalizedKey];
936
+ }
937
+ });
938
+ var DEFAULT_SNIPPET_OPTIONS = {
939
+ maxLength: 79,
940
+ indent: 1,
941
+ linesBefore: 3,
942
+ linesAfter: 2
943
+ };
944
+ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
945
+ let head = "";
946
+ let tail = "";
947
+ const maxHalfLength = Math.floor(maxLineLength / 2) - 1;
948
+ if (position - lineStart > maxHalfLength) {
949
+ head = " ... ";
950
+ lineStart = position - maxHalfLength + head.length;
951
+ }
952
+ if (lineEnd - position > maxHalfLength) {
953
+ tail = " ...";
954
+ lineEnd = position + maxHalfLength - tail.length;
955
+ }
956
+ return {
957
+ str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
958
+ pos: position - lineStart + head.length
959
+ };
960
+ }
961
+ function padStart(string, max) {
962
+ return " ".repeat(Math.max(max - string.length, 0)) + string;
963
+ }
964
+ function makeSnippet(mark, options) {
965
+ if (!mark.buffer) return null;
966
+ const opts = {
967
+ ...DEFAULT_SNIPPET_OPTIONS,
968
+ ...options
969
+ };
970
+ const re = /\r?\n|\r|\0/g;
971
+ const lineStarts = [0];
972
+ const lineEnds = [];
973
+ let match;
974
+ let foundLineNo = -1;
975
+ while (match = re.exec(mark.buffer)) {
976
+ lineEnds.push(match.index);
977
+ lineStarts.push(match.index + match[0].length);
978
+ if (mark.position <= match.index && foundLineNo < 0) foundLineNo = lineStarts.length - 2;
979
+ }
980
+ if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
981
+ let result = "";
982
+ const lineNoLength = Math.min(mark.line + opts.linesAfter, lineEnds.length).toString().length;
983
+ const maxLineLength = opts.maxLength - (opts.indent + lineNoLength + 3);
984
+ for (let i = 1; i <= opts.linesBefore; i++) {
985
+ if (foundLineNo - i < 0) break;
986
+ const line2 = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
987
+ result = `${" ".repeat(opts.indent)}${padStart((mark.line - i + 1).toString(), lineNoLength)} | ${line2.str}
988
+ ${result}`;
989
+ }
990
+ const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
991
+ result += `${" ".repeat(opts.indent)}${padStart((mark.line + 1).toString(), lineNoLength)} | ${line.str}
992
+ `;
993
+ result += `${"-".repeat(opts.indent + lineNoLength + 3 + line.pos)}^
994
+ `;
995
+ for (let i = 1; i <= opts.linesAfter; i++) {
996
+ if (foundLineNo + i >= lineEnds.length) break;
997
+ const line2 = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
998
+ result += `${" ".repeat(opts.indent)}${padStart((mark.line + i + 1).toString(), lineNoLength)} | ${line2.str}
999
+ `;
1000
+ }
1001
+ return result.replace(/\n$/, "");
1002
+ }
1003
+ function formatError(exception, compact) {
1004
+ let where = "";
1005
+ if (!exception.mark) return exception.reason;
1006
+ if (exception.mark.name) where += `in "${exception.mark.name}" `;
1007
+ where += `(${exception.mark.line + 1}:${exception.mark.column + 1})`;
1008
+ if (!compact && exception.mark.snippet) where += `
1009
+
1010
+ ${exception.mark.snippet}`;
1011
+ return `${exception.reason} ${where}`;
1012
+ }
1013
+ var YAMLException = class YAMLException2 extends Error {
1014
+ reason;
1015
+ mark;
1016
+ /**
1017
+ * Optional `mark` contains source snippet data. Usually, use
1018
+ * {@link YAMLException.throwAt} instead of passing it directly.
1019
+ */
1020
+ constructor(reason, mark) {
1021
+ super();
1022
+ this.name = "YAMLException";
1023
+ this.reason = reason;
1024
+ this.mark = mark;
1025
+ this.message = formatError(this, false);
1026
+ if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
1027
+ }
1028
+ /**
1029
+ * Returns the formatted error, omitting the source snippet in compact mode.
1030
+ */
1031
+ toString(compact) {
1032
+ return `${this.name}: ${formatError(this, compact)}`;
1033
+ }
1034
+ /**
1035
+ * Builds a YAMLException with a source snippet and throws it. `source` is
1036
+ * the raw input text; `position` is an offset into it.
1037
+ */
1038
+ static throwAt(source, position, message, filename = "") {
1039
+ let line = 0;
1040
+ let lineStart = 0;
1041
+ for (let index = 0; index < position; index++) {
1042
+ const ch = source.charCodeAt(index);
1043
+ if (ch === 10) {
1044
+ line++;
1045
+ lineStart = index + 1;
1046
+ } else if (ch === 13) {
1047
+ line++;
1048
+ if (source.charCodeAt(index + 1) === 10) index++;
1049
+ lineStart = index + 1;
1050
+ }
1051
+ }
1052
+ const mark = {
1053
+ name: filename,
1054
+ buffer: source,
1055
+ position,
1056
+ line,
1057
+ column: position - lineStart
1058
+ };
1059
+ mark.snippet = makeSnippet(mark);
1060
+ throw new YAMLException2(message, mark);
1061
+ }
1062
+ };
1063
+ var EVENT_ID = {
1064
+ DOCUMENT: 1,
1065
+ SEQUENCE: 2,
1066
+ MAPPING: 3,
1067
+ SCALAR: 4,
1068
+ ALIAS: 5,
1069
+ POP: 6
1070
+ };
1071
+ var SCALAR_STYLE = {
1072
+ PLAIN: 1,
1073
+ SINGLE_QUOTED: 2,
1074
+ DOUBLE_QUOTED: 3,
1075
+ LITERAL_BLOCK: 4,
1076
+ FOLDED_BLOCK: 5
1077
+ };
1078
+ var COLLECTION_STYLE = {
1079
+ BLOCK: 1,
1080
+ FLOW: 2
1081
+ };
1082
+ var CHOMPING_MODE = {
1083
+ CLIP: 1,
1084
+ STRIP: 2,
1085
+ KEEP: 3
1086
+ };
1087
+ var NO_RANGE$3 = -1;
1088
+ function simpleEscapeSequence(c) {
1089
+ switch (c) {
1090
+ case 48:
1091
+ return "\0";
1092
+ case 97:
1093
+ return "\x07";
1094
+ case 98:
1095
+ return "\b";
1096
+ case 116:
1097
+ return " ";
1098
+ case 9:
1099
+ return " ";
1100
+ case 110:
1101
+ return "\n";
1102
+ case 118:
1103
+ return "\v";
1104
+ case 102:
1105
+ return "\f";
1106
+ case 114:
1107
+ return "\r";
1108
+ case 101:
1109
+ return "\x1B";
1110
+ case 32:
1111
+ return " ";
1112
+ case 34:
1113
+ return '"';
1114
+ case 47:
1115
+ return "/";
1116
+ case 92:
1117
+ return "\\";
1118
+ case 78:
1119
+ return "\x85";
1120
+ case 95:
1121
+ return "\xA0";
1122
+ case 76:
1123
+ return "\u2028";
1124
+ case 80:
1125
+ return "\u2029";
1126
+ default:
1127
+ return "";
1128
+ }
1129
+ }
1130
+ var simpleEscapeCheck = new Array(256);
1131
+ var simpleEscapeMap = new Array(256);
1132
+ for (let i = 0; i < 256; i++) {
1133
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
1134
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
1135
+ }
1136
+ function charFromCodepoint(c) {
1137
+ if (c <= 65535) return String.fromCharCode(c);
1138
+ return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
1139
+ }
1140
+ function fromHexCode$1(c) {
1141
+ if (c >= 48 && c <= 57) return c - 48;
1142
+ return (c | 32) - 97 + 10;
1143
+ }
1144
+ function escapedHexLen$1(c) {
1145
+ if (c === 120) return 2;
1146
+ if (c === 117) return 4;
1147
+ return 8;
1148
+ }
1149
+ function skipFoldedBreaks(input, position, end) {
1150
+ let breaks = 0;
1151
+ while (position < end) {
1152
+ const ch = input.charCodeAt(position);
1153
+ if (ch === 10) {
1154
+ breaks++;
1155
+ position++;
1156
+ } else if (ch === 13) {
1157
+ breaks++;
1158
+ position++;
1159
+ if (input.charCodeAt(position) === 10) position++;
1160
+ } else if (ch === 32 || ch === 9) position++;
1161
+ else break;
1162
+ }
1163
+ return {
1164
+ position,
1165
+ breaks
1166
+ };
1167
+ }
1168
+ function foldedBreaks(count) {
1169
+ if (count === 1) return " ";
1170
+ return "\n".repeat(count - 1);
1171
+ }
1172
+ function getPlainValue(input, start, end) {
1173
+ let result = "";
1174
+ let position = start;
1175
+ let captureStart = start;
1176
+ let captureEnd = start;
1177
+ while (position < end) {
1178
+ const ch = input.charCodeAt(position);
1179
+ if (ch === 10 || ch === 13) {
1180
+ result += input.slice(captureStart, captureEnd);
1181
+ const fold = skipFoldedBreaks(input, position, end);
1182
+ result += foldedBreaks(fold.breaks);
1183
+ position = captureStart = captureEnd = fold.position;
1184
+ } else {
1185
+ position++;
1186
+ if (ch !== 32 && ch !== 9) captureEnd = position;
1187
+ }
1188
+ }
1189
+ return result + input.slice(captureStart, captureEnd);
1190
+ }
1191
+ function getSingleQuotedValue(input, start, end) {
1192
+ let result = "";
1193
+ let position = start;
1194
+ let captureStart = start;
1195
+ let captureEnd = start;
1196
+ while (position < end) {
1197
+ const ch = input.charCodeAt(position);
1198
+ if (ch === 39) {
1199
+ result += input.slice(captureStart, position) + "'";
1200
+ position += 2;
1201
+ captureStart = captureEnd = position;
1202
+ } else if (ch === 10 || ch === 13) {
1203
+ result += input.slice(captureStart, captureEnd);
1204
+ const fold = skipFoldedBreaks(input, position, end);
1205
+ result += foldedBreaks(fold.breaks);
1206
+ position = captureStart = captureEnd = fold.position;
1207
+ } else {
1208
+ position++;
1209
+ if (ch !== 32 && ch !== 9) captureEnd = position;
1210
+ }
1211
+ }
1212
+ return result + input.slice(captureStart, end);
1213
+ }
1214
+ function getDoubleQuotedValue(input, start, end) {
1215
+ let result = "";
1216
+ let position = start;
1217
+ let captureStart = start;
1218
+ let captureEnd = start;
1219
+ while (position < end) {
1220
+ const ch = input.charCodeAt(position);
1221
+ if (ch === 92) {
1222
+ result += input.slice(captureStart, position);
1223
+ position++;
1224
+ const escaped = input.charCodeAt(position);
1225
+ if (escaped === 10 || escaped === 13) position = skipFoldedBreaks(input, position, end).position;
1226
+ else if (escaped < 256 && simpleEscapeCheck[escaped]) {
1227
+ result += simpleEscapeMap[escaped];
1228
+ position++;
1229
+ } else {
1230
+ let hexLength = escapedHexLen$1(escaped);
1231
+ let hexResult = 0;
1232
+ for (; hexLength > 0; hexLength--) {
1233
+ position++;
1234
+ const digit = fromHexCode$1(input.charCodeAt(position));
1235
+ hexResult = (hexResult << 4) + digit;
1236
+ }
1237
+ result += charFromCodepoint(hexResult);
1238
+ position++;
1239
+ }
1240
+ captureStart = captureEnd = position;
1241
+ } else if (ch === 10 || ch === 13) {
1242
+ result += input.slice(captureStart, captureEnd);
1243
+ const fold = skipFoldedBreaks(input, position, end);
1244
+ result += foldedBreaks(fold.breaks);
1245
+ position = captureStart = captureEnd = fold.position;
1246
+ } else {
1247
+ position++;
1248
+ if (ch !== 32 && ch !== 9) captureEnd = position;
1249
+ }
1250
+ }
1251
+ return result + input.slice(captureStart, end);
1252
+ }
1253
+ function getBlockValue(input, start, end, indent, chomping, folded) {
1254
+ const textIndent = indent < 0 ? 0 : indent;
1255
+ const region = input.slice(start, end).replace(/\r\n?/g, "\n");
1256
+ const lines = region === "" ? [] : (region.endsWith("\n") ? region.slice(0, -1) : region).split("\n");
1257
+ let result = "";
1258
+ let didReadContent = false;
1259
+ let emptyLines = 0;
1260
+ let atMoreIndented = false;
1261
+ for (const line of lines) {
1262
+ let column = 0;
1263
+ while (column < textIndent && line.charCodeAt(column) === 32) column++;
1264
+ if (indent < 0 || column >= line.length) {
1265
+ emptyLines++;
1266
+ continue;
1267
+ }
1268
+ const content = line.slice(textIndent);
1269
+ const first = content.charCodeAt(0);
1270
+ if (folded) if (first === 32 || first === 9) {
1271
+ atMoreIndented = true;
1272
+ result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
1273
+ } else if (atMoreIndented) {
1274
+ atMoreIndented = false;
1275
+ result += "\n".repeat(emptyLines + 1);
1276
+ } else if (emptyLines === 0) {
1277
+ if (didReadContent) result += " ";
1278
+ } else result += "\n".repeat(emptyLines);
1279
+ else result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
1280
+ result += content;
1281
+ didReadContent = true;
1282
+ emptyLines = 0;
1283
+ }
1284
+ if (chomping === CHOMPING_MODE.KEEP) result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
1285
+ else if (chomping !== CHOMPING_MODE.STRIP) {
1286
+ if (didReadContent) result += "\n";
1287
+ }
1288
+ return result;
1289
+ }
1290
+ function getScalarValue(input, scalar) {
1291
+ if (scalar.valueStart === NO_RANGE$3) return "";
1292
+ const { valueStart, valueEnd } = scalar;
1293
+ if (scalar.fast) return input.slice(valueStart, valueEnd);
1294
+ switch (scalar.style) {
1295
+ case SCALAR_STYLE.SINGLE_QUOTED:
1296
+ return getSingleQuotedValue(input, valueStart, valueEnd);
1297
+ case SCALAR_STYLE.DOUBLE_QUOTED:
1298
+ return getDoubleQuotedValue(input, valueStart, valueEnd);
1299
+ case SCALAR_STYLE.LITERAL_BLOCK:
1300
+ return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, false);
1301
+ case SCALAR_STYLE.FOLDED_BLOCK:
1302
+ return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, true);
1303
+ default:
1304
+ return getPlainValue(input, valueStart, valueEnd);
1305
+ }
1306
+ }
1307
+ var DEFAULT_TAG_HANDLERS = Object.assign(/* @__PURE__ */ Object.create(null), {
1308
+ "!": "!",
1309
+ "!!": "tag:yaml.org,2002:"
1310
+ });
1311
+ function tagPercentEncode(source) {
1312
+ return encodeURI(source).replace(/!/g, "%21");
1313
+ }
1314
+ function tagNameFull(rawTag2, tagHandlers) {
1315
+ if (rawTag2.startsWith("!<") && rawTag2.endsWith(">")) return decodeURIComponent(rawTag2.slice(2, -1));
1316
+ const handleEnd = rawTag2.indexOf("!", 1);
1317
+ const handle = handleEnd === -1 ? "!" : rawTag2.slice(0, handleEnd + 1);
1318
+ const prefix = tagHandlers?.[handle] ?? DEFAULT_TAG_HANDLERS[handle] ?? handle;
1319
+ return decodeURIComponent(prefix) + decodeURIComponent(rawTag2.slice(handle.length));
1320
+ }
1321
+ function tagNameShort(fullTag) {
1322
+ let tag = fullTag;
1323
+ if (tag.charCodeAt(0) === 33) {
1324
+ tag = tag.slice(1);
1325
+ return `!${tagPercentEncode(tag)}`;
1326
+ }
1327
+ if (tag.slice(0, 18) === "tag:yaml.org,2002:") return `!!${tagPercentEncode(tag.slice(18))}`;
1328
+ return `!<${tagPercentEncode(tag)}>`;
1329
+ }
1330
+ var NO_RANGE$2 = -1;
1331
+ var MERGE_TAG_NAME = "tag:yaml.org,2002:merge";
1332
+ var DEFAULT_CONSTRUCTOR_OPTIONS = {
1333
+ filename: "",
1334
+ schema: CORE_SCHEMA,
1335
+ json: false,
1336
+ maxTotalMergeKeys: 1e4,
1337
+ maxAliases: -1
1338
+ };
1339
+ function eventPosition$1(event) {
1340
+ if ("tagStart" in event && event.tagStart !== NO_RANGE$2) return event.tagStart;
1341
+ if ("anchorStart" in event && event.anchorStart !== NO_RANGE$2) return event.anchorStart;
1342
+ if ("valueStart" in event && event.valueStart !== NO_RANGE$2) return event.valueStart;
1343
+ if ("start" in event) return event.start;
1344
+ return 0;
1345
+ }
1346
+ function throwError$1(state, message) {
1347
+ YAMLException.throwAt(state.source, state.position, message, state.filename);
1348
+ }
1349
+ function finalizeCollection(state, position, tag, carrier) {
1350
+ try {
1351
+ return tag.finalize(carrier);
1352
+ } catch (error) {
1353
+ if (error instanceof YAMLException) throw error;
1354
+ YAMLException.throwAt(state.source, position, error instanceof Error ? error.message : String(error), state.filename);
1355
+ }
1356
+ }
1357
+ function constructScalar(state, event) {
1358
+ const source = getScalarValue(state.source, event);
1359
+ const rawTag2 = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
1360
+ const strTag2 = state.schema.defaultScalarTag;
1361
+ if (rawTag2 !== "") {
1362
+ if (rawTag2 === "!") return {
1363
+ value: source,
1364
+ tag: strTag2
1365
+ };
1366
+ const tagName = tagNameFull(rawTag2, state.tagHandlers);
1367
+ const scalarTag = state.schema.lookupScalarTag(tagName);
1368
+ if (scalarTag) {
1369
+ const result = scalarTag.resolve(source, true, tagName);
1370
+ if (result === NOT_RESOLVED) throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
1371
+ return {
1372
+ value: result,
1373
+ tag: scalarTag
1374
+ };
1375
+ }
1376
+ const collectionTagDef = state.schema.lookupMappingTag(tagName) ?? state.schema.lookupSequenceTag(tagName);
1377
+ if (collectionTagDef) {
1378
+ if (source !== "") throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
1379
+ const carrier = collectionTagDef.create(tagName);
1380
+ return {
1381
+ value: collectionTagDef.carrierIsResult ? carrier : finalizeCollection(state, state.position, collectionTagDef, carrier),
1382
+ tag: collectionTagDef
1383
+ };
1384
+ }
1385
+ throwError$1(state, `unknown scalar tag !<${tagName}>`);
1386
+ }
1387
+ if (event.style === SCALAR_STYLE.PLAIN) return state.schema.resolveImplicitScalarTag(source);
1388
+ return {
1389
+ value: strTag2.resolve(source, false, strTag2.tagName),
1390
+ tag: strTag2
1391
+ };
1392
+ }
1393
+ function collectionTagName(state, event, defaultTagName) {
1394
+ const rawTag2 = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
1395
+ return rawTag2 === "" || rawTag2 === "!" ? defaultTagName : tagNameFull(rawTag2, state.tagHandlers);
1396
+ }
1397
+ function isMappingTag(tag) {
1398
+ return tag.nodeKind === "mapping";
1399
+ }
1400
+ function chargeMergeWork(state) {
1401
+ state.totalMergeKeys++;
1402
+ if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) throwError$1(state, `merge keys exceeded maxTotalMergeKeys (${state.maxTotalMergeKeys})`);
1403
+ }
1404
+ function mergeKeys(state, frame, source, sourceTag) {
1405
+ chargeMergeWork(state);
1406
+ for (const sourceKey of sourceTag.keys(source)) {
1407
+ chargeMergeWork(state);
1408
+ if (frame.tag.has(frame.value, sourceKey)) continue;
1409
+ const err = frame.tag.addPair(frame.value, sourceKey, sourceTag.get(source, sourceKey));
1410
+ if (err) throwError$1(state, err);
1411
+ frame.overridable ??= /* @__PURE__ */ new Set();
1412
+ frame.overridable.add(sourceKey);
1413
+ }
1414
+ }
1415
+ function mergeSource(state, frame, source, sourceTag) {
1416
+ state.position = frame.keyPosition;
1417
+ if (isMappingTag(sourceTag)) mergeKeys(state, frame, source, sourceTag);
1418
+ else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) {
1419
+ if (source.length > 100) throwError$1(state, "abnormal merge sequence size");
1420
+ for (const element of source) {
1421
+ const elementTag = state.nodeTags.get(element);
1422
+ if (!elementTag) throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
1423
+ mergeKeys(state, frame, element, elementTag);
1424
+ }
1425
+ } else throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
1426
+ }
1427
+ function addMappingValue(state, frame, key, value, tag) {
1428
+ state.position = frame.keyPosition;
1429
+ if (frame.keyIsMerge) {
1430
+ mergeSource(state, frame, value, tag);
1431
+ return;
1432
+ }
1433
+ if (!state.json && frame.tag.has(frame.value, key) && !frame.overridable?.has(key)) throwError$1(state, "duplicated mapping key");
1434
+ const err = frame.tag.addPair(frame.value, key, value);
1435
+ if (err) throwError$1(state, err);
1436
+ frame.overridable?.delete(key);
1437
+ }
1438
+ function addValue(state, value, tag) {
1439
+ const frame = state.frames[state.frames.length - 1];
1440
+ if (frame.kind === "document") {
1441
+ frame.value = value;
1442
+ frame.hasValue = true;
1443
+ } else if (frame.kind === "sequence") {
1444
+ if (isMappingTag(tag)) state.nodeTags.set(value, tag);
1445
+ const err = frame.tag.addItem(frame.value, value, frame.index++);
1446
+ if (err) throwError$1(state, err);
1447
+ } else if (frame.hasKey) {
1448
+ const key = frame.key;
1449
+ frame.key = void 0;
1450
+ frame.hasKey = false;
1451
+ addMappingValue(state, frame, key, value, tag);
1452
+ } else {
1453
+ frame.key = value;
1454
+ frame.keyPosition = state.position;
1455
+ frame.hasKey = true;
1456
+ frame.keyIsMerge = tag.tagName === MERGE_TAG_NAME;
1457
+ }
1458
+ }
1459
+ function storeAnchor(state, event, value, tag, isValueFinal) {
1460
+ if (event.anchorStart !== NO_RANGE$2) {
1461
+ const anchor = {
1462
+ value,
1463
+ tag,
1464
+ isValueFinal
1465
+ };
1466
+ state.anchors.set(state.source.slice(event.anchorStart, event.anchorEnd), anchor);
1467
+ return anchor;
1468
+ }
1469
+ return null;
1470
+ }
1471
+ function constructFromEvents(events, options) {
1472
+ const state = {
1473
+ ...DEFAULT_CONSTRUCTOR_OPTIONS,
1474
+ ...options,
1475
+ events,
1476
+ documents: [],
1477
+ eventIndex: 0,
1478
+ position: 0,
1479
+ frames: [],
1480
+ anchors: /* @__PURE__ */ new Map(),
1481
+ nodeTags: /* @__PURE__ */ new Map(),
1482
+ tagHandlers: /* @__PURE__ */ Object.create(null),
1483
+ totalMergeKeys: 0,
1484
+ aliasCount: 0
1485
+ };
1486
+ while (state.eventIndex < state.events.length) {
1487
+ const event = state.events[state.eventIndex++];
1488
+ state.position = eventPosition$1(event);
1489
+ switch (event.type) {
1490
+ case EVENT_ID.DOCUMENT:
1491
+ state.anchors = /* @__PURE__ */ new Map();
1492
+ state.nodeTags = /* @__PURE__ */ new Map();
1493
+ state.aliasCount = 0;
1494
+ state.tagHandlers = /* @__PURE__ */ Object.create(null);
1495
+ for (const directive of event.directives) if (directive.kind === "tag") state.tagHandlers[directive.handle] = directive.prefix;
1496
+ state.frames.push({
1497
+ kind: "document",
1498
+ position: state.position,
1499
+ value: void 0,
1500
+ hasValue: false
1501
+ });
1502
+ break;
1503
+ case EVENT_ID.SCALAR: {
1504
+ const { value, tag } = constructScalar(state, event);
1505
+ storeAnchor(state, event, value, tag, true);
1506
+ addValue(state, value, tag);
1507
+ break;
1508
+ }
1509
+ case EVENT_ID.SEQUENCE: {
1510
+ const tagName = collectionTagName(state, event, "tag:yaml.org,2002:seq");
1511
+ const tag = state.schema.lookupSequenceTag(tagName);
1512
+ if (!tag) throwError$1(state, `unknown sequence tag !<${tagName}>`);
1513
+ const value = tag.create(tagName);
1514
+ const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult);
1515
+ state.frames.push({
1516
+ kind: "sequence",
1517
+ position: state.position,
1518
+ value,
1519
+ tag,
1520
+ anchor,
1521
+ index: 0
1522
+ });
1523
+ break;
1524
+ }
1525
+ case EVENT_ID.MAPPING: {
1526
+ const tagName = collectionTagName(state, event, "tag:yaml.org,2002:map");
1527
+ const tag = state.schema.lookupMappingTag(tagName);
1528
+ if (!tag) throwError$1(state, `unknown mapping tag !<${tagName}>`);
1529
+ const value = tag.create(tagName);
1530
+ const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult);
1531
+ state.frames.push({
1532
+ kind: "mapping",
1533
+ position: state.position,
1534
+ value,
1535
+ tag,
1536
+ anchor,
1537
+ key: void 0,
1538
+ keyPosition: state.position,
1539
+ hasKey: false,
1540
+ keyIsMerge: false,
1541
+ overridable: null
1542
+ });
1543
+ break;
1544
+ }
1545
+ case EVENT_ID.ALIAS: {
1546
+ if (state.maxAliases !== -1 && ++state.aliasCount > state.maxAliases) throwError$1(state, `aliases exceeded maxAliases (${state.maxAliases})`);
1547
+ const name = state.source.slice(event.anchorStart, event.anchorEnd);
1548
+ const anchor = state.anchors.get(name);
1549
+ if (!anchor) throwError$1(state, `unidentified alias "${name}"`);
1550
+ if (!anchor.isValueFinal) throwError$1(state, `recursive alias "${name}" is not supported for tag ${anchor.tag.tagName} because it uses finalize()`);
1551
+ addValue(state, anchor.value, anchor.tag);
1552
+ break;
1553
+ }
1554
+ case EVENT_ID.POP: {
1555
+ const frame = state.frames.pop();
1556
+ if (frame.kind === "mapping" && frame.hasKey) {
1557
+ state.position = frame.keyPosition;
1558
+ throwError$1(state, "incomplete mapping pair in event stream");
1559
+ }
1560
+ if (frame.kind === "document") state.documents.push(frame.value);
1561
+ else {
1562
+ const value = frame.tag.carrierIsResult ? frame.value : finalizeCollection(state, frame.position, frame.tag, frame.value);
1563
+ if (frame.anchor) {
1564
+ frame.anchor.value = value;
1565
+ frame.anchor.isValueFinal = true;
1566
+ }
1567
+ addValue(state, value, frame.tag);
1568
+ }
1569
+ break;
1570
+ }
1571
+ }
1572
+ }
1573
+ return state.documents;
1574
+ }
1575
+ var NO_RANGE$1 = -1;
1576
+ var HAS_OWN = Object.prototype.hasOwnProperty;
1577
+ var CONTEXT_FLOW_IN = 1;
1578
+ var CONTEXT_FLOW_OUT = 2;
1579
+ var CONTEXT_BLOCK_IN = 3;
1580
+ var CONTEXT_BLOCK_OUT = 4;
1581
+ var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
1582
+ var PATTERN_FLOW_INDICATORS = /[,\[\]{}]/;
1583
+ var PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/;
1584
+ var NS_URI_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`;
1585
+ var NS_TAG_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`;
1586
+ var PATTERN_TAG_URI = new RegExp(`^(?:${NS_URI_CHAR})*$`);
1587
+ var PATTERN_TAG_SUFFIX = new RegExp(`^(?:${NS_TAG_CHAR})+$`);
1588
+ var PATTERN_TAG_PREFIX = new RegExp(`^(?:!(?:${NS_URI_CHAR})*|${NS_TAG_CHAR}(?:${NS_URI_CHAR})*)$`);
1589
+ var DEFAULT_PARSER_OPTIONS = {
1590
+ filename: "",
1591
+ maxDepth: 100
1592
+ };
1593
+ function addDocumentEvent(state, explicitStart, explicitEnd) {
1594
+ state.events.push({
1595
+ type: EVENT_ID.DOCUMENT,
1596
+ explicitStart,
1597
+ explicitEnd,
1598
+ directives: state.directives
1599
+ });
1600
+ }
1601
+ function addSequenceEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
1602
+ state.events.push({
1603
+ type: EVENT_ID.SEQUENCE,
1604
+ start,
1605
+ anchorStart,
1606
+ anchorEnd,
1607
+ tagStart,
1608
+ tagEnd,
1609
+ style
1610
+ });
1611
+ }
1612
+ function addMappingEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
1613
+ state.events.push({
1614
+ type: EVENT_ID.MAPPING,
1615
+ start,
1616
+ anchorStart,
1617
+ anchorEnd,
1618
+ tagStart,
1619
+ tagEnd,
1620
+ style
1621
+ });
1622
+ }
1623
+ function insertFlowPairMappingEvent(state, snapshot) {
1624
+ state.events.splice(snapshot.eventsLength, 0, {
1625
+ type: EVENT_ID.MAPPING,
1626
+ start: snapshot.position,
1627
+ anchorStart: NO_RANGE$1,
1628
+ anchorEnd: NO_RANGE$1,
1629
+ tagStart: NO_RANGE$1,
1630
+ tagEnd: NO_RANGE$1,
1631
+ style: COLLECTION_STYLE.FLOW
1632
+ });
1633
+ }
1634
+ function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tagStart, tagEnd, style, chomping = CHOMPING_MODE.CLIP, indent = -1, fast = false) {
1635
+ state.events.push({
1636
+ type: EVENT_ID.SCALAR,
1637
+ valueStart,
1638
+ valueEnd,
1639
+ anchorStart,
1640
+ anchorEnd,
1641
+ tagStart,
1642
+ tagEnd,
1643
+ style,
1644
+ chomping,
1645
+ indent,
1646
+ fast
1647
+ });
1648
+ }
1649
+ function addAliasEvent(state, anchorStart, anchorEnd) {
1650
+ state.events.push({
1651
+ type: EVENT_ID.ALIAS,
1652
+ anchorStart,
1653
+ anchorEnd
1654
+ });
1655
+ }
1656
+ function addPopEvent(state) {
1657
+ state.events.push({ type: EVENT_ID.POP });
1658
+ }
1659
+ function addEmptyScalarEvent(state) {
1660
+ addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, SCALAR_STYLE.PLAIN);
1661
+ }
1662
+ function emptyProperties() {
1663
+ return {
1664
+ anchorStart: NO_RANGE$1,
1665
+ anchorEnd: NO_RANGE$1,
1666
+ tagStart: NO_RANGE$1,
1667
+ tagEnd: NO_RANGE$1
1668
+ };
1669
+ }
1670
+ function snapshotState(state) {
1671
+ return {
1672
+ position: state.position,
1673
+ line: state.line,
1674
+ lineStart: state.lineStart,
1675
+ lineIndent: state.lineIndent,
1676
+ firstTabInLine: state.firstTabInLine,
1677
+ eventsLength: state.events.length
1678
+ };
1679
+ }
1680
+ function restoreState(state, snapshot) {
1681
+ state.position = snapshot.position;
1682
+ state.line = snapshot.line;
1683
+ state.lineStart = snapshot.lineStart;
1684
+ state.lineIndent = snapshot.lineIndent;
1685
+ state.firstTabInLine = snapshot.firstTabInLine;
1686
+ state.events.length = snapshot.eventsLength;
1687
+ }
1688
+ function throwError(state, message) {
1689
+ YAMLException.throwAt(state.input.slice(0, state.length), state.position, message, state.filename);
1690
+ }
1691
+ function isEol(c) {
1692
+ return c === 10 || c === 13;
1693
+ }
1694
+ function isWhiteSpace(c) {
1695
+ return c === 9 || c === 32;
1696
+ }
1697
+ function isWsOrEol(c) {
1698
+ return isWhiteSpace(c) || isEol(c);
1699
+ }
1700
+ function isWsOrEolOrEnd(c) {
1701
+ return c === 0 || isWsOrEol(c);
1702
+ }
1703
+ function isFlowIndicator(c) {
1704
+ return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
1705
+ }
1706
+ function fromDecimalCode(c) {
1707
+ return c >= 48 && c <= 57 ? c - 48 : -1;
1708
+ }
1709
+ function fromHexCode(c) {
1710
+ if (c >= 48 && c <= 57) return c - 48;
1711
+ const lc = c | 32;
1712
+ if (lc >= 97 && lc <= 102) return lc - 97 + 10;
1713
+ return -1;
1714
+ }
1715
+ function escapedHexLen(c) {
1716
+ if (c === 120) return 2;
1717
+ if (c === 117) return 4;
1718
+ if (c === 85) return 8;
1719
+ return 0;
1720
+ }
1721
+ function isSimpleEscape(c) {
1722
+ return c === 48 || c === 97 || c === 98 || c === 116 || c === 9 || c === 110 || c === 118 || c === 102 || c === 114 || c === 101 || c === 32 || c === 34 || c === 47 || c === 92 || c === 78 || c === 95 || c === 76 || c === 80;
1723
+ }
1724
+ function consumeLineBreak(state) {
1725
+ if (state.input.charCodeAt(state.position) === 10) state.position++;
1726
+ else {
1727
+ state.position++;
1728
+ if (state.input.charCodeAt(state.position) === 10) state.position++;
1729
+ }
1730
+ state.line++;
1731
+ state.lineStart = state.position;
1732
+ state.lineIndent = 0;
1733
+ state.firstTabInLine = -1;
1734
+ }
1735
+ function skipSeparationSpace(state, allowComments) {
1736
+ let lineBreaks = 0;
1737
+ let ch = state.input.charCodeAt(state.position);
1738
+ let hasSeparation = state.position === state.lineStart || isWsOrEol(state.input.charCodeAt(state.position - 1));
1739
+ while (ch !== 0) {
1740
+ while (isWhiteSpace(ch)) {
1741
+ hasSeparation = true;
1742
+ if (ch === 9 && state.firstTabInLine === -1) state.firstTabInLine = state.position;
1743
+ ch = state.input.charCodeAt(++state.position);
1744
+ }
1745
+ if (allowComments && hasSeparation && ch === 35) do
1746
+ ch = state.input.charCodeAt(++state.position);
1747
+ while (!isEol(ch) && ch !== 0);
1748
+ if (!isEol(ch)) break;
1749
+ consumeLineBreak(state);
1750
+ lineBreaks++;
1751
+ hasSeparation = true;
1752
+ ch = state.input.charCodeAt(state.position);
1753
+ while (ch === 32) {
1754
+ state.lineIndent++;
1755
+ ch = state.input.charCodeAt(++state.position);
1756
+ }
1757
+ }
1758
+ return lineBreaks;
1759
+ }
1760
+ function testDocumentSeparator(state, position = state.position) {
1761
+ const ch = state.input.charCodeAt(position);
1762
+ if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(position + 1) && ch === state.input.charCodeAt(position + 2)) {
1763
+ const following = state.input.charCodeAt(position + 3);
1764
+ return following === 0 || isWsOrEol(following);
1765
+ }
1766
+ return false;
1767
+ }
1768
+ function skipByteOrderMark(state) {
1769
+ if (state.position === state.lineStart && state.input.charCodeAt(state.position) === 65279) {
1770
+ state.position++;
1771
+ state.lineStart = state.position;
1772
+ }
1773
+ }
1774
+ function testDocumentBoundary(state) {
1775
+ if (state.position !== state.lineStart) return false;
1776
+ if (testDocumentSeparator(state)) return true;
1777
+ if (state.input.charCodeAt(state.position) !== 65279) return false;
1778
+ const snapshot = snapshotState(state);
1779
+ skipByteOrderMark(state);
1780
+ skipSeparationSpace(state, true);
1781
+ const ch = state.input.charCodeAt(state.position);
1782
+ const result = state.position === state.lineStart && (ch === 37 || ch === 45 && testDocumentSeparator(state));
1783
+ restoreState(state, snapshot);
1784
+ return result;
1785
+ }
1786
+ function skipUntilLineEnd(state) {
1787
+ let ch = state.input.charCodeAt(state.position);
1788
+ while (ch !== 0 && !isEol(ch)) ch = state.input.charCodeAt(++state.position);
1789
+ }
1790
+ function checkPrintable(state, start, end) {
1791
+ if (PATTERN_NON_PRINTABLE.test(state.input.slice(start, end))) throwError(state, "the stream contains non-printable characters");
1792
+ }
1793
+ function readTagProperty(state, props, inFlow) {
1794
+ if (state.input.charCodeAt(state.position) !== 33) return false;
1795
+ if (props.tagStart !== NO_RANGE$1) throwError(state, "duplication of a tag property");
1796
+ const start = state.position;
1797
+ let isVerbatim = false;
1798
+ let isNamed = false;
1799
+ let tagHandle = "!";
1800
+ let ch = state.input.charCodeAt(++state.position);
1801
+ if (ch === 60) {
1802
+ isVerbatim = true;
1803
+ ch = state.input.charCodeAt(++state.position);
1804
+ } else if (ch === 33) {
1805
+ isNamed = true;
1806
+ tagHandle = "!!";
1807
+ ch = state.input.charCodeAt(++state.position);
1808
+ }
1809
+ let suffixStart = state.position;
1810
+ let tagName;
1811
+ if (isVerbatim) {
1812
+ while (ch !== 0 && ch !== 62) ch = state.input.charCodeAt(++state.position);
1813
+ if (ch !== 62) throwError(state, "unexpected end of the stream within a verbatim tag");
1814
+ tagName = state.input.slice(suffixStart, state.position);
1815
+ state.position++;
1816
+ } else {
1817
+ while (ch !== 0 && !isWsOrEol(ch) && !(inFlow && isFlowIndicator(ch))) {
1818
+ if (ch === 33) if (!isNamed) {
1819
+ tagHandle = state.input.slice(suffixStart - 1, state.position + 1);
1820
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, "named tag handle cannot contain such characters");
1821
+ isNamed = true;
1822
+ suffixStart = state.position + 1;
1823
+ } else throwError(state, "tag suffix cannot contain exclamation marks");
1824
+ ch = state.input.charCodeAt(++state.position);
1825
+ }
1826
+ tagName = state.input.slice(suffixStart, state.position);
1827
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, "tag suffix cannot contain flow indicator characters");
1828
+ }
1829
+ if (tagName && !(isVerbatim ? PATTERN_TAG_URI.test(tagName) : PATTERN_TAG_SUFFIX.test(tagName))) throwError(state, `tag name cannot contain such characters: ${tagName}`);
1830
+ if (!isVerbatim && tagHandle !== "!" && tagHandle !== "!!" && !HAS_OWN.call(state.tagHandlers, tagHandle)) throwError(state, `undeclared tag handle "${tagHandle}"`);
1831
+ props.tagStart = start;
1832
+ props.tagEnd = state.position;
1833
+ return true;
1834
+ }
1835
+ function readAnchorProperty(state, props) {
1836
+ if (state.input.charCodeAt(state.position) !== 38) return false;
1837
+ if (props.anchorStart !== NO_RANGE$1) throwError(state, "duplication of an anchor property");
1838
+ state.position++;
1839
+ const start = state.position;
1840
+ while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) state.position++;
1841
+ if (state.position === start) throwError(state, "name of an anchor node must contain at least one character");
1842
+ props.anchorStart = start;
1843
+ props.anchorEnd = state.position;
1844
+ return true;
1845
+ }
1846
+ function readAlias(state, props) {
1847
+ if (state.input.charCodeAt(state.position) !== 42) return false;
1848
+ if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) throwError(state, "alias node should not have any properties");
1849
+ state.position++;
1850
+ const start = state.position;
1851
+ while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) state.position++;
1852
+ if (state.position === start) throwError(state, "name of an alias node must contain at least one character");
1853
+ addAliasEvent(state, start, state.position);
1854
+ return true;
1855
+ }
1856
+ function readFlowScalarBreak(state, nodeIndent) {
1857
+ skipSeparationSpace(state, false);
1858
+ if (state.lineIndent < nodeIndent) throwError(state, "deficient indentation");
1859
+ }
1860
+ function readSingleQuotedScalar(state, nodeIndent, props) {
1861
+ if (state.input.charCodeAt(state.position) !== 39) return false;
1862
+ state.position++;
1863
+ const start = state.position;
1864
+ let simple = true;
1865
+ while (state.input.charCodeAt(state.position) !== 0) {
1866
+ const ch = state.input.charCodeAt(state.position);
1867
+ if (ch === 39) {
1868
+ if (state.input.charCodeAt(state.position + 1) === 39) {
1869
+ simple = false;
1870
+ state.position += 2;
1871
+ continue;
1872
+ }
1873
+ const end = state.position;
1874
+ state.position++;
1875
+ addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.SINGLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple);
1876
+ return true;
1877
+ }
1878
+ if (isEol(ch)) {
1879
+ simple = false;
1880
+ readFlowScalarBreak(state, nodeIndent);
1881
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a single quoted scalar");
1882
+ else if (ch !== 9 && ch < 32) throwError(state, "expected valid JSON character");
1883
+ else state.position++;
1884
+ }
1885
+ throwError(state, "unexpected end of the stream within a single quoted scalar");
1886
+ }
1887
+ function readDoubleQuotedScalar(state, nodeIndent, props) {
1888
+ if (state.input.charCodeAt(state.position) !== 34) return false;
1889
+ state.position++;
1890
+ const start = state.position;
1891
+ let simple = true;
1892
+ while (state.input.charCodeAt(state.position) !== 0) {
1893
+ const ch = state.input.charCodeAt(state.position);
1894
+ if (ch === 34) {
1895
+ const end = state.position;
1896
+ state.position++;
1897
+ addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.DOUBLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple);
1898
+ return true;
1899
+ }
1900
+ if (ch === 92) {
1901
+ simple = false;
1902
+ const escaped = state.input.charCodeAt(++state.position);
1903
+ if (isEol(escaped)) readFlowScalarBreak(state, nodeIndent);
1904
+ else if (isSimpleEscape(escaped)) state.position++;
1905
+ else {
1906
+ let hexLength = escapedHexLen(escaped);
1907
+ if (hexLength === 0) throwError(state, "unknown escape sequence");
1908
+ while (hexLength-- > 0) {
1909
+ state.position++;
1910
+ if (fromHexCode(state.input.charCodeAt(state.position)) < 0) throwError(state, "expected hexadecimal character");
1911
+ }
1912
+ state.position++;
1913
+ }
1914
+ } else if (isEol(ch)) {
1915
+ simple = false;
1916
+ readFlowScalarBreak(state, nodeIndent);
1917
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a double quoted scalar");
1918
+ else if (ch !== 9 && ch < 32) throwError(state, "expected valid JSON character");
1919
+ else state.position++;
1920
+ }
1921
+ throwError(state, "unexpected end of the stream within a double quoted scalar");
1922
+ }
1923
+ function readBlockScalar(state, parentIndent, props) {
1924
+ const ch = state.input.charCodeAt(state.position);
1925
+ let chomping = CHOMPING_MODE.CLIP;
1926
+ let indent = -1;
1927
+ let detectedIndent = false;
1928
+ if (ch !== 124 && ch !== 62) return false;
1929
+ const style = ch === 124 ? SCALAR_STYLE.LITERAL_BLOCK : SCALAR_STYLE.FOLDED_BLOCK;
1930
+ state.position++;
1931
+ while (state.input.charCodeAt(state.position) !== 0) {
1932
+ const current = state.input.charCodeAt(state.position);
1933
+ const digit = fromDecimalCode(current);
1934
+ if (current === 43 || current === 45) {
1935
+ if (chomping !== CHOMPING_MODE.CLIP) throwError(state, "repeat of a chomping mode identifier");
1936
+ chomping = current === 43 ? CHOMPING_MODE.KEEP : CHOMPING_MODE.STRIP;
1937
+ state.position++;
1938
+ } else if (digit >= 0) {
1939
+ if (digit === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
1940
+ if (detectedIndent) throwError(state, "repeat of an indentation width identifier");
1941
+ indent = parentIndent + digit - 1;
1942
+ detectedIndent = true;
1943
+ state.position++;
1944
+ } else break;
1945
+ }
1946
+ let hadWhitespace = false;
1947
+ while (isWhiteSpace(state.input.charCodeAt(state.position))) {
1948
+ hadWhitespace = true;
1949
+ state.position++;
1950
+ }
1951
+ if (hadWhitespace && state.input.charCodeAt(state.position) === 35) skipUntilLineEnd(state);
1952
+ if (isEol(state.input.charCodeAt(state.position))) consumeLineBreak(state);
1953
+ else if (state.input.charCodeAt(state.position) !== 0) throwError(state, "a line break is expected");
1954
+ let contentIndent = detectedIndent ? indent : -1;
1955
+ let maxLeadingIndent = 0;
1956
+ const valueStart = state.position;
1957
+ let valueEnd = state.position;
1958
+ while (state.input.charCodeAt(state.position) !== 0) {
1959
+ const linePosition = state.position;
1960
+ let column = 0;
1961
+ while (state.input.charCodeAt(linePosition + column) === 32) column++;
1962
+ const first = state.input.charCodeAt(linePosition + column);
1963
+ if (first === 0) {
1964
+ if (contentIndent >= 0) {
1965
+ if (column > contentIndent) valueEnd = linePosition + column;
1966
+ } else if (column > 0) valueEnd = linePosition + column;
1967
+ break;
1968
+ }
1969
+ if (testDocumentBoundary(state)) break;
1970
+ if (!detectedIndent && contentIndent === -1 && isEol(first)) maxLeadingIndent = Math.max(maxLeadingIndent, column);
1971
+ if (!detectedIndent && contentIndent === -1 && !isEol(first)) {
1972
+ if (first === 9 && column < parentIndent) {
1973
+ state.position = linePosition + column;
1974
+ throwError(state, "tab characters must not be used in indentation");
1975
+ }
1976
+ if (column < maxLeadingIndent) {
1977
+ state.position = linePosition + column;
1978
+ throwError(state, "bad indentation of a mapping entry");
1979
+ }
1980
+ }
1981
+ if (contentIndent === -1 && first !== 0 && !isEol(first) && column < parentIndent) {
1982
+ state.lineIndent = column;
1983
+ state.position = linePosition + column;
1984
+ break;
1985
+ }
1986
+ if (!detectedIndent && first !== 0 && !isEol(first) && contentIndent === -1) contentIndent = column;
1987
+ const requiredIndent = contentIndent === -1 ? parentIndent + 1 : contentIndent;
1988
+ if (first !== 0 && !isEol(first) && column < requiredIndent) {
1989
+ state.lineIndent = column;
1990
+ state.position = linePosition + column;
1991
+ break;
1992
+ }
1993
+ skipUntilLineEnd(state);
1994
+ valueEnd = state.position;
1995
+ if (isEol(state.input.charCodeAt(state.position))) {
1996
+ consumeLineBreak(state);
1997
+ valueEnd = state.position;
1998
+ }
1999
+ }
2000
+ checkPrintable(state, valueStart, valueEnd);
2001
+ addScalarEvent(state, valueStart, valueEnd, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, style, chomping, contentIndent);
2002
+ return true;
2003
+ }
2004
+ function canStartPlainScalar(state, nodeContext) {
2005
+ const ch = state.input.charCodeAt(state.position);
2006
+ const inFlow = nodeContext === CONTEXT_FLOW_IN;
2007
+ if (ch === 0 || isWsOrEol(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96 || inFlow && isFlowIndicator(ch)) return false;
2008
+ if (ch === 63 || ch === 45) {
2009
+ const following = state.input.charCodeAt(state.position + 1);
2010
+ if (isWsOrEolOrEnd(following) || inFlow && isFlowIndicator(following)) return false;
2011
+ }
2012
+ return true;
2013
+ }
2014
+ function readPlainScalar(state, nodeIndent, nodeContext, props) {
2015
+ if (!canStartPlainScalar(state, nodeContext)) return false;
2016
+ const start = state.position;
2017
+ let end = state.position;
2018
+ let ch = state.input.charCodeAt(state.position);
2019
+ const inFlow = nodeContext === CONTEXT_FLOW_IN;
2020
+ let multiline = false;
2021
+ while (ch !== 0) {
2022
+ if (testDocumentBoundary(state)) break;
2023
+ if (ch === 58) {
2024
+ const following = state.input.charCodeAt(state.position + 1);
2025
+ if (isWsOrEolOrEnd(following) || inFlow && isFlowIndicator(following)) break;
2026
+ } else if (ch === 35) {
2027
+ if (isWsOrEol(state.input.charCodeAt(state.position - 1))) break;
2028
+ } else if (inFlow && isFlowIndicator(ch)) break;
2029
+ else if (isEol(ch)) {
2030
+ const savedPosition = state.position;
2031
+ const savedLine = state.line;
2032
+ const savedLineStart = state.lineStart;
2033
+ const savedLineIndent = state.lineIndent;
2034
+ skipSeparationSpace(state, false);
2035
+ if (state.lineIndent >= nodeIndent) {
2036
+ multiline = true;
2037
+ ch = state.input.charCodeAt(state.position);
2038
+ continue;
2039
+ }
2040
+ state.position = savedPosition;
2041
+ state.line = savedLine;
2042
+ state.lineStart = savedLineStart;
2043
+ state.lineIndent = savedLineIndent;
2044
+ break;
2045
+ }
2046
+ if (!isWhiteSpace(ch)) end = state.position + 1;
2047
+ ch = state.input.charCodeAt(++state.position);
2048
+ }
2049
+ if (end === start) return false;
2050
+ checkPrintable(state, start, end);
2051
+ addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.PLAIN, CHOMPING_MODE.CLIP, -1, !multiline);
2052
+ return true;
2053
+ }
2054
+ function skipFlowSeparationSpace(state, nodeIndent) {
2055
+ const startLine = state.line;
2056
+ skipSeparationSpace(state, true);
2057
+ if (state.line > startLine && state.lineIndent < nodeIndent || state.firstTabInLine !== -1 && state.lineIndent < nodeIndent) throwError(state, "deficient indentation");
2058
+ }
2059
+ function readFlowCollection(state, nodeIndent, props) {
2060
+ const ch = state.input.charCodeAt(state.position);
2061
+ const isMapping = ch === 123;
2062
+ const start = state.position;
2063
+ let readNext = true;
2064
+ if (ch !== 91 && ch !== 123) return false;
2065
+ const terminator = isMapping ? 125 : 93;
2066
+ if (isMapping) addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW);
2067
+ else addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW);
2068
+ state.position++;
2069
+ while (state.input.charCodeAt(state.position) !== 0) {
2070
+ skipFlowSeparationSpace(state, nodeIndent);
2071
+ let ch2 = state.input.charCodeAt(state.position);
2072
+ if (ch2 === terminator) {
2073
+ state.position++;
2074
+ addPopEvent(state);
2075
+ return true;
2076
+ } else if (!readNext) throwError(state, "missed comma between flow collection entries");
2077
+ else if (ch2 === 44) throwError(state, "expected the node content, but found ','");
2078
+ let isPair = false;
2079
+ let isExplicitPair = false;
2080
+ if (ch2 === 63 && isWsOrEol(state.input.charCodeAt(state.position + 1))) {
2081
+ isPair = isExplicitPair = true;
2082
+ state.position += 1;
2083
+ skipFlowSeparationSpace(state, nodeIndent);
2084
+ }
2085
+ const entryLine = state.line;
2086
+ const entryStart = snapshotState(state);
2087
+ const keyWasRead = parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
2088
+ skipFlowSeparationSpace(state, nodeIndent);
2089
+ ch2 = state.input.charCodeAt(state.position);
2090
+ if ((isMapping || isExplicitPair || state.line === entryLine) && ch2 === 58) {
2091
+ isPair = true;
2092
+ state.position++;
2093
+ skipFlowSeparationSpace(state, nodeIndent);
2094
+ if (!isMapping) {
2095
+ insertFlowPairMappingEvent(state, entryStart);
2096
+ if (!keyWasRead) addEmptyScalarEvent(state);
2097
+ } else if (!keyWasRead) addEmptyScalarEvent(state);
2098
+ if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) addEmptyScalarEvent(state);
2099
+ skipFlowSeparationSpace(state, nodeIndent);
2100
+ if (!isMapping) addPopEvent(state);
2101
+ } else if (isMapping && isPair) {
2102
+ if (!keyWasRead) addEmptyScalarEvent(state);
2103
+ addEmptyScalarEvent(state);
2104
+ } else if (isMapping) addEmptyScalarEvent(state);
2105
+ else if (isPair) {
2106
+ insertFlowPairMappingEvent(state, entryStart);
2107
+ if (!keyWasRead) addEmptyScalarEvent(state);
2108
+ addEmptyScalarEvent(state);
2109
+ addPopEvent(state);
2110
+ }
2111
+ ch2 = state.input.charCodeAt(state.position);
2112
+ if (ch2 === 44) {
2113
+ readNext = true;
2114
+ state.position++;
2115
+ } else readNext = false;
2116
+ }
2117
+ throwError(state, "unexpected end of the stream within a flow collection");
2118
+ }
2119
+ function readBlockSequence(state, nodeIndent, props) {
2120
+ if (state.firstTabInLine !== -1 || state.input.charCodeAt(state.position) !== 45 || !isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) return false;
2121
+ addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
2122
+ while (state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {
2123
+ if (state.firstTabInLine !== -1) {
2124
+ state.position = state.firstTabInLine;
2125
+ throwError(state, "tab characters must not be used in indentation");
2126
+ }
2127
+ const entryLine = state.line;
2128
+ state.position++;
2129
+ const hadBreak = skipSeparationSpace(state, true) > 0;
2130
+ if (state.firstTabInLine !== -1 && state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) throwError(state, "bad indentation of a sequence entry");
2131
+ if (hadBreak && state.lineIndent <= nodeIndent) addEmptyScalarEvent(state);
2132
+ else parseNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
2133
+ skipSeparationSpace(state, true);
2134
+ if (state.lineIndent < nodeIndent || state.position >= state.length) break;
2135
+ if (state.lineIndent > nodeIndent) throwError(state, "bad indentation of a sequence entry");
2136
+ if (state.line === entryLine && state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) throwError(state, "bad indentation of a sequence entry");
2137
+ }
2138
+ addPopEvent(state);
2139
+ return true;
2140
+ }
2141
+ function readBlockMapping(state, nodeIndent, flowIndent, props) {
2142
+ let atExplicitKey = false;
2143
+ let detected = false;
2144
+ let mappingOpened = false;
2145
+ let pendingExplicitKey = false;
2146
+ if (state.firstTabInLine !== -1) return false;
2147
+ let ch = state.input.charCodeAt(state.position);
2148
+ while (ch !== 0) {
2149
+ if (!atExplicitKey && state.firstTabInLine !== -1) {
2150
+ state.position = state.firstTabInLine;
2151
+ throwError(state, "tab characters must not be used in indentation");
2152
+ }
2153
+ const following = state.input.charCodeAt(state.position + 1);
2154
+ const entryLine = state.line;
2155
+ if ((ch === 63 || ch === 58) && isWsOrEolOrEnd(following)) {
2156
+ if (!mappingOpened) {
2157
+ addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
2158
+ mappingOpened = true;
2159
+ }
2160
+ if (ch === 63) {
2161
+ if (atExplicitKey) addEmptyScalarEvent(state);
2162
+ detected = true;
2163
+ atExplicitKey = true;
2164
+ } else if (atExplicitKey) atExplicitKey = false;
2165
+ else {
2166
+ addEmptyScalarEvent(state);
2167
+ detected = true;
2168
+ atExplicitKey = false;
2169
+ }
2170
+ state.position += 1;
2171
+ pendingExplicitKey = true;
2172
+ } else {
2173
+ if (atExplicitKey) {
2174
+ addEmptyScalarEvent(state);
2175
+ atExplicitKey = false;
2176
+ }
2177
+ const beforeKey = snapshotState(state);
2178
+ if (!parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) break;
2179
+ if (state.line === entryLine) {
2180
+ ch = state.input.charCodeAt(state.position);
2181
+ while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
2182
+ if (ch === 58) {
2183
+ ch = state.input.charCodeAt(++state.position);
2184
+ if (!isWsOrEolOrEnd(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
2185
+ if (!mappingOpened) {
2186
+ restoreState(state, beforeKey);
2187
+ addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
2188
+ mappingOpened = true;
2189
+ parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true);
2190
+ ch = state.input.charCodeAt(state.position);
2191
+ while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
2192
+ state.position++;
2193
+ }
2194
+ detected = true;
2195
+ atExplicitKey = false;
2196
+ pendingExplicitKey = false;
2197
+ } else if (detected) throwError(state, "expected ':' after a mapping key");
2198
+ else {
2199
+ if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) {
2200
+ restoreState(state, beforeKey);
2201
+ return false;
2202
+ }
2203
+ return true;
2204
+ }
2205
+ } else if (detected) throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
2206
+ else {
2207
+ if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) {
2208
+ restoreState(state, beforeKey);
2209
+ return false;
2210
+ }
2211
+ return true;
2212
+ }
2213
+ }
2214
+ if (parseNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, pendingExplicitKey)) pendingExplicitKey = false;
2215
+ if (!atExplicitKey) {
2216
+ if (pendingExplicitKey) {
2217
+ addEmptyScalarEvent(state);
2218
+ pendingExplicitKey = false;
2219
+ }
2220
+ }
2221
+ skipSeparationSpace(state, true);
2222
+ ch = state.input.charCodeAt(state.position);
2223
+ if ((state.line === entryLine || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a mapping entry");
2224
+ else if (state.lineIndent < nodeIndent) break;
2225
+ }
2226
+ if (!detected) return false;
2227
+ if (atExplicitKey) addEmptyScalarEvent(state);
2228
+ if (mappingOpened) addPopEvent(state);
2229
+ return true;
2230
+ }
2231
+ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact, allowPropertyMapping = true) {
2232
+ if (state.depth >= state.maxDepth) throwError(state, `nesting exceeded maxDepth (${state.maxDepth})`);
2233
+ state.depth++;
2234
+ let indentStatus = 1;
2235
+ let atNewLine = false;
2236
+ let hasContent = false;
2237
+ let propertyStart = null;
2238
+ const props = emptyProperties();
2239
+ let allowBlockScalars = nodeContext === CONTEXT_BLOCK_OUT || nodeContext === CONTEXT_BLOCK_IN;
2240
+ let allowBlockCollections = allowBlockScalars;
2241
+ const allowBlockStyles = allowBlockScalars;
2242
+ if (allowToSeek && skipSeparationSpace(state, true)) {
2243
+ atNewLine = true;
2244
+ if (state.lineIndent > parentIndent) indentStatus = 1;
2245
+ else if (state.lineIndent === parentIndent) indentStatus = 0;
2246
+ else indentStatus = -1;
2247
+ }
2248
+ if (indentStatus === 1) while (true) {
2249
+ const ch = state.input.charCodeAt(state.position);
2250
+ const propertyState = snapshotState(state);
2251
+ if (atNewLine && indentStatus !== 1 && (ch === 33 || ch === 38)) break;
2252
+ if (atNewLine && allowBlockStyles && (props.tagStart !== NO_RANGE$1 || props.anchorStart !== NO_RANGE$1) && (ch === 33 || ch === 38)) {
2253
+ const fallbackState = snapshotState(state);
2254
+ const flowIndent = parentIndent + 1;
2255
+ if (readBlockMapping(state, state.position - state.lineStart, flowIndent, props) && state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) {
2256
+ state.depth--;
2257
+ return true;
2258
+ }
2259
+ restoreState(state, fallbackState);
2260
+ }
2261
+ if (atNewLine && (ch === 33 && props.tagStart !== NO_RANGE$1 || ch === 38 && props.anchorStart !== NO_RANGE$1)) break;
2262
+ if (!readTagProperty(state, props, nodeContext === CONTEXT_FLOW_IN) && !readAnchorProperty(state, props)) break;
2263
+ if (propertyStart === null) propertyStart = propertyState;
2264
+ if (skipSeparationSpace(state, true)) {
2265
+ atNewLine = true;
2266
+ allowBlockCollections = allowBlockStyles;
2267
+ if (state.lineIndent > parentIndent) indentStatus = 1;
2268
+ else if (state.lineIndent === parentIndent) indentStatus = 0;
2269
+ else indentStatus = -1;
2270
+ } else allowBlockCollections = false;
2271
+ }
2272
+ if (allowBlockCollections) allowBlockCollections = atNewLine || allowCompact;
2273
+ if (indentStatus === 1 || nodeContext === CONTEXT_BLOCK_OUT) {
2274
+ const flowIndent = nodeContext === CONTEXT_FLOW_IN || nodeContext === CONTEXT_FLOW_OUT ? parentIndent : parentIndent + 1;
2275
+ const blockIndent = state.position - state.lineStart;
2276
+ if (indentStatus === 1) if (allowBlockCollections && (readBlockSequence(state, blockIndent, props) || readBlockMapping(state, blockIndent, flowIndent, props)) || readFlowCollection(state, flowIndent, props)) hasContent = true;
2277
+ else {
2278
+ const ch = state.input.charCodeAt(state.position);
2279
+ if (propertyStart !== null && allowPropertyMapping && allowBlockStyles && !allowBlockCollections && ch !== 124 && ch !== 62) {
2280
+ const fallbackState = snapshotState(state);
2281
+ const propertyIndent = propertyStart.position - propertyStart.lineStart;
2282
+ restoreState(state, propertyStart);
2283
+ if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) && state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) hasContent = true;
2284
+ else restoreState(state, fallbackState);
2285
+ }
2286
+ if (!hasContent && (allowBlockScalars && readBlockScalar(state, flowIndent, props) || readSingleQuotedScalar(state, flowIndent, props) || readDoubleQuotedScalar(state, flowIndent, props) || readAlias(state, props) || readPlainScalar(state, flowIndent, nodeContext, props))) hasContent = true;
2287
+ }
2288
+ else if (indentStatus === 0) hasContent = allowBlockCollections && readBlockSequence(state, blockIndent, props);
2289
+ }
2290
+ allowBlockScalars = allowBlockScalars && !hasContent;
2291
+ if (!hasContent && (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1 || allowBlockScalars)) {
2292
+ addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.PLAIN);
2293
+ hasContent = true;
2294
+ }
2295
+ state.depth--;
2296
+ return hasContent || props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1;
2297
+ }
2298
+ function readDirective(state) {
2299
+ if (state.lineIndent > 0 || state.input.charCodeAt(state.position) !== 37) return false;
2300
+ state.position++;
2301
+ const nameStart = state.position;
2302
+ while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++;
2303
+ const name = state.input.slice(nameStart, state.position);
2304
+ const args = [];
2305
+ if (name.length === 0) throwError(state, "directive name must not be less than one character in length");
2306
+ while (state.input.charCodeAt(state.position) !== 0 && !isEol(state.input.charCodeAt(state.position))) {
2307
+ while (isWhiteSpace(state.input.charCodeAt(state.position))) state.position++;
2308
+ if (state.input.charCodeAt(state.position) === 35 || isEol(state.input.charCodeAt(state.position)) || state.input.charCodeAt(state.position) === 0) break;
2309
+ const start = state.position;
2310
+ while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++;
2311
+ args.push(state.input.slice(start, state.position));
2312
+ }
2313
+ if (isEol(state.input.charCodeAt(state.position))) consumeLineBreak(state);
2314
+ if (name === "YAML") {
2315
+ if (state.directives.some((directive) => directive.kind === "yaml")) throwError(state, "duplication of %YAML directive");
2316
+ if (args.length !== 1) throwError(state, "YAML directive accepts exactly one argument");
2317
+ const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
2318
+ if (match === null) throwError(state, "ill-formed argument of the YAML directive");
2319
+ if (parseInt(match[1], 10) !== 1) throwError(state, "unacceptable YAML version of the document");
2320
+ state.directives.push({
2321
+ kind: "yaml",
2322
+ version: args[0]
2323
+ });
2324
+ } else if (name === "TAG") {
2325
+ if (args.length !== 2) throwError(state, "TAG directive accepts exactly two arguments");
2326
+ const [handle, prefix] = args;
2327
+ if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
2328
+ if (HAS_OWN.call(state.tagHandlers, handle)) throwError(state, `there is a previously declared suffix for "${handle}" tag handle`);
2329
+ if (!PATTERN_TAG_PREFIX.test(prefix)) throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
2330
+ state.tagHandlers[handle] = prefix;
2331
+ state.directives.push({
2332
+ kind: "tag",
2333
+ handle,
2334
+ prefix
2335
+ });
2336
+ }
2337
+ return true;
2338
+ }
2339
+ function readDocument(state) {
2340
+ state.directives = [];
2341
+ state.tagHandlers = /* @__PURE__ */ Object.create(null);
2342
+ let hasDirectives = false;
2343
+ skipSeparationSpace(state, true);
2344
+ while (readDirective(state)) {
2345
+ hasDirectives = true;
2346
+ skipSeparationSpace(state, true);
2347
+ }
2348
+ let explicitStart = false;
2349
+ let explicitEnd = false;
2350
+ let allowCompact = true;
2351
+ if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 3))) {
2352
+ explicitStart = true;
2353
+ const markerLine = state.line;
2354
+ state.position += 3;
2355
+ skipSeparationSpace(state, true);
2356
+ allowCompact = state.line > markerLine;
2357
+ } else if (hasDirectives) throwError(state, "directives end mark is expected");
2358
+ const documentEventIndex = state.events.length;
2359
+ if (!explicitStart && state.position === state.lineStart && state.input.charCodeAt(state.position) === 46 && testDocumentSeparator(state)) {
2360
+ state.position += 3;
2361
+ skipSeparationSpace(state, true);
2362
+ return;
2363
+ }
2364
+ addDocumentEvent(state, explicitStart, false);
2365
+ if (!parseNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, allowCompact, allowCompact)) addEmptyScalarEvent(state);
2366
+ skipSeparationSpace(state, true);
2367
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
2368
+ explicitEnd = state.input.charCodeAt(state.position) === 46;
2369
+ if (explicitEnd) {
2370
+ const markerLine = state.line;
2371
+ state.position += 3;
2372
+ skipSeparationSpace(state, true);
2373
+ if (state.line === markerLine && state.position < state.length) throwError(state, "end of the stream or a document separator is expected");
2374
+ }
2375
+ }
2376
+ const documentEvent = state.events[documentEventIndex];
2377
+ if (documentEvent?.type === EVENT_ID.DOCUMENT) documentEvent.explicitEnd = explicitEnd;
2378
+ addPopEvent(state);
2379
+ if (!explicitEnd && state.position < state.length && !testDocumentBoundary(state)) throwError(state, "end of the stream or a document separator is expected");
2380
+ }
2381
+ function parseEvents(input, options) {
2382
+ const length = input.length;
2383
+ const state = {
2384
+ ...DEFAULT_PARSER_OPTIONS,
2385
+ ...options,
2386
+ input: `${input}\0`,
2387
+ length,
2388
+ position: 0,
2389
+ line: 0,
2390
+ lineStart: 0,
2391
+ lineIndent: 0,
2392
+ firstTabInLine: -1,
2393
+ depth: 0,
2394
+ directives: [],
2395
+ tagHandlers: /* @__PURE__ */ Object.create(null),
2396
+ events: []
2397
+ };
2398
+ const nullpos = input.indexOf("\0");
2399
+ if (nullpos !== -1) YAMLException.throwAt(input, nullpos, "null byte is not allowed in input", state.filename);
2400
+ while (state.position < state.length) {
2401
+ skipByteOrderMark(state);
2402
+ skipSeparationSpace(state, true);
2403
+ if (state.position >= state.length) break;
2404
+ const documentStart = state.position;
2405
+ readDocument(state);
2406
+ if (state.position === documentStart)
2407
+ throwError(state, "can not read a document");
2408
+ }
2409
+ return state.events;
2410
+ }
2411
+ var DEFAULT_LOAD_OPTIONS = {
2412
+ ...DEFAULT_PARSER_OPTIONS,
2413
+ ...DEFAULT_CONSTRUCTOR_OPTIONS
2414
+ };
2415
+ function loadDocuments(input, options = {}) {
2416
+ const opts = {
2417
+ ...DEFAULT_LOAD_OPTIONS,
2418
+ ...options
2419
+ };
2420
+ const source = String(input);
2421
+ const PARSER_OPT_KEYS = Object.keys(DEFAULT_PARSER_OPTIONS);
2422
+ const CONSTRUCTOR_OPT_KEYS = Object.keys(DEFAULT_CONSTRUCTOR_OPTIONS);
2423
+ return constructFromEvents(parseEvents(source, pick(opts, PARSER_OPT_KEYS)), {
2424
+ ...pick(opts, CONSTRUCTOR_OPT_KEYS),
2425
+ source
2426
+ });
2427
+ }
2428
+ function loadAll(input, iteratorOrOptions, options) {
2429
+ let iterator = null;
2430
+ if (typeof iteratorOrOptions === "function") iterator = iteratorOrOptions;
2431
+ else if (iteratorOrOptions !== null && typeof iteratorOrOptions === "object") options = iteratorOrOptions;
2432
+ const documents = loadDocuments(input, options);
2433
+ if (iterator === null) return documents;
2434
+ for (const document of documents) iterator(document);
2435
+ }
2436
+ function load(input, options) {
2437
+ const documents = loadDocuments(input, options);
2438
+ if (documents.length === 0) throw new YAMLException("expected a document, but the input is empty");
2439
+ if (documents.length === 1) return documents[0];
2440
+ throw new YAMLException("expected a single document in the stream, but found more");
2441
+ }
2442
+ var INVALID = /* @__PURE__ */ Symbol("INVALID");
2443
+ function buildRepresentTypes(schema) {
2444
+ const defaultTags = new Set([
2445
+ schema.defaultScalarTag,
2446
+ schema.defaultSequenceTag,
2447
+ schema.defaultMappingTag
2448
+ ].filter((t) => t !== void 0));
2449
+ const implicitScalars = schema.implicitScalarTags;
2450
+ const explicitTags = schema.tags.filter((t) => !(t.nodeKind === "scalar" && t.implicit) && !defaultTags.has(t));
2451
+ const defaultTagsLast = schema.tags.filter((t) => defaultTags.has(t));
2452
+ return [
2453
+ ...implicitScalars.map((tag) => ({
2454
+ tag,
2455
+ implicitTag: true
2456
+ })),
2457
+ ...explicitTags.map((tag) => ({
2458
+ tag,
2459
+ implicitTag: false
2460
+ })),
2461
+ ...defaultTagsLast.map((tag) => ({
2462
+ tag,
2463
+ implicitTag: true
2464
+ }))
2465
+ ];
2466
+ }
2467
+ function matchTag(state, object) {
2468
+ for (let index = 0, length = state.representTypes.length; index < length; index += 1) {
2469
+ const { tag, implicitTag } = state.representTypes[index];
2470
+ if (tag.identify(object)) {
2471
+ let tagName;
2472
+ if (tag.matchByTagPrefix) tagName = tag.representTagName(object);
2473
+ else tagName = tag.tagName;
2474
+ return {
2475
+ tag,
2476
+ tagName,
2477
+ implicitTag
2478
+ };
2479
+ }
2480
+ }
2481
+ return null;
2482
+ }
2483
+ function build(state, object) {
2484
+ if (!state.noRefs && object !== null && typeof object === "object") {
2485
+ const existing = state.refs.get(object);
2486
+ if (existing) {
2487
+ if (existing.anchor === void 0) existing.anchor = `ref_${state.refCounter++}`;
2488
+ return {
2489
+ kind: "alias",
2490
+ anchor: existing.anchor
2491
+ };
2492
+ }
2493
+ }
2494
+ const matched = matchTag(state, object);
2495
+ if (!matched) {
2496
+ if (object === void 0) return INVALID;
2497
+ if (state.skipInvalid) return INVALID;
2498
+ throw new YAMLException(`unacceptable kind of an object to dump ${Object.prototype.toString.call(object)}`);
2499
+ }
2500
+ const { tag, tagName, implicitTag } = matched;
2501
+ const nodeTagName = implicitTag ? tagName : tagNameShort(tagName);
2502
+ if (tag.nodeKind === "scalar") return {
2503
+ kind: "scalar",
2504
+ tag: nodeTagName,
2505
+ tagged: !implicitTag,
2506
+ style: SCALAR_STYLE.PLAIN,
2507
+ value: tag.represent(object)
2508
+ };
2509
+ if (tag.nodeKind === "sequence") {
2510
+ const container = tag.represent(object);
2511
+ const node2 = {
2512
+ kind: "sequence",
2513
+ tag: nodeTagName,
2514
+ tagged: !implicitTag,
2515
+ style: COLLECTION_STYLE.BLOCK,
2516
+ items: []
2517
+ };
2518
+ if (!state.noRefs) state.refs.set(object, node2);
2519
+ for (let index = 0, length = container.length; index < length; index += 1) {
2520
+ let item = build(state, container[index]);
2521
+ if (item === INVALID && container[index] === void 0) item = build(state, null);
2522
+ if (item === INVALID) continue;
2523
+ node2.items.push(item);
2524
+ }
2525
+ return node2;
2526
+ }
2527
+ const map = tag.represent(object);
2528
+ const node = {
2529
+ kind: "mapping",
2530
+ tag: nodeTagName,
2531
+ tagged: !implicitTag,
2532
+ style: COLLECTION_STYLE.BLOCK,
2533
+ items: []
2534
+ };
2535
+ if (!state.noRefs) state.refs.set(object, node);
2536
+ for (const [objectKey, objectValue] of map) {
2537
+ const key = build(state, objectKey);
2538
+ if (key === INVALID) continue;
2539
+ const value = build(state, objectValue);
2540
+ if (value === INVALID) continue;
2541
+ node.items.push({
2542
+ key,
2543
+ value
2544
+ });
2545
+ }
2546
+ return node;
2547
+ }
2548
+ function jsToAst(input, schema, options = {}) {
2549
+ const root = build({
2550
+ representTypes: buildRepresentTypes(schema),
2551
+ noRefs: options.noRefs ?? false,
2552
+ skipInvalid: options.skipInvalid ?? false,
2553
+ refs: /* @__PURE__ */ new Map(),
2554
+ refCounter: 0
2555
+ }, input);
2556
+ return [{
2557
+ contents: root === INVALID ? null : root,
2558
+ directives: []
2559
+ }];
2560
+ }
2561
+ var VISIT_BREAK = /* @__PURE__ */ Symbol("visit:break");
2562
+ var VISIT_SKIP = /* @__PURE__ */ Symbol("visit:skip");
2563
+ function visitNode(node, visitor, ctx) {
2564
+ const control = visitor(node, ctx);
2565
+ if (control === VISIT_BREAK) return true;
2566
+ if (control === VISIT_SKIP) return false;
2567
+ const depth = ctx.depth + 1;
2568
+ switch (node.kind) {
2569
+ case "sequence":
2570
+ for (const item of node.items) if (visitNode(item, visitor, {
2571
+ depth,
2572
+ parent: node,
2573
+ isKey: false
2574
+ })) return true;
2575
+ break;
2576
+ case "mapping":
2577
+ for (const { key, value } of node.items) {
2578
+ if (visitNode(key, visitor, {
2579
+ depth,
2580
+ parent: node,
2581
+ isKey: true
2582
+ })) return true;
2583
+ if (visitNode(value, visitor, {
2584
+ depth,
2585
+ parent: node,
2586
+ isKey: false
2587
+ })) return true;
2588
+ }
2589
+ break;
2590
+ }
2591
+ return false;
2592
+ }
2593
+ function visit(documents, visitor) {
2594
+ for (const doc of documents) if (doc.contents && visitNode(doc.contents, visitor, {
2595
+ depth: 0,
2596
+ parent: null,
2597
+ isKey: false
2598
+ })) return;
2599
+ }
2600
+ function hasBit(mask, bit) {
2601
+ return (mask & 1 << bit) !== 0;
2602
+ }
2603
+ var DEFAULT_SCALAR_STYLE_RULES = {
2604
+ applyQuoteFlowKeysOption,
2605
+ doubleQuoteForInvisibles,
2606
+ doubleQuoteWhitespaceOnly,
2607
+ applyForceQuotesOption,
2608
+ tryLongOrMultilineAsBlock,
2609
+ quoteInvalidPlain,
2610
+ fallbackToDoubleQuoted
2611
+ };
2612
+ function _preferredQuotedStyle(layout) {
2613
+ if (layout.presenterOptions.quoteStyle === "single" && hasBit(layout.allowedStylesMask, SCALAR_STYLE.SINGLE_QUOTED)) return SCALAR_STYLE.SINGLE_QUOTED;
2614
+ return SCALAR_STYLE.DOUBLE_QUOTED;
2615
+ }
2616
+ function applyQuoteFlowKeysOption(layout) {
2617
+ if (!layout.presenterOptions.quoteFlowKeys) return;
2618
+ if (!layout.isKey || !layout.flowOnly || layout.style !== SCALAR_STYLE.PLAIN) return;
2619
+ layout.style = SCALAR_STYLE.DOUBLE_QUOTED;
2620
+ }
2621
+ function doubleQuoteForInvisibles(layout) {
2622
+ if (layout.style === SCALAR_STYLE.PLAIN && /[\t\x7F-\xA0\u2028\u2029\uFEFF\uFFFE\uFFFF]/.test(layout.node.value)) layout.style = SCALAR_STYLE.DOUBLE_QUOTED;
2623
+ }
2624
+ function doubleQuoteWhitespaceOnly(layout) {
2625
+ if (layout.style === SCALAR_STYLE.PLAIN && /^\s+$/.test(layout.node.value)) layout.style = SCALAR_STYLE.DOUBLE_QUOTED;
2626
+ }
2627
+ function applyForceQuotesOption(layout) {
2628
+ if (!layout.presenterOptions.forceQuotes) return;
2629
+ if (layout.isKey || layout.style !== SCALAR_STYLE.PLAIN) return;
2630
+ if (layout.node.tag !== layout.presenterOptions.schema.defaultScalarTag.tagName) return;
2631
+ layout.style = layout.node.value.includes("\n") ? SCALAR_STYLE.DOUBLE_QUOTED : _preferredQuotedStyle(layout);
2632
+ }
2633
+ function tryLongOrMultilineAsBlock(layout) {
2634
+ if (layout.style !== SCALAR_STYLE.PLAIN || layout.isKey) return;
2635
+ const value = layout.node.value;
2636
+ const multiline = value.indexOf("\n") !== -1;
2637
+ if (!hasBit(layout.allowedStylesMask, SCALAR_STYLE.LITERAL_BLOCK)) {
2638
+ if (multiline) layout.style = SCALAR_STYLE.DOUBLE_QUOTED;
2639
+ return;
2640
+ }
2641
+ const w = layout.presenterOptions.lineWidth;
2642
+ if (w === -1) {
2643
+ if (multiline) layout.style = SCALAR_STYLE.LITERAL_BLOCK;
2644
+ return;
2645
+ }
2646
+ const availableWidth = Math.max(Math.min(w, 40), w - layout.shiftOfContent);
2647
+ let position = 0;
2648
+ let shouldFold = false;
2649
+ while (position <= value.length) {
2650
+ let lineEnd = value.length;
2651
+ const nextLineBreak = value.indexOf("\n", position);
2652
+ if (nextLineBreak !== -1) lineEnd = nextLineBreak;
2653
+ const line = value.slice(position, lineEnd);
2654
+ if (line.length > availableWidth && line[0] !== " " && / [^ \t]/.test(line)) shouldFold = true;
2655
+ if (nextLineBreak === -1) break;
2656
+ position = nextLineBreak + 1;
2657
+ }
2658
+ if (shouldFold) layout.style = SCALAR_STYLE.FOLDED_BLOCK;
2659
+ else if (multiline) layout.style = SCALAR_STYLE.LITERAL_BLOCK;
2660
+ }
2661
+ function quoteInvalidPlain(layout) {
2662
+ if (layout.style === SCALAR_STYLE.PLAIN && !hasBit(layout.allowedStylesMask, SCALAR_STYLE.PLAIN)) layout.style = _preferredQuotedStyle(layout);
2663
+ }
2664
+ function fallbackToDoubleQuoted(layout) {
2665
+ if (!hasBit(layout.allowedStylesMask, layout.style)) layout.style = SCALAR_STYLE.DOUBLE_QUOTED;
2666
+ }
2667
+ function setBit(mask, bit) {
2668
+ return mask | 1 << bit;
2669
+ }
2670
+ var SRC_C_PRINTABLE = "[\\x09\\x0A\\x0D\\x20-\\x7E\\x85\\xA0-\\uD7FF\\uE000-\\uFFFD\\u{10000}-\\u{10FFFF}]";
2671
+ var SRC_B_CHAR = "[\\n\\r]";
2672
+ var SRC_C_BYTE_ORDER_MARK = "\\uFEFF";
2673
+ var SRC_S_WHITE = "[ \\t]";
2674
+ var SRC_NB_CHAR = `(?:(?!(?:${SRC_B_CHAR}|${SRC_C_BYTE_ORDER_MARK}))${SRC_C_PRINTABLE})`;
2675
+ var SRC_NS_CHAR = `(?:(?!${SRC_S_WHITE})${SRC_NB_CHAR})`;
2676
+ var SRC_NB_JSON = "[\\x09\\x20-\\uD7FF\\uE000-\\uFFFF\\u{10000}-\\u{10FFFF}]";
2677
+ var SRC_C_INDICATOR = "[-?:,\\[\\]{}#&*!|>'\"%@`]";
2678
+ var SRC_C_FLOW_INDICATOR = "[,\\[\\]{}]";
2679
+ var SRC_NS_PLAIN_SAFE_FLOW_OUT = SRC_NS_CHAR;
2680
+ var SRC_NS_PLAIN_SAFE_FLOW_IN = `(?:(?!${SRC_C_FLOW_INDICATOR})${SRC_NS_CHAR})`;
2681
+ var SRC_NS_PLAIN_FIRST_FLOW_OUT = `(?:(?:(?!${SRC_C_INDICATOR})${SRC_NS_CHAR})|[?:-](?=${SRC_NS_PLAIN_SAFE_FLOW_OUT}))`;
2682
+ var SRC_NS_PLAIN_FIRST_FLOW_IN = `(?:(?:(?!${SRC_C_INDICATOR})${SRC_NS_CHAR})|[?:-](?=${SRC_NS_PLAIN_SAFE_FLOW_IN}))`;
2683
+ var SRC_NS_PLAIN_CHAR_FLOW_OUT = `(?:(?:(?![:#])${SRC_NS_PLAIN_SAFE_FLOW_OUT})|:(?=${SRC_NS_PLAIN_SAFE_FLOW_OUT}))#*`;
2684
+ var SRC_NS_PLAIN_CHAR_FLOW_IN = `(?:(?:(?![:#])${SRC_NS_PLAIN_SAFE_FLOW_IN})|:(?=${SRC_NS_PLAIN_SAFE_FLOW_IN}))#*`;
2685
+ var SRC_NB_NS_PLAIN_IN_LINE_FLOW_OUT = `(?:${SRC_S_WHITE}*${SRC_NS_PLAIN_CHAR_FLOW_OUT})*`;
2686
+ var SRC_NB_NS_PLAIN_IN_LINE_FLOW_IN = `(?:${SRC_S_WHITE}*${SRC_NS_PLAIN_CHAR_FLOW_IN})*`;
2687
+ var SRC_NS_PLAIN_ONE_LINE_FLOW_OUT = `${SRC_NS_PLAIN_FIRST_FLOW_OUT}#*${SRC_NB_NS_PLAIN_IN_LINE_FLOW_OUT}`;
2688
+ var SRC_NS_PLAIN_ONE_LINE_FLOW_IN = `${SRC_NS_PLAIN_FIRST_FLOW_IN}#*${SRC_NB_NS_PLAIN_IN_LINE_FLOW_IN}`;
2689
+ var SRC_NS_PLAIN_ONE_LINE_BLOCK_KEY = SRC_NS_PLAIN_ONE_LINE_FLOW_OUT;
2690
+ var SRC_NS_PLAIN_ONE_LINE_FLOW_KEY = SRC_NS_PLAIN_ONE_LINE_FLOW_IN;
2691
+ var SRC_S_NS_PLAIN_NEXT_LINE_FLOW_OUT = `\\n+${SRC_NS_PLAIN_CHAR_FLOW_OUT}${SRC_NB_NS_PLAIN_IN_LINE_FLOW_OUT}`;
2692
+ var SRC_S_NS_PLAIN_NEXT_LINE_FLOW_IN = `\\n+${SRC_NS_PLAIN_CHAR_FLOW_IN}${SRC_NB_NS_PLAIN_IN_LINE_FLOW_IN}`;
2693
+ var SRC_NS_PLAIN_MULTI_LINE_FLOW_OUT = `${SRC_NS_PLAIN_ONE_LINE_FLOW_OUT}(?:${SRC_S_NS_PLAIN_NEXT_LINE_FLOW_OUT})*`;
2694
+ var SRC_NS_PLAIN_MULTI_LINE_FLOW_IN = `${SRC_NS_PLAIN_ONE_LINE_FLOW_IN}(?:${SRC_S_NS_PLAIN_NEXT_LINE_FLOW_IN})*`;
2695
+ var NS_PLAIN_FLOW_OUT = new RegExp(`^(?:${SRC_NS_PLAIN_MULTI_LINE_FLOW_OUT})$`, "u");
2696
+ var NS_PLAIN_FLOW_IN = new RegExp(`^(?:${SRC_NS_PLAIN_MULTI_LINE_FLOW_IN})$`, "u");
2697
+ var NS_PLAIN_BLOCK_KEY = new RegExp(`^(?:${SRC_NS_PLAIN_ONE_LINE_BLOCK_KEY})$`, "u");
2698
+ var NS_PLAIN_FLOW_KEY = new RegExp(`^(?:${SRC_NS_PLAIN_ONE_LINE_FLOW_KEY})$`, "u");
2699
+ var NB_SINGLE_ONE_LINE = new RegExp(`^(?:${SRC_NB_JSON})*$`, "u");
2700
+ var NB_SINGLE_MULTI_LINE = new RegExp(`^(?:${SRC_NB_JSON}|\\n)*$`, "u");
2701
+ var BLOCK_SCALAR_CONTENT = new RegExp(`^(?:${SRC_NB_CHAR}|\\n)*$`, "u");
2702
+ var C_FORBIDDEN_FIRST_LINE = /^(?:---|\.\.\.)(?=$|[ \t\n\r])/;
2703
+ var C_FORBIDDEN_CONTENT = /^(?:---|\.\.\.)(?=$|[ \t\n\r])/m;
2704
+ function canUsePlain(layout) {
2705
+ const str = layout.node.value;
2706
+ if (str !== "") {
2707
+ if (!(layout.isKey ? layout.flowOnly ? NS_PLAIN_FLOW_KEY : NS_PLAIN_BLOCK_KEY : layout.flowOnly ? NS_PLAIN_FLOW_IN : NS_PLAIN_FLOW_OUT).test(str)) return false;
2708
+ if (layout.shiftOfFirstLine === 0 && C_FORBIDDEN_FIRST_LINE.test(str)) return false;
2709
+ if (layout.shiftOfContent === 0) {
2710
+ const firstLineBreak = str.indexOf("\n");
2711
+ if (firstLineBreak !== -1) {
2712
+ const content = str.slice(firstLineBreak + 1);
2713
+ if (C_FORBIDDEN_CONTENT.test(content)) return false;
2714
+ }
2715
+ }
2716
+ }
2717
+ const resolvedTag = layout.presenterOptions.schema.resolveImplicitScalarTag(str).tag.tagName;
2718
+ if (!layout.node.tagged && resolvedTag !== layout.node.tag) return false;
2719
+ if (!layout.node.tagged && str === "=" && resolvedTag === layout.presenterOptions.schema.defaultScalarTag.tagName) return false;
2720
+ return true;
2721
+ }
2722
+ function canUseSingleQuoted(layout) {
2723
+ const str = layout.node.value;
2724
+ if (!(layout.isKey ? NB_SINGLE_ONE_LINE : NB_SINGLE_MULTI_LINE).test(str)) return false;
2725
+ if (/[ \t]\n|\n[ \t]/.test(str)) return false;
2726
+ if (!layout.isKey && layout.shiftOfContent === 0) {
2727
+ const firstLineBreak = str.indexOf("\n");
2728
+ if (firstLineBreak !== -1 && C_FORBIDDEN_CONTENT.test(str.slice(firstLineBreak + 1))) return false;
2729
+ }
2730
+ return true;
2731
+ }
2732
+ function canUseBlock(layout) {
2733
+ if (layout.flowOnly || !BLOCK_SCALAR_CONTENT.test(layout.node.value)) return false;
2734
+ const contentIndent = layout.shiftOfContent - layout.shiftOfParent;
2735
+ if (contentIndent < 1) return false;
2736
+ if (contentIndent > 9 && /^\n* /.test(layout.node.value)) return false;
2737
+ if (layout.shiftOfContent === 0 && C_FORBIDDEN_CONTENT.test(layout.node.value)) return false;
2738
+ return true;
2739
+ }
2740
+ function detectAllowedStyles(layout) {
2741
+ let mask = setBit(0, SCALAR_STYLE.DOUBLE_QUOTED);
2742
+ if (canUsePlain(layout)) mask = setBit(mask, SCALAR_STYLE.PLAIN);
2743
+ if (canUseSingleQuoted(layout)) mask = setBit(mask, SCALAR_STYLE.SINGLE_QUOTED);
2744
+ if (canUseBlock(layout)) mask = setBit(setBit(mask, SCALAR_STYLE.LITERAL_BLOCK), SCALAR_STYLE.FOLDED_BLOCK);
2745
+ layout.allowedStylesMask = mask;
2746
+ }
2747
+ function renderScalar(layout) {
2748
+ switch (layout.style) {
2749
+ case SCALAR_STYLE.PLAIN:
2750
+ return renderPlain(layout);
2751
+ case SCALAR_STYLE.SINGLE_QUOTED:
2752
+ return renderSingleQuoted(layout);
2753
+ case SCALAR_STYLE.LITERAL_BLOCK:
2754
+ return renderLiteralBlock(layout);
2755
+ case SCALAR_STYLE.FOLDED_BLOCK:
2756
+ return renderFoldedBlock(layout);
2757
+ case SCALAR_STYLE.DOUBLE_QUOTED:
2758
+ return renderDoubleQuoted(layout);
2759
+ }
2760
+ }
2761
+ function renderPlain(layout) {
2762
+ return encodeFlowBreaks(layout.node.value, layout.shiftOfContent);
2763
+ }
2764
+ function renderSingleQuoted(layout) {
2765
+ return `'${encodeFlowBreaks(layout.node.value, layout.shiftOfContent).replace(/'/g, "''")}'`;
2766
+ }
2767
+ function renderLiteralBlock(layout) {
2768
+ const value = layout.node.value;
2769
+ return "|" + blockHeader(value, layout.shiftOfParent, layout.shiftOfContent) + dropEndingNewline(indentString(value, layout.shiftOfContent));
2770
+ }
2771
+ function renderFoldedBlock(layout) {
2772
+ const value = layout.node.value;
2773
+ const w = layout.presenterOptions.lineWidth;
2774
+ let availableWidth = Infinity;
2775
+ if (w !== -1) availableWidth = Math.max(Math.min(w, 40), w - layout.shiftOfContent);
2776
+ return ">" + blockHeader(value, layout.shiftOfParent, layout.shiftOfContent) + dropEndingNewline(indentString(foldBlockScalar(value, availableWidth), layout.shiftOfContent));
2777
+ }
2778
+ function renderDoubleQuoted(layout) {
2779
+ return `"${escapeString(layout.node.value)}"`;
2780
+ }
2781
+ function encodeFlowBreaks(string, shiftOfContent) {
2782
+ let nextLF = string.indexOf("\n");
2783
+ if (nextLF === -1) return string;
2784
+ const pad = " ".repeat(shiftOfContent);
2785
+ let result = string.slice(0, nextLF);
2786
+ const lineRe = /(\n+)([^\n]*)/g;
2787
+ lineRe.lastIndex = nextLF;
2788
+ let match;
2789
+ while (match = lineRe.exec(string)) {
2790
+ const breaks = match[1].length;
2791
+ const line = match[2];
2792
+ result += "\n".repeat(breaks + 1) + pad + line;
2793
+ }
2794
+ return result;
2795
+ }
2796
+ function indentString(string, spaces) {
2797
+ const indent = " ".repeat(spaces);
2798
+ let position = 0;
2799
+ let result = "";
2800
+ const length = string.length;
2801
+ while (position < length) {
2802
+ let line;
2803
+ const next = string.indexOf("\n", position);
2804
+ if (next === -1) {
2805
+ line = string.slice(position);
2806
+ position = length;
2807
+ } else {
2808
+ line = string.slice(position, next + 1);
2809
+ position = next + 1;
2810
+ }
2811
+ if (line.length && line !== "\n") result += indent;
2812
+ result += line;
2813
+ }
2814
+ return result;
2815
+ }
2816
+ function needIndentIndicator(string) {
2817
+ return /^\n* /.test(string);
2818
+ }
2819
+ function blockHeader(string, shiftOfParent, shiftOfContent) {
2820
+ const indentIndicator = needIndentIndicator(string) ? String(shiftOfContent - shiftOfParent) : "";
2821
+ const clip = string[string.length - 1] === "\n";
2822
+ return `${indentIndicator}${clip && (string[string.length - 2] === "\n" || string === "\n") ? "+" : clip ? "" : "-"}
2823
+ `;
2824
+ }
2825
+ function dropEndingNewline(string) {
2826
+ return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
2827
+ }
2828
+ function isMoreIndented(char) {
2829
+ return char === " " || char === " ";
2830
+ }
2831
+ function foldLine(line, width) {
2832
+ if (line === "" || isMoreIndented(line[0])) return line;
2833
+ const breakRe = / [^ \t]/g;
2834
+ let match;
2835
+ let start = 0;
2836
+ let end;
2837
+ let curr = 0;
2838
+ let next = 0;
2839
+ let result = "";
2840
+ while (match = breakRe.exec(line)) {
2841
+ next = match.index;
2842
+ if (next - start > width) {
2843
+ end = curr > start ? curr : next;
2844
+ result += `
2845
+ ${line.slice(start, end)}`;
2846
+ start = end + 1;
2847
+ }
2848
+ curr = next;
2849
+ }
2850
+ result += "\n";
2851
+ if (line.length - start > width && curr > start) result += `${line.slice(start, curr)}
2852
+ ${line.slice(curr + 1)}`;
2853
+ else result += line.slice(start);
2854
+ return result.slice(1);
2855
+ }
2856
+ function foldBlockScalar(string, width) {
2857
+ const lineRe = /(\n+)([^\n]*)/g;
2858
+ let nextLF = string.indexOf("\n");
2859
+ if (nextLF === -1) nextLF = string.length;
2860
+ lineRe.lastIndex = nextLF;
2861
+ let result = foldLine(string.slice(0, nextLF), width);
2862
+ let prevMoreIndented = string[0] === "\n" || isMoreIndented(string[0]);
2863
+ let moreIndented;
2864
+ let match;
2865
+ while (match = lineRe.exec(string)) {
2866
+ const prefix = match[1];
2867
+ const line = match[2];
2868
+ moreIndented = line !== "" && isMoreIndented(line[0]);
2869
+ result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
2870
+ prevMoreIndented = moreIndented;
2871
+ }
2872
+ return result;
2873
+ }
2874
+ var CHARACTERS_TO_ESCAPE = /["\\\x00-\x1F\x7F-\xA0\u2028\u2029\uD800-\uDFFF\uFEFF\uFFFE\uFFFF]/gu;
2875
+ function escapeCharacter(character) {
2876
+ switch (character) {
2877
+ case "\0":
2878
+ return "\\0";
2879
+ case "\x07":
2880
+ return "\\a";
2881
+ case "\b":
2882
+ return "\\b";
2883
+ case " ":
2884
+ return "\\t";
2885
+ case "\n":
2886
+ return "\\n";
2887
+ case "\v":
2888
+ return "\\v";
2889
+ case "\f":
2890
+ return "\\f";
2891
+ case "\r":
2892
+ return "\\r";
2893
+ case "\x1B":
2894
+ return "\\e";
2895
+ case '"':
2896
+ return '\\"';
2897
+ case "\\":
2898
+ return "\\\\";
2899
+ case "\x85":
2900
+ return "\\N";
2901
+ case "\xA0":
2902
+ return "\\_";
2903
+ case "\u2028":
2904
+ return "\\L";
2905
+ case "\u2029":
2906
+ return "\\P";
2907
+ }
2908
+ const code = character.charCodeAt(0);
2909
+ const hex = code.toString(16).toUpperCase();
2910
+ if (code <= 255) return `\\x${"0".repeat(2 - hex.length)}${hex}`;
2911
+ return `\\u${"0".repeat(4 - hex.length)}${hex}`;
2912
+ }
2913
+ function escapeString(string) {
2914
+ return string.replace(CHARACTERS_TO_ESCAPE, escapeCharacter);
2915
+ }
2916
+ var CHAR_LINE_FEED = 10;
2917
+ var DEFAULT_PRESENTER_OPTIONS = {
2918
+ indent: 2,
2919
+ seqNoIndent: false,
2920
+ seqInlineFirst: true,
2921
+ lineWidth: 80,
2922
+ flowBracketPadding: false,
2923
+ flowSkipCommaSpace: false,
2924
+ flowSkipColonSpace: false,
2925
+ quoteFlowKeys: false,
2926
+ quoteStyle: "single",
2927
+ forceQuotes: false,
2928
+ scalarStyleRules: Object.keys(DEFAULT_SCALAR_STYLE_RULES).map((name) => Reflect.get(DEFAULT_SCALAR_STYLE_RULES, name)),
2929
+ tagBeforeAnchor: false
2930
+ };
2931
+ function nodeTagShort(node) {
2932
+ return node.tagged ? node.tag : tagNameShort(node.tag);
2933
+ }
2934
+ function createPresenterState(options) {
2935
+ const opts = {
2936
+ ...DEFAULT_PRESENTER_OPTIONS,
2937
+ ...options
2938
+ };
2939
+ if (opts.flowSkipColonSpace) opts.quoteFlowKeys = true;
2940
+ return {
2941
+ ...opts,
2942
+ defaultScalarTagName: opts.schema.defaultScalarTag.tagName,
2943
+ openEnded: false
2944
+ };
2945
+ }
2946
+ function generateNextLine(state, level) {
2947
+ return `
2948
+ ${" ".repeat(state.indent * level)}`;
2949
+ }
2950
+ function scalarLayout(state, node, parent, level, isKey, flowOnly) {
2951
+ return {
2952
+ node,
2953
+ parent,
2954
+ level,
2955
+ isKey,
2956
+ flowOnly,
2957
+ shiftOfParent: level === 0 ? -1 : state.indent * (level - 1),
2958
+ shiftOfContent: state.indent * Math.max(1, level),
2959
+ shiftOfFirstLine: level === 0 ? 0 : state.indent * level,
2960
+ presenterOptions: state,
2961
+ allowedStylesMask: 0,
2962
+ style: node.style
2963
+ };
2964
+ }
2965
+ function writeFlowSequence(state, level, node) {
2966
+ let result = "";
2967
+ for (let index = 0, length = node.items.length; index < length; index += 1) {
2968
+ const item = writeNode(state, level, node.items[index], node, {}).text;
2969
+ if (index > 0) result += `,${!state.flowSkipCommaSpace ? " " : ""}`;
2970
+ result += item;
2971
+ }
2972
+ const pad = state.flowBracketPadding && node.items.length > 0 ? " " : "";
2973
+ return `[${pad}${result}${pad}]`;
2974
+ }
2975
+ function writeBlockSequence(state, level, node, compact) {
2976
+ let result = "";
2977
+ for (let index = 0, length = node.items.length; index < length; index += 1) {
2978
+ const item = writeNode(state, level + 1, node.items[index], node, {
2979
+ block: true,
2980
+ compact: state.seqInlineFirst,
2981
+ isblockseq: true
2982
+ }).text;
2983
+ if (!compact || result !== "") result += generateNextLine(state, level);
2984
+ if (item === "" || CHAR_LINE_FEED === item.charCodeAt(0)) result += "-";
2985
+ else result += "- ";
2986
+ result += item;
2987
+ }
2988
+ return result;
2989
+ }
2990
+ function writeFlowMapping(state, level, node) {
2991
+ let result = "";
2992
+ for (const { key, value } of node.items) {
2993
+ let pairBuffer = "";
2994
+ if (result !== "") pairBuffer += `,${!state.flowSkipCommaSpace ? " " : ""}`;
2995
+ const keyRender = writeNode(state, level, key, node, { iskey: true });
2996
+ const keyText = keyRender.text;
2997
+ const valueText = writeNode(state, level, value, node, {}).text;
2998
+ const sep = state.flowSkipColonSpace || valueText === "" ? "" : " ";
2999
+ const keyIsBareProps = key.kind === "scalar" && keyRender.noBody && (key.tagged || key.anchor !== void 0);
3000
+ const keyColonSep = key.kind === "alias" || keyIsBareProps ? " " : "";
3001
+ pairBuffer += `${keyText}${keyColonSep}:${sep}${valueText}`;
3002
+ result += pairBuffer;
3003
+ }
3004
+ const pad = state.flowBracketPadding && result !== "" ? " " : "";
3005
+ return `{${pad}${result}${pad}}`;
3006
+ }
3007
+ function writeBlockMapping(state, level, node, compact) {
3008
+ let result = "";
3009
+ for (let index = 0, length = node.items.length; index < length; index += 1) {
3010
+ let pairBuffer = "";
3011
+ if (!compact || result !== "") pairBuffer += generateNextLine(state, level);
3012
+ const { key, value } = node.items[index];
3013
+ const keyIsBlock = (key.kind === "mapping" || key.kind === "sequence") && key.style === COLLECTION_STYLE.BLOCK && key.items.length !== 0 || key.kind === "scalar" && (key.style === SCALAR_STYLE.LITERAL_BLOCK || key.style === SCALAR_STYLE.FOLDED_BLOCK);
3014
+ const keyRender = keyIsBlock ? writeNode(state, level + 1, key, node, {
3015
+ block: true,
3016
+ compact: true,
3017
+ isblockseq: !cannotBeCompact(state, key, level + 1)
3018
+ }) : writeNode(state, level + 1, key, node, {
3019
+ block: true,
3020
+ compact: true,
3021
+ iskey: true
3022
+ });
3023
+ const keyText = keyRender.text;
3024
+ const keyHasLineBreak = key.kind === "scalar" && key.value.indexOf("\n") !== -1;
3025
+ const keyIsTooLong = keyText.length > 1024 && /^[\s\S]{1025}/u.test(keyText);
3026
+ const explicitPair = keyIsBlock || keyHasLineBreak || keyIsTooLong;
3027
+ if (explicitPair) if (keyText && CHAR_LINE_FEED === keyText.charCodeAt(0)) pairBuffer += "?";
3028
+ else pairBuffer += "? ";
3029
+ pairBuffer += keyText;
3030
+ if (explicitPair) pairBuffer += generateNextLine(state, level);
3031
+ const valueText = writeNode(state, level + 1, value, node, {
3032
+ block: true,
3033
+ compact: explicitPair,
3034
+ isblockseq: explicitPair && !cannotBeCompact(state, value, level + 1)
3035
+ }).text;
3036
+ const keyIsBareProps = key.kind === "scalar" && keyRender.noBody && (key.tagged || key.anchor !== void 0);
3037
+ const keyColonSep = !explicitPair && (key.kind === "alias" || keyIsBareProps) ? " " : "";
3038
+ if (valueText === "" || CHAR_LINE_FEED === valueText.charCodeAt(0)) pairBuffer += `${keyColonSep}:`;
3039
+ else pairBuffer += `${keyColonSep}: `;
3040
+ pairBuffer += valueText;
3041
+ result += pairBuffer;
3042
+ }
3043
+ return result;
3044
+ }
3045
+ function cannotBeCompact(state, node, level) {
3046
+ if (node.kind === "alias") return true;
3047
+ return node.tagged || node.anchor !== void 0 || state.indent < 2 && level > 0;
3048
+ }
3049
+ function writeNode(state, level, node, parent, ctx) {
3050
+ if (node.kind === "alias") {
3051
+ state.openEnded = false;
3052
+ return {
3053
+ text: `*${node.anchor}`,
3054
+ noBody: false
3055
+ };
3056
+ }
3057
+ const { block = false, iskey = false, isblockseq = false } = ctx;
3058
+ let compact = ctx.compact ?? false;
3059
+ const hasAnchor = node.anchor !== void 0;
3060
+ if (cannotBeCompact(state, node, level)) compact = false;
3061
+ let body;
3062
+ let shouldPrintTag = node.tagged;
3063
+ const useBlockCollection = block && (node.kind === "mapping" || node.kind === "sequence") && node.style === COLLECTION_STYLE.BLOCK && node.items.length !== 0;
3064
+ if (node.kind === "mapping") if (useBlockCollection) body = writeBlockMapping(state, level, node, compact);
3065
+ else body = writeFlowMapping(state, level, node);
3066
+ else if (node.kind === "sequence") if (useBlockCollection) if (state.seqNoIndent && !isblockseq && level > 0) body = writeBlockSequence(state, level - 1, node, compact);
3067
+ else body = writeBlockSequence(state, level, node, compact);
3068
+ else body = writeFlowSequence(state, level, node);
3069
+ else {
3070
+ const layout = scalarLayout(state, node, parent, level, iskey, !block);
3071
+ detectAllowedStyles(layout);
3072
+ for (const rule of state.scalarStyleRules) rule(layout);
3073
+ body = renderScalar(layout);
3074
+ state.openEnded = (layout.style === SCALAR_STYLE.LITERAL_BLOCK || layout.style === SCALAR_STYLE.FOLDED_BLOCK) && (node.value === "\n" || node.value.endsWith("\n\n"));
3075
+ shouldPrintTag = node.tagged || body === "" && layout.flowOnly && parent?.kind === "sequence" && !hasAnchor || layout.style !== SCALAR_STYLE.PLAIN && node.tag !== state.defaultScalarTagName;
3076
+ }
3077
+ if ((node.kind === "mapping" || node.kind === "sequence") && !useBlockCollection) state.openEnded = false;
3078
+ if (useBlockCollection && compact && level > 0 && state.indent > 2) body = `${" ".repeat(state.indent - 2)}${body}`;
3079
+ const noBody = body === "";
3080
+ let text = body;
3081
+ if (shouldPrintTag || hasAnchor) {
3082
+ const props = [];
3083
+ const tag = shouldPrintTag ? nodeTagShort(node) : null;
3084
+ const anchor = hasAnchor ? `&${node.anchor}` : null;
3085
+ if (state.tagBeforeAnchor) {
3086
+ if (tag !== null) props.push(tag);
3087
+ if (anchor !== null) props.push(anchor);
3088
+ } else {
3089
+ if (anchor !== null) props.push(anchor);
3090
+ if (tag !== null) props.push(tag);
3091
+ }
3092
+ const sep = body === "" || body.charCodeAt(0) === CHAR_LINE_FEED ? "" : " ";
3093
+ text = `${props.join(" ")}${sep}${body}`;
3094
+ }
3095
+ return {
3096
+ text,
3097
+ noBody
3098
+ };
3099
+ }
3100
+ function rootStartsOwnLine(node) {
3101
+ return (node.kind === "sequence" || node.kind === "mapping") && node.style === COLLECTION_STYLE.BLOCK && node.items.length !== 0 && !node.tagged && node.anchor === void 0;
3102
+ }
3103
+ function writeDocumentDirectives(doc) {
3104
+ let result = "";
3105
+ for (const directive of doc.directives) {
3106
+ if (directive.kind === "yaml") {
3107
+ result += `%YAML ${directive.version}
3108
+ `;
3109
+ continue;
3110
+ }
3111
+ const { handle, prefix } = directive;
3112
+ result += `%TAG ${handle} ${prefix}
3113
+ `;
3114
+ }
3115
+ return result;
3116
+ }
3117
+ function present(documents, options) {
3118
+ const state = createPresenterState(options);
3119
+ let result = "";
3120
+ let previousEnded = false;
3121
+ for (let index = 0; index < documents.length; index += 1) {
3122
+ const doc = documents[index];
3123
+ state.openEnded = false;
3124
+ const directives = writeDocumentDirectives(doc);
3125
+ const hasDirectives = directives !== "";
3126
+ const marker = doc.explicitStart || hasDirectives || index > 0 && !previousEnded;
3127
+ result += directives;
3128
+ if (doc.contents === null) {
3129
+ if (marker) result += "---\n";
3130
+ } else if (marker) {
3131
+ const body = writeNode(state, 0, doc.contents, null, {
3132
+ block: true,
3133
+ compact: true
3134
+ }).text;
3135
+ const sep = body === "" ? "" : hasDirectives || rootStartsOwnLine(doc.contents) ? "\n" : " ";
3136
+ result += `---${sep}${body}
3137
+ `;
3138
+ } else result += writeNode(state, 0, doc.contents, null, {
3139
+ block: true,
3140
+ compact: true
3141
+ }).text + "\n";
3142
+ previousEnded = doc.explicitEnd || state.openEnded;
3143
+ if (previousEnded) result += "...\n";
3144
+ }
3145
+ return result;
3146
+ }
3147
+ var DEFAULT_DUMP_OPTIONS = {
3148
+ ...DEFAULT_PRESENTER_OPTIONS,
3149
+ schema: DUMP_SCHEMA,
3150
+ skipInvalid: false,
3151
+ noRefs: false,
3152
+ flowLevel: -1,
3153
+ sortKeys: false,
3154
+ transform: () => {
3155
+ }
3156
+ };
3157
+ function defaultCompareFn(a, b) {
3158
+ const x = String(a);
3159
+ const y = String(b);
3160
+ if (x < y) return -1;
3161
+ if (x > y) return 1;
3162
+ return 0;
3163
+ }
3164
+ function dump(input, options = {}) {
3165
+ const opts = {
3166
+ ...DEFAULT_DUMP_OPTIONS,
3167
+ ...options
3168
+ };
3169
+ const documents = jsToAst(input, opts.schema, {
3170
+ noRefs: opts.noRefs,
3171
+ skipInvalid: opts.skipInvalid
3172
+ });
3173
+ if (opts.flowLevel >= 0) visit(documents, (node, ctx) => {
3174
+ if (ctx.depth < opts.flowLevel) return;
3175
+ if (node.kind === "sequence" || node.kind === "mapping") node.style = COLLECTION_STYLE.FLOW;
3176
+ return VISIT_SKIP;
3177
+ });
3178
+ if (opts.sortKeys) {
3179
+ const compareFn = opts.sortKeys === true ? defaultCompareFn : opts.sortKeys;
3180
+ visit(documents, (node) => {
3181
+ if (node.kind !== "mapping") return;
3182
+ node.items.sort((a, b) => compareFn(a.key.kind === "scalar" ? a.key.value : "", b.key.kind === "scalar" ? b.key.value : ""));
3183
+ });
3184
+ }
3185
+ opts.transform(documents);
3186
+ return present(documents, {
3187
+ ...pick(opts, Object.keys(DEFAULT_PRESENTER_OPTIONS)),
3188
+ schema: opts.schema
3189
+ });
3190
+ }
3191
+ var NO_RANGE = -1;
3192
+ function eventPosition(event) {
3193
+ if ("tagStart" in event && event.tagStart !== NO_RANGE) return event.tagStart;
3194
+ if ("anchorStart" in event && event.anchorStart !== NO_RANGE) return event.anchorStart;
3195
+ if ("valueStart" in event && event.valueStart !== NO_RANGE) return event.valueStart;
3196
+ if ("start" in event) return event.start;
3197
+ return 0;
3198
+ }
3199
+ function rawTag(state, event) {
3200
+ return event.tagStart === NO_RANGE ? "" : state.source.slice(event.tagStart, event.tagEnd);
3201
+ }
3202
+ function anchorName(state, event) {
3203
+ return event.anchorStart === NO_RANGE ? void 0 : state.source.slice(event.anchorStart, event.anchorEnd);
3204
+ }
3205
+ function buildScalar(state, event) {
3206
+ const value = getScalarValue(state.source, event);
3207
+ const raw = rawTag(state, event);
3208
+ let tag;
3209
+ let tagged = false;
3210
+ if (raw !== "") {
3211
+ tagged = true;
3212
+ tag = raw;
3213
+ } else if (event.style === SCALAR_STYLE.PLAIN) tag = state.schema.resolveImplicitScalarTag(value).tag.tagName;
3214
+ else tag = state.schema.defaultScalarTag.tagName;
3215
+ return {
3216
+ kind: "scalar",
3217
+ tag,
3218
+ tagged,
3219
+ style: event.style,
3220
+ anchor: anchorName(state, event),
3221
+ value
3222
+ };
3223
+ }
3224
+ function buildCollection(state, event, defaultTagName) {
3225
+ const raw = rawTag(state, event);
3226
+ let tag;
3227
+ let tagged = false;
3228
+ if (raw === "") tag = defaultTagName;
3229
+ else {
3230
+ tag = raw;
3231
+ tagged = true;
3232
+ }
3233
+ return {
3234
+ tag,
3235
+ tagged,
3236
+ style: event.style,
3237
+ anchor: anchorName(state, event)
3238
+ };
3239
+ }
3240
+ function addNode(state, node) {
3241
+ const frame = state.frames[state.frames.length - 1];
3242
+ if (frame.kind === "document") frame.doc.contents = node;
3243
+ else if (frame.kind === "sequence") frame.node.items.push(node);
3244
+ else if (frame.key) {
3245
+ frame.node.items.push({
3246
+ key: frame.key,
3247
+ value: node
3248
+ });
3249
+ frame.key = null;
3250
+ } else frame.key = node;
3251
+ }
3252
+ function eventsToAst(events, options) {
3253
+ const state = {
3254
+ source: options.source,
3255
+ schema: options.schema,
3256
+ eventIndex: 0,
3257
+ position: 0,
3258
+ frames: [],
3259
+ documents: []
3260
+ };
3261
+ while (state.eventIndex < events.length) {
3262
+ const event = events[state.eventIndex++];
3263
+ state.position = eventPosition(event);
3264
+ switch (event.type) {
3265
+ case EVENT_ID.DOCUMENT: {
3266
+ const doc = {
3267
+ contents: null,
3268
+ explicitStart: event.explicitStart,
3269
+ explicitEnd: event.explicitEnd,
3270
+ directives: event.directives
3271
+ };
3272
+ state.frames.push({
3273
+ kind: "document",
3274
+ doc
3275
+ });
3276
+ break;
3277
+ }
3278
+ case EVENT_ID.SCALAR:
3279
+ addNode(state, buildScalar(state, event));
3280
+ break;
3281
+ case EVENT_ID.SEQUENCE: {
3282
+ const { tag, tagged, style, anchor } = buildCollection(state, event, "tag:yaml.org,2002:seq");
3283
+ const node = {
3284
+ kind: "sequence",
3285
+ tag,
3286
+ tagged,
3287
+ style,
3288
+ anchor,
3289
+ items: []
3290
+ };
3291
+ state.frames.push({
3292
+ kind: "sequence",
3293
+ node
3294
+ });
3295
+ break;
3296
+ }
3297
+ case EVENT_ID.MAPPING: {
3298
+ const { tag, tagged, style, anchor } = buildCollection(state, event, "tag:yaml.org,2002:map");
3299
+ const node = {
3300
+ kind: "mapping",
3301
+ tag,
3302
+ tagged,
3303
+ style,
3304
+ anchor,
3305
+ items: []
3306
+ };
3307
+ state.frames.push({
3308
+ kind: "mapping",
3309
+ node,
3310
+ key: null
3311
+ });
3312
+ break;
3313
+ }
3314
+ case EVENT_ID.ALIAS:
3315
+ addNode(state, {
3316
+ kind: "alias",
3317
+ anchor: state.source.slice(event.anchorStart, event.anchorEnd)
3318
+ });
3319
+ break;
3320
+ case EVENT_ID.POP: {
3321
+ const frame = state.frames.pop();
3322
+ if (frame.kind === "mapping" && frame.key) throw new Error("incomplete mapping pair in event stream");
3323
+ if (frame.kind === "document") state.documents.push(frame.doc);
3324
+ else addNode(state, frame.node);
3325
+ break;
3326
+ }
3327
+ }
3328
+ }
3329
+ return state.documents;
3330
+ }
3331
+ var EVENT_DOCUMENT = EVENT_ID.DOCUMENT;
3332
+ var EVENT_SEQUENCE = EVENT_ID.SEQUENCE;
3333
+ var EVENT_MAPPING = EVENT_ID.MAPPING;
3334
+ var EVENT_SCALAR = EVENT_ID.SCALAR;
3335
+ var EVENT_ALIAS = EVENT_ID.ALIAS;
3336
+ var EVENT_POP = EVENT_ID.POP;
3337
+ var SCALAR_STYLE_PLAIN = SCALAR_STYLE.PLAIN;
3338
+ var SCALAR_STYLE_SINGLE_QUOTED = SCALAR_STYLE.SINGLE_QUOTED;
3339
+ var SCALAR_STYLE_DOUBLE_QUOTED = SCALAR_STYLE.DOUBLE_QUOTED;
3340
+ var SCALAR_STYLE_LITERAL_BLOCK = SCALAR_STYLE.LITERAL_BLOCK;
3341
+ var SCALAR_STYLE_FOLDED_BLOCK = SCALAR_STYLE.FOLDED_BLOCK;
3342
+ var COLLECTION_STYLE_BLOCK = COLLECTION_STYLE.BLOCK;
3343
+ var COLLECTION_STYLE_FLOW = COLLECTION_STYLE.FLOW;
3344
+ var CHOMPING_CLIP = CHOMPING_MODE.CLIP;
3345
+ var CHOMPING_STRIP = CHOMPING_MODE.STRIP;
3346
+ var CHOMPING_KEEP = CHOMPING_MODE.KEEP;
3347
+
3348
+ // dist/clients/deps/js-yaml.js
3349
+ var js_yaml_default = js_yaml_exports;
3350
+ var dump2 = dump;
3351
+ var load2 = load;
3352
+
3353
+ export {
3354
+ getPackageRoot,
3355
+ resolvePackagePath,
3356
+ js_yaml_default,
3357
+ dump2 as dump,
3358
+ load2 as load
3359
+ };
3360
+ /*! Bundled license information:
3361
+
3362
+ js-yaml/dist/js-yaml.mjs:
3363
+ (*! js-yaml 5.4.2 https://github.com/nodeca/js-yaml @license MIT *)
3364
+ */