copperflow 0.3.4 → 0.4.1
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.
- package/README.md +117 -14
- package/dist/app/THIRD_PARTY_LICENSES.txt +5 -0
- package/dist/app/assets/NewPartDialog-ZQ4Y3m45.js +1 -0
- package/dist/app/assets/PackagesDialog-C8ZyWl-g.css +1 -0
- package/dist/app/assets/PackagesDialog-vEzilmpR.js +2 -0
- package/dist/app/assets/VerifyPartDialog-BHLqD_WJ.css +1 -0
- package/dist/app/assets/VerifyPartDialog-DYr1UIds.js +2 -0
- package/dist/app/assets/footprint-preview-Nyk2poiN.js +160 -0
- package/dist/app/assets/index-BUjGdMvr.js +20 -0
- package/dist/app/assets/index-CF7-tL4t.css +1 -0
- package/dist/app/assets/texture-worker-CyI_g_XZ.js +1 -0
- package/dist/app/index.html +2 -2
- package/dist/cli-commands.js +141 -16
- package/dist/cli-commands.js.map +1 -1
- package/dist/cli-impedance.d.ts +4 -0
- package/dist/cli-impedance.js +56 -0
- package/dist/cli-impedance.js.map +1 -0
- package/dist/cli-simulate.d.ts +3 -0
- package/dist/cli-simulate.js +54 -0
- package/dist/cli-simulate.js.map +1 -0
- package/dist/core/analyze.js +5 -2
- package/dist/core/analyze.js.map +1 -1
- package/dist/core/bom.d.ts +6 -1
- package/dist/core/bom.js +23 -4
- package/dist/core/bom.js.map +1 -1
- package/dist/core/case-results.d.ts +4 -0
- package/dist/core/case-results.js +9 -0
- package/dist/core/case-results.js.map +1 -0
- package/dist/core/change-files.d.ts +31 -0
- package/dist/core/change-files.js +67 -0
- package/dist/core/change-files.js.map +1 -0
- package/dist/core/change-render.d.ts +18 -0
- package/dist/core/change-render.js +48 -0
- package/dist/core/change-render.js.map +1 -0
- package/dist/core/change-view.d.ts +33 -0
- package/dist/core/change-view.js +73 -0
- package/dist/core/change-view.js.map +1 -0
- package/dist/core/change-words.d.ts +39 -0
- package/dist/core/change-words.js +214 -0
- package/dist/core/change-words.js.map +1 -0
- package/dist/core/checklist-text.d.ts +21 -0
- package/dist/core/checklist-text.js +59 -0
- package/dist/core/checklist-text.js.map +1 -0
- package/dist/core/edit.js +5 -2
- package/dist/core/edit.js.map +1 -1
- package/dist/core/fabrication.d.ts +9 -2
- package/dist/core/fabrication.js +29 -10
- package/dist/core/fabrication.js.map +1 -1
- package/dist/core/library.d.ts +46 -0
- package/dist/core/library.js +54 -16
- package/dist/core/library.js.map +1 -1
- package/dist/core/model-export.d.ts +33 -0
- package/dist/core/model-export.js +33 -0
- package/dist/core/model-export.js.map +1 -0
- package/dist/core/modules.d.ts +1 -0
- package/dist/core/modules.js +17 -0
- package/dist/core/modules.js.map +1 -1
- package/dist/core/order-report.d.ts +10 -0
- package/dist/core/order-report.js +93 -0
- package/dist/core/order-report.js.map +1 -0
- package/dist/core/packages.d.ts +18 -0
- package/dist/core/packages.js +49 -0
- package/dist/core/packages.js.map +1 -0
- package/dist/core/pin-header.d.ts +5 -0
- package/dist/core/pin-header.js +77 -0
- package/dist/core/pin-header.js.map +1 -0
- package/dist/core/pin-map.d.ts +46 -0
- package/dist/core/pin-map.js +101 -0
- package/dist/core/pin-map.js.map +1 -0
- package/dist/core/render.d.ts +26 -5
- package/dist/core/render.js +16 -6
- package/dist/core/render.js.map +1 -1
- package/dist/core/sheet-card.d.ts +4 -0
- package/dist/core/sheet-card.js +46 -1
- package/dist/core/sheet-card.js.map +1 -1
- package/dist/core/sheet-files.js +10 -3
- package/dist/core/sheet-files.js.map +1 -1
- package/dist/core/simulate.d.ts +19 -0
- package/dist/core/simulate.js +72 -0
- package/dist/core/simulate.js.map +1 -0
- package/dist/core/step-export.d.ts +17 -0
- package/dist/core/step-export.js +35 -0
- package/dist/core/step-export.js.map +1 -0
- package/dist/core/supplier-prop.d.ts +6 -0
- package/dist/core/supplier-prop.js +21 -0
- package/dist/core/supplier-prop.js.map +1 -0
- package/dist/core/workspace.d.ts +2 -1
- package/dist/core/workspace.js +2 -1
- package/dist/core/workspace.js.map +1 -1
- package/dist/engine/board.js +3 -1
- package/dist/engine/board.js.map +1 -1
- package/dist/engine/checks/fast-lines.d.ts +60 -0
- package/dist/engine/checks/fast-lines.js +209 -0
- package/dist/engine/checks/fast-lines.js.map +1 -0
- package/dist/engine/checks/index.js +2 -0
- package/dist/engine/checks/index.js.map +1 -1
- package/dist/engine/design-diff.d.ts +120 -0
- package/dist/engine/design-diff.js +249 -0
- package/dist/engine/design-diff.js.map +1 -0
- package/dist/engine/design.d.ts +3 -0
- package/dist/engine/design.js +7 -2
- package/dist/engine/design.js.map +1 -1
- package/dist/engine/fab/export.d.ts +17 -1
- package/dist/engine/fab/export.js +26 -4
- package/dist/engine/fab/export.js.map +1 -1
- package/dist/engine/fab/names.d.ts +2 -2
- package/dist/engine/fab/names.js +4 -2
- package/dist/engine/fab/names.js.map +1 -1
- package/dist/engine/fab/picture/board-picture.d.ts +52 -0
- package/dist/engine/fab/picture/board-picture.js +102 -0
- package/dist/engine/fab/picture/board-picture.js.map +1 -0
- package/dist/engine/fab/picture/board-view.d.ts +20 -0
- package/dist/engine/fab/picture/board-view.js +50 -0
- package/dist/engine/fab/picture/board-view.js.map +1 -0
- package/dist/engine/fab/picture/compose.d.ts +50 -0
- package/dist/engine/fab/picture/compose.js +208 -0
- package/dist/engine/fab/picture/compose.js.map +1 -0
- package/dist/engine/fab/picture/layer-images.d.ts +9 -0
- package/dist/engine/fab/picture/layer-images.js +67 -0
- package/dist/engine/fab/picture/layer-images.js.map +1 -0
- package/dist/engine/fab/picture/looks.d.ts +152 -0
- package/dist/engine/fab/picture/looks.js +53 -0
- package/dist/engine/fab/picture/looks.js.map +1 -0
- package/dist/engine/fab/picture/png.d.ts +31 -0
- package/dist/engine/fab/picture/png.js +47 -0
- package/dist/engine/fab/picture/png.js.map +1 -0
- package/dist/engine/fab/picture/raster.d.ts +46 -0
- package/dist/engine/fab/picture/raster.js +170 -0
- package/dist/engine/fab/picture/raster.js.map +1 -0
- package/dist/engine/fab/zip.d.ts +2 -1
- package/dist/engine/fab/zip.js +1 -1
- package/dist/engine/fab/zip.js.map +1 -1
- package/dist/engine/footprints/array.d.ts +4 -0
- package/dist/engine/footprints/array.js +51 -0
- package/dist/engine/footprints/array.js.map +1 -0
- package/dist/engine/footprints/axial.d.ts +6 -0
- package/dist/engine/footprints/axial.js +115 -0
- package/dist/engine/footprints/axial.js.map +1 -0
- package/dist/engine/footprints/catalogue.d.ts +39 -0
- package/dist/engine/footprints/catalogue.js +284 -0
- package/dist/engine/footprints/catalogue.js.map +1 -0
- package/dist/engine/footprints/chip.js +10 -1
- package/dist/engine/footprints/chip.js.map +1 -1
- package/dist/engine/footprints/connector.d.ts +16 -0
- package/dist/engine/footprints/connector.js +31 -0
- package/dist/engine/footprints/connector.js.map +1 -0
- package/dist/engine/footprints/dcjack.d.ts +3 -0
- package/dist/engine/footprints/dcjack.js +46 -0
- package/dist/engine/footprints/dcjack.js.map +1 -0
- package/dist/engine/footprints/dpak.d.ts +7 -0
- package/dist/engine/footprints/dpak.js +172 -0
- package/dist/engine/footprints/dpak.js.map +1 -0
- package/dist/engine/footprints/dual.d.ts +11 -2
- package/dist/engine/footprints/dual.js +113 -12
- package/dist/engine/footprints/dual.js.map +1 -1
- package/dist/engine/footprints/index.js +46 -3
- package/dist/engine/footprints/index.js.map +1 -1
- package/dist/engine/footprints/inductor.d.ts +3 -0
- package/dist/engine/footprints/inductor.js +32 -0
- package/dist/engine/footprints/inductor.js.map +1 -0
- package/dist/engine/footprints/known.js +114 -14
- package/dist/engine/footprints/known.js.map +1 -1
- package/dist/engine/footprints/ledsmd.d.ts +3 -0
- package/dist/engine/footprints/ledsmd.js +52 -0
- package/dist/engine/footprints/ledsmd.js.map +1 -0
- package/dist/engine/footprints/ledth.d.ts +4 -0
- package/dist/engine/footprints/ledth.js +45 -0
- package/dist/engine/footprints/ledth.js.map +1 -0
- package/dist/engine/footprints/melf.d.ts +8 -0
- package/dist/engine/footprints/melf.js +56 -0
- package/dist/engine/footprints/melf.js.map +1 -0
- package/dist/engine/footprints/plcc.d.ts +4 -0
- package/dist/engine/footprints/plcc.js +117 -0
- package/dist/engine/footprints/plcc.js.map +1 -0
- package/dist/engine/footprints/resonator.d.ts +3 -0
- package/dist/engine/footprints/resonator.js +33 -0
- package/dist/engine/footprints/resonator.js.map +1 -0
- package/dist/engine/footprints/screw.d.ts +3 -0
- package/dist/engine/footprints/screw.js +51 -0
- package/dist/engine/footprints/screw.js.map +1 -0
- package/dist/engine/footprints/smallsot.d.ts +8 -0
- package/dist/engine/footprints/smallsot.js +143 -0
- package/dist/engine/footprints/smallsot.js.map +1 -0
- package/dist/engine/footprints/smdbox.d.ts +33 -0
- package/dist/engine/footprints/smdbox.js +76 -0
- package/dist/engine/footprints/smdbox.js.map +1 -0
- package/dist/engine/footprints/smdcan.d.ts +3 -0
- package/dist/engine/footprints/smdcan.js +61 -0
- package/dist/engine/footprints/smdcan.js.map +1 -0
- package/dist/engine/footprints/smdip.d.ts +4 -0
- package/dist/engine/footprints/smdip.js +58 -0
- package/dist/engine/footprints/smdip.js.map +1 -0
- package/dist/engine/footprints/socket.d.ts +8 -0
- package/dist/engine/footprints/socket.js +21 -0
- package/dist/engine/footprints/socket.js.map +1 -0
- package/dist/engine/footprints/sod.d.ts +6 -0
- package/dist/engine/footprints/sod.js +63 -6
- package/dist/engine/footprints/sod.js.map +1 -1
- package/dist/engine/footprints/sot.d.ts +1 -1
- package/dist/engine/footprints/sot.js +17 -2
- package/dist/engine/footprints/sot.js.map +1 -1
- package/dist/engine/footprints/tact.d.ts +3 -0
- package/dist/engine/footprints/tact.js +65 -0
- package/dist/engine/footprints/tact.js.map +1 -0
- package/dist/engine/footprints/tantalum.d.ts +7 -0
- package/dist/engine/footprints/tantalum.js +91 -0
- package/dist/engine/footprints/tantalum.js.map +1 -0
- package/dist/engine/footprints/to92inline.d.ts +14 -0
- package/dist/engine/footprints/to92inline.js +21 -0
- package/dist/engine/footprints/to92inline.js.map +1 -0
- package/dist/engine/footprints/topower.d.ts +7 -0
- package/dist/engine/footprints/topower.js +119 -0
- package/dist/engine/footprints/topower.js.map +1 -0
- package/dist/engine/footprints/usb.d.ts +32 -0
- package/dist/engine/footprints/usb.js +109 -0
- package/dist/engine/footprints/usb.js.map +1 -0
- package/dist/engine/footprints/xtal.d.ts +4 -0
- package/dist/engine/footprints/xtal.js +61 -0
- package/dist/engine/footprints/xtal.js.map +1 -0
- package/dist/engine/impedance.d.ts +72 -0
- package/dist/engine/impedance.js +133 -0
- package/dist/engine/impedance.js.map +1 -0
- package/dist/engine/line-length.d.ts +15 -0
- package/dist/engine/line-length.js +116 -0
- package/dist/engine/line-length.js.map +1 -0
- package/dist/engine/model.d.ts +2 -0
- package/dist/engine/model.js.map +1 -1
- package/dist/engine/pcb-place/roles.d.ts +3 -1
- package/dist/engine/pcb-place/roles.js +5 -0
- package/dist/engine/pcb-place/roles.js.map +1 -1
- package/dist/engine/rules/impedance-widths.d.ts +20 -0
- package/dist/engine/rules/impedance-widths.js +57 -0
- package/dist/engine/rules/impedance-widths.js.map +1 -0
- package/dist/engine/rules/load.js +11 -2
- package/dist/engine/rules/load.js.map +1 -1
- package/dist/engine/rules/pairs.d.ts +27 -0
- package/dist/engine/rules/pairs.js +86 -0
- package/dist/engine/rules/pairs.js.map +1 -0
- package/dist/engine/rules/profiles.js +16 -0
- package/dist/engine/rules/profiles.js.map +1 -1
- package/dist/engine/rules/rotations.d.ts +12 -3
- package/dist/engine/rules/rotations.js +77 -2
- package/dist/engine/rules/rotations.js.map +1 -1
- package/dist/engine/rules/schema.d.ts +44 -0
- package/dist/engine/rules/schema.js +16 -1
- package/dist/engine/rules/schema.js.map +1 -1
- package/dist/engine/sim/answer.d.ts +13 -0
- package/dist/engine/sim/answer.js +101 -0
- package/dist/engine/sim/answer.js.map +1 -0
- package/dist/engine/sim/cases.d.ts +29 -0
- package/dist/engine/sim/cases.js +63 -0
- package/dist/engine/sim/cases.js.map +1 -0
- package/dist/engine/sim/devices.d.ts +109 -0
- package/dist/engine/sim/devices.js +137 -0
- package/dist/engine/sim/devices.js.map +1 -0
- package/dist/engine/sim/elements.d.ts +49 -0
- package/dist/engine/sim/elements.js +2 -0
- package/dist/engine/sim/elements.js.map +1 -0
- package/dist/engine/sim/from-circuit.d.ts +52 -0
- package/dist/engine/sim/from-circuit.js +354 -0
- package/dist/engine/sim/from-circuit.js.map +1 -0
- package/dist/engine/sim/limits.d.ts +12 -0
- package/dist/engine/sim/limits.js +79 -0
- package/dist/engine/sim/limits.js.map +1 -0
- package/dist/engine/sim/linear.d.ts +2 -0
- package/dist/engine/sim/linear.js +49 -0
- package/dist/engine/sim/linear.js.map +1 -0
- package/dist/engine/sim/model-schema.d.ts +246 -0
- package/dist/engine/sim/model-schema.js +115 -0
- package/dist/engine/sim/model-schema.js.map +1 -0
- package/dist/engine/sim/part-models.d.ts +47 -0
- package/dist/engine/sim/part-models.js +102 -0
- package/dist/engine/sim/part-models.js.map +1 -0
- package/dist/engine/sim/run.d.ts +14 -0
- package/dist/engine/sim/run.js +13 -0
- package/dist/engine/sim/run.js.map +1 -0
- package/dist/engine/sim/solve.d.ts +42 -0
- package/dist/engine/sim/solve.js +294 -0
- package/dist/engine/sim/solve.js.map +1 -0
- package/dist/engine/sim/spice.d.ts +5 -0
- package/dist/engine/sim/spice.js +66 -0
- package/dist/engine/sim/spice.js.map +1 -0
- package/dist/engine/sim/values.d.ts +4 -0
- package/dist/engine/sim/values.js +40 -0
- package/dist/engine/sim/values.js.map +1 -0
- package/dist/engine/solid/heights-smd.d.ts +3 -0
- package/dist/engine/solid/heights-smd.js +81 -0
- package/dist/engine/solid/heights-smd.js.map +1 -0
- package/dist/engine/solid/heights-through.d.ts +7 -0
- package/dist/engine/solid/heights-through.js +93 -0
- package/dist/engine/solid/heights-through.js.map +1 -0
- package/dist/engine/solid/heights-uno.d.ts +2 -0
- package/dist/engine/solid/heights-uno.js +15 -0
- package/dist/engine/solid/heights-uno.js.map +1 -0
- package/dist/engine/solid/heights.d.ts +31 -0
- package/dist/engine/solid/heights.js +112 -0
- package/dist/engine/solid/heights.js.map +1 -0
- package/dist/engine/solid/limits.d.ts +7 -0
- package/dist/engine/solid/limits.js +20 -0
- package/dist/engine/solid/limits.js.map +1 -0
- package/dist/engine/solid/model.d.ts +54 -0
- package/dist/engine/solid/model.js +147 -0
- package/dist/engine/solid/model.js.map +1 -0
- package/dist/engine/solid/step.d.ts +5 -0
- package/dist/engine/solid/step.js +164 -0
- package/dist/engine/solid/step.js.map +1 -0
- package/dist/engine/solid/thickness.d.ts +11 -0
- package/dist/engine/solid/thickness.js +10 -0
- package/dist/engine/solid/thickness.js.map +1 -0
- package/dist/library/kicad/board.d.ts +26 -0
- package/dist/library/kicad/board.js +96 -0
- package/dist/library/kicad/board.js.map +1 -0
- package/dist/library/kicad/copper.d.ts +44 -0
- package/dist/library/kicad/copper.js +106 -0
- package/dist/library/kicad/copper.js.map +1 -0
- package/dist/library/kicad/footprints.d.ts +62 -0
- package/dist/library/kicad/footprints.js +184 -0
- package/dist/library/kicad/footprints.js.map +1 -0
- package/dist/library/kicad/geometry.d.ts +36 -0
- package/dist/library/kicad/geometry.js +84 -0
- package/dist/library/kicad/geometry.js.map +1 -0
- package/dist/library/kicad/import.d.ts +58 -0
- package/dist/library/kicad/import.js +240 -0
- package/dist/library/kicad/import.js.map +1 -0
- package/dist/library/kicad/plan.d.ts +40 -0
- package/dist/library/kicad/plan.js +139 -0
- package/dist/library/kicad/plan.js.map +1 -0
- package/dist/library/kicad/read.d.ts +30 -0
- package/dist/library/kicad/read.js +105 -0
- package/dist/library/kicad/read.js.map +1 -0
- package/dist/library/kicad/sexpr.d.ts +36 -0
- package/dist/library/kicad/sexpr.js +153 -0
- package/dist/library/kicad/sexpr.js.map +1 -0
- package/dist/library/kicad/tally.d.ts +32 -0
- package/dist/library/kicad/tally.js +55 -0
- package/dist/library/kicad/tally.js.map +1 -0
- package/dist/library/kicad/write.d.ts +37 -0
- package/dist/library/kicad/write.js +146 -0
- package/dist/library/kicad/write.js.map +1 -0
- package/dist/library/new-part.d.ts +2 -0
- package/dist/library/new-part.js +1 -0
- package/dist/library/new-part.js.map +1 -1
- package/dist/mcp/board-import-tool.d.ts +1 -1
- package/dist/mcp/board-import-tool.js +14 -4
- package/dist/mcp/board-import-tool.js.map +1 -1
- package/dist/mcp/copper-summary.d.ts +2 -0
- package/dist/mcp/copper-summary.js +4 -2
- package/dist/mcp/copper-summary.js.map +1 -1
- package/dist/mcp/create-part.d.ts +23 -0
- package/dist/mcp/create-part.js +1 -0
- package/dist/mcp/create-part.js.map +1 -1
- package/dist/mcp/fast-summary.d.ts +3 -0
- package/dist/mcp/fast-summary.js +46 -0
- package/dist/mcp/fast-summary.js.map +1 -0
- package/dist/mcp/guide.d.ts +3 -1
- package/dist/mcp/guide.js +15 -4
- package/dist/mcp/guide.js.map +1 -1
- package/dist/mcp/model-tool.d.ts +31 -0
- package/dist/mcp/model-tool.js +27 -0
- package/dist/mcp/model-tool.js.map +1 -0
- package/dist/mcp/render-tool.d.ts +33 -2
- package/dist/mcp/render-tool.js +21 -5
- package/dist/mcp/render-tool.js.map +1 -1
- package/dist/mcp/server.js +20 -8
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/sheet-card-tools.d.ts +3 -1
- package/dist/mcp/sheet-card-tools.js +3 -1
- package/dist/mcp/sheet-card-tools.js.map +1 -1
- package/dist/mcp/simulate-tool.d.ts +10 -0
- package/dist/mcp/simulate-tool.js +12 -0
- package/dist/mcp/simulate-tool.js.map +1 -0
- package/dist/render/render.js +11327 -1645
- package/dist/studio/change-route.d.ts +18 -0
- package/dist/studio/change-route.js +24 -0
- package/dist/studio/change-route.js.map +1 -0
- package/dist/studio/http-error.d.ts +5 -0
- package/dist/studio/http-error.js +9 -0
- package/dist/studio/http-error.js.map +1 -0
- package/dist/studio/live.d.ts +2 -0
- package/dist/studio/live.js.map +1 -1
- package/dist/studio/server.js +43 -15
- package/dist/studio/server.js.map +1 -1
- package/dist/studio/verify-routes.d.ts +42 -0
- package/dist/studio/verify-routes.js +110 -0
- package/dist/studio/verify-routes.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/library/modules/CanNode/CanNode.sheet.tsx +1 -1
- package/library/modules/CanNode/parts/MCP2515-I-SO/MCP2515_I_SO.tsx +1 -0
- package/library/modules/CanNode/parts/MCP2515-I-SO/part.yaml +2 -0
- package/library/modules/CanNode/parts/MCP2515-I-SO/verification.md +2 -1
- package/library/modules/CanNode/parts/TJA1051T-3/TJA1051T_3.tsx +1 -0
- package/library/modules/CanNode/parts/TJA1051T-3/part.yaml +2 -0
- package/library/modules/CanNode/parts/TJA1051T-3/verification.md +2 -1
- package/library/modules/DigitalInput24V/DigitalInput24V.sheet.tsx +7 -7
- package/library/modules/RelayDriver/RelayDriver.sheet.tsx +3 -3
- package/library/modules/RelayDriver/parts/AO3400A/part.yaml +34 -0
- package/library/modules/RelayDriver/parts/AO3400A/verification.md +11 -1
- package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/SRD_12VDC_SL_C.tsx +1 -0
- package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/part.yaml +14 -0
- package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/verification.md +4 -1
- package/package.json +2 -1
- package/skills/copperflow/references/copper.md +8 -0
- package/skills/copperflow/references/design-rules.md +57 -6
- package/skills/copperflow/references/editable-subset.md +18 -8
- package/skills/copperflow/references/modules.md +26 -0
- package/skills/copperflow/references/parts-library.md +2 -1
- package/skills/copperflow/references/writing-circuits.md +9 -0
- package/dist/app/assets/NewPartDialog-C4sKWnGI.js +0 -160
- package/dist/app/assets/index-BgzJedaB.css +0 -1
- package/dist/app/assets/index-C_U9me2P.js +0 -19
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import{_ as e,g as t}from"./index-BUjGdMvr.js";function n(e,t,n){let r=e.span.max-e.span.min,i=e.terminal.max-e.terminal.min,a=e.width.max-e.width.min,o=e.span.min-2*e.terminal.max,s=e.span.max-2*e.terminal.min,c=Math.sqrt(r**2+2*i**2),l=s-(s-o-c)/2,u=e=>Math.sqrt(e**2+n.fabrication**2+n.placement**2);return{Z:e.span.min+2*t.toe+u(r),G:l-2*t.heel-u(c),X:e.width.min+2*t.side+u(a)}}function r(e,t,r){let i=n(e,t,r),a=e.span.max-e.span.min,o=e.terminal.max-e.terminal.min,s=e.span.min-2*e.terminal.max,c=e.span.max-2*e.terminal.min,l=c-(c-s-Math.sqrt(a**2+2*o**2))/2,u=Math.sqrt(a**2+r.fabrication**2+r.placement**2);return{...i,G:l-2*t.heel-u}}var i=Object.freeze({fabrication:.1,placement:.05});function a(e,t,n){return Object.freeze({goals:Object.freeze(e),roundOff:t,courtyardExcess:n})}var o=a({toe:.35,heel:0,side:0},.05,.25),s=a({toe:.2,heel:0,side:0},.02,.15),c=a({toe:.35,heel:.35,side:.03},.05,.25),l=a({toe:.35,heel:.35,side:-.02},.05,.25);function u(e){return e>.625000001?c:l}var d=a({toe:.3,heel:0,side:-.04},.05,.25),f=a({toe:.15,heel:.5,side:-.05},.05,.25),p=.15;function m(e){return(e.min+e.max)/2<1.599999999?s:o}function h(e,t,n=c){let r=e.span.min-2*e.terminal.max,i=e.terminal.max-e.terminal.min;return r<=t+1e-9&&i<=.500000001?{...n.goals,heel:p}:{...n.goals}}var g=1e-6;function _(e,t,n){let r=e/t;return n===`up`?Math.ceil(r-g):Math.round(r+g)}function v(e,t){return _(e,t,`up`)/Math.round(1/t)}var y=.25,ee=.25;function b(e,t){let n=Math.round(1/t),r=_(e.Z,t,`nearest`),i=_(e.G,t,`nearest`),a=_(e.X,t,`nearest`);if(i<=0||r<=i)throw Error(`land pattern has no gap between its pads (Z ${e.Z}, G ${e.G})`);return{length:(r-i)/(2*n),width:a/n,centre:(r+i)/(4*n)}}function x(e,t){let n=b(e,t);return[S(`1`,-n.centre,0,n.length,n.width),S(`2`,n.centre,0,n.length,n.width)]}function S(e,t,n,r,i){return{number:e,shape:`roundrect`,x:t,y:n,width:r,height:i,rotation:0,layers:`top`,cornerRadius:Math.min(ee,y*Math.min(r,i))}}var C=.15,te=1e6;function w(e){return Math.round(e*te)/te+0}function T(e,t){return Array.from({length:e},(n,r)=>w((r-(e-1)/2)*t))}function ne(e){return Math.abs(e.rotation%180)===90?{x:e.height/2,y:e.width/2}:{x:e.width/2,y:e.height/2}}function E(e){return e.reduce((e,t)=>{let n=ne(t);return{x:Math.max(e.x,Math.abs(t.x)+n.x),y:Math.max(e.y,Math.abs(t.y)+n.y)}},{x:0,y:0})}function re(e,t){let n=e.map(e=>({pad:e,half:ne(e)}));return n.every((e,r)=>n.slice(r+1).every(n=>{let r=Math.abs(e.pad.x-n.pad.x)-e.half.x-n.half.x,i=Math.abs(e.pad.y-n.pad.y)-e.half.y-n.half.y;return Math.max(r,i)>=t-1e-9}))}function ie(e,t=`x`){return Math.min(...e.map(e=>Math.abs(e[t])-ne(e)[t]))}function ae(e){return[{x:-e.x,y:-e.y},{x:e.x,y:-e.y},{x:e.x,y:e.y},{x:-e.x,y:e.y}]}function D(e,t,n){let r=E(e);return ae({x:v(Math.max(r.x,t.x)+n.courtyardExcess,n.roundOff),y:v(Math.max(r.y,t.y)+n.courtyardExcess,n.roundOff)})}function O(e){let t={x:w(e.x),y:w(e.y)};return[...ae(t),{x:-t.x,y:-t.y}]}function k(e){return[O(e)]}function oe(e,t){return w(Math.max(t.y,E(e).y+C))}function se(e,t){let n=oe(e,t),r=w(Math.min(t.x,ie(e)));return[[{x:-r,y:n},{x:r,y:n}],[{x:-r,y:-n},{x:r,y:-n}]]}function ce(e,t){let n=ie(e)-C,r=w(n>0?n:E(e).x+C),i=oe(e,t);return[{x:r,y:-i},{x:r,y:i}]}function le(e,t){let[n,r]=se(e,t),[,i]=n;return[[{x:-w(E(e).x),y:i.y},i],r]}function ue(e,t){let n=E(e),r=w(Math.max(t.x,n.x+C)),i=w(Math.min(t.y,ie(e,`y`)));return[[{x:-r,y:-w(n.y)},{x:-r,y:i}],[{x:r,y:-i},{x:r,y:i}]]}function de(e){let t=ne(e);return Math.abs(e.x)>Math.abs(e.y)?Math.abs(e.y)+t.y:Math.abs(e.x)+t.x}function fe(e,t){let n=w(Math.max(...e.map(de))+C),r=w(Math.max(t.x,n)),i=(e,t)=>[{x:w(e*r),y:w(t*n)},{x:w(e*r),y:w(t*r)},{x:w(e*n),y:w(t*r)}];return[[{x:-r,y:n},{x:-r,y:r}],[{x:-w(E(e).x),y:r},{x:-n,y:r}],i(1,1),i(1,-1),i(-1,-1)]}function pe(e,t,n,r,i=5){let a=Math.max(1,Math.ceil(Math.abs(r-n)/i));return Array.from({length:a+1},(i,o)=>{let s=(n+(r-n)*o/a)*Math.PI/180;return{x:w(e.x+t*Math.cos(s)),y:w(e.y+t*Math.sin(s))}})}function me(e,t){let n=ne(t);if(t.shape===`circle`)return Math.hypot(e.x-t.x,e.y-t.y)-n.x;let r=Math.max(Math.abs(e.x-t.x)-n.x,0),i=Math.max(Math.abs(e.y-t.y)-n.y,0);return Math.hypot(r,i)}function he(e,t){let n=[],r=[];for(let i of e)t.every(e=>me(i,e)>=.16999999999999998)?r.push(i):(r.length>1&&n.push(r),r=[]);return r.length>1&&n.push(r),n}var ge=1;function _e(e,t){return[{x:w(e.x-ge/2),y:w(t)},{x:w(e.x+ge/2),y:w(t)}]}var ve=(e,t)=>({min:e,max:t}),ye=new Map([[`4x0603`,{label:`4 × 0603`,count:4,pitch:.8,bodyLength:ve(3,3.4),span:ve(1.4,1.8),terminal:ve(.2,.5),terminalWidth:ve(.3,.5)}],[`4x0402`,{label:`4 × 0402`,count:4,pitch:.5,bodyLength:ve(1.9,2.1),span:ve(.9,1.1),terminal:ve(.15,.35),terminalWidth:ve(.2,.3)}],[`2x0402`,{label:`2 × 0402`,count:2,pitch:.65,bodyLength:ve(.9,1.1),span:ve(.9,1.1),terminal:ve(.15,.35),terminalWidth:ve(.25,.4)}]]);function be(e){let t=e.variant===void 0&&e.suffix===void 0&&e.size===void 0&&e.pairs===void 0;if(!(e.kind!==`array`||!t||e.cross===void 0||Object.keys(e.params).length>0))return`${e.code}x${e.cross}`}function xe(e){let t=m(e.span),r=b(n({span:e.span,terminal:e.terminal,width:e.terminalWidth},t.goals,i),t.roundOff),a=T(e.count,e.pitch),o=a.map((e,t)=>S(String(t+1),e,-r.centre,r.width,r.length)),s=[...a].reverse().map((t,n)=>S(String(e.count+n+1),t,r.centre,r.width,r.length));return[...o,...s]}function Se(e){let t=be(e),n=t===void 0?void 0:ye.get(t);if(!t||!n)return;let r=xe(n),i={x:n.bodyLength.max/2,y:n.span.max/2};return{name:`array${t}`,pads:r,courtyard:D(r,i,m(n.span)),silkscreen:ue(r,i),fabrication:k(i),origin:`IPC-7351B nominal, chip resistor array ${n.label}`}}var A=e=>({refused:e}),Ce=e=>typeof e==`object`&&!!e&&`refused`in e,we=.1,j=e=>String(w(e)),Te=e=>e.x===e.y?j(e.x):`${j(e.x)}x${j(e.y)}`;function Ee(e){return Object.keys(e.params).every(e=>e===`p`)&&e.pairs===void 0}function De(e,t){let n=[...Object.keys(e.params),...Object.keys(e.pairs??{})].filter(e=>e!==`p`&&e!==`ep`);if(n.length>0)return A(`a ${t} takes only _p and _ep, not _${n[0]}`);let r=e.params.ep,i=e.pairs?.ep;if(r===!0)return A(`_ep needs the exposed pad's size, such as _ep3.1 or _ep1.6x2.4`);if(typeof r==`number`)return r>0?{x:r,y:r}:A(`the exposed pad needs a size above 0`);if(i)return i[0]>0&&i[1]>0?{x:i[0],y:i[1]}:A(`the exposed pad needs a size above 0`)}function Oe(e,t){return re(e,.1)?void 0:re(t?e.slice(0,-1):e,.1)?A(`the exposed pad would touch the pins`):A(`the pins would come closer than ${we} mm to each other`)}var M=(e,t)=>({min:e,max:t});function ke(e){return{span:e.span,terminal:e.terminal,width:e.leadWidth}}function N(e){let t=u(e.pitch),n=h(ke(e),e.bodyAcross.max,t);return{row:b(r(ke(e),n,i),t.roundOff),table:t}}function Ae(e){return{row:b(n(ke(e),d.goals,i),d.roundOff),table:d}}var je=1e-6,Me=e=>(e.min+e.max)/2;function Ne(e,t,n=[]){return Object.entries(e).every(([e,r])=>e===`p`?r!==!0&&Math.abs(r-t.pitch)<je:e===`w`?r!==!0&&Math.abs(r-Me(t.span))<je:n.includes(e)&&r===!0)}var Pe=.2,Fe=.05,Ie=.5,Le=.05,Re={courtyardExcess:.25,roundOff:Le};function ze(e,t){return t?Math.hypot(e.max,t.max):e.max}function Be(e){let t=v(e+Pe,Le);return{drill:t,pad:v(t+2*Fe+Ie,Le)}}function P(e,t,n,r,i=!1){return{number:e,shape:i?`rect`:`circle`,x:t,y:n,width:r.pad,height:r.pad,rotation:0,layers:`through`,drill:{width:r.drill,height:r.drill}}}var Ve=[{upTo:3.7,diameter:1.8},{upTo:6.6,diameter:2.5},{upTo:9.1,diameter:3.5},{upTo:12.1,diameter:4.5},{upTo:1/0,diameter:5.5}],He=M(.55,.65),Ue=M(.75,.85),We=6.6,Ge=1.5,Ke=1,qe=30,Je=20,Ye=60,Xe=.6,Ze=.05,Qe=new Map([[`do35`,{label:`DO-35`,length:4.2,diameter:2,lead:M(.46,.56),pitch:7.62,diode:!0}],[`do41`,{label:`DO-41`,length:5.2,diameter:2.7,lead:M(.71,.86),pitch:10.16,diode:!0}],[`do15`,{label:`DO-15`,length:7.6,diameter:3.6,lead:M(.69,.88),pitch:12.7,diode:!0}],[`do201ad`,{label:`DO-201AD`,length:9.5,diameter:5.3,lead:M(1.2,1.3),pitch:15.24,diode:!0}]]),$e=e=>e.suffix===void 0&&e.size===void 0&&e.pairs===void 0&&e.variant===void 0;function et(e){if(e.kind===`do`){let t=Qe.get(`do${e.code}${e.suffix??``}`),n=e.cross===void 0&&e.variant===void 0&&e.size===void 0&&e.pairs===void 0;return t&&n&&Object.keys(e.params).length===0?nt(t,`do${e.code}${e.suffix??``}`):void 0}if(e.kind!==`axial`||!$e(e)||Object.keys(e.params).some(e=>e!==`d`))return;let t=tt(e);return`refused`in t?t:nt(t,`axial${j(t.length)}x${j(t.pitch)}${e.params.d===void 0?``:`_d${j(t.diameter)}`}`)}function tt(e){if(e.cross===void 0||e.code===``)return A(`an axial part is axial<body length>x<lead spacing>, such as axial6.3x10.16`);let t=Number(e.code),n=Number(e.cross),r=e.params.d;if(r===!0)return A(`_d needs the body diameter in mm, such as _d2.5`);if(t<Ke||t>qe)return A(`the body is ${Ke} to ${qe} mm long`);if(n>Ye)return A(`the leads are at most ${Ye} mm apart`);if(n<t+3)return A(`leads ${j(n)} mm apart leave no room to bend them around a ${j(t)} mm body: at least ${j(t+2*Ge)} mm (${Ge} mm of straight lead at each end)`);let i=r??Ve.find(e=>t<=e.upTo).diameter;return i<=0||i>Je?A(`the body diameter is above 0 and at most ${Je} mm`):{label:`axial`,length:t,diameter:i,lead:t<=We?He:Ue,pitch:n,diode:!1}}function nt(e,t){let n=Be(ze(e.lead)),r=[P(`1`,w(-e.pitch/2),0,n,!0),P(`2`,w(e.pitch/2),0,n)],i={x:w(e.length/2),y:w(e.diameter/2)},a=[O(i),...rt(e,n.pad),...e.diode?[it(e)]:[]],o=e.diode?`${e.label} diode (pad 1 anode, pad 2 cathode)`:`axial ${j(e.length)} × ${j(e.diameter)} mm body`;return{name:t,pads:r,courtyard:D(r,i,Re),silkscreen:a,fabrication:[O(i)],origin:`Through-hole, ${o}, leads ${j(e.pitch)} mm apart: ${n.drill} mm holes, ${n.pad} mm lands (IPC-2222 level B); body typical`}}function rt(e,t){let n=w(e.length/2),r=w(e.pitch/2-t/2-C-Ze);return r<=n?[]:[[{x:-r,y:0},{x:-n,y:0}],[{x:n,y:0},{x:r,y:0}]]}function it(e){let t=w(e.length/2-Math.min(Xe,e.length*.15)),n=w(e.diameter/2);return[{x:t,y:-n},{x:t,y:n}]}var at=`ABCDEFGHJKLMNPRTUVWY`;function ot(e){let t=``;for(let n=e+1;n>0;n=Math.floor((n-1)/20))t=at[(n-1)%20]+t;return t}var st=new Map([[1.27,.75],[1,.5],[.8,.45],[.65,.35],[.5,.3],[.4,.25]]),ct=.25,lt=.2,ut=.05,dt={courtyardExcess:1,roundOff:.05},ft=.3,pt=1,mt=4096,ht=1e-9;function gt(e){for(let[t,n]of st)if(!(Math.abs(t-e)>ht))return{ball:n,land:w(Math.round(n*(1-(n>=.5499999990000001?ct:lt))/ut+1e-6)*ut)}}function _t(e,t){if(t){let[n,r]=t;return Number.isInteger(n)&&Number.isInteger(r)&&n*r===e?{rows:n,columns:r}:A(`_rows${n}x${r} is not a full grid of ${e} balls`)}let n=Math.round(Math.sqrt(e));return n*n===e?{rows:n,columns:n}:A(`${e} balls are no square grid; give _rows<R>x<C>`)}var vt=[...st.keys()].join(`, `);function yt(e,t,n,r){let i=T(t,n);return[...T(e,n)].reverse().flatMap((e,t)=>i.map((n,i)=>({number:`${ot(t)}${i+1}`,shape:`circle`,x:n,y:e,width:r,height:r,rotation:0,layers:`top`})))}function bt(e,t){let n=E(e),r={x:w(Math.max(t.x,n.x+C)),y:w(Math.max(t.y,n.y+C))},i=w(-r.x-ft),a=w(r.y+ft);return[O(r),[{x:i,y:w(a-pt)},{x:i,y:a},{x:w(i+pt),y:a}]]}function xt(e){if(e.kind!==`bga`||e.variant!==void 0||e.cross!==void 0||e.suffix!==void 0)return;let t=e.size,n=e.params.p;if(!t)return A(`a BGA needs its body, such as bga256_17x17_p1`);if(typeof n!=`number`)return A(`a BGA needs its pitch, such as _p1`);let r=[...Object.keys(e.params),...Object.keys(e.pairs??{})].find(e=>e!==`p`&&e!==`rows`);if(r!==void 0)return A(`a BGA takes only _p and _rows, not _${r}`);let i=Number(e.code);if(!Number.isInteger(i)||i<1||i>mt)return A(`a BGA has 1 to ${mt} balls`);let a=gt(n);if(!a)return A(`BGA pitch must be one of ${vt} mm`);let o=_t(i,e.pairs?.rows);if(Ce(o))return o;let[s,c]=t,l=(e,t)=>(e-1)*n+a.land<=t+ht;if(!l(o.columns,s)||!l(o.rows,c))return A(`a ${o.rows}×${o.columns} grid at ${j(n)} mm does not fit the body`);let u=yt(o.rows,o.columns,n,a.land),d={x:s/2,y:c/2},f=o.rows===o.columns;return{name:`bga${i}_${j(s)}x${j(c)}_p${j(n)}${f?``:`_rows${o.rows}x${o.columns}`}`,pads:u,courtyard:D(u,d,dt),silkscreen:bt(u,d),fabrication:[O(d)],origin:`IPC-7351B nominal, BGA-${i} ${j(s)}×${j(c)} mm, ${j(n)} mm pitch, ${o.rows}×${o.columns} grid, ${j(a.ball)} mm balls on ${j(a.land)} mm lands`}}function F(e,t){let n=e=>Math.round(e*1e6)/1e6;return{min:n(e-t),max:n(e+t)}}var St={"0201":{length:F(.6,.03),width:F(.3,.03),terminal:F(.15,.05)},"0402":{length:F(1,.05),width:F(.5,.05),terminal:F(.3,.1)},"0603":{length:F(1.6,.15),width:F(.8,.15),terminal:F(.35,.15)},"0805":{length:F(2,.2),width:F(1.25,.2),terminal:F(.5,.25)},1206:{length:F(3.2,.2),width:F(1.6,.2),terminal:F(.5,.25)},1210:{length:F(3.2,.2),width:F(2.5,.2),terminal:F(.5,.25)},1812:{length:F(4.5,.3),width:F(3.2,.3),terminal:F(.6,.35)}},Ct={2010:{length:F(5,.15),width:F(2.5,.15),terminal:F(.6,.2)},2512:{length:F(6.3,.2),width:F(3.15,.15),terminal:F(.6,.2)}},wt={"01005":{length:F(.4,.02),width:F(.2,.02),terminal:F(.1,.03)},2220:{length:F(5.7,.4),width:F(5,.4),terminal:F(.6,.35)}},Tt={...St,...Ct,...wt};function Et(e){if(!Object.hasOwn(Tt,e))return;let t=Tt[e],r={span:t.length,terminal:t.terminal,width:t.width},a=m(t.length),o=x(n(r,a.goals,i),a.roundOff),s={x:t.length.max/2,y:t.width.max/2};return{name:e,pads:o,courtyard:D(o,s,a),silkscreen:se(o,s),fabrication:k(s),origin:`IPC-7351B nominal, EIA ${e}`}}var Dt=4.88,Ot=M(.4,.46),kt=11.05,At=4.65,jt=.2,Mt=new Map([[void 0,`HC-49/U`],[`s`,`HC-49/S`]]);function Nt(){let e=At/2,t=pe({x:kt/2-e,y:0},e,-90,90,10),n=pe({x:-3.2,y:0},e,90,270,10);return[...t,...n,t[0]]}function Pt(e){let t=e.kind===`hc`&&e.code===`49`?Mt.get(e.suffix):void 0,n=e.cross===void 0&&e.size===void 0&&e.pairs===void 0&&e.variant===void 0;if(!t||!n||Object.keys(e.params).length>0)return;let r=Be(ze(Ot)),i=[P(`1`,-4.88/2,0,r,!0),P(`2`,Dt/2,0,r)],a=Nt(),o=w(-(E(i).y+C+jt));return{name:`hc49${e.suffix??``}`,pads:i,courtyard:D(i,{x:kt/2,y:At/2},Re),silkscreen:[a,_e(i[0],o)],fabrication:[a],origin:`Through-hole, ${t} crystal: ${r.drill} mm holes, ${r.pad} mm lands (IPC-2222 level B)`}}var Ft=.6,It=.05,Lt=e=>w(Math.ceil(w((e+Ft)/It))*It);function Rt(e,t,n,r,i=!1){let a=Lt(r);return{number:e,shape:i?`rect`:`circle`,x:w(t),y:w(n),width:a,height:a,rotation:0,layers:`through`,drill:{width:r,height:r}}}function zt(e,t,n,r,i){return{number:e,shape:`oval`,x:w(t),y:w(n),width:r.x,height:r.y,rotation:0,layers:`through`,drill:{width:i.x,height:i.y}}}var Bt=1.5,Vt=.5;function Ht(e){let t=w(e+Bt);return[[{x:0,y:w(e)},{x:0,y:t}],[{x:-.5,y:w(t-Vt)},{x:0,y:t},{x:Vt,y:w(t-Vt)}]]}var Ut={courtyardExcess:.25,roundOff:.05},Wt=.05,Gt=1,Kt=.05;function qt(e){return t(e)&&e.variant===void 0&&Object.keys(e.params).length===0}function Jt(e,t=Kt){let n=e.length>0?[e[0]]:[];for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r],o=Math.max(1,Math.ceil(Math.hypot(a.x-i.x,a.y-i.y)/t));for(let e=1;e<=o;e++)n.push({x:w(i.x+(a.x-i.x)*e/o),y:w(i.y+(a.y-i.y)*e/o)})}return n}var Yt=1e-6;function Xt(e){return e.filter((t,n)=>{let r=e[n-1],i=e[n+1];if(!r||!i)return!0;let a=Math.hypot(i.x-r.x,i.y-r.y);if(a===0)return!1;let o=(i.x-r.x)*(t.y-r.y)-(i.y-r.y)*(t.x-r.x);return Math.abs(o)/a>Yt})}function Zt(e,t){return he(Jt(e),t).map(Xt)}function Qt(e,t){let n=w(-(E(e).y+C+Wt));return[{x:w(t.x-Gt/2),y:n},{x:w(t.x+Gt/2),y:n}]}function $t(e,t,n,r){let i=e.map((e,i)=>S(String(i+1),w(e),w(-t),n,r)),a=[...e].reverse().map((i,a)=>S(String(e.length+a+1),w(i),w(t),n,r));return[...i,...a]}function en(e,t,n){return[S(`1`,w(-e),0,t,n),S(`2`,w(e),0,t,n)]}var tn={x:4.5,y:7.25},nn={pin:13.5,sleeve:7.7,switched:10.55},rn=4.8,an=.7,on=1.7,sn=[``,`2.1`,`2.5`];function cn(e){if(e.kind!==`dcjack`)return;if(!sn.includes(e.code)||!qt(e))return A(`dcjack, dcjack2.1 and dcjack2.5 are one footprint (5.5 mm sleeve, 2.0/2.1 mm pin); no other`);let t=e=>-tn.y+e,n=[zt(`1`,0,t(nn.pin),{x:4.2,y:on},{x:3.2,y:an}),zt(`2`,0,t(nn.sleeve),{x:3.8,y:on},{x:2.8,y:an}),zt(`3`,rn,t(nn.switched),{x:on,y:3.8},{x:an,y:2.8})],r=O(tn);return{name:`dcjack`,pads:n,courtyard:D(n,tn,Ut),silkscreen:Zt(r,n),fabrication:[r,...Ht(-tn.y)],origin:`DC barrel jack 5.5 / 2.1 mm, through-hole, slotted terminals: from Würth Elektronik 694106301002 recommended hole pattern; that maker's part, others may differ`}}var ln=(e,t)=>Array.from({length:(t-e)/2+1},(t,n)=>e+2*n),un={kind:`soic`,suffix:``,label:e=>`SOIC-${e}`,pins:ln(8,16),lead:{pitch:1.27,span:M(5.8,6.2),terminal:M(.41,1.27),leadWidth:M(.33,.51),bodyAcross:M(3.8,4)},bodyLength:new Map([[8,M(4.8,5)],[14,M(8.55,8.75)],[16,M(9.8,10)]]),overhang:.53,bodyTolerance:.1},dn={kind:`soic`,suffix:`w`,label:e=>`SOIC-${e} wide`,pins:[16,18,20,24,28],lead:{pitch:1.27,span:M(10,10.65),terminal:M(.4,1.27),leadWidth:M(.31,.51),bodyAcross:M(7.4,7.6)},bodyLength:new Map([[16,M(10.1,10.5)],[18,M(11.35,11.75)],[20,M(12.6,13)],[24,M(15.2,15.6)],[28,M(17.7,18.1)]]),overhang:.6,bodyTolerance:.2},fn={kind:`sop`,suffix:``,label:e=>`SOP-${e}`,pins:ln(8,16),lead:{pitch:1.27,span:M(7.7,8.1),terminal:M(.51,.8),leadWidth:M(.36,.48),bodyAcross:M(5.18,5.38)},bodyLength:new Map([[8,M(5.18,5.33)]]),overhang:.72,bodyTolerance:.08},pn={kind:`ssop`,suffix:``,label:e=>`SSOP-${e}`,pins:[14,16,20,24,28],lead:{pitch:.65,span:M(7.4,8.2),terminal:M(.55,.95),leadWidth:M(.22,.38),bodyAcross:M(5,5.6)},bodyLength:new Map([[14,M(5.9,6.5)],[16,M(5.9,6.5)],[20,M(6.9,7.5)],[24,M(7.9,8.5)],[28,M(9.9,10.5)]]),overhang:.7,bodyTolerance:.3},mn={kind:`tssop`,suffix:``,label:e=>`TSSOP-${e}`,pins:ln(8,28),lead:{pitch:.65,span:M(6.2,6.6),terminal:M(.45,.75),leadWidth:M(.19,.3),bodyAcross:M(4.3,4.5)},bodyLength:new Map([[8,M(2.9,3.1)],[14,M(4.9,5.1)],[16,M(4.9,5.1)],[20,M(6.4,6.6)],[24,M(7.7,7.9)],[28,M(9.6,9.8)]]),overhang:.6,bodyTolerance:.1},hn={kind:`msop`,suffix:``,label:e=>`MSOP-${e}`,pins:[8],lead:{pitch:.65,span:M(4.7,5.1),terminal:M(.4,.8),leadWidth:M(.22,.38),bodyAcross:M(2.9,3.1)},bodyLength:new Map([[8,M(2.9,3.1)]]),overhang:.55,bodyTolerance:.1},gn={...hn,pins:[10],lead:{...hn.lead,pitch:.5,leadWidth:M(.17,.27)},bodyLength:new Map([[10,M(2.9,3.1)]])},_n=[un,dn,fn,pn,mn,hn,gn,{kind:`qsop`,suffix:``,label:e=>`QSOP-${e}`,pins:[16,20,24,28],lead:{pitch:.635,span:M(5.8,6.2),terminal:M(.4,1.27),leadWidth:M(.2,.3),bodyAcross:M(3.8,4)},bodyLength:new Map([[16,M(4.8,5)],[20,M(8.56,8.74)],[24,M(8.56,8.74)],[28,M(9.8,10)]]),overhang:.5,bodyTolerance:.1}],vn=_n.map(e=>({form:`${e.kind}<N>${e.suffix}`,pins:e.pins}));function yn(e){let t=Number(e.code),n=_n.filter(t=>t.kind===e.kind&&t.suffix===(e.suffix??``));return n.find(e=>e.pins.includes(t))??n[0]}function bn(e,t){let n=e.bodyLength.get(t),r=(t/2-1)*e.lead.pitch+2*e.overhang,i=n??M(r-e.bodyTolerance,r+e.bodyTolerance);return{...e.lead,label:e.label(t),bodyAlong:i}}function xn(e,t,n){let r=T(e/2,t),i=[...r].reverse().map((e,t)=>S(String(t+1),-n.centre,e,n.length,n.width)),a=r.map((t,r)=>S(String(e/2+r+1),n.centre,t,n.length,n.width));return[...i,...a]}function Sn(e,t){let n=e.pairs===void 0||Object.keys(e.pairs).every(e=>e===`ep`);if(e.cross!==void 0||e.size!==void 0||!n||e.variant!==void 0)return;let r=Number(e.code);return String(r)===e.code&&t.pins.includes(r)?r:void 0}var Cn=(e,t)=>e===un&&t===8||e===hn||e===gn||e===mn,wn=`_ep needs the exposed pad's size, such as _ep2.3x2.3, because it differs from part to part for this package; take it from the part's drawing`;function Tn(e){let t=e.params.ep,n=e.pairs?.ep;if(t===!0)return A(wn);let r=typeof t==`number`?{x:t,y:t}:n?{x:n[0],y:n[1]}:void 0;return r&&(r.x<=0||r.y<=0)?A(`the exposed pad needs a size above 0`):r}var En=e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==`ep`)),Dn=e=>Object.hasOwn(e.params,`ep`)||e.pairs!==void 0;function On(e){if(Dn(e))return;let t=An(e);return Ce(t)?void 0:t}function kn(e){return Dn(e)?An(e):void 0}function An(e){let t=yn(e),n=t&&Sn(e,t);if(!t||n===void 0)return;let r=Dn(e);if(r&&!Cn(t,n))return;let i=bn(t,n);if(!Ne(En(e.params),i))return;let a=r?Tn(e):void 0;if(Ce(a))return a;let{row:o,table:s}=N(i),c=xn(n,i.pitch,o),l=a?[...c,S(String(n+1),0,0,a.x,a.y)]:c,u=a?Oe(l,!0):void 0;if(u)return u;let d={x:i.bodyAcross.max/2,y:i.bodyAlong.max/2},f=(n/2-1)/2*i.pitch+i.leadWidth.max/2,p={x:i.span.max/2,y:Math.max(d.y,f)};return{name:`${e.kind}${e.code}${t.suffix}${a?`_ep${j(a.x)}x${j(a.y)}`:``}`,pads:l,courtyard:D(l,p,s),silkscreen:le(c,d),fabrication:k(d),origin:`IPC-7351B nominal, ${i.label}${a?` with exposed pad`:``}`}}var jn=.1,Mn=M(.3,.5),Nn=new Map([[.4,M(.15,.25)],[.5,M(.18,.3)],[.65,M(.25,.35)]]),Pn=M(.45,.75),Fn=new Map([[.4,M(.13,.23)],[.5,M(.17,.27)],[.65,M(.22,.38)],[.8,M(.3,.4)]]),In=2,Ln=.15,Rn=.25,zn=1024,Bn=1,Vn=60,Hn=1e-9,Un=(e,t)=>M(Wn(e-t),Wn(e+t)),Wn=e=>Math.round(e*1e6)/1e6;function Gn(e,t){for(let[n,r]of e)if(Math.abs(n-t)<Hn)return r}function Kn(e,t,n){let r=Number(e);return!Number.isInteger(r)||r<=0||r>zn?A(`a ${n} has 1 to ${zn} pins`):r%t===0?r:A(`a ${n} has a pin count divisible by ${t}`)}var qn=e=>{let t=[...e.keys()].map(String);return`${t.slice(0,-1).join(`, `)} or ${t[t.length-1]} mm`};function Jn(e,t){return t.every(e=>e>=Bn&&e<=Vn)?void 0:A(`a ${e} body is ${Bn} to ${Vn} mm`)}function Yn(e,t,n,r){return(e-1)*t+n.max<=r+Hn?void 0:A(`${e} pins a side at ${t} mm do not fit a ${r} mm side`)}function Xn(...e){for(let t of e){let e=t();if(e)return e}}function Zn(e,t,n,r,i){let a=Kn(t,4,e);if(Ce(a))return a;let o=Gn(i,r);if(!o)return A(`${e} pitch must be ${qn(i)}`);let[s,c]=n;return Xn(()=>Math.abs(s-c)>Hn?A(`${e} bodies must be square`):void 0,()=>Jn(e,n),()=>Yn(a/4,r,o,s))??{pins:a,side:s,width:o}}function Qn(e,t,n){let r=Zn(`QFN`,e,t,n,Nn);if(Ce(r))return r;let{pins:i,side:a,width:o}=r,s=Un(a,jn);return{label:`QFN-${i} ${a}×${a} mm, ${n} mm pitch`,pitch:n,span:s,terminal:Mn,leadWidth:o,bodyAcross:s,bodyAlong:s}}function $n(e,t,n){let r=Kn(e,2,`DFN`);if(Ce(r))return r;let i=Gn(Nn,n);if(!i)return A(`DFN pitch must be ${qn(Nn)}`);let[a,o]=t,s=Xn(()=>Jn(`DFN`,t),()=>Yn(r/2,n,i,o));if(s)return s;let c=Un(a,jn);return{label:`DFN-${r} ${a}×${o} mm, ${n} mm pitch`,pitch:n,span:c,terminal:Mn,leadWidth:i,bodyAcross:c,bodyAlong:Un(o,jn)}}function er(e,t,n){let r=Zn(`QFP`,e,t,n,Fn);if(Ce(r))return r;let{pins:i,side:a,width:o}=r,s=a<=10.000000001?Ln:Rn,c=Un(a,jn);return{label:`LQFP-${i} ${a}×${a} mm, ${n} mm pitch`,pitch:n,span:Un(a+In,s),terminal:Pn,leadWidth:o,bodyAcross:c,bodyAlong:c}}function tr(e){if(e.kind!==`dfn`||e.variant!==void 0||e.cross!==void 0||e.suffix!==void 0)return;let t=e.size,n=e.params.p;if(!t)return A(`a DFN needs its body, such as dfn8_3x3_p0.65`);if(typeof n!=`number`)return A(`a DFN needs its pitch, such as _p0.65`);let r=$n(e.code,t,n);if(Ce(r))return r;let i=De(e,`DFN`);if(Ce(i))return i;let a=Number(e.code),{row:o,table:s}=Ae(r),c=xn(a,n,o),l=i?[...c,S(String(a+1),0,0,i.x,i.y)]:c,u=Oe(l,i!==void 0);if(u)return u;let d={x:r.bodyAcross.max/2,y:r.bodyAlong.max/2};return{name:`dfn${a}_${j(t[0])}x${j(t[1])}_p${j(n)}${i?`_ep${Te(i)}`:``}`,pads:l,courtyard:D(l,d,s),silkscreen:le(c,d),fabrication:k(d),origin:`IPC-7351B nominal, ${r.label}${i?` with exposed pad`:``}`}}var nr=2.54,rr=M(.36,.56),ir=M(.2,.36),ar=1.27,or=7.62,sr=64,cr=.75;function lr(e,t){let n=Be(ze(rr,ir)),r=T(e/2,nr),i=[...r].reverse().map((e,r)=>P(String(r+1),w(-t/2),e,n,r===0)),a=r.map((r,i)=>P(String(e/2+i+1),w(t/2),r,n));return[...i,...a]}function ur(e,t){let n=Math.min(...e.map(e=>Math.abs(e.x)-e.width/2)),r=w(Math.min(t.x,n-C)),i=w(Math.max(t.y,E(e).y+C)),a=pe({x:0,y:i},cr,0,-180,15);return[[{x:-.75,y:i},{x:-r,y:i},{x:-r,y:-i},{x:r,y:-i},{x:r,y:i},...a]]}function dr(e){if(e.kind!==`dip`||!t(e)||e.variant!==void 0)return;let n=Object.keys(e.params).find(e=>e!==`w`);if(n!==void 0)return A(`a DIP takes only _w, not _${n}`);let r=Number(e.code),i=e.params.w??7.62;if(!Number.isInteger(r)||r<4||r>sr||r%2!=0)return A(`a DIP has an even pin count from 4 to ${sr}`);if(i===!0||i<7.619999999)return A(`DIP rows are at least ${or} mm apart`);let a=lr(r,i),o={x:(i-ar)/2,y:r/2*(nr/2)},s=a[0];return{name:Math.abs(i-7.62)<1e-9?`dip${r}`:`dip${r}_w${j(i)}`,pads:a,courtyard:D(a,o,Re),silkscreen:ur(a,o),fabrication:k(o),origin:`Through-hole, DIP-${r} with rows ${j(i)} mm apart: ${j(s.drill?.width??0)} mm holes, ${j(s.width)} mm lands (IPC-2222 level B)`}}var fr={name:`dpak`,pkg:{label:`DPAK (TO-252)`,pitch:2.29,span:M(9.4,10.41),terminal:M(1.4,1.78),leadWidth:M(.63,.89),bodyAcross:M(5.97,6.22),bodyAlong:M(6.35,6.73)},leads:[`1`,`3`],leadX:[-2.29,2.29],tabNumber:`2`,tabWidth:M(4.57,5.46),tabLength:M(4.82,5.2),tabOverhang:M(.89,1.27)},pr={span:M(14.6,15.88),bodyAcross:M(8.64,9.65),bodyAlong:M(9.65,10.29)},mr={tabWidth:M(7.87,8.89),tabLength:M(8.43,9.96),tabOverhang:M(1.32,1.83)},hr={name:`d2pak`,pkg:{label:`D2PAK (TO-263)`,pitch:2.54,terminal:M(2.03,2.79),leadWidth:M(.51,.89),...pr},leads:[`1`,`3`],leadX:[-2.54,2.54],tabNumber:`2`,...mr};function gr(e,t,n){return{name:`d2pak_${e}`,pkg:{label:`D2PAK-${e} (TO-263-${e})`,pitch:t,terminal:M(2.03,2.79),leadWidth:n,...pr},leads:Array.from({length:e},(e,t)=>String(t+1)),leadX:T(e,t),tabNumber:String(e+1),...mr}}var _r=gr(5,1.7,M(.51,.89)),vr=gr(7,1.27,M(.5,.7)),yr=.35;function br(e){let{row:t}=N(e.pkg),n=N({...e.pkg,leadWidth:e.tabWidth}).row,r=e.leads.map((n,r)=>S(n,e.leadX[r],-t.centre,t.width,t.length)),i=t.centre+t.length/2,a=i-e.tabLength.max-yr;return[...r,S(e.tabNumber,0,w((i+a)/2),n.width,w(i-a))]}function xr(e){let t=w(e.pkg.span.max/2-e.tabOverhang.min);return{top:t,bottom:w(t-e.pkg.bodyAcross.max),half:w(e.pkg.bodyAlong.max/2)}}function Sr(e,t){let n=xr(t),r=w(Math.max(n.half,E(e).x+C)),i=w(-E(e).y);return[[{x:-r,y:i},{x:-r,y:n.top}],[{x:r,y:n.bottom},{x:r,y:n.top}]]}function Cr(e){let t=xr(e),n=(e=>e.map(e=>({x:e.x,y:w(e.y+(t.top+t.bottom)/2)})))(O({x:t.half,y:(t.top-t.bottom)/2})),r=w(e.pkg.span.max/2),i=w(e.tabWidth.max/2);return[n,[{x:-i,y:t.top},{x:-i,y:r},{x:i,y:r},{x:i,y:t.top}]]}function wr(e){let t=br(e),{table:n}=N(e.pkg),r={x:e.pkg.bodyAlong.max/2,y:e.pkg.span.max/2};return{name:e.name,pads:t,courtyard:D(t,r,n),silkscreen:Sr(t,e),fabrication:Cr(e),origin:`IPC-7351B nominal, ${e.pkg.label}`}}var Tr=new Map([[`dpak`,fr],[`to252`,fr],[`d2pak`,hr],[`to263`,hr],[`d2pak_5`,_r],[`to263_5`,_r],[`d2pak_7`,vr],[`to263_7`,vr]]);function Er(e){let t=`${e.kind}${e.code}${e.suffix??``}`;if(!(e.cross!==void 0||e.size!==void 0||e.pairs!==void 0||Object.keys(e.params).length>0))return e.variant===void 0?t:`${t}_${e.variant}`}var Dr=e=>e.kind===`to`&&(e.code===`252`||e.code===`263`)&&t(e)||e.kind===`dpak`&&e.code===``||e.kind===`d`&&e.code===`2`&&e.suffix===`pak`;function Or(e){if(!Dr(e))return;let t=Er(e),n=t===void 0?void 0:Tr.get(t);return n?wr(n):A(e.kind===`dpak`||e.code===`252`?`a DPAK takes no variant or parameters`:`a D2PAK has 3 (no variant), 5 or 7 leads`)}var kr=Symbol.for(`yaml.alias`),Ar=Symbol.for(`yaml.document`),jr=Symbol.for(`yaml.map`),Mr=Symbol.for(`yaml.pair`),Nr=Symbol.for(`yaml.scalar`),Pr=Symbol.for(`yaml.seq`),Fr=Symbol.for(`yaml.node.type`),Ir=e=>!!e&&typeof e==`object`&&e[Fr]===kr,Lr=e=>!!e&&typeof e==`object`&&e[Fr]===Ar,Rr=e=>!!e&&typeof e==`object`&&e[Fr]===jr,I=e=>!!e&&typeof e==`object`&&e[Fr]===Mr,L=e=>!!e&&typeof e==`object`&&e[Fr]===Nr,zr=e=>!!e&&typeof e==`object`&&e[Fr]===Pr;function R(e){if(e&&typeof e==`object`)switch(e[Fr]){case jr:case Pr:return!0}return!1}function z(e){if(e&&typeof e==`object`)switch(e[Fr]){case kr:case jr:case Nr:case Pr:return!0}return!1}var Br=e=>(L(e)||R(e))&&!!e.anchor,Vr=Symbol(`break visit`),Hr=Symbol(`skip children`),Ur=Symbol(`remove node`);function Wr(e,t){let n=Kr(t);Lr(e)?Gr(null,e.contents,n,Object.freeze([e]))===Ur&&(e.contents=null):Gr(null,e,n,Object.freeze([]))}Wr.BREAK=Vr,Wr.SKIP=Hr,Wr.REMOVE=Ur;function Gr(e,t,n,r){let i=qr(e,t,n,r);if(z(i)||I(i))return Jr(e,r,i),Gr(e,i,n,r);if(typeof i!=`symbol`){if(R(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Gr(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Vr)return Vr;else i===Ur&&(t.items.splice(e,1),--e)}}else if(I(t)){r=Object.freeze(r.concat(t));let e=Gr(`key`,t.key,n,r);if(e===Vr)return Vr;e===Ur&&(t.key=null);let i=Gr(`value`,t.value,n,r);if(i===Vr)return Vr;i===Ur&&(t.value=null)}}return i}function Kr(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function qr(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Rr(t))return n.Map?.(e,t,r);if(zr(t))return n.Seq?.(e,t,r);if(I(t))return n.Pair?.(e,t,r);if(L(t))return n.Scalar?.(e,t,r);if(Ir(t))return n.Alias?.(e,t,r)}function Jr(e,t,n){let r=t[t.length-1];if(R(r))r.items[e]=n;else if(I(r))e===`key`?r.key=n:r.value=n;else if(Lr(r))r.contents=n;else{let e=Ir(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var Yr={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Xr=e=>e.replace(/[!,[\]{}]/g,e=>Yr[e]),Zr=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Xr(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&z(e.contents)){let t={};Wr(e.contents,(e,n)=>{z(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||e&&!r.some(e=>e.startsWith(a))||t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
2
|
+
`)}};Zr.defaultYaml={explicit:!1,version:`1.2`},Zr.defaultTags={"!!":`tag:yaml.org,2002:`};function Qr(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function $r(e){let t=new Set;return Wr(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function ei(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function ti(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=$r(e);let a=ei(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(L(t.node)||R(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function ni(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=ni(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=ni(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=ni(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=ni(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function ri(e,t,n){if(Array.isArray(e))return e.map((e,t)=>ri(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Br(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var ii=class{constructor(e){Object.defineProperty(this,Fr,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Lr(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=ri(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?ni(i,{"":o},``,o):o}},ai=class extends ii{constructor(e){super(kr),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Wr(e,{Node:(e,t)=>{(Ir(t)||Br(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(ri(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=oi(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Qr(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function oi(e,t,n){if(Ir(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(R(t)){let r=0;for(let i of t.items){let t=oi(e,i,n);t>r&&(r=t)}return r}if(I(t)){let r=oi(e,t.key,n),i=oi(e,t.value,n);return Math.max(r,i)}return 1}var si=e=>!e||typeof e!=`function`&&typeof e!=`object`,B=class extends ii{constructor(e){super(Nr),this.value=e}toJSON(e,t){return t?.keep?this.value:ri(this.value,e,t)}toString(){return String(this.value)}};B.BLOCK_FOLDED=`BLOCK_FOLDED`,B.BLOCK_LITERAL=`BLOCK_LITERAL`,B.PLAIN=`PLAIN`,B.QUOTE_DOUBLE=`QUOTE_DOUBLE`,B.QUOTE_SINGLE=`QUOTE_SINGLE`;var ci=`tag:yaml.org,2002:`;function li(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ui(e,t,n){if(Lr(e)&&(e=e.contents),z(e))return e;if(I(e)){let t=n.schema[jr].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new ai(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=ci+t.slice(2));let l=li(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new B(e);return c&&(c.node=t),t}l=e instanceof Map?o[jr]:Symbol.iterator in Object(e)?o[Pr]:o[jr]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new B(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function di(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ui(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var fi=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,pi=class extends ii{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>z(t)||I(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(fi(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(R(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,di(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(R(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&L(i)?i.value:i:R(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!I(t))return!1;let n=t.value;return n==null||e&&L(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return R(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(R(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,di(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},mi=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function hi(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var gi=(e,t,n)=>e.endsWith(`
|
|
3
|
+
`)?hi(n,t):n.includes(`
|
|
4
|
+
`)?`
|
|
5
|
+
`+hi(n,t):(e.endsWith(` `)?``:` `)+n,_i=`flow`,vi=`block`,yi=`quoted`;function bi(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=xi(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
|
6
|
+
`)n===`block`&&(h=xi(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
7
|
+
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
8
|
+
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function xi(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
9
|
+
`);r=t,i=t+1,a=e[i]}return r}var Si=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ci=e=>/^(%|---|\.\.\.)/m.test(e);function wi(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
10
|
+
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function Ti(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Ci(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
|
11
|
+
|
|
12
|
+
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
13
|
+
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:bi(o,a,yi,Si(t,!1))}function Ei(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
14
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return Ti(e,t);let n=t.indent||(Ci(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:bi(r,n,_i,Si(t,!1))}function Di(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Ti;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Ei:i&&!t?Ti:n?Ei:Ti}return r(e,t)}var Oi;try{Oi=RegExp(`(^|(?<!
|
|
15
|
+
))
|
|
16
|
+
+(?!
|
|
17
|
+
|$)`,`g`)}catch{Oi=/\n+(?!\n|$)/g}function ki({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return Di(n,r);let l=r.indent||(r.forceBlockIndent||Ci(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===B.BLOCK_FOLDED?!1:t===B.BLOCK_LITERAL||!wi(n,c,l.length);if(!n)return u?`|
|
|
18
|
+
`:`>
|
|
19
|
+
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
20
|
+
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
21
|
+
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
22
|
+
`&&(p=p.slice(0,-1)),p.replace(Oi,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
23
|
+
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
|
24
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=Si(r,!0);o!==`folded`&&t!==B.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=bi(`${v}${e}${p}`,l,vi,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Ai(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
|
25
|
+
`)||u&&/[[\]{},]/.test(a))return Di(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
26
|
+
`)?Di(a,t):ki(e,t,n,r);if(!s&&!u&&i!==B.PLAIN&&a.includes(`
|
|
27
|
+
`))return ki(e,t,n,r);if(Ci(a)){if(c===``)return t.forceBlockIndent=!0,ki(e,t,n,r);if(s&&c===l)return Di(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return Di(a,t)}return s?d:bi(d,c,_i,Si(t,!1))}function ji(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==B.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=B.QUOTE_DOUBLE);let c=e=>{switch(e){case B.BLOCK_FOLDED:case B.BLOCK_LITERAL:return i||a?Di(o.value,t):ki(o,t,n,r);case B.QUOTE_DOUBLE:return Ti(o.value,t);case B.QUOTE_SINGLE:return Ei(o.value,t);case B.PLAIN:return Ai(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Mi(e,t){let n=Object.assign({blockQuote:!0,commentString:mi,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Ni(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(L(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Pi(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(L(e)||R(e))&&e.anchor;a&&Qr(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Fi(e,t,n,r){if(I(e))return e.toString(t,n,r);if(Ir(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=z(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Ni(t.doc.schema.tags,a);let o=Pi(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):L(a)?ji(a,t,n,r):a.toString(t,n,r);return o?L(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Ii({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=z(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(R(e)||!z(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||R(e)||(L(e)?e.type===B.BLOCK_FOLDED||e.type===B.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Fi(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=gi(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=gi(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=gi(g,n.indent,l(f))));let _,v,y;z(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&L(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&zr(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let ee=!1,b=Fi(t,n,()=>ee=!0,()=>h=!0),x=` `;if(f||_||v){if(x=_?`
|
|
28
|
+
`:``,v){let e=l(v);x+=`\n${hi(e,n.indent)}`}b===``&&!n.inFlow?x===`
|
|
29
|
+
`&&y&&(x=`
|
|
30
|
+
|
|
31
|
+
`):x+=`\n${n.indent}`}else if(!p&&R(t)){let e=b[0],r=b.indexOf(`
|
|
32
|
+
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=b.indexOf(` `);e===`&`&&n!==-1&&n<r&&b[n+1]===`!`&&(n=b.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(x=`\n${n.indent}`)}}else(b===``||b[0]===`
|
|
33
|
+
`)&&(x=``);return g+=x+b,n.inFlow?ee&&r&&r():y&&!ee?g+=gi(g,n.indent,l(y)):h&&i&&i(),g}function Li(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Ri=`<<`,zi={identify:e=>e===Ri||typeof e==`symbol`&&e.description===Ri,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new B(Symbol(Ri)),{addToJSMap:Vi}),stringify:()=>Ri},Bi=(e,t)=>(zi.identify(t)||L(t)&&(!t.type||t.type===B.PLAIN)&&zi.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===zi.tag&&e.default);function Vi(e,t,n){let r=Ui(e,n);if(zr(r))for(let n of r.items)Hi(e,t,n);else if(Array.isArray(r))for(let n of r)Hi(e,t,n);else Hi(e,t,r)}function Hi(e,t,n){let r=Ui(e,n);if(!Rr(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Ui(e,t){return e&&Ir(t)?t.resolve(e.doc,e):t}function Wi(e,t,{key:n,value:r}){if(z(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Bi(e,n))Vi(e,t,r);else{let i=ri(n,``,e);if(t instanceof Map)t.set(i,ri(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Gi(n,i,e),o=ri(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Gi(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(z(e)&&n?.doc){let t=Mi(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Li(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Ki(e,t,n){return new qi(ui(e,void 0,n),ui(t,void 0,n))}var qi=class e{constructor(e,t=null){Object.defineProperty(this,Fr,{value:Mr}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return z(n)&&(n=n.clone(t)),z(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Wi(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Ii(this,e,t,n):JSON.stringify(this)}};function Ji(e,t,n){return(t.inFlow??e.flow?Xi:Yi)(e,t,n)}function Yi({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(z(i))!d&&i.spaceBefore&&f.push(``),Zi(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(I(i)){let e=z(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Zi(n,f,e.commentBefore,d))}d=!1;let s=Fi(i,u,()=>o=null,()=>d=!0);o&&(s+=gi(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
|
34
|
+
`}}return e?(p+=`
|
|
35
|
+
`+hi(l(e),c),s&&s()):d&&o&&o(),p}function Xi({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(z(i))i.spaceBefore&&d.push(``),Zi(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(I(i)){let e=z(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Zi(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=z(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Fi(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
36
|
+
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=gi(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
37
|
+
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Zi({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=hi(t(r),e);n.push(i.trimStart())}}function Qi(e,t){let n=L(t)?t.value:t;for(let r of e)if(I(r)&&(r.key===t||r.key===n||L(r.key)&&r.key.value===n))return r}var $i=class extends pi{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(jr,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Ki(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=I(e)?e:!e||typeof e!=`object`||!(`key`in e)?new qi(e,e?.value):new qi(e.key,e.value);let r=Qi(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);L(r.value)&&si(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=Qi(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Qi(this.items,e)?.value;return(!t&&L(n)?n.value:n)??void 0}has(e){return!!Qi(this.items,e)}set(e,t){this.add(new qi(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Wi(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!I(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Ji(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},ea={collection:`map`,default:!0,nodeClass:$i,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Rr(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>$i.from(e,t,n)},ta=class extends pi{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Pr,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=na(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=na(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&L(r)?r.value:r}has(e){let t=na(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=na(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];L(r)&&si(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(ri(e,String(r++),t));return n}toString(e,t,n){return e?Ji(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(ui(a,void 0,n))}}return i}};function na(e){let t=L(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var ra={collection:`seq`,default:!0,nodeClass:ta,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return zr(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>ta.from(e,t,n)},ia={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),ji(e,t,n,r)}},aa={identify:e=>e==null,createNode:()=>new B(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new B(null),stringify:({source:e},t)=>typeof e==`string`&&aa.test.test(e)?e:t.options.nullStr},oa={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new B(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&oa.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function sa({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var ca={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:sa},la={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():sa(e)}},ua={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new B(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:sa},da=e=>typeof e==`bigint`||Number.isInteger(e),fa=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function pa(e,t,n){let{value:r}=e;return da(r)&&r>=0?n+r.toString(t):sa(e)}var ma={identify:e=>da(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>fa(e,2,8,n),stringify:e=>pa(e,8,`0o`)},ha={identify:da,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>fa(e,0,10,n),stringify:sa},ga={identify:e=>da(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>fa(e,2,16,n),stringify:e=>pa(e,16,`0x`)},_a=[ea,ra,ia,aa,oa,ma,ha,ga,ca,la,ua];function va(e){return typeof e==`bigint`||Number.isInteger(e)}var ya=({value:e})=>JSON.stringify(e),ba=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:ya},{identify:e=>e==null,createNode:()=>new B(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:ya},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:ya},{identify:va,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>va(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:ya}],xa=[ea,ra].concat(ba,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Sa={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=B.BLOCK_LITERAL,t!==B.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===B.BLOCK_LITERAL?`
|
|
38
|
+
`:` `)}return ji({comment:e,type:t,value:s},r,i,a)}};function Ca(e,t){if(zr(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!I(r)){if(Rr(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new qi(new B(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=I(r)?r:new qi(r)}}else t(`Expected a sequence for this tag`);return e}function wa(e,t,n){let{replacer:r}=n,i=new ta(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Ki(o,s,n))}return i}var Ta={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Ca,createNode:wa},Ea=class e extends ta{constructor(){super(),this.add=$i.prototype.add.bind(this),this.delete=$i.prototype.delete.bind(this),this.get=$i.prototype.get.bind(this),this.has=$i.prototype.has.bind(this),this.set=$i.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(I(e)?(r=ri(e.key,``,t),i=ri(e.value,r,t)):r=ri(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=wa(e,t,n),i=new this;return i.items=r.items,i}};Ea.tag=`tag:yaml.org,2002:omap`;var Da={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Ea,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Ca(e,t),r=[];for(let{key:e}of n.items)L(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Ea,n)},createNode:(e,t,n)=>Ea.from(e,t,n)};function Oa({value:e,source:t},n){return t&&(e?ka:Aa).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var ka={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new B(!0),stringify:Oa},Aa={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new B(!1),stringify:Oa},ja={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:sa},Ma={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():sa(e)}},Na={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new B(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:sa},Pa=e=>typeof e==`bigint`||Number.isInteger(e);function Fa(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function Ia(e,t,n){let{value:r}=e;if(Pa(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return sa(e)}var La={identify:Pa,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Fa(e,2,2,n),stringify:e=>Ia(e,2,`0b`)},Ra={identify:Pa,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Fa(e,1,8,n),stringify:e=>Ia(e,8,`0`)},za={identify:Pa,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Fa(e,0,10,n),stringify:sa},Ba={identify:Pa,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Fa(e,2,16,n),stringify:e=>Ia(e,16,`0x`)},Va=class e extends $i{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=I(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new qi(e.key,null):new qi(e,null),Qi(this.items,t.key)||this.items.push(t)}get(e,t){let n=Qi(this.items,e);return!t&&I(n)?L(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Qi(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new qi(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Ki(e,null,n));return i}};Va.tag=`tag:yaml.org,2002:set`;var Ha={collection:`map`,identify:e=>e instanceof Set,nodeClass:Va,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Va.from(e,t,n),resolve(e,t){if(Rr(e)){if(e.hasAllNullValues(!0))return Object.assign(new Va,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function Ua(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function Wa(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return sa(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var Ga={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Ua(e,n),stringify:Wa},Ka={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Ua(e,!1),stringify:Wa},qa={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(qa.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=Ua(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},Ja=[ea,ra,ia,aa,ka,Aa,La,Ra,za,Ba,ja,Ma,Na,Sa,zi,Da,Ta,Ha,Ga,Ka,qa],Ya=new Map([[`core`,_a],[`failsafe`,[ea,ra,ia]],[`json`,xa],[`yaml11`,Ja],[`yaml-1.1`,Ja]]),Xa={binary:Sa,bool:oa,float:ua,floatExp:la,floatNaN:ca,floatTime:Ka,int:ha,intHex:ga,intOct:ma,intTime:Ga,map:ea,merge:zi,null:aa,omap:Da,pairs:Ta,seq:ra,set:Ha,timestamp:qa},Za={"tag:yaml.org,2002:binary":Sa,"tag:yaml.org,2002:merge":zi,"tag:yaml.org,2002:omap":Da,"tag:yaml.org,2002:pairs":Ta,"tag:yaml.org,2002:set":Ha,"tag:yaml.org,2002:timestamp":qa};function Qa(e,t,n){let r=Ya.get(t);if(r&&!e)return n&&!r.includes(zi)?r.concat(zi):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(Ya.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(zi)),i.reduce((e,t)=>{let n=typeof t==`string`?Xa[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(Xa).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var $a=(e,t)=>e.key<t.key?-1:+(e.key>t.key),eo=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?Qa(e,`compat`):e?Qa(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?Za:{},this.tags=Qa(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,jr,{value:ea}),Object.defineProperty(this,Nr,{value:ia}),Object.defineProperty(this,Pr,{value:ra}),this.sortMapEntries=typeof a==`function`?a:a===!0?$a:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function to(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=Mi(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(hi(t,``))}let o=!1,s=null;if(e.contents){if(z(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(hi(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Fi(e.contents,i,()=>s=null,t);s&&(c+=gi(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Fi(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
|
|
39
|
+
`)?(n.push(`...`),n.push(hi(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(hi(a(t),``)))}return n.join(`
|
|
40
|
+
`)+`
|
|
41
|
+
`}var no=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Fr,{value:Ar});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Zr({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Fr]:{value:Ar}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=z(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){ro(this.contents)&&this.contents.add(e)}addIn(e,t){ro(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=$r(this);e.anchor=!t||n.has(t)?ei(t||`a`,n):t}return new ai(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=ti(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=ui(e,l,p);return o&&R(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new qi(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return ro(this.contents)?this.contents.delete(e):!1}deleteIn(e){return fi(e)?this.contents!=null&&(this.contents=null,!0):ro(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return R(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return fi(e)?!t&&L(this.contents)?this.contents.value:this.contents:R(this.contents)?this.contents.getIn(e,t):void 0}has(e){return R(this.contents)?this.contents.has(e):!1}hasIn(e){return fi(e)?this.contents!==void 0:R(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=di(this.schema,[e],t):ro(this.contents)&&this.contents.set(e,t)}setIn(e,t){fi(e)?this.contents=t:this.contents==null?this.contents=di(this.schema,Array.from(e),t):ro(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new Zr({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new Zr({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new eo(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=ri(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?ni(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return to(this,e)}};function ro(e){if(R(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var io=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},ao=class extends io{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},oo=class extends io{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},so=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
|
|
42
|
+
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function co(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,ee=null,b=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:ee&&n===`seq-item-ind`||(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,b??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,b??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),ee&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),ee=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let x=e[e.length-1],S=x?x.offset+x.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:ee,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:S,start:b??S}}function lo(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
|
|
43
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(lo(t.key)||lo(t.value))return!0}return!1;default:return!0}}function uo(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&lo(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function fo(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||L(e)&&L(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var po=`All mapping items must start at the same column`;function mo({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??$i)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=co(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,po)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
|
|
44
|
+
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||lo(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,po);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&uo(r.indent,u,i),n.atKey=!1,fo(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=co(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&uo(r.indent,f,i),s=c.range[2];let l=new qi(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
|
|
45
|
+
`+_.comment:g.comment=_.comment);let e=new qi(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function ho({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??ta)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=co(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found){if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&uo(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function go(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var _o=`Block collections are not allowed within flow collections`,vo=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function yo({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?$i:ta))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=co(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
|
|
46
|
+
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&lo(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];I(t)&&(t=t.value??t.key),t.comment?t.comment+=`
|
|
47
|
+
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],vo(m)&&i(r.range,`BLOCK_IN_FLOW`,_o)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);vo(f)&&i(g.range,`BLOCK_IN_FLOW`,_o),n.atKey=!1;let _=co(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?vo(m)&&i(v.range,`BLOCK_IN_FLOW`,_o):_.comment&&(g.comment?g.comment+=`
|
|
48
|
+
`+_.comment:g.comment=_.comment);let y=new qi(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;fo(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new $i(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=go(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
|
|
49
|
+
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function bo(e,t,n,r,i,a){let o=n.type===`block-map`?mo(e,t,n,r,a):n.type===`block-seq`?ho(e,t,n,r,a):yo(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function xo(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===$i.tagName&&s===`map`||o===ta.tagName&&s===`seq`)return bo(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),bo(e,t,n,i,o)}let l=bo(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=z(u)?u:new B(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function So(e,t,n){let r=t.offset,i=Co(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?B.BLOCK_FOLDED:B.BLOCK_LITERAL,o=t.source?wo(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
|
|
50
|
+
`.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
|
|
51
|
+
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===B.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
|
|
52
|
+
`):t.length>c||r[0]===` `?(f===` `?f=`
|
|
53
|
+
`:!p&&f===`
|
|
54
|
+
`&&(f=`
|
|
55
|
+
|
|
56
|
+
`),d+=f+t.slice(c)+r,f=`
|
|
57
|
+
`,p=!0):r===``?f===`
|
|
58
|
+
`?d+=`
|
|
59
|
+
`:f=`
|
|
60
|
+
`:(d+=f+r,f=` `,p=!1)}switch(i.chomp){case`-`:break;case`+`:for(let e=s;e<o.length;++e)d+=`
|
|
61
|
+
`+o[e][0].slice(c);d[d.length-1]!==`
|
|
62
|
+
`&&(d+=`
|
|
63
|
+
`);break;default:d+=`
|
|
64
|
+
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function Co({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function wo(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function To(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=B.PLAIN,c=Eo(a,l);break;case`single-quoted-scalar`:s=B.QUOTE_SINGLE,c=Do(a,l);break;case`double-quoted-scalar`:s=B.QUOTE_DOUBLE,c=ko(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=go(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Eo(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),Oo(e)}function Do(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Oo(e.slice(1,-1)).replace(/''/g,`'`)}function Oo(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
|
|
65
|
+
`?a+=o:o=`
|
|
66
|
+
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function ko(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
|
|
67
|
+
`){if(i===`
|
|
68
|
+
`){let{fold:t,offset:i}=Ao(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=jo[i];if(a)n+=a;else if(i===`
|
|
69
|
+
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
|
|
70
|
+
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=Mo(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
|
|
71
|
+
`&&(a!==`\r`||e[r+2]!==`
|
|
72
|
+
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function Ao(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
|
|
73
|
+
`||r===`\r`)&&(r!==`\r`||e[t+2]===`
|
|
74
|
+
`);)r===`
|
|
75
|
+
`&&(n+=`
|
|
76
|
+
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var jo={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
|
|
77
|
+
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Mo(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function No(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?So(e,t,r):To(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Nr]:c?Po(e.schema,i,c,n,r):t.type===`scalar`?Fo(e,i,t,r):e.schema[Nr];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=L(a)?a:new B(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new B(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Po(e,t,n,r,i){if(n===`!`)return e[Nr];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Nr])}function Fo({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Nr];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Nr];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function Io(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var Lo={composeNode:Ro,composeEmptyNode:zo};function Ro(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Bo(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=No(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=xo(Lo,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=zo(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!L(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function zo(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=No(e,{type:`scalar`,offset:Io(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Bo({options:e},{offset:t,source:n,end:r},i){let a=new ai(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=go(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Vo(e,t,{offset:n,start:r,value:i,end:a},o){let s=new no(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=co(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Ro(c,i,l,o):zo(c,l.end,r,null,l,o);let u=s.contents.range[2],d=go(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Ho(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function Uo(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
|
|
78
|
+
|
|
79
|
+
`:`
|
|
80
|
+
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var Wo=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Ho(e);r?this.warnings.push(new oo(i,t,n)):this.errors.push(new ao(i,t,n))},this.directives=new Zr({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Uo(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(R(i)&&!i.flow&&i.items.length>0){let e=i.items[0];I(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Uo(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Ho(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Vo(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new ao(Ho(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new ao(Ho(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=go(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new ao(Ho(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new no(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},Go=Symbol(`break visit`),Ko=Symbol(`skip children`),qo=Symbol(`remove item`);function Jo(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Yo(Object.freeze([]),e,t)}Jo.BREAK=Go,Jo.SKIP=Ko,Jo.REMOVE=qo,Jo.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Jo.parentCollection=(e,t)=>{let n=Jo.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Yo(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Yo(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Go)return Go;else r===qo&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function Xo(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
|
|
81
|
+
`:case`\r
|
|
82
|
+
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function Zo(e){switch(e){case void 0:case` `:case`
|
|
83
|
+
`:case`\r`:case` `:return!0;default:return!1}}var Qo=new Set(`0123456789ABCDEFabcdef`),$o=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),es=new Set(`,[]{}`),ts=new Set(` ,[]{}
|
|
84
|
+
\r `),ns=e=>!e||ts.has(e),rs=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
|
|
85
|
+
`||t===`\r`&&this.buffer[e+1]===`
|
|
86
|
+
`}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
|
|
87
|
+
`||!t&&!this.atEnd)return e+n+1}return t===`
|
|
88
|
+
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&Zo(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
89
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&Zo(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Zo(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&Zo(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(ns),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&Zo(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(ns),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||Zo(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
|
|
90
|
+
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
|
|
91
|
+
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>Zo(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
|
|
92
|
+
`:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
|
|
93
|
+
`)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
|
|
94
|
+
`,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
|
|
95
|
+
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
|
|
96
|
+
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(Zo(r)||e&&es.has(r))break;t=n}else if(Zo(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
|
|
97
|
+
`?(n+=1,r=`
|
|
98
|
+
`,i=this.buffer[n+1]):t=n),i===`#`||e&&es.has(i))break;if(r===`
|
|
99
|
+
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&es.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(ns),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(Zo(n)||t&&es.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!Zo(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if($o.has(t))t=this.buffer[++e];else if(t===`%`&&Qo.has(this.buffer[e+1])&&Qo.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
100
|
+
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
|
|
101
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},is=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function as(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function os(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function ss(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function cs(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function ls(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function us(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function ds(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!as(t.start,`explicit-key-ind`)&&!as(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,ss(t.value)?t.value.end?us(t.value.end,t.sep):t.value.end=t.sep:us(t.start,t.sep),delete t.sep)}var fs=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new rs,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Xo(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source})}else{if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&ds(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&os(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:os(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=ls(cs(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
|
|
102
|
+
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
103
|
+
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){us(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(as(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=ls(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(as(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(ss(t.key)&&!as(t.sep,`newline`)){let e=ls(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):as(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!as(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){us(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||as(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=ls(cs(t));ds(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
104
|
+
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
105
|
+
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=ls(cs(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=ls(cs(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function ps(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new is||null,prettyErrors:t}}function ms(e,t={}){let{lineCounter:n,prettyErrors:r}=ps(t),i=new fs(n?.addNewLine),a=new Wo(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new ao(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(so(e,n)),o.warnings.forEach(so(e,n))),o}function hs(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=ms(e,n);if(!i)return null;if(i.warnings.forEach(e=>Li(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function gs(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function _s(e,t=`|`){return e.map(e=>Hs(e)).join(t)}function vs(e,t){return typeof t==`bigint`?t.toString():t}var ys=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function bs(e){return new ys(e)}function xs(e){return e==null}function Ss(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Cs(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function ws(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ts(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Es(e){return Ts(e._zod.def)??e._zod.def.shape}function Ds(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return ws(this,t,e),e},enumerable:!0,configurable:!0})}function Os(e,t,n){t in e?ws(e,t,n):e[t]=n}function ks(e,t,n,r){let i=Es(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Ds(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Os(e,a,r?r(n.value,a):n.value))}}function As(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Ds(e,n,()=>t[n]):Os(e,n,r.value))}}function js(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ms(e){return JSON.stringify(e)}function Ns(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Ps=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Fs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Is=bs(()=>{if(jc.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ls(e){if(Fs(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Fs(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Rs(e){return Ls(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var zs=new Set([`string`,`number`,`symbol`]);function Bs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Vs(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function V(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Hs(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Us(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Ws={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Gs={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Ks(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return ks(i,e,qs(e,t)),Vs(e,js(n,{shape:i,checks:[]}))}function qs(e,t){let n=Es(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Js(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(qs(e,t)),a={};return ks(a,e,Reflect.ownKeys(Es(e)).filter(e=>!i.has(e))),Vs(e,js(n,{shape:a,checks:[]}))}function Ys(e,t){if(!Ls(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Es(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Vs(e,js(e._zod.def,{shape:Xs(e,t)}))}function Xs(e,t){let n={};return ks(n,e,Reflect.ownKeys(Es(e))),As(n,t),n}function Zs(e,t){if(!Ls(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Vs(e,js(e._zod.def,{shape:Xs(e,t)}))}function Qs(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return ks(n,e,Reflect.ownKeys(Es(e))),ks(n,t,Reflect.ownKeys(Es(t))),Vs(e,js(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function $s(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(qs(t,n)):void 0,o={};return ks(o,t,Reflect.ownKeys(Es(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Vs(t,js(t._zod.def,{shape:o,checks:[]}))}function ec(e,t,n){let r=n?new Set(qs(t,n)):void 0,i={};return ks(i,t,Reflect.ownKeys(Es(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Vs(t,js(t._zod.def,{shape:i}))}function tc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function nc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function rc(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ic(e){return typeof e==`string`?e:e?.message}function ac(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function oc(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function sc(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:ic(e.inst?._zod.def?.error?.(e))??ic(a?.(e))??ic(t?.error?.(e))??ic(n.customError?.(e))??ic(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var cc=/[\uD800-\uDBFF]/;function lc(e){let t=e.length;if(!cc.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function uc(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function dc(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function fc(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function pc(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):_c(e,n,r.value)}}function mc(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function hc(e,t,n){return mc(e,t,n,!1)}function gc(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return mc(this,n,r(this))},set(e){mc(this,n,e)}})}return t}function _c(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:mc(this,t,n.bind(this))},set(e){mc(this,t,e)}})}function vc(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var yc,bc=!1,xc={configurable:!0,get(){bc=!0}};function H(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&yc!==e._zod?yc=void 0:(yc=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,xc);let e=bc;bc=!1;try{let r=n(this);return bc?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),bc||=e,r}catch(n){throw delete this[t],bc||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Sc(e,t,n,r){let i=vc(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Cc=`~constantCatch`;function wc(e){let t=()=>e;return t[Cc]=!0,t}var Tc,Ec={value:void 0,enumerable:!1},Dc=`captureStackTrace`in Error?Error:null;function Oc(e){let t=Dc;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Dc=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function U(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Ec.value=new a(r);try{Object.defineProperty(n,"_zod",Ec)}finally{Ec.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),pc(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Oc(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var kc=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ac=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Tc=globalThis).__zod_globalConfig??(Tc.__zod_globalConfig={});var jc=globalThis.__zod_globalConfig;function Mc(e){return e&&Object.assign(jc,e),jc}function Nc(){let e=this._zod;return e.message??=JSON.stringify(e.def,vs,2),e.message}function Pc(e){this._zod.message=e}var Fc={get:Nc,set:Pc,enumerable:!0,configurable:!0},Ic={value:void 0,enumerable:!1},Lc=new WeakSet([Object.prototype,Error.prototype]),Rc=U(`$ZodError`,(e,t)=>{e.name=`$ZodError`,Ic.value=t,Object.defineProperty(e,"issues",Ic),Ic.value=void 0,Object.defineProperty(e,"message",Fc);let n=Object.getPrototypeOf(e);Lc.has(n)||(Lc.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function zc(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Bc(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?zc(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Vc(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Hc(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Uc=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new kc;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>sc(e,o,Mc())));throw Ps(n,a?.callee??t),n}return s.value};return t},Wc=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>sc(e,o,Mc())));throw Ps(n,a?.callee??t),n}return s.value};return t},Gc=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new kc;return a.issues.length?Kc(e,a.issues,i):{success:!0,data:a.value}};function Kc(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>sc(e,n,Mc()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var qc=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Kc(e,a.issues,i):{success:!0,data:a.value}},Jc=Symbol.for(`zod.compile.invalid`),Yc=Symbol.for(`zod.compile.fallback`),Xc=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Jc)return!0;if(r.definite===!0&&n===void 0)return!1}return Zc(e,t,n)});function Zc(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Yc]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new kc;return a.issues.length===0}var Qc=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},$c=e=>{let t=Uc(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Hc(n,a))};return n},el=e=>{let t=Uc(e),n=(e,r,i,a)=>t(e,r,i,Hc(n,a));return n},tl=e=>{let t=Wc(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Hc(n,a))};return n},nl=e=>{let t=Wc(e),n=async(e,r,i,a)=>await t(e,r,i,Hc(n,a));return n},rl=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Gc(e)(t,n,i)},il=e=>(t,n,r)=>Gc(e)(t,n,r),al=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qc(e)(t,n,i)},ol=e=>async(t,n,r)=>qc(e)(t,n,r),sl=/^[cC][0-9a-z]{6,}$/,cl=/^[0-9a-z]+$/,ll=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ul=/^[0-9a-vA-V]{20}$/,dl=/^[A-Za-z0-9]{27}$/,fl=/^[a-zA-Z0-9_-]{21}$/;function pl(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var ml=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,hl=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gl=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,_l=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vl=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function yl(){return new RegExp(vl,`u`)}var bl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,xl=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Sl=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Cl=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Tl=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,El=/^https?$/,Dl=/^\+[1-9]\d{6,14}$/,Ol=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function kl(e){return RegExp(`^${e}$`)}var Al=kl(Ol);function jl(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ml(e){return RegExp(`^${jl(e)}$`)}function Nl(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${jl({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${jl({precision:e.precision})}`:n;return RegExp(`^${Ol}T(?:${r})$`)}var Pl=/^[\s\S]{0,}$/,Fl=/^-?\d+(?:\.\d+)?$/,Il=/^(?:true|false)$/i,Ll=/^[^A-Z]*$/,Rl=/^[^a-z]*$/,zl=U(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Bl=e=>{let t=e.value;return!xs(t)&&t.length!==void 0},Vl={number:`number`,bigint:`bigint`,object:`date`},Hl=U(`$ZodCheckLessThan`,(e,t)=>{zl.init(e,t);let n=Vl[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Vl[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ul=U(`$ZodCheckGreaterThan`,(e,t)=>{zl.init(e,t);let n=Vl[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Vl[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wl=U(`$ZodCheckMultipleOf`,(e,t)=>{zl.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Cs(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Gl=U(`$ZodCheckNumberFormat`,(e,t)=>{zl.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ws[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Kl=U(`$ZodCheckMaxLength`,(e,t)=>{var n;zl.init(e,t),(n=e._zod.def).when??(n.when=Bl),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?lc(r):i)<=t.maximum)return;let a=uc(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ql=U(`$ZodCheckMinLength`,(e,t)=>{var n;zl.init(e,t),(n=e._zod.def).when??(n.when=Bl),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?lc(r):i)>=t.minimum)return;let a=uc(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Jl=U(`$ZodCheckLengthEquals`,(e,t)=>{var n;zl.init(e,t),(n=e._zod.def).when??(n.when=Bl),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?lc(r):i;if(a===t.length)return;let o=uc(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Yl=U(`$ZodCheckStringFormat`,(e,t)=>{var n,r;zl.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Xl=U(`$ZodCheckRegex`,(e,t)=>{Yl.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Zl=U(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ll,Yl.init(e,t)}),Ql=U(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Rl,Yl.init(e,t)}),$l=U(`$ZodCheckIncludes`,(e,t)=>{zl.init(e,t);let n=Bs(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),eu=U(`$ZodCheckStartsWith`,(e,t)=>{zl.init(e,t);let n=RegExp(`^${Bs(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),tu=U(`$ZodCheckEndsWith`,(e,t)=>{zl.init(e,t);let n=RegExp(`.*${Bs(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),nu=U(`$ZodCheckOverwrite`,(e,t)=>{zl.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),ru=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
106
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
107
|
+
`)}\n};`)(...Object.values(this.closed))}},iu={major:4,minor:6,patch:7},W=U(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=iu;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=tc(t),a;for(let o of n){if(o._zod.def.when){if(nc(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new kc;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(oc(t.issues,n,e),i||=tc(t,n))});else{if(t.issues.length===n)continue;oc(t.issues,n,e),i||=tc(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(tc(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new kc;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new kc;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return hc(this,`~standard`,su(this))},set"~standard"(e){mc(this,`~standard`,e)}}),au=(e,t)=>e.issues.length?{issues:e.issues.map(e=>sc(e,t,Mc()))}:{value:e.value};async function ou(e,t){let n={async:!0};return au(await e._zod.run({value:t,issues:[]},n),n)}function su(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return au(r,n)}catch{}return ou(e,t)},vendor:`zod`,version:1}}var cu=U(`$ZodString`,(e,t)=>{W.init(e,t),e._zod.pattern=t.pattern??Pl,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),G=U(`$ZodStringFormat`,(e,t)=>{Yl.init(e,t),cu.init(e,t)}),lu=U(`$ZodGUID`,(e,t)=>{t.pattern??=hl,G.init(e,t)}),uu=U(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=gl(e)}else t.pattern??=gl();G.init(e,t)}),du=U(`$ZodEmail`,(e,t)=>{t.pattern??=_l,G.init(e,t)});function fu(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function pu(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?fu(e)||2:mu(e,t)}function mu(e,t){if(!t.normalize&&t.protocol?.source===El.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var hu=/[\t\n\r]/g;function gu(e){return e.replace(hu,``)}function _u(e,t){return t.lastIndex=0,t.test(e.hostname)}function vu(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var yu=U(`$ZodURL`,(e,t)=>{G.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=pu(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=gu(r);return}t.hostname&&!_u(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!vu(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:gu(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),bu=U(`$ZodEmoji`,(e,t)=>{t.pattern??=yl(),G.init(e,t)}),xu=U(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?fl:pl(t.length),G.init(e,t)}),Su=U(`$ZodCUID`,(e,t)=>{t.pattern??=sl,G.init(e,t)}),Cu=U(`$ZodCUID2`,(e,t)=>{t.pattern??=cl,G.init(e,t)}),wu=U(`$ZodULID`,(e,t)=>{t.pattern??=ll,G.init(e,t)}),Tu=U(`$ZodXID`,(e,t)=>{t.pattern??=ul,G.init(e,t)}),Eu=U(`$ZodKSUID`,(e,t)=>{t.pattern??=dl,G.init(e,t)}),Du=U(`$ZodISODateTime`,(e,t)=>{t.pattern??=Nl(t),G.init(e,t)}),Ou=U(`$ZodISODate`,(e,t)=>{t.pattern??=Al,G.init(e,t)}),ku=U(`$ZodISOTime`,(e,t)=>{t.pattern??=Ml(t),G.init(e,t)}),Au=U(`$ZodISODuration`,(e,t)=>{t.pattern??=ml,G.init(e,t)}),ju=U(`$ZodIPv4`,(e,t)=>{t.pattern??=bl,G.init(e,t)}),Mu=/^[0-9a-fA-F:.]+$/;function Nu(e){return Mu.test(e)?fu(`http://[${e}]`):!1}var Pu=U(`$ZodIPv6`,(e,t)=>{t.pattern??=xl,G.init(e,t),e._zod.check=n=>{Nu(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Fu=U(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Sl,G.init(e,t)});function Iu(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Nu(n)}var Lu=U(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Cl,G.init(e,t),e._zod.check=n=>{Iu(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Ru(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var zu=/^[0-9a-zA-Z+/]*={0,2}$/,Bu=U(`$ZodBase64`,(e,t)=>{t.pattern??=zu,G.init(e,t),e._zod.check=n=>{Ru(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Vu=/^[A-Za-z0-9_-]*$/;function Hu(e){if(!Vu.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Ru(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Uu=U(`$ZodBase64URL`,(e,t)=>{t.pattern??=Vu,G.init(e,t),e._zod.check=n=>{Hu(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Wu=U(`$ZodE164`,(e,t)=>{t.pattern??=Dl,G.init(e,t)});function Gu(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Ku=U(`$ZodJWT`,(e,t)=>{G.init(e,t),e._zod.check=n=>{Gu(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),qu=U(`$ZodNumber`,(e,t)=>{W.init(e,t),e._zod.pattern=Fl,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Ju=U(`$ZodNumberFormat`,(e,t)=>{Gl.init(e,t),qu.init(e,t)}),Yu=U(`$ZodBoolean`,(e,t)=>{W.init(e,t),e._zod.pattern=Il,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Xu=U(`$ZodUnknown`,(e,t)=>{W.init(e,t),e._zod.parse=e=>e}),Zu=U(`$ZodNever`,(e,t)=>{W.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Qu(e,t){let n=ac(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of ac(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,oc(n.issues,t,e),n}}return i(n,a)}}var $u=e=>Array.isArray(e)?e.length:-1;function ed(e,t,n){e.issues.length&&t.issues.push(...rc(n,e.issues)),t.value[n]=e.value}var td=U(`$ZodArray`,(e,t)=>{W.init(e,t);let n=jc.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>ed(t,r,e)));else if(ed(c,r,e),s&&c.issues.length!==0&&tc(c))break}return o.length?Promise.all(o).then(()=>r):r},Qu(e,$u)});function nd(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...rc(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var rd=[];function id(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:rd,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Us(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function ad(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(tc(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>nd(e,n,i,t,d,f))):nd(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var od=U(`$ZodObject`,(e,t)=>{W.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=bs(()=>id(t));H(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||ws(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Fs,o=t.catchall,s,c=jc.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(tc(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>nd(n,t,e,r,a,o))):nd(s,t,e,r,a,o)}return o?ad(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),sd=U(`$ZodObjectJIT`,(e,t)=>{od.init(e,t);let n=e._zod.parse,r=bs(()=>id(t)),i=jc.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new ru([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
108
|
+
let ${e}_ab = false;
|
|
109
|
+
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
110
|
+
const iss = ${e}.issues[i];
|
|
111
|
+
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
112
|
+
payload.issues.push(iss);
|
|
113
|
+
if (iss.continue !== true) ${e}_ab = true;
|
|
114
|
+
}
|
|
115
|
+
if (${e}_ab && ctx && ctx.abortEarly) {
|
|
116
|
+
payload.value = newResult;
|
|
117
|
+
return payload;
|
|
118
|
+
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Ms(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
119
|
+
const ${n}_present = ${i};
|
|
120
|
+
if (!${n}.issues.length || ${n}_present) {
|
|
121
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (${e}) {
|
|
125
|
+
newResult[${r}] = ${n}.value;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
`)}else f?(o.write(`
|
|
130
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
131
|
+
}
|
|
132
|
+
`),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
|
|
133
|
+
if (${n}.value !== undefined || ${i}) {
|
|
134
|
+
newResult[${r}] = ${n}.value;
|
|
135
|
+
}
|
|
136
|
+
`)):o.write(`
|
|
137
|
+
const ${n}_present = ${i};
|
|
138
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
139
|
+
}
|
|
140
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
141
|
+
payload.issues.push({
|
|
142
|
+
code: "invalid_type",
|
|
143
|
+
expected: "nonoptional",
|
|
144
|
+
input: undefined,
|
|
145
|
+
path: [${r}]
|
|
146
|
+
});
|
|
147
|
+
if (ctx && ctx.abortEarly) {
|
|
148
|
+
payload.value = newResult;
|
|
149
|
+
return payload;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (${n}_present) {
|
|
154
|
+
newResult[${r}] = ${n}.value;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Fs,c=!jc.jitless,l=c&&Is.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?ad([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function cd(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!tc(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>sc(e,r,Mc())))}),t)}var ld=U(`$ZodUnion`,(e,t)=>{W.init(e,t),H(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),H(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),H(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),H(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Ss(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>cd(t,r,e,i)):cd(o,r,e,i)}}),ud=U(`$ZodIntersection`,(e,t)=>{W.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>fd(e,t,n)):fd(e,i,a)}});function dd(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ls(e)&&Ls(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=dd(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=dd(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function fd(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=dd(t.value,n.value);if(!c.valid){if(tc(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var pd=U(`$ZodTuple`,(e,t)=>{W.init(e,t);let n=t.items,r=jc.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=md(n,`optin`),l=md(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=tc(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(tc(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>hd(t,i,e))):hd(r,i,e)}}return s.length?Promise.all(s).then(()=>gd(u,i,n,o,l)):gd(u,i,n,o,l)}});function md(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function hd(e,t,n){e.issues.length&&t.issues.push(...rc(n,e.issues)),t.value[n]=e.value}function gd(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...rc(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var _d=U(`$ZodEnum`,(e,t)=>{W.init(e,t);let n=gs(t.entries),r=new Set(n);e._zod.values=r,H(e,`pattern`,e=>{let t=gs(e.def.entries).filter(e=>zs.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Bs(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),vd=U(`$ZodTransform`,(e,t)=>{W.init(e,t),e._zod.optin=`optional`,jc.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ac(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new kc;return n.value=i,n}});function yd(e,t){return e.value=t.issues.length?void 0:t.value,e}var bd=U(`$ZodOptional`,(e,t)=>{W.init(e,t),H(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,H(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),H(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Ss(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>yd(e,t)):yd(e,r)}return t.innerType._zod.run(e,n)}}),xd=U(`$ZodExactOptional`,(e,t)=>{bd.init(e,t),H(e,`values`,e=>e.def.innerType._zod.values),H(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Sd=U(`$ZodNullable`,(e,t)=>{W.init(e,t),H(e,`optin`,e=>e.def.innerType._zod.optin),H(e,`optout`,e=>e.def.innerType._zod.optout),H(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Ss(t.source)}|null)$`):void 0}),H(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Cd=U(`$ZodDefault`,(e,t)=>{W.init(e,t),e._zod.optin=`defaulted`,H(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>wd(e,t)):wd(r,t)}});function wd(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Td=U(`$ZodPrefault`,(e,t)=>{W.init(e,t),e._zod.optin=`defaulted`,H(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ed=U(`$ZodNonOptional`,(e,t)=>{W.init(e,t),H(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Dd(t,e)):Dd(i,e)}});function Dd(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Od(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>sc(e,r,Mc()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var kd=U(`$ZodCatch`,(e,t)=>{W.init(e,t),H(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),H(e,`optout`,e=>e.def.innerType._zod.optout),H(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Od(e,r,t,n)):Od(e,r,t,n)}}),Ad=U(`$ZodPipe`,(e,t)=>{W.init(e,t),H(e,`values`,e=>e.def.in._zod.values),H(e,`optin`,e=>e.def.in._zod.optin),H(e,`optout`,e=>e.def.out._zod.optout),H(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>jd(e,t.in,n)):jd(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>jd(e,t.out,n)):jd(r,t.out,n)}});function jd(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Md=U(`$ZodReadonly`,(e,t)=>{W.init(e,t),H(e,`propValues`,e=>e.def.innerType._zod.propValues),H(e,`values`,e=>e.def.innerType._zod.values),H(e,`optin`,e=>e.def.innerType?._zod?.optin),H(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Nd):Nd(r)}});function Nd(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Pd=U(`$ZodCustom`,(e,t)=>{zl.init(e,t),W.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Fd(t,n,r,e));Fd(i,n,r,e)}});function Fd(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(fc(e))}}var Id=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Ld=`~memo`,Rd=[];function zd(e){return typeof e==`object`&&!!e}function Bd(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Vd=new WeakMap,Hd=0,Ud=1,Wd=2;function Gd(e,t,n){let r=Vd.get(e);if(r!==void 0)return r?Wd:Hd;if(t.has(e))return Wd;t.add(e);let i=Hd,a=e=>{if(i!==Wd&&e?._zod){let r=Gd(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Hd;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ud:o.value?._zod?Gd(o.value,t,n):Hd;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Ts(c);s(e?o(e,!0):Ud),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Gd(r,t,!1):Ud);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Kd(e,i)}function Kd(e,t){return t!==Ud&&Vd.set(e,t===Wd),t}function qd(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Jd,Yd=[],Xd={alloc(e,t,n){let r=Jd;if(!r)return n;Jd=void 0;let i={value:n,issues:null};return r.set(t.value,i),Yd.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Qd(n,e.value))throw new Id;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Gd(e,new Set,!1);if(i===Hd)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Wd||r?n=!0:r=!0}let l=s.value;if(!zd(l))return t(s,c);let u=c[Ld];u||(u={buckets:new WeakMap,backEdges:void 0},c[Ld]=u);let d;i===c?d=a:(d=qd(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Bd(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Jd=d;let p=Yd.length,m=t(s,c);Jd=void 0;let h=Yd.length>p?Yd.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Bd(e.issues):Rd),e)):(h&&(h.issues=m.issues.length?Bd(m.issues):Rd),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Zd(){return Xd}function Qd(e,t){let n=e[Ld]?.backEdges;return n!==void 0&&zd(t)&&n.has(t)}var $d=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(dc(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Hs(e.values[0])}`:`Invalid option: expected one of ${_s(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${_s(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function ef(){return{localeError:$d()}}var tf,nf=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function rf(){return new nf}(tf=globalThis).__zod_globalRegistry??(tf.__zod_globalRegistry=rf());var af=globalThis.__zod_globalRegistry;function of(e){return e.checks&&=[...e.checks],e}function sf(e,t){return new e(of({type:`string`,...V(t)}))}function cf(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...V(t)})}function lf(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...V(t)})}function uf(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...V(t)})}function df(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...V(t)})}function ff(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...V(t)})}function pf(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...V(t)})}function mf(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...V(t)})}function hf(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...V(t)})}function gf(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...V(t)})}function _f(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...V(t)})}function vf(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...V(t)})}function yf(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...V(t)})}function bf(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...V(t)})}function xf(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...V(t)})}function Sf(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...V(t)})}function Cf(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...V(t)})}function wf(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...V(t)})}function Tf(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...V(t)})}function Ef(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...V(t)})}function Df(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...V(t)})}function Of(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...V(t)})}function kf(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...V(t)})}function Af(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...V(t)})}function jf(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...V(t)})}function Mf(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...V(t)})}function Nf(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...V(t)})}function Pf(e,t){return new e(of({type:`number`,checks:[],...V(t)}))}function Ff(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...V(t)})}function If(e,t){return new e({type:`boolean`,...V(t)})}function Lf(e){return new e({type:`unknown`})}function Rf(e,t){return new e({type:`never`,...V(t)})}function zf(e,t){return new Hl({check:`less_than`,...V(t),value:e,inclusive:!1})}function Bf(e,t){return new Hl({check:`less_than`,...V(t),value:e,inclusive:!0})}function Vf(e,t){return new Ul({check:`greater_than`,...V(t),value:e,inclusive:!1})}function Hf(e,t){return new Ul({check:`greater_than`,...V(t),value:e,inclusive:!0})}function Uf(e,t){return new Wl({check:`multiple_of`,...V(t),value:e})}function Wf(e,t){return new Kl({check:`max_length`,...V(t),maximum:e})}function Gf(e,t){return new ql({check:`min_length`,...V(t),minimum:e})}function Kf(e,t){return new Jl({check:`length_equals`,...V(t),length:e})}function qf(e,t){return new Xl({check:`string_format`,format:`regex`,...V(t),pattern:e})}function Jf(e){return new Zl({check:`string_format`,format:`lowercase`,...V(e)})}function Yf(e){return new Ql({check:`string_format`,format:`uppercase`,...V(e)})}function Xf(e,t){return new $l({check:`string_format`,format:`includes`,...V(t),includes:e})}function Zf(e,t){return new eu({check:`string_format`,format:`starts_with`,...V(t),prefix:e})}function Qf(e,t){return new tu({check:`string_format`,format:`ends_with`,...V(t),suffix:e})}function $f(e){return new nu({check:`overwrite`,tx:e})}function ep(e){return $f(t=>t.normalize(e))}function tp(){return $f(e=>e.trim())}function np(){return $f(e=>e.toLowerCase())}function rp(){return $f(e=>e.toUpperCase())}function ip(){return $f(e=>Ns(e))}function ap(e,t,n){return new e({type:`array`,element:t,...V(n)})}function op(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...V(n)})}function sp(e,t){let n=cp(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(fc(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(fc(r))}},e(t.value,t)),t);return n}function cp(e,t){let n=new zl({check:`custom`,...V(t)});return n._zod.check=e,n}function lp(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&ws(e,t,n[t]);return e}function up(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??af,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function dp(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function K(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,K(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&lp(o.schema,c),t.io===`input`&&q(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function fp(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function pp(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${fp(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+fp(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
158
|
+
|
|
159
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function mp(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;mp(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var hp=new Set([`type`,`properties`,`required`,`additionalProperties`]),gp=[`oneOf`,`anyOf`];function _p(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function vp(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!hp.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??_p(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}ws(n,r,e.length===1?e[0]:vp(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=_p(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function yp(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of hp)if(t in e)return;let n=t.filter(e=>gp.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=vp(t);else{let e=n[0],i=gp.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>vp([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,lp(e,r))}function bp(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):lp(i,s),lp(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())mp(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])yp(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}lp(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,ws(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Sp(t,`input`,e.processors),output:Sp(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function q(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return q(r.element,n);if(r.type===`set`)return q(r.valueType,n);if(r.type===`lazy`)return q(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return q(r.innerType,n);if(r.type===`intersection`)return q(r.left,n)||q(r.right,n);if(r.type===`record`||r.type===`map`)return q(r.keyType,n)||q(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:q(r.in,n)||q(r.out,n);if(r.type===`object`){for(let e in r.shape)if(q(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(q(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(q(e,n))return!0;return!!(r.rest&&q(r.rest,n))}return!1}var xp=(e,t={})=>n=>{let r=up({...n,processors:t});return K(e,r),pp(r,e),bp(r,e)},Sp=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=up({...i??{},target:a,io:t,processors:n});return K(e,o),pp(o,e),bp(o,e)},Cp=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},wp=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Tp=(e,t)=>{Cp(e,`minimum`,t),wp(e,`maximum`,t)},Ep=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Dp=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Op=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},kp=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ap=(e,t)=>Cp(e,`minimum`,t.minimum),jp=(e,t)=>wp(e,`maximum`,t.maximum),Mp=e=>(t,n)=>{kp(t,n.format);let[r,i]=e[n.format];Cp(t,`minimum`,r),wp(t,`maximum`,i)},Np={greater_than:(e,t)=>Cp(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>wp(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Ep(e,t.value),number_format:Mp(Ws),bigint_format:Mp(Gs),min_length:Ap,max_length:jp,length_equals:(e,t)=>Tp(e,t.length),min_size:Ap,max_size:jp,size_equals:(e,t)=>Tp(e,t.size),string_format:(e,t)=>{kp(e,t.format),t.pattern&&Dp(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Op(e,t.mime)};function Pp(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Np[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Cp(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Cp(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&wp(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&wp(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Ep(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Op(t,i.mime);for(let e of i.patterns??[])Dp(t,e);return t}var Fp={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ip=new Map([[zu,wl],[Vu,Tl]]),Lp=e=>Ip.get(e)??e,Rp=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Pp(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Fp[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Lp);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},zp=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Pp(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):dp(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Bp=(e,t,n,r)=>{n.type=`boolean`},Vp=(e,t,n,r)=>{n.not={}},Hp=(e,t,n,r)=>{let i=e._zod.def,a=gs(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Up=(e,t,n,r)=>{dp(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Wp=(e,t,n,r)=>{dp(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Gp=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Pp(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=K(a.element,t,{...r,path:[...r.path,`items`]})};function Kp(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Kp(t.out):t.type===`catch`?Kp(t.innerType):e._zod.optin}var qp=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&dp(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)ws(i.properties,e,K(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Kp(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=K(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Jp=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>K(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Yp=(e,t,n,r)=>{let i=e._zod.def,a=K(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=K(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Xp=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>K(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?K(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Kp(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=Pp(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)},Zp=(e,t,n,r)=>{let i=e._zod.def,a=K(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Qp=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},$p=Symbol();function em(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(dp(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),$p):JSON.parse(o)}var tm=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=em(i.defaultValue,e,t,n,r);o!==$p&&(n.default=o)},nm=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=em(i.defaultValue,e,t,n,r);o!==$p&&(n._prefault=o)},rm=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{dp(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},im=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;K(o,t,r);let s=t.seen.get(e);s.ref=o},am=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},om=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},sm=new WeakSet([Object.prototype,Error.prototype]);function cm(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var lm=U(`ZodError`,(e,t)=>{Rc.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);sm.has(n)||(sm.add(n),cm(n,`format`,e=>t=>Vc(e,t)),cm(n,`flatten`,e=>t=>Bc(e,t)),cm(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,vs,2)}),cm(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,vs,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),um=Uc(lm),dm=Wc(lm),fm=Gc(lm),pm=qc(lm),mm=$c(lm),hm=el(lm),gm=tl(lm),_m=nl(lm),vm=rl(lm),ym=il(lm),bm=al(lm),xm=ol(lm);function Sm(){jc.localeError||Mc(ef())}function Cm(){jc.memoizer||Mc({memoizer:Zd()})}var J=U(`ZodType`,(e,t)=>(Sm(),W.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(js(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Vs(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(zh(e,t))},superRefine(e,t){return this.check(Bh(e,t))},overwrite(e){return this.check($f(e))},optional(){return xh(this)},exactOptional(){return Ch(this)},nullable(){return Th(this)},nullish(){return xh(Th(this))},nonoptional(e){return jh(this,e)},array(){return sh(this)},or(e){return dh([this,e])},and(e){return ph(this,e)},transform(e){return Fh(this,yh(e))},default(e){return Dh(this,e)},prefault(e){return kh(this,e)},catch(e){return Nh(this,e)},pipe(e){return Fh(this,e)},readonly(){return Lh(this)},describe(e){let t=this.clone();return af.add(t,{description:e}),t},meta(...e){if(e.length===0)return af.get(this);let t=this.clone();return af.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return hc(this,`~standard`,{...su(this),jsonSchema:{input:Sp(this,`input`),output:Sp(this,`output`)}})},set"~standard"(e){mc(this,`~standard`,e)},parse:function e(t,n){return um(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await dm(this,t,n,{callee:e})},safeParse(e,t){return fm(this,e,t)},async safeParseAsync(e,t){return pm(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){mc(this,`spa`,e)},validate(e,t){return Xc(this,e,t)},validateAsync(e,t){return Qc(this,e,t)},encode:function e(t,n){return mm(this,t,n,{callee:e})},decode:function e(t,n){return hm(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await gm(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await _m(this,t,n,{callee:e})},safeEncode(e,t){return vm(this,e,t)},safeDecode(e,t){return ym(this,e,t)},async safeEncodeAsync(e,t){return bm(this,e,t)},async safeDecodeAsync(e,t){return xm(this,e,t)},toJSONSchema(e){return xp(this,{})(e)},get description(){return af.get(this)?.description},get _def(){return this._zod.def}}),wm=U(`_ZodString`,(e,t)=>{cu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rp(e,t,n,r)},gc({format:e=>Pp(e).format??null,minLength:e=>Pp(e).minimum??null,maxLength:e=>Pp(e).maximum??null},{regex(...e){return this.check(qf(...e))},includes(...e){return this.check(Xf(...e))},startsWith(...e){return this.check(Zf(...e))},endsWith(...e){return this.check(Qf(...e))},min(...e){return this.check(Gf(...e))},max(...e){return this.check(Wf(...e))},length(...e){return this.check(Kf(...e))},nonempty(...e){return this.check(Gf(1,...e))},lowercase(e){return this.check(Jf(e))},uppercase(e){return this.check(Yf(e))},trim(){return this.check(tp())},normalize(...e){return this.check(ep(...e))},toLowerCase(){return this.check(np())},toUpperCase(){return this.check(rp())},slugify(){return this.check(ip())}})),Tm=U(`ZodString`,(e,t)=>{cu.init(e,t),wm.init(e,t)},{email(e){return this.check(cf(jm,e))},url(e){return this.check(mf(Pm,e))},jwt(e){return this.check(kf(Ym,e))},emoji(e){return this.check(hf(Fm,e))},guid(e){return this.check(lf(Mm,e))},uuid(e){return this.check(uf(Nm,e))},uuidv4(e){return this.check(df(Nm,e))},uuidv6(e){return this.check(ff(Nm,e))},uuidv7(e){return this.check(pf(Nm,e))},nanoid(e){return this.check(gf(Im,e))},cuid(e){return this.check(_f(Lm,e))},cuid2(e){return this.check(vf(Rm,e))},ulid(e){return this.check(yf(zm,e))},base64(e){return this.check(Ef(Km,e))},base64url(e){return this.check(Df(qm,e))},xid(e){return this.check(bf(Bm,e))},ksuid(e){return this.check(xf(Vm,e))},ipv4(e){return this.check(Sf(Hm,e))},ipv6(e){return this.check(Cf(Um,e))},cidrv4(e){return this.check(wf(Wm,e))},cidrv6(e){return this.check(Tf(Gm,e))},e164(e){return this.check(Of(Jm,e))},datetime(e){return this.check(Af(Dm,e))},date(e){return this.check(jf(Om,e))},time(e){return this.check(Mf(km,e))},duration(e){return this.check(Nf(Am,e))}});function Em(e){return sf(Tm,e)}var Y=U(`ZodStringFormat`,(e,t)=>{G.init(e,t),wm.init(e,t)}),Dm=U(`ZodISODateTime`,(e,t)=>{Du.init(e,t),Y.init(e,t)}),Om=U(`ZodISODate`,(e,t)=>{Ou.init(e,t),Y.init(e,t)}),km=U(`ZodISOTime`,(e,t)=>{ku.init(e,t),Y.init(e,t)}),Am=U(`ZodISODuration`,(e,t)=>{Au.init(e,t),Y.init(e,t)}),jm=U(`ZodEmail`,(e,t)=>{du.init(e,t),Y.init(e,t)}),Mm=U(`ZodGUID`,(e,t)=>{lu.init(e,t),Y.init(e,t)}),Nm=U(`ZodUUID`,(e,t)=>{uu.init(e,t),Y.init(e,t)}),Pm=U(`ZodURL`,(e,t)=>{yu.init(e,t),Y.init(e,t)}),Fm=U(`ZodEmoji`,(e,t)=>{bu.init(e,t),Y.init(e,t)}),Im=U(`ZodNanoID`,(e,t)=>{xu.init(e,t),Y.init(e,t)}),Lm=U(`ZodCUID`,(e,t)=>{Su.init(e,t),Y.init(e,t)}),Rm=U(`ZodCUID2`,(e,t)=>{Cu.init(e,t),Y.init(e,t)}),zm=U(`ZodULID`,(e,t)=>{wu.init(e,t),Y.init(e,t)}),Bm=U(`ZodXID`,(e,t)=>{Tu.init(e,t),Y.init(e,t)}),Vm=U(`ZodKSUID`,(e,t)=>{Eu.init(e,t),Y.init(e,t)}),Hm=U(`ZodIPv4`,(e,t)=>{ju.init(e,t),Y.init(e,t)}),Um=U(`ZodIPv6`,(e,t)=>{Pu.init(e,t),Y.init(e,t)}),Wm=U(`ZodCIDRv4`,(e,t)=>{Fu.init(e,t),Y.init(e,t)}),Gm=U(`ZodCIDRv6`,(e,t)=>{Lu.init(e,t),Y.init(e,t)}),Km=U(`ZodBase64`,(e,t)=>{Bu.init(e,t),Y.init(e,t)}),qm=U(`ZodBase64URL`,(e,t)=>{Uu.init(e,t),Y.init(e,t)}),Jm=U(`ZodE164`,(e,t)=>{Wu.init(e,t),Y.init(e,t)}),Ym=U(`ZodJWT`,(e,t)=>{Ku.init(e,t),Y.init(e,t)}),Xm=U(`ZodNumber`,(e,t)=>{qu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zp(e,t,n,r),e.isFinite=!0},gc({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Pp(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Pp(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Pp(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Pp(e).format??null},{gt(e,t){return this.check(Vf(e,t))},gte(e,t){return this.check(Hf(e,t))},min(e,t){return this.check(Hf(e,t))},lt(e,t){return this.check(zf(e,t))},lte(e,t){return this.check(Bf(e,t))},max(e,t){return this.check(Bf(e,t))},int(e){return this.check($m(e))},safe(e){return this.check($m(e))},positive(e){return this.check(Vf(0,e))},nonnegative(e){return this.check(Hf(0,e))},negative(e){return this.check(zf(0,e))},nonpositive(e){return this.check(Bf(0,e))},multipleOf(e,t){return this.check(Uf(e,t))},step(e,t){return this.check(Uf(e,t))},finite(){return this}}));function Zm(e){return Pf(Xm,e)}var Qm=U(`ZodNumberFormat`,(e,t)=>{Ju.init(e,t),Xm.init(e,t)});function $m(e){return Ff(Qm,e)}var eh=U(`ZodBoolean`,(e,t)=>{Yu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bp(e,t,n,r)});function th(e){return If(eh,e)}var nh=U(`ZodUnknown`,(e,t)=>{Xu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function rh(){return Lf(nh)}var ih=U(`ZodNever`,(e,t)=>{Zu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vp(e,t,n,r)});function ah(e){return Rf(ih,e)}var oh=U(`ZodArray`,(e,t)=>{Cm(),td.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gp(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Gf(e,t))},nonempty(e){return this.check(Gf(1,e))},max(e,t){return this.check(Wf(e,t))},length(e,t){return this.check(Kf(e,t))},unwrap(){return this.element}});function sh(e,t){return ap(oh,e,t)}var ch=U(`ZodObject`,(e,t)=>{Cm(),sd.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qp(e,t,n,r),Sc(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return _h(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(js(this._zod.def,{catchall:e}))},passthrough(){return this.clone(js(this._zod.def,{catchall:rh()}))},loose(){return this.clone(js(this._zod.def,{catchall:rh()}))},strict(){return this.clone(js(this._zod.def,{catchall:ah()}))},strip(){return this.clone(js(this._zod.def,{catchall:void 0}))},extend(e){return Ys(this,e)},safeExtend(e){return Zs(this,e)},merge(e){return Qs(this,e)},pick(e){return Ks(this,e)},omit(e){return Js(this,e)},partial(...e){return $s(bh,this,e[0])},exactPartial(...e){return $s(Sh,this,e[0],`exactPartial`)},required(...e){return ec(Ah,this,e[0])}});function lh(e,t){return new ch({type:`object`,shape:e??{},...V(t)})}var uh=U(`ZodUnion`,(e,t)=>{ld.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jp(e,t,n,r),e.options=t.options});function dh(e,t){return new uh({type:`union`,options:e,...V(t)})}var fh=U(`ZodIntersection`,(e,t)=>{ud.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yp(e,t,n,r)});function ph(e,t){return new fh({type:`intersection`,left:e,right:t})}var mh=U(`ZodTuple`,(e,t)=>{Cm(),pd.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xp(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new bh({type:`optional`,innerType:e}))})}});function hh(e,t,n){let r=t instanceof W;return new mh({type:`tuple`,items:e,rest:r?t:null,...V(r?n:t)})}var gh=U(`ZodEnum`,(e,t)=>{_d.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hp(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new gh({...t,checks:[],...V(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new gh({...t,checks:[],...V(r),entries:i})}});function _h(e,t){return new gh({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...V(t)})}var vh=U(`ZodTransform`,(e,t)=>{Cm(),vd.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wp(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ac(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(fc(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(fc(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function yh(e){return new vh({type:`transform`,transform:e})}var bh=U(`ZodOptional`,(e,t)=>{bd.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>om(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xh(e){return new bh({type:`optional`,innerType:e})}var Sh=U(`ZodExactOptional`,(e,t)=>{xd.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>om(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ch(e){return new Sh({type:`optional`,innerType:e})}var wh=U(`ZodNullable`,(e,t)=>{Sd.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Th(e){return new wh({type:`nullable`,innerType:e})}var Eh=U(`ZodDefault`,(e,t)=>{Cd.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tm(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Dh(e,t){return new Eh({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rs(t)}})}var Oh=U(`ZodPrefault`,(e,t)=>{Td.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nm(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kh(e,t){return new Oh({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rs(t)}})}var Ah=U(`ZodNonOptional`,(e,t)=>{Ed.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jh(e,t){return new Ah({type:`nonoptional`,innerType:e,...V(t)})}var Mh=U(`ZodCatch`,(e,t)=>{kd.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rm(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Nh(e,t){return new Mh({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:wc(t)})}var Ph=U(`ZodPipe`,(e,t)=>{Ad.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>im(e,t,n,r),e.in=t.in,e.out=t.out});function Fh(e,t){return new Ph({type:`pipe`,in:e,out:t})}var Ih=U(`ZodReadonly`,(e,t)=>{Md.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>am(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lh(e){return new Ih({type:`readonly`,innerType:e})}var Rh=U(`ZodCustom`,(e,t)=>{Pd.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Up(e,t,n,r)});function zh(e,t={}){return op(Rh,e,t)}function Bh(e,t){return sp(e,t)}var Vh=.25,Hh=Zm().finite(),Uh=Zm().finite().positive(),Wh=hh([Hh,Hh]),Gh=lh({number:Em().regex(/^[1-9][0-9]*$/,`pad numbers are pin numbers: digits, starting at 1`),shape:_h([`rect`,`roundrect`,`circle`,`oval`]),x:Hh,y:Hh,width:Uh,height:Uh,rotation:Hh.optional(),layers:_h([`top`,`through`]).optional(),drill:dh([Uh,lh({width:Uh,height:Uh}).strict()]).optional()}).strict(),Kh=e=>lh({pads:sh(Gh).min(1),courtyard:sh(e).min(3).optional(),silkscreen:sh(sh(e).min(2)).optional(),body:sh(e).min(3).optional(),placeholder:th().optional()}).strict(),qh=Kh(Wh);Kh(sh(Hh).length(2));function Jh(e,t){let n=t=>({error:`${e}: ${t}`}),r;try{r=hs(t)}catch(e){return n(`not valid YAML (${e.message.split(`
|
|
160
|
+
`)[0]})`)}let i=qh.safeParse($h(r));if(!i.success)return n(i.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`; `));let a=Yh(i.data);return a.length>0?n(a.join(`; `)):Xh(e,i.data)}function Yh(e){let t=[];for(let[n,r]of e.pads.entries()){let e=`pad ${r.number} (entry ${n+1})`,i=r.layers===`through`;i&&r.drill===void 0&&t.push(`${e} is a through pad and needs a drill`),!i&&r.drill!==void 0&&t.push(`${e} is a top pad and must not have a drill`)}return t}function Xh(e,t){let n=t.pads.map(Zh),r=([e,t])=>({x:e,y:t});return{name:e,pads:n,courtyard:t.courtyard?t.courtyard.map(r):Qh(n,Vh),silkscreen:(t.silkscreen??[]).map(e=>e.map(r)),fabrication:t.body?[(e=>[...e,...e[0]?[e[0]]:[]])(t.body.map(r))]:[],origin:`copperflow footprint file ${e}`,...t.placeholder?{placeholder:!0}:{}}}function Zh(e){let t=typeof e.drill==`number`?{width:e.drill,height:e.drill}:e.drill;return{number:e.number,shape:e.shape,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation??0,layers:e.layers??`top`,...t?{drill:{...t}}:{}}}function Qh(e,t,n=[]){let r=n.map(e=>e.x),i=n.map(e=>e.y);for(let t of e){let e=t.rotation*Math.PI/180,n=(Math.abs(t.width*Math.cos(e))+Math.abs(t.height*Math.sin(e)))/2,a=(Math.abs(t.width*Math.sin(e))+Math.abs(t.height*Math.cos(e)))/2;r.push(t.x-n,t.x+n),i.push(t.y-a,t.y+a)}let a=Math.min(...r)-t,o=Math.max(...r)+t,s=Math.min(...i)-t,c=Math.max(...i)+t;return[{x:a,y:s},{x:o,y:s},{x:o,y:c},{x:a,y:c}]}function $h(e){if(typeof e!=`object`||!e||!Array.isArray(e.pads))return e;let t=e.pads.map(e=>typeof e==`object`&&e&&Number.isInteger(e.number)?{...e,number:String(e.number)}:e);return{...e,pads:t}}var eg=[{side:4,pad:{x:1.5,y:3.6},centre:1.6},{side:5,pad:{x:1.8,y:4.4},centre:2},{side:6,pad:{x:2,y:5.4},centre:2.4},{side:8,pad:{x:2.6,y:6},centre:3.2},{side:10,pad:{x:3.2,y:7},centre:4},{side:12,pad:{x:3.6,y:5.5},centre:5}],tg=eg.map(e=>`${e.side}x${e.side}`).join(`, `);function ng(e){if(e.kind!==`ind`)return;let t=e.suffix===void 0&&e.variant===void 0&&e.size===void 0&&e.pairs===void 0&&Object.keys(e.params).length===0,n=eg.find(t=>String(t.side)===e.code&&String(t.side)===e.cross);if(!t||!n)return A(`known shielded power inductor sizes are ${tg}`);let r=en(n.centre,n.pad.x,n.pad.y),i={x:n.side/2,y:n.side/2},a=O(i);return{name:`ind${n.side}x${n.side}`,pads:r,courtyard:D(r,i,Ut),silkscreen:Zt(a,r),fabrication:[a],origin:`Shielded power inductor ${n.side} × ${n.side} mm: fixed land pattern, typical, not from one maker's drawing`}}var rg=[`chips 01005 0201 0402 0603 0805 1206 1210 1812 2010 2220 2512`,`sod123 sod123f sod323 sod523 sod923 sod128, minimelf (sod80, do213aa), melf (do213ab)`,`sma smb smc (do214ac do214aa do214ab)`,`sot23 sot23_5 sot23_6 sot23_8 sot143 sot223 sot89`,`sot323 sot353 sot363 (sc70 sc70_5 sc70_6) sot523 sot563 sot723`,`tant_a … tant_e (tant3216 tant3528 tant6032 tant7343)`,...vn.reduce((e,{form:t,pins:n})=>{let r=e.find(e=>e.form===t);return r?r.pins.push(...n):e.push({form:t,pins:[...n]}),e},[]).map(({form:e,pins:t})=>`${e} (N ${ig(t.sort((e,t)=>e-t))})`),`soic8_ep<w>x<h> msop8_ep<w>x<h> msop10_ep<w>x<h> tssop<N>_ep<w>x<h>`,`array4x0603 array4x0402 array2x0402`,`dpak d2pak d2pak_5 d2pak_7 (to252 to263 to263_5 to263_7)`,`qfp32 qfp48 qfp64 qfp100, qfp<N>_<b>x<b>_p<pitch> (lqfp, tqfp)`,`qfn16 qfn32 qfn48 with _ep, qfn<N>_<b>x<b>_p<pitch>[_ep<size>]`,`dfn<N>_<a>x<b>_p<pitch>`,`bga<N>_<x>x<y>_p<pitch>`,`plcc<N> (N 20, 28, 32, 44, 52, 68, 84)`,`smdip<N> (N 4, 6, 8, 16)`,`dip<N>[_w<spacing>]`,`to220 to220_2 to220_5 to247 to126 to92`,`axial<length>x<spacing>[_d<diameter>] do35 do41 do15 do201ad`,`led3mm led5mm led3528 led5050 led5050_6`,`radial<can>x<spacing>`,`smdcan<can>x<height> (4x5.4 5x5.4 6.3x5.4 6.3x7.7 8x6.5 8x10.2 10x10.2)`,`xtal2016 xtal2520 xtal3225 xtal5032 xtal5032_2 xtal3215 xtal7050 hc49smd hc49 hc49s`,`pinrow<N>[_p<pitch>] pinrow2x<N>`,`socket<N> socket2x<N>`,`screw<N>[_p3.5|3.81|5|5.08] (N 2–24)`,`resonator3213 usb_b usb_c16 dcjack (dcjack2.1 dcjack2.5) tact6x6 tact6x6_smd`,`ind<a>x<a> (4x4 5x5 6x6 8x8 10x10 12x12)`].join(`; `);function ig(e){return e.length>2&&e.every((t,n)=>n===0||t-(e[n-1]??0)===2)?`even ${e[0]}–${e[e.length-1]}`:e.join(`, `)}var ag=[`01005`,`0201`,`0402`,`0603`,`0805`,`1206`,`1210`,`1812`,`2010`,`2220`,`2512`],og=(e,t,n)=>Array.from({length:Math.floor((t-e)/n)+1},(t,r)=>e+r*n),sg=[...ag,`sod123`,`sod123f`,`sod323`,`sod523`,`sod923`,`sod128`,`sod80`,`minimelf`,`melf`,`sot23`,`sot143`,`sot223`,`sot89`,`sot323`,`sot353`,`sot363`,`sot523`,`sot563`,`sot723`,`sc70`,`do214ac`,`do214aa`,`do214ab`,`do213aa`,`do213ab`,`do35`,`do41`,`do15`,`do201ad`,...[`a`,`b`,`c`,`d`,`e`].map(e=>`tant_${e}`),`tant3216`,`tant3528`,`tant6032`,`tant7343`,...vn.flatMap(({form:e,pins:t})=>t.map(t=>e.replace(`<N>`,String(t)))),`array4x0603`,`array4x0402`,`array2x0402`,`dpak`,`d2pak`,`to252`,`to263`,...[`qfp`,`lqfp`,`tqfp`].flatMap(e=>[32,48,64,100].map(t=>`${e}${t}`)),...[16,32,48].map(e=>`qfn${e}`),...[20,28,32,44,52,68,84].map(e=>`plcc${e}`),...[4,6,8,16].map(e=>`smdip${e}`),...og(4,64,2).map(e=>`dip${e}`),`to220`,`to220_2`,`to220_5`,`to247`,`to126`,`to92`,`hc49`,`hc49s`,`hc49smd`,`led3mm`,`led5mm`,`led3528`,`led5050`,...[`4x5.4`,`5x5.4`,`6.3x5.4`,`6.3x7.7`,`8x6.5`,`8x10.2`,`10x10.2`].map(e=>`smdcan${e}`),`xtal2016`,`xtal2520`,`xtal3225`,`xtal5032`,`xtal3215`,`xtal7050`,...og(1,40,1).map(e=>`pinrow${e}`),...og(1,40,1).map(e=>`socket${e}`),`socket2x5`,...og(2,24,1).map(e=>`screw${e}`),`resonator3213`,`dcjack2.1`,`dcjack2.5`,`tact6x6`,...[4,5,6,8,10,12].map(e=>`ind${e}x${e}`)],cg=3,lg=3;function ug(e){let t=e.suffix??``,n=Number(e.cross??0),r=Object.keys(e.params),i=e.code===``&&r.length===1&&r[0]?.length===1?r[0]:void 0;return i===void 0?{kind:e.kind,number:Number(e.code||0),cross:n,suffix:t}:{kind:`${e.kind}_`,number:i.charCodeAt(0)-96,cross:n,suffix:t}}var dg=sg.flatMap(t=>{let n=e(t);return n?[{text:t,...ug(n)}]:[]});function fg(t){let n=e(t);if(!n)return[];let r=ug(n),i=e=>(e.suffix===r.suffix?0:lg)+Math.abs(e.number-r.number)+Math.abs(e.cross-r.cross);return dg.filter(e=>e.kind===r.kind).sort((e,t)=>i(e)-i(t)||e.number-t.number||e.cross-t.cross||e.text.localeCompare(t.text)).slice(0,cg).sort((e,t)=>e.number-t.number||e.cross-t.cross||e.text.localeCompare(t.text)).map(e=>e.text)}function pg(e){let t=fg(e);return`copperflow cannot make footprint "${e}":${t.length>0?` nearest are ${t.join(`, `)};`:``} known families are ${rg} (see the skill's parts library reference)`}var mg={x:1.75,y:1.4},hg={x:2.5,y:2.5},gg={x:1,y:1.6},_g=2.4;function vg(){let e=en(1.55,1.2,2.4);return{name:`led3528`,pads:e,courtyard:D(e,mg,Ut),silkscreen:[...Zt(O(mg),e),ce(e,mg)],fabrication:[O(mg)],origin:`Surface-mount PLCC-2 LED 3.5 × 2.8 mm (pad 1 anode): fixed land pattern, typical, not from one maker's drawing`}}function yg(e,t){let n=$t(t,_g,gg.x,gg.y),r=O(hg);return{name:e,pads:n,courtyard:D(n,hg,Ut),silkscreen:[...Zt(r,n),Qt(n,n[0])],fabrication:[r],origin:`Surface-mount PLCC-${n.length} LED 5.0 × 5.0 mm: fixed land pattern, typical, not from one maker's drawing`}}function bg(e){if(e.kind===`led`){if(e.code===`3528`&&qt(e))return vg();if(e.code===`5050`)return qt(e)?yg(`led5050`,[-1.65,1.65]):e.variant===`6`&&e.cross===void 0&&e.suffix===void 0&&e.size===void 0&&Object.keys(e.params).length===0?yg(`led5050_6`,[-1.6,0,1.6]):void 0}}var xg=2.54,Sg=M(.45,.55),Cg=new Map([[`3`,{lens:3,flange:3.8,flat:.3}],[`5`,{lens:5,flange:5.8,flat:.5}]]);function wg(e){let t=e.flange/2,n=t-e.flat,r=Math.acos(n/t)*180/Math.PI,i=pe({x:0,y:0},t,r,360-r,5);return[...i,i[0]]}function Tg(e){let t=e.cross===void 0&&e.variant===void 0&&e.size===void 0&&e.pairs===void 0,n=e.kind===`led`&&e.suffix===`mm`&&t&&Object.keys(e.params).length===0?Cg.get(e.code):void 0;if(!n)return;let r=Be(ze(Sg,Sg)),i=[P(`1`,-2.54/2,0,r,!0),P(`2`,xg/2,0,r)],a=wg(n),o=n.flange/2;return{name:`led${n.lens}mm`,pads:i,courtyard:D(i,{x:o,y:o},Re),silkscreen:Zt(a,i),fabrication:[a],origin:`Through-hole, ${n.lens} mm round LED, leads 2.54 mm apart (pad 1 anode, flat at the cathode): ${r.drill} mm holes, ${r.pad} mm lands (IPC-2222 level B); body typical`}}var Eg=(e,t)=>({min:e,max:t}),Dg={label:`MiniMELF (SOD-80, DO-213AA)`,length:Eg(3.3,3.7),diameter:Eg(1.4,1.6),cap:Eg(.25,.55)},Og={label:`MELF (DO-213AB)`,length:Eg(4.8,5.2),diameter:Eg(2.4,2.6),cap:Eg(.45,.65)},kg=Object.freeze({goals:Object.freeze({toe:.4,heel:.2,side:.1}),roundOff:.05,courtyardExcess:.25}),Ag=new Map([[`minimelf`,Dg],[`sod80`,Dg],[`do213aa`,Dg],[`melf`,Og],[`do213ab`,Og]]);function jg(e){if(!(e.variant!==void 0||e.cross!==void 0||e.size!==void 0||e.pairs!==void 0||Object.keys(e.params).length>0))return`${e.kind}${e.code}${e.suffix??``}`}function Mg(e){let t=jg(e),r=t===void 0?void 0:Ag.get(t);if(!t||!r)return;let a=x(n({span:r.length,terminal:r.cap,width:r.diameter},kg.goals,i),kg.roundOff),o={x:r.length.max/2,y:r.diameter.max/2};return{name:t,pads:a,courtyard:D(a,o,kg),silkscreen:[...se(a,o),ce(a,o)],fabrication:k(o),origin:`IPC-7351B nominal, ${r.label}`}}var X=(e,t)=>({min:e,max:t}),Ng={label:`DO-214AC (SMA)`,span:X(4.93,5.28),terminal:X(.76,1.52),leadWidth:X(1.25,1.65),bodyLength:X(3.99,4.5),bodyWidth:X(2.54,2.79)},Pg={label:`DO-214AA (SMB)`,span:X(5.21,5.59),terminal:X(.76,1.52),leadWidth:X(1.95,2.2),bodyLength:X(4.06,4.57),bodyWidth:X(3.3,3.94)},Fg={label:`DO-214AB (SMC)`,span:X(7.75,8.13),terminal:X(.76,1.52),leadWidth:X(2.9,3.2),bodyLength:X(6.6,7.11),bodyWidth:X(5.59,6.22)},Ig=new Map([[`sma`,Ng],[`smb`,Pg],[`smc`,Fg],[`do214ac`,Ng],[`do214aa`,Pg],[`do214ab`,Fg]]);function Lg(e){if(!(e.variant!==void 0||e.cross!==void 0||e.size!==void 0||e.pairs!==void 0||Object.keys(e.params).length>0))return`${e.kind}${e.code}${e.suffix??``}`}function Rg(e){if(e.kind===`do`&&e.code===`214`&&!Ig.has(`do214${e.suffix??``}`))return A(`do214 needs a suffix: do214ac, do214aa or do214ab`);let t=Lg(e),r=t===void 0?void 0:Ig.get(t);if(!t||!r)return;let a=x(n({span:r.span,terminal:r.terminal,width:r.leadWidth},f.goals,i),f.roundOff),o={x:r.bodyLength.max/2,y:r.bodyWidth.max/2};return{name:t,pads:a,courtyard:D(a,{x:r.span.max/2,y:Math.max(r.bodyWidth.max,r.leadWidth.max)/2},f),silkscreen:[...se(a,o),ce(a,o)],fabrication:k(o),origin:`IPC-7351B nominal, ${r.label}`}}var zg=1,Bg=1.7,Vg=.25,Hg=1e3,Ug=e=>String(w(e));function Wg(e,t){return`pinrow${e}_p${Ug(t)}mm`}function Gg(e,t,n=0){return{number:String(e),shape:e===1?`rect`:`circle`,x:t,y:n,width:Bg,height:Bg,rotation:0,layers:`through`,drill:{width:zg,height:zg}}}function Kg(e){if(e.kind!==`pinrow`||e.variant!==void 0||Object.keys(e.params).some(e=>e!==`p`))return;let n=e.params.p??2.54;if(n===!0||n<=Bg)return;if(e.cross!==void 0)return Xg(e,n);if(!t(e))return;let r=Number(e.code);if(!Number.isInteger(r)||r<1||r>Hg)return;let i=T(r,n).map((e,t)=>Gg(t+1,e));return{name:Wg(r,n),...qg(i),origin:`Fixed pin row, not an IPC-7351B calculation: ${Ug(n)} mm pitch, ${zg.toFixed(1)} mm drill, ${Bg.toFixed(1)} mm pads`}}function qg(e){let t=E(e),n=e=>({x:w(t.x+e),y:w(t.y+e)});return{pads:e,courtyard:ae(n(Vg)),silkscreen:[O(n(C))],fabrication:[]}}var Jg=.3,Yg=.1;function Xg(e,t){let n=e.suffix===void 0&&e.size===void 0&&e.pairs===void 0,r=Number(e.cross);if(!n)return;if(e.code!==`2`)return A(`headers have one row (pinrow<N>) or two (pinrow2x<N>)`);if(!Number.isInteger(r)||r<1||r>Hg/2)return A(`a two-row header has 1 to ${Hg/2} pins a row`);let i=T(r,t).flatMap((e,n)=>[Gg(2*n+1,e,w(t/2)),Gg(2*n+2,e,w(-t/2))]),a=qg(i),o=E(i),s=w(-(o.x+C+Jg)),c=w(t/2+Bg/2);return{name:`pinrow2x${r}_p${Ug(t)}mm`,...a,courtyard:ae({x:w(-s+Yg),y:w(o.y+Vg)}),silkscreen:[...a.silkscreen,[{x:s,y:c},{x:s,y:w(c-Bg)}]],origin:`Fixed two-row pin header, not an IPC-7351B calculation: ${Ug(t)} mm pitch, ${zg.toFixed(1)} mm drill, ${Bg.toFixed(1)} mm pads`}}var Zg=1.27,Qg=M(.33,.53),$g=M(1,1.5),e_=(e,t,n)=>{let r={leads:e/4,span:t,body:n};return{across:r,upright:r}},t_=new Map([[`20`,e_(20,M(9.78,10.03),M(8.89,9.04))],[`28`,e_(28,M(12.32,12.57),M(11.43,11.58))],[`44`,e_(44,M(17.4,17.65),M(16.51,16.66))],[`52`,e_(52,M(19.94,20.19),M(19.05,19.2))],[`68`,e_(68,M(25.02,25.27),M(24.13,24.28))],[`84`,e_(84,M(30.1,30.35),M(29.21,29.36))],[`32`,{across:{leads:7,span:M(12.32,12.57),body:M(11.35,11.51)},upright:{leads:9,span:M(14.86,15.11),body:M(13.89,14.05)}}]]),n_=Object.freeze({goals:Object.freeze({toe:.35,heel:0,side:.03}),roundOff:.05,courtyardExcess:.25});function r_(e){return b(n({span:e.span,terminal:$g,width:Qg},n_.goals,i),n_.roundOff)}function i_(e){let t=r_(e.upright),n=r_(e.across),r=T(e.across.leads,Zg),i=T(e.upright.leads,Zg),a=(e,n)=>({x:e,y:n,width:t.width,height:t.length}),o=(e,t)=>({x:e,y:t,width:n.length,height:n.width}),s=[...[...r].reverse().map(e=>a(e,t.centre)),...[...i].reverse().map(e=>o(-n.centre,e)),...r.map(e=>a(e,-t.centre)),...i.map(e=>o(n.centre,e))],c=(e.across.leads-1)/2;return[...s.slice(c),...s.slice(0,c)].map((e,t)=>S(String(t+1),e.x,e.y,e.width,e.height))}function a_(e,t){let n={x:Math.max(...e.filter(e=>e.height>e.width).map(e=>Math.abs(e.x)+e.width/2)),y:0},r=Math.max(...e.filter(e=>e.width>e.height).map(e=>Math.abs(e.y)+e.height/2)),i=w(n.x+C),a=w(r+C),o=w(Math.max(t.x,i)),s=w(Math.max(t.y,a)),c=(e,t)=>[{x:w(e*i),y:w(t*s)},{x:w(e*o),y:w(t*s)},{x:w(e*o),y:w(t*a)}],l=e[0],u=w(E(e).y+C),d=[{x:w(l.x-l.width/2),y:u},{x:w(l.x+l.width/2),y:u}];return[c(-1,1),c(1,1),c(1,-1),c(-1,-1),d]}var o_=[...t_.keys()].map(Number).sort((e,t)=>e-t);function s_(e){if(e.kind!==`plcc`)return;let n=t_.get(e.code);if(!n)return A(`a PLCC has ${o_.slice(0,-1).join(`, `)} or ${o_[o_.length-1]} pins`);if(!t(e)||e.variant!==void 0||Object.keys(e.params).length>0)return A(`a PLCC takes no variant or parameters`);let r=i_(n),i={x:n.across.body.max/2,y:n.upright.body.max/2},a={x:n.across.span.max/2,y:n.upright.span.max/2},o=e.code===`32`?`PLCC-32 (JEDEC MS-016)`:`PLCC-${e.code} (JEDEC MS-018)`;return{name:`plcc${e.code}`,pads:r,courtyard:D(r,a,n_),silkscreen:a_(r,i),fabrication:k(i),origin:`IPC-7351B nominal, ${o}, J-lead goals from general knowledge`}}var c_=(e,t,n,r,i)=>({label:`LQFP-${e}`,pitch:t,span:n,terminal:M(.45,.75),leadWidth:r,bodyAcross:i,bodyAlong:i}),l_=new Map([[`32`,c_(32,.8,M(8.85,9.15),M(.3,.4),M(6.9,7.1))],[`48`,c_(48,.5,M(8.85,9.15),M(.17,.27),M(6.9,7.1))],[`64`,c_(64,.5,M(11.85,12.15),M(.17,.27),M(9.9,10.1))],[`100`,c_(100,.5,M(15.75,16.25),M(.17,.27),M(13.9,14.1))]]),u_=(e,t,n)=>({label:`QFN-${e}`,pitch:.5,span:t,terminal:M(.3,.5),leadWidth:M(.18,.3),bodyAcross:t,bodyAlong:t,exposedPad:n}),d_=new Map([[`16`,u_(16,M(2.9,3.1),M(1.45,1.75))],[`32`,u_(32,M(4.9,5.1),M(2.95,3.25))],[`48`,u_(48,M(6.9,7.1),M(4.95,5.25))]]);function f_(e,t,n){let r=T(e/4,t),i=[...r].reverse(),a=n.centre,o=(e,t)=>({x:e,y:t,width:n.length,height:n.width}),s=(e,t)=>({x:e,y:t,width:n.width,height:n.length});return[...i.map(e=>o(-a,e)),...r.map(e=>s(e,-a)),...r.map(e=>o(a,e)),...i.map(e=>s(e,a))].map((e,t)=>S(String(t+1),e.x,e.y,e.width,e.height))}var p_=new Set([`qfn`,...new Set([`qfp`,`lqfp`,`tqfp`])]);function m_(e){if(p_.has(e.kind)&&e.variant===void 0)return e.size?__(e,e.size):h_(e)}function h_(e){let n=e.kind===`qfn`,r=n?d_.get(e.code):l_.get(e.code);if(!r||!t(e)||!Ne(e.params,r,n?[`ep`]:[]))return;let i=e.params.ep===!0&&r.exposedPad?g_(r.exposedPad):void 0;return v_(e.kind+e.code+(i?`_ep`:``),Number(e.code),r,n,i)}var g_=e=>{let t=w((e.min+e.max)/2);return{x:t,y:t}};function __(e,t){let n=e.kind===`qfn`,r=n?`QFN`:`QFP`,i=e.params.p;if(e.cross!==void 0||e.suffix!==void 0)return;if(typeof i!=`number`)return A(`a ${r} named by its body needs its pitch, such as _p0.5`);let a=n?Qn(e.code,t,i):er(e.code,t,i);if(Ce(a))return a;let o=n?De(e,r):Ee(e)?void 0:A(`a QFP takes only _p`);return Ce(o)?o:v_(`${e.kind}${e.code}_${j(t[0])}x${j(t[1])}_p${j(i)}${o?`_ep${Te(o)}`:``}`,Number(e.code),a,n,o)}function v_(e,t,n,r,i){let{row:a,table:o}=r?Ae(n):N(n),s=f_(t,n.pitch,a),c=i?[...s,S(String(t+1),0,0,i.x,i.y)]:s,l=Oe(c,i!==void 0);if(l)return l;let u=n.bodyAcross.max/2,d=Math.max(n.span.max,n.bodyAcross.max)/2;return{name:e,pads:c,courtyard:D(c,{x:d,y:d},o),silkscreen:fe(s,{x:u,y:u}),fabrication:k({x:u,y:u}),origin:`IPC-7351B nominal, ${n.label}${i?` with exposed pad`:``}`}}var y_=[{upTo:7.99,lead:M(.4,.5)},{upTo:10,lead:M(.55,.65)},{upTo:1/0,lead:M(.75,.85)}],b_=3,x_=40,S_=.4;function C_(e){let t=w(e.y+e.height/2+C+.05+S_);return[[{x:w(e.x-S_),y:t},{x:w(e.x+S_),y:t}],[{x:w(e.x),y:w(t-S_)},{x:w(e.x),y:w(t+S_)}]]}function w_(e){let t=e.suffix===void 0&&e.size===void 0&&e.pairs===void 0&&e.variant===void 0;if(e.kind!==`radial`||!t||Object.keys(e.params).length>0)return;if(e.cross===void 0)return A(`a radial capacitor is radial<can diameter>x<lead spacing>, such as radial6.3x2.5`);let n=Number(e.code),r=Number(e.cross),i=y_.find(e=>n<=e.upTo)?.lead;if(!i||n<b_||n>x_)return A(`the can is ${b_} to ${x_} mm across`);if(r<=0||r>=n)return A(`the leads must be closer together than the ${j(n)} mm can is wide`);let a=Be(ze(i));if(r-a.pad<.1)return A(`${a.pad} mm lands ${j(r)} mm apart would touch`);let o=[P(`1`,w(-r/2),0,a,!0),P(`2`,w(r/2),0,a)],s=n/2,c=Math.max(s,r/2+a.pad*Math.SQRT2/2+C);return{name:`radial${j(n)}x${j(r)}`,pads:o,courtyard:D(o,{x:c,y:c},Re),silkscreen:[pe({x:0,y:0},c,0,360,5),...C_(o[0])],fabrication:[pe({x:0,y:0},s,0,360,5)],origin:`Through-hole, radial electrolytic ${j(n)} mm can, leads ${j(r)} mm apart: ${a.drill} mm holes, ${a.pad} mm lands (IPC-2222 level B)`}}var T_=1.2,E_={x:.4,y:1.9},D_={x:1.6,y:.65};function O_(e){if(e.kind!==`resonator`)return;if(e.code!==`3213`||!qt(e))return A(`the ceramic resonator is resonator3213`);let t=[-1.2,0,T_].map((e,t)=>S(String(t+1),e,0,E_.x,E_.y)),n=O(D_);return{name:`resonator3213`,pads:t,courtyard:D(t,D_,Ut),silkscreen:[...Zt(n,t),Qt(t,t[0])],fabrication:[n],origin:`Surface-mount 3.2 × 1.3 mm three-terminal ceramic resonator: fixed land pattern, typical, not from one maker's drawing`}}var k_=[3.5,3.81,5,5.08],A_=5.08,j_=M(.95,1.05),M_=2,N_=24,P_=9,F_=7,I_=5,L_=.3,R_=.1;function z_(e){let t=e.cross===void 0&&e.suffix===void 0&&e.variant===void 0&&e.size===void 0&&e.pairs===void 0;if(e.kind!==`screw`||!t||Object.keys(e.params).some(e=>e!==`p`))return;let n=Number(e.code),r=e.params.p??A_;if(e.code===``||!Number.isInteger(n)||n<M_||n>N_)return A(`a screw terminal block has ${M_} to ${N_} poles: screw<N>, such as screw2`);if(r===!0||!k_.includes(r))return A(`screw terminal blocks come at ${k_.join(`, `)} mm pitch`);let i=Be(ze(j_,j_)),a=T(n,r).map((e,t)=>P(String(t+1),e,0,i,t===0)),o={x:w(n*r/2),y:(r>=I_?P_:F_)/2},s=w(-(o.y+L_));return{name:`screw${n}_p${j(r)}mm`,pads:a,courtyard:D(a,{x:o.x,y:o.y+L_+R_},Re),silkscreen:[O(o),_e(a[0],s)],fabrication:[O(o)],origin:`Through-hole screw terminal block, ${n} poles at ${j(r)} mm, 1 mm square pins: ${i.drill} mm holes, ${i.pad} mm lands (IPC-2222 level B); body typical`}}var B_={label:`SOT-323 (SC-70)`,pitch:.65,span:M(2,2.2),terminal:M(.15,.45),leadWidth:M(.3,.4),bodyAcross:M(1.15,1.35),bodyAlong:M(1.8,2.2)},V_={label:`SOT-353 (SC-70-5)`,pitch:.65,span:M(2,2.25),terminal:M(.21,.46),leadWidth:M(.15,.3),bodyAcross:M(1.15,1.35),bodyAlong:M(1.85,2.25)},H_={label:`SOT-363 (SC-70-6)`,pitch:.65,span:M(2,2.2),terminal:M(.15,.45),leadWidth:M(.2,.3),bodyAcross:M(1.15,1.35),bodyAlong:M(1.8,2.2)},U_={label:`SOT-523 (SC-89)`,pitch:.5,span:M(1.5,1.7),terminal:M(.1,.3),leadWidth:M(.15,.3),bodyAcross:M(.7,.9),bodyAlong:M(1.5,1.7)},W_={...U_,label:`SOT-563`,bodyAcross:M(1.1,1.3)},G_={label:`SOT-723`,pitch:.4,span:M(1.15,1.25),terminal:M(.1,.2),leadWidth:M(.15,.25),bodyAcross:M(.75,.85),bodyAlong:M(1.15,1.25)},K_={label:`SOT-143`,pitch:.95,span:M(2.1,2.5),terminal:M(.15,.45),leadWidth:M(.38,.48),bodyAcross:M(1.2,1.4),bodyAlong:M(2.8,3)},q_=e=>({bottom:[-e,e],top:[0]}),J_=e=>({bottom:[-e,0,e],top:[e,-e]}),Y_=e=>({bottom:[-e,0,e],top:[e,0,-e]}),X_=[{name:`sot323`,pkg:B_,...q_(.65)},{name:`sot353`,pkg:V_,...J_(.65)},{name:`sot363`,pkg:H_,...Y_(.65)},{name:`sot523`,pkg:U_,...q_(.5)},{name:`sot563`,pkg:W_,...Y_(.5)},{name:`sot723`,pkg:G_,...q_(.4)},{name:`sot143`,pkg:K_,bottom:[-.75,.95],top:[.95,-.95],wideFirst:M(.76,.89)}],Z_=new Map([...X_.map(e=>[e.name,e]),[`sc70`,X_[0]],[`sc70_5`,X_[1]],[`sc70_6`,X_[2]]]);function Q_(e){if(t(e))return`${e.kind}${e.code}${e.variant===void 0?``:`_${e.variant}`}`}function $_(e){let{row:t}=N(e.pkg),n=e.wideFirst?N({...e.pkg,leadWidth:e.wideFirst}).row.width:t.width,r=e.bottom.map((e,r)=>S(String(r+1),w(e),-t.centre,r===0?n:t.width,t.length)),i=e.bottom.length+1,a=e.top.map((e,n)=>S(String(i+n),w(e),t.centre,t.width,t.length));return[...r,...a]}function ev(e){let t=Q_(e),n=t===void 0?void 0:Z_.get(t);if(!t||!n||!Ne(e.params,n.pkg))return;let{pkg:r}=n,{table:i}=N(r),a=$_(n),o={x:r.bodyAlong.max/2,y:r.bodyAcross.max/2},s=Math.max(...a.map(e=>Math.abs(e.x)+e.width/2));return{name:t,pads:a,courtyard:D(a,{x:Math.max(o.x,s),y:r.span.max/2},i),silkscreen:ue(a,o),fabrication:k(o),origin:`IPC-7351B nominal, ${r.label}`}}var tv=[{diameter:4,height:5.4,across:1.6,along:2.6,gap:1},{diameter:5,height:5.4,across:1.6,along:3,gap:1.4},{diameter:6.3,height:5.4,across:1.6,along:3.5,gap:1.9},{diameter:6.3,height:7.7,across:1.6,along:3.5,gap:1.9},{diameter:8,height:6.5,across:2.5,along:4,gap:2.1},{diameter:8,height:10.2,across:2.5,along:3.5,gap:3},{diameter:10,height:10.2,across:2.5,along:4,gap:4}],nv=.3,rv=.25,iv=.4,av=.05,ov=e=>`${j(e.diameter)}x${j(e.height)}`;function sv(e,t){return[{x:w(-e+t),y:-e},{x:e,y:-e},{x:e,y:e},{x:w(-e+t),y:e},{x:-e,y:w(e-t)},{x:-e,y:w(-e+t)},{x:w(-e+t),y:-e}]}function cv(e){let t=w(e.y+e.height/2+C+av+iv);return[[{x:w(e.x-iv),y:t},{x:w(e.x+iv),y:t}],[{x:e.x,y:w(t-iv)},{x:e.x,y:w(t+iv)}]]}function lv(e){let t=e.suffix===void 0&&e.variant===void 0&&e.size===void 0&&e.pairs===void 0;if(e.kind!==`smdcan`||!t||Object.keys(e.params).length>0)return;let n=tv.find(t=>t.diameter===Number(e.code)&&t.height===Number(e.cross));if(e.cross===void 0||!n)return A(`known surface-mount can sizes are ${tv.map(ov).join(`, `)}`);let r=en(w((n.gap+n.along)/2),n.along,n.across),i=w(n.diameter/2+nv/2),a=sv(i,w(n.diameter*rv)),o=cv(r[0]),s=o[1][1];return{name:`smdcan${ov(n)}`,pads:r,courtyard:D(r,{x:i,y:Math.max(i,s.y)},Ut),silkscreen:[...Zt(a,r),...o],fabrication:[a,pe({x:0,y:0},n.diameter/2,0,360,5)],origin:`Surface-mount aluminium electrolytic, ${j(n.diameter)} mm can ${j(n.height)} mm high: lands from Nichicon CAT.8100N recommended land size; base typical`}}var uv=2.54,dv=M(9.4,10.16),fv=M(.76,1.27),pv=M(.4,.6),mv=M(6.35,6.6),hv=new Map([[`4`,M(4.4,4.8)],[`6`,M(7,7.4)],[`8`,M(9.4,9.9)],[`16`,M(19.8,20.3)]]);function gv(e,t){return{label:`SMD DIP-${e}`,pitch:uv,span:dv,terminal:fv,leadWidth:pv,bodyAcross:mv,bodyAlong:t}}function _v(e,t){let{row:n}=N(t),r=T(e/2,t.pitch),i=[...r].reverse().map((e,t)=>S(String(t+1),-n.centre,e,n.length,n.width)),a=r.map((t,r)=>S(String(e/2+r+1),n.centre,t,n.length,n.width));return[...i,...a]}var vv=[...hv.keys()];function yv(e){if(e.kind!==`smdip`)return;let n=hv.get(e.code);if(!n)return A(`a surface-mount DIP has ${vv.slice(0,-1).join(`, `)} or ${vv[vv.length-1]} pins`);if(!t(e)||e.variant!==void 0||Object.keys(e.params).length>0)return A(`a surface-mount DIP takes no variant or parameters`);let r=gv(e.code,n),{table:i}=N(r),a=_v(Number(e.code),r),o={x:w(mv.max/2),y:w(n.max/2)};return{name:`smdip${e.code}`,pads:a,courtyard:D(a,{x:dv.max/2,y:o.y},i),silkscreen:le(a,o),fabrication:k(o),origin:`IPC-7351B nominal, ${r.label}`}}function bv(e){if(e.kind!==`socket`)return;if(Object.keys(e.params).length>0)return A(`pin sockets are 2.54 mm pitch only and take no parameters`);let t=Kg({...e,kind:`pinrow`});if(t===void 0)return A(`a pin socket is socket<N> or socket2x<N>, such as socket4`);if(Ce(t))return A(t.refused.replaceAll(`pinrow`,`socket`).replaceAll(`header`,`socket`));let n=e.cross===void 0?`socket${e.code}`:`socket2x${e.cross}`;return{...t,name:n,origin:t.origin.replace(/pin (row|header)/,`pin socket`)}}var Z=(e,t)=>({min:e,max:t}),xv={123:{label:`SOD-123`,span:Z(3.55,3.85),terminal:Z(.25,.4),leadWidth:Z(.52,.62),bodyLength:Z(2.55,2.85),bodyWidth:Z(1.4,1.7)},323:{label:`SOD-323`,span:Z(2.3,2.7),terminal:Z(.2,.4),leadWidth:Z(.25,.35),bodyLength:Z(1.6,1.8),bodyWidth:Z(1.2,1.4)}},Sv={523:{label:`SOD-523`,span:Z(1.55,1.65),terminal:Z(.15,.25),leadWidth:Z(.26,.34),bodyLength:Z(1.15,1.25),bodyWidth:Z(.75,.85)},923:{label:`SOD-923`,span:Z(.95,1.05),terminal:Z(.05,.15),leadWidth:Z(.15,.25),bodyLength:Z(.75,.85),bodyWidth:Z(.55,.65)},"123f":{label:`SOD-123F`,span:Z(3.4,3.8),terminal:Z(.45,.75),leadWidth:Z(.7,.9),bodyLength:Z(2.5,2.8),bodyWidth:Z(1.5,1.8)},128:{label:`SOD-128`,span:Z(4.4,5),terminal:Z(.6,1),leadWidth:Z(1.5,1.9),bodyLength:Z(3.6,4),bodyWidth:Z(2.3,2.7)}};function Cv(e){let t=e.variant===void 0&&e.cross===void 0&&e.size===void 0&&e.pairs===void 0;if(e.kind!==`sod`||!t||Object.keys(e.params).length>0)return;let n=`${e.code}${e.suffix??``}`;return Object.hasOwn(Sv,n)?Tv(n,Sv[n]):wv(n)}function wv(e){return Object.hasOwn(xv,e)?Tv(e,xv[e]):void 0}function Tv(e,t){let r={span:t.span,terminal:t.terminal,width:t.leadWidth},a=x(n(r,h(r,t.bodyLength.max),i),c.roundOff),o={x:t.bodyLength.max/2,y:t.bodyWidth.max/2},s={x:Math.max(t.span.max,t.bodyLength.max)/2,y:Math.max(t.bodyWidth.max,t.leadWidth.max)/2};return{name:`sod${e}`,pads:a,courtyard:D(a,s,c),silkscreen:[...se(a,o),ce(a,o)],fabrication:k(o),origin:`IPC-7351B nominal, ${t.label}`}}var Ev={pkg:{label:`SOT-23`,pitch:.95,span:M(2.1,2.5),terminal:M(.15,.45),leadWidth:M(.38,.48),bodyAcross:M(1.2,1.4),bodyAlong:M(2.8,3)},bottom:[-1,1],top:[0]},Dv=e=>({label:`SOT-23-${e}`,pitch:.95,span:M(2.7,3),terminal:M(.35,.55),leadWidth:M(.35,.5),bodyAcross:M(1.5,1.7),bodyAlong:M(2.9,3.1)}),Ov={label:`SOT-23-8`,pitch:.65,span:M(2.6,3),terminal:M(.3,.6),leadWidth:M(.22,.38),bodyAcross:M(1.5,1.7),bodyAlong:M(2.8,3)},kv=new Map([[void 0,Ev],[`5`,{pkg:Dv(5),bottom:[-1,0,1],top:[1,-1]}],[`6`,{pkg:Dv(6),bottom:[-1,0,1],top:[1,0,-1]}],[`8`,{pkg:Ov,bottom:[-1.5,-.5,.5,1.5],top:[1.5,.5,-.5,-1.5]}]]);function Av(e,t,n,r){let i=t=>w(t*e.pkg.pitch),a=e.bottom.map((e,a)=>S(String(a+1),i(e),-t,r,n)),o=e.bottom.length+1,s=e.top.map((e,a)=>S(String(o+a),i(e),t,r,n));return[...a,...s]}function jv(e){let n=e.kind===`sot`&&e.code===`23`?kv.get(e.variant):void 0;if(!n||!t(e)||!Ne(e.params,n.pkg))return;let{pkg:r}=n,{row:i,table:a}=N(r),o=Av(n,i.centre,i.length,i.width),s={x:r.bodyAlong.max/2,y:r.bodyAcross.max/2},c=Math.max(...[...n.bottom,...n.top].map(Math.abs))*r.pitch+r.leadWidth.max/2,l={x:Math.max(s.x,c),y:r.span.max/2};return{name:e.variant===void 0?`sot23`:`sot23_${e.variant}`,pads:o,courtyard:D(o,l,a),silkscreen:ue(o,s),fabrication:k(s),origin:`IPC-7351B nominal, ${r.label}`}}var Mv={x:3.1,y:3.1},Nv=2.25,Pv={half:3.25,hole:1},Fv={inside:6.4,over:9.5,height:1.3},Iv=.3,Lv=e=>[[-e,Nv],[e,Nv],[-e,-2.25],[e,-2.25]];function Rv(){let e=Lv(Pv.half).map(([e,t],n)=>Rt(String(n+1),e,t,Pv.hole,n===0)),t=O(Mv),n=w(Mv.y+Iv);return{name:`tact6x6`,pads:e,courtyard:D(e,{x:Mv.x,y:n},Ut),silkscreen:[...Zt(t,e),_e(e[0],n)],fabrication:[t],origin:`Tact switch 6 × 6 mm, through-hole: holes from Würth Elektronik 430186043716 recommended hole pattern; that maker's part, others may differ`}}function zv(){let e=w((Fv.over-Fv.inside)/2),t=Lv(w((Fv.inside+e)/2)).map(([t,n],r)=>S(String(r+1),t,n,e,Fv.height)),n=O(Mv);return{name:`tact6x6_smd`,pads:t,courtyard:D(t,Mv,Ut),silkscreen:[...Zt(n,t),Qt(t,t[2]).map(e=>({x:e.x,y:-e.y}))],fabrication:[n],origin:`Tact switch 6 × 6 mm, surface-mount: lands from Würth Elektronik 430182043816 recommended land pattern; that maker's part, others may differ`}}function Bv(e){if(e.kind!==`tact`)return;let t=Object.keys(e.params),n=e.code===`6`&&e.cross===`6`&&e.suffix===void 0&&e.variant===void 0&&e.size===void 0&&e.pairs===void 0;return n&&t.length===0?Rv():n&&t.length===1&&e.params.smd===!0?zv():A(`tact switches are tact6x6 (through-hole) and tact6x6_smd`)}var Vv={pkg:{label:`SOT-223`,pitch:2.3,span:M(6.7,7.3),terminal:M(.7,1.1),leadWidth:M(.6,.8),bodyAcross:M(3.3,3.7),bodyAlong:M(6.3,6.7)},tabWidth:M(2.9,3.1),tabNumber:`4`},Hv={pkg:{label:`SOT-89`,pitch:1.5,span:M(3.94,4.25),terminal:M(.89,1.2),leadWidth:M(.44,.56),bodyAcross:M(2.4,2.6),bodyAlong:M(4.4,4.6)},tabWidth:M(1.62,1.83),tabNumber:`2`,tabUnderBody:!0},Uv=new Map([[`223`,Vv],[`89`,Hv]]),Wv=.3;function Gv(e){let{row:t}=N(e.pkg),n=N({...e.pkg,leadWidth:e.tabWidth}).row,r=e.pkg.pitch,i=[-r,0,r].map((e,n)=>S(String(n+1),e,-t.centre,t.width,t.length)),a=n.centre+n.length/2,o=e.tabUnderBody?-t.centre+t.length/2+Wv:n.centre-n.length/2;return[...i,S(e.tabNumber,0,w((a+o)/2),n.width,w(a-o))]}function Kv(e,t){let n=E(e),r=w(Math.max(t.x,n.x+C)),i=w(t.y);return[[{x:-r,y:-w(n.y)},{x:-r,y:i}],[{x:r,y:-i},{x:r,y:i}]]}function qv(e){let n=e.kind===`sot`?Uv.get(e.code):void 0;if(!n||!t(e)||e.variant!==void 0||Object.keys(e.params).length>0)return;let{pkg:r}=n,{table:i}=N(r),a=Gv(n),o={x:r.bodyAlong.max/2,y:r.bodyAcross.max/2},s=r.pitch+r.leadWidth.max/2,c={x:Math.max(o.x,s,n.tabWidth.max/2),y:r.span.max/2};return{name:`sot${e.code}`,pads:a,courtyard:D(a,c,i),silkscreen:Kv(a,o),fabrication:k(o),origin:`IPC-7351B nominal, ${r.label}`}}var Jv=(e,t)=>({min:e,max:t}),Yv={label:`EIA 3216-18 (A)`,length:Jv(3,3.4),width:Jv(1.4,1.8),land:{length:1.8,width:1.23,gap:.82}},Xv={label:`EIA 3528-21 (B)`,length:Jv(3.3,3.7),width:Jv(2.6,3),land:{length:1.8,width:2.23,gap:1.12}},Zv={label:`EIA 6032-28 (C)`,length:Jv(5.7,6.3),width:Jv(2.9,3.5),land:{length:2.37,width:2.23,gap:2.57}},Qv={label:`EIA 7343-31 (D)`,length:Jv(7,7.6),width:Jv(4,4.6),land:{length:2.37,width:2.43,gap:3.87}},$v={...Qv,label:`EIA 7343-43 (E, KEMET X)`},ey=new Map([[`a`,Yv],[`b`,Xv],[`c`,Zv],[`d`,Qv],[`e`,$v]]),ty=new Map([[`3216`,Yv],[`3528`,Xv],[`6032`,Zv],[`7343`,Qv]]),ny=`tant_a … tant_e or tant3216, tant3528, tant6032, tant7343`,ry=.4;function iy(e){let t=w(e.y+e.height/2+C+.05+ry);return[[{x:w(e.x-ry),y:t},{x:w(e.x+ry),y:t}],[{x:w(e.x),y:w(t-ry)},{x:w(e.x),y:w(t+ry)}]]}function ay(e){let t=e.variant===void 0&&e.cross===void 0&&e.suffix===void 0&&e.size===void 0&&e.pairs===void 0;if(e.kind!==`tant`||!t)return;let n=Object.keys(e.params);return e.code===``?(n.length===1&&e.params[n[0]]===!0?ey.get(n[0]):void 0)??A(`a tantalum capacitor is ${ny}`):n.length===0?ty.get(e.code)??A(`the sizes are ${ny}`):void 0}function oy(e){return e.code===``?`tant_${Object.keys(e.params)[0]}`:`tant${e.code}`}function sy(e){let t=ay(e);if(!t||`refused`in t)return t;let{land:n}=t,r=w((n.gap+n.length)/2),i=[S(`1`,-r,0,n.length,n.width),S(`2`,r,0,n.length,n.width)],a={x:t.length.max/2,y:t.width.max/2},o=iy(i[0]),s=Math.max(...o.flat().map(e=>Math.abs(e.y))),c={x:a.x,y:Math.max(a.y,s)};return{name:oy(e),pads:i,courtyard:D(i,c,f),silkscreen:[...se(i,a),...o],fabrication:k(a),origin:`KEMET T491 data sheet (T2005_T491, 2026-07-08) Table 2 level B lands, moulded tantalum ${t.label}`}}var cy=2.54,ly=M(.7,.9),uy=M(.45,.6),dy=10.66,fy=-2,py=2.5,my=1.23,hy=dy/2;function gy(){let[e,t,n]=[w(hy),w(fy),w(py)];return[{x:-e,y:t},{x:e,y:t},{x:e,y:n},{x:-e,y:n},{x:-e,y:t}]}function _y(e){let n=t(e)&&e.variant===void 0&&Object.keys(e.params).length===0;if(e.kind!==`to`||e.code!==`220`||!n)return;let r=Be(ze(ly,uy)),i=T(3,cy).map((e,t)=>P(String(t+1),e,0,r,t===0)),a=[{x:-w(hy),y:w(my)},{x:w(hy),y:w(my)}];return{name:`to220`,pads:i,courtyard:D(i,{x:hy,y:Math.max(2,py)},Re),silkscreen:[gy(),a,_e(i[0],-2.3)],fabrication:[gy(),a],origin:`Through-hole, TO-220 upright: ${r.drill} mm holes, ${r.pad} mm lands (IPC-2222 level B)`}}var vy=2.54,yy=M(.36,.53),by=M(.36,.51),xy=5.21/2,Sy=-1.5850000000000004;function Cy(){let e=Math.asin(Sy/xy)*180/Math.PI;return pe({x:0,y:0},xy,e,180-e,2).concat([pe({x:0,y:0},xy,e,e)[0]])}function wy(e){let n=t(e)&&e.variant===void 0&&Object.keys(e.params).length===0;if(e.kind!==`to`||e.code!==`92`||!n)return;let r=Be(ze(yy,by)),i=[-2.54,0,vy].map((e,t)=>P(String(t+1),e,0,r,t===0)),a=Cy();return{name:`to92`,pads:i,courtyard:D(i,{x:xy,y:xy},Re),silkscreen:[...he(a,i),_e(i[0],w(-1.8850000000000005))],fabrication:[a],origin:`Through-hole, TO-92 with leads formed to 2.54 mm: ${r.drill} mm holes, ${r.pad} mm lands (IPC-2222 level B)`}}var Ty=`at 1.27 mm the straight TO-92 leads leave no room for lands that meet the design rules (0.18 mm ring, 0.2 mm copper clearance); use to92, the leads formed to 2.54 mm`;function Ey(e){let n=Object.keys(e.params).length===1&&e.params.inline===!0;if(e.kind===`to`&&e.code===`92`&&t(e)&&e.variant===void 0&&n)return A(Ty)}var Dy=.3,Oy={halfWidth:10.66/2,front:-2,back:2.5,tab:1.23,leadWidth:M(.7,.9),leadThickness:M(.45,.6)},ky={name:`to220_2`,label:`TO-220-2`,leads:2,pitch:5.08,...Oy},Ay={name:`to220_5`,label:`TO-220-5`,leads:5,pitch:1.7,...Oy,leadWidth:M(.64,.9),leadThickness:M(.4,.5),narrow:{drill:1.1,width:1.46,length:2}},jy={name:`to247`,label:`TO-247`,leads:3,pitch:5.45,leadWidth:M(1.17,1.35),leadThickness:M(.51,.71),halfWidth:15.87/2,front:-2.22,back:2.6},My={name:`to126`,label:`TO-126`,leads:3,pitch:2.29,leadWidth:M(.6,.9),leadThickness:M(.4,.6),halfWidth:7.8/2,front:-1.5,back:1.4};function Ny(e){let[t,n,r]=[w(e.halfWidth),w(e.front),w(e.back)];return[{x:-t,y:n},{x:t,y:n},{x:t,y:r},{x:-t,y:r},{x:-t,y:n}]}function Py(e,t,n,r){let i=Be(ze(n.leadWidth,n.leadThickness));if(!n.narrow)return{pad:P(e,t,0,i,r),text:`${i.drill} mm holes, ${i.pad} mm lands (IPC-2222 level B)`};let{drill:a,width:o,length:s}=n.narrow;return{pad:{...P(e,t,0,{drill:a,pad:s},r),shape:r?`rect`:`oval`,width:o},text:`${a} mm holes (below the IPC-2222 allowance), ${o} × ${s} mm oval lands`}}function Fy(e){let t=T(e.leads,e.pitch).map((t,n)=>Py(String(n+1),t,e,n===0)),n=t.map(e=>e.pad),r=e.tab===void 0?[]:[[{x:-w(e.halfWidth),y:w(e.tab)},{x:w(e.halfWidth),y:w(e.tab)}]];return{name:e.name,pads:n,courtyard:D(n,{x:e.halfWidth,y:Math.max(Dy-e.front,e.back)},Re),silkscreen:[Ny(e),...r,_e(n[0],e.front-Dy)],fabrication:[Ny(e),...r],origin:`Through-hole, ${e.label} upright: ${t[0]?.text??``}`}}var Iy=e=>t(e)&&Object.keys(e.params).length===0;function Ly(e){if(e.kind!==`to`||!Iy(e))return;if(e.code===`220`&&e.variant!==void 0)return e.variant===`2`?Fy(ky):e.variant===`5`?Fy(Ay):A(`TO-220 comes as to220 (3 leads), to220_2 or to220_5`);let t=e.code===`247`?jy:e.code===`126`?My:void 0;if(t)return e.variant===void 0?Fy(t):A(`${t.label} has three leads and takes no variant`)}var Q={body:{x:6.02,y:8.25},signalHole:.92,shellHole:2.3,pinX:1.25,shellX:6.02,shellFromFront:10.28,shellToRow:2.71,rowGap:2},$={body:{x:4.47,y:3.765},xs:[-3.2,-2.4,-1.75,-1.25,-.75,-.25,.25,.75,1.25,1.75,2.4,3.2],wide:.6,narrow:.3,length:1.15,shellX:4.32,frontFromEdge:2.62,rearAboveFront:4.18,padEndAboveFront:5.32,rear:{land:{x:1,y:2.1},hole:{x:.6,y:1.7}},front:{land:{x:1,y:1.8},hole:{x:.6,y:1.4}}};function Ry(){let e=w(-Q.body.y+Q.shellFromFront),t=e+Q.shellToRow,n=t+Q.rowGap;return[Rt(`1`,Q.pinX,n,Q.signalHole,!0),Rt(`2`,-Q.pinX,n,Q.signalHole),Rt(`3`,-Q.pinX,t,Q.signalHole),Rt(`4`,Q.pinX,t,Q.signalHole),Rt(`5`,-Q.shellX,e,Q.shellHole),Rt(`5`,Q.shellX,e,Q.shellHole)]}function zy(){let e=w(-$.body.y+$.frontFromEdge),t=w(e+$.rearAboveFront),n=w(e+$.padEndAboveFront-$.length/2),r=$.xs.map((e,t)=>S(String(t+1),e,n,Math.abs(e)>=2?$.wide:$.narrow,$.length)),i=[zt(`13`,-$.shellX,t,$.rear.land,$.rear.hole),zt(`13`,$.shellX,t,$.rear.land,$.rear.hole),zt(`13`,-$.shellX,e,$.front.land,$.front.hole),zt(`13`,$.shellX,e,$.front.land,$.front.hole)];return[...r,...i]}function By(e,t,n,r){let i=O(n);return{name:e,pads:t,courtyard:D(t,n,Ut),silkscreen:Zt(i,t),fabrication:[i,...Ht(-n.y)],origin:r}}function Vy(e){if(e.kind!==`usb`)return;let n=Object.keys(e.params),r=t(e)&&e.code===``&&e.variant===void 0&&n.length===1;return r&&e.params.b===!0?By(`usb_b`,Ry(),Q.body,`USB Type-B receptacle, through-hole, right-angle: holes from Würth Elektronik 61400416121 recommended hole pattern; that maker's part, others may differ`):r&&e.params.c===16?By(`usb_c16`,zy(),$.body,`USB Type-C receptacle, 16 pins (USB 2.0): lands from Würth Elektronik 629722000214 recommended land pattern; that maker's part, others may differ`):A(`USB receptacles are usb_b and usb_c16`)}var Hy=new Map([[`xtal3225`,{label:`3.2 × 2.5 mm crystal (Abracon ABM8 land pattern)`,body:{x:1.6,y:1.25},pad:{x:1.3,y:1.05},centre:{x:1.15,y:.875},cited:!0}],...new Map([[`xtal2016`,{label:`2.0 × 1.6 mm crystal`,body:{x:1,y:.8},pad:{x:.7,y:.6},centre:{x:.7,y:.5},cited:!1}],[`xtal2520`,{label:`2.5 × 2.0 mm crystal`,body:{x:1.25,y:1},pad:{x:.9,y:.8},centre:{x:.85,y:.65},cited:!1}],[`xtal5032`,{label:`5.0 × 3.2 mm crystal, four pads`,body:{x:2.5,y:1.6},pad:{x:1.6,y:1.4},centre:{x:1.85,y:1.1},cited:!1}],[`xtal5032_2`,{label:`5.0 × 3.2 mm crystal, two pads`,body:{x:2.5,y:1.6},pad:{x:2,y:2.4},centre:{x:1.85,y:0},cited:!1}],[`xtal3215`,{label:`3.2 × 1.5 mm 32.768 kHz crystal`,body:{x:1.6,y:.75},pad:{x:1,y:1.8},centre:{x:1.25,y:0},cited:!1}],[`xtal7050`,{label:`7.0 × 5.0 mm oscillator`,body:{x:3.5,y:2.5},pad:{x:1.8,y:2},centre:{x:2.54,y:1.4},cited:!1}],[`hc49smd`,{label:`HC-49/US SMD crystal`,body:{x:5.7,y:2.35},pad:{x:5.5,y:2},centre:{x:4.75,y:0},cited:!1}]])]);function Uy(e){if(e.kind===`hc`&&e.code===`49`&&e.suffix===`smd`)return e.cross===void 0&&e.variant===void 0&&e.size===void 0&&Object.keys(e.params).length===0?`hc49smd`:void 0;if(e.kind===`xtal`)return e.variant===`2`&&Object.keys(e.params).length===0&&e.cross===void 0&&e.suffix===void 0&&e.size===void 0?`xtal${e.code}_2`:qt(e)?`xtal${e.code}`:void 0}function Wy(e){let t=Uy(e),n=t===void 0?void 0:Hy.get(t);if(!t||!n)return;let r=n.centre.y===0?en(n.centre.x,n.pad.x,n.pad.y):$t([-n.centre.x,n.centre.x],n.centre.y,n.pad.x,n.pad.y),i=O(n.body);return{name:t,pads:r,courtyard:D(r,n.body,Ut),silkscreen:[...Zt(i,r),Qt(r,r[0])],fabrication:[i],origin:`Surface-mount ${n.label}: fixed land pattern, ${n.cited?`from the maker's recommended land pattern`:`typical, not from one maker's drawing`}`}}var Gy=e=>t(e)&&e.variant===void 0&&Object.keys(e.params).length===0,Ky=[e=>e.kind===``&&Gy(e)?Et(e.code):void 0,Cv,Mg,jv,ev,qv,Or,Rg,et,sy,Se,On,kn,yv,s_,m_,tr,xt,Kg,bv,z_,dr,_y,Ly,wy,Ey,Pt,Wy,w_,lv,Tg,bg,O_,Vy,cn,Bv,ng],qy=512,Jy=new Map,Yy=/^parts\/[A-Za-z0-9._-]+\/footprint\.yaml$/,Xy=e=>e.includes(`/`);function Zy(e,t){if(Xy(e))return eb(Qy(e,t));let n=Jy.get(e);if(n)return n;let r=eb($y(e));return Jy.size>=qy&&Jy.delete(Jy.keys().next().value),Jy.set(e,r),r}function Qy(e,t){if(!Yy.test(e)||e.split(`/`).some(e=>e.includes(`..`)))return{error:`"${e}" is not a footprint file: only parts/<id>/footprint.yaml can be read`};if(!t)return{error:`"${e}" is a footprint file and needs a way to read files`};let n=t(e);return n===void 0?{error:`${e}: footprint file not found`}:Jh(e,n)}function $y(t){let n=e(t);if(n)for(let e of Ky){let r=e(n);if(Ce(r))return{error:`copperflow cannot make footprint "${t}": ${r.refused}`};if(r)return r}return{error:pg(t)}}function eb(e){if(typeof e==`object`&&e&&!Object.isFrozen(e)){for(let t of Object.values(e))eb(t);Object.freeze(e)}return e}var tb=`Type a footprint string such as soic8, qfn32_5x5_p0.5 or hc49s.`;function nb(e,t){let n=e.trim();if(n===``)return{error:tb};if(n.includes(`/`))return{error:`"${n}" is not a footprint string`};let r=Zy(n);if(`error`in r)return{error:r.error};let i=ib([...r.courtyard,...r.silkscreen.flat(),...r.fabrication.flat(),...r.pads.flatMap(rb)]),a=Math.min((t.width-20)/Math.max(i.width,1e-6),(t.height-20)/Math.max(i.height,1e-6)),o=e=>({x:t.width/2+(e.x-i.cx)*a,y:t.height/2-(e.y-i.cy)*a}),s=r.pads.map(e=>{let t=o(e);return{number:e.number,shape:e.shape,x:t.x,y:t.y,width:e.width*a,height:e.height*a,rotation:-e.rotation,through:e.layers===`through`,...e.drill?{drill:Math.min(e.drill.width,e.drill.height)*a}:{}}}),c=ib(r.courtyard),l=r.pads.length;return{pads:s,courtyard:r.courtyard.map(o),silkscreen:r.silkscreen.map(e=>e.map(o)),body:r.fabrication.map(e=>e.map(o)),scale:a,summary:`${l} pad${l===1?``:`s`}, courtyard ${ab(c.width)} × ${ab(c.height)} mm`}}function rb(e){let[t,n]=[e.width/2,e.height/2],r=e.rotation*Math.PI/180,[i,a]=[Math.cos(r),Math.sin(r)];return[[-t,-n],[t,-n],[t,n],[-t,n]].map(([t=0,n=0])=>({x:e.x+t*i-n*a,y:e.y+t*a+n*i}))}function ib(e){let t=e.map(e=>e.x),n=e.map(e=>e.y),[r,i,a,o]=[Math.min(...t),Math.max(...t),Math.min(...n),Math.max(...n)];return{width:i-r,height:o-a,cx:(r+i)/2,cy:(a+o)/2}}var ab=e=>Number(e.toFixed(2));export{Zy as n,nb as t};
|