diff --git a/docs/dynamic-plugins/frontend-plugin-wiring.md b/docs/dynamic-plugins/frontend-plugin-wiring.md index 76bf463dd6..b5b6d15eee 100644 --- a/docs/dynamic-plugins/frontend-plugin-wiring.md +++ b/docs/dynamic-plugins/frontend-plugin-wiring.md @@ -16,7 +16,7 @@ The overall configuration is as follows: # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -38,7 +38,7 @@ Backstage offers an internal catalog of system icons available across the applic # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -83,7 +83,7 @@ In dynamic plugins this mechanism has changed and users are no longer allowed to # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -128,7 +128,7 @@ Here is an example configuration specifying a custom `SidebarItem` component: # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -151,7 +151,7 @@ Order and parent-children relationship of plugin menu items which are in main si # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -185,7 +185,7 @@ Up to 3 levels of nested menu items are supported. # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -227,7 +227,7 @@ Dynamic plugins offer similar functionality via `routeBindings` configuration: # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -306,7 +306,7 @@ Here is an example of the overall configuration structure of a mount point: # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -358,7 +358,7 @@ The context menu entry can be configured via the `props` configuration entry for # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -586,7 +586,7 @@ Out of the box the frontend system provides an opinionated set of tabs for catal # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -651,7 +651,7 @@ Users can add translation resources exported by plugin packages in the plugin's # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -667,7 +667,7 @@ Users can override default translations of a plugin with their own JSON-based tr # dynamic-plugins-config.yaml plugins: - plugin: - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: diff --git a/docs/dynamic-plugins/index.md b/docs/dynamic-plugins/index.md index 9f8819ae3f..0a4b1a97a6 100644 --- a/docs/dynamic-plugins/index.md +++ b/docs/dynamic-plugins/index.md @@ -130,9 +130,9 @@ Example of this process on the [todo](https://github.com/backstage/community-plu plugins: - package: oci://quay.io/user/backstage-community-plugin-todo:v0.1.1!backstage-community-plugin-todo - disabled: false + enabled: true - package: oci://quay.io/user/backstage-community-plugin-todo:v0.1.1!backstage-community-plugin-todo-backend-dynamic - disabled: false + enabled: true ``` Push image to container registry. @@ -152,7 +152,7 @@ Example of this process on the [todo](https://github.com/backstage/community-plu ```yaml # frontend and backend plugins for the todo plugin - package: oci://quay.io/user/backstage-community-plugin-todo:v0.1.1!backstage-community-plugin-todo - disabled: false + enabled: true pluginConfig: dynamicPlugins: frontend: @@ -165,7 +165,7 @@ Example of this process on the [todo](https://github.com/backstage/community-plu title: Todo mountPoint: entity.page.todo - package: oci://quay.io/user/backstage-community-plugin-todo:v0.1.1!backstage-community-plugin-todo-backend-dynamic - disabled: false + enabled: true ``` diff --git a/docs/dynamic-plugins/installing-plugins.md b/docs/dynamic-plugins/installing-plugins.md index 2d7c80bf8b..5fd026902b 100644 --- a/docs/dynamic-plugins/installing-plugins.md +++ b/docs/dynamic-plugins/installing-plugins.md @@ -8,7 +8,7 @@ For more information, see [Installing Dynamic Plugins with the Red Hat Developer Plugins are defined in the `plugins` array in the `dynamic-plugins.yaml` file. Each plugin is defined as an object with the following properties: - `package`: The package definition of the plugin. This can be an OCI image, `tgz` archive, npm package, or a directory path. For OCI packages ONLY, the tag or digest can be replaced by the `{{inherit}}` tag to inherit the version from an included configuration. Additionally, when using single-plugin OCI images, the plugin path can also be omitted. -- `disabled`: A boolean value that determines whether the plugin is enabled or disabled. +- `enabled`: A boolean value that determines whether the plugin is enabled (`true`) or disabled (`false`). The legacy `disabled` field is still accepted for backward compatibility; when both are present, `enabled` takes precedence. - `integrity`: The integrity hash of the package. This is required for `tgz` archives and npm packages. - `pluginConfig`: The configuration for the plugin. For backend plugins this is optional and can be used to pass configuration to the plugin. For frontend plugins this is required, see [Frontend Plugin Wiring](frontend-plugin-wiring.md) for more information on how to configure bindings and routes. This is a fragment of the `app-config.yaml` file. Anything that is added to this object will be merged into a `app-config.dynamic-plugins.yaml` file whose config can be merged with the main `app-config.yaml` config when launching RHDH. @@ -18,17 +18,17 @@ Note: Duplicate plugins found across config files in the `includes` field will t The RHDH container image is preloaded with a variety of dynamic plugin packages, the majority of which are initially disabled, as they must be configured to work. The comprehensive list of these packages can be found in the [`default.packages.yaml`](https://github.com/redhat-developer/rhdh-plugin-export-overlays/blob/main/default.packages.yaml) file. -On application start, for each disabled package, the `install-dynamic-plugins` init container within the `redhat-developer-hub` pod's will log something like: +On application start, for each plugin that is not enabled, the `install-dynamic-plugins` init container within the `redhat-developer-hub` pod's will log something like: ```console ======= Skipping disabled dynamic plugin oci://registry.access.redhat.com/rhdh/backstage-community-plugin-analytics-provider-segment ``` -To activate this plugin, simply add a package with the same name and adjust the `disabled` field. +To activate this plugin, simply add a package with the same name and set `enabled: true`. ```yaml plugins: - - disabled: false + - enabled: true package: oci://registry.access.redhat.com/rhdh/backstage-community-plugin-analytics-provider-segment:{{inherit}} ``` @@ -67,11 +67,11 @@ The catalog index OCI image should contain the following at the root level: # Contents of dynamic-plugins.default.yaml in the OCI image plugins: - package: '@backstage/plugin-catalog' - disabled: true + enabled: false pluginConfig: # ... plugin configuration - package: oci://quay.io/example/plugin:v1.0!my-plugin - disabled: true + enabled: false ``` ### Catalog Entities Extraction @@ -133,7 +133,7 @@ When defining the plugin packaged as an OCI image, use the `oci://` prefix, foll ```yaml plugins: - - disabled: false + - enabled: true package: oci://quay.io/example/image:v0.0.1!backstage-plugin-myplugin ``` @@ -143,7 +143,7 @@ For integrity check one may use [image digests](https://github.com/opencontainer ```yaml plugins: - - disabled: false + - enabled: true package: oci://quay.io/example/image@sha256:28036abec4dffc714394e4ee433f16a59493db8017795049c831be41c02eb5dc!backstage-plugin-myplugin ``` @@ -155,7 +155,7 @@ Explicit Path Usage: ```yaml plugins: - - disabled: false + - enabled: true package: oci://quay.io/example/image:v1.0.0!backstage-plugin-myplugin ``` @@ -163,7 +163,7 @@ Auto-detected Path Usage: ```yaml plugins: - - disabled: false + - enabled: true package: oci://quay.io/example/image:v1.0.0 ``` @@ -180,7 +180,7 @@ For example, if we have an included dynamic plugin file (`dynamic-plugins.exampl ```yaml # dynamic-plugins.example.yaml plugins: - - disabled: true + - enabled: false package: oci://quay.io/example/image:v0.0.2!backstage-plugin-myplugin ``` @@ -191,13 +191,13 @@ and a `dynamic-plugins.yaml` file with the `{{inherit}}` tag using configuration includes: - dynamic-plugins.example.yaml plugins: - - disabled: false + - enabled: true package: oci://quay.io/example/image:{{inherit}}!backstage-plugin-myplugin pluginConfig: exampleName: "test" ``` -The resolved version would be `v0.0.2`, but the overridden `pluginConfig` and `disabled: false` would still apply. +The resolved version would be `v0.0.2`, but the overridden `pluginConfig` and `enabled: true` would still apply. **General Notes:** @@ -214,7 +214,7 @@ For example, we can have an example plugin that uses auto-detection that will re ```yaml # dynamic-plugins.example.yaml plugins: - - disabled: true + - enabled: false package: oci://quay.io/example/image:v0.0.2 ``` @@ -225,7 +225,7 @@ Then we can just use `{{inherit}}` without a path, and we will inherit both the includes: - dynamic-plugins.example.yaml plugins: - - disabled: false + - enabled: true package: oci://quay.io/example/image:{{inherit}} pluginConfig: exampleName: "test" @@ -239,7 +239,7 @@ When defining the plugin packaged as a `tgz` archive, use the URL of the archive ```yaml plugins: - - disabled: false + - enabled: true package: https://example.com/backstage-plugin-myplugin-1.0.0.tgz integrity: sha512-9WlbgEdadJNeQxdn1973r5E4kNFvnT9GjLD627GWgrhCaxjCmxqdNW08cj+Bf47mwAtZMt1Ttyo+ZhDRDj9PoA== ``` @@ -250,7 +250,7 @@ When defining the plugin packaged as an npm package, use the package name and ve ```yaml plugins: - - disabled: false + - enabled: true package: @example/backstage-plugin-myplugin@1.0.0 integrity: sha512-9WlbgEdadJNeQxdn1973r5E4kNFvnT9GjLD627GWgrhCaxjCmxqdNW08cj+Bf47mwAtZMt1Ttyo+ZhDRDj9PoA== ``` diff --git a/docs/index.md b/docs/index.md index 4bea1bf510..9a8be077e6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -63,7 +63,7 @@ To enable or disable telemetry data collection and customize a telemetry destina To turn off the telemetry feature, you must disable the `analytics-provider-segment` plugin either using the Helm Chart or the RHDH Operator. -NOTE: If the `analytics-provider-segment` plugin is already present in your dynamic plugins configuration, set the value of the `plugins.disabled` parameter to `true` to disable telemetry, or `false` to enable it. +NOTE: If the `analytics-provider-segment` plugin is already present in your dynamic plugins configuration, set `enabled: false` to disable telemetry, or `enabled: true` to enable it. #### Using Helm Chart @@ -74,7 +74,7 @@ global: dynamic: plugins: - package: oci://registry.access.redhat.com/rhdh/backstage-community-plugin-analytics-provider-segment:{{inherit}} - disabled: true + enabled: false ``` or using the deprecated wrapper syntax: @@ -84,7 +84,7 @@ global: dynamic: plugins: - package: './dynamic-plugins/dist/backstage-community-plugin-analytics-provider-segment' - disabled: true + enabled: false ``` #### Using RHDH Operator @@ -103,7 +103,7 @@ data: - dynamic-plugins.default.yaml plugins: - package: oci://registry.access.redhat.com/rhdh/backstage-community-plugin-analytics-provider-segment:{{inherit}} - disabled: true + enabled: false ``` or using the deprecated wrapper syntax: @@ -119,7 +119,7 @@ data: - dynamic-plugins.default.yaml plugins: - package: './dynamic-plugins/dist/backstage-community-plugin-analytics-provider-segment' - disabled: true + enabled: false ``` Note that as of 1.10, the latest version of the `dynamic-plugins.default.yaml` file exists in the plugin catalog index container image, and has been removed from this repo. @@ -128,14 +128,14 @@ See previous section `Inheriting values` for how to fetch this file from the ind ### Disable Telemetry for Local Development -By default, the `analytics-provider-segment` plugin is disabled when you run your application locally without using the `dynamic-plugins.default.yaml` file. -However, if you run your application using the `dynamic-plugins.default.yaml` file, it is enabled by default. To disable the `analytics-provider-segment` plugin. follow this example: +By default, the `analytics-provider-segment` plugin is not enabled when you run your application locally without using the `dynamic-plugins.default.yaml` file. +However, if you run your application using the `dynamic-plugins.default.yaml` file, it is enabled by default. To disable the `analytics-provider-segment` plugin, follow this example: ```yaml dynamicPlugins: plugins: - package: oci://registry.access.redhat.com/rhdh/backstage-community-plugin-analytics-provider-segment:{{inherit}} - disabled: true + enabled: false ``` or, using the deprecated wrapper syntax: @@ -144,7 +144,7 @@ or, using the deprecated wrapper syntax: dynamicPlugins: plugins: - package: './dynamic-plugins/dist/backstage-community-plugin-analytics-provider-segment' - disabled: true + enabled: false ``` If using the deprecated wrapper approach, you should then delete the `dynamic-plugins-root/backstage-community-plugin-analytics-provider-segment` plugin directory, to stop the plugin from loading. @@ -161,7 +161,7 @@ To disable telemetry while running Backstage in a CI environment, set the value To turn on the telemetry feature, you must enable the `analytics-provider-segment` plugin either using the Helm Chart or the RHDH Operator. -NOTE: If the `analytics-provider-segment` plugin is already present in your dynamic plugins configuration, set the value of the `plugins.disabled` parameter to `false` to enable telemetry, or `true` to disable it. +NOTE: If the `analytics-provider-segment` plugin is already present in your dynamic plugins configuration, set `enabled: true` to enable telemetry, or `enabled: false` to disable it. #### Using Helm Chart @@ -172,7 +172,7 @@ global: dynamic: plugins: - package: oci://registry.access.redhat.com/rhdh/backstage-community-plugin-analytics-provider-segment:{{inherit}} - disabled: false + enabled: true ``` or, using the deprecated wrapper syntax: @@ -182,12 +182,12 @@ global: dynamic: plugins: - package: './dynamic-plugins/dist/backstage-community-plugin-analytics-provider-segment' - disabled: false + enabled: true ``` #### Using RHDH Operator -If you have created the `dynamic-plugins-rhdh` ConfigMap file, add the `analytics-provider-segment` plugin to the list of plugins and set the `plugins.disabled` parameter to `true` to disable telemetry, or `false` to enable it. +If you have created the `dynamic-plugins-rhdh` ConfigMap file, add the `analytics-provider-segment` plugin to the list of plugins and set `enabled: true` to enable telemetry, or `enabled: false` to disable it. If you have not created the `dynamic-plugins-rhdh` ConfigMap file, create it with the following content: @@ -202,7 +202,7 @@ data: - dynamic-plugins.default.yaml plugins: - package: oci://registry.access.redhat.com/rhdh/backstage-community-plugin-analytics-provider-segment:{{inherit}} - disabled: false + enabled: true ``` or, using the deprecated wrapper syntax: @@ -218,7 +218,7 @@ data: - dynamic-plugins.default.yaml plugins: - package: './dynamic-plugins/dist/backstage-community-plugin-analytics-provider-segment' - disabled: false + enabled: true ``` Set the value of the `dynamicPluginsConfigMapName` parameter to the name of the `ConfigMap` file in your `Backstage` custom resource: diff --git a/scripts/install-dynamic-plugins/__tests__/merger-pre-merge.test.ts b/scripts/install-dynamic-plugins/__tests__/merger-pre-merge.test.ts index 13cc3ce432..fd8ed98a38 100644 --- a/scripts/install-dynamic-plugins/__tests__/merger-pre-merge.test.ts +++ b/scripts/install-dynamic-plugins/__tests__/merger-pre-merge.test.ts @@ -171,4 +171,53 @@ describe('filterDisabledOciPlugins', () => { const out = filterDisabledOciPlugins(plugins, new Set(['oci://something/plugin'])); expect(out).toHaveLength(2); }); + + it('removes invalid OCI entries that are marked enabled: false', () => { + const plugins: PluginSpec[] = [ + { package: 'oci://bad spec', enabled: false }, + { package: 'oci://also bad' }, + ]; + const out = filterDisabledOciPlugins(plugins, new Set()); + expect(out.map(p => p.package)).toEqual(['oci://also bad']); + }); +}); + +describe('preMergeOciDisabledState — enabled field', () => { + it('enabled: false in main disables the registry', () => { + const include: PluginSpec[] = [ + { package: 'oci://registry.example.com/plugin:1.0', enabled: true }, + ]; + const main: PluginSpec[] = [ + { package: 'oci://registry.example.com/plugin:{{inherit}}', enabled: false }, + ]; + const result = preMergeOciDisabledState([['include.yaml', include]], main, 'main.yaml'); + expect(result.has('oci://registry.example.com/plugin')).toBe(true); + }); + + it('enabled: true in main re-enables a disabled include', () => { + const include: PluginSpec[] = [ + { package: 'oci://registry.example.com/plugin:1.0', enabled: false }, + ]; + const main: PluginSpec[] = [ + { package: 'oci://registry.example.com/plugin:{{inherit}}', enabled: true }, + ]; + const result = preMergeOciDisabledState([['include.yaml', include]], main, 'main.yaml'); + expect(result.has('oci://registry.example.com/plugin')).toBe(false); + }); + + it('enabled takes precedence when both enabled and disabled are set', () => { + const warn = vi.spyOn(process.stdout, 'write').mockImplementation(() => true); + try { + const main: PluginSpec[] = [ + { package: 'oci://registry.example.com/plugin:1.0', enabled: true, disabled: true }, + ]; + const result = preMergeOciDisabledState([], main, 'main.yaml'); + // enabled: true should win even though disabled: true is also set + expect(result.has('oci://registry.example.com/plugin')).toBe(false); + const out = warn.mock.calls.map(args => String(args[0])).join('\n'); + expect(out).toMatch(/both 'enabled' and 'disabled'/); + } finally { + warn.mockRestore(); + } + }); }); diff --git a/scripts/install-dynamic-plugins/__tests__/merger.test.ts b/scripts/install-dynamic-plugins/__tests__/merger.test.ts index 3932dcc970..60236413bb 100644 --- a/scripts/install-dynamic-plugins/__tests__/merger.test.ts +++ b/scripts/install-dynamic-plugins/__tests__/merger.test.ts @@ -56,6 +56,24 @@ describe('mergePlugin — NPM', () => { expect(all['pkg']?.last_modified_level).toBe(1); }); + it('overrides using the enabled field', async () => { + const all: PluginMap = {}; + await mergePlugin({ package: 'pkg@1.0.0', enabled: true }, all, 'inc.yaml', 0); + await mergePlugin({ package: 'pkg@2.0.0', enabled: false }, all, 'cfg.yaml', 1); + expect(all['pkg']?.package).toBe('pkg@2.0.0'); + expect(all['pkg']?.enabled).toBe(false); + expect(all['pkg']?.last_modified_level).toBe(1); + }); + + it('handles enabled overriding disabled from a lower level', async () => { + const all: PluginMap = {}; + await mergePlugin({ package: 'pkg@1.0.0', disabled: true }, all, 'inc.yaml', 0); + await mergePlugin({ package: 'pkg@2.0.0', enabled: true }, all, 'cfg.yaml', 1); + expect(all['pkg']?.package).toBe('pkg@2.0.0'); + expect(all['pkg']?.enabled).toBe(true); + expect(all['pkg']?.last_modified_level).toBe(1); + }); + it('raises on duplicates within the same level', async () => { const all: PluginMap = {}; await mergePlugin({ package: 'pkg@1.0.0' }, all, 'cfg.yaml', 0); diff --git a/scripts/install-dynamic-plugins/__tests__/types.test.ts b/scripts/install-dynamic-plugins/__tests__/types.test.ts index ac51fc57ab..b643a263b3 100644 --- a/scripts/install-dynamic-plugins/__tests__/types.test.ts +++ b/scripts/install-dynamic-plugins/__tests__/types.test.ts @@ -1,4 +1,4 @@ -import { parseMaxEntrySize } from '../src/types'; +import { isPluginDisabled, parseMaxEntrySize } from '../src/types'; describe('parseMaxEntrySize', () => { const DEFAULT = 40_000_000; @@ -31,3 +31,96 @@ describe('parseMaxEntrySize', () => { expect(parseMaxEntrySize('NaN')).toBe(DEFAULT); }); }); + +describe('isPluginDisabled', () => { + it('returns false when neither enabled nor disabled is set', () => { + expect(isPluginDisabled({ package: 'pkg@1.0' })).toBe(false); + }); + + it('returns false when enabled: true', () => { + expect(isPluginDisabled({ package: 'pkg@1.0', enabled: true })).toBe(false); + }); + + it('returns true when enabled: false', () => { + expect(isPluginDisabled({ package: 'pkg@1.0', enabled: false })).toBe(true); + }); + + it('returns true when disabled: true (backward compat)', () => { + expect(isPluginDisabled({ package: 'pkg@1.0', disabled: true })).toBe(true); + }); + + it('returns false when disabled: false (backward compat)', () => { + expect(isPluginDisabled({ package: 'pkg@1.0', disabled: false })).toBe(false); + }); + + it('enabled takes precedence over disabled when both set (enabled: true, disabled: true)', () => { + const warnings: string[] = []; + const result = isPluginDisabled( + { package: 'pkg@1.0', enabled: true, disabled: true }, + msg => warnings.push(msg), + ); + expect(result).toBe(false); + expect(warnings).toHaveLength(1); + expect(warnings[0]).toMatch(/both 'enabled' and 'disabled'/); + }); + + it('enabled takes precedence over disabled when both set (enabled: false, disabled: false)', () => { + const warnings: string[] = []; + const result = isPluginDisabled( + { package: 'pkg@1.0', enabled: false, disabled: false }, + msg => warnings.push(msg), + ); + expect(result).toBe(true); + expect(warnings).toHaveLength(1); + }); + + it('does not warn when no callback provided', () => { + // Should not throw even when both fields are set + expect(isPluginDisabled({ package: 'pkg@1.0', enabled: true, disabled: true })).toBe(false); + }); + + it('treats non-boolean enabled as unset', () => { + const warnings: string[] = []; + const result = isPluginDisabled( + { package: 'pkg@1.0', enabled: 'false' as unknown as boolean }, + msg => warnings.push(msg), + ); + expect(result).toBe(false); + expect(warnings).toHaveLength(1); + expect(warnings[0]).toMatch(/non-boolean 'enabled: false'/); + }); + + it('treats null enabled as unset', () => { + const warnings: string[] = []; + const result = isPluginDisabled( + { package: 'pkg@1.0', enabled: null as unknown as boolean }, + msg => warnings.push(msg), + ); + expect(result).toBe(false); + expect(warnings).toHaveLength(1); + expect(warnings[0]).toMatch(/non-boolean 'enabled: null'/); + }); + + it('treats non-boolean disabled as unset', () => { + const warnings: string[] = []; + const result = isPluginDisabled( + { package: 'pkg@1.0', disabled: 'true' as unknown as boolean }, + msg => warnings.push(msg), + ); + expect(result).toBe(false); + expect(warnings).toHaveLength(1); + expect(warnings[0]).toMatch(/non-boolean 'disabled: true'/); + }); + + it('falls back to valid disabled when enabled is non-boolean', () => { + const warnings: string[] = []; + const result = isPluginDisabled( + { package: 'pkg@1.0', enabled: 'yes' as unknown as boolean, disabled: true }, + msg => warnings.push(msg), + ); + // enabled is non-boolean so ignored; disabled: true is valid + expect(result).toBe(true); + expect(warnings).toHaveLength(1); + expect(warnings[0]).toMatch(/non-boolean 'enabled/); + }); +}); diff --git a/scripts/install-dynamic-plugins/dist/install-dynamic-plugins.cjs b/scripts/install-dynamic-plugins/dist/install-dynamic-plugins.cjs index 815dd8923d..1ae1386578 100644 --- a/scripts/install-dynamic-plugins/dist/install-dynamic-plugins.cjs +++ b/scripts/install-dynamic-plugins/dist/install-dynamic-plugins.cjs @@ -1,75 +1,75 @@ #!/usr/bin/env node -"use strict";var yd=Object.create;var gs=Object.defineProperty;var bd=Object.getOwnPropertyDescriptor;var wd=Object.getOwnPropertyNames;var Sd=Object.getPrototypeOf,vd=Object.prototype.hasOwnProperty;var y=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ed=(e,t)=>{for(var i in t)gs(e,i,{get:t[i],enumerable:!0})},wl=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of wd(t))!vd.call(e,n)&&n!==i&&gs(e,n,{get:()=>t[n],enumerable:!(s=bd(t,n))||s.enumerable});return e};var O=(e,t,i)=>(i=e!=null?yd(Sd(e)):{},wl(t||!e||!e.__esModule?gs(i,"default",{value:e,enumerable:!0}):i,e)),kd=e=>wl(gs({},"__esModule",{value:!0}),e);var I=y(J=>{"use strict";var hr=Symbol.for("yaml.alias"),Sl=Symbol.for("yaml.document"),ys=Symbol.for("yaml.map"),vl=Symbol.for("yaml.pair"),ur=Symbol.for("yaml.scalar"),bs=Symbol.for("yaml.seq"),Ne=Symbol.for("yaml.node.type"),Od=e=>!!e&&typeof e=="object"&&e[Ne]===hr,_d=e=>!!e&&typeof e=="object"&&e[Ne]===Sl,Ad=e=>!!e&&typeof e=="object"&&e[Ne]===ys,Nd=e=>!!e&&typeof e=="object"&&e[Ne]===vl,El=e=>!!e&&typeof e=="object"&&e[Ne]===ur,Rd=e=>!!e&&typeof e=="object"&&e[Ne]===bs;function kl(e){if(e&&typeof e=="object")switch(e[Ne]){case ys:case bs:return!0}return!1}function Pd(e){if(e&&typeof e=="object")switch(e[Ne]){case hr:case ys:case ur:case bs:return!0}return!1}var Id=e=>(El(e)||kl(e))&&!!e.anchor;J.ALIAS=hr;J.DOC=Sl;J.MAP=ys;J.NODE_TYPE=Ne;J.PAIR=vl;J.SCALAR=ur;J.SEQ=bs;J.hasAnchor=Id;J.isAlias=Od;J.isCollection=kl;J.isDocument=_d;J.isMap=Ad;J.isNode=Pd;J.isPair=Nd;J.isScalar=El;J.isSeq=Rd});var ri=y(fr=>{"use strict";var Y=I(),te=Symbol("break visit"),Ol=Symbol("skip children"),Se=Symbol("remove node");function ws(e,t){let i=_l(t);Y.isDocument(e)?Lt(null,e.contents,i,Object.freeze([e]))===Se&&(e.contents=null):Lt(null,e,i,Object.freeze([]))}ws.BREAK=te;ws.SKIP=Ol;ws.REMOVE=Se;function Lt(e,t,i,s){let n=Al(e,t,i,s);if(Y.isNode(n)||Y.isPair(n))return Nl(e,s,n),Lt(e,n,i,s);if(typeof n!="symbol"){if(Y.isCollection(t)){s=Object.freeze(s.concat(t));for(let r=0;r{"use strict";var Rl=I(),Td=ri(),Ld={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Cd=e=>e.replace(/[!,[\]{}]/g,t=>Ld[t]),oi=class e{constructor(t,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,i)}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);break}return t}add(t,i){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let s=t.trim().split(/[ \t]+/),n=s.shift();switch(n){case"%TAG":{if(s.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[r,o]=s;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return i(6,`Unsupported YAML version ${r}`,o),!1}}default:return i(0,`Unknown directive ${n}`,!0),!1}}tagName(t,i){if(t==="!")return"!";if(t[0]!=="!")return i(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,s,n]=t.match(/^(.*!)([^!]*)$/s);n||i(`The ${t} tag has no suffix`);let r=this.tags[s];if(r)try{return r+decodeURIComponent(n)}catch(o){return i(String(o)),null}return s==="!"?t:(i(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[i,s]of Object.entries(this.tags))if(t.startsWith(s))return i+Cd(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),n;if(t&&s.length>0&&Rl.isNode(t.contents)){let r={};Td.visit(t.contents,(o,a)=>{Rl.isNode(a)&&a.tag&&(r[a.tag]=!0)}),n=Object.keys(r)}else n=[];for(let[r,o]of s)r==="!!"&&o==="tag:yaml.org,2002:"||(!t||n.some(a=>a.startsWith(o)))&&i.push(`%TAG ${r} ${o}`);return i.join(` -`)}};oi.defaultYaml={explicit:!1,version:"1.2"};oi.defaultTags={"!!":"tag:yaml.org,2002:"};Pl.Directives=oi});var vs=y(ai=>{"use strict";var Il=I(),Md=ri();function Dd(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(i)}return!0}function Tl(e){let t=new Set;return Md.visit(e,{Value(i,s){s.anchor&&t.add(s.anchor)}}),t}function Ll(e,t){for(let i=1;;++i){let s=`${e}${i}`;if(!t.has(s))return s}}function $d(e,t){let i=[],s=new Map,n=null;return{onAnchor:r=>{i.push(r),n??(n=Tl(e));let o=Ll(t,n);return n.add(o),o},setAnchors:()=>{for(let r of i){let o=s.get(r);if(typeof o=="object"&&o.anchor&&(Il.isScalar(o.node)||Il.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:s}}ai.anchorIsValid=Dd;ai.anchorNames=Tl;ai.createNodeAnchors=$d;ai.findNewAnchor=Ll});var pr=y(Cl=>{"use strict";function li(e,t,i,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let n=0,r=s.length;n{"use strict";var xd=I();function Ml(e,t,i){if(Array.isArray(e))return e.map((s,n)=>Ml(s,String(n),i));if(e&&typeof e.toJSON=="function"){if(!i||!xd.hasAnchor(e))return e.toJSON(t,i);let s={aliasCount:0,count:1,res:void 0};i.anchors.set(e,s),i.onCreate=r=>{s.res=r,delete i.onCreate};let n=e.toJSON(t,i);return i.onCreate&&i.onCreate(n),n}return typeof e=="bigint"&&!i?.keep?Number(e):e}Dl.toJS=Ml});var Es=y(xl=>{"use strict";var qd=pr(),$l=I(),Bd=qe(),mr=class{constructor(t){Object.defineProperty(this,$l.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:i,maxAliasCount:s,onAnchor:n,reviver:r}={}){if(!$l.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=Bd.toJS(this,"",o);if(typeof n=="function")for(let{count:l,res:c}of o.anchors.values())n(c,l);return typeof r=="function"?qd.applyReviver(r,{"":a},"",a):a}};xl.NodeBase=mr});var ci=y(ql=>{"use strict";var Fd=vs(),jd=ri(),Mt=I(),Kd=Es(),Ud=qe(),gr=class extends Kd.NodeBase{constructor(t){super(Mt.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,i){let s;i?.aliasResolveCache?s=i.aliasResolveCache:(s=[],jd.visit(t,{Node:(r,o)=>{(Mt.isAlias(o)||Mt.hasAnchor(o))&&s.push(o)}}),i&&(i.aliasResolveCache=s));let n;for(let r of s){if(r===this)break;r.anchor===this.source&&(n=r)}return n}toJSON(t,i){if(!i)return{source:this.source};let{anchors:s,doc:n,maxAliasCount:r}=i,o=this.resolve(n,i);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=s.get(o);if(a||(Ud.toJS(o,null,i),a=s.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ks(n,o,s)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(t,i,s){let n=`*${this.source}`;if(t){if(Fd.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(t.implicitKey)return`${n} `}return n}};function ks(e,t,i){if(Mt.isAlias(t)){let s=t.resolve(e),n=i&&s&&i.get(s);return n?n.count*n.aliasCount:0}else if(Mt.isCollection(t)){let s=0;for(let n of t.items){let r=ks(e,n,i);r>s&&(s=r)}return s}else if(Mt.isPair(t)){let s=ks(e,t.key,i),n=ks(e,t.value,i);return Math.max(s,n)}return 1}ql.Alias=gr});var B=y(yr=>{"use strict";var zd=I(),Yd=Es(),Gd=qe(),Wd=e=>!e||typeof e!="function"&&typeof e!="object",Be=class extends Yd.NodeBase{constructor(t){super(zd.SCALAR),this.value=t}toJSON(t,i){return i?.keep?this.value:Gd.toJS(this.value,t,i)}toString(){return String(this.value)}};Be.BLOCK_FOLDED="BLOCK_FOLDED";Be.BLOCK_LITERAL="BLOCK_LITERAL";Be.PLAIN="PLAIN";Be.QUOTE_DOUBLE="QUOTE_DOUBLE";Be.QUOTE_SINGLE="QUOTE_SINGLE";yr.Scalar=Be;yr.isScalarValue=Wd});var hi=y(Fl=>{"use strict";var Hd=ci(),at=I(),Bl=B(),Vd="tag:yaml.org,2002:";function Jd(e,t,i){if(t){let s=i.filter(r=>r.tag===t),n=s.find(r=>!r.format)??s[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return i.find(s=>s.identify?.(e)&&!s.format)}function Zd(e,t,i){if(at.isDocument(e)&&(e=e.contents),at.isNode(e))return e;if(at.isPair(e)){let u=i.schema[at.MAP].createNode?.(i.schema,null,i);return u.items.push(e),u}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:n,onTagObj:r,schema:o,sourceObjects:a}=i,l;if(s&&e&&typeof e=="object"){if(l=a.get(e),l)return l.anchor??(l.anchor=n(e)),new Hd.Alias(l.anchor);l={anchor:null,node:null},a.set(e,l)}t?.startsWith("!!")&&(t=Vd+t.slice(2));let c=Jd(e,t,o.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let u=new Bl.Scalar(e);return l&&(l.node=u),u}c=e instanceof Map?o[at.MAP]:Symbol.iterator in Object(e)?o[at.SEQ]:o[at.MAP]}r&&(r(c),delete i.onTagObj);let h=c?.createNode?c.createNode(i.schema,e,i):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(i.schema,e,i):new Bl.Scalar(e);return t?h.tag=t:c.default||(h.tag=c.tag),l&&(l.node=h),h}Fl.createNode=Zd});var _s=y(Os=>{"use strict";var Xd=hi(),ve=I(),Qd=Es();function br(e,t,i){let s=i;for(let n=t.length-1;n>=0;--n){let r=t[n];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=s,s=o}else s=new Map([[r,s]])}return Xd.createNode(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var jl=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,wr=class extends Qd.NodeBase{constructor(t,i){super(t),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(t){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(i.schema=t),i.items=i.items.map(s=>ve.isNode(s)||ve.isPair(s)?s.clone(t):s),this.range&&(i.range=this.range.slice()),i}addIn(t,i){if(jl(t))this.add(i);else{let[s,...n]=t,r=this.get(s,!0);if(ve.isCollection(r))r.addIn(n,i);else if(r===void 0&&this.schema)this.set(s,br(this.schema,n,i));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${n}`)}}deleteIn(t){let[i,...s]=t;if(s.length===0)return this.delete(i);let n=this.get(i,!0);if(ve.isCollection(n))return n.deleteIn(s);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${s}`)}getIn(t,i){let[s,...n]=t,r=this.get(s,!0);return n.length===0?!i&&ve.isScalar(r)?r.value:r:ve.isCollection(r)?r.getIn(n,i):void 0}hasAllNullValues(t){return this.items.every(i=>{if(!ve.isPair(i))return!1;let s=i.value;return s==null||t&&ve.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(t){let[i,...s]=t;if(s.length===0)return this.has(i);let n=this.get(i,!0);return ve.isCollection(n)?n.hasIn(s):!1}setIn(t,i){let[s,...n]=t;if(n.length===0)this.set(s,i);else{let r=this.get(s,!0);if(ve.isCollection(r))r.setIn(n,i);else if(r===void 0&&this.schema)this.set(s,br(this.schema,n,i));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${n}`)}}};Os.Collection=wr;Os.collectionFromPath=br;Os.isEmptyPath=jl});var ui=y(As=>{"use strict";var ep=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Sr(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var tp=(e,t,i)=>e.endsWith(` -`)?Sr(i,t):i.includes(` +"use strict";var bd=Object.create;var ys=Object.defineProperty;var wd=Object.getOwnPropertyDescriptor;var Sd=Object.getOwnPropertyNames;var vd=Object.getPrototypeOf,Ed=Object.prototype.hasOwnProperty;var y=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kd=(e,t)=>{for(var i in t)ys(e,i,{get:t[i],enumerable:!0})},Sl=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Sd(t))!Ed.call(e,n)&&n!==i&&ys(e,n,{get:()=>t[n],enumerable:!(s=wd(t,n))||s.enumerable});return e};var O=(e,t,i)=>(i=e!=null?bd(vd(e)):{},Sl(t||!e||!e.__esModule?ys(i,"default",{value:e,enumerable:!0}):i,e)),Od=e=>Sl(ys({},"__esModule",{value:!0}),e);var I=y(J=>{"use strict";var ur=Symbol.for("yaml.alias"),vl=Symbol.for("yaml.document"),bs=Symbol.for("yaml.map"),El=Symbol.for("yaml.pair"),fr=Symbol.for("yaml.scalar"),ws=Symbol.for("yaml.seq"),Ne=Symbol.for("yaml.node.type"),_d=e=>!!e&&typeof e=="object"&&e[Ne]===ur,Ad=e=>!!e&&typeof e=="object"&&e[Ne]===vl,Nd=e=>!!e&&typeof e=="object"&&e[Ne]===bs,Rd=e=>!!e&&typeof e=="object"&&e[Ne]===El,kl=e=>!!e&&typeof e=="object"&&e[Ne]===fr,Pd=e=>!!e&&typeof e=="object"&&e[Ne]===ws;function Ol(e){if(e&&typeof e=="object")switch(e[Ne]){case bs:case ws:return!0}return!1}function Id(e){if(e&&typeof e=="object")switch(e[Ne]){case ur:case bs:case fr:case ws:return!0}return!1}var Td=e=>(kl(e)||Ol(e))&&!!e.anchor;J.ALIAS=ur;J.DOC=vl;J.MAP=bs;J.NODE_TYPE=Ne;J.PAIR=El;J.SCALAR=fr;J.SEQ=ws;J.hasAnchor=Td;J.isAlias=_d;J.isCollection=Ol;J.isDocument=Ad;J.isMap=Nd;J.isNode=Id;J.isPair=Rd;J.isScalar=kl;J.isSeq=Pd});var oi=y(dr=>{"use strict";var Y=I(),te=Symbol("break visit"),_l=Symbol("skip children"),Se=Symbol("remove node");function Ss(e,t){let i=Al(t);Y.isDocument(e)?Ct(null,e.contents,i,Object.freeze([e]))===Se&&(e.contents=null):Ct(null,e,i,Object.freeze([]))}Ss.BREAK=te;Ss.SKIP=_l;Ss.REMOVE=Se;function Ct(e,t,i,s){let n=Nl(e,t,i,s);if(Y.isNode(n)||Y.isPair(n))return Rl(e,s,n),Ct(e,n,i,s);if(typeof n!="symbol"){if(Y.isCollection(t)){s=Object.freeze(s.concat(t));for(let r=0;r{"use strict";var Pl=I(),Ld=oi(),Cd={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Md=e=>e.replace(/[!,[\]{}]/g,t=>Cd[t]),ai=class e{constructor(t,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,i)}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);break}return t}add(t,i){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let s=t.trim().split(/[ \t]+/),n=s.shift();switch(n){case"%TAG":{if(s.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[r,o]=s;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return i(6,`Unsupported YAML version ${r}`,o),!1}}default:return i(0,`Unknown directive ${n}`,!0),!1}}tagName(t,i){if(t==="!")return"!";if(t[0]!=="!")return i(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,s,n]=t.match(/^(.*!)([^!]*)$/s);n||i(`The ${t} tag has no suffix`);let r=this.tags[s];if(r)try{return r+decodeURIComponent(n)}catch(o){return i(String(o)),null}return s==="!"?t:(i(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[i,s]of Object.entries(this.tags))if(t.startsWith(s))return i+Md(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),n;if(t&&s.length>0&&Pl.isNode(t.contents)){let r={};Ld.visit(t.contents,(o,a)=>{Pl.isNode(a)&&a.tag&&(r[a.tag]=!0)}),n=Object.keys(r)}else n=[];for(let[r,o]of s)r==="!!"&&o==="tag:yaml.org,2002:"||(!t||n.some(a=>a.startsWith(o)))&&i.push(`%TAG ${r} ${o}`);return i.join(` +`)}};ai.defaultYaml={explicit:!1,version:"1.2"};ai.defaultTags={"!!":"tag:yaml.org,2002:"};Il.Directives=ai});var Es=y(li=>{"use strict";var Tl=I(),Dd=oi();function $d(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(i)}return!0}function Ll(e){let t=new Set;return Dd.visit(e,{Value(i,s){s.anchor&&t.add(s.anchor)}}),t}function Cl(e,t){for(let i=1;;++i){let s=`${e}${i}`;if(!t.has(s))return s}}function xd(e,t){let i=[],s=new Map,n=null;return{onAnchor:r=>{i.push(r),n??(n=Ll(e));let o=Cl(t,n);return n.add(o),o},setAnchors:()=>{for(let r of i){let o=s.get(r);if(typeof o=="object"&&o.anchor&&(Tl.isScalar(o.node)||Tl.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:s}}li.anchorIsValid=$d;li.anchorNames=Ll;li.createNodeAnchors=xd;li.findNewAnchor=Cl});var mr=y(Ml=>{"use strict";function ci(e,t,i,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let n=0,r=s.length;n{"use strict";var qd=I();function Dl(e,t,i){if(Array.isArray(e))return e.map((s,n)=>Dl(s,String(n),i));if(e&&typeof e.toJSON=="function"){if(!i||!qd.hasAnchor(e))return e.toJSON(t,i);let s={aliasCount:0,count:1,res:void 0};i.anchors.set(e,s),i.onCreate=r=>{s.res=r,delete i.onCreate};let n=e.toJSON(t,i);return i.onCreate&&i.onCreate(n),n}return typeof e=="bigint"&&!i?.keep?Number(e):e}$l.toJS=Dl});var ks=y(ql=>{"use strict";var Bd=mr(),xl=I(),Fd=Be(),gr=class{constructor(t){Object.defineProperty(this,xl.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:i,maxAliasCount:s,onAnchor:n,reviver:r}={}){if(!xl.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=Fd.toJS(this,"",o);if(typeof n=="function")for(let{count:l,res:c}of o.anchors.values())n(c,l);return typeof r=="function"?Bd.applyReviver(r,{"":a},"",a):a}};ql.NodeBase=gr});var hi=y(Bl=>{"use strict";var jd=Es(),Kd=oi(),Dt=I(),Ud=ks(),zd=Be(),yr=class extends Ud.NodeBase{constructor(t){super(Dt.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,i){let s;i?.aliasResolveCache?s=i.aliasResolveCache:(s=[],Kd.visit(t,{Node:(r,o)=>{(Dt.isAlias(o)||Dt.hasAnchor(o))&&s.push(o)}}),i&&(i.aliasResolveCache=s));let n;for(let r of s){if(r===this)break;r.anchor===this.source&&(n=r)}return n}toJSON(t,i){if(!i)return{source:this.source};let{anchors:s,doc:n,maxAliasCount:r}=i,o=this.resolve(n,i);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=s.get(o);if(a||(zd.toJS(o,null,i),a=s.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Os(n,o,s)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(t,i,s){let n=`*${this.source}`;if(t){if(jd.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(t.implicitKey)return`${n} `}return n}};function Os(e,t,i){if(Dt.isAlias(t)){let s=t.resolve(e),n=i&&s&&i.get(s);return n?n.count*n.aliasCount:0}else if(Dt.isCollection(t)){let s=0;for(let n of t.items){let r=Os(e,n,i);r>s&&(s=r)}return s}else if(Dt.isPair(t)){let s=Os(e,t.key,i),n=Os(e,t.value,i);return Math.max(s,n)}return 1}Bl.Alias=yr});var B=y(br=>{"use strict";var Yd=I(),Gd=ks(),Wd=Be(),Hd=e=>!e||typeof e!="function"&&typeof e!="object",Fe=class extends Gd.NodeBase{constructor(t){super(Yd.SCALAR),this.value=t}toJSON(t,i){return i?.keep?this.value:Wd.toJS(this.value,t,i)}toString(){return String(this.value)}};Fe.BLOCK_FOLDED="BLOCK_FOLDED";Fe.BLOCK_LITERAL="BLOCK_LITERAL";Fe.PLAIN="PLAIN";Fe.QUOTE_DOUBLE="QUOTE_DOUBLE";Fe.QUOTE_SINGLE="QUOTE_SINGLE";br.Scalar=Fe;br.isScalarValue=Hd});var ui=y(jl=>{"use strict";var Vd=hi(),lt=I(),Fl=B(),Jd="tag:yaml.org,2002:";function Zd(e,t,i){if(t){let s=i.filter(r=>r.tag===t),n=s.find(r=>!r.format)??s[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return i.find(s=>s.identify?.(e)&&!s.format)}function Xd(e,t,i){if(lt.isDocument(e)&&(e=e.contents),lt.isNode(e))return e;if(lt.isPair(e)){let u=i.schema[lt.MAP].createNode?.(i.schema,null,i);return u.items.push(e),u}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:n,onTagObj:r,schema:o,sourceObjects:a}=i,l;if(s&&e&&typeof e=="object"){if(l=a.get(e),l)return l.anchor??(l.anchor=n(e)),new Vd.Alias(l.anchor);l={anchor:null,node:null},a.set(e,l)}t?.startsWith("!!")&&(t=Jd+t.slice(2));let c=Zd(e,t,o.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let u=new Fl.Scalar(e);return l&&(l.node=u),u}c=e instanceof Map?o[lt.MAP]:Symbol.iterator in Object(e)?o[lt.SEQ]:o[lt.MAP]}r&&(r(c),delete i.onTagObj);let h=c?.createNode?c.createNode(i.schema,e,i):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(i.schema,e,i):new Fl.Scalar(e);return t?h.tag=t:c.default||(h.tag=c.tag),l&&(l.node=h),h}jl.createNode=Xd});var As=y(_s=>{"use strict";var Qd=ui(),ve=I(),ep=ks();function wr(e,t,i){let s=i;for(let n=t.length-1;n>=0;--n){let r=t[n];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=s,s=o}else s=new Map([[r,s]])}return Qd.createNode(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Kl=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Sr=class extends ep.NodeBase{constructor(t,i){super(t),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(t){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(i.schema=t),i.items=i.items.map(s=>ve.isNode(s)||ve.isPair(s)?s.clone(t):s),this.range&&(i.range=this.range.slice()),i}addIn(t,i){if(Kl(t))this.add(i);else{let[s,...n]=t,r=this.get(s,!0);if(ve.isCollection(r))r.addIn(n,i);else if(r===void 0&&this.schema)this.set(s,wr(this.schema,n,i));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${n}`)}}deleteIn(t){let[i,...s]=t;if(s.length===0)return this.delete(i);let n=this.get(i,!0);if(ve.isCollection(n))return n.deleteIn(s);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${s}`)}getIn(t,i){let[s,...n]=t,r=this.get(s,!0);return n.length===0?!i&&ve.isScalar(r)?r.value:r:ve.isCollection(r)?r.getIn(n,i):void 0}hasAllNullValues(t){return this.items.every(i=>{if(!ve.isPair(i))return!1;let s=i.value;return s==null||t&&ve.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(t){let[i,...s]=t;if(s.length===0)return this.has(i);let n=this.get(i,!0);return ve.isCollection(n)?n.hasIn(s):!1}setIn(t,i){let[s,...n]=t;if(n.length===0)this.set(s,i);else{let r=this.get(s,!0);if(ve.isCollection(r))r.setIn(n,i);else if(r===void 0&&this.schema)this.set(s,wr(this.schema,n,i));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${n}`)}}};_s.Collection=Sr;_s.collectionFromPath=wr;_s.isEmptyPath=Kl});var fi=y(Ns=>{"use strict";var tp=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function vr(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var ip=(e,t,i)=>e.endsWith(` +`)?vr(i,t):i.includes(` `)?` -`+Sr(i,t):(e.endsWith(" ")?"":" ")+i;As.indentComment=Sr;As.lineComment=tp;As.stringifyComment=ep});var Ul=y(fi=>{"use strict";var ip="flow",vr="block",Ns="quoted";function sp(e,t,i="flow",{indentAtStart:s,lineWidth:n=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!n||n<0)return e;nn-Math.max(2,r)?c.push(0):u=n-s);let f,p,g=!1,d=-1,m=-1,w=-1;i===vr&&(d=Kl(e,d,t.length),d!==-1&&(u=d+l));for(let k;k=e[d+=1];){if(i===Ns&&k==="\\"){switch(m=d,e[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}w=d}if(k===` -`)i===vr&&(d=Kl(e,d,t.length)),u=d+t.length+l,f=void 0;else{if(k===" "&&p&&p!==" "&&p!==` +`+vr(i,t):(e.endsWith(" ")?"":" ")+i;Ns.indentComment=vr;Ns.lineComment=ip;Ns.stringifyComment=tp});var zl=y(di=>{"use strict";var sp="flow",Er="block",Rs="quoted";function np(e,t,i="flow",{indentAtStart:s,lineWidth:n=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!n||n<0)return e;nn-Math.max(2,r)?c.push(0):u=n-s);let f,p,g=!1,d=-1,m=-1,w=-1;i===Er&&(d=Ul(e,d,t.length),d!==-1&&(u=d+l));for(let k;k=e[d+=1];){if(i===Rs&&k==="\\"){switch(m=d,e[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}w=d}if(k===` +`)i===Er&&(d=Ul(e,d,t.length)),u=d+t.length+l,f=void 0;else{if(k===" "&&p&&p!==" "&&p!==` `&&p!==" "){let _=e[d+1];_&&_!==" "&&_!==` -`&&_!==" "&&(f=d)}if(d>=u)if(f)c.push(f),u=f+l,f=void 0;else if(i===Ns){for(;p===" "||p===" ";)p=k,k=e[d+=1],g=!0;let _=d>w+1?d-2:m-1;if(h[_])return e;c.push(_),h[_]=!0,u=_+l,f=void 0}else g=!0}p=k}if(g&&a&&a(),c.length===0)return e;o&&o();let E=e.slice(0,c[0]);for(let k=0;k{"use strict";var he=B(),Fe=Ul(),Ps=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Is=e=>/^(%|---|\.\.\.)/m.test(e);function np(e,t,i){if(!t||t<0)return!1;let s=t-i,n=e.length;if(n<=s)return!1;for(let r=0,o=0;rs)return!0;if(o=r+1,n-o<=s)return!1}return!0}function di(e,t){let i=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return i;let{implicitKey:s}=t,n=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(Is(e)?" ":""),o="",a=0;for(let l=0,c=i[l];c;c=i[++l])if(c===" "&&i[l+1]==="\\"&&i[l+2]==="n"&&(o+=i.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(i[l+1]){case"u":{o+=i.slice(a,l);let h=i.substr(l+2,4);switch(h){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:h.substr(0,2)==="00"?o+="\\x"+h.substr(2):o+=i.substr(l,6)}l+=5,a=l+1}break;case"n":if(s||i[l+2]==='"'||i.length=u)if(f)c.push(f),u=f+l,f=void 0;else if(i===Rs){for(;p===" "||p===" ";)p=k,k=e[d+=1],g=!0;let _=d>w+1?d-2:m-1;if(h[_])return e;c.push(_),h[_]=!0,u=_+l,f=void 0}else g=!0}p=k}if(g&&a&&a(),c.length===0)return e;o&&o();let E=e.slice(0,c[0]);for(let k=0;k{"use strict";var he=B(),je=zl(),Is=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ts=e=>/^(%|---|\.\.\.)/m.test(e);function rp(e,t,i){if(!t||t<0)return!1;let s=t-i,n=e.length;if(n<=s)return!1;for(let r=0,o=0;rs)return!0;if(o=r+1,n-o<=s)return!1}return!0}function pi(e,t){let i=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return i;let{implicitKey:s}=t,n=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(Ts(e)?" ":""),o="",a=0;for(let l=0,c=i[l];c;c=i[++l])if(c===" "&&i[l+1]==="\\"&&i[l+2]==="n"&&(o+=i.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(i[l+1]){case"u":{o+=i.slice(a,l);let h=i.substr(l+2,4);switch(h){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:h.substr(0,2)==="00"?o+="\\x"+h.substr(2):o+=i.substr(l,6)}l+=5,a=l+1}break;case"n":if(s||i[l+2]==='"'||i.length `;let u,f;for(f=i.length;f>0;--f){let A=i[f-1];if(A!==` `&&A!==" "&&A!==" ")break}let p=i.substring(f),g=p.indexOf(` `);g===-1?u="-":i===p||g!==p.length-1?(u="+",r&&r()):u="",p&&(i=i.slice(0,-p.length),p[p.length-1]===` -`&&(p=p.slice(0,-1)),p=p.replace(kr,`$&${c}`));let d=!1,m,w=-1;for(m=0;m{N=!0});let v=Fe.foldFlowLines(`${E}${A}${p}`,c,Fe.FOLD_BLOCK,C);if(!N)return`>${_} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),N=!1,C=Is(s,!0);o!=="folded"&&t!==he.Scalar.BLOCK_FOLDED&&(C.onOverflow=()=>{N=!0});let v=je.foldFlowLines(`${E}${A}${p}`,c,je.FOLD_BLOCK,C);if(!N)return`>${_} ${c}${v}`}return i=i.replace(/\n+/g,`$&${c}`),`|${_} -${c}${E}${i}${p}`}function rp(e,t,i,s){let{type:n,value:r}=e,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:h}=t;if(a&&r.includes(` -`)||h&&/[[\]{},]/.test(r))return Dt(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||h||!r.includes(` -`)?Dt(r,t):Rs(e,t,i,s);if(!a&&!h&&n!==he.Scalar.PLAIN&&r.includes(` -`))return Rs(e,t,i,s);if(Is(r)){if(l==="")return t.forceBlockIndent=!0,Rs(e,t,i,s);if(a&&l===c)return Dt(r,t)}let u=r.replace(/\n+/g,`$& -${l}`);if(o){let f=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(u),{compat:p,tags:g}=t.doc.schema;if(g.some(f)||p?.some(f))return Dt(r,t)}return a?u:Fe.foldFlowLines(u,l,Fe.FOLD_FLOW,Ps(t,!1))}function op(e,t,i,s){let{implicitKey:n,inFlow:r}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==he.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=he.Scalar.QUOTE_DOUBLE);let l=h=>{switch(h){case he.Scalar.BLOCK_FOLDED:case he.Scalar.BLOCK_LITERAL:return n||r?Dt(o.value,t):Rs(o,t,i,s);case he.Scalar.QUOTE_DOUBLE:return di(o.value,t);case he.Scalar.QUOTE_SINGLE:return Er(o.value,t);case he.Scalar.PLAIN:return rp(o,t,i,s);default:return null}},c=l(a);if(c===null){let{defaultKeyType:h,defaultStringType:u}=t.options,f=n&&h||u;if(c=l(f),c===null)throw new Error(`Unsupported default string type ${f}`)}return c}zl.stringifyString=op});var mi=y(Or=>{"use strict";var ap=vs(),je=I(),lp=ui(),cp=pi();function hp(e,t){let i=Object.assign({blockQuote:!0,commentString:lp.stringifyComment,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),s;switch(i.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:s,options:i}}function up(e,t){if(t.tag){let n=e.filter(r=>r.tag===t.tag);if(n.length>0)return n.find(r=>r.format===t.format)??n[0]}let i,s;if(je.isScalar(t)){s=t.value;let n=e.filter(r=>r.identify?.(s));if(n.length>1){let r=n.filter(o=>o.test);r.length>0&&(n=r)}i=n.find(r=>r.format===t.format)??n.find(r=>!r.format)}else s=t,i=e.find(n=>n.nodeClass&&s instanceof n.nodeClass);if(!i){let n=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${n} value`)}return i}function fp(e,t,{anchors:i,doc:s}){if(!s.directives)return"";let n=[],r=(je.isScalar(e)||je.isCollection(e))&&e.anchor;r&&ap.anchorIsValid(r)&&(i.add(r),n.push(`&${r}`));let o=e.tag??(t.default?null:t.tag);return o&&n.push(s.directives.tagString(o)),n.join(" ")}function dp(e,t,i,s){if(je.isPair(e))return e.toString(t,i,s);if(je.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new 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 n,r=je.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>n=l});n??(n=up(t.doc.schema.tags,r));let o=fp(r,n,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let a=typeof n.stringify=="function"?n.stringify(r,t,i,s):je.isScalar(r)?cp.stringifyString(r,t,i,s):r.toString(t,i,s);return o?je.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o} -${t.indent}${a}`:a}Or.createStringifyContext=hp;Or.stringify=dp});var Hl=y(Wl=>{"use strict";var Re=I(),Yl=B(),Gl=mi(),gi=ui();function pp({key:e,value:t},i,s,n){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:h,simpleKeys:u}}=i,f=Re.isNode(e)&&e.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Re.isCollection(e)||!Re.isNode(e)&&typeof e=="object"){let C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let p=!u&&(!e||f&&t==null&&!i.inFlow||Re.isCollection(e)||(Re.isScalar(e)?e.type===Yl.Scalar.BLOCK_FOLDED||e.type===Yl.Scalar.BLOCK_LITERAL:typeof e=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!p&&(u||!r),indent:a+l});let g=!1,d=!1,m=Gl.stringify(e,i,()=>g=!0,()=>d=!0);if(!p&&!i.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(i.inFlow){if(r||t==null)return g&&s&&s(),m===""?"?":p?`? ${m}`:m}else if(r&&!u||t==null&&p)return m=`? ${m}`,f&&!g?m+=gi.lineComment(m,i.indent,c(f)):d&&n&&n(),m;g&&(f=null),p?(f&&(m+=gi.lineComment(m,i.indent,c(f))),m=`? ${m} -${a}:`):(m=`${m}:`,f&&(m+=gi.lineComment(m,i.indent,c(f))));let w,E,k;Re.isNode(t)?(w=!!t.spaceBefore,E=t.commentBefore,k=t.comment):(w=!1,E=null,k=null,t&&typeof t=="object"&&(t=o.createNode(t))),i.implicitKey=!1,!p&&!f&&Re.isScalar(t)&&(i.indentAtStart=m.length+1),d=!1,!h&&l.length>=2&&!i.inFlow&&!p&&Re.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(i.indent=i.indent.substring(2));let _=!1,A=Gl.stringify(t,i,()=>_=!0,()=>d=!0),N=" ";if(f||w||E){if(N=w?` +${c}${E}${i}${p}`}function op(e,t,i,s){let{type:n,value:r}=e,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:h}=t;if(a&&r.includes(` +`)||h&&/[[\]{},]/.test(r))return $t(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||h||!r.includes(` +`)?$t(r,t):Ps(e,t,i,s);if(!a&&!h&&n!==he.Scalar.PLAIN&&r.includes(` +`))return Ps(e,t,i,s);if(Ts(r)){if(l==="")return t.forceBlockIndent=!0,Ps(e,t,i,s);if(a&&l===c)return $t(r,t)}let u=r.replace(/\n+/g,`$& +${l}`);if(o){let f=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(u),{compat:p,tags:g}=t.doc.schema;if(g.some(f)||p?.some(f))return $t(r,t)}return a?u:je.foldFlowLines(u,l,je.FOLD_FLOW,Is(t,!1))}function ap(e,t,i,s){let{implicitKey:n,inFlow:r}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==he.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=he.Scalar.QUOTE_DOUBLE);let l=h=>{switch(h){case he.Scalar.BLOCK_FOLDED:case he.Scalar.BLOCK_LITERAL:return n||r?$t(o.value,t):Ps(o,t,i,s);case he.Scalar.QUOTE_DOUBLE:return pi(o.value,t);case he.Scalar.QUOTE_SINGLE:return kr(o.value,t);case he.Scalar.PLAIN:return op(o,t,i,s);default:return null}},c=l(a);if(c===null){let{defaultKeyType:h,defaultStringType:u}=t.options,f=n&&h||u;if(c=l(f),c===null)throw new Error(`Unsupported default string type ${f}`)}return c}Yl.stringifyString=ap});var gi=y(_r=>{"use strict";var lp=Es(),Ke=I(),cp=fi(),hp=mi();function up(e,t){let i=Object.assign({blockQuote:!0,commentString:cp.stringifyComment,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),s;switch(i.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:s,options:i}}function fp(e,t){if(t.tag){let n=e.filter(r=>r.tag===t.tag);if(n.length>0)return n.find(r=>r.format===t.format)??n[0]}let i,s;if(Ke.isScalar(t)){s=t.value;let n=e.filter(r=>r.identify?.(s));if(n.length>1){let r=n.filter(o=>o.test);r.length>0&&(n=r)}i=n.find(r=>r.format===t.format)??n.find(r=>!r.format)}else s=t,i=e.find(n=>n.nodeClass&&s instanceof n.nodeClass);if(!i){let n=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${n} value`)}return i}function dp(e,t,{anchors:i,doc:s}){if(!s.directives)return"";let n=[],r=(Ke.isScalar(e)||Ke.isCollection(e))&&e.anchor;r&&lp.anchorIsValid(r)&&(i.add(r),n.push(`&${r}`));let o=e.tag??(t.default?null:t.tag);return o&&n.push(s.directives.tagString(o)),n.join(" ")}function pp(e,t,i,s){if(Ke.isPair(e))return e.toString(t,i,s);if(Ke.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new 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 n,r=Ke.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>n=l});n??(n=fp(t.doc.schema.tags,r));let o=dp(r,n,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let a=typeof n.stringify=="function"?n.stringify(r,t,i,s):Ke.isScalar(r)?hp.stringifyString(r,t,i,s):r.toString(t,i,s);return o?Ke.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o} +${t.indent}${a}`:a}_r.createStringifyContext=up;_r.stringify=pp});var Vl=y(Hl=>{"use strict";var Re=I(),Gl=B(),Wl=gi(),yi=fi();function mp({key:e,value:t},i,s,n){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:h,simpleKeys:u}}=i,f=Re.isNode(e)&&e.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Re.isCollection(e)||!Re.isNode(e)&&typeof e=="object"){let C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let p=!u&&(!e||f&&t==null&&!i.inFlow||Re.isCollection(e)||(Re.isScalar(e)?e.type===Gl.Scalar.BLOCK_FOLDED||e.type===Gl.Scalar.BLOCK_LITERAL:typeof e=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!p&&(u||!r),indent:a+l});let g=!1,d=!1,m=Wl.stringify(e,i,()=>g=!0,()=>d=!0);if(!p&&!i.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(i.inFlow){if(r||t==null)return g&&s&&s(),m===""?"?":p?`? ${m}`:m}else if(r&&!u||t==null&&p)return m=`? ${m}`,f&&!g?m+=yi.lineComment(m,i.indent,c(f)):d&&n&&n(),m;g&&(f=null),p?(f&&(m+=yi.lineComment(m,i.indent,c(f))),m=`? ${m} +${a}:`):(m=`${m}:`,f&&(m+=yi.lineComment(m,i.indent,c(f))));let w,E,k;Re.isNode(t)?(w=!!t.spaceBefore,E=t.commentBefore,k=t.comment):(w=!1,E=null,k=null,t&&typeof t=="object"&&(t=o.createNode(t))),i.implicitKey=!1,!p&&!f&&Re.isScalar(t)&&(i.indentAtStart=m.length+1),d=!1,!h&&l.length>=2&&!i.inFlow&&!p&&Re.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(i.indent=i.indent.substring(2));let _=!1,A=Wl.stringify(t,i,()=>_=!0,()=>d=!0),N=" ";if(f||w||E){if(N=w?` `:"",E){let C=c(E);N+=` -${gi.indentComment(C,i.indent)}`}A===""&&!i.inFlow?N===` +${yi.indentComment(C,i.indent)}`}A===""&&!i.inFlow?N===` `&&k&&(N=` `):N+=` ${i.indent}`}else if(!p&&Re.isCollection(t)){let C=A[0],v=A.indexOf(` -`),U=v!==-1,xe=i.inFlow??t.flow??t.items.length===0;if(U||!xe){let Tt=!1;if(U&&(C==="&"||C==="!")){let z=A.indexOf(" ");C==="&"&&z!==-1&&z{"use strict";var Vl=require("process");function mp(e,...t){e==="debug"&&console.log(...t)}function gp(e,t){(e==="debug"||e==="warn")&&(typeof Vl.emitWarning=="function"?Vl.emitWarning(t):console.warn(t))}_r.debug=mp;_r.warn=gp});var Ms=y(Cs=>{"use strict";var yi=I(),Jl=B(),Ts="<<",Ls={identify:e=>e===Ts||typeof e=="symbol"&&e.description===Ts,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Jl.Scalar(Symbol(Ts)),{addToJSMap:Zl}),stringify:()=>Ts},yp=(e,t)=>(Ls.identify(t)||yi.isScalar(t)&&(!t.type||t.type===Jl.Scalar.PLAIN)&&Ls.identify(t.value))&&e?.doc.schema.tags.some(i=>i.tag===Ls.tag&&i.default);function Zl(e,t,i){if(i=e&&yi.isAlias(i)?i.resolve(e.doc):i,yi.isSeq(i))for(let s of i.items)Nr(e,t,s);else if(Array.isArray(i))for(let s of i)Nr(e,t,s);else Nr(e,t,i)}function Nr(e,t,i){let s=e&&yi.isAlias(i)?i.resolve(e.doc):i;if(!yi.isMap(s))throw new Error("Merge sources must be maps or map aliases");let n=s.toJSON(null,e,Map);for(let[r,o]of n)t instanceof Map?t.has(r)||t.set(r,o):t instanceof Set?t.add(r):Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}Cs.addMergeToJSMap=Zl;Cs.isMergeKey=yp;Cs.merge=Ls});var Pr=y(ec=>{"use strict";var bp=Ar(),Xl=Ms(),wp=mi(),Ql=I(),Rr=qe();function Sp(e,t,{key:i,value:s}){if(Ql.isNode(i)&&i.addToJSMap)i.addToJSMap(e,t,s);else if(Xl.isMergeKey(e,i))Xl.addMergeToJSMap(e,t,s);else{let n=Rr.toJS(i,"",e);if(t instanceof Map)t.set(n,Rr.toJS(s,n,e));else if(t instanceof Set)t.add(n);else{let r=vp(i,n,e),o=Rr.toJS(s,r,e);r in t?Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[r]=o}}return t}function vp(e,t,i){if(t===null)return"";if(typeof t!="object")return String(t);if(Ql.isNode(e)&&i?.doc){let s=wp.createStringifyContext(i.doc,{});s.anchors=new Set;for(let r of i.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;let n=e.toString(s);if(!i.mapKeyWarned){let r=JSON.stringify(n);r.length>40&&(r=r.substring(0,36)+'..."'),bp.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return n}return JSON.stringify(t)}ec.addPairToJSMap=Sp});var Ke=y(Ir=>{"use strict";var tc=hi(),Ep=Hl(),kp=Pr(),Ds=I();function Op(e,t,i){let s=tc.createNode(e,void 0,i),n=tc.createNode(t,void 0,i);return new $s(s,n)}var $s=class e{constructor(t,i=null){Object.defineProperty(this,Ds.NODE_TYPE,{value:Ds.PAIR}),this.key=t,this.value=i}clone(t){let{key:i,value:s}=this;return Ds.isNode(i)&&(i=i.clone(t)),Ds.isNode(s)&&(s=s.clone(t)),new e(i,s)}toJSON(t,i){let s=i?.mapAsMap?new Map:{};return kp.addPairToJSMap(i,s,this)}toString(t,i,s){return t?.doc?Ep.stringifyPair(this,t,i,s):JSON.stringify(this)}};Ir.Pair=$s;Ir.createPair=Op});var Tr=y(sc=>{"use strict";var lt=I(),ic=mi(),xs=ui();function _p(e,t,i){return(t.inFlow??e.flow?Np:Ap)(e,t,i)}function Ap({comment:e,items:t},i,{blockItemPrefix:s,flowChars:n,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=i,h=Object.assign({},i,{indent:r,type:null}),u=!1,f=[];for(let g=0;gm=null,()=>u=!0);m&&(w+=xs.lineComment(w,r,c(m))),u&&m&&(u=!1),f.push(s+w)}let p;if(f.length===0)p=n.start+n.end;else{p=f[0];for(let g=1;g{"use strict";var Jl=require("process");function gp(e,...t){e==="debug"&&console.log(...t)}function yp(e,t){(e==="debug"||e==="warn")&&(typeof Jl.emitWarning=="function"?Jl.emitWarning(t):console.warn(t))}Ar.debug=gp;Ar.warn=yp});var Ds=y(Ms=>{"use strict";var bi=I(),Zl=B(),Ls="<<",Cs={identify:e=>e===Ls||typeof e=="symbol"&&e.description===Ls,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Zl.Scalar(Symbol(Ls)),{addToJSMap:Xl}),stringify:()=>Ls},bp=(e,t)=>(Cs.identify(t)||bi.isScalar(t)&&(!t.type||t.type===Zl.Scalar.PLAIN)&&Cs.identify(t.value))&&e?.doc.schema.tags.some(i=>i.tag===Cs.tag&&i.default);function Xl(e,t,i){if(i=e&&bi.isAlias(i)?i.resolve(e.doc):i,bi.isSeq(i))for(let s of i.items)Rr(e,t,s);else if(Array.isArray(i))for(let s of i)Rr(e,t,s);else Rr(e,t,i)}function Rr(e,t,i){let s=e&&bi.isAlias(i)?i.resolve(e.doc):i;if(!bi.isMap(s))throw new Error("Merge sources must be maps or map aliases");let n=s.toJSON(null,e,Map);for(let[r,o]of n)t instanceof Map?t.has(r)||t.set(r,o):t instanceof Set?t.add(r):Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}Ms.addMergeToJSMap=Xl;Ms.isMergeKey=bp;Ms.merge=Cs});var Ir=y(tc=>{"use strict";var wp=Nr(),Ql=Ds(),Sp=gi(),ec=I(),Pr=Be();function vp(e,t,{key:i,value:s}){if(ec.isNode(i)&&i.addToJSMap)i.addToJSMap(e,t,s);else if(Ql.isMergeKey(e,i))Ql.addMergeToJSMap(e,t,s);else{let n=Pr.toJS(i,"",e);if(t instanceof Map)t.set(n,Pr.toJS(s,n,e));else if(t instanceof Set)t.add(n);else{let r=Ep(i,n,e),o=Pr.toJS(s,r,e);r in t?Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[r]=o}}return t}function Ep(e,t,i){if(t===null)return"";if(typeof t!="object")return String(t);if(ec.isNode(e)&&i?.doc){let s=Sp.createStringifyContext(i.doc,{});s.anchors=new Set;for(let r of i.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;let n=e.toString(s);if(!i.mapKeyWarned){let r=JSON.stringify(n);r.length>40&&(r=r.substring(0,36)+'..."'),wp.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return n}return JSON.stringify(t)}tc.addPairToJSMap=vp});var Ue=y(Tr=>{"use strict";var ic=ui(),kp=Vl(),Op=Ir(),$s=I();function _p(e,t,i){let s=ic.createNode(e,void 0,i),n=ic.createNode(t,void 0,i);return new xs(s,n)}var xs=class e{constructor(t,i=null){Object.defineProperty(this,$s.NODE_TYPE,{value:$s.PAIR}),this.key=t,this.value=i}clone(t){let{key:i,value:s}=this;return $s.isNode(i)&&(i=i.clone(t)),$s.isNode(s)&&(s=s.clone(t)),new e(i,s)}toJSON(t,i){let s=i?.mapAsMap?new Map:{};return Op.addPairToJSMap(i,s,this)}toString(t,i,s){return t?.doc?kp.stringifyPair(this,t,i,s):JSON.stringify(this)}};Tr.Pair=xs;Tr.createPair=_p});var Lr=y(nc=>{"use strict";var ct=I(),sc=gi(),qs=fi();function Ap(e,t,i){return(t.inFlow??e.flow?Rp:Np)(e,t,i)}function Np({comment:e,items:t},i,{blockItemPrefix:s,flowChars:n,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=i,h=Object.assign({},i,{indent:r,type:null}),u=!1,f=[];for(let g=0;gm=null,()=>u=!0);m&&(w+=qs.lineComment(w,r,c(m))),u&&m&&(u=!1),f.push(s+w)}let p;if(f.length===0)p=n.start+n.end;else{p=f[0];for(let g=1;gm=null);c||(c=u.length>h||w.includes(` -`)),g0&&(c||(c=u.reduce((E,k)=>E+k.length+2,2)+(w.length+2)>t.options.lineWidth)),c&&(w+=",")),m&&(w+=xs.lineComment(w,s,a(m))),u.push(w),h=u.length}let{start:f,end:p}=i;if(u.length===0)return f+p;if(!c){let g=u.reduce((d,m)=>d+m.length+2,2);c=t.options.lineWidth>0&&g>t.options.lineWidth}if(c){let g=f;for(let d of u)g+=d?` +`+qs.indentComment(c(e),l),a&&a()):u&&o&&o(),p}function Rp({items:e},t,{flowChars:i,itemIndent:s}){let{indent:n,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=t;s+=r;let l=Object.assign({},t,{indent:s,inFlow:!0,type:null}),c=!1,h=0,u=[];for(let g=0;gm=null);c||(c=u.length>h||w.includes(` +`)),g0&&(c||(c=u.reduce((E,k)=>E+k.length+2,2)+(w.length+2)>t.options.lineWidth)),c&&(w+=",")),m&&(w+=qs.lineComment(w,s,a(m))),u.push(w),h=u.length}let{start:f,end:p}=i;if(u.length===0)return f+p;if(!c){let g=u.reduce((d,m)=>d+m.length+2,2);c=t.options.lineWidth>0&&g>t.options.lineWidth}if(c){let g=f;for(let d of u)g+=d?` ${r}${n}${d}`:` `;return`${g} -${n}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function qs({indent:e,options:{commentString:t}},i,s,n){if(s&&n&&(s=s.replace(/^\n+/,"")),s){let r=xs.indentComment(t(s),e);i.push(r.trimStart())}}sc.stringifyCollection=_p});var ze=y(Cr=>{"use strict";var Rp=Tr(),Pp=Pr(),Ip=_s(),Ue=I(),Bs=Ke(),Tp=B();function bi(e,t){let i=Ue.isScalar(t)?t.value:t;for(let s of e)if(Ue.isPair(s)&&(s.key===t||s.key===i||Ue.isScalar(s.key)&&s.key.value===i))return s}var Lr=class extends Ip.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Ue.MAP,t),this.items=[]}static from(t,i,s){let{keepUndefined:n,replacer:r}=s,o=new this(t),a=(l,c)=>{if(typeof r=="function")c=r.call(i,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||n)&&o.items.push(Bs.createPair(l,c,s))};if(i instanceof Map)for(let[l,c]of i)a(l,c);else if(i&&typeof i=="object")for(let l of Object.keys(i))a(l,i[l]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,i){let s;Ue.isPair(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new Bs.Pair(t,t?.value):s=new Bs.Pair(t.key,t.value);let n=bi(this.items,s.key),r=this.schema?.sortMapEntries;if(n){if(!i)throw new Error(`Key ${s.key} already set`);Ue.isScalar(n.value)&&Tp.isScalarValue(s.value)?n.value.value=s.value:n.value=s.value}else if(r){let o=this.items.findIndex(a=>r(s,a)<0);o===-1?this.items.push(s):this.items.splice(o,0,s)}else this.items.push(s)}delete(t){let i=bi(this.items,t);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(t,i){let n=bi(this.items,t)?.value;return(!i&&Ue.isScalar(n)?n.value:n)??void 0}has(t){return!!bi(this.items,t)}set(t,i){this.add(new Bs.Pair(t,i),!0)}toJSON(t,i,s){let n=s?new s:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(n);for(let r of this.items)Pp.addPairToJSMap(i,n,r);return n}toString(t,i,s){if(!t)return JSON.stringify(this);for(let n of this.items)if(!Ue.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),Rp.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:i})}};Cr.YAMLMap=Lr;Cr.findPair=bi});var $t=y(rc=>{"use strict";var Lp=I(),nc=ze(),Cp={collection:"map",default:!0,nodeClass:nc.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return Lp.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,i)=>nc.YAMLMap.from(e,t,i)};rc.map=Cp});var Ye=y(oc=>{"use strict";var Mp=hi(),Dp=Tr(),$p=_s(),js=I(),xp=B(),qp=qe(),Mr=class extends $p.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(js.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let i=Fs(t);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(t,i){let s=Fs(t);if(typeof s!="number")return;let n=this.items[s];return!i&&js.isScalar(n)?n.value:n}has(t){let i=Fs(t);return typeof i=="number"&&i=0?t:null}oc.YAMLSeq=Mr});var xt=y(lc=>{"use strict";var Bp=I(),ac=Ye(),Fp={collection:"seq",default:!0,nodeClass:ac.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Bp.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,i)=>ac.YAMLSeq.from(e,t,i)};lc.seq=Fp});var wi=y(cc=>{"use strict";var jp=pi(),Kp={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,i,s){return t=Object.assign({actualString:!0},t),jp.stringifyString(e,t,i,s)}};cc.string=Kp});var Ks=y(fc=>{"use strict";var hc=B(),uc={identify:e=>e==null,createNode:()=>new hc.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new hc.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&uc.test.test(e)?e:t.options.nullStr};fc.nullTag=uc});var Dr=y(pc=>{"use strict";var Up=B(),dc={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Up.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},i){if(e&&dc.test.test(e)){let s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?i.options.trueStr:i.options.falseStr}};pc.boolTag=dc});var qt=y(mc=>{"use strict";function zp({format:e,minFractionDigits:t,tag:i,value:s}){if(typeof s=="bigint")return String(s);let n=typeof s=="number"?s:Number(s);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!i||i==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=t-(r.length-o-1);for(;a-- >0;)r+="0"}return r}mc.stringifyNumber=zp});var xr=y(Us=>{"use strict";var Yp=B(),$r=qt(),Gp={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]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$r.stringifyNumber},Wp={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():$r.stringifyNumber(e)}},Hp={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 Yp.Scalar(parseFloat(e)),i=e.indexOf(".");return i!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-i-1),t},stringify:$r.stringifyNumber};Us.float=Hp;Us.floatExp=Wp;Us.floatNaN=Gp});var Br=y(Ys=>{"use strict";var gc=qt(),zs=e=>typeof e=="bigint"||Number.isInteger(e),qr=(e,t,i,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),i);function yc(e,t,i){let{value:s}=e;return zs(s)&&s>=0?i+s.toString(t):gc.stringifyNumber(e)}var Vp={identify:e=>zs(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,i)=>qr(e,2,8,i),stringify:e=>yc(e,8,"0o")},Jp={identify:zs,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,i)=>qr(e,0,10,i),stringify:gc.stringifyNumber},Zp={identify:e=>zs(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,i)=>qr(e,2,16,i),stringify:e=>yc(e,16,"0x")};Ys.int=Jp;Ys.intHex=Zp;Ys.intOct=Vp});var wc=y(bc=>{"use strict";var Xp=$t(),Qp=Ks(),em=xt(),tm=wi(),im=Dr(),Fr=xr(),jr=Br(),sm=[Xp.map,em.seq,tm.string,Qp.nullTag,im.boolTag,jr.intOct,jr.int,jr.intHex,Fr.floatNaN,Fr.floatExp,Fr.float];bc.schema=sm});var Ec=y(vc=>{"use strict";var nm=B(),rm=$t(),om=xt();function Sc(e){return typeof e=="bigint"||Number.isInteger(e)}var Gs=({value:e})=>JSON.stringify(e),am=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Gs},{identify:e=>e==null,createNode:()=>new nm.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Gs},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Gs},{identify:Sc,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:i})=>i?BigInt(e):parseInt(e,10),stringify:({value:e})=>Sc(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:Gs}],lm={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},cm=[rm.map,om.seq].concat(am,lm);vc.schema=cm});var Ur=y(kc=>{"use strict";var Si=require("buffer"),Kr=B(),hm=pi(),um={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Si.Buffer=="function")return Si.Buffer.from(e,"base64");if(typeof atob=="function"){let i=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(i.length);for(let n=0;n{"use strict";var Ws=I(),zr=Ke(),fm=B(),dm=Ye();function Oc(e,t){if(Ws.isSeq(e))for(let i=0;i1&&t("Each pair must have its own sequence indicator");let n=s.items[0]||new zr.Pair(new fm.Scalar(null));if(s.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${s.commentBefore} +${n}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function Bs({indent:e,options:{commentString:t}},i,s,n){if(s&&n&&(s=s.replace(/^\n+/,"")),s){let r=qs.indentComment(t(s),e);i.push(r.trimStart())}}nc.stringifyCollection=Ap});var Ye=y(Mr=>{"use strict";var Pp=Lr(),Ip=Ir(),Tp=As(),ze=I(),Fs=Ue(),Lp=B();function wi(e,t){let i=ze.isScalar(t)?t.value:t;for(let s of e)if(ze.isPair(s)&&(s.key===t||s.key===i||ze.isScalar(s.key)&&s.key.value===i))return s}var Cr=class extends Tp.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(ze.MAP,t),this.items=[]}static from(t,i,s){let{keepUndefined:n,replacer:r}=s,o=new this(t),a=(l,c)=>{if(typeof r=="function")c=r.call(i,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||n)&&o.items.push(Fs.createPair(l,c,s))};if(i instanceof Map)for(let[l,c]of i)a(l,c);else if(i&&typeof i=="object")for(let l of Object.keys(i))a(l,i[l]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,i){let s;ze.isPair(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new Fs.Pair(t,t?.value):s=new Fs.Pair(t.key,t.value);let n=wi(this.items,s.key),r=this.schema?.sortMapEntries;if(n){if(!i)throw new Error(`Key ${s.key} already set`);ze.isScalar(n.value)&&Lp.isScalarValue(s.value)?n.value.value=s.value:n.value=s.value}else if(r){let o=this.items.findIndex(a=>r(s,a)<0);o===-1?this.items.push(s):this.items.splice(o,0,s)}else this.items.push(s)}delete(t){let i=wi(this.items,t);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(t,i){let n=wi(this.items,t)?.value;return(!i&&ze.isScalar(n)?n.value:n)??void 0}has(t){return!!wi(this.items,t)}set(t,i){this.add(new Fs.Pair(t,i),!0)}toJSON(t,i,s){let n=s?new s:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(n);for(let r of this.items)Ip.addPairToJSMap(i,n,r);return n}toString(t,i,s){if(!t)return JSON.stringify(this);for(let n of this.items)if(!ze.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),Pp.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:i})}};Mr.YAMLMap=Cr;Mr.findPair=wi});var xt=y(oc=>{"use strict";var Cp=I(),rc=Ye(),Mp={collection:"map",default:!0,nodeClass:rc.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return Cp.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,i)=>rc.YAMLMap.from(e,t,i)};oc.map=Mp});var Ge=y(ac=>{"use strict";var Dp=ui(),$p=Lr(),xp=As(),Ks=I(),qp=B(),Bp=Be(),Dr=class extends xp.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Ks.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let i=js(t);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(t,i){let s=js(t);if(typeof s!="number")return;let n=this.items[s];return!i&&Ks.isScalar(n)?n.value:n}has(t){let i=js(t);return typeof i=="number"&&i=0?t:null}ac.YAMLSeq=Dr});var qt=y(cc=>{"use strict";var Fp=I(),lc=Ge(),jp={collection:"seq",default:!0,nodeClass:lc.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Fp.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,i)=>lc.YAMLSeq.from(e,t,i)};cc.seq=jp});var Si=y(hc=>{"use strict";var Kp=mi(),Up={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,i,s){return t=Object.assign({actualString:!0},t),Kp.stringifyString(e,t,i,s)}};hc.string=Up});var Us=y(dc=>{"use strict";var uc=B(),fc={identify:e=>e==null,createNode:()=>new uc.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new uc.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&fc.test.test(e)?e:t.options.nullStr};dc.nullTag=fc});var $r=y(mc=>{"use strict";var zp=B(),pc={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new zp.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},i){if(e&&pc.test.test(e)){let s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?i.options.trueStr:i.options.falseStr}};mc.boolTag=pc});var Bt=y(gc=>{"use strict";function Yp({format:e,minFractionDigits:t,tag:i,value:s}){if(typeof s=="bigint")return String(s);let n=typeof s=="number"?s:Number(s);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!i||i==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=t-(r.length-o-1);for(;a-- >0;)r+="0"}return r}gc.stringifyNumber=Yp});var qr=y(zs=>{"use strict";var Gp=B(),xr=Bt(),Wp={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]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:xr.stringifyNumber},Hp={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():xr.stringifyNumber(e)}},Vp={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 Gp.Scalar(parseFloat(e)),i=e.indexOf(".");return i!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-i-1),t},stringify:xr.stringifyNumber};zs.float=Vp;zs.floatExp=Hp;zs.floatNaN=Wp});var Fr=y(Gs=>{"use strict";var yc=Bt(),Ys=e=>typeof e=="bigint"||Number.isInteger(e),Br=(e,t,i,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),i);function bc(e,t,i){let{value:s}=e;return Ys(s)&&s>=0?i+s.toString(t):yc.stringifyNumber(e)}var Jp={identify:e=>Ys(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,i)=>Br(e,2,8,i),stringify:e=>bc(e,8,"0o")},Zp={identify:Ys,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,i)=>Br(e,0,10,i),stringify:yc.stringifyNumber},Xp={identify:e=>Ys(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,i)=>Br(e,2,16,i),stringify:e=>bc(e,16,"0x")};Gs.int=Zp;Gs.intHex=Xp;Gs.intOct=Jp});var Sc=y(wc=>{"use strict";var Qp=xt(),em=Us(),tm=qt(),im=Si(),sm=$r(),jr=qr(),Kr=Fr(),nm=[Qp.map,tm.seq,im.string,em.nullTag,sm.boolTag,Kr.intOct,Kr.int,Kr.intHex,jr.floatNaN,jr.floatExp,jr.float];wc.schema=nm});var kc=y(Ec=>{"use strict";var rm=B(),om=xt(),am=qt();function vc(e){return typeof e=="bigint"||Number.isInteger(e)}var Ws=({value:e})=>JSON.stringify(e),lm=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Ws},{identify:e=>e==null,createNode:()=>new rm.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ws},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Ws},{identify:vc,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:i})=>i?BigInt(e):parseInt(e,10),stringify:({value:e})=>vc(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:Ws}],cm={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},hm=[om.map,am.seq].concat(lm,cm);Ec.schema=hm});var zr=y(Oc=>{"use strict";var vi=require("buffer"),Ur=B(),um=mi(),fm={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof vi.Buffer=="function")return vi.Buffer.from(e,"base64");if(typeof atob=="function"){let i=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(i.length);for(let n=0;n{"use strict";var Hs=I(),Yr=Ue(),dm=B(),pm=Ge();function _c(e,t){if(Hs.isSeq(e))for(let i=0;i1&&t("Each pair must have its own sequence indicator");let n=s.items[0]||new Yr.Pair(new dm.Scalar(null));if(s.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${s.commentBefore} ${n.key.commentBefore}`:s.commentBefore),s.comment){let r=n.value??n.key;r.comment=r.comment?`${s.comment} -${r.comment}`:s.comment}s=n}e.items[i]=Ws.isPair(s)?s:new zr.Pair(s)}}else t("Expected a sequence for this tag");return e}function _c(e,t,i){let{replacer:s}=i,n=new dm.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;n.items.push(zr.createPair(a,l,i))}return n}var pm={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Oc,createNode:_c};Hs.createPairs=_c;Hs.pairs=pm;Hs.resolvePairs=Oc});var Wr=y(Gr=>{"use strict";var Ac=I(),Yr=qe(),vi=ze(),mm=Ye(),Nc=Vs(),ct=class e extends mm.YAMLSeq{constructor(){super(),this.add=vi.YAMLMap.prototype.add.bind(this),this.delete=vi.YAMLMap.prototype.delete.bind(this),this.get=vi.YAMLMap.prototype.get.bind(this),this.has=vi.YAMLMap.prototype.has.bind(this),this.set=vi.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,i){if(!i)return super.toJSON(t);let s=new Map;i?.onCreate&&i.onCreate(s);for(let n of this.items){let r,o;if(Ac.isPair(n)?(r=Yr.toJS(n.key,"",i),o=Yr.toJS(n.value,r,i)):r=Yr.toJS(n,"",i),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(t,i,s){let n=Nc.createPairs(t,i,s),r=new this;return r.items=n.items,r}};ct.tag="tag:yaml.org,2002:omap";var gm={collection:"seq",identify:e=>e instanceof Map,nodeClass:ct,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let i=Nc.resolvePairs(e,t),s=[];for(let{key:n}of i.items)Ac.isScalar(n)&&(s.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):s.push(n.value));return Object.assign(new ct,i)},createNode:(e,t,i)=>ct.from(e,t,i)};Gr.YAMLOMap=ct;Gr.omap=gm});var Lc=y(Hr=>{"use strict";var Rc=B();function Pc({value:e,source:t},i){return t&&(e?Ic:Tc).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}var Ic={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 Rc.Scalar(!0),stringify:Pc},Tc={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 Rc.Scalar(!1),stringify:Pc};Hr.falseTag=Tc;Hr.trueTag=Ic});var Cc=y(Js=>{"use strict";var ym=B(),Vr=qt(),bm={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]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Vr.stringifyNumber},wm={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():Vr.stringifyNumber(e)}},Sm={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 ym.Scalar(parseFloat(e.replace(/_/g,""))),i=e.indexOf(".");if(i!==-1){let s=e.substring(i+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:Vr.stringifyNumber};Js.float=Sm;Js.floatExp=wm;Js.floatNaN=bm});var Dc=y(ki=>{"use strict";var Mc=qt(),Ei=e=>typeof e=="bigint"||Number.isInteger(e);function Zs(e,t,i,{intAsBigInt:s}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(i){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return n==="-"?BigInt(-1)*o:o}let r=parseInt(e,i);return n==="-"?-1*r:r}function Jr(e,t,i){let{value:s}=e;if(Ei(s)){let n=s.toString(t);return s<0?"-"+i+n.substr(1):i+n}return Mc.stringifyNumber(e)}var vm={identify:Ei,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,i)=>Zs(e,2,2,i),stringify:e=>Jr(e,2,"0b")},Em={identify:Ei,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,i)=>Zs(e,1,8,i),stringify:e=>Jr(e,8,"0")},km={identify:Ei,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,i)=>Zs(e,0,10,i),stringify:Mc.stringifyNumber},Om={identify:Ei,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,i)=>Zs(e,2,16,i),stringify:e=>Jr(e,16,"0x")};ki.int=km;ki.intBin=vm;ki.intHex=Om;ki.intOct=Em});var Xr=y(Zr=>{"use strict";var en=I(),Xs=Ke(),Qs=ze(),ht=class e extends Qs.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let i;en.isPair(t)?i=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?i=new Xs.Pair(t.key,null):i=new Xs.Pair(t,null),Qs.findPair(this.items,i.key)||this.items.push(i)}get(t,i){let s=Qs.findPair(this.items,t);return!i&&en.isPair(s)?en.isScalar(s.key)?s.key.value:s.key:s}set(t,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let s=Qs.findPair(this.items,t);s&&!i?this.items.splice(this.items.indexOf(s),1):!s&&i&&this.items.push(new Xs.Pair(t))}toJSON(t,i){return super.toJSON(t,i,Set)}toString(t,i,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),i,s);throw new Error("Set items must all have null values")}static from(t,i,s){let{replacer:n}=s,r=new this(t);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof n=="function"&&(o=n.call(i,o,o)),r.items.push(Xs.createPair(o,null,s));return r}};ht.tag="tag:yaml.org,2002:set";var _m={collection:"map",identify:e=>e instanceof Set,nodeClass:ht,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,i)=>ht.from(e,t,i),resolve(e,t){if(en.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new ht,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Zr.YAMLSet=ht;Zr.set=_m});var eo=y(tn=>{"use strict";var Am=qt();function Qr(e,t){let i=e[0],s=i==="-"||i==="+"?e.substring(1):e,n=o=>t?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,a)=>o*n(60)+n(a),n(0));return i==="-"?n(-1)*r:r}function $c(e){let{value:t}=e,i=o=>o;if(typeof t=="bigint")i=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Am.stringifyNumber(e);let s="";t<0&&(s="-",t*=i(-1));let n=i(60),r=[t%n];return t<60?r.unshift(0):(t=(t-r[0])/n,r.unshift(t%n),t>=60&&(t=(t-r[0])/n,r.unshift(t))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Nm={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:i})=>Qr(e,i),stringify:$c},Rm={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=>Qr(e,!1),stringify:$c},xc={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(xc.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,s,n,r,o,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(i,s-1,n,r||0,o||0,a||0,l),h=t[8];if(h&&h!=="Z"){let u=Qr(h,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};tn.floatTime=Rm;tn.intTime=Nm;tn.timestamp=xc});var Fc=y(Bc=>{"use strict";var Pm=$t(),Im=Ks(),Tm=xt(),Lm=wi(),Cm=Ur(),qc=Lc(),to=Cc(),sn=Dc(),Mm=Ms(),Dm=Wr(),$m=Vs(),xm=Xr(),io=eo(),qm=[Pm.map,Tm.seq,Lm.string,Im.nullTag,qc.trueTag,qc.falseTag,sn.intBin,sn.intOct,sn.int,sn.intHex,to.floatNaN,to.floatExp,to.float,Cm.binary,Mm.merge,Dm.omap,$m.pairs,xm.set,io.intTime,io.floatTime,io.timestamp];Bc.schema=qm});var Jc=y(ro=>{"use strict";var zc=$t(),Bm=Ks(),Yc=xt(),Fm=wi(),jm=Dr(),so=xr(),no=Br(),Km=wc(),Um=Ec(),Gc=Ur(),Oi=Ms(),Wc=Wr(),Hc=Vs(),jc=Fc(),Vc=Xr(),nn=eo(),Kc=new Map([["core",Km.schema],["failsafe",[zc.map,Yc.seq,Fm.string]],["json",Um.schema],["yaml11",jc.schema],["yaml-1.1",jc.schema]]),Uc={binary:Gc.binary,bool:jm.boolTag,float:so.float,floatExp:so.floatExp,floatNaN:so.floatNaN,floatTime:nn.floatTime,int:no.int,intHex:no.intHex,intOct:no.intOct,intTime:nn.intTime,map:zc.map,merge:Oi.merge,null:Bm.nullTag,omap:Wc.omap,pairs:Hc.pairs,seq:Yc.seq,set:Vc.set,timestamp:nn.timestamp},zm={"tag:yaml.org,2002:binary":Gc.binary,"tag:yaml.org,2002:merge":Oi.merge,"tag:yaml.org,2002:omap":Wc.omap,"tag:yaml.org,2002:pairs":Hc.pairs,"tag:yaml.org,2002:set":Vc.set,"tag:yaml.org,2002:timestamp":nn.timestamp};function Ym(e,t,i){let s=Kc.get(t);if(s&&!e)return i&&!s.includes(Oi.merge)?s.concat(Oi.merge):s.slice();let n=s;if(!n)if(Array.isArray(e))n=[];else{let r=Array.from(Kc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(let r of e)n=n.concat(r);else typeof e=="function"&&(n=e(n.slice()));return i&&(n=n.concat(Oi.merge)),n.reduce((r,o)=>{let a=typeof o=="string"?Uc[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Uc).map(h=>JSON.stringify(h)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}ro.coreKnownTags=zm;ro.getTags=Ym});var lo=y(Zc=>{"use strict";var oo=I(),Gm=$t(),Wm=xt(),Hm=wi(),rn=Jc(),Vm=(e,t)=>e.keyt.key?1:0,ao=class e{constructor({compat:t,customTags:i,merge:s,resolveKnownTags:n,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?rn.getTags(t,"compat"):t?rn.getTags(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=n?rn.coreKnownTags:{},this.tags=rn.getTags(i,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,oo.MAP,{value:Gm.map}),Object.defineProperty(this,oo.SCALAR,{value:Hm.string}),Object.defineProperty(this,oo.SEQ,{value:Wm.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Vm:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Zc.Schema=ao});var Qc=y(Xc=>{"use strict";var Jm=I(),co=mi(),_i=ui();function Zm(e,t){let i=[],s=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(i.push(l),s=!0):e.directives.docStart&&(s=!0)}s&&i.push("---");let n=co.createStringifyContext(e,t),{commentString:r}=n.options;if(e.commentBefore){i.length!==1&&i.unshift("");let l=r(e.commentBefore);i.unshift(_i.indentComment(l,""))}let o=!1,a=null;if(e.contents){if(Jm.isNode(e.contents)){if(e.contents.spaceBefore&&s&&i.push(""),e.contents.commentBefore){let h=r(e.contents.commentBefore);i.push(_i.indentComment(h,""))}n.forceBlockIndent=!!e.comment,a=e.contents.comment}let l=a?void 0:()=>o=!0,c=co.stringify(e.contents,n,()=>a=null,l);a&&(c+=_i.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${c}`:i.push(c)}else i.push(co.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let l=r(e.comment);l.includes(` -`)?(i.push("..."),i.push(_i.indentComment(l,""))):i.push(`... ${l}`)}else i.push("...");else{let l=e.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&i[i.length-1]!==""&&i.push(""),i.push(_i.indentComment(r(l),"")))}return i.join(` +${r.comment}`:s.comment}s=n}e.items[i]=Hs.isPair(s)?s:new Yr.Pair(s)}}else t("Expected a sequence for this tag");return e}function Ac(e,t,i){let{replacer:s}=i,n=new pm.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;n.items.push(Yr.createPair(a,l,i))}return n}var mm={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:_c,createNode:Ac};Vs.createPairs=Ac;Vs.pairs=mm;Vs.resolvePairs=_c});var Hr=y(Wr=>{"use strict";var Nc=I(),Gr=Be(),Ei=Ye(),gm=Ge(),Rc=Js(),ht=class e extends gm.YAMLSeq{constructor(){super(),this.add=Ei.YAMLMap.prototype.add.bind(this),this.delete=Ei.YAMLMap.prototype.delete.bind(this),this.get=Ei.YAMLMap.prototype.get.bind(this),this.has=Ei.YAMLMap.prototype.has.bind(this),this.set=Ei.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,i){if(!i)return super.toJSON(t);let s=new Map;i?.onCreate&&i.onCreate(s);for(let n of this.items){let r,o;if(Nc.isPair(n)?(r=Gr.toJS(n.key,"",i),o=Gr.toJS(n.value,r,i)):r=Gr.toJS(n,"",i),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(t,i,s){let n=Rc.createPairs(t,i,s),r=new this;return r.items=n.items,r}};ht.tag="tag:yaml.org,2002:omap";var ym={collection:"seq",identify:e=>e instanceof Map,nodeClass:ht,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let i=Rc.resolvePairs(e,t),s=[];for(let{key:n}of i.items)Nc.isScalar(n)&&(s.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):s.push(n.value));return Object.assign(new ht,i)},createNode:(e,t,i)=>ht.from(e,t,i)};Wr.YAMLOMap=ht;Wr.omap=ym});var Cc=y(Vr=>{"use strict";var Pc=B();function Ic({value:e,source:t},i){return t&&(e?Tc:Lc).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}var Tc={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 Pc.Scalar(!0),stringify:Ic},Lc={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 Pc.Scalar(!1),stringify:Ic};Vr.falseTag=Lc;Vr.trueTag=Tc});var Mc=y(Zs=>{"use strict";var bm=B(),Jr=Bt(),wm={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]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Jr.stringifyNumber},Sm={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():Jr.stringifyNumber(e)}},vm={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 bm.Scalar(parseFloat(e.replace(/_/g,""))),i=e.indexOf(".");if(i!==-1){let s=e.substring(i+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:Jr.stringifyNumber};Zs.float=vm;Zs.floatExp=Sm;Zs.floatNaN=wm});var $c=y(Oi=>{"use strict";var Dc=Bt(),ki=e=>typeof e=="bigint"||Number.isInteger(e);function Xs(e,t,i,{intAsBigInt:s}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(i){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return n==="-"?BigInt(-1)*o:o}let r=parseInt(e,i);return n==="-"?-1*r:r}function Zr(e,t,i){let{value:s}=e;if(ki(s)){let n=s.toString(t);return s<0?"-"+i+n.substr(1):i+n}return Dc.stringifyNumber(e)}var Em={identify:ki,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,i)=>Xs(e,2,2,i),stringify:e=>Zr(e,2,"0b")},km={identify:ki,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,i)=>Xs(e,1,8,i),stringify:e=>Zr(e,8,"0")},Om={identify:ki,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,i)=>Xs(e,0,10,i),stringify:Dc.stringifyNumber},_m={identify:ki,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,i)=>Xs(e,2,16,i),stringify:e=>Zr(e,16,"0x")};Oi.int=Om;Oi.intBin=Em;Oi.intHex=_m;Oi.intOct=km});var Qr=y(Xr=>{"use strict";var tn=I(),Qs=Ue(),en=Ye(),ut=class e extends en.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let i;tn.isPair(t)?i=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?i=new Qs.Pair(t.key,null):i=new Qs.Pair(t,null),en.findPair(this.items,i.key)||this.items.push(i)}get(t,i){let s=en.findPair(this.items,t);return!i&&tn.isPair(s)?tn.isScalar(s.key)?s.key.value:s.key:s}set(t,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let s=en.findPair(this.items,t);s&&!i?this.items.splice(this.items.indexOf(s),1):!s&&i&&this.items.push(new Qs.Pair(t))}toJSON(t,i){return super.toJSON(t,i,Set)}toString(t,i,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),i,s);throw new Error("Set items must all have null values")}static from(t,i,s){let{replacer:n}=s,r=new this(t);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof n=="function"&&(o=n.call(i,o,o)),r.items.push(Qs.createPair(o,null,s));return r}};ut.tag="tag:yaml.org,2002:set";var Am={collection:"map",identify:e=>e instanceof Set,nodeClass:ut,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,i)=>ut.from(e,t,i),resolve(e,t){if(tn.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new ut,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Xr.YAMLSet=ut;Xr.set=Am});var to=y(sn=>{"use strict";var Nm=Bt();function eo(e,t){let i=e[0],s=i==="-"||i==="+"?e.substring(1):e,n=o=>t?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,a)=>o*n(60)+n(a),n(0));return i==="-"?n(-1)*r:r}function xc(e){let{value:t}=e,i=o=>o;if(typeof t=="bigint")i=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Nm.stringifyNumber(e);let s="";t<0&&(s="-",t*=i(-1));let n=i(60),r=[t%n];return t<60?r.unshift(0):(t=(t-r[0])/n,r.unshift(t%n),t>=60&&(t=(t-r[0])/n,r.unshift(t))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Rm={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:i})=>eo(e,i),stringify:xc},Pm={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=>eo(e,!1),stringify:xc},qc={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(qc.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,s,n,r,o,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(i,s-1,n,r||0,o||0,a||0,l),h=t[8];if(h&&h!=="Z"){let u=eo(h,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};sn.floatTime=Pm;sn.intTime=Rm;sn.timestamp=qc});var jc=y(Fc=>{"use strict";var Im=xt(),Tm=Us(),Lm=qt(),Cm=Si(),Mm=zr(),Bc=Cc(),io=Mc(),nn=$c(),Dm=Ds(),$m=Hr(),xm=Js(),qm=Qr(),so=to(),Bm=[Im.map,Lm.seq,Cm.string,Tm.nullTag,Bc.trueTag,Bc.falseTag,nn.intBin,nn.intOct,nn.int,nn.intHex,io.floatNaN,io.floatExp,io.float,Mm.binary,Dm.merge,$m.omap,xm.pairs,qm.set,so.intTime,so.floatTime,so.timestamp];Fc.schema=Bm});var Zc=y(oo=>{"use strict";var Yc=xt(),Fm=Us(),Gc=qt(),jm=Si(),Km=$r(),no=qr(),ro=Fr(),Um=Sc(),zm=kc(),Wc=zr(),_i=Ds(),Hc=Hr(),Vc=Js(),Kc=jc(),Jc=Qr(),rn=to(),Uc=new Map([["core",Um.schema],["failsafe",[Yc.map,Gc.seq,jm.string]],["json",zm.schema],["yaml11",Kc.schema],["yaml-1.1",Kc.schema]]),zc={binary:Wc.binary,bool:Km.boolTag,float:no.float,floatExp:no.floatExp,floatNaN:no.floatNaN,floatTime:rn.floatTime,int:ro.int,intHex:ro.intHex,intOct:ro.intOct,intTime:rn.intTime,map:Yc.map,merge:_i.merge,null:Fm.nullTag,omap:Hc.omap,pairs:Vc.pairs,seq:Gc.seq,set:Jc.set,timestamp:rn.timestamp},Ym={"tag:yaml.org,2002:binary":Wc.binary,"tag:yaml.org,2002:merge":_i.merge,"tag:yaml.org,2002:omap":Hc.omap,"tag:yaml.org,2002:pairs":Vc.pairs,"tag:yaml.org,2002:set":Jc.set,"tag:yaml.org,2002:timestamp":rn.timestamp};function Gm(e,t,i){let s=Uc.get(t);if(s&&!e)return i&&!s.includes(_i.merge)?s.concat(_i.merge):s.slice();let n=s;if(!n)if(Array.isArray(e))n=[];else{let r=Array.from(Uc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(let r of e)n=n.concat(r);else typeof e=="function"&&(n=e(n.slice()));return i&&(n=n.concat(_i.merge)),n.reduce((r,o)=>{let a=typeof o=="string"?zc[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(zc).map(h=>JSON.stringify(h)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}oo.coreKnownTags=Ym;oo.getTags=Gm});var co=y(Xc=>{"use strict";var ao=I(),Wm=xt(),Hm=qt(),Vm=Si(),on=Zc(),Jm=(e,t)=>e.keyt.key?1:0,lo=class e{constructor({compat:t,customTags:i,merge:s,resolveKnownTags:n,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?on.getTags(t,"compat"):t?on.getTags(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=n?on.coreKnownTags:{},this.tags=on.getTags(i,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,ao.MAP,{value:Wm.map}),Object.defineProperty(this,ao.SCALAR,{value:Vm.string}),Object.defineProperty(this,ao.SEQ,{value:Hm.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Jm:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Xc.Schema=lo});var eh=y(Qc=>{"use strict";var Zm=I(),ho=gi(),Ai=fi();function Xm(e,t){let i=[],s=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(i.push(l),s=!0):e.directives.docStart&&(s=!0)}s&&i.push("---");let n=ho.createStringifyContext(e,t),{commentString:r}=n.options;if(e.commentBefore){i.length!==1&&i.unshift("");let l=r(e.commentBefore);i.unshift(Ai.indentComment(l,""))}let o=!1,a=null;if(e.contents){if(Zm.isNode(e.contents)){if(e.contents.spaceBefore&&s&&i.push(""),e.contents.commentBefore){let h=r(e.contents.commentBefore);i.push(Ai.indentComment(h,""))}n.forceBlockIndent=!!e.comment,a=e.contents.comment}let l=a?void 0:()=>o=!0,c=ho.stringify(e.contents,n,()=>a=null,l);a&&(c+=Ai.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${c}`:i.push(c)}else i.push(ho.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let l=r(e.comment);l.includes(` +`)?(i.push("..."),i.push(Ai.indentComment(l,""))):i.push(`... ${l}`)}else i.push("...");else{let l=e.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&i[i.length-1]!==""&&i.push(""),i.push(Ai.indentComment(r(l),"")))}return i.join(` `)+` -`}Xc.stringifyDocument=Zm});var Ai=y(eh=>{"use strict";var Xm=ci(),Bt=_s(),oe=I(),Qm=Ke(),eg=qe(),tg=lo(),ig=Qc(),ho=vs(),sg=pr(),ng=hi(),uo=dr(),fo=class e{constructor(t,i,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,oe.NODE_TYPE,{value:oe.DOC});let n=null;typeof i=="function"||Array.isArray(i)?n=i:s===void 0&&i&&(s=i,i=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:o}=r;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new uo.Directives({version:o}),this.setSchema(o,s),this.contents=t===void 0?null:this.createNode(t,n,s)}clone(){let t=Object.create(e.prototype,{[oe.NODE_TYPE]:{value:oe.DOC}});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=oe.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Ft(this.contents)&&this.contents.add(t)}addIn(t,i){Ft(this.contents)&&this.contents.addIn(t,i)}createAlias(t,i){if(!t.anchor){let s=ho.anchorNames(this);t.anchor=!i||s.has(i)?ho.findNewAnchor(i||"a",s):i}return new Xm.Alias(t.anchor)}createNode(t,i,s){let n;if(typeof i=="function")t=i.call({"":t},"",t),n=i;else if(Array.isArray(i)){let m=E=>typeof E=="number"||E instanceof String||E instanceof Number,w=i.filter(m).map(String);w.length>0&&(i=i.concat(w)),n=i}else s===void 0&&i&&(s=i,i=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:h}=s??{},{onAnchor:u,setAnchors:f,sourceObjects:p}=ho.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:p},d=ng.createNode(t,h,g);return a&&oe.isCollection(d)&&(d.flow=!0),f(),d}createPair(t,i,s={}){let n=this.createNode(t,null,s),r=this.createNode(i,null,s);return new Qm.Pair(n,r)}delete(t){return Ft(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Bt.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):Ft(this.contents)?this.contents.deleteIn(t):!1}get(t,i){return oe.isCollection(this.contents)?this.contents.get(t,i):void 0}getIn(t,i){return Bt.isEmptyPath(t)?!i&&oe.isScalar(this.contents)?this.contents.value:this.contents:oe.isCollection(this.contents)?this.contents.getIn(t,i):void 0}has(t){return oe.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return Bt.isEmptyPath(t)?this.contents!==void 0:oe.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,i){this.contents==null?this.contents=Bt.collectionFromPath(this.schema,[t],i):Ft(this.contents)&&this.contents.set(t,i)}setIn(t,i){Bt.isEmptyPath(t)?this.contents=i:this.contents==null?this.contents=Bt.collectionFromPath(this.schema,Array.from(t),i):Ft(this.contents)&&this.contents.setIn(t,i)}setSchema(t,i={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new uo.Directives({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new uo.Directives({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let n=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(s)this.schema=new tg.Schema(Object.assign(s,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:i,mapAsMap:s,maxAliasCount:n,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=eg.toJS(this.contents,i??"",a);if(typeof r=="function")for(let{count:c,res:h}of a.anchors.values())r(h,c);return typeof o=="function"?sg.applyReviver(o,{"":l},"",l):l}toJSON(t,i){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:i})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let i=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return ig.stringifyDocument(this,t)}};function Ft(e){if(oe.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}eh.Document=fo});var Pi=y(Ri=>{"use strict";var Ni=class extends Error{constructor(t,i,s,n){super(),this.name=t,this.code=s,this.message=n,this.pos=i}},po=class extends Ni{constructor(t,i,s){super("YAMLParseError",t,i,s)}},mo=class extends Ni{constructor(t,i,s){super("YAMLWarning",t,i,s)}},rg=(e,t)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(a=>t.linePos(a));let{line:s,col:n}=i.linePos[0];i.message+=` at line ${s}, column ${n}`;let r=n-1,o=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),s>1&&/^ *$/.test(o.substring(0,r))){let a=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`}Qc.stringifyDocument=Xm});var Ni=y(th=>{"use strict";var Qm=hi(),Ft=As(),oe=I(),eg=Ue(),tg=Be(),ig=co(),sg=eh(),uo=Es(),ng=mr(),rg=ui(),fo=pr(),po=class e{constructor(t,i,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,oe.NODE_TYPE,{value:oe.DOC});let n=null;typeof i=="function"||Array.isArray(i)?n=i:s===void 0&&i&&(s=i,i=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:o}=r;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new fo.Directives({version:o}),this.setSchema(o,s),this.contents=t===void 0?null:this.createNode(t,n,s)}clone(){let t=Object.create(e.prototype,{[oe.NODE_TYPE]:{value:oe.DOC}});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=oe.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){jt(this.contents)&&this.contents.add(t)}addIn(t,i){jt(this.contents)&&this.contents.addIn(t,i)}createAlias(t,i){if(!t.anchor){let s=uo.anchorNames(this);t.anchor=!i||s.has(i)?uo.findNewAnchor(i||"a",s):i}return new Qm.Alias(t.anchor)}createNode(t,i,s){let n;if(typeof i=="function")t=i.call({"":t},"",t),n=i;else if(Array.isArray(i)){let m=E=>typeof E=="number"||E instanceof String||E instanceof Number,w=i.filter(m).map(String);w.length>0&&(i=i.concat(w)),n=i}else s===void 0&&i&&(s=i,i=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:h}=s??{},{onAnchor:u,setAnchors:f,sourceObjects:p}=uo.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:p},d=rg.createNode(t,h,g);return a&&oe.isCollection(d)&&(d.flow=!0),f(),d}createPair(t,i,s={}){let n=this.createNode(t,null,s),r=this.createNode(i,null,s);return new eg.Pair(n,r)}delete(t){return jt(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Ft.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):jt(this.contents)?this.contents.deleteIn(t):!1}get(t,i){return oe.isCollection(this.contents)?this.contents.get(t,i):void 0}getIn(t,i){return Ft.isEmptyPath(t)?!i&&oe.isScalar(this.contents)?this.contents.value:this.contents:oe.isCollection(this.contents)?this.contents.getIn(t,i):void 0}has(t){return oe.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return Ft.isEmptyPath(t)?this.contents!==void 0:oe.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,i){this.contents==null?this.contents=Ft.collectionFromPath(this.schema,[t],i):jt(this.contents)&&this.contents.set(t,i)}setIn(t,i){Ft.isEmptyPath(t)?this.contents=i:this.contents==null?this.contents=Ft.collectionFromPath(this.schema,Array.from(t),i):jt(this.contents)&&this.contents.setIn(t,i)}setSchema(t,i={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new fo.Directives({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new fo.Directives({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let n=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(s)this.schema=new ig.Schema(Object.assign(s,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:i,mapAsMap:s,maxAliasCount:n,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=tg.toJS(this.contents,i??"",a);if(typeof r=="function")for(let{count:c,res:h}of a.anchors.values())r(h,c);return typeof o=="function"?ng.applyReviver(o,{"":l},"",l):l}toJSON(t,i){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:i})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let i=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return sg.stringifyDocument(this,t)}};function jt(e){if(oe.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}th.Document=po});var Ii=y(Pi=>{"use strict";var Ri=class extends Error{constructor(t,i,s,n){super(),this.name=t,this.code=s,this.message=n,this.pos=i}},mo=class extends Ri{constructor(t,i,s){super("YAMLParseError",t,i,s)}},go=class extends Ri{constructor(t,i,s){super("YAMLWarning",t,i,s)}},og=(e,t)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(a=>t.linePos(a));let{line:s,col:n}=i.linePos[0];i.message+=` at line ${s}, column ${n}`;let r=n-1,o=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),s>1&&/^ *$/.test(o.substring(0,r))){let a=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),o=a+o}if(/[^ ]/.test(o)){let a=1,l=i.linePos[1];l?.line===s&&l.col>n&&(a=Math.max(1,Math.min(l.col-n,80-r)));let c=" ".repeat(r)+"^".repeat(a);i.message+=`: ${o} ${c} -`}};Ri.YAMLError=Ni;Ri.YAMLParseError=po;Ri.YAMLWarning=mo;Ri.prettifyError=rg});var Ii=y(th=>{"use strict";function og(e,{flow:t,indicator:i,next:s,offset:n,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,h=a,u="",f="",p=!1,g=!1,d=null,m=null,w=null,E=null,k=null,_=null,A=null;for(let v of e)switch(g&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&r(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),d&&(c&&v.type!=="comment"&&v.type!=="newline"&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),d=null),v.type){case"space":!t&&(i!=="doc-start"||s?.type!=="flow-collection")&&v.source.includes(" ")&&(d=v),h=!0;break;case"comment":{h||r(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let U=v.source.substring(1)||" ";u?u+=f+U:u=U,f="",c=!1;break}case"newline":c?u?u+=v.source:(!_||i!=="seq-item-ind")&&(l=!0):f+=v.source,c=!0,p=!0,(m||w)&&(E=v),h=!0;break;case"anchor":m&&r(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&r(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=v,A??(A=v.offset),c=!1,h=!1,g=!0;break;case"tag":{w&&r(v,"MULTIPLE_TAGS","A node can have at most one tag"),w=v,A??(A=v.offset),c=!1,h=!1,g=!0;break}case i:(m||w)&&r(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),_&&r(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${t??"collection"}`),_=v,c=i==="seq-item-ind"||i==="explicit-key-ind",h=!1;break;case"comma":if(t){k&&r(v,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),k=v,c=!1,h=!1;break}default:r(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),c=!1,h=!1}let N=e[e.length-1],C=N?N.offset+N.source.length:n;return g&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d&&(c&&d.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:_,spaceBefore:l,comment:u,hasNewline:p,anchor:m,tag:w,newlineAfterProp:E,end:C,start:A??C}}th.resolveProps=og});var on=y(ih=>{"use strict";function go(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(` -`))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 i of t.start)if(i.type==="newline")return!0;if(t.sep){for(let i of t.sep)if(i.type==="newline")return!0}if(go(t.key)||go(t.value))return!0}return!1;default:return!0}}ih.containsNewline=go});var yo=y(sh=>{"use strict";var ag=on();function lg(e,t,i){if(t?.type==="flow-collection"){let s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&ag.containsNewline(t)&&i(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}sh.flowIndentCheck=lg});var bo=y(rh=>{"use strict";var nh=I();function cg(e,t,i){let{uniqueKeys:s}=e.options;if(s===!1)return!1;let n=typeof s=="function"?s:(r,o)=>r===o||nh.isScalar(r)&&nh.isScalar(o)&&r.value===o.value;return t.some(r=>n(r.key,i))}rh.mapIncludes=cg});var uh=y(hh=>{"use strict";var oh=Ke(),hg=ze(),ah=Ii(),ug=on(),lh=yo(),fg=bo(),ch="All mapping items must start at the same column";function dg({composeNode:e,composeEmptyNode:t},i,s,n,r){let o=r?.nodeClass??hg.YAMLMap,a=new o(i.schema);i.atRoot&&(i.atRoot=!1);let l=s.offset,c=null;for(let h of s.items){let{start:u,key:f,sep:p,value:g}=h,d=ah.resolveProps(u,{indicator:"explicit-key-ind",next:f??p?.[0],offset:l,onError:n,parentIndent:s.indent,startOnNewline:!0}),m=!d.found;if(m){if(f&&(f.type==="block-seq"?n(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==s.indent&&n(l,"BAD_INDENT",ch)),!d.anchor&&!d.tag&&!p){c=d.end,d.comment&&(a.comment?a.comment+=` -`+d.comment:a.comment=d.comment);continue}(d.newlineAfterProp||ug.containsNewline(f))&&n(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else d.found?.indent!==s.indent&&n(l,"BAD_INDENT",ch);i.atKey=!0;let w=d.end,E=f?e(i,f,d,n):t(i,w,u,null,d,n);i.schema.compat&&lh.flowIndentCheck(s.indent,f,n),i.atKey=!1,fg.mapIncludes(i,a.items,E)&&n(w,"DUPLICATE_KEY","Map keys must be unique");let k=ah.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:E.range[2],onError:n,parentIndent:s.indent,startOnNewline:!f||f.type==="block-scalar"});if(l=k.end,k.found){m&&(g?.type==="block-map"&&!k.hasNewline&&n(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&d.start{"use strict";var pg=Ye(),mg=Ii(),gg=yo();function yg({composeNode:e,composeEmptyNode:t},i,s,n,r){let o=r?.nodeClass??pg.YAMLSeq,a=new o(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let l=s.offset,c=null;for(let{start:h,value:u}of s.items){let f=mg.resolveProps(h,{indicator:"seq-item-ind",next:u,offset:l,onError:n,parentIndent:s.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(l,"MISSING_CHAR","Sequence item without - indicator");else{c=f.end,f.comment&&(a.comment=f.comment);continue}let p=u?e(i,u,f,n):t(i,f.end,h,null,f,n);i.schema.compat&&gg.flowIndentCheck(s.indent,u,n),l=p.range[2],a.items.push(p)}return a.range=[s.offset,l,c??l],a}fh.resolveBlockSeq=yg});var jt=y(ph=>{"use strict";function bg(e,t,i,s){let n="";if(e){let r=!1,o="";for(let a of e){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{i&&!r&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let h=l.substring(1)||" ";n?n+=o+h:n=h,o="";break}case"newline":n&&(o+=l),r=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=l.length}}return{comment:n,offset:t}}ph.resolveEnd=bg});var bh=y(yh=>{"use strict";var wg=I(),Sg=Ke(),mh=ze(),vg=Ye(),Eg=jt(),gh=Ii(),kg=on(),Og=bo(),wo="Block collections are not allowed within flow collections",So=e=>e&&(e.type==="block-map"||e.type==="block-seq");function _g({composeNode:e,composeEmptyNode:t},i,s,n,r){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?mh.YAMLMap:vg.YAMLSeq),c=new l(i.schema);c.flow=!0;let h=i.atRoot;h&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let u=s.offset+s.start.source.length;for(let m=0;m0){let m=Eg.resolveEnd(g,d,i.options.strict,n);m.comment&&(c.comment?c.comment+=` -`+m.comment:c.comment=m.comment),c.range=[s.offset,d,m.offset]}else c.range=[s.offset,d,d];return c}yh.resolveFlowCollection=_g});var Sh=y(wh=>{"use strict";var Ag=I(),Ng=B(),Rg=ze(),Pg=Ye(),Ig=uh(),Tg=dh(),Lg=bh();function vo(e,t,i,s,n,r){let o=i.type==="block-map"?Ig.resolveBlockMap(e,t,i,s,r):i.type==="block-seq"?Tg.resolveBlockSeq(e,t,i,s,r):Lg.resolveFlowCollection(e,t,i,s,r),a=o.constructor;return n==="!"||n===a.tagName?(o.tag=a.tagName,o):(n&&(o.tag=n),o)}function Cg(e,t,i,s,n){let r=s.tag,o=r?t.directives.tagName(r.source,f=>n(r,"TAG_RESOLVE_FAILED",f)):null;if(i.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=s,g=f&&r?f.offset>r.offset?f:r:f??r;g&&(!p||p.offsetf.tag===o&&f.collection===a);if(!l){let f=t.schema.knownTags[o];if(f?.collection===a)t.schema.tags.push(Object.assign({},f,{default:!1})),l=f;else return f?n(r,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),vo(e,t,i,n,o)}let c=vo(e,t,i,n,o,l),h=l.resolve?.(c,f=>n(r,"TAG_RESOLVE_FAILED",f),t.options)??c,u=Ag.isNode(h)?h:new Ng.Scalar(h);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}wh.composeCollection=Cg});var ko=y(vh=>{"use strict";var Eo=B();function Mg(e,t,i){let s=t.offset,n=Dg(t,e.options.strict,i);if(!n)return{value:"",type:null,comment:"",range:[s,s,s]};let r=n.mode===">"?Eo.Scalar.BLOCK_FOLDED:Eo.Scalar.BLOCK_LITERAL,o=t.source?$g(t.source):[],a=o.length;for(let d=o.length-1;d>=0;--d){let m=o[d][1];if(m===""||m==="\r")a=d;else break}if(a===0){let d=n.chomp==="+"&&o.length>0?` +`}};Pi.YAMLError=Ri;Pi.YAMLParseError=mo;Pi.YAMLWarning=go;Pi.prettifyError=og});var Ti=y(ih=>{"use strict";function ag(e,{flow:t,indicator:i,next:s,offset:n,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,h=a,u="",f="",p=!1,g=!1,d=null,m=null,w=null,E=null,k=null,_=null,A=null;for(let v of e)switch(g&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&r(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),d&&(c&&v.type!=="comment"&&v.type!=="newline"&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),d=null),v.type){case"space":!t&&(i!=="doc-start"||s?.type!=="flow-collection")&&v.source.includes(" ")&&(d=v),h=!0;break;case"comment":{h||r(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let U=v.source.substring(1)||" ";u?u+=f+U:u=U,f="",c=!1;break}case"newline":c?u?u+=v.source:(!_||i!=="seq-item-ind")&&(l=!0):f+=v.source,c=!0,p=!0,(m||w)&&(E=v),h=!0;break;case"anchor":m&&r(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&r(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=v,A??(A=v.offset),c=!1,h=!1,g=!0;break;case"tag":{w&&r(v,"MULTIPLE_TAGS","A node can have at most one tag"),w=v,A??(A=v.offset),c=!1,h=!1,g=!0;break}case i:(m||w)&&r(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),_&&r(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${t??"collection"}`),_=v,c=i==="seq-item-ind"||i==="explicit-key-ind",h=!1;break;case"comma":if(t){k&&r(v,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),k=v,c=!1,h=!1;break}default:r(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),c=!1,h=!1}let N=e[e.length-1],C=N?N.offset+N.source.length:n;return g&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d&&(c&&d.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:_,spaceBefore:l,comment:u,hasNewline:p,anchor:m,tag:w,newlineAfterProp:E,end:C,start:A??C}}ih.resolveProps=ag});var an=y(sh=>{"use strict";function yo(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(` +`))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 i of t.start)if(i.type==="newline")return!0;if(t.sep){for(let i of t.sep)if(i.type==="newline")return!0}if(yo(t.key)||yo(t.value))return!0}return!1;default:return!0}}sh.containsNewline=yo});var bo=y(nh=>{"use strict";var lg=an();function cg(e,t,i){if(t?.type==="flow-collection"){let s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&lg.containsNewline(t)&&i(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}nh.flowIndentCheck=cg});var wo=y(oh=>{"use strict";var rh=I();function hg(e,t,i){let{uniqueKeys:s}=e.options;if(s===!1)return!1;let n=typeof s=="function"?s:(r,o)=>r===o||rh.isScalar(r)&&rh.isScalar(o)&&r.value===o.value;return t.some(r=>n(r.key,i))}oh.mapIncludes=hg});var fh=y(uh=>{"use strict";var ah=Ue(),ug=Ye(),lh=Ti(),fg=an(),ch=bo(),dg=wo(),hh="All mapping items must start at the same column";function pg({composeNode:e,composeEmptyNode:t},i,s,n,r){let o=r?.nodeClass??ug.YAMLMap,a=new o(i.schema);i.atRoot&&(i.atRoot=!1);let l=s.offset,c=null;for(let h of s.items){let{start:u,key:f,sep:p,value:g}=h,d=lh.resolveProps(u,{indicator:"explicit-key-ind",next:f??p?.[0],offset:l,onError:n,parentIndent:s.indent,startOnNewline:!0}),m=!d.found;if(m){if(f&&(f.type==="block-seq"?n(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==s.indent&&n(l,"BAD_INDENT",hh)),!d.anchor&&!d.tag&&!p){c=d.end,d.comment&&(a.comment?a.comment+=` +`+d.comment:a.comment=d.comment);continue}(d.newlineAfterProp||fg.containsNewline(f))&&n(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else d.found?.indent!==s.indent&&n(l,"BAD_INDENT",hh);i.atKey=!0;let w=d.end,E=f?e(i,f,d,n):t(i,w,u,null,d,n);i.schema.compat&&ch.flowIndentCheck(s.indent,f,n),i.atKey=!1,dg.mapIncludes(i,a.items,E)&&n(w,"DUPLICATE_KEY","Map keys must be unique");let k=lh.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:E.range[2],onError:n,parentIndent:s.indent,startOnNewline:!f||f.type==="block-scalar"});if(l=k.end,k.found){m&&(g?.type==="block-map"&&!k.hasNewline&&n(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&d.start{"use strict";var mg=Ge(),gg=Ti(),yg=bo();function bg({composeNode:e,composeEmptyNode:t},i,s,n,r){let o=r?.nodeClass??mg.YAMLSeq,a=new o(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let l=s.offset,c=null;for(let{start:h,value:u}of s.items){let f=gg.resolveProps(h,{indicator:"seq-item-ind",next:u,offset:l,onError:n,parentIndent:s.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(l,"MISSING_CHAR","Sequence item without - indicator");else{c=f.end,f.comment&&(a.comment=f.comment);continue}let p=u?e(i,u,f,n):t(i,f.end,h,null,f,n);i.schema.compat&&yg.flowIndentCheck(s.indent,u,n),l=p.range[2],a.items.push(p)}return a.range=[s.offset,l,c??l],a}dh.resolveBlockSeq=bg});var Kt=y(mh=>{"use strict";function wg(e,t,i,s){let n="";if(e){let r=!1,o="";for(let a of e){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{i&&!r&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let h=l.substring(1)||" ";n?n+=o+h:n=h,o="";break}case"newline":n&&(o+=l),r=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=l.length}}return{comment:n,offset:t}}mh.resolveEnd=wg});var wh=y(bh=>{"use strict";var Sg=I(),vg=Ue(),gh=Ye(),Eg=Ge(),kg=Kt(),yh=Ti(),Og=an(),_g=wo(),So="Block collections are not allowed within flow collections",vo=e=>e&&(e.type==="block-map"||e.type==="block-seq");function Ag({composeNode:e,composeEmptyNode:t},i,s,n,r){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?gh.YAMLMap:Eg.YAMLSeq),c=new l(i.schema);c.flow=!0;let h=i.atRoot;h&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let u=s.offset+s.start.source.length;for(let m=0;m0){let m=kg.resolveEnd(g,d,i.options.strict,n);m.comment&&(c.comment?c.comment+=` +`+m.comment:c.comment=m.comment),c.range=[s.offset,d,m.offset]}else c.range=[s.offset,d,d];return c}bh.resolveFlowCollection=Ag});var vh=y(Sh=>{"use strict";var Ng=I(),Rg=B(),Pg=Ye(),Ig=Ge(),Tg=fh(),Lg=ph(),Cg=wh();function Eo(e,t,i,s,n,r){let o=i.type==="block-map"?Tg.resolveBlockMap(e,t,i,s,r):i.type==="block-seq"?Lg.resolveBlockSeq(e,t,i,s,r):Cg.resolveFlowCollection(e,t,i,s,r),a=o.constructor;return n==="!"||n===a.tagName?(o.tag=a.tagName,o):(n&&(o.tag=n),o)}function Mg(e,t,i,s,n){let r=s.tag,o=r?t.directives.tagName(r.source,f=>n(r,"TAG_RESOLVE_FAILED",f)):null;if(i.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=s,g=f&&r?f.offset>r.offset?f:r:f??r;g&&(!p||p.offsetf.tag===o&&f.collection===a);if(!l){let f=t.schema.knownTags[o];if(f?.collection===a)t.schema.tags.push(Object.assign({},f,{default:!1})),l=f;else return f?n(r,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Eo(e,t,i,n,o)}let c=Eo(e,t,i,n,o,l),h=l.resolve?.(c,f=>n(r,"TAG_RESOLVE_FAILED",f),t.options)??c,u=Ng.isNode(h)?h:new Rg.Scalar(h);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}Sh.composeCollection=Mg});var Oo=y(Eh=>{"use strict";var ko=B();function Dg(e,t,i){let s=t.offset,n=$g(t,e.options.strict,i);if(!n)return{value:"",type:null,comment:"",range:[s,s,s]};let r=n.mode===">"?ko.Scalar.BLOCK_FOLDED:ko.Scalar.BLOCK_LITERAL,o=t.source?xg(t.source):[],a=o.length;for(let d=o.length-1;d>=0;--d){let m=o[d][1];if(m===""||m==="\r")a=d;else break}if(a===0){let d=n.chomp==="+"&&o.length>0?` `.repeat(Math.max(1,o.length-1)):"",m=s+n.length;return t.source&&(m+=t.source.length),{value:d,type:r,comment:n.comment,range:[s,m,m]}}let l=t.indent+n.indent,c=t.offset+n.length,h=0;for(let d=0;dl&&(l=m.length);else{m.length=a;--d)o[d][0].length>l&&(a=d+1);let u="",f="",p=!1;for(let d=0;dl||w[0]===" "?(f===" "?f=` `:!p&&f===` `&&(f=` @@ -82,97 +82,97 @@ ${c} `+o[d][0].slice(l);u[u.length-1]!==` `&&(u+=` `);break;default:u+=` -`}let g=s+n.length+t.source.length;return{value:u,type:r,comment:n.comment,range:[s,g,g]}}function Dg({offset:e,props:t},i,s){if(t[0].type!=="block-scalar-header")return s(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=t[0],r=n[0],o=0,a="",l=-1;for(let f=1;f{"use strict";var Oo=B(),xg=jt();function qg(e,t,i){let{offset:s,type:n,source:r,end:o}=e,a,l,c=(f,p,g)=>i(s+f,p,g);switch(n){case"scalar":a=Oo.Scalar.PLAIN,l=Bg(r,c);break;case"single-quoted-scalar":a=Oo.Scalar.QUOTE_SINGLE,l=Fg(r,c);break;case"double-quoted-scalar":a=Oo.Scalar.QUOTE_DOUBLE,l=jg(r,c);break;default:return i(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}let h=s+r.length,u=xg.resolveEnd(o,h,t,i);return{value:l,type:a,comment:u.comment,range:[s,h,u.offset]}}function Bg(e,t){let i="";switch(e[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${e[0]}`;break}case"@":case"`":{i=`reserved character ${e[0]}`;break}}return i&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Eh(e)}function Fg(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Eh(e.slice(1,-1)).replace(/''/g,"'")}function Eh(e){let t,i;try{t=new RegExp(`(.*?)(?{"use strict";var _o=B(),qg=Kt();function Bg(e,t,i){let{offset:s,type:n,source:r,end:o}=e,a,l,c=(f,p,g)=>i(s+f,p,g);switch(n){case"scalar":a=_o.Scalar.PLAIN,l=Fg(r,c);break;case"single-quoted-scalar":a=_o.Scalar.QUOTE_SINGLE,l=jg(r,c);break;case"double-quoted-scalar":a=_o.Scalar.QUOTE_DOUBLE,l=Kg(r,c);break;default:return i(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}let h=s+r.length,u=qg.resolveEnd(o,h,t,i);return{value:l,type:a,comment:u.comment,range:[s,h,u.offset]}}function Fg(e,t){let i="";switch(e[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${e[0]}`;break}case"@":case"`":{i=`reserved character ${e[0]}`;break}}return i&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),kh(e)}function jg(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),kh(e.slice(1,-1)).replace(/''/g,"'")}function kh(e){let t,i;try{t=new RegExp(`(.*?)(?r?e.slice(r,s+1):n)}else i+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),i}function Kg(e,t){let i="",s=e[t+1];for(;(s===" "||s===" "||s===` +`)&&(i+=s>r?e.slice(r,s+1):n)}else i+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),i}function Ug(e,t){let i="",s=e[t+1];for(;(s===" "||s===" "||s===` `||s==="\r")&&!(s==="\r"&&e[t+2]!==` `);)s===` `&&(i+=` -`),t+=1,s=e[t+1];return i||(i=" "),{fold:i,offset:t}}var Ug={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function zg(e,t,i,s){let n=e.substr(t,i),o=n.length===i&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;if(isNaN(o)){let a=e.substr(t-2,i+2);return s(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}kh.resolveFlowScalar=qg});var Ah=y(_h=>{"use strict";var ut=I(),Oh=B(),Yg=ko(),Gg=_o();function Wg(e,t,i,s){let{value:n,type:r,comment:o,range:a}=t.type==="block-scalar"?Yg.resolveBlockScalar(e,t,s):Gg.resolveFlowScalar(t,e.options.strict,s),l=i?e.directives.tagName(i.source,u=>s(i,"TAG_RESOLVE_FAILED",u)):null,c;e.options.stringKeys&&e.atKey?c=e.schema[ut.SCALAR]:l?c=Hg(e.schema,n,l,i,s):t.type==="scalar"?c=Vg(e,n,t,s):c=e.schema[ut.SCALAR];let h;try{let u=c.resolve(n,f=>s(i??t,"TAG_RESOLVE_FAILED",f),e.options);h=ut.isScalar(u)?u:new Oh.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);s(i??t,"TAG_RESOLVE_FAILED",f),h=new Oh.Scalar(n)}return h.range=a,h.source=n,r&&(h.type=r),l&&(h.tag=l),c.format&&(h.format=c.format),o&&(h.comment=o),h}function Hg(e,t,i,s,n){if(i==="!")return e[ut.SCALAR];let r=[];for(let a of e.tags)if(!a.collection&&a.tag===i)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(t))return a;let o=e.knownTags[i];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),e[ut.SCALAR])}function Vg({atKey:e,directives:t,schema:i},s,n,r){let o=i.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(s))||i[ut.SCALAR];if(i.compat){let a=i.compat.find(l=>l.default&&l.test?.test(s))??i[ut.SCALAR];if(o.tag!==a.tag){let l=t.tagString(o.tag),c=t.tagString(a.tag),h=`Value may be parsed as either ${l} or ${c}`;r(n,"TAG_RESOLVE_FAILED",h,!0)}}return o}_h.composeScalar=Wg});var Rh=y(Nh=>{"use strict";function Jg(e,t,i){if(t){i??(i=t.length);for(let s=i-1;s>=0;--s){let n=t[s];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++s];n?.type==="space";)e+=n.source.length,n=t[++s];break}}return e}Nh.emptyScalarPosition=Jg});var Th=y(No=>{"use strict";var Zg=ci(),Xg=I(),Qg=Sh(),Ph=Ah(),ey=jt(),ty=Rh(),iy={composeNode:Ih,composeEmptyNode:Ao};function Ih(e,t,i,s){let n=e.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=i,c,h=!0;switch(t.type){case"alias":c=sy(e,t,s),(a||l)&&s(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":c=Ph.composeScalar(e,t,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Qg.composeCollection(iy,e,t,i,s),a&&(c.anchor=a.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);s(t,"RESOURCE_EXHAUSTION",f)}break;default:{let u=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",u),h=!1}}return c??(c=Ao(e,t.offset,void 0,null,i,s)),a&&c.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!Xg.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&s(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?c.comment=o:c.commentBefore=o),e.options.keepSourceTokens&&h&&(c.srcToken=t),c}function Ao(e,t,i,s,{spaceBefore:n,comment:r,anchor:o,tag:a,end:l},c){let h={type:"scalar",offset:ty.emptyScalarPosition(t,i,s),indent:-1,source:""},u=Ph.composeScalar(e,h,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(u.spaceBefore=!0),r&&(u.comment=r,u.range[2]=l),u}function sy({options:e},{offset:t,source:i,end:s},n){let r=new Zg.Alias(i.substring(1));r.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&n(t+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+i.length,a=ey.resolveEnd(s,o,e.strict,n);return r.range=[t,o,a.offset],a.comment&&(r.comment=a.comment),r}No.composeEmptyNode=Ao;No.composeNode=Ih});var Mh=y(Ch=>{"use strict";var ny=Ai(),Lh=Th(),ry=jt(),oy=Ii();function ay(e,t,{offset:i,start:s,value:n,end:r},o){let a=Object.assign({_directives:t},e),l=new ny.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},h=oy.resolveProps(s,{indicator:"doc-start",next:n??r?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});h.found&&(l.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!h.hasNewline&&o(h.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=n?Lh.composeNode(c,n,h,o):Lh.composeEmptyNode(c,h.end,s,null,h,o);let u=l.contents.range[2],f=ry.resolveEnd(r,u,!1,o);return f.comment&&(l.comment=f.comment),l.range=[i,u,f.offset],l}Ch.composeDoc=ay});var Po=y(xh=>{"use strict";var ly=require("process"),cy=dr(),hy=Ai(),Ti=Pi(),Dh=I(),uy=Mh(),fy=jt();function Li(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:i}=e;return[t,t+(typeof i=="string"?i.length:1)]}function $h(e){let t="",i=!1,s=!1;for(let n=0;n{"use strict";var ft=I(),_h=B(),Gg=Oo(),Wg=Ao();function Hg(e,t,i,s){let{value:n,type:r,comment:o,range:a}=t.type==="block-scalar"?Gg.resolveBlockScalar(e,t,s):Wg.resolveFlowScalar(t,e.options.strict,s),l=i?e.directives.tagName(i.source,u=>s(i,"TAG_RESOLVE_FAILED",u)):null,c;e.options.stringKeys&&e.atKey?c=e.schema[ft.SCALAR]:l?c=Vg(e.schema,n,l,i,s):t.type==="scalar"?c=Jg(e,n,t,s):c=e.schema[ft.SCALAR];let h;try{let u=c.resolve(n,f=>s(i??t,"TAG_RESOLVE_FAILED",f),e.options);h=ft.isScalar(u)?u:new _h.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);s(i??t,"TAG_RESOLVE_FAILED",f),h=new _h.Scalar(n)}return h.range=a,h.source=n,r&&(h.type=r),l&&(h.tag=l),c.format&&(h.format=c.format),o&&(h.comment=o),h}function Vg(e,t,i,s,n){if(i==="!")return e[ft.SCALAR];let r=[];for(let a of e.tags)if(!a.collection&&a.tag===i)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(t))return a;let o=e.knownTags[i];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),e[ft.SCALAR])}function Jg({atKey:e,directives:t,schema:i},s,n,r){let o=i.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(s))||i[ft.SCALAR];if(i.compat){let a=i.compat.find(l=>l.default&&l.test?.test(s))??i[ft.SCALAR];if(o.tag!==a.tag){let l=t.tagString(o.tag),c=t.tagString(a.tag),h=`Value may be parsed as either ${l} or ${c}`;r(n,"TAG_RESOLVE_FAILED",h,!0)}}return o}Ah.composeScalar=Hg});var Ph=y(Rh=>{"use strict";function Zg(e,t,i){if(t){i??(i=t.length);for(let s=i-1;s>=0;--s){let n=t[s];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++s];n?.type==="space";)e+=n.source.length,n=t[++s];break}}return e}Rh.emptyScalarPosition=Zg});var Lh=y(Ro=>{"use strict";var Xg=hi(),Qg=I(),ey=vh(),Ih=Nh(),ty=Kt(),iy=Ph(),sy={composeNode:Th,composeEmptyNode:No};function Th(e,t,i,s){let n=e.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=i,c,h=!0;switch(t.type){case"alias":c=ny(e,t,s),(a||l)&&s(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":c=Ih.composeScalar(e,t,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=ey.composeCollection(sy,e,t,i,s),a&&(c.anchor=a.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);s(t,"RESOURCE_EXHAUSTION",f)}break;default:{let u=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",u),h=!1}}return c??(c=No(e,t.offset,void 0,null,i,s)),a&&c.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!Qg.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&s(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?c.comment=o:c.commentBefore=o),e.options.keepSourceTokens&&h&&(c.srcToken=t),c}function No(e,t,i,s,{spaceBefore:n,comment:r,anchor:o,tag:a,end:l},c){let h={type:"scalar",offset:iy.emptyScalarPosition(t,i,s),indent:-1,source:""},u=Ih.composeScalar(e,h,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(u.spaceBefore=!0),r&&(u.comment=r,u.range[2]=l),u}function ny({options:e},{offset:t,source:i,end:s},n){let r=new Xg.Alias(i.substring(1));r.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&n(t+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+i.length,a=ty.resolveEnd(s,o,e.strict,n);return r.range=[t,o,a.offset],a.comment&&(r.comment=a.comment),r}Ro.composeEmptyNode=No;Ro.composeNode=Th});var Dh=y(Mh=>{"use strict";var ry=Ni(),Ch=Lh(),oy=Kt(),ay=Ti();function ly(e,t,{offset:i,start:s,value:n,end:r},o){let a=Object.assign({_directives:t},e),l=new ry.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},h=ay.resolveProps(s,{indicator:"doc-start",next:n??r?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});h.found&&(l.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!h.hasNewline&&o(h.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=n?Ch.composeNode(c,n,h,o):Ch.composeEmptyNode(c,h.end,s,null,h,o);let u=l.contents.range[2],f=oy.resolveEnd(r,u,!1,o);return f.comment&&(l.comment=f.comment),l.range=[i,u,f.offset],l}Mh.composeDoc=ly});var Io=y(qh=>{"use strict";var cy=require("process"),hy=pr(),uy=Ni(),Li=Ii(),$h=I(),fy=Dh(),dy=Kt();function Ci(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:i}=e;return[t,t+(typeof i=="string"?i.length:1)]}function xh(e){let t="",i=!1,s=!1;for(let n=0;n{let o=Li(i);r?this.warnings.push(new Ti.YAMLWarning(o,s,n)):this.errors.push(new Ti.YAMLParseError(o,s,n))},this.directives=new cy.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,i){let{comment:s,afterEmptyLine:n}=$h(this.prelude);if(s){let r=t.contents;if(i)t.comment=t.comment?`${t.comment} -${s}`:s;else if(n||t.directives.docStart||!r)t.commentBefore=s;else if(Dh.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];Dh.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s} +`)+(r.substring(1)||" "),i=!0,s=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),i=!1;break;default:i||(s=!0),i=!1}}return{comment:t,afterEmptyLine:s}}var Po=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,s,n,r)=>{let o=Ci(i);r?this.warnings.push(new Li.YAMLWarning(o,s,n)):this.errors.push(new Li.YAMLParseError(o,s,n))},this.directives=new hy.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,i){let{comment:s,afterEmptyLine:n}=xh(this.prelude);if(s){let r=t.contents;if(i)t.comment=t.comment?`${t.comment} +${s}`:s;else if(n||t.directives.docStart||!r)t.commentBefore=s;else if($h.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];$h.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s} ${a}`:s}else{let o=r.commentBefore;r.commentBefore=o?`${s} -${o}`:s}}i?(Array.prototype.push.apply(t.errors,this.errors),Array.prototype.push.apply(t.warnings,this.warnings)):(t.errors=this.errors,t.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:$h(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,i=!1,s=-1){for(let n of t)yield*this.next(n);yield*this.end(i,s)}*next(t){switch(ly.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(i,s,n)=>{let r=Li(t);r[0]+=i,this.onError(r,"BAD_DIRECTIVE",s,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let i=uy.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let i=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,s=new Ti.YAMLParseError(Li(t),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){let s="Unexpected doc-end without preceding document";this.errors.push(new Ti.YAMLParseError(Li(t),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let i=fy.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let s=this.doc.comment;this.doc.comment=s?`${s} -${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new Ti.YAMLParseError(Li(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let s=Object.assign({_directives:this.directives},this.options),n=new hy.Document(void 0,s);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,i,i],this.decorate(n,!1),yield n}}};xh.Composer=Ro});var Fh=y(an=>{"use strict";var dy=ko(),py=_o(),my=Pi(),qh=pi();function gy(e,t=!0,i){if(e){let s=(n,r,o)=>{let a=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(i)i(a,r,o);else throw new my.YAMLParseError([a,a+1],r,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return py.resolveFlowScalar(e,t,s);case"block-scalar":return dy.resolveBlockScalar({options:{strict:t}},e,s)}}return null}function yy(e,t){let{implicitKey:i=!1,indent:s,inFlow:n=!1,offset:r=-1,type:o="PLAIN"}=t,a=qh.stringifyString({type:o,value:e},{implicitKey:i,indent:s>0?" ".repeat(s):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:s,source:` +${o}`:s}}i?(Array.prototype.push.apply(t.errors,this.errors),Array.prototype.push.apply(t.warnings,this.warnings)):(t.errors=this.errors,t.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:xh(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,i=!1,s=-1){for(let n of t)yield*this.next(n);yield*this.end(i,s)}*next(t){switch(cy.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(i,s,n)=>{let r=Ci(t);r[0]+=i,this.onError(r,"BAD_DIRECTIVE",s,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let i=fy.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let i=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,s=new Li.YAMLParseError(Ci(t),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){let s="Unexpected doc-end without preceding document";this.errors.push(new Li.YAMLParseError(Ci(t),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let i=dy.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let s=this.doc.comment;this.doc.comment=s?`${s} +${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new Li.YAMLParseError(Ci(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let s=Object.assign({_directives:this.directives},this.options),n=new uy.Document(void 0,s);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,i,i],this.decorate(n,!1),yield n}}};qh.Composer=Po});var jh=y(ln=>{"use strict";var py=Oo(),my=Ao(),gy=Ii(),Bh=mi();function yy(e,t=!0,i){if(e){let s=(n,r,o)=>{let a=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(i)i(a,r,o);else throw new gy.YAMLParseError([a,a+1],r,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return my.resolveFlowScalar(e,t,s);case"block-scalar":return py.resolveBlockScalar({options:{strict:t}},e,s)}}return null}function by(e,t){let{implicitKey:i=!1,indent:s,inFlow:n=!1,offset:r=-1,type:o="PLAIN"}=t,a=Bh.stringifyString({type:o,value:e},{implicitKey:i,indent:s>0?" ".repeat(s):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:s,source:` `}];switch(a[0]){case"|":case">":{let c=a.indexOf(` `),h=a.substring(0,c),u=a.substring(c+1)+` -`,f=[{type:"block-scalar-header",offset:r,indent:s,source:h}];return Bh(f,l)||f.push({type:"newline",offset:-1,indent:s,source:` -`}),{type:"block-scalar",offset:r,indent:s,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:r,indent:s,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:s,source:a,end:l};default:return{type:"scalar",offset:r,indent:s,source:a,end:l}}}function by(e,t,i={}){let{afterKey:s=!1,implicitKey:n=!1,inFlow:r=!1,type:o}=i,a="indent"in e?e.indent:null;if(s&&typeof a=="number"&&(a+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=e.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=qh.stringifyString({type:o,value:t},{implicitKey:n||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":wy(e,l);break;case'"':Io(e,l,"double-quoted-scalar");break;case"'":Io(e,l,"single-quoted-scalar");break;default:Io(e,l,"scalar")}}function wy(e,t){let i=t.indexOf(` +`,f=[{type:"block-scalar-header",offset:r,indent:s,source:h}];return Fh(f,l)||f.push({type:"newline",offset:-1,indent:s,source:` +`}),{type:"block-scalar",offset:r,indent:s,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:r,indent:s,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:s,source:a,end:l};default:return{type:"scalar",offset:r,indent:s,source:a,end:l}}}function wy(e,t,i={}){let{afterKey:s=!1,implicitKey:n=!1,inFlow:r=!1,type:o}=i,a="indent"in e?e.indent:null;if(s&&typeof a=="number"&&(a+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=e.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=Bh.stringifyString({type:o,value:t},{implicitKey:n||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":Sy(e,l);break;case'"':To(e,l,"double-quoted-scalar");break;case"'":To(e,l,"single-quoted-scalar");break;default:To(e,l,"scalar")}}function Sy(e,t){let i=t.indexOf(` `),s=t.substring(0,i),n=t.substring(i+1)+` -`;if(e.type==="block-scalar"){let r=e.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=s,e.source=n}else{let{offset:r}=e,o="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:s}];Bh(a,"end"in e?e.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:` -`});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:o,props:a,source:n})}}function Bh(e,t){if(t)for(let i of t)switch(i.type){case"space":case"comment":e.push(i);break;case"newline":return e.push(i),!0}return!1}function Io(e,t,i){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=i,e.source=t;break;case"block-scalar":{let s=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let r of s)r.offset+=n;delete e.props,Object.assign(e,{type:i,source:t,end:s});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:` -`};delete e.items,Object.assign(e,{type:i,source:t,end:[n]});break}default:{let s="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(e))r!=="type"&&r!=="offset"&&delete e[r];Object.assign(e,{type:i,indent:s,source:t,end:n})}}}an.createScalarToken=yy;an.resolveAsScalar=gy;an.setScalarValue=by});var Kh=y(jh=>{"use strict";var Sy=e=>"type"in e?cn(e):ln(e);function cn(e){switch(e.type){case"block-scalar":{let t="";for(let i of e.props)t+=cn(i);return t+e.source}case"block-map":case"block-seq":{let t="";for(let i of e.items)t+=ln(i);return t}case"flow-collection":{let t=e.start.source;for(let i of e.items)t+=ln(i);for(let i of e.end)t+=i.source;return t}case"document":{let t=ln(e);if(e.end)for(let i of e.end)t+=i.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let i of e.end)t+=i.source;return t}}}function ln({start:e,key:t,sep:i,value:s}){let n="";for(let r of e)n+=r.source;if(t&&(n+=cn(t)),i)for(let r of i)n+=r.source;return s&&(n+=cn(s)),n}jh.stringify=Sy});var Gh=y(Yh=>{"use strict";var To=Symbol("break visit"),vy=Symbol("skip children"),Uh=Symbol("remove item");function ft(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),zh(Object.freeze([]),e,t)}ft.BREAK=To;ft.SKIP=vy;ft.REMOVE=Uh;ft.itemAtPath=(e,t)=>{let i=e;for(let[s,n]of t){let r=i?.[s];if(r&&"items"in r)i=r.items[n];else return}return i};ft.parentCollection=(e,t)=>{let i=ft.itemAtPath(e,t.slice(0,-1)),s=t[t.length-1][0],n=i?.[s];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function zh(e,t,i){let s=i(t,e);if(typeof s=="symbol")return s;for(let n of["key","value"]){let r=t[n];if(r&&"items"in r){for(let o=0;o{"use strict";var Lo=Fh(),Ey=Kh(),ky=Gh(),Co="\uFEFF",Mo="",Do="",$o="",Oy=e=>!!e&&"items"in e,_y=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function Ay(e){switch(e){case Co:return"";case Mo:return"";case Do:return"";case $o:return"";default:return JSON.stringify(e)}}function Ny(e){switch(e){case Co:return"byte-order-mark";case Mo:return"doc-mode";case Do:return"flow-error-end";case $o:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`;if(e.type==="block-scalar"){let r=e.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=s,e.source=n}else{let{offset:r}=e,o="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:s}];Fh(a,"end"in e?e.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:` +`});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:o,props:a,source:n})}}function Fh(e,t){if(t)for(let i of t)switch(i.type){case"space":case"comment":e.push(i);break;case"newline":return e.push(i),!0}return!1}function To(e,t,i){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=i,e.source=t;break;case"block-scalar":{let s=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let r of s)r.offset+=n;delete e.props,Object.assign(e,{type:i,source:t,end:s});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:` +`};delete e.items,Object.assign(e,{type:i,source:t,end:[n]});break}default:{let s="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(e))r!=="type"&&r!=="offset"&&delete e[r];Object.assign(e,{type:i,indent:s,source:t,end:n})}}}ln.createScalarToken=by;ln.resolveAsScalar=yy;ln.setScalarValue=wy});var Uh=y(Kh=>{"use strict";var vy=e=>"type"in e?hn(e):cn(e);function hn(e){switch(e.type){case"block-scalar":{let t="";for(let i of e.props)t+=hn(i);return t+e.source}case"block-map":case"block-seq":{let t="";for(let i of e.items)t+=cn(i);return t}case"flow-collection":{let t=e.start.source;for(let i of e.items)t+=cn(i);for(let i of e.end)t+=i.source;return t}case"document":{let t=cn(e);if(e.end)for(let i of e.end)t+=i.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let i of e.end)t+=i.source;return t}}}function cn({start:e,key:t,sep:i,value:s}){let n="";for(let r of e)n+=r.source;if(t&&(n+=hn(t)),i)for(let r of i)n+=r.source;return s&&(n+=hn(s)),n}Kh.stringify=vy});var Wh=y(Gh=>{"use strict";var Lo=Symbol("break visit"),Ey=Symbol("skip children"),zh=Symbol("remove item");function dt(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Yh(Object.freeze([]),e,t)}dt.BREAK=Lo;dt.SKIP=Ey;dt.REMOVE=zh;dt.itemAtPath=(e,t)=>{let i=e;for(let[s,n]of t){let r=i?.[s];if(r&&"items"in r)i=r.items[n];else return}return i};dt.parentCollection=(e,t)=>{let i=dt.itemAtPath(e,t.slice(0,-1)),s=t[t.length-1][0],n=i?.[s];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function Yh(e,t,i){let s=i(t,e);if(typeof s=="symbol")return s;for(let n of["key","value"]){let r=t[n];if(r&&"items"in r){for(let o=0;o{"use strict";var Co=jh(),ky=Uh(),Oy=Wh(),Mo="\uFEFF",Do="",$o="",xo="",_y=e=>!!e&&"items"in e,Ay=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function Ny(e){switch(e){case Mo:return"";case Do:return"";case $o:return"";case xo:return"";default:return JSON.stringify(e)}}function Ry(e){switch(e){case Mo:return"byte-order-mark";case Do:return"doc-mode";case $o:return"flow-error-end";case xo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`: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}ie.createScalarToken=Lo.createScalarToken;ie.resolveAsScalar=Lo.resolveAsScalar;ie.setScalarValue=Lo.setScalarValue;ie.stringify=Ey.stringify;ie.visit=ky.visit;ie.BOM=Co;ie.DOCUMENT=Mo;ie.FLOW_END=Do;ie.SCALAR=$o;ie.isCollection=Oy;ie.isScalar=_y;ie.prettyToken=Ay;ie.tokenType=Ny});var Bo=y(Hh=>{"use strict";var Ci=hn();function ue(e){switch(e){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var Wh=new Set("0123456789ABCDEFabcdef"),Ry=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),un=new Set(",[]{}"),Py=new Set(` ,[]{} -\r `),xo=e=>!e||Py.has(e),qo=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(t,i=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!i;let s=this.next??"stream";for(;s&&(i||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let t=this.pos,i=this.buffer[t];for(;i===" "||i===" ";)i=this.buffer[++t];return!i||i==="#"||i===` +`: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}ie.createScalarToken=Co.createScalarToken;ie.resolveAsScalar=Co.resolveAsScalar;ie.setScalarValue=Co.setScalarValue;ie.stringify=ky.stringify;ie.visit=Oy.visit;ie.BOM=Mo;ie.DOCUMENT=Do;ie.FLOW_END=$o;ie.SCALAR=xo;ie.isCollection=_y;ie.isScalar=Ay;ie.prettyToken=Ny;ie.tokenType=Ry});var Fo=y(Vh=>{"use strict";var Mi=un();function ue(e){switch(e){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var Hh=new Set("0123456789ABCDEFabcdef"),Py=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),fn=new Set(",[]{}"),Iy=new Set(` ,[]{} +\r `),qo=e=>!e||Iy.has(e),Bo=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(t,i=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!i;let s=this.next??"stream";for(;s&&(i||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let t=this.pos,i=this.buffer[t];for(;i===" "||i===" ";)i=this.buffer[++t];return!i||i==="#"||i===` `?!0:i==="\r"?this.buffer[t+1]===` `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let i=this.buffer[t];if(this.indentNext>0){let s=0;for(;i===" ";)i=this.buffer[++s+t];if(i==="\r"){let n=this.buffer[s+t+1];if(n===` `||!n&&!this.atEnd)return t+s+1}return i===` `||s>=this.indentNext||!i&&!this.atEnd?t+s:-1}if(i==="-"||i==="."){let s=this.buffer.substr(t,3);if((s==="---"||s==="...")&&ue(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!ue(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&ue(i)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(t[i]){case"#":yield*this.pushCount(t.length-i);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(xo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,i,s=-1;do t=yield*this.pushNewline(),t>0?(i=yield*this.pushSpaces(!1),this.indentValue=s=i):i=0,i+=yield*this.pushSpaces(!0);while(t+i>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((s!==-1&&sthis.indentValue&&!ue(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&ue(i)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(t[i]){case"#":yield*this.pushCount(t.length-i);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(qo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,i,s=-1;do t=yield*this.pushNewline(),t>0?(i=yield*this.pushSpaces(!1),this.indentValue=s=i):i=0,i+=yield*this.pushSpaces(!0);while(t+i>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((s!==-1&&s"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>ue(i)||i==="#")}*parseBlockScalar(){let t=this.pos-1,i=0,s;e:for(let r=this.pos;s=this.buffer[r];++r)switch(s){case" ":i+=1;break;case` `:t=r,i=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===` `)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(t+1);if(r===-1)break;t=this.buffer.indexOf(` `,r)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let n=t+1;for(s=this.buffer[n];s===" ";)s=this.buffer[++n];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===` `;)s=this.buffer[++n];t=n-1}else if(!this.blockScalarKeep)do{let r=t-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===` -`&&r>=this.pos&&r+1+i>a)t=r;else break}while(!0);return yield Ci.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,i=this.pos-1,s=this.pos-1,n;for(;n=this.buffer[++s];)if(n===":"){let r=this.buffer[s+1];if(ue(r)||t&&un.has(r))break;i=s}else if(ue(n)){let r=this.buffer[s+1];if(n==="\r"&&(r===` +`&&r>=this.pos&&r+1+i>a)t=r;else break}while(!0);return yield Mi.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,i=this.pos-1,s=this.pos-1,n;for(;n=this.buffer[++s];)if(n===":"){let r=this.buffer[s+1];if(ue(r)||t&&fn.has(r))break;i=s}else if(ue(n)){let r=this.buffer[s+1];if(n==="\r"&&(r===` `?(s+=1,n=` -`,r=this.buffer[s+1]):i=s),r==="#"||t&&un.has(r))break;if(n===` -`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(t&&un.has(n))break;i=s}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Ci.SCALAR,yield*this.pushToIndex(i+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,i){let s=this.buffer.slice(this.pos,t);return s?(yield s,this.pos+=s.length,s.length):(i&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(xo))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let t=this.flowLevel>0,i=this.charAt(1);if(ue(i)||t&&un.has(i))return t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,i=this.buffer[t];for(;!ue(i)&&i!==">";)i=this.buffer[++t];return yield*this.pushToIndex(i===">"?t+1:t,!1)}else{let t=this.pos+1,i=this.buffer[t];for(;i;)if(Ry.has(i))i=this.buffer[++t];else if(i==="%"&&Wh.has(this.buffer[t+1])&&Wh.has(this.buffer[t+2]))i=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===` +`,r=this.buffer[s+1]):i=s),r==="#"||t&&fn.has(r))break;if(n===` +`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(t&&fn.has(n))break;i=s}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Mi.SCALAR,yield*this.pushToIndex(i+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,i){let s=this.buffer.slice(this.pos,t);return s?(yield s,this.pos+=s.length,s.length):(i&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(qo))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let t=this.flowLevel>0,i=this.charAt(1);if(ue(i)||t&&fn.has(i))return t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,i=this.buffer[t];for(;!ue(i)&&i!==">";)i=this.buffer[++t];return yield*this.pushToIndex(i===">"?t+1:t,!1)}else{let t=this.pos+1,i=this.buffer[t];for(;i;)if(Py.has(i))i=this.buffer[++t];else if(i==="%"&&Hh.has(this.buffer[t+1])&&Hh.has(this.buffer[t+2]))i=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===` `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(t){let i=this.pos-1,s;do s=this.buffer[++i];while(s===" "||t&&s===" ");let n=i-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(t){let i=this.pos,s=this.buffer[i];for(;!t(s);)s=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};Hh.Lexer=qo});var jo=y(Vh=>{"use strict";var Fo=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let i=0,s=this.lineStarts.length;for(;i>1;this.lineStarts[r]{"use strict";var Iy=require("process"),Jh=hn(),Ty=Bo();function Ge(e,t){for(let i=0;i=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Xh(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ge(t.start,"explicit-key-ind")&&!Ge(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,Qh(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}var Ko=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ty.Lexer,this.onNewLine=t}*parse(t,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let s of this.lexer.lex(t,i))yield*this.next(s);i||(yield*this.end())}*next(t){if(this.source=t,Iy.env.LOG_TOKENS&&console.log("|",Jh.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let i=Jh.tokenType(t);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let s=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:t}),this.offset+=t.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 t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let i=t??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let s=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in s?s.indent:0:i.type==="flow-collection"&&s.type==="document"&&(i.indent=0),i.type==="flow-collection"&&Xh(i),s.type){case"document":s.value=i;break;case"block-scalar":s.props.push(i);break;case"block-map":{let n=s.items[s.items.length-1];if(n.value){s.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=i;else{Object.assign(n,{key:i,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=s.items[s.items.length-1];n.value?s.items.push({start:[],value:i}):n.value=i;break}case"flow-collection":{let n=s.items[s.items.length-1];!n||n.value?s.items.push({start:[],key:i,sep:[]}):n.sep?n.value=i:Object.assign(n,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let n=i.items[i.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Zh(n.start)===-1&&(i.indent===0||n.start.every(r=>r.type!=="comment"||r.indent0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(t){let i=this.pos,s=this.buffer[i];for(;!t(s);)s=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};Vh.Lexer=Bo});var Ko=y(Jh=>{"use strict";var jo=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let i=0,s=this.lineStarts.length;for(;i>1;this.lineStarts[r]{"use strict";var Ty=require("process"),Zh=un(),Ly=Fo();function We(e,t){for(let i=0;i=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Qh(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!We(t.start,"explicit-key-ind")&&!We(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,eu(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}var Uo=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ly.Lexer,this.onNewLine=t}*parse(t,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let s of this.lexer.lex(t,i))yield*this.next(s);i||(yield*this.end())}*next(t){if(this.source=t,Ty.env.LOG_TOKENS&&console.log("|",Zh.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let i=Zh.tokenType(t);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let s=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:t}),this.offset+=t.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 t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let i=t??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let s=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in s?s.indent:0:i.type==="flow-collection"&&s.type==="document"&&(i.indent=0),i.type==="flow-collection"&&Qh(i),s.type){case"document":s.value=i;break;case"block-scalar":s.props.push(i);break;case"block-map":{let n=s.items[s.items.length-1];if(n.value){s.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=i;else{Object.assign(n,{key:i,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=s.items[s.items.length-1];n.value?s.items.push({start:[],value:i}):n.value=i;break}case"flow-collection":{let n=s.items[s.items.length-1];!n||n.value?s.items.push({start:[],key:i,sep:[]}):n.sep?n.value=i:Object.assign(n,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let n=i.items[i.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Xh(n.start)===-1&&(i.indent===0||n.start.every(r=>r.type!=="comment"||r.indent=t.indent){let s=!this.onKeyLine&&this.indent===t.indent,n=s&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",r=[];if(n&&i.sep&&!i.value){let o=[];for(let a=0;at.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||i.value?(r.push(this.sourceToken),t.items.push({start:r}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):n||i.value?(r.push(this.sourceToken),t.items.push({start:r,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(i.explicitKey)if(i.sep)if(i.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ge(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(Qh(i.key)&&!Ge(i.sep,"newline")){let o=Kt(i.start),a=i.key,l=i.sep;l.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?i.sep=i.sep.concat(r,this.sourceToken):i.sep.push(this.sourceToken);else if(Ge(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=Kt(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||n?t.items.push({start:r,key:null,sep:[this.sourceToken]}):Ge(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||i.value?(t.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!Ge(i.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 s&&t.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let i=t.items[t.items.length-1];switch(this.type){case"newline":if(i.value){let s="end"in i.value?i.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,i.start),n.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=t.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;i.value||Ge(i.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>t.indent){let s=this.startBlockValue(t);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let i=t.items[t.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?t.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!i||i.value?t.items.push({start:[],key:n,sep:[]}):i.sep?this.stack.push(n):Object.assign(i,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let s=this.startBlockValue(t);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{let s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===t.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){let n=fn(s),r=Kt(n);Xh(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let i=this.source.indexOf(` +`,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let i=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let s="end"in i.value?i.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,i.start),n.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let s=!this.onKeyLine&&this.indent===t.indent,n=s&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",r=[];if(n&&i.sep&&!i.value){let o=[];for(let a=0;at.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||i.value?(r.push(this.sourceToken),t.items.push({start:r}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):n||i.value?(r.push(this.sourceToken),t.items.push({start:r,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(i.explicitKey)if(i.sep)if(i.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(We(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(eu(i.key)&&!We(i.sep,"newline")){let o=Ut(i.start),a=i.key,l=i.sep;l.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?i.sep=i.sep.concat(r,this.sourceToken):i.sep.push(this.sourceToken);else if(We(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=Ut(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||n?t.items.push({start:r,key:null,sep:[this.sourceToken]}):We(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||i.value?(t.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!We(i.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 s&&t.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let i=t.items[t.items.length-1];switch(this.type){case"newline":if(i.value){let s="end"in i.value?i.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,i.start),n.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=t.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;i.value||We(i.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>t.indent){let s=this.startBlockValue(t);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let i=t.items[t.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?t.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!i||i.value?t.items.push({start:[],key:n,sep:[]}):i.sep?this.stack.push(n):Object.assign(i,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let s=this.startBlockValue(t);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{let s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===t.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){let n=dn(s),r=Ut(n);Qh(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let i=this.source.indexOf(` `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(` -`,i)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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 i=fn(t),s=Kt(i);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=fn(t),s=Kt(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,i){return this.type!=="comment"||this.indent<=i?!1:t.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};eu.Parser=Ko});var ru=y(Di=>{"use strict";var tu=Po(),Ly=Ai(),Mi=Pi(),Cy=Ar(),My=I(),Dy=jo(),iu=Uo();function su(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Dy.LineCounter||null,prettyErrors:t}}function $y(e,t={}){let{lineCounter:i,prettyErrors:s}=su(t),n=new iu.Parser(i?.addNewLine),r=new tu.Composer(t),o=Array.from(r.compose(n.parse(e)));if(s&&i)for(let a of o)a.errors.forEach(Mi.prettifyError(e,i)),a.warnings.forEach(Mi.prettifyError(e,i));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function nu(e,t={}){let{lineCounter:i,prettyErrors:s}=su(t),n=new iu.Parser(i?.addNewLine),r=new tu.Composer(t),o=null;for(let a of r.compose(n.parse(e),!0,e.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Mi.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&i&&(o.errors.forEach(Mi.prettifyError(e,i)),o.warnings.forEach(Mi.prettifyError(e,i))),o}function xy(e,t,i){let s;typeof t=="function"?s=t:i===void 0&&t&&typeof t=="object"&&(i=t);let n=nu(e,i);if(!n)return null;if(n.warnings.forEach(r=>Cy.warn(n.options.logLevel,r)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:s},i))}function qy(e,t,i){let s=null;if(typeof t=="function"||Array.isArray(t)?s=t:i===void 0&&t&&(i=t),typeof i=="string"&&(i=i.length),typeof i=="number"){let n=Math.round(i);i=n<1?void 0:n>8?{indent:8}:{indent:n}}if(e===void 0){let{keepUndefined:n}=i??t??{};if(!n)return}return My.isDocument(e)&&!s?e.toString(i):new Ly.Document(e,s,i).toString(i)}Di.parse=xy;Di.parseAllDocuments=$y;Di.parseDocument=nu;Di.stringify=qy});var Yo=y(T=>{"use strict";var By=Po(),Fy=Ai(),jy=lo(),zo=Pi(),Ky=ci(),We=I(),Uy=Ke(),zy=B(),Yy=ze(),Gy=Ye(),Wy=hn(),Hy=Bo(),Vy=jo(),Jy=Uo(),dn=ru(),ou=ri();T.Composer=By.Composer;T.Document=Fy.Document;T.Schema=jy.Schema;T.YAMLError=zo.YAMLError;T.YAMLParseError=zo.YAMLParseError;T.YAMLWarning=zo.YAMLWarning;T.Alias=Ky.Alias;T.isAlias=We.isAlias;T.isCollection=We.isCollection;T.isDocument=We.isDocument;T.isMap=We.isMap;T.isNode=We.isNode;T.isPair=We.isPair;T.isScalar=We.isScalar;T.isSeq=We.isSeq;T.Pair=Uy.Pair;T.Scalar=zy.Scalar;T.YAMLMap=Yy.YAMLMap;T.YAMLSeq=Gy.YAMLSeq;T.CST=Wy;T.Lexer=Hy.Lexer;T.LineCounter=Vy.LineCounter;T.Parser=Jy.Parser;T.parse=dn.parse;T.parseAllDocuments=dn.parseAllDocuments;T.parseDocument=dn.parseDocument;T.stringify=dn.stringify;T.visit=ou.visit;T.visitAsync=ou.visitAsync});var ZS={};Ed(ZS,{finalizeInstall:()=>pd});module.exports=kd(ZS);var fd=require("node:fs"),X=O(require("node:fs/promises")),ps=O(require("node:os")),K=O(require("node:path")),ms=O(Yo());var q=O(require("node:fs/promises")),ll=O(require("node:os")),x=O(require("node:path"));var Bu=O(require("events"),1),ee=O(require("fs"),1),Un=require("node:events"),ja=O(require("node:stream"),1),Fu=require("node:string_decoder"),Ua=O(require("node:path"),1),kt=O(require("node:fs"),1),Yn=require("path"),Uu=require("events"),Bn=O(require("assert"),1),it=require("buffer"),uu=O(require("zlib"),1),zu=O(require("zlib"),1),Et=require("node:path"),Ju=require("node:path"),ns=O(require("fs"),1),me=O(require("fs"),1),ka=O(require("path"),1),tf=require("node:path"),Ta=O(require("path"),1),Za=O(require("node:fs"),1),lf=O(require("node:assert"),1),Xa=require("node:crypto"),P=O(require("node:fs"),1),j=O(require("node:path"),1),Qa=O(require("fs"),1),as=O(require("node:fs"),1),Xt=O(require("node:path"),1),ne=O(require("node:fs"),1),yf=O(require("node:fs/promises"),1),rs=O(require("node:path"),1),el=require("node:path"),se=O(require("node:fs"),1),il=O(require("node:path"),1),Zy=Object.defineProperty,Xy=(e,t)=>{for(var i in t)Zy(e,i,{get:t[i],enumerable:!0})},au=typeof process=="object"&&process?process:{stdout:null,stderr:null},Qy=e=>!!e&&typeof e=="object"&&(e instanceof Nt||e instanceof ja.default||eb(e)||tb(e)),eb=e=>!!e&&typeof e=="object"&&e instanceof Un.EventEmitter&&typeof e.pipe=="function"&&e.pipe!==ja.default.Writable.prototype.pipe,tb=e=>!!e&&typeof e=="object"&&e instanceof Un.EventEmitter&&typeof e.write=="function"&&typeof e.end=="function",Pe=Symbol("EOF"),Ie=Symbol("maybeEmitEnd"),He=Symbol("emittedEnd"),pn=Symbol("emittingEnd"),$i=Symbol("emittedError"),mn=Symbol("closed"),lu=Symbol("read"),gn=Symbol("flush"),cu=Symbol("flushChunk"),fe=Symbol("encoding"),Ut=Symbol("decoder"),G=Symbol("flowing"),xi=Symbol("paused"),Wt=Symbol("resume"),W=Symbol("buffer"),Q=Symbol("pipes"),H=Symbol("bufferLength"),Go=Symbol("bufferPush"),yn=Symbol("bufferShift"),Z=Symbol("objectMode"),$=Symbol("destroyed"),Wo=Symbol("error"),Ho=Symbol("emitData"),hu=Symbol("emitEnd"),Vo=Symbol("emitEnd2"),Ee=Symbol("async"),Jo=Symbol("abort"),bn=Symbol("aborted"),qi=Symbol("signal"),dt=Symbol("dataListeners"),re=Symbol("discarded"),Bi=e=>Promise.resolve().then(e),ib=e=>e(),sb=e=>e==="end"||e==="finish"||e==="prefinish",nb=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,rb=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),ju=class{src;dest;opts;ondrain;constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[Wt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ob=class extends ju{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=s=>this.dest.emit("error",s),e.on("error",this.proxyErrors)}},ab=e=>!!e.objectMode,lb=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",Nt=class extends Un.EventEmitter{[G]=!1;[xi]=!1;[Q]=[];[W]=[];[Z];[fe];[Ee];[Ut];[Pe]=!1;[He]=!1;[pn]=!1;[mn]=!1;[$i]=null;[H]=0;[$]=!1;[qi];[bn]=!1;[dt]=0;[re]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");ab(t)?(this[Z]=!0,this[fe]=null):lb(t)?(this[fe]=t.encoding,this[Z]=!1):(this[Z]=!1,this[fe]=null),this[Ee]=!!t.async,this[Ut]=this[fe]?new Fu.StringDecoder(this[fe]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[W]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Q]});let{signal:i}=t;i&&(this[qi]=i,i.aborted?this[Jo]():i.addEventListener("abort",()=>this[Jo]()))}get bufferLength(){return this[H]}get encoding(){return this[fe]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Z]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ee]}set async(e){this[Ee]=this[Ee]||!!e}[Jo](){this[bn]=!0,this.emit("abort",this[qi]?.reason),this.destroy(this[qi]?.reason)}get aborted(){return this[bn]}set aborted(e){}write(e,t,i){if(this[bn])return!1;if(this[Pe])throw new Error("write after end");if(this[$])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||(t="utf8");let s=this[Ee]?Bi:ib;if(!this[Z]&&!Buffer.isBuffer(e)){if(rb(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(nb(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Z]?(this[G]&&this[H]!==0&&this[gn](!0),this[G]?this.emit("data",e):this[Go](e),this[H]!==0&&this.emit("readable"),i&&s(i),this[G]):e.length?(typeof e=="string"&&!(t===this[fe]&&!this[Ut]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[fe]&&(e=this[Ut].write(e)),this[G]&&this[H]!==0&&this[gn](!0),this[G]?this.emit("data",e):this[Go](e),this[H]!==0&&this.emit("readable"),i&&s(i),this[G]):(this[H]!==0&&this.emit("readable"),i&&s(i),this[G])}read(e){if(this[$])return null;if(this[re]=!1,this[H]===0||e===0||e&&e>this[H])return this[Ie](),null;this[Z]&&(e=null),this[W].length>1&&!this[Z]&&(this[W]=[this[fe]?this[W].join(""):Buffer.concat(this[W],this[H])]);let t=this[lu](e||null,this[W][0]);return this[Ie](),t}[lu](e,t){if(this[Z])this[yn]();else{let i=t;e===i.length||e===null?this[yn]():typeof i=="string"?(this[W][0]=i.slice(e),t=i.slice(0,e),this[H]-=e):(this[W][0]=i.subarray(e),t=i.subarray(0,e),this[H]-=e)}return this.emit("data",t),!this[W].length&&!this[Pe]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t="utf8"),e!==void 0&&this.write(e,t),i&&this.once("end",i),this[Pe]=!0,this.writable=!1,(this[G]||!this[xi])&&this[Ie](),this}[Wt](){this[$]||(!this[dt]&&!this[Q].length&&(this[re]=!0),this[xi]=!1,this[G]=!0,this.emit("resume"),this[W].length?this[gn]():this[Pe]?this[Ie]():this.emit("drain"))}resume(){return this[Wt]()}pause(){this[G]=!1,this[xi]=!0,this[re]=!1}get destroyed(){return this[$]}get flowing(){return this[G]}get paused(){return this[xi]}[Go](e){this[Z]?this[H]+=1:this[H]+=e.length,this[W].push(e)}[yn](){return this[Z]?this[H]-=1:this[H]-=this[W][0].length,this[W].shift()}[gn](e=!1){do;while(this[cu](this[yn]())&&this[W].length);!e&&!this[W].length&&!this[Pe]&&this.emit("drain")}[cu](e){return this.emit("data",e),this[G]}pipe(e,t){if(this[$])return e;this[re]=!1;let i=this[He];return t=t||{},e===au.stdout||e===au.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this[Q].push(t.proxyErrors?new ob(this,e,t):new ju(this,e,t)),this[Ee]?Bi(()=>this[Wt]()):this[Wt]()),e}unpipe(e){let t=this[Q].find(i=>i.dest===e);t&&(this[Q].length===1?(this[G]&&this[dt]===0&&(this[G]=!1),this[Q]=[]):this[Q].splice(this[Q].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);if(e==="data")this[re]=!1,this[dt]++,!this[Q].length&&!this[G]&&this[Wt]();else if(e==="readable"&&this[H]!==0)super.emit("readable");else if(sb(e)&&this[He])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[$i]){let s=t;this[Ee]?Bi(()=>s.call(this,this[$i])):s.call(this,this[$i])}return i}removeListener(e,t){return this.off(e,t)}off(e,t){let i=super.off(e,t);return e==="data"&&(this[dt]=this.listeners("data").length,this[dt]===0&&!this[re]&&!this[Q].length&&(this[G]=!1)),i}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[dt]=0,!this[re]&&!this[Q].length&&(this[G]=!1)),t}get emittedEnd(){return this[He]}[Ie](){!this[pn]&&!this[He]&&!this[$]&&this[W].length===0&&this[Pe]&&(this[pn]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[mn]&&this.emit("close"),this[pn]=!1)}emit(e,...t){let i=t[0];if(e!=="error"&&e!=="close"&&e!==$&&this[$])return!1;if(e==="data")return!this[Z]&&!i?!1:this[Ee]?(Bi(()=>this[Ho](i)),!0):this[Ho](i);if(e==="end")return this[hu]();if(e==="close"){if(this[mn]=!0,!this[He]&&!this[$])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[$i]=i,super.emit(Wo,i);let n=!this[qi]||this.listeners("error").length?super.emit("error",i):!1;return this[Ie](),n}else if(e==="resume"){let n=super.emit("resume");return this[Ie](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let s=super.emit(e,...t);return this[Ie](),s}[Ho](e){for(let i of this[Q])i.dest.write(e)===!1&&this.pause();let t=this[re]?!1:super.emit("data",e);return this[Ie](),t}[hu](){return this[He]?!1:(this[He]=!0,this.readable=!1,this[Ee]?(Bi(()=>this[Vo]()),!0):this[Vo]())}[Vo](){if(this[Ut]){let t=this[Ut].end();if(t){for(let i of this[Q])i.dest.write(t);this[re]||super.emit("data",t)}}for(let t of this[Q])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Z]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[Z]||(e.dataLength+=i.length)}),await t,e}async concat(){if(this[Z])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[fe]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on($,()=>t(new Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[re]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Pe])return t();let s,n,r=c=>{this.off("data",o),this.off("end",a),this.off($,l),t(),n(c)},o=c=>{this.off("error",r),this.off("end",a),this.off($,l),this.pause(),s({value:c,done:!!this[Pe]})},a=()=>{this.off("error",r),this.off("data",o),this.off($,l),t(),s({done:!0,value:void 0})},l=()=>r(new Error("stream destroyed"));return new Promise((c,h)=>{n=h,s=c,this.once($,l),this.once("error",r),this.once("end",a),this.once("data",o)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[re]=!1;let e=!1,t=()=>(this.pause(),this.off(Wo,t),this.off($,t),this.off("end",t),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return t();let s=this.read();return s===null?t():{done:!1,value:s}};return this.once("end",t),this.once(Wo,t),this.once($,t),{next:i,throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[$])return e?this.emit("error",e):this.emit($),this;this[$]=!0,this[re]=!0,this[W].length=0,this[H]=0;let t=this;return typeof t.close=="function"&&!this[mn]&&t.close(),e?this.emit("error",e):this.emit($),this}static get isStream(){return Qy}},cb=ee.default.writev,nt=Symbol("_autoClose"),ye=Symbol("_close"),Fi=Symbol("_ended"),L=Symbol("_fd"),Zo=Symbol("_finished"),Me=Symbol("_flags"),Xo=Symbol("_flush"),wa=Symbol("_handleChunk"),Sa=Symbol("_makeBuf"),Ji=Symbol("_mode"),wn=Symbol("_needDrain"),Zt=Symbol("_onerror"),Qt=Symbol("_onopen"),Qo=Symbol("_onread"),Ht=Symbol("_onwrite"),rt=Symbol("_open"),ge=Symbol("_path"),Xe=Symbol("_pos"),ke=Symbol("_queue"),Vt=Symbol("_read"),ea=Symbol("_readSize"),Ce=Symbol("_reading"),ji=Symbol("_remain"),ta=Symbol("_size"),Rn=Symbol("_write"),pt=Symbol("_writing"),Pn=Symbol("_defaultFlag"),Ot=Symbol("_errored"),Ka=class extends Nt{[Ot]=!1;[L];[ge];[ea];[Ce]=!1;[ta];[ji];[nt];constructor(e,t){if(t=t||{},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[Ot]=!1,this[L]=typeof t.fd=="number"?t.fd:void 0,this[ge]=e,this[ea]=t.readSize||16*1024*1024,this[Ce]=!1,this[ta]=typeof t.size=="number"?t.size:1/0,this[ji]=this[ta],this[nt]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[L]=="number"?this[Vt]():this[rt]()}get fd(){return this[L]}get path(){return this[ge]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[rt](){ee.default.open(this[ge],"r",(e,t)=>this[Qt](e,t))}[Qt](e,t){e?this[Zt](e):(this[L]=t,this.emit("open",t),this[Vt]())}[Sa](){return Buffer.allocUnsafe(Math.min(this[ea],this[ji]))}[Vt](){if(!this[Ce]){this[Ce]=!0;let e=this[Sa]();if(e.length===0)return process.nextTick(()=>this[Qo](null,0,e));ee.default.read(this[L],e,0,e.length,null,(t,i,s)=>this[Qo](t,i,s))}}[Qo](e,t,i){this[Ce]=!1,e?this[Zt](e):this[wa](t,i)&&this[Vt]()}[ye](){if(this[nt]&&typeof this[L]=="number"){let e=this[L];this[L]=void 0,ee.default.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Zt](e){this[Ce]=!0,this[ye](),this.emit("error",e)}[wa](e,t){let i=!1;return this[ji]-=e,e>0&&(i=super.write(ethis[Qt](e,t))}[Qt](e,t){this[Pn]&&this[Me]==="r+"&&e&&e.code==="ENOENT"?(this[Me]="w",this[rt]()):e?this[Zt](e):(this[L]=t,this.emit("open",t),this[pt]||this[Xo]())}end(e,t){return e&&this.write(e,t),this[Fi]=!0,!this[pt]&&!this[ke].length&&typeof this[L]=="number"&&this[Ht](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[Fi]?(this.emit("error",new Error("write() after end()")),!1):this[L]===void 0||this[pt]||this[ke].length?(this[ke].push(e),this[wn]=!0,!1):(this[pt]=!0,this[Rn](e),!0)}[Rn](e){ee.default.write(this[L],e,0,e.length,this[Xe],(t,i)=>this[Ht](t,i))}[Ht](e,t){e?this[Zt](e):(this[Xe]!==void 0&&typeof t=="number"&&(this[Xe]+=t),this[ke].length?this[Xo]():(this[pt]=!1,this[Fi]&&!this[Zo]?(this[Zo]=!0,this[ye](),this.emit("finish")):this[wn]&&(this[wn]=!1,this.emit("drain"))))}[Xo](){if(this[ke].length===0)this[Fi]&&this[Ht](null,0);else if(this[ke].length===1)this[Rn](this[ke].pop());else{let e=this[ke];this[ke]=[],cb(this[L],e,this[Xe],(t,i)=>this[Ht](t,i))}}[ye](){if(this[nt]&&typeof this[L]=="number"){let e=this[L];this[L]=void 0,ee.default.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},Ku=class extends zn{[rt](){let e;if(this[Pn]&&this[Me]==="r+")try{e=ee.default.openSync(this[ge],this[Me],this[Ji])}catch(t){if(t?.code==="ENOENT")return this[Me]="w",this[rt]();throw t}else e=ee.default.openSync(this[ge],this[Me],this[Ji]);this[Qt](null,e)}[ye](){if(this[nt]&&typeof this[L]=="number"){let e=this[L];this[L]=void 0,ee.default.closeSync(e),this.emit("close")}}[Rn](e){let t=!0;try{this[Ht](null,ee.default.writeSync(this[L],e,0,e.length,this[Xe])),t=!1}finally{if(t)try{this[ye]()}catch{}}}},ub=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),fb=e=>!!e.sync&&!!e.file,db=e=>!e.sync&&!!e.file,pb=e=>!!e.sync&&!e.file,mb=e=>!e.sync&&!e.file,gb=e=>!!e.file,yb=e=>ub.get(e)||e,za=(e={})=>{if(!e)return{};let t={};for(let[i,s]of Object.entries(e)){let n=yb(i);t[n]=s}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t},os=(e,t,i,s,n)=>Object.assign((r=[],o,a)=>{Array.isArray(r)&&(o=r,r={}),typeof o=="function"&&(a=o,o=void 0),o=o?Array.from(o):[];let l=za(r);if(n?.(l,o),fb(l)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return e(l,o)}else if(db(l)){let c=t(l,o);return a?c.then(()=>a(),a):c}else if(pb(l)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return i(l,o)}else if(mb(l)){if(typeof a=="function")throw new TypeError("callback only supported with file option");return s(l,o)}throw new Error("impossible options??")},{syncFile:e,asyncFile:t,syncNoFile:i,asyncNoFile:s,validate:n}),bb=zu.default.constants||{ZLIB_VERNUM:4736},Ae=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},bb)),wb=it.Buffer.concat,fu=Object.getOwnPropertyDescriptor(it.Buffer,"concat"),Sb=e=>e,ia=fu?.writable===!0||fu?.set!==void 0?e=>{it.Buffer.concat=e?Sb:wb}:e=>{},_t=Symbol("_superWrite"),Sn=class extends Error{code;errno;constructor(e,t){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,t??this.constructor)}get name(){return"ZlibError"}},sa=Symbol("flushFlag"),Ya=class extends Nt{#e=!1;#i=!1;#s;#r;#n;#t;#o;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#s}constructor(e,t){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(e),this.#s=e.flush??0,this.#r=e.finishFlush??0,this.#n=e.fullFlushFlag??0,typeof uu[t]!="function")throw new TypeError("Compression method not supported: "+t);try{this.#t=new uu[t](e)}catch(i){throw new Sn(i,this.constructor)}this.#o=i=>{this.#e||(this.#e=!0,this.close(),this.emit("error",i))},this.#t?.on("error",i=>this.#o(new Sn(i))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return(0,Bn.default)(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#n),this.write(Object.assign(it.Buffer.alloc(0),{[sa]:e})))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#r),this.#i=!0,super.end(i)}get ended(){return this.#i}[_t](e){return super.write(e)}write(e,t,i){if(typeof t=="function"&&(i=t,t="utf8"),typeof e=="string"&&(e=it.Buffer.from(e,t)),this.#e)return;(0,Bn.default)(this.#t,"zlib binding closed");let s=this.#t._handle,n=s.close;s.close=()=>{};let r=this.#t.close;this.#t.close=()=>{},ia(!0);let o;try{let l=typeof e[sa]=="number"?e[sa]:this.#s;o=this.#t._processChunk(e,l),ia(!1)}catch(l){ia(!1),this.#o(new Sn(l,this.write))}finally{this.#t&&(this.#t._handle=s,s.close=n,this.#t.close=r,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",l=>this.#o(new Sn(l,this.write)));let a;if(o)if(Array.isArray(o)&&o.length>0){let l=o[0];a=this[_t](it.Buffer.from(l));for(let c=1;c{typeof s=="function"&&(n=s,s=this.flushFlag),this.flush(s),n?.()};try{this.handle.params(e,t)}finally{this.handle.flush=i}this.handle&&(this.#e=e,this.#i=t)}}}},vb=class extends Yu{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[_t](e){return this.#e?(this.#e=!1,e[9]=255,super[_t](e)):super[_t](e)}},Eb=class extends Yu{constructor(e){super(e,"Unzip")}},Gu=class extends Ya{constructor(e,t){e=e||{},e.flush=e.flush||Ae.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||Ae.BROTLI_OPERATION_FINISH,e.fullFlushFlag=Ae.BROTLI_OPERATION_FLUSH,super(e,t)}},kb=class extends Gu{constructor(e){super(e,"BrotliCompress")}},Ob=class extends Gu{constructor(e){super(e,"BrotliDecompress")}},Wu=class extends Ya{constructor(e,t){e=e||{},e.flush=e.flush||Ae.ZSTD_e_continue,e.finishFlush=e.finishFlush||Ae.ZSTD_e_end,e.fullFlushFlag=Ae.ZSTD_e_flush,super(e,t)}},_b=class extends Wu{constructor(e){super(e,"ZstdCompress")}},Ab=class extends Wu{constructor(e){super(e,"ZstdDecompress")}},Nb=(e,t)=>{if(Number.isSafeInteger(e))e<0?Pb(e,t):Rb(e,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},Rb=(e,t)=>{t[0]=128;for(var i=t.length;i>1;i--)t[i-1]=e&255,e=Math.floor(e/256)},Pb=(e,t)=>{t[0]=255;var i=!1;e=e*-1;for(var s=t.length;s>1;s--){var n=e&255;e=Math.floor(e/256),i?t[s-1]=Hu(n):n===0?t[s-1]=0:(i=!0,t[s-1]=Vu(n))}},Ib=e=>{let t=e[0],i=t===128?Lb(e.subarray(1,e.length)):t===255?Tb(e):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},Tb=e=>{for(var t=e.length,i=0,s=!1,n=t-1;n>-1;n--){var r=Number(e[n]),o;s?o=Hu(r):r===0?o=r:(s=!0,o=Vu(r)),o!==0&&(i-=o*Math.pow(256,t-n-1))}return i},Lb=e=>{for(var t=e.length,i=0,s=t-1;s>-1;s--){var n=Number(e[s]);n!==0&&(i+=n*Math.pow(256,t-s-1))}return i},Hu=e=>(255^e)&255,Vu=e=>(255^e)+1&255,Cb={};Xy(Cb,{code:()=>Ga,isCode:()=>In,isName:()=>Mb,name:()=>Gn});var In=e=>Gn.has(e),Mb=e=>Ga.has(e),Gn=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Ga=new Map(Array.from(Gn).map(e=>[e[1],e[0]])),At=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,i,s){Buffer.isBuffer(e)?this.decode(e,t||0,i,s):e&&this.#i(e)}decode(e,t,i,s){if(t||(t=0),!e||!(e.length>=t+512))throw new Error("need 512 bytes for header");this.path=i?.path??mt(e,t,100),this.mode=i?.mode??s?.mode??Qe(e,t+100,8),this.uid=i?.uid??s?.uid??Qe(e,t+108,8),this.gid=i?.gid??s?.gid??Qe(e,t+116,8),this.size=i?.size??s?.size??Qe(e,t+124,12),this.mtime=i?.mtime??s?.mtime??na(e,t+136,12),this.cksum=Qe(e,t+148,12),s&&this.#i(s,!0),i&&this.#i(i);let n=mt(e,t+156,1);if(In(n)&&(this.#e=n||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=mt(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=i?.uname??s?.uname??mt(e,t+265,32),this.gname=i?.gname??s?.gname??mt(e,t+297,32),this.devmaj=i?.devmaj??s?.devmaj??Qe(e,t+329,8)??0,this.devmin=i?.devmin??s?.devmin??Qe(e,t+337,8)??0,e[t+475]!==0){let o=mt(e,t+345,155);this.path=o+"/"+this.path}else{let o=mt(e,t+345,130);o&&(this.path=o+"/"+this.path),this.atime=i?.atime??s?.atime??na(e,t+476,12),this.ctime=i?.ctime??s?.ctime??na(e,t+488,12)}let r=256;for(let o=t;o!(s==null||i==="path"&&t||i==="linkpath"&&t||i==="global"))))}encode(e,t=0){if(e||(e=this.block=Buffer.alloc(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw new Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,s=Db(this.path||"",i),n=s[0],r=s[1];this.needPax=!!s[2],this.needPax=gt(e,t,100,n)||this.needPax,this.needPax=et(e,t+100,8,this.mode)||this.needPax,this.needPax=et(e,t+108,8,this.uid)||this.needPax,this.needPax=et(e,t+116,8,this.gid)||this.needPax,this.needPax=et(e,t+124,12,this.size)||this.needPax,this.needPax=ra(e,t+136,12,this.mtime)||this.needPax,e[t+156]=Number(this.#e.codePointAt(0)),this.needPax=gt(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=gt(e,t+265,32,this.uname)||this.needPax,this.needPax=gt(e,t+297,32,this.gname)||this.needPax,this.needPax=et(e,t+329,8,this.devmaj)||this.needPax,this.needPax=et(e,t+337,8,this.devmin)||this.needPax,this.needPax=gt(e,t+345,i,r)||this.needPax,e[t+475]!==0?this.needPax=gt(e,t+345,155,r)||this.needPax:(this.needPax=gt(e,t+345,130,r)||this.needPax,this.needPax=ra(e,t+476,12,this.atime)||this.needPax,this.needPax=ra(e,t+488,12,this.ctime)||this.needPax);let o=256;for(let a=t;a{let i=e,s="",n,r=Et.posix.parse(e).root||".";if(Buffer.byteLength(i)<100)n=[i,s,!1];else{s=Et.posix.dirname(i),i=Et.posix.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(s)<=t?n=[i,s,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(s)<=t?n=[i.slice(0,99),s,!0]:(i=Et.posix.join(Et.posix.basename(s),i),s=Et.posix.dirname(s));while(s!==r&&n===void 0);n||(n=[e.slice(0,99),"",!0])}return n},mt=(e,t,i)=>e.subarray(t,t+i).toString("utf8").replace(/\0.*/,""),na=(e,t,i)=>$b(Qe(e,t,i)),$b=e=>e===void 0?void 0:new Date(e*1e3),Qe=(e,t,i)=>Number(e[t])&128?Ib(e.subarray(t,t+i)):qb(e,t,i),xb=e=>isNaN(e)?void 0:e,qb=(e,t,i)=>xb(parseInt(e.subarray(t,t+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),Bb={12:8589934591,8:2097151},et=(e,t,i,s)=>s===void 0?!1:s>Bb[i]||s<0?(Nb(s,e.subarray(t,t+i)),!0):(Fb(e,t,i,s),!1),Fb=(e,t,i,s)=>e.write(jb(s,i),t,i,"ascii"),jb=(e,t)=>Kb(Math.floor(e).toString(8),t),Kb=(e,t)=>(e.length===t-1?e:new Array(t-e.length-1).join("0")+e+" ")+"\0",ra=(e,t,i,s)=>s===void 0?!1:et(e,t,i,s.getTime()/1e3),Ub=new Array(156).join("\0"),gt=(e,t,i,s)=>s===void 0?!1:(e.write(s+Ub,t,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),Fn=class Zu{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,i=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=i,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(t),s=512*Math.ceil(1+i/512),n=Buffer.allocUnsafe(s);for(let r=0;r<512;r++)n[r]=0;new At({path:("PaxHeader/"+(0,Ju.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(n),n.write(t,512,i,"utf8");for(let r=i+512;r=Math.pow(10,o)&&(o+=1),o+r+n}static parse(t,i,s=!1){return new Zu(zb(Yb(t),i),s)}},zb=(e,t)=>t?Object.assign({},t,e):e,Yb=e=>e.replace(/\n$/,"").split(` -`).reduce(Gb,Object.create(null)),Gb=(e,t)=>{let i=parseInt(t,10);if(i!==Buffer.byteLength(t)+1)return e;t=t.slice((i+" ").length);let s=t.split("="),n=s.shift();if(!n)return e;let r=n.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),o=s.join("=");return e[r]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(r)?new Date(Number(o)*1e3):/^[0-9]+$/.test(o)?+o:o,e},Wb=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,R=Wb!=="win32"?e=>e:e=>e&&e.replaceAll(/\\/g,"/"),Xu=class extends Nt{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,t,i){switch(super({}),this.pause(),this.extended=t,this.globalExtended=i,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=R(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?R(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),i&&this.#e(i,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw new Error("writing more to entry than is appropriate");let i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-t),this.blockRemain=Math.max(0,s-t),this.ignore?!0:i>=t?super.write(e):super.write(e.subarray(0,i))}#e(e,t=!1){e.path&&(e.path=R(e.path)),e.linkpath&&(e.linkpath=R(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,s])=>!(s==null||i==="path"&&t))))}},Wn=(e,t,i,s={})=>{e.file&&(s.file=e.file),e.cwd&&(s.cwd=e.cwd),s.code=i instanceof Error&&i.code||t,s.tarCode=t,!e.strict&&s.recoverable!==!1?(i instanceof Error&&(s=Object.assign(i,s),i=i.message),e.emit("warn",t,i,s)):i instanceof Error?e.emit("error",Object.assign(i,s)):e.emit("error",Object.assign(new Error(`${t}: ${i}`),s))},Hb=1024*1024,va=Buffer.from([31,139]),Ea=Buffer.from([40,181,47,253]),Vb=Math.max(va.length,Ea.length),ae=Symbol("state"),yt=Symbol("writeEntry"),Te=Symbol("readEntry"),oa=Symbol("nextEntry"),du=Symbol("processEntry"),Oe=Symbol("extendedHeader"),Ki=Symbol("globalExtendedHeader"),Ve=Symbol("meta"),pu=Symbol("emitMeta"),M=Symbol("buffer"),Le=Symbol("queue"),Je=Symbol("ended"),aa=Symbol("emittedEnd"),bt=Symbol("emit"),F=Symbol("unzip"),vn=Symbol("consumeChunk"),En=Symbol("consumeChunkSub"),la=Symbol("consumeBody"),mu=Symbol("consumeMeta"),gu=Symbol("consumeHeader"),Ui=Symbol("consuming"),ca=Symbol("bufferConcat"),kn=Symbol("maybeEnd"),zt=Symbol("writing"),Ze=Symbol("aborted"),On=Symbol("onDone"),wt=Symbol("sawValidEntry"),_n=Symbol("sawNullBlock"),An=Symbol("sawEOF"),yu=Symbol("closeStream"),Jb=()=>!0,ss=class extends Uu.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[Le]=[];[M];[Te];[yt];[ae]="begin";[Ve]="";[Oe];[Ki];[Je]=!1;[F];[Ze]=!1;[wt];[_n]=!1;[An]=!1;[zt]=!1;[Ui]=!1;[aa]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(On,()=>{(this[ae]==="begin"||this[wt]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(On,e.ondone):this.on(On,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||Hb,this.filter=typeof e.filter=="function"?e.filter:Jb;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:t?void 0:!1;let i=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:i?!0:void 0,this.on("end",()=>this[yu]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,i={}){Wn(this,e,t,i)}[gu](e,t){this[wt]===void 0&&(this[wt]=!1);let i;try{i=new At(e,t,this[Oe],this[Ki])}catch(s){return this.warn("TAR_ENTRY_INVALID",s)}if(i.nullBlock)this[_n]?(this[An]=!0,this[ae]==="begin"&&(this[ae]="header"),this[bt]("eof")):(this[_n]=!0,this[bt]("nullBlock"));else if(this[_n]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let s=i.type;if(/^(Symbolic)?Link$/.test(s)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(s)&&!/^(Global)?ExtendedHeader$/.test(s)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let n=this[yt]=new Xu(i,this[Oe],this[Ki]);if(!this[wt])if(n.remain){let r=()=>{n.invalid||(this[wt]=!0)};n.on("end",r)}else this[wt]=!0;n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[bt]("ignoredEntry",n),this[ae]="ignore",n.resume()):n.size>0&&(this[Ve]="",n.on("data",r=>this[Ve]+=r),this[ae]="meta"):(this[Oe]=void 0,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[bt]("ignoredEntry",n),this[ae]=n.remain?"ignore":"header",n.resume()):(n.remain?this[ae]="body":(this[ae]="header",n.end()),this[Te]?this[Le].push(n):(this[Le].push(n),this[oa]())))}}}[yu](){queueMicrotask(()=>this.emit("close"))}[du](e){let t=!0;if(!e)this[Te]=void 0,t=!1;else if(Array.isArray(e)){let[i,...s]=e;this.emit(i,...s)}else this[Te]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[oa]()),t=!1);return t}[oa](){do;while(this[du](this[Le].shift()));if(this[Le].length===0){let e=this[Te];!e||e.flowing||e.size===e.remain?this[zt]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[la](e,t){let i=this[yt];if(!i)throw new Error("attempt to consume body without entry??");let s=i.blockRemain??0,n=s>=e.length&&t===0?e:e.subarray(t,t+s);return i.write(n),i.blockRemain||(this[ae]="header",this[yt]=void 0,i.end()),n.length}[mu](e,t){let i=this[yt],s=this[la](e,t);return!this[yt]&&i&&this[pu](i),s}[bt](e,t,i){this[Le].length===0&&!this[Te]?this.emit(e,t,i):this[Le].push([e,t,i])}[pu](e){switch(this[bt]("meta",this[Ve]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Oe]=Fn.parse(this[Ve],this[Oe],!1);break;case"GlobalExtendedHeader":this[Ki]=Fn.parse(this[Ve],this[Ki],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[Oe]??Object.create(null);this[Oe]=t,t.path=this[Ve].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[Oe]||Object.create(null);this[Oe]=t,t.linkpath=this[Ve].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[Ze]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[Ze])return i?.(),!1;if((this[F]===void 0||this.brotli===void 0&&this[F]===!1)&&e){if(this[M]&&(e=Buffer.concat([this[M],e]),this[M]=void 0),e.lengththis[vn](l)),this[F].on("error",l=>this.abort(l)),this[F].on("end",()=>{this[Je]=!0,this[vn]()}),this[zt]=!0;let a=!!this[F][o?"end":"write"](e);return this[zt]=!1,i?.(),a}}this[zt]=!0,this[F]?this[F].write(e):this[vn](e),this[zt]=!1;let s=this[Le].length>0?!1:this[Te]?this[Te].flowing:!0;return!s&&this[Le].length===0&&this[Te]?.once("drain",()=>this.emit("drain")),i?.(),s}[ca](e){e&&!this[Ze]&&(this[M]=this[M]?Buffer.concat([this[M],e]):e)}[kn](){if(this[Je]&&!this[aa]&&!this[Ze]&&!this[Ui]){this[aa]=!0;let e=this[yt];if(e&&e.blockRemain){let t=this[M]?this[M].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[M]&&e.write(this[M]),e.end()}this[bt](On)}}[vn](e){if(this[Ui]&&e)this[ca](e);else if(!e&&!this[M])this[kn]();else if(e){if(this[Ui]=!0,this[M]){this[ca](e);let t=this[M];this[M]=void 0,this[En](t)}else this[En](e);for(;this[M]&&this[M]?.length>=512&&!this[Ze]&&!this[An];){let t=this[M];this[M]=void 0,this[En](t)}this[Ui]=!1}(!this[M]||this[Je])&&this[kn]()}[En](e){let t=0,i=e.length;for(;t+512<=i&&!this[Ze]&&!this[An];)switch(this[ae]){case"begin":case"header":this[gu](e,t),t+=512;break;case"ignore":case"body":t+=this[la](e,t);break;case"meta":t+=this[mu](e,t);break;default:throw new Error("invalid state: "+this[ae])}t{let t=e.length-1,i=-1;for(;t>-1&&e.charAt(t)==="/";)i=t,t--;return i===-1?e:e.slice(0,i)},Zb=e=>{let t=e.onReadEntry;e.onReadEntry=t?i=>{t(i),i.resume()}:i=>i.resume()},Qu=(e,t)=>{let i=new Map(t.map(r=>[Zi(r),!0])),s=e.filter,n=(r,o="")=>{let a=o||(0,Yn.parse)(r).root||".",l;if(r===a)l=!1;else{let c=i.get(r);l=c!==void 0?c:n((0,Yn.dirname)(r),a)}return i.set(r,l),l};e.filter=s?(r,o)=>s(r,o)&&n(Zi(r)):r=>n(Zi(r))},Xb=e=>{let t=new ss(e),i=e.file,s;try{s=kt.default.openSync(i,"r");let n=kt.default.fstatSync(s),r=e.maxReadSize||16*1024*1024;if(n.size{let i=new ss(e),s=e.maxReadSize||16*1024*1024,n=e.file;return new Promise((r,o)=>{i.on("error",o),i.on("end",r),kt.default.stat(n,(a,l)=>{if(a)o(a);else{let c=new Ka(n,{readSize:s,size:l.size});c.on("error",o),c.pipe(i)}})})},Hn=os(Xb,Qb,e=>new ss(e),e=>new ss(e),(e,t)=>{t?.length&&Qu(e,t),e.noResume||Zb(e)}),ef=(e,t,i)=>(e&=4095,i&&(e=(e|384)&-19),t&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),{isAbsolute:ew,parse:bu}=tf.win32,Wa=e=>{let t="",i=bu(e);for(;ew(e)||i.root;){let s=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":i.root;e=e.slice(s.length),t+=s,i=bu(e)}return[t,e]},Vn=["|","<",">","?",":"],Ha=Vn.map(e=>String.fromCodePoint(61440+Number(e.codePointAt(0)))),tw=new Map(Vn.map((e,t)=>[e,Ha[t]])),iw=new Map(Ha.map((e,t)=>[e,Vn[t]])),wu=e=>Vn.reduce((t,i)=>t.split(i).join(tw.get(i)),e),sw=e=>Ha.reduce((t,i)=>t.split(i).join(iw.get(i)),e),sf=(e,t)=>t?(e=R(e).replace(/^\.(\/|$)/,""),Zi(t)+"/"+e):R(e),nw=16*1024*1024,Su=Symbol("process"),vu=Symbol("file"),Eu=Symbol("directory"),Oa=Symbol("symlink"),ku=Symbol("hardlink"),zi=Symbol("header"),Tn=Symbol("read"),_a=Symbol("lstat"),Ln=Symbol("onlstat"),Aa=Symbol("onread"),Na=Symbol("onreadlink"),Ra=Symbol("openfile"),Pa=Symbol("onopenfile"),tt=Symbol("close"),jn=Symbol("mode"),Ia=Symbol("awaitDrain"),ha=Symbol("ondrain"),_e=Symbol("prefix"),nf=class extends Nt{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,t={}){let i=za(t);super(),this.path=R(e),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||nw,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=R(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?R(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){let[r,o]=Wa(this.path);r&&typeof o=="string"&&(this.path=o,s=r)}this.win32=!!i.win32||process.platform==="win32",this.win32&&(this.path=sw(this.path.replaceAll(/\\/g,"/")),e=e.replaceAll(/\\/g,"/")),this.absolute=R(i.absolute||ka.default.resolve(this.cwd,e)),this.path===""&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});let n=this.statCache.get(this.absolute);n?this[Ln](n):this[_a]()}warn(e,t,i={}){return Wn(this,e,t,i)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[_a](){me.default.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Ln](t)})}[Ln](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=aw(e),this.emit("stat",e),this[Su]()}[Su](){switch(this.type){case"File":return this[vu]();case"Directory":return this[Eu]();case"SymbolicLink":return this[Oa]();default:return this.end()}}[jn](e){return ef(e,this.type==="Directory",this.portable)}[_e](e){return sf(e,this.prefix)}[zi](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new At({path:this[_e](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[_e](this.linkpath):this.linkpath,mode:this[jn](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Fn({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[_e](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[_e](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e)}[Eu](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[zi](),this.end()}[Oa](){me.default.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Na](t)})}[Na](e){this.linkpath=R(e),this[zi](),this.end()}[ku](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=R(ka.default.relative(this.cwd,e)),this.stat.size=0,this[zi](),this.end()}[vu](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[ku](t);this.linkCache.set(e,this.absolute)}if(this[zi](),this.stat.size===0)return this.end();this[Ra]()}[Ra](){me.default.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[Pa](t)})}[Pa](e){if(this.fd=e,this.#e)return this[tt]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Tn]()}[Tn](){let{fd:e,buf:t,offset:i,length:s,pos:n}=this;if(e===void 0||t===void 0)throw new Error("cannot read file without first opening");me.default.read(e,t,i,s,n,(r,o)=>{if(r)return this[tt](()=>this.emit("error",r));this[Aa](o)})}[tt](e=()=>{}){this.fd!==void 0&&me.default.close(this.fd,e)}[Aa](e){if(e<=0&&this.remain>0){let i=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[tt](()=>this.emit("error",i))}if(e>this.remain){let i=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[tt](()=>this.emit("error",i))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let i=e;ithis[ha]())}[Ia](e){this.once("drain",e)}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemaine?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Tn]()}},rw=class extends nf{sync=!0;[_a](){this[Ln](me.default.lstatSync(this.absolute))}[Oa](){this[Na](me.default.readlinkSync(this.absolute))}[Ra](){this[Pa](me.default.openSync(this.absolute,"r"))}[Tn](){let e=!0;try{let{fd:t,buf:i,offset:s,length:n,pos:r}=this;if(t===void 0||i===void 0)throw new Error("fd and buf must be set in READ method");let o=me.default.readSync(t,i,s,n,r);this[Aa](o),e=!1}finally{if(e)try{this[tt](()=>{})}catch{}}}[Ia](e){e()}[tt](e=()=>{}){this.fd!==void 0&&me.default.closeSync(this.fd),e()}},ow=class extends Nt{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,t,i={}){return Wn(this,e,t,i)}constructor(e,t={}){let i=za(t);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=e;let{type:s}=e;if(s==="Unsupported")throw new Error("writing entry that should be ignored");this.type=s,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=R(e.path),this.mode=e.mode!==void 0?this[jn](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:i.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?R(e.linkpath):void 0,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let n=!1;if(!this.preservePaths){let[o,a]=Wa(this.path);o&&typeof a=="string"&&(this.path=a,n=o)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new At({path:this[_e](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[_e](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),n&&this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path}),this.header.encode()&&!this.noPax&&super.write(new Fn({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[_e](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[_e](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let r=this.header?.block;if(!r)throw new Error("failed to encode header");super.write(r),e.pipe(this)}[_e](e){return sf(e,this.prefix)}[jn](e){return ef(e,this.type==="Directory",this.portable)}write(e,t,i){typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let s=e.length;if(s>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(e,i)}end(e,t,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),i&&this.once("finish",i),e?super.end(e,i):super.end(i),this}},aw=e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported",lw=class Jt{tail;head;length=0;static create(t=[]){return new Jt(t)}constructor(t=[]){for(let i of t)this.push(i)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");let i=t.next,s=t.prev;return i&&(i.prev=s),s&&(s.next=i),t===this.head&&(this.head=i),t===this.tail&&(this.tail=s),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,i}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let i=this.head;t.list=this,t.next=i,i&&(i.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let i=this.tail;t.list=this,t.prev=i,i&&(i.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let i=0,s=t.length;i1)s=i;else if(this.head)n=this.head.next,s=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var r=0;n;r++)s=t(s,n.value,r),n=n.next;return s}reduceReverse(t,i){let s,n=this.tail;if(arguments.length>1)s=i;else if(this.tail)n=this.tail.prev,s=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let r=this.length-1;n;r--)s=t(s,n.value,r),n=n.prev;return s}toArray(){let t=new Array(this.length);for(let i=0,s=this.head;s;i++)t[i]=s.value,s=s.next;return t}toArrayReverse(){let t=new Array(this.length);for(let i=0,s=this.tail;s;i++)t[i]=s.value,s=s.prev;return t}slice(t=0,i=this.length){i<0&&(i+=this.length),t<0&&(t+=this.length);let s=new Jt;if(ithis.length&&(i=this.length);let n=this.head,r=0;for(r=0;n&&rthis.length&&(i=this.length);let n=this.length,r=this.tail;for(;r&&n>i;n--)r=r.prev;for(;r&&n>t;n--,r=r.prev)s.push(r.value);return s}splice(t,i=0,...s){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let n=this.head;for(let o=0;n&&o1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new vb(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new kb(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new _b(e.zstd)),!this.zip)throw new Error("impossible");let t=this.zip;t.on("data",i=>super.write(i)),t.on("end",()=>super.end()),t.on("drain",()=>this[pa]()),this.on("resume",()=>t.resume())}else this.on("drain",this[pa]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[de]=new lw,this[pe]=0,this.jobs=Number(e.jobs)||4,this[Gi]=!1,this[Yi]=!1}[rf](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&this.add(e),this[Yi]=!0,this[vt](),i&&i(),this}write(e){if(this[Yi])throw new Error("write after end");return e instanceof Xu?this[Au](e):this[Mn](e),this.flowing}[Au](e){let t=R(Ta.default.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let i=new Ou(e.path,t);i.entry=new ow(e,this[da](i)),i.entry.on("end",()=>this[fa](i)),this[pe]+=1,this[de].push(i)}this[vt]()}[Mn](e){let t=R(Ta.default.resolve(this.cwd,e));this[de].push(new Ou(e,t)),this[vt]()}[La](e){e.pending=!0,this[pe]+=1;let t=this.follow?"stat":"lstat";ns.default[t](e.absolute,(i,s)=>{e.pending=!1,this[pe]-=1,i?this.emit("error",i):this[Cn](e,s)})}[Cn](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)?t.isFile()&&t.nlink>1&&e===this[St]&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync&&this[ua](e):e.ignore=!0,this[vt]()}[Ca](e){e.pending=!0,this[pe]+=1,ns.default.readdir(e.absolute,(t,i)=>{if(e.pending=!1,this[pe]-=1,t)return this.emit("error",t);this[Dn](e,i)})}[Dn](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[vt]()}[vt](){if(!this[Gi]){this[Gi]=!0;for(let e=this[de].head;e&&this[pe]this.warn(t,i,s),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Nu](e){this[pe]+=1;try{return new this[xn](e.path,this[da](e)).on("end",()=>this[fa](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[pa](){this[St]&&this[St].entry&&this[St].entry.resume()}[$n](e){e.piped=!0,e.readdir&&e.readdir.forEach(s=>{let n=e.path,r=n==="./"?"":n.replace(/\/*$/,"/");this[Mn](r+s)});let t=e.entry,i=this.zip;if(!t)throw new Error("cannot pipe without source");i?t.on("data",s=>{i.write(s)||t.pause()}):t.on("data",s=>{super.write(s)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,i={}){Wn(this,e,t,i)}},Ja=class extends Jn{sync=!0;constructor(e){super(e),this[xn]=rw}pause(){}resume(){}[La](e){let t=this.follow?"statSync":"lstatSync";this[Cn](e,ns.default[t](e.absolute))}[Ca](e){this[Dn](e,ns.default.readdirSync(e.absolute))}[$n](e){let t=e.entry,i=this.zip;if(e.readdir&&e.readdir.forEach(s=>{let n=e.path,r=n==="./"?"":n.replace(/\/*$/,"/");this[Mn](r+s)}),!t)throw new Error("Cannot pipe without source");i?t.on("data",s=>{i.write(s)}):t.on("data",s=>{super[rf](s)})}},fw=(e,t)=>{let i=new Ja(e),s=new Ku(e.file,{mode:e.mode||438});i.pipe(s),of(i,t)},dw=(e,t)=>{let i=new Jn(e),s=new zn(e.file,{mode:e.mode||438});i.pipe(s);let n=new Promise((r,o)=>{s.on("error",o),s.on("close",r),i.on("error",o)});return af(i,t).catch(r=>i.emit("error",r)),n},of=(e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Hn({file:Ua.default.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:s=>e.add(s)}):e.add(i)}),e.end()},af=async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Hn({file:Ua.default.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:s=>{e.add(s)}}):e.add(i);e.end()},pw=(e,t)=>{let i=new Ja(e);return of(i,t),i},mw=(e,t)=>{let i=new Jn(e);return af(i,t).catch(s=>i.emit("error",s)),i},yv=os(fw,dw,pw,mw,(e,t)=>{if(!t?.length)throw new TypeError("no paths specified to add to archive")}),gw=process.env.__FAKE_PLATFORM__||process.platform,cf=gw==="win32",{O_CREAT:hf,O_NOFOLLOW:Ru,O_TRUNC:uf,O_WRONLY:ff}=Qa.default.constants,df=Number(process.env.__FAKE_FS_O_FILENAME__)||Qa.default.constants.UV_FS_O_FILEMAP||0,yw=cf&&!!df,bw=512*1024,ww=df|uf|hf|ff,Pu=!cf&&typeof Ru=="number"?Ru|uf|hf|ff:null,pf=Pu!==null?()=>Pu:yw?e=>e"w",Ma=(e,t,i)=>{try{return as.default.lchownSync(e,t,i)}catch(s){if(s?.code!=="ENOENT")throw s}},Kn=(e,t,i,s)=>{as.default.lchown(e,t,i,n=>{s(n&&n?.code!=="ENOENT"?n:null)})},Sw=(e,t,i,s,n)=>{if(t.isDirectory())mf(Xt.default.resolve(e,t.name),i,s,r=>{if(r)return n(r);let o=Xt.default.resolve(e,t.name);Kn(o,i,s,n)});else{let r=Xt.default.resolve(e,t.name);Kn(r,i,s,n)}},mf=(e,t,i,s)=>{as.default.readdir(e,{withFileTypes:!0},(n,r)=>{if(n){if(n.code==="ENOENT")return s();if(n.code!=="ENOTDIR"&&n.code!=="ENOTSUP")return s(n)}if(n||!r.length)return Kn(e,t,i,s);let o=r.length,a=null,l=c=>{if(!a){if(c)return s(a=c);if(--o===0)return Kn(e,t,i,s)}};for(let c of r)Sw(e,c,t,i,l)})},vw=(e,t,i,s)=>{t.isDirectory()&&gf(Xt.default.resolve(e,t.name),i,s),Ma(Xt.default.resolve(e,t.name),i,s)},gf=(e,t,i)=>{let s;try{s=as.default.readdirSync(e,{withFileTypes:!0})}catch(n){let r=n;if(r?.code==="ENOENT")return;if(r?.code==="ENOTDIR"||r?.code==="ENOTSUP")return Ma(e,t,i);throw r}for(let n of s)vw(e,n,t,i);return Ma(e,t,i)},bf=class extends Error{path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}},Zn=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}},Ew=(e,t)=>{ne.default.stat(e,(i,s)=>{(i||!s.isDirectory())&&(i=new bf(e,i?.code||"ENOTDIR")),t(i)})},kw=(e,t,i)=>{e=R(e);let s=t.umask??18,n=t.mode|448,r=(n&s)!==0,o=t.uid,a=t.gid,l=typeof o=="number"&&typeof a=="number"&&(o!==t.processUid||a!==t.processGid),c=t.preserve,h=t.unlink,u=R(t.cwd),f=(g,d)=>{g?i(g):d&&l?mf(d,o,a,m=>f(m)):r?ne.default.chmod(e,n,i):i()};if(e===u)return Ew(e,f);if(c)return yf.default.mkdir(e,{mode:n,recursive:!0}).then(g=>f(null,g??void 0),f);let p=R(rs.default.relative(u,e)).split("/");Da(u,p,n,h,u,void 0,f)},Da=(e,t,i,s,n,r,o)=>{if(t.length===0)return o(null,r);let a=t.shift(),l=R(rs.default.resolve(e+"/"+a));ne.default.mkdir(l,i,wf(l,t,i,s,n,r,o))},wf=(e,t,i,s,n,r,o)=>a=>{a?ne.default.lstat(e,(l,c)=>{if(l)l.path=l.path&&R(l.path),o(l);else if(c.isDirectory())Da(e,t,i,s,n,r,o);else if(s)ne.default.unlink(e,h=>{if(h)return o(h);ne.default.mkdir(e,i,wf(e,t,i,s,n,r,o))});else{if(c.isSymbolicLink())return o(new Zn(e,e+"/"+t.join("/")));o(a)}}):(r=r||e,Da(e,t,i,s,n,r,o))},Ow=e=>{let t=!1,i;try{t=ne.default.statSync(e).isDirectory()}catch(s){i=s?.code}finally{if(!t)throw new bf(e,i??"ENOTDIR")}},_w=(e,t)=>{e=R(e);let i=t.umask??18,s=t.mode|448,n=(s&i)!==0,r=t.uid,o=t.gid,a=typeof r=="number"&&typeof o=="number"&&(r!==t.processUid||o!==t.processGid),l=t.preserve,c=t.unlink,h=R(t.cwd),u=g=>{g&&a&&gf(g,r,o),n&&ne.default.chmodSync(e,s)};if(e===h)return Ow(h),u();if(l)return u(ne.default.mkdirSync(e,{mode:s,recursive:!0})??void 0);let f=R(rs.default.relative(h,e)).split("/"),p;for(let g=f.shift(),d=h;g&&(d+="/"+g);g=f.shift()){d=R(rs.default.resolve(d));try{ne.default.mkdirSync(d,s),p=p||d}catch{let m=ne.default.lstatSync(d);if(m.isDirectory())continue;if(c){ne.default.unlinkSync(d),ne.default.mkdirSync(d,s),p=p||d;continue}else if(m.isSymbolicLink())return new Zn(d,d+"/"+f.join("/"))}}return u(p)},ma=Object.create(null),Iu=1e4,Yt=new Set,Aw=e=>{Yt.has(e)?Yt.delete(e):ma[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Yt.add(e);let t=ma[e],i=Yt.size-Iu;if(i>Iu/10){for(let s of Yt)if(Yt.delete(s),delete ma[s],--i<=0)break}return t},Nw=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Rw=Nw==="win32",Pw=e=>e.split("/").slice(0,-1).reduce((t,i)=>{let s=t.at(-1);return s!==void 0&&(i=(0,el.join)(s,i)),t.push(i||"/"),t},[]),Iw=class{#e=new Map;#i=new Map;#s=new Set;reserve(e,t){e=Rw?["win32 parallelization disabled"]:e.map(s=>Zi((0,el.join)(Aw(s))));let i=new Set(e.map(s=>Pw(s)).reduce((s,n)=>s.concat(n)));this.#i.set(t,{dirs:i,paths:e});for(let s of e){let n=this.#e.get(s);n?n.push(t):this.#e.set(s,[t])}for(let s of i){let n=this.#e.get(s);if(!n)this.#e.set(s,[new Set([t])]);else{let r=n.at(-1);r instanceof Set?r.add(t):n.push(new Set([t]))}}return this.#n(t)}#r(e){let t=this.#i.get(e);if(!t)throw new Error("function does not have any path reservations");return{paths:t.paths.map(i=>this.#e.get(i)),dirs:[...t.dirs].map(i=>this.#e.get(i))}}check(e){let{paths:t,dirs:i}=this.#r(e);return t.every(s=>s&&s[0]===e)&&i.every(s=>s&&s[0]instanceof Set&&s[0].has(e))}#n(e){return this.#s.has(e)||!this.check(e)?!1:(this.#s.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#s.has(e))return!1;let t=this.#i.get(e);if(!t)throw new Error("invalid reservation");let{paths:i,dirs:s}=t,n=new Set;for(let r of i){let o=this.#e.get(r);if(!o||o?.[0]!==e)continue;let a=o[1];if(!a){this.#e.delete(r);continue}if(o.shift(),typeof a=="function")n.add(a);else for(let l of a)n.add(l)}for(let r of s){let o=this.#e.get(r),a=o?.[0];if(!(!o||!(a instanceof Set)))if(a.size===1&&o.length===1){this.#e.delete(r);continue}else if(a.size===1){o.shift();let l=o[0];typeof l=="function"&&n.add(l)}else a.delete(e)}return this.#s.delete(e),n.forEach(r=>this.#n(r)),!0}},Tw=()=>process.umask(),Tu=Symbol("onEntry"),$a=Symbol("checkFs"),Lu=Symbol("checkFs2"),xa=Symbol("isReusable"),le=Symbol("makeFs"),qa=Symbol("file"),Ba=Symbol("directory"),qn=Symbol("link"),Cu=Symbol("symlink"),Mu=Symbol("hardlink"),Vi=Symbol("ensureNoSymlink"),Du=Symbol("unsupported"),$u=Symbol("checkPath"),ga=Symbol("stripAbsolutePath"),st=Symbol("mkdir"),V=Symbol("onError"),Nn=Symbol("pending"),xu=Symbol("pend"),Gt=Symbol("unpend"),ya=Symbol("ended"),ba=Symbol("maybeClose"),Fa=Symbol("skip"),Xi=Symbol("doChown"),Qi=Symbol("uid"),es=Symbol("gid"),ts=Symbol("checkedCwd"),Lw=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,is=Lw==="win32",Cw=1024,Mw=(e,t)=>{if(!is)return P.default.unlink(e,t);let i=e+".DELETE."+(0,Xa.randomBytes)(16).toString("hex");P.default.rename(e,i,s=>{if(s)return t(s);P.default.unlink(i,t)})},Dw=e=>{if(!is)return P.default.unlinkSync(e);let t=e+".DELETE."+(0,Xa.randomBytes)(16).toString("hex");P.default.renameSync(e,t),P.default.unlinkSync(t)},qu=(e,t,i)=>e!==void 0&&e===e>>>0?e:t!==void 0&&t===t>>>0?t:i,tl=class extends ss{[ya]=!1;[ts]=!1;[Nn]=0;reservations=new Iw;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[ya]=!0,this[ba]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=e.preserveOwner===void 0&&typeof e.uid!="number"?!!(process.getuid&&process.getuid()===0):!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:Cw,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||is,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=R(j.default.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:Tw():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[Tu](t))}warn(e,t,i={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(i.recoverable=!1),super.warn(e,t,i)}[ba](){this[ya]&&this[Nn]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[ga](e,t){let i=e[t],{type:s}=e;if(!i||this.preservePaths)return!0;let[n,r]=Wa(i),o=r.replaceAll(/\\/g,"/").split("/");if(o.includes("..")||is&&/^[a-z]:\.\.$/i.test(o[0]??"")){if(t==="path"||s==="Link")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:i}),!1;let a=j.default.posix.dirname(e.path),l=j.default.posix.normalize(j.default.posix.join(a,o.join("/")));if(l.startsWith("../")||l==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:i}),!1}return n&&(e[t]=String(r),this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute ${t}`,{entry:e,[t]:i})),!0}[$u](e){let t=R(e.path),i=t.split("/");if(this.strip){if(i.length=this.strip)e.linkpath=s.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),e.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[ga](e,"path")||!this[ga](e,"linkpath"))return!1;if(e.absolute=j.default.isAbsolute(e.path)?R(j.default.resolve(e.path)):R(j.default.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:R(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:s}=j.default.win32.parse(String(e.absolute));e.absolute=s+wu(String(e.absolute).slice(s.length));let{root:n}=j.default.win32.parse(e.path);e.path=n+wu(e.path.slice(n.length))}return!0}[Tu](e){if(!this[$u](e))return e.resume();switch(lf.default.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[$a](e);default:return this[Du](e)}}[V](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[Gt](),t.resume())}[st](e,t,i){kw(R(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t},i)}[Xi](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[Qi](e){return qu(this.uid,e.uid,this.processUid)}[es](e){return qu(this.gid,e.gid,this.processGid)}[qa](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=new zn(String(e.absolute),{flags:pf(e.size),mode:i,autoClose:!1});s.on("error",a=>{s.fd&&P.default.close(s.fd,()=>{}),s.write=()=>!0,this[V](a,e),t()});let n=1,r=a=>{if(a){s.fd&&P.default.close(s.fd,()=>{}),this[V](a,e),t();return}--n===0&&s.fd!==void 0&&P.default.close(s.fd,l=>{l?this[V](l,e):this[Gt](),t()})};s.on("finish",()=>{let a=String(e.absolute),l=s.fd;if(typeof l=="number"&&e.mtime&&!this.noMtime){n++;let c=e.atime||new Date,h=e.mtime;P.default.futimes(l,c,h,u=>u?P.default.utimes(a,c,h,f=>r(f&&u)):r())}if(typeof l=="number"&&this[Xi](e)){n++;let c=this[Qi](e),h=this[es](e);typeof c=="number"&&typeof h=="number"&&P.default.fchown(l,c,h,u=>u?P.default.chown(a,c,h,f=>r(f&&u)):r())}r()});let o=this.transform&&this.transform(e)||e;o!==e&&(o.on("error",a=>{this[V](a,e),t()}),e.pipe(o)),o.pipe(s)}[Ba](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode;this[st](String(e.absolute),i,s=>{if(s){this[V](s,e),t();return}let n=1,r=()=>{--n===0&&(t(),this[Gt](),e.resume())};e.mtime&&!this.noMtime&&(n++,P.default.utimes(String(e.absolute),e.atime||new Date,e.mtime,r)),this[Xi](e)&&(n++,P.default.chown(String(e.absolute),Number(this[Qi](e)),Number(this[es](e)),r)),r()})}[Du](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[Cu](e,t){let i=R(j.default.relative(this.cwd,j.default.resolve(j.default.dirname(String(e.absolute)),String(e.linkpath)))).split("/");this[Vi](e,this.cwd,i,()=>this[qn](e,String(e.linkpath),"symlink",t),s=>{this[V](s,e),t()})}[Mu](e,t){let i=R(j.default.resolve(this.cwd,String(e.linkpath))),s=R(String(e.linkpath)).split("/");this[Vi](e,this.cwd,s,()=>this[qn](e,i,"link",t),n=>{this[V](n,e),t()})}[Vi](e,t,i,s,n){let r=i.shift();if(this.preservePaths||r===void 0)return s();let o=j.default.resolve(t,r);P.default.lstat(o,(a,l)=>{if(a)return s();if(l?.isSymbolicLink())return n(new Zn(o,j.default.resolve(o,i.join("/"))));this[Vi](e,o,i,s,n)})}[xu](){this[Nn]++}[Gt](){this[Nn]--,this[ba]()}[Fa](e){this[Gt](),e.resume()}[xa](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!is}[$a](e){this[xu]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,i=>this[Lu](e,i))}[Lu](e,t){let i=o=>{t(o)},s=()=>{this[st](this.cwd,this.dmode,o=>{if(o){this[V](o,e),i();return}this[ts]=!0,n()})},n=()=>{if(e.absolute!==this.cwd){let o=R(j.default.dirname(String(e.absolute)));if(o!==this.cwd)return this[st](o,this.dmode,a=>{if(a){this[V](a,e),i();return}r()})}r()},r=()=>{P.default.lstat(String(e.absolute),(o,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(e.mtime??a.mtime))){this[Fa](e),i();return}if(o||this[xa](e,a))return this[le](null,e,i);if(a.isDirectory()){if(e.type==="Directory"){let l=this.chmod&&e.mode&&(a.mode&4095)!==e.mode,c=h=>this[le](h??null,e,i);return l?P.default.chmod(String(e.absolute),Number(e.mode),c):c()}if(e.absolute!==this.cwd)return P.default.rmdir(String(e.absolute),l=>this[le](l??null,e,i))}if(e.absolute===this.cwd)return this[le](null,e,i);Mw(String(e.absolute),l=>this[le](l??null,e,i))})};this[ts]?n():s()}[le](e,t,i){if(e){this[V](e,t),i();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[qa](t,i);case"Link":return this[Mu](t,i);case"SymbolicLink":return this[Cu](t,i);case"Directory":case"GNUDumpDir":return this[Ba](t,i)}}[qn](e,t,i,s){P.default[i](t,String(e.absolute),n=>{n?this[V](n,e):(this[Gt](),e.resume()),s()})}},Wi=e=>{try{return[null,e()]}catch(t){return[t,null]}},Sf=class extends tl{sync=!0;[le](e,t){return super[le](e,t,()=>{})}[$a](e){if(!this[ts]){let n=this[st](this.cwd,this.dmode);if(n)return this[V](n,e);this[ts]=!0}if(e.absolute!==this.cwd){let n=R(j.default.dirname(String(e.absolute)));if(n!==this.cwd){let r=this[st](n,this.dmode);if(r)return this[V](r,e)}}let[t,i]=Wi(()=>P.default.lstatSync(String(e.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(e.mtime??i.mtime)))return this[Fa](e);if(t||this[xa](e,i))return this[le](null,e);if(i.isDirectory()){if(e.type==="Directory"){let r=this.chmod&&e.mode&&(i.mode&4095)!==e.mode,[o]=r?Wi(()=>{P.default.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[le](o,e)}let[n]=Wi(()=>P.default.rmdirSync(String(e.absolute)));this[le](n,e)}let[s]=e.absolute===this.cwd?[]:Wi(()=>Dw(String(e.absolute)));this[le](s,e)}[qa](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=o=>{let a;try{P.default.closeSync(n)}catch(l){a=l}(o||a)&&this[V](o||a,e),t()},n;try{n=P.default.openSync(String(e.absolute),pf(e.size),i)}catch(o){return s(o)}let r=this.transform&&this.transform(e)||e;r!==e&&(r.on("error",o=>this[V](o,e)),e.pipe(r)),r.on("data",o=>{try{P.default.writeSync(n,o,0,o.length)}catch(a){s(a)}}),r.on("end",()=>{let o=null;if(e.mtime&&!this.noMtime){let a=e.atime||new Date,l=e.mtime;try{P.default.futimesSync(n,a,l)}catch(c){try{P.default.utimesSync(String(e.absolute),a,l)}catch{o=c}}}if(this[Xi](e)){let a=this[Qi](e),l=this[es](e);try{P.default.fchownSync(n,Number(a),Number(l))}catch(c){try{P.default.chownSync(String(e.absolute),Number(a),Number(l))}catch{o=o||c}}}s(o)})}[Ba](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode,s=this[st](String(e.absolute),i);if(s){this[V](s,e),t();return}if(e.mtime&&!this.noMtime)try{P.default.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Xi](e))try{P.default.chownSync(String(e.absolute),Number(this[Qi](e)),Number(this[es](e)))}catch{}t(),e.resume()}[st](e,t){try{return _w(R(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t})}catch(i){return i}}[Vi](e,t,i,s,n){if(this.preservePaths||i.length===0)return s();let r=t;for(let o of i){r=j.default.resolve(r,o);let[a,l]=Wi(()=>P.default.lstatSync(r));if(a)return s();if(l.isSymbolicLink())return n(new Zn(r,j.default.resolve(t,i.join("/"))))}s()}[qn](e,t,i,s){let n=`${i}Sync`;try{P.default[n](t,String(e.absolute)),s(),e.resume()}catch(r){return this[V](r,e)}}},$w=e=>{let t=new Sf(e),i=e.file,s=Za.default.statSync(i),n=e.maxReadSize||16*1024*1024;new hb(i,{readSize:n,size:s.size}).pipe(t)},xw=(e,t)=>{let i=new tl(e),s=e.maxReadSize||16*1024*1024,n=e.file;return new Promise((r,o)=>{i.on("error",o),i.on("close",r),Za.default.stat(n,(a,l)=>{if(a)o(a);else{let c=new Ka(n,{readSize:s,size:l.size});c.on("error",o),c.pipe(i)}})})},ls=os($w,xw,e=>new Sf(e),e=>new tl(e),(e,t)=>{t?.length&&Qu(e,t)}),qw=(e,t)=>{let i=new Ja(e),s=!0,n,r;try{try{n=se.default.openSync(e.file,"r+")}catch(l){if(l?.code==="ENOENT")n=se.default.openSync(e.file,"w+");else throw l}let o=se.default.fstatSync(n),a=Buffer.alloc(512);e:for(r=0;ro.size)break;r+=c,e.mtimeCache&&l.mtime&&e.mtimeCache.set(String(l.path),l.mtime)}s=!1,Bw(e,i,r,n,t)}finally{if(s)try{se.default.closeSync(n)}catch{}}},Bw=(e,t,i,s,n)=>{let r=new Ku(e.file,{fd:s,start:i});t.pipe(r),jw(t,n)},Fw=(e,t)=>{t=Array.from(t);let i=new Jn(e),s=(n,r,o)=>{let a=(f,p)=>{f?se.default.close(n,g=>o(f)):o(null,p)},l=0;if(r===0)return a(null,0);let c=0,h=Buffer.alloc(512),u=(f,p)=>{if(f||p===void 0)return a(f);if(c+=p,c<512&&p)return se.default.read(n,h,c,h.length-c,l+c,u);if(l===0&&h[0]===31&&h[1]===139)return a(new Error("cannot append to compressed archives"));if(c<512)return a(null,l);let g=new At(h);if(!g.cksumValid)return a(null,l);let d=512*Math.ceil((g.size??0)/512);if(l+d+512>r||(l+=d+512,l>=r))return a(null,l);e.mtimeCache&&g.mtime&&e.mtimeCache.set(String(g.path),g.mtime),c=0,se.default.read(n,h,0,512,l,u)};se.default.read(n,h,0,512,l,u)};return new Promise((n,r)=>{i.on("error",r);let o="r+",a=(l,c)=>{if(l&&l.code==="ENOENT"&&o==="r+")return o="w+",se.default.open(e.file,o,a);if(l||!c)return r(l);se.default.fstat(c,(h,u)=>{if(h)return se.default.close(c,()=>r(h));s(c,u.size,(f,p)=>{if(f)return r(f);let g=new zn(e.file,{fd:c,start:p});i.pipe(g),g.on("error",r),g.on("close",n),Kw(i,t)})})};se.default.open(e.file,o,a)})},jw=(e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Hn({file:il.default.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:s=>e.add(s)}):e.add(i)}),e.end()},Kw=async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Hn({file:il.default.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:s=>e.add(s)}):e.add(i);e.end()},Hi=os(qw,Fw,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(e,t)=>{if(!gb(e))throw new TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!t?.length)throw new TypeError("no paths specified to add/replace")}),bv=os(Hi.syncFile,Hi.asyncFile,Hi.syncNoFile,Hi.asyncNoFile,(e,t=[])=>{Hi.validate?.(e,t),Uw(e)}),Uw=e=>{let t=e.filter;e.mtimeCache||(e.mtimeCache=new Map),e.filter=t?(i,s)=>t(i,s)&&!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(i,s)=>!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0))};var b=class extends Error{constructor(t){super(t),this.name="InstallException"}};function S(e){process.stdout.write(`${e} -`)}var Rt={IF_NOT_PRESENT:"IfNotPresent",ALWAYS:"Always"},ce="docker://",D="oci://",zw=":latest!",sl="registry.access.redhat.com/rhdh/",nl="quay.io/rhdh/",ei="dynamic-plugin-config.hash",rl="dynamic-plugin-image.hash",Xn="dynamic-plugins.default.yaml",kf="install-dynamic-plugins.lock",ol="app-config.dynamic-plugins.yaml",Ef=4e7;function Yw(e=process.env.MAX_ENTRY_SIZE){if(!e)return Ef;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=1?t:Ef}var cs=Yw(),ot=["sha512","sha384","sha256"];function Qn(e){return e.pullPolicy?e.pullPolicy:e.package.includes(zw)?Rt.ALWAYS:Rt.IF_NOT_PRESENT}async function ti(e,t){let{proto:i,raw:s}=Gw(t);if(!s.startsWith(sl))return t;let n=`${ce}${s}`;if(await e.exists(n))return t;let r=s.replace(sl,nl);return S(` ==> Falling back to ${nl} for ${s}`),`${i}${r}`}function Gw(e){return e.startsWith(D)?{proto:D,raw:e.slice(D.length)}:e.startsWith(ce)?{proto:ce,raw:e.slice(ce.length)}:{proto:"",raw:e}}var Of=O(require("node:fs/promises")),al=O(require("node:path"));async function be(e){try{return await Of.access(e),!0}catch{return!1}}function ii(e,t){let i=t.endsWith(al.sep)?t:t+al.sep;return e===t||e.startsWith(i)}function De(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function er(e){return e==="File"||e==="Directory"||e==="SymbolicLink"||e==="Link"||e==="OldFile"||e==="ContiguousFile"}function tr(e,t){for(let[i,s]of e)s===t&&e.delete(i)}async function _f(e,t,i,s){S(` -======= Extracting catalog index from ${t}`);let n=x.join(i,".catalog-index-temp");await q.mkdir(n,{recursive:!0});let r=x.resolve(n);await Af(e,t,r);let o=x.join(n,Xn);if(!await be(o))throw new b(`dynamic-plugins.default.yaml not found in ${t}`);S(" ==> Extracted dynamic-plugins.default.yaml");for(let a of["catalog-entities/extensions","catalog-entities/marketplace"]){let l=x.join(n,a);if(await be(l)){await q.mkdir(s,{recursive:!0});let c=x.join(s,"catalog-entities");await q.rm(c,{recursive:!0,force:!0}),await cl(l,c),S(` ==> Extracted catalog entities from ${a}`);break}}return o}async function Af(e,t,i){let s=await ti(e,t),n=await q.mkdtemp(x.join(ll.tmpdir(),"rhdh-catalog-index-"));try{let r=s.startsWith(ce)?s:`${ce}${s.replace(D,"")}`,o=x.join(n,"idx");S(" ==> Downloading catalog index image"),await e.copy(r,`dir:${o}`);let a=x.join(o,"manifest.json");if(!await be(a))throw new b(`manifest.json not found in catalog index image ${t}`);let c=JSON.parse(await q.readFile(a,"utf8")).layers??[],h=null;for(let u of c){if(h)break;let f=u.digest;if(!f)continue;let[,p]=f.split(":");if(!p)continue;let g=x.join(o,p);await be(g)&&await ls({file:g,cwd:i,preservePaths:!1,filter:(d,m)=>{if(h)return!1;let w=m;if(w.size>cs)return h=new b(`Zip bomb detected in ${d}`),!1;if(w.type==="SymbolicLink"||w.type==="Link"){let k=x.resolve(i,w.linkpath??"");if(!ii(k,i))return!1}let E=x.resolve(i,d);return ii(E,i)?er(w.type):!1}})}if(h)throw h}finally{await q.rm(n,{recursive:!0,force:!0})}}async function Nf(e,t,i,s,n){if(!Pf(i))throw new b(`Refusing to extract extra catalog index into unsafe subdirectory '${i}'`);S(` -======= Extracting extra catalog index '${i}' from ${t}`),n&&S(` ==> WARNING: Subdirectory '${i}' was already used by '${n}'. The previous extraction will be overwritten.`);let r=await q.mkdtemp(x.join(ll.tmpdir(),"rhdh-extra-catalog-index-"));try{let o=x.join(r,"extracted");await q.mkdir(o,{recursive:!0}),await Af(e,t,o);let a=x.join(s,i);S(` ==> Extracting extensions catalog entities to ${a}`);let l=null;for(let h of["catalog-entities/extensions","catalog-entities/marketplace"]){let u=x.join(o,h);if(await be(u)){l=u;break}}if(!l){S(` ==> WARNING: Extra catalog index image ${t} does not have neither 'catalog-entities/extensions/' nor 'catalog-entities/marketplace/' directory`);return}await q.mkdir(a,{recursive:!0});let c=x.join(a,"catalog-entities");await q.rm(c,{recursive:!0,force:!0}),await cl(l,c),S(` ==> Successfully extracted extensions catalog entities from extra index image to ${a}`)}finally{await q.rm(r,{recursive:!0,force:!0})}}function Ww(e){return e.replaceAll(/[/:@]/g,"_")}function Rf(e){let t=[];for(let i of e.split(",")){let s=i.trim();if(!s)continue;let n,r,o=s.indexOf("=");if(o===-1?(r=s,n=Ww(r)):(n=s.slice(0,o).trim(),r=s.slice(o+1).trim()),!r){S(`WARNING: Skipping EXTRA_CATALOG_INDEX_IMAGES entry with empty image reference: '${s}'`);continue}if(!Pf(n)){S(`WARNING: Skipping EXTRA_CATALOG_INDEX_IMAGES entry with unsafe subdirectory name '${n}' in '${s}'. Names must be non-empty and must not contain '/', '\\\\', or '..'.`);continue}t.push([n,r])}return t}function Pf(e){return!e||e==="."||e===".."?!1:!/[/\\]/.test(e)}async function If(e){await q.rm(x.join(e,".catalog-index-temp"),{recursive:!0,force:!0})}async function cl(e,t){await q.mkdir(t,{recursive:!0});let i=await q.readdir(e,{withFileTypes:!0});for(let s of i){let n=x.join(e,s.name),r=x.join(t,s.name);s.isDirectory()?await cl(n,r):s.isFile()&&await q.copyFile(n,r)}}var hs=O(require("node:os")),hl=class{available;queue=[];constructor(t){if(t<1)throw new RangeError(`Semaphore max must be >= 1, got ${t}`);this.available=t}async acquire(){if(this.available>0){this.available--;return}return new Promise(t=>this.queue.push(t))}release(){let t=this.queue.shift();t?t():this.available++}};async function Tf(e,t,i){let s=new hl(Math.max(1,t));return Promise.all(e.map(async n=>{await s.acquire();try{return{ok:!0,value:await i(n),item:n}}catch(r){return{ok:!1,error:r,item:n}}finally{s.release()}}))}var Hw=6,Vw=3;function Lf(){return Mf(process.env.DYNAMIC_PLUGINS_WORKERS,Hw)}function Cf(){return Mf(process.env.DYNAMIC_PLUGINS_NPM_WORKERS,Vw)}function Mf(e,t){let i=e??"auto";if(i!=="auto"){let n=Number.parseInt(i,10);return!Number.isFinite(n)||n<1?1:n}let s=typeof hs.availableParallelism=="function"?hs.availableParallelism():hs.cpus().length;return Math.max(1,Math.min(Math.floor(s/2),t))}var Df=require("node:crypto"),nr=O(require("node:fs/promises")),ir=O(require("node:path"));var sr=class{constructor(t,i){this.skopeo=t;this.tmpDir=i}tarballs=new Map;async getTarball(t){let i=await ti(this.skopeo,t),s=this.tarballs.get(i);return s||(s=this.downloadAndLocateTarball(i),this.tarballs.set(i,s),s.catch(()=>this.tarballs.delete(i))),s}async getDigest(t){let s=(await ti(this.skopeo,t)).replace(D,ce),r=(await this.skopeo.inspect(s)).Digest;if(!r)throw new b(`No digest returned for ${t}`);let[,o]=r.split(":");if(!o)throw new b(`Malformed digest ${r} for ${t}`);return o}async getPluginPaths(t){let s=(await ti(this.skopeo,t)).replace(D,ce),r=(await this.skopeo.inspectRaw(s)).annotations?.["io.backstage.dynamic-packages"];if(!r)return[];let o;try{let l=Buffer.from(r,"base64").toString("utf8");o=JSON.parse(l)}catch(l){throw new b(`Could not decode 'io.backstage.dynamic-packages' annotation on ${t}: ${l.message}`)}if(!Array.isArray(o))return[];let a=[];for(let l of o)l&&typeof l=="object"&&a.push(...Object.keys(l));return a}async downloadAndLocateTarball(t){let i=(0,Df.createHash)("sha256").update(t).digest("hex"),s=ir.join(this.tmpDir,i);await nr.mkdir(s,{recursive:!0});let n=t.replace(D,ce);S(` ==> Downloading ${t}`),await this.skopeo.copy(n,`dir:${s}`);let r=ir.join(s,"manifest.json"),a=JSON.parse(await nr.readFile(r,"utf8")).layers?.[0]?.digest;if(!a)throw new b(`OCI manifest for ${t} has no layers`);let[,l]=a.split(":");if(!l)throw new b(`Malformed layer digest ${a} in ${t}`);return ir.join(s,l)}};var Yf=O(require("node:fs/promises")),rr=O(require("node:path"));var xf=require("node:crypto"),qf=require("node:fs"),Bf=require("node:stream/promises");async function Ff(e,t,i){let s=i.indexOf("-");if(s===-1)throw new b(`Package integrity for ${e} must be a string of the form -`);let n=i.slice(0,s),r=i.slice(s+1);if(!Jw(n))throw new b(`${e}: Provided Package integrity algorithm ${n} is not supported, please use one of following algorithms ${ot.join(", ")} instead`);if(!Zw(r))throw new b(`${e}: Provided Package integrity hash ${r} is not a valid base64 encoding`);let o=(0,xf.createHash)(n);await(0,Bf.pipeline)((0,qf.createReadStream)(t),o);let a=o.digest("base64");if(a!==r)throw new b(`${e}: integrity check failed \u2014 got ${n}-${a}, expected ${i}`)}function Jw(e){return ot.includes(e)}function Zw(e){if(e.length===0||!Xw(e))return!1;try{let t=Buffer.from(e,"base64");return $f(t.toString("base64"))===$f(e)}catch{return!1}}var jf=61;function Xw(e){let t=0;for(let i=0;i2)return!1;continue}if(t>0||!Qw(s))return!1}return!0}function Qw(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function $f(e){let t=e.length;for(;t>0&&e.codePointAt(t-1)===jf;)t--;return e.slice(0,t)}var Kf=require("node:child_process");async function us(e,t,i={}){if(e.length===0)throw new b(`${t}: empty command`);let[s,...n]=e;return new Promise((r,o)=>{let a=(0,Kf.spawn)(s,n,{...i,stdio:["ignore","pipe","pipe"]}),l="",c="";a.stdout?.on("data",h=>l+=h.toString()),a.stderr?.on("data",h=>c+=h.toString()),a.on("error",h=>o(new b(`${t}: ${h.message}`))),a.on("close",h=>{if(h===0)r({stdout:l,stderr:c});else{let u=[`${t}: exit code ${h}`,`cmd: ${e.join(" ")}`];c.trim()&&u.push(`stderr: ${c.trim()}`),o(new b(u.join(` -`)))}})})}var Pt=O(require("node:fs/promises")),we=O(require("node:path"));var fs="package/";async function Uf(e,t,i){eS(t);let s=we.resolve(i),n=we.join(s,t);await Pt.rm(n,{recursive:!0,force:!0}),await Pt.mkdir(s,{recursive:!0});let r=t.endsWith("/")?t:`${t}/`,o=null;if(await ls({file:e,cwd:s,preservePaths:!1,filter:(a,l)=>{if(o)return!1;let c=l;if(a!==t&&!a.startsWith(r))return!1;if(c.size>cs)return o=new b(`Zip bomb detected in ${a}`),!1;if(c.type==="SymbolicLink"||c.type==="Link"){let h=c.linkpath??"",u=we.resolve(s,h);if(!ii(u,s))return S(` ==> WARNING: skipping file containing link outside of the archive: ${a} -> ${h}`),!1}return er(c.type)?!0:(o=new b(`Disallowed tar entry type ${c.type} for ${a}`),!1)}}),o)throw o}async function zf(e){if(!e.endsWith(".tgz"))throw new b(`Expected .tgz archive, got ${e}`);let t=e.slice(0,-4),i=we.resolve(t);await Pt.rm(t,{recursive:!0,force:!0}),await Pt.mkdir(t,{recursive:!0});let s=null;if(await ls({file:e,cwd:t,preservePaths:!1,filter:(n,r)=>{if(s)return!1;let o=r;if(o.type==="Directory")return!1;if(o.type==="File")return n.startsWith(fs)?o.size>cs?(s=new b(`Zip bomb detected in ${n}`),!1):(o.path=n.slice(fs.length),!0):(s=new b(`NPM package archive does not start with 'package/' as it should: ${n}`),!1);if(o.type==="SymbolicLink"||o.type==="Link"){let a=o.linkpath??"";if(!a.startsWith(fs))return s=new b(`NPM package archive contains a link outside of the archive: ${n} -> ${a}`),!1;o.path=n.slice(fs.length),o.linkpath=a.slice(fs.length);let l=we.resolve(t,o.linkpath);return ii(l,i)?!0:(s=new b(`NPM package archive contains a link outside of the archive: ${o.path} -> ${o.linkpath}`),!1)}return s=new b(`NPM package archive contains a non-regular file: ${n}`),!1}}),s)throw s;return await Pt.rm(e,{force:!0}),we.basename(i)}function eS(e){if(we.isAbsolute(e))throw new b(`Invalid plugin path (absolute): ${e}`);if(e.length===0)throw new b("Invalid plugin path (empty)");let t=e.split(/[/\\]/);for(let i of t)if(i===""||i==="."||i==="..")throw new b(`Invalid plugin path (path traversal detected): ${e}`)}async function Gf(e,t,i,s){if(e.disabled)return{pluginPath:null,pluginConfig:{}};let n=e.plugin_hash;if(!n)throw new b(`Internal error: plugin ${e.package} missing plugin_hash`);let r=e.package,o=e.pluginConfig??{},a=r.startsWith("./"),l=a?rr.join(process.cwd(),r.slice(2)):r,c=!a&&!i;if(c&&!e.integrity)throw new b(`No integrity hash provided for Package ${r}. This is an insecure installation. To ignore this error, set the SKIP_INTEGRITY_CHECK environment variable to 'true'.`);S(" ==> Running npm pack");let h=await tS(l,t);if(!sS(h))throw new b(`npm pack returned an unsafe filename for ${r}: '${h}'`);let u=rr.join(t,h);c&&(S(" ==> Verifying package integrity"),await Ff(r,u,e.integrity));let f=await zf(u);return await Yf.writeFile(rr.join(t,f,ei),n),tr(s,f),{pluginPath:f,pluginConfig:o}}async function tS(e,t){let{stdout:i}=await us(["npm","pack","--json","--ignore-scripts",e],`npm pack failed for ${e}`,{cwd:t}),s;try{s=JSON.parse(i)}catch(r){throw new b(`npm pack produced invalid JSON for ${e}: ${r.message}`)}if(!Array.isArray(s)||s.length===0)throw new b(`npm pack produced no archives for ${e}`);let n=s[0];if(!iS(n))throw new b(`npm pack output missing 'filename' for ${e}`);return n.filename}function iS(e){return!!e&&typeof e=="object"&&typeof e.filename=="string"}function sS(e){return!e||e==="."||e===".."||e.startsWith("..")?!1:!/[/\\]/.test(e)}var It=O(require("node:fs/promises")),ds=O(require("node:path"));function Wf(e){let t=e.indexOf("!");if(t===-1)return null;let i=e.slice(0,t),s=e.slice(t+1);return!i||!s?null:{imagePart:i,pluginPath:s}}async function Hf(e,t,i,s){if(e.disabled)return{pluginPath:null,pluginConfig:{}};let n=e.plugin_hash;if(!n)throw new b(`Internal error: plugin ${e.package} missing plugin_hash`);let r=e.package,o=e.pluginConfig??{},a=Qn(e);if(await nS(r,n,a,t,i,s))return s.delete(n),{pluginPath:null,pluginConfig:o};if(!e.version)throw new b(`No version for ${r}`);let l=Wf(r);if(!l)throw new b(`OCI package ${r} missing !plugin-path suffix`);let{imagePart:c,pluginPath:h}=l,u=await i.getTarball(c);await Uf(u,h,t);let f=ds.join(t,h);return await It.mkdir(f,{recursive:!0}),await It.writeFile(ds.join(f,rl),await i.getDigest(c)),await It.writeFile(ds.join(f,ei),n),tr(s,h),{pluginPath:h,pluginConfig:o}}async function nS(e,t,i,s,n,r){let o=r.get(t);if(o===void 0)return!1;if(i===Rt.IF_NOT_PRESENT)return S(` ==> ${e}: already installed, skipping`),!0;if(i!==Rt.ALWAYS)return!1;let a=ds.join(s,o,rl);if(!await be(a))return!1;let l=(await It.readFile(a,"utf8")).trim(),c=Wf(e);if(!c)return!1;let h=await n.getDigest(c.imagePart);return l!==h?!1:(S(` ==> ${e}: digest unchanged, skipping`),!0)}var Jf=require("node:fs"),si=O(require("node:fs/promises"));var rS=1e3,Vf=600*1e3;async function Zf(e){let t=oS(process.env.DYNAMIC_PLUGINS_LOCK_TIMEOUT_MS),i=Date.now()+t;for(;;){try{await si.writeFile(e,String(process.pid),{flag:"wx"}),S(`======= Created lock file: ${e}`);return}catch(s){if(s.code!=="EEXIST")throw s}if(Date.now()>=i)throw new b(`Timed out after ${t}ms waiting for lock file ${e}. Another install may be stuck \u2014 remove the file manually to proceed.`);S(`======= Waiting for lock to be released: ${e}`),await aS(e,i)}}function oS(e){if(!e)return Vf;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=1?t:Vf}async function Xf(e){try{await si.unlink(e),S(`======= Removed lock file: ${e}`)}catch(t){if(t.code!=="ENOENT")throw t}}function Qf(e){let t=()=>{try{(0,Jf.unlinkSync)(e)}catch{}};process.on("exit",t),process.on("SIGTERM",()=>{t(),process.exit(0)}),process.on("SIGINT",()=>{t(),process.exit(130)})}async function aS(e,t){for(;;){try{await si.access(e)}catch{return}if(Date.now()>=t)return;await lS(rS)}}function lS(e){return new Promise(t=>setTimeout(t,e))}var wS=O(Yo());var cS=/^(@[^/]+\/)?([^@]+)(?:@(.+))?$/,hS=/^([^@]+)@npm:(@[^/]+\/)?([^@]+)(?:@(.+))?$/,uS=/^([^/@]+)\/([^/#]+)(?:#(.+))?$/,fS=[/^git\+https?:\/\/[^#]+(?:#(.+))?$/,/^git\+ssh:\/\/[^#]+(?:#(.+))?$/,/^git:\/\/[^#]+(?:#(.+))?$/,/^https:\/\/github\.com\/[^/]+\/[^/#]+(?:\.git)?(?:#(.+))?$/,/^git@github\.com:[^/]+\/[^/#]+(?:\.git)?(?:#(.+))?$/,/^github:([^/@]+)\/([^/#]+)(?:#(.+))?$/];function ed(e){if(e.startsWith("./")||e.endsWith(".tgz"))return e;let t=dS(e);return t||(pS(e)?mS(e):gS(e))}function dS(e){let t=hS.exec(e);if(!t)return null;let[,i,s,n]=t;return`${i}@npm:${s??""}${n}`}function pS(e){return fS.some(t=>t.test(e))?!0:e.includes("://")||e.startsWith("@")?!1:uS.test(e)}function mS(e){let t=e.indexOf("#");return t>=0?e.slice(0,t):e}function gS(e){let t=cS.exec(e);if(!t)return e;let[,i,s]=t;return`${i??""}${s}`}var td=new RegExp("^("+bS(D)+String.raw`[^\s/:@]+`+String.raw`(?::\d+)?`+String.raw`(?:/[^\s:@]+)+`+")"+String.raw`(?::([^\s!@:]+)`+"|"+String.raw`@((?:sha256|sha512|blake3):[^\s!@:]+))`+String.raw`(?:!([^\s]+))?$`);async function id(e,t){let i=td.exec(e);if(!i)throw new b(`oci package '${e}' is not in the expected format '${D}:' or '${D}@:' (optionally followed by '!') where may include a port (e.g. host:5000/path) and is one of ${ot.join(", ")}`);let s=i[1],n=i[2],r=i[3],o=i[4]??null,a=n??r,l=n==="{{inherit}}"&&r===void 0;return l&&!o?{pluginKey:s,version:a,inherit:l,resolvedPath:null}:(o||(o=await yS(e,s,a,n!==void 0,t)),{pluginKey:`${s}:!${o}`,version:a,inherit:l,resolvedPath:o})}async function yS(e,t,i,s,n){if(!n)throw new b(`Cannot auto-detect plugin path for ${e}: no image cache provided`);let r=s?`${t}:${i}`:`${t}@${i}`;S(` +`,i)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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 i=dn(t),s=Ut(i);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=dn(t),s=Ut(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,i){return this.type!=="comment"||this.indent<=i?!1:t.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};tu.Parser=Uo});var ou=y($i=>{"use strict";var iu=Io(),Cy=Ni(),Di=Ii(),My=Nr(),Dy=I(),$y=Ko(),su=zo();function nu(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new $y.LineCounter||null,prettyErrors:t}}function xy(e,t={}){let{lineCounter:i,prettyErrors:s}=nu(t),n=new su.Parser(i?.addNewLine),r=new iu.Composer(t),o=Array.from(r.compose(n.parse(e)));if(s&&i)for(let a of o)a.errors.forEach(Di.prettifyError(e,i)),a.warnings.forEach(Di.prettifyError(e,i));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function ru(e,t={}){let{lineCounter:i,prettyErrors:s}=nu(t),n=new su.Parser(i?.addNewLine),r=new iu.Composer(t),o=null;for(let a of r.compose(n.parse(e),!0,e.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Di.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&i&&(o.errors.forEach(Di.prettifyError(e,i)),o.warnings.forEach(Di.prettifyError(e,i))),o}function qy(e,t,i){let s;typeof t=="function"?s=t:i===void 0&&t&&typeof t=="object"&&(i=t);let n=ru(e,i);if(!n)return null;if(n.warnings.forEach(r=>My.warn(n.options.logLevel,r)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:s},i))}function By(e,t,i){let s=null;if(typeof t=="function"||Array.isArray(t)?s=t:i===void 0&&t&&(i=t),typeof i=="string"&&(i=i.length),typeof i=="number"){let n=Math.round(i);i=n<1?void 0:n>8?{indent:8}:{indent:n}}if(e===void 0){let{keepUndefined:n}=i??t??{};if(!n)return}return Dy.isDocument(e)&&!s?e.toString(i):new Cy.Document(e,s,i).toString(i)}$i.parse=qy;$i.parseAllDocuments=xy;$i.parseDocument=ru;$i.stringify=By});var Go=y(T=>{"use strict";var Fy=Io(),jy=Ni(),Ky=co(),Yo=Ii(),Uy=hi(),He=I(),zy=Ue(),Yy=B(),Gy=Ye(),Wy=Ge(),Hy=un(),Vy=Fo(),Jy=Ko(),Zy=zo(),pn=ou(),au=oi();T.Composer=Fy.Composer;T.Document=jy.Document;T.Schema=Ky.Schema;T.YAMLError=Yo.YAMLError;T.YAMLParseError=Yo.YAMLParseError;T.YAMLWarning=Yo.YAMLWarning;T.Alias=Uy.Alias;T.isAlias=He.isAlias;T.isCollection=He.isCollection;T.isDocument=He.isDocument;T.isMap=He.isMap;T.isNode=He.isNode;T.isPair=He.isPair;T.isScalar=He.isScalar;T.isSeq=He.isSeq;T.Pair=zy.Pair;T.Scalar=Yy.Scalar;T.YAMLMap=Gy.YAMLMap;T.YAMLSeq=Wy.YAMLSeq;T.CST=Hy;T.Lexer=Vy.Lexer;T.LineCounter=Jy.LineCounter;T.Parser=Zy.Parser;T.parse=pn.parse;T.parseAllDocuments=pn.parseAllDocuments;T.parseDocument=pn.parseDocument;T.stringify=pn.stringify;T.visit=au.visit;T.visitAsync=au.visitAsync});var XS={};kd(XS,{finalizeInstall:()=>md});module.exports=Od(XS);var dd=require("node:fs"),X=O(require("node:fs/promises")),ms=O(require("node:os")),K=O(require("node:path")),gs=O(Go());var q=O(require("node:fs/promises")),cl=O(require("node:os")),x=O(require("node:path"));var Fu=O(require("events"),1),ee=O(require("fs"),1),zn=require("node:events"),Ka=O(require("node:stream"),1),ju=require("node:string_decoder"),za=O(require("node:path"),1),Ot=O(require("node:fs"),1),Gn=require("path"),zu=require("events"),Fn=O(require("assert"),1),st=require("buffer"),fu=O(require("zlib"),1),Yu=O(require("zlib"),1),kt=require("node:path"),Zu=require("node:path"),rs=O(require("fs"),1),me=O(require("fs"),1),Oa=O(require("path"),1),sf=require("node:path"),La=O(require("path"),1),Xa=O(require("node:fs"),1),cf=O(require("node:assert"),1),Qa=require("node:crypto"),P=O(require("node:fs"),1),j=O(require("node:path"),1),el=O(require("fs"),1),ls=O(require("node:fs"),1),Qt=O(require("node:path"),1),ne=O(require("node:fs"),1),bf=O(require("node:fs/promises"),1),os=O(require("node:path"),1),tl=require("node:path"),se=O(require("node:fs"),1),sl=O(require("node:path"),1),Xy=Object.defineProperty,Qy=(e,t)=>{for(var i in t)Xy(e,i,{get:t[i],enumerable:!0})},lu=typeof process=="object"&&process?process:{stdout:null,stderr:null},eb=e=>!!e&&typeof e=="object"&&(e instanceof Rt||e instanceof Ka.default||tb(e)||ib(e)),tb=e=>!!e&&typeof e=="object"&&e instanceof zn.EventEmitter&&typeof e.pipe=="function"&&e.pipe!==Ka.default.Writable.prototype.pipe,ib=e=>!!e&&typeof e=="object"&&e instanceof zn.EventEmitter&&typeof e.write=="function"&&typeof e.end=="function",Pe=Symbol("EOF"),Ie=Symbol("maybeEmitEnd"),Ve=Symbol("emittedEnd"),mn=Symbol("emittingEnd"),xi=Symbol("emittedError"),gn=Symbol("closed"),cu=Symbol("read"),yn=Symbol("flush"),hu=Symbol("flushChunk"),fe=Symbol("encoding"),zt=Symbol("decoder"),G=Symbol("flowing"),qi=Symbol("paused"),Ht=Symbol("resume"),W=Symbol("buffer"),Q=Symbol("pipes"),H=Symbol("bufferLength"),Wo=Symbol("bufferPush"),bn=Symbol("bufferShift"),Z=Symbol("objectMode"),$=Symbol("destroyed"),Ho=Symbol("error"),Vo=Symbol("emitData"),uu=Symbol("emitEnd"),Jo=Symbol("emitEnd2"),Ee=Symbol("async"),Zo=Symbol("abort"),wn=Symbol("aborted"),Bi=Symbol("signal"),pt=Symbol("dataListeners"),re=Symbol("discarded"),Fi=e=>Promise.resolve().then(e),sb=e=>e(),nb=e=>e==="end"||e==="finish"||e==="prefinish",rb=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,ob=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),Ku=class{src;dest;opts;ondrain;constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[Ht](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ab=class extends Ku{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=s=>this.dest.emit("error",s),e.on("error",this.proxyErrors)}},lb=e=>!!e.objectMode,cb=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",Rt=class extends zn.EventEmitter{[G]=!1;[qi]=!1;[Q]=[];[W]=[];[Z];[fe];[Ee];[zt];[Pe]=!1;[Ve]=!1;[mn]=!1;[gn]=!1;[xi]=null;[H]=0;[$]=!1;[Bi];[wn]=!1;[pt]=0;[re]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");lb(t)?(this[Z]=!0,this[fe]=null):cb(t)?(this[fe]=t.encoding,this[Z]=!1):(this[Z]=!1,this[fe]=null),this[Ee]=!!t.async,this[zt]=this[fe]?new ju.StringDecoder(this[fe]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[W]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Q]});let{signal:i}=t;i&&(this[Bi]=i,i.aborted?this[Zo]():i.addEventListener("abort",()=>this[Zo]()))}get bufferLength(){return this[H]}get encoding(){return this[fe]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Z]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ee]}set async(e){this[Ee]=this[Ee]||!!e}[Zo](){this[wn]=!0,this.emit("abort",this[Bi]?.reason),this.destroy(this[Bi]?.reason)}get aborted(){return this[wn]}set aborted(e){}write(e,t,i){if(this[wn])return!1;if(this[Pe])throw new Error("write after end");if(this[$])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||(t="utf8");let s=this[Ee]?Fi:sb;if(!this[Z]&&!Buffer.isBuffer(e)){if(ob(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(rb(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Z]?(this[G]&&this[H]!==0&&this[yn](!0),this[G]?this.emit("data",e):this[Wo](e),this[H]!==0&&this.emit("readable"),i&&s(i),this[G]):e.length?(typeof e=="string"&&!(t===this[fe]&&!this[zt]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[fe]&&(e=this[zt].write(e)),this[G]&&this[H]!==0&&this[yn](!0),this[G]?this.emit("data",e):this[Wo](e),this[H]!==0&&this.emit("readable"),i&&s(i),this[G]):(this[H]!==0&&this.emit("readable"),i&&s(i),this[G])}read(e){if(this[$])return null;if(this[re]=!1,this[H]===0||e===0||e&&e>this[H])return this[Ie](),null;this[Z]&&(e=null),this[W].length>1&&!this[Z]&&(this[W]=[this[fe]?this[W].join(""):Buffer.concat(this[W],this[H])]);let t=this[cu](e||null,this[W][0]);return this[Ie](),t}[cu](e,t){if(this[Z])this[bn]();else{let i=t;e===i.length||e===null?this[bn]():typeof i=="string"?(this[W][0]=i.slice(e),t=i.slice(0,e),this[H]-=e):(this[W][0]=i.subarray(e),t=i.subarray(0,e),this[H]-=e)}return this.emit("data",t),!this[W].length&&!this[Pe]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t="utf8"),e!==void 0&&this.write(e,t),i&&this.once("end",i),this[Pe]=!0,this.writable=!1,(this[G]||!this[qi])&&this[Ie](),this}[Ht](){this[$]||(!this[pt]&&!this[Q].length&&(this[re]=!0),this[qi]=!1,this[G]=!0,this.emit("resume"),this[W].length?this[yn]():this[Pe]?this[Ie]():this.emit("drain"))}resume(){return this[Ht]()}pause(){this[G]=!1,this[qi]=!0,this[re]=!1}get destroyed(){return this[$]}get flowing(){return this[G]}get paused(){return this[qi]}[Wo](e){this[Z]?this[H]+=1:this[H]+=e.length,this[W].push(e)}[bn](){return this[Z]?this[H]-=1:this[H]-=this[W][0].length,this[W].shift()}[yn](e=!1){do;while(this[hu](this[bn]())&&this[W].length);!e&&!this[W].length&&!this[Pe]&&this.emit("drain")}[hu](e){return this.emit("data",e),this[G]}pipe(e,t){if(this[$])return e;this[re]=!1;let i=this[Ve];return t=t||{},e===lu.stdout||e===lu.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this[Q].push(t.proxyErrors?new ab(this,e,t):new Ku(this,e,t)),this[Ee]?Fi(()=>this[Ht]()):this[Ht]()),e}unpipe(e){let t=this[Q].find(i=>i.dest===e);t&&(this[Q].length===1?(this[G]&&this[pt]===0&&(this[G]=!1),this[Q]=[]):this[Q].splice(this[Q].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);if(e==="data")this[re]=!1,this[pt]++,!this[Q].length&&!this[G]&&this[Ht]();else if(e==="readable"&&this[H]!==0)super.emit("readable");else if(nb(e)&&this[Ve])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[xi]){let s=t;this[Ee]?Fi(()=>s.call(this,this[xi])):s.call(this,this[xi])}return i}removeListener(e,t){return this.off(e,t)}off(e,t){let i=super.off(e,t);return e==="data"&&(this[pt]=this.listeners("data").length,this[pt]===0&&!this[re]&&!this[Q].length&&(this[G]=!1)),i}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[pt]=0,!this[re]&&!this[Q].length&&(this[G]=!1)),t}get emittedEnd(){return this[Ve]}[Ie](){!this[mn]&&!this[Ve]&&!this[$]&&this[W].length===0&&this[Pe]&&(this[mn]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[gn]&&this.emit("close"),this[mn]=!1)}emit(e,...t){let i=t[0];if(e!=="error"&&e!=="close"&&e!==$&&this[$])return!1;if(e==="data")return!this[Z]&&!i?!1:this[Ee]?(Fi(()=>this[Vo](i)),!0):this[Vo](i);if(e==="end")return this[uu]();if(e==="close"){if(this[gn]=!0,!this[Ve]&&!this[$])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[xi]=i,super.emit(Ho,i);let n=!this[Bi]||this.listeners("error").length?super.emit("error",i):!1;return this[Ie](),n}else if(e==="resume"){let n=super.emit("resume");return this[Ie](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let s=super.emit(e,...t);return this[Ie](),s}[Vo](e){for(let i of this[Q])i.dest.write(e)===!1&&this.pause();let t=this[re]?!1:super.emit("data",e);return this[Ie](),t}[uu](){return this[Ve]?!1:(this[Ve]=!0,this.readable=!1,this[Ee]?(Fi(()=>this[Jo]()),!0):this[Jo]())}[Jo](){if(this[zt]){let t=this[zt].end();if(t){for(let i of this[Q])i.dest.write(t);this[re]||super.emit("data",t)}}for(let t of this[Q])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Z]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[Z]||(e.dataLength+=i.length)}),await t,e}async concat(){if(this[Z])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[fe]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on($,()=>t(new Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[re]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Pe])return t();let s,n,r=c=>{this.off("data",o),this.off("end",a),this.off($,l),t(),n(c)},o=c=>{this.off("error",r),this.off("end",a),this.off($,l),this.pause(),s({value:c,done:!!this[Pe]})},a=()=>{this.off("error",r),this.off("data",o),this.off($,l),t(),s({done:!0,value:void 0})},l=()=>r(new Error("stream destroyed"));return new Promise((c,h)=>{n=h,s=c,this.once($,l),this.once("error",r),this.once("end",a),this.once("data",o)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[re]=!1;let e=!1,t=()=>(this.pause(),this.off(Ho,t),this.off($,t),this.off("end",t),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return t();let s=this.read();return s===null?t():{done:!1,value:s}};return this.once("end",t),this.once(Ho,t),this.once($,t),{next:i,throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[$])return e?this.emit("error",e):this.emit($),this;this[$]=!0,this[re]=!0,this[W].length=0,this[H]=0;let t=this;return typeof t.close=="function"&&!this[gn]&&t.close(),e?this.emit("error",e):this.emit($),this}static get isStream(){return eb}},hb=ee.default.writev,rt=Symbol("_autoClose"),ye=Symbol("_close"),ji=Symbol("_ended"),L=Symbol("_fd"),Xo=Symbol("_finished"),Me=Symbol("_flags"),Qo=Symbol("_flush"),Sa=Symbol("_handleChunk"),va=Symbol("_makeBuf"),Zi=Symbol("_mode"),Sn=Symbol("_needDrain"),Xt=Symbol("_onerror"),ei=Symbol("_onopen"),ea=Symbol("_onread"),Vt=Symbol("_onwrite"),ot=Symbol("_open"),ge=Symbol("_path"),Qe=Symbol("_pos"),ke=Symbol("_queue"),Jt=Symbol("_read"),ta=Symbol("_readSize"),Ce=Symbol("_reading"),Ki=Symbol("_remain"),ia=Symbol("_size"),Pn=Symbol("_write"),mt=Symbol("_writing"),In=Symbol("_defaultFlag"),_t=Symbol("_errored"),Ua=class extends Rt{[_t]=!1;[L];[ge];[ta];[Ce]=!1;[ia];[Ki];[rt];constructor(e,t){if(t=t||{},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[_t]=!1,this[L]=typeof t.fd=="number"?t.fd:void 0,this[ge]=e,this[ta]=t.readSize||16*1024*1024,this[Ce]=!1,this[ia]=typeof t.size=="number"?t.size:1/0,this[Ki]=this[ia],this[rt]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[L]=="number"?this[Jt]():this[ot]()}get fd(){return this[L]}get path(){return this[ge]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[ot](){ee.default.open(this[ge],"r",(e,t)=>this[ei](e,t))}[ei](e,t){e?this[Xt](e):(this[L]=t,this.emit("open",t),this[Jt]())}[va](){return Buffer.allocUnsafe(Math.min(this[ta],this[Ki]))}[Jt](){if(!this[Ce]){this[Ce]=!0;let e=this[va]();if(e.length===0)return process.nextTick(()=>this[ea](null,0,e));ee.default.read(this[L],e,0,e.length,null,(t,i,s)=>this[ea](t,i,s))}}[ea](e,t,i){this[Ce]=!1,e?this[Xt](e):this[Sa](t,i)&&this[Jt]()}[ye](){if(this[rt]&&typeof this[L]=="number"){let e=this[L];this[L]=void 0,ee.default.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Xt](e){this[Ce]=!0,this[ye](),this.emit("error",e)}[Sa](e,t){let i=!1;return this[Ki]-=e,e>0&&(i=super.write(ethis[ei](e,t))}[ei](e,t){this[In]&&this[Me]==="r+"&&e&&e.code==="ENOENT"?(this[Me]="w",this[ot]()):e?this[Xt](e):(this[L]=t,this.emit("open",t),this[mt]||this[Qo]())}end(e,t){return e&&this.write(e,t),this[ji]=!0,!this[mt]&&!this[ke].length&&typeof this[L]=="number"&&this[Vt](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[ji]?(this.emit("error",new Error("write() after end()")),!1):this[L]===void 0||this[mt]||this[ke].length?(this[ke].push(e),this[Sn]=!0,!1):(this[mt]=!0,this[Pn](e),!0)}[Pn](e){ee.default.write(this[L],e,0,e.length,this[Qe],(t,i)=>this[Vt](t,i))}[Vt](e,t){e?this[Xt](e):(this[Qe]!==void 0&&typeof t=="number"&&(this[Qe]+=t),this[ke].length?this[Qo]():(this[mt]=!1,this[ji]&&!this[Xo]?(this[Xo]=!0,this[ye](),this.emit("finish")):this[Sn]&&(this[Sn]=!1,this.emit("drain"))))}[Qo](){if(this[ke].length===0)this[ji]&&this[Vt](null,0);else if(this[ke].length===1)this[Pn](this[ke].pop());else{let e=this[ke];this[ke]=[],hb(this[L],e,this[Qe],(t,i)=>this[Vt](t,i))}}[ye](){if(this[rt]&&typeof this[L]=="number"){let e=this[L];this[L]=void 0,ee.default.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},Uu=class extends Yn{[ot](){let e;if(this[In]&&this[Me]==="r+")try{e=ee.default.openSync(this[ge],this[Me],this[Zi])}catch(t){if(t?.code==="ENOENT")return this[Me]="w",this[ot]();throw t}else e=ee.default.openSync(this[ge],this[Me],this[Zi]);this[ei](null,e)}[ye](){if(this[rt]&&typeof this[L]=="number"){let e=this[L];this[L]=void 0,ee.default.closeSync(e),this.emit("close")}}[Pn](e){let t=!0;try{this[Vt](null,ee.default.writeSync(this[L],e,0,e.length,this[Qe])),t=!1}finally{if(t)try{this[ye]()}catch{}}}},fb=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),db=e=>!!e.sync&&!!e.file,pb=e=>!e.sync&&!!e.file,mb=e=>!!e.sync&&!e.file,gb=e=>!e.sync&&!e.file,yb=e=>!!e.file,bb=e=>fb.get(e)||e,Ya=(e={})=>{if(!e)return{};let t={};for(let[i,s]of Object.entries(e)){let n=bb(i);t[n]=s}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t},as=(e,t,i,s,n)=>Object.assign((r=[],o,a)=>{Array.isArray(r)&&(o=r,r={}),typeof o=="function"&&(a=o,o=void 0),o=o?Array.from(o):[];let l=Ya(r);if(n?.(l,o),db(l)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return e(l,o)}else if(pb(l)){let c=t(l,o);return a?c.then(()=>a(),a):c}else if(mb(l)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return i(l,o)}else if(gb(l)){if(typeof a=="function")throw new TypeError("callback only supported with file option");return s(l,o)}throw new Error("impossible options??")},{syncFile:e,asyncFile:t,syncNoFile:i,asyncNoFile:s,validate:n}),wb=Yu.default.constants||{ZLIB_VERNUM:4736},Ae=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},wb)),Sb=st.Buffer.concat,du=Object.getOwnPropertyDescriptor(st.Buffer,"concat"),vb=e=>e,sa=du?.writable===!0||du?.set!==void 0?e=>{st.Buffer.concat=e?vb:Sb}:e=>{},At=Symbol("_superWrite"),vn=class extends Error{code;errno;constructor(e,t){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,t??this.constructor)}get name(){return"ZlibError"}},na=Symbol("flushFlag"),Ga=class extends Rt{#e=!1;#i=!1;#s;#r;#n;#t;#o;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#s}constructor(e,t){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(e),this.#s=e.flush??0,this.#r=e.finishFlush??0,this.#n=e.fullFlushFlag??0,typeof fu[t]!="function")throw new TypeError("Compression method not supported: "+t);try{this.#t=new fu[t](e)}catch(i){throw new vn(i,this.constructor)}this.#o=i=>{this.#e||(this.#e=!0,this.close(),this.emit("error",i))},this.#t?.on("error",i=>this.#o(new vn(i))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return(0,Fn.default)(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#n),this.write(Object.assign(st.Buffer.alloc(0),{[na]:e})))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#r),this.#i=!0,super.end(i)}get ended(){return this.#i}[At](e){return super.write(e)}write(e,t,i){if(typeof t=="function"&&(i=t,t="utf8"),typeof e=="string"&&(e=st.Buffer.from(e,t)),this.#e)return;(0,Fn.default)(this.#t,"zlib binding closed");let s=this.#t._handle,n=s.close;s.close=()=>{};let r=this.#t.close;this.#t.close=()=>{},sa(!0);let o;try{let l=typeof e[na]=="number"?e[na]:this.#s;o=this.#t._processChunk(e,l),sa(!1)}catch(l){sa(!1),this.#o(new vn(l,this.write))}finally{this.#t&&(this.#t._handle=s,s.close=n,this.#t.close=r,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",l=>this.#o(new vn(l,this.write)));let a;if(o)if(Array.isArray(o)&&o.length>0){let l=o[0];a=this[At](st.Buffer.from(l));for(let c=1;c{typeof s=="function"&&(n=s,s=this.flushFlag),this.flush(s),n?.()};try{this.handle.params(e,t)}finally{this.handle.flush=i}this.handle&&(this.#e=e,this.#i=t)}}}},Eb=class extends Gu{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[At](e){return this.#e?(this.#e=!1,e[9]=255,super[At](e)):super[At](e)}},kb=class extends Gu{constructor(e){super(e,"Unzip")}},Wu=class extends Ga{constructor(e,t){e=e||{},e.flush=e.flush||Ae.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||Ae.BROTLI_OPERATION_FINISH,e.fullFlushFlag=Ae.BROTLI_OPERATION_FLUSH,super(e,t)}},Ob=class extends Wu{constructor(e){super(e,"BrotliCompress")}},_b=class extends Wu{constructor(e){super(e,"BrotliDecompress")}},Hu=class extends Ga{constructor(e,t){e=e||{},e.flush=e.flush||Ae.ZSTD_e_continue,e.finishFlush=e.finishFlush||Ae.ZSTD_e_end,e.fullFlushFlag=Ae.ZSTD_e_flush,super(e,t)}},Ab=class extends Hu{constructor(e){super(e,"ZstdCompress")}},Nb=class extends Hu{constructor(e){super(e,"ZstdDecompress")}},Rb=(e,t)=>{if(Number.isSafeInteger(e))e<0?Ib(e,t):Pb(e,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},Pb=(e,t)=>{t[0]=128;for(var i=t.length;i>1;i--)t[i-1]=e&255,e=Math.floor(e/256)},Ib=(e,t)=>{t[0]=255;var i=!1;e=e*-1;for(var s=t.length;s>1;s--){var n=e&255;e=Math.floor(e/256),i?t[s-1]=Vu(n):n===0?t[s-1]=0:(i=!0,t[s-1]=Ju(n))}},Tb=e=>{let t=e[0],i=t===128?Cb(e.subarray(1,e.length)):t===255?Lb(e):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},Lb=e=>{for(var t=e.length,i=0,s=!1,n=t-1;n>-1;n--){var r=Number(e[n]),o;s?o=Vu(r):r===0?o=r:(s=!0,o=Ju(r)),o!==0&&(i-=o*Math.pow(256,t-n-1))}return i},Cb=e=>{for(var t=e.length,i=0,s=t-1;s>-1;s--){var n=Number(e[s]);n!==0&&(i+=n*Math.pow(256,t-s-1))}return i},Vu=e=>(255^e)&255,Ju=e=>(255^e)+1&255,Mb={};Qy(Mb,{code:()=>Wa,isCode:()=>Tn,isName:()=>Db,name:()=>Wn});var Tn=e=>Wn.has(e),Db=e=>Wa.has(e),Wn=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Wa=new Map(Array.from(Wn).map(e=>[e[1],e[0]])),Nt=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,i,s){Buffer.isBuffer(e)?this.decode(e,t||0,i,s):e&&this.#i(e)}decode(e,t,i,s){if(t||(t=0),!e||!(e.length>=t+512))throw new Error("need 512 bytes for header");this.path=i?.path??gt(e,t,100),this.mode=i?.mode??s?.mode??et(e,t+100,8),this.uid=i?.uid??s?.uid??et(e,t+108,8),this.gid=i?.gid??s?.gid??et(e,t+116,8),this.size=i?.size??s?.size??et(e,t+124,12),this.mtime=i?.mtime??s?.mtime??ra(e,t+136,12),this.cksum=et(e,t+148,12),s&&this.#i(s,!0),i&&this.#i(i);let n=gt(e,t+156,1);if(Tn(n)&&(this.#e=n||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=gt(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=i?.uname??s?.uname??gt(e,t+265,32),this.gname=i?.gname??s?.gname??gt(e,t+297,32),this.devmaj=i?.devmaj??s?.devmaj??et(e,t+329,8)??0,this.devmin=i?.devmin??s?.devmin??et(e,t+337,8)??0,e[t+475]!==0){let o=gt(e,t+345,155);this.path=o+"/"+this.path}else{let o=gt(e,t+345,130);o&&(this.path=o+"/"+this.path),this.atime=i?.atime??s?.atime??ra(e,t+476,12),this.ctime=i?.ctime??s?.ctime??ra(e,t+488,12)}let r=256;for(let o=t;o!(s==null||i==="path"&&t||i==="linkpath"&&t||i==="global"))))}encode(e,t=0){if(e||(e=this.block=Buffer.alloc(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw new Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,s=$b(this.path||"",i),n=s[0],r=s[1];this.needPax=!!s[2],this.needPax=yt(e,t,100,n)||this.needPax,this.needPax=tt(e,t+100,8,this.mode)||this.needPax,this.needPax=tt(e,t+108,8,this.uid)||this.needPax,this.needPax=tt(e,t+116,8,this.gid)||this.needPax,this.needPax=tt(e,t+124,12,this.size)||this.needPax,this.needPax=oa(e,t+136,12,this.mtime)||this.needPax,e[t+156]=Number(this.#e.codePointAt(0)),this.needPax=yt(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=yt(e,t+265,32,this.uname)||this.needPax,this.needPax=yt(e,t+297,32,this.gname)||this.needPax,this.needPax=tt(e,t+329,8,this.devmaj)||this.needPax,this.needPax=tt(e,t+337,8,this.devmin)||this.needPax,this.needPax=yt(e,t+345,i,r)||this.needPax,e[t+475]!==0?this.needPax=yt(e,t+345,155,r)||this.needPax:(this.needPax=yt(e,t+345,130,r)||this.needPax,this.needPax=oa(e,t+476,12,this.atime)||this.needPax,this.needPax=oa(e,t+488,12,this.ctime)||this.needPax);let o=256;for(let a=t;a{let i=e,s="",n,r=kt.posix.parse(e).root||".";if(Buffer.byteLength(i)<100)n=[i,s,!1];else{s=kt.posix.dirname(i),i=kt.posix.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(s)<=t?n=[i,s,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(s)<=t?n=[i.slice(0,99),s,!0]:(i=kt.posix.join(kt.posix.basename(s),i),s=kt.posix.dirname(s));while(s!==r&&n===void 0);n||(n=[e.slice(0,99),"",!0])}return n},gt=(e,t,i)=>e.subarray(t,t+i).toString("utf8").replace(/\0.*/,""),ra=(e,t,i)=>xb(et(e,t,i)),xb=e=>e===void 0?void 0:new Date(e*1e3),et=(e,t,i)=>Number(e[t])&128?Tb(e.subarray(t,t+i)):Bb(e,t,i),qb=e=>isNaN(e)?void 0:e,Bb=(e,t,i)=>qb(parseInt(e.subarray(t,t+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),Fb={12:8589934591,8:2097151},tt=(e,t,i,s)=>s===void 0?!1:s>Fb[i]||s<0?(Rb(s,e.subarray(t,t+i)),!0):(jb(e,t,i,s),!1),jb=(e,t,i,s)=>e.write(Kb(s,i),t,i,"ascii"),Kb=(e,t)=>Ub(Math.floor(e).toString(8),t),Ub=(e,t)=>(e.length===t-1?e:new Array(t-e.length-1).join("0")+e+" ")+"\0",oa=(e,t,i,s)=>s===void 0?!1:tt(e,t,i,s.getTime()/1e3),zb=new Array(156).join("\0"),yt=(e,t,i,s)=>s===void 0?!1:(e.write(s+zb,t,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),jn=class Xu{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,i=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=i,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(t),s=512*Math.ceil(1+i/512),n=Buffer.allocUnsafe(s);for(let r=0;r<512;r++)n[r]=0;new Nt({path:("PaxHeader/"+(0,Zu.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(n),n.write(t,512,i,"utf8");for(let r=i+512;r=Math.pow(10,o)&&(o+=1),o+r+n}static parse(t,i,s=!1){return new Xu(Yb(Gb(t),i),s)}},Yb=(e,t)=>t?Object.assign({},t,e):e,Gb=e=>e.replace(/\n$/,"").split(` +`).reduce(Wb,Object.create(null)),Wb=(e,t)=>{let i=parseInt(t,10);if(i!==Buffer.byteLength(t)+1)return e;t=t.slice((i+" ").length);let s=t.split("="),n=s.shift();if(!n)return e;let r=n.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),o=s.join("=");return e[r]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(r)?new Date(Number(o)*1e3):/^[0-9]+$/.test(o)?+o:o,e},Hb=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,R=Hb!=="win32"?e=>e:e=>e&&e.replaceAll(/\\/g,"/"),Qu=class extends Rt{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,t,i){switch(super({}),this.pause(),this.extended=t,this.globalExtended=i,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=R(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?R(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),i&&this.#e(i,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw new Error("writing more to entry than is appropriate");let i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-t),this.blockRemain=Math.max(0,s-t),this.ignore?!0:i>=t?super.write(e):super.write(e.subarray(0,i))}#e(e,t=!1){e.path&&(e.path=R(e.path)),e.linkpath&&(e.linkpath=R(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,s])=>!(s==null||i==="path"&&t))))}},Hn=(e,t,i,s={})=>{e.file&&(s.file=e.file),e.cwd&&(s.cwd=e.cwd),s.code=i instanceof Error&&i.code||t,s.tarCode=t,!e.strict&&s.recoverable!==!1?(i instanceof Error&&(s=Object.assign(i,s),i=i.message),e.emit("warn",t,i,s)):i instanceof Error?e.emit("error",Object.assign(i,s)):e.emit("error",Object.assign(new Error(`${t}: ${i}`),s))},Vb=1024*1024,Ea=Buffer.from([31,139]),ka=Buffer.from([40,181,47,253]),Jb=Math.max(Ea.length,ka.length),ae=Symbol("state"),bt=Symbol("writeEntry"),Te=Symbol("readEntry"),aa=Symbol("nextEntry"),pu=Symbol("processEntry"),Oe=Symbol("extendedHeader"),Ui=Symbol("globalExtendedHeader"),Je=Symbol("meta"),mu=Symbol("emitMeta"),M=Symbol("buffer"),Le=Symbol("queue"),Ze=Symbol("ended"),la=Symbol("emittedEnd"),wt=Symbol("emit"),F=Symbol("unzip"),En=Symbol("consumeChunk"),kn=Symbol("consumeChunkSub"),ca=Symbol("consumeBody"),gu=Symbol("consumeMeta"),yu=Symbol("consumeHeader"),zi=Symbol("consuming"),ha=Symbol("bufferConcat"),On=Symbol("maybeEnd"),Yt=Symbol("writing"),Xe=Symbol("aborted"),_n=Symbol("onDone"),St=Symbol("sawValidEntry"),An=Symbol("sawNullBlock"),Nn=Symbol("sawEOF"),bu=Symbol("closeStream"),Zb=()=>!0,ns=class extends zu.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[Le]=[];[M];[Te];[bt];[ae]="begin";[Je]="";[Oe];[Ui];[Ze]=!1;[F];[Xe]=!1;[St];[An]=!1;[Nn]=!1;[Yt]=!1;[zi]=!1;[la]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(_n,()=>{(this[ae]==="begin"||this[St]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(_n,e.ondone):this.on(_n,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||Vb,this.filter=typeof e.filter=="function"?e.filter:Zb;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:t?void 0:!1;let i=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:i?!0:void 0,this.on("end",()=>this[bu]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,i={}){Hn(this,e,t,i)}[yu](e,t){this[St]===void 0&&(this[St]=!1);let i;try{i=new Nt(e,t,this[Oe],this[Ui])}catch(s){return this.warn("TAR_ENTRY_INVALID",s)}if(i.nullBlock)this[An]?(this[Nn]=!0,this[ae]==="begin"&&(this[ae]="header"),this[wt]("eof")):(this[An]=!0,this[wt]("nullBlock"));else if(this[An]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let s=i.type;if(/^(Symbolic)?Link$/.test(s)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(s)&&!/^(Global)?ExtendedHeader$/.test(s)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let n=this[bt]=new Qu(i,this[Oe],this[Ui]);if(!this[St])if(n.remain){let r=()=>{n.invalid||(this[St]=!0)};n.on("end",r)}else this[St]=!0;n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[wt]("ignoredEntry",n),this[ae]="ignore",n.resume()):n.size>0&&(this[Je]="",n.on("data",r=>this[Je]+=r),this[ae]="meta"):(this[Oe]=void 0,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[wt]("ignoredEntry",n),this[ae]=n.remain?"ignore":"header",n.resume()):(n.remain?this[ae]="body":(this[ae]="header",n.end()),this[Te]?this[Le].push(n):(this[Le].push(n),this[aa]())))}}}[bu](){queueMicrotask(()=>this.emit("close"))}[pu](e){let t=!0;if(!e)this[Te]=void 0,t=!1;else if(Array.isArray(e)){let[i,...s]=e;this.emit(i,...s)}else this[Te]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[aa]()),t=!1);return t}[aa](){do;while(this[pu](this[Le].shift()));if(this[Le].length===0){let e=this[Te];!e||e.flowing||e.size===e.remain?this[Yt]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[ca](e,t){let i=this[bt];if(!i)throw new Error("attempt to consume body without entry??");let s=i.blockRemain??0,n=s>=e.length&&t===0?e:e.subarray(t,t+s);return i.write(n),i.blockRemain||(this[ae]="header",this[bt]=void 0,i.end()),n.length}[gu](e,t){let i=this[bt],s=this[ca](e,t);return!this[bt]&&i&&this[mu](i),s}[wt](e,t,i){this[Le].length===0&&!this[Te]?this.emit(e,t,i):this[Le].push([e,t,i])}[mu](e){switch(this[wt]("meta",this[Je]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Oe]=jn.parse(this[Je],this[Oe],!1);break;case"GlobalExtendedHeader":this[Ui]=jn.parse(this[Je],this[Ui],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[Oe]??Object.create(null);this[Oe]=t,t.path=this[Je].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[Oe]||Object.create(null);this[Oe]=t,t.linkpath=this[Je].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[Xe]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[Xe])return i?.(),!1;if((this[F]===void 0||this.brotli===void 0&&this[F]===!1)&&e){if(this[M]&&(e=Buffer.concat([this[M],e]),this[M]=void 0),e.lengththis[En](l)),this[F].on("error",l=>this.abort(l)),this[F].on("end",()=>{this[Ze]=!0,this[En]()}),this[Yt]=!0;let a=!!this[F][o?"end":"write"](e);return this[Yt]=!1,i?.(),a}}this[Yt]=!0,this[F]?this[F].write(e):this[En](e),this[Yt]=!1;let s=this[Le].length>0?!1:this[Te]?this[Te].flowing:!0;return!s&&this[Le].length===0&&this[Te]?.once("drain",()=>this.emit("drain")),i?.(),s}[ha](e){e&&!this[Xe]&&(this[M]=this[M]?Buffer.concat([this[M],e]):e)}[On](){if(this[Ze]&&!this[la]&&!this[Xe]&&!this[zi]){this[la]=!0;let e=this[bt];if(e&&e.blockRemain){let t=this[M]?this[M].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[M]&&e.write(this[M]),e.end()}this[wt](_n)}}[En](e){if(this[zi]&&e)this[ha](e);else if(!e&&!this[M])this[On]();else if(e){if(this[zi]=!0,this[M]){this[ha](e);let t=this[M];this[M]=void 0,this[kn](t)}else this[kn](e);for(;this[M]&&this[M]?.length>=512&&!this[Xe]&&!this[Nn];){let t=this[M];this[M]=void 0,this[kn](t)}this[zi]=!1}(!this[M]||this[Ze])&&this[On]()}[kn](e){let t=0,i=e.length;for(;t+512<=i&&!this[Xe]&&!this[Nn];)switch(this[ae]){case"begin":case"header":this[yu](e,t),t+=512;break;case"ignore":case"body":t+=this[ca](e,t);break;case"meta":t+=this[gu](e,t);break;default:throw new Error("invalid state: "+this[ae])}t{let t=e.length-1,i=-1;for(;t>-1&&e.charAt(t)==="/";)i=t,t--;return i===-1?e:e.slice(0,i)},Xb=e=>{let t=e.onReadEntry;e.onReadEntry=t?i=>{t(i),i.resume()}:i=>i.resume()},ef=(e,t)=>{let i=new Map(t.map(r=>[Xi(r),!0])),s=e.filter,n=(r,o="")=>{let a=o||(0,Gn.parse)(r).root||".",l;if(r===a)l=!1;else{let c=i.get(r);l=c!==void 0?c:n((0,Gn.dirname)(r),a)}return i.set(r,l),l};e.filter=s?(r,o)=>s(r,o)&&n(Xi(r)):r=>n(Xi(r))},Qb=e=>{let t=new ns(e),i=e.file,s;try{s=Ot.default.openSync(i,"r");let n=Ot.default.fstatSync(s),r=e.maxReadSize||16*1024*1024;if(n.size{let i=new ns(e),s=e.maxReadSize||16*1024*1024,n=e.file;return new Promise((r,o)=>{i.on("error",o),i.on("end",r),Ot.default.stat(n,(a,l)=>{if(a)o(a);else{let c=new Ua(n,{readSize:s,size:l.size});c.on("error",o),c.pipe(i)}})})},Vn=as(Qb,ew,e=>new ns(e),e=>new ns(e),(e,t)=>{t?.length&&ef(e,t),e.noResume||Xb(e)}),tf=(e,t,i)=>(e&=4095,i&&(e=(e|384)&-19),t&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),{isAbsolute:tw,parse:wu}=sf.win32,Ha=e=>{let t="",i=wu(e);for(;tw(e)||i.root;){let s=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":i.root;e=e.slice(s.length),t+=s,i=wu(e)}return[t,e]},Jn=["|","<",">","?",":"],Va=Jn.map(e=>String.fromCodePoint(61440+Number(e.codePointAt(0)))),iw=new Map(Jn.map((e,t)=>[e,Va[t]])),sw=new Map(Va.map((e,t)=>[e,Jn[t]])),Su=e=>Jn.reduce((t,i)=>t.split(i).join(iw.get(i)),e),nw=e=>Va.reduce((t,i)=>t.split(i).join(sw.get(i)),e),nf=(e,t)=>t?(e=R(e).replace(/^\.(\/|$)/,""),Xi(t)+"/"+e):R(e),rw=16*1024*1024,vu=Symbol("process"),Eu=Symbol("file"),ku=Symbol("directory"),_a=Symbol("symlink"),Ou=Symbol("hardlink"),Yi=Symbol("header"),Ln=Symbol("read"),Aa=Symbol("lstat"),Cn=Symbol("onlstat"),Na=Symbol("onread"),Ra=Symbol("onreadlink"),Pa=Symbol("openfile"),Ia=Symbol("onopenfile"),it=Symbol("close"),Kn=Symbol("mode"),Ta=Symbol("awaitDrain"),ua=Symbol("ondrain"),_e=Symbol("prefix"),rf=class extends Rt{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,t={}){let i=Ya(t);super(),this.path=R(e),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||rw,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=R(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?R(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){let[r,o]=Ha(this.path);r&&typeof o=="string"&&(this.path=o,s=r)}this.win32=!!i.win32||process.platform==="win32",this.win32&&(this.path=nw(this.path.replaceAll(/\\/g,"/")),e=e.replaceAll(/\\/g,"/")),this.absolute=R(i.absolute||Oa.default.resolve(this.cwd,e)),this.path===""&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});let n=this.statCache.get(this.absolute);n?this[Cn](n):this[Aa]()}warn(e,t,i={}){return Hn(this,e,t,i)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[Aa](){me.default.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Cn](t)})}[Cn](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=lw(e),this.emit("stat",e),this[vu]()}[vu](){switch(this.type){case"File":return this[Eu]();case"Directory":return this[ku]();case"SymbolicLink":return this[_a]();default:return this.end()}}[Kn](e){return tf(e,this.type==="Directory",this.portable)}[_e](e){return nf(e,this.prefix)}[Yi](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new Nt({path:this[_e](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[_e](this.linkpath):this.linkpath,mode:this[Kn](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new jn({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[_e](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[_e](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e)}[ku](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Yi](),this.end()}[_a](){me.default.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Ra](t)})}[Ra](e){this.linkpath=R(e),this[Yi](),this.end()}[Ou](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=R(Oa.default.relative(this.cwd,e)),this.stat.size=0,this[Yi](),this.end()}[Eu](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[Ou](t);this.linkCache.set(e,this.absolute)}if(this[Yi](),this.stat.size===0)return this.end();this[Pa]()}[Pa](){me.default.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[Ia](t)})}[Ia](e){if(this.fd=e,this.#e)return this[it]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Ln]()}[Ln](){let{fd:e,buf:t,offset:i,length:s,pos:n}=this;if(e===void 0||t===void 0)throw new Error("cannot read file without first opening");me.default.read(e,t,i,s,n,(r,o)=>{if(r)return this[it](()=>this.emit("error",r));this[Na](o)})}[it](e=()=>{}){this.fd!==void 0&&me.default.close(this.fd,e)}[Na](e){if(e<=0&&this.remain>0){let i=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[it](()=>this.emit("error",i))}if(e>this.remain){let i=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[it](()=>this.emit("error",i))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let i=e;ithis[ua]())}[Ta](e){this.once("drain",e)}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemaine?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Ln]()}},ow=class extends rf{sync=!0;[Aa](){this[Cn](me.default.lstatSync(this.absolute))}[_a](){this[Ra](me.default.readlinkSync(this.absolute))}[Pa](){this[Ia](me.default.openSync(this.absolute,"r"))}[Ln](){let e=!0;try{let{fd:t,buf:i,offset:s,length:n,pos:r}=this;if(t===void 0||i===void 0)throw new Error("fd and buf must be set in READ method");let o=me.default.readSync(t,i,s,n,r);this[Na](o),e=!1}finally{if(e)try{this[it](()=>{})}catch{}}}[Ta](e){e()}[it](e=()=>{}){this.fd!==void 0&&me.default.closeSync(this.fd),e()}},aw=class extends Rt{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,t,i={}){return Hn(this,e,t,i)}constructor(e,t={}){let i=Ya(t);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=e;let{type:s}=e;if(s==="Unsupported")throw new Error("writing entry that should be ignored");this.type=s,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=R(e.path),this.mode=e.mode!==void 0?this[Kn](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:i.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?R(e.linkpath):void 0,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let n=!1;if(!this.preservePaths){let[o,a]=Ha(this.path);o&&typeof a=="string"&&(this.path=a,n=o)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new Nt({path:this[_e](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[_e](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),n&&this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path}),this.header.encode()&&!this.noPax&&super.write(new jn({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[_e](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[_e](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let r=this.header?.block;if(!r)throw new Error("failed to encode header");super.write(r),e.pipe(this)}[_e](e){return nf(e,this.prefix)}[Kn](e){return tf(e,this.type==="Directory",this.portable)}write(e,t,i){typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let s=e.length;if(s>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(e,i)}end(e,t,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),i&&this.once("finish",i),e?super.end(e,i):super.end(i),this}},lw=e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported",cw=class Zt{tail;head;length=0;static create(t=[]){return new Zt(t)}constructor(t=[]){for(let i of t)this.push(i)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");let i=t.next,s=t.prev;return i&&(i.prev=s),s&&(s.next=i),t===this.head&&(this.head=i),t===this.tail&&(this.tail=s),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,i}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let i=this.head;t.list=this,t.next=i,i&&(i.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let i=this.tail;t.list=this,t.prev=i,i&&(i.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let i=0,s=t.length;i1)s=i;else if(this.head)n=this.head.next,s=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var r=0;n;r++)s=t(s,n.value,r),n=n.next;return s}reduceReverse(t,i){let s,n=this.tail;if(arguments.length>1)s=i;else if(this.tail)n=this.tail.prev,s=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let r=this.length-1;n;r--)s=t(s,n.value,r),n=n.prev;return s}toArray(){let t=new Array(this.length);for(let i=0,s=this.head;s;i++)t[i]=s.value,s=s.next;return t}toArrayReverse(){let t=new Array(this.length);for(let i=0,s=this.tail;s;i++)t[i]=s.value,s=s.prev;return t}slice(t=0,i=this.length){i<0&&(i+=this.length),t<0&&(t+=this.length);let s=new Zt;if(ithis.length&&(i=this.length);let n=this.head,r=0;for(r=0;n&&rthis.length&&(i=this.length);let n=this.length,r=this.tail;for(;r&&n>i;n--)r=r.prev;for(;r&&n>t;n--,r=r.prev)s.push(r.value);return s}splice(t,i=0,...s){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let n=this.head;for(let o=0;n&&o1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new Eb(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new Ob(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new Ab(e.zstd)),!this.zip)throw new Error("impossible");let t=this.zip;t.on("data",i=>super.write(i)),t.on("end",()=>super.end()),t.on("drain",()=>this[ma]()),this.on("resume",()=>t.resume())}else this.on("drain",this[ma]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[de]=new cw,this[pe]=0,this.jobs=Number(e.jobs)||4,this[Wi]=!1,this[Gi]=!1}[of](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&this.add(e),this[Gi]=!0,this[Et](),i&&i(),this}write(e){if(this[Gi])throw new Error("write after end");return e instanceof Qu?this[Nu](e):this[Dn](e),this.flowing}[Nu](e){let t=R(La.default.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let i=new _u(e.path,t);i.entry=new aw(e,this[pa](i)),i.entry.on("end",()=>this[da](i)),this[pe]+=1,this[de].push(i)}this[Et]()}[Dn](e){let t=R(La.default.resolve(this.cwd,e));this[de].push(new _u(e,t)),this[Et]()}[Ca](e){e.pending=!0,this[pe]+=1;let t=this.follow?"stat":"lstat";rs.default[t](e.absolute,(i,s)=>{e.pending=!1,this[pe]-=1,i?this.emit("error",i):this[Mn](e,s)})}[Mn](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)?t.isFile()&&t.nlink>1&&e===this[vt]&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync&&this[fa](e):e.ignore=!0,this[Et]()}[Ma](e){e.pending=!0,this[pe]+=1,rs.default.readdir(e.absolute,(t,i)=>{if(e.pending=!1,this[pe]-=1,t)return this.emit("error",t);this[$n](e,i)})}[$n](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[Et]()}[Et](){if(!this[Wi]){this[Wi]=!0;for(let e=this[de].head;e&&this[pe]this.warn(t,i,s),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Ru](e){this[pe]+=1;try{return new this[qn](e.path,this[pa](e)).on("end",()=>this[da](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[ma](){this[vt]&&this[vt].entry&&this[vt].entry.resume()}[xn](e){e.piped=!0,e.readdir&&e.readdir.forEach(s=>{let n=e.path,r=n==="./"?"":n.replace(/\/*$/,"/");this[Dn](r+s)});let t=e.entry,i=this.zip;if(!t)throw new Error("cannot pipe without source");i?t.on("data",s=>{i.write(s)||t.pause()}):t.on("data",s=>{super.write(s)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,i={}){Hn(this,e,t,i)}},Za=class extends Zn{sync=!0;constructor(e){super(e),this[qn]=ow}pause(){}resume(){}[Ca](e){let t=this.follow?"statSync":"lstatSync";this[Mn](e,rs.default[t](e.absolute))}[Ma](e){this[$n](e,rs.default.readdirSync(e.absolute))}[xn](e){let t=e.entry,i=this.zip;if(e.readdir&&e.readdir.forEach(s=>{let n=e.path,r=n==="./"?"":n.replace(/\/*$/,"/");this[Dn](r+s)}),!t)throw new Error("Cannot pipe without source");i?t.on("data",s=>{i.write(s)}):t.on("data",s=>{super[of](s)})}},dw=(e,t)=>{let i=new Za(e),s=new Uu(e.file,{mode:e.mode||438});i.pipe(s),af(i,t)},pw=(e,t)=>{let i=new Zn(e),s=new Yn(e.file,{mode:e.mode||438});i.pipe(s);let n=new Promise((r,o)=>{s.on("error",o),s.on("close",r),i.on("error",o)});return lf(i,t).catch(r=>i.emit("error",r)),n},af=(e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Vn({file:za.default.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:s=>e.add(s)}):e.add(i)}),e.end()},lf=async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Vn({file:za.default.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:s=>{e.add(s)}}):e.add(i);e.end()},mw=(e,t)=>{let i=new Za(e);return af(i,t),i},gw=(e,t)=>{let i=new Zn(e);return lf(i,t).catch(s=>i.emit("error",s)),i},bv=as(dw,pw,mw,gw,(e,t)=>{if(!t?.length)throw new TypeError("no paths specified to add to archive")}),yw=process.env.__FAKE_PLATFORM__||process.platform,hf=yw==="win32",{O_CREAT:uf,O_NOFOLLOW:Pu,O_TRUNC:ff,O_WRONLY:df}=el.default.constants,pf=Number(process.env.__FAKE_FS_O_FILENAME__)||el.default.constants.UV_FS_O_FILEMAP||0,bw=hf&&!!pf,ww=512*1024,Sw=pf|ff|uf|df,Iu=!hf&&typeof Pu=="number"?Pu|ff|uf|df:null,mf=Iu!==null?()=>Iu:bw?e=>e"w",Da=(e,t,i)=>{try{return ls.default.lchownSync(e,t,i)}catch(s){if(s?.code!=="ENOENT")throw s}},Un=(e,t,i,s)=>{ls.default.lchown(e,t,i,n=>{s(n&&n?.code!=="ENOENT"?n:null)})},vw=(e,t,i,s,n)=>{if(t.isDirectory())gf(Qt.default.resolve(e,t.name),i,s,r=>{if(r)return n(r);let o=Qt.default.resolve(e,t.name);Un(o,i,s,n)});else{let r=Qt.default.resolve(e,t.name);Un(r,i,s,n)}},gf=(e,t,i,s)=>{ls.default.readdir(e,{withFileTypes:!0},(n,r)=>{if(n){if(n.code==="ENOENT")return s();if(n.code!=="ENOTDIR"&&n.code!=="ENOTSUP")return s(n)}if(n||!r.length)return Un(e,t,i,s);let o=r.length,a=null,l=c=>{if(!a){if(c)return s(a=c);if(--o===0)return Un(e,t,i,s)}};for(let c of r)vw(e,c,t,i,l)})},Ew=(e,t,i,s)=>{t.isDirectory()&&yf(Qt.default.resolve(e,t.name),i,s),Da(Qt.default.resolve(e,t.name),i,s)},yf=(e,t,i)=>{let s;try{s=ls.default.readdirSync(e,{withFileTypes:!0})}catch(n){let r=n;if(r?.code==="ENOENT")return;if(r?.code==="ENOTDIR"||r?.code==="ENOTSUP")return Da(e,t,i);throw r}for(let n of s)Ew(e,n,t,i);return Da(e,t,i)},wf=class extends Error{path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}},Xn=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}},kw=(e,t)=>{ne.default.stat(e,(i,s)=>{(i||!s.isDirectory())&&(i=new wf(e,i?.code||"ENOTDIR")),t(i)})},Ow=(e,t,i)=>{e=R(e);let s=t.umask??18,n=t.mode|448,r=(n&s)!==0,o=t.uid,a=t.gid,l=typeof o=="number"&&typeof a=="number"&&(o!==t.processUid||a!==t.processGid),c=t.preserve,h=t.unlink,u=R(t.cwd),f=(g,d)=>{g?i(g):d&&l?gf(d,o,a,m=>f(m)):r?ne.default.chmod(e,n,i):i()};if(e===u)return kw(e,f);if(c)return bf.default.mkdir(e,{mode:n,recursive:!0}).then(g=>f(null,g??void 0),f);let p=R(os.default.relative(u,e)).split("/");$a(u,p,n,h,u,void 0,f)},$a=(e,t,i,s,n,r,o)=>{if(t.length===0)return o(null,r);let a=t.shift(),l=R(os.default.resolve(e+"/"+a));ne.default.mkdir(l,i,Sf(l,t,i,s,n,r,o))},Sf=(e,t,i,s,n,r,o)=>a=>{a?ne.default.lstat(e,(l,c)=>{if(l)l.path=l.path&&R(l.path),o(l);else if(c.isDirectory())$a(e,t,i,s,n,r,o);else if(s)ne.default.unlink(e,h=>{if(h)return o(h);ne.default.mkdir(e,i,Sf(e,t,i,s,n,r,o))});else{if(c.isSymbolicLink())return o(new Xn(e,e+"/"+t.join("/")));o(a)}}):(r=r||e,$a(e,t,i,s,n,r,o))},_w=e=>{let t=!1,i;try{t=ne.default.statSync(e).isDirectory()}catch(s){i=s?.code}finally{if(!t)throw new wf(e,i??"ENOTDIR")}},Aw=(e,t)=>{e=R(e);let i=t.umask??18,s=t.mode|448,n=(s&i)!==0,r=t.uid,o=t.gid,a=typeof r=="number"&&typeof o=="number"&&(r!==t.processUid||o!==t.processGid),l=t.preserve,c=t.unlink,h=R(t.cwd),u=g=>{g&&a&&yf(g,r,o),n&&ne.default.chmodSync(e,s)};if(e===h)return _w(h),u();if(l)return u(ne.default.mkdirSync(e,{mode:s,recursive:!0})??void 0);let f=R(os.default.relative(h,e)).split("/"),p;for(let g=f.shift(),d=h;g&&(d+="/"+g);g=f.shift()){d=R(os.default.resolve(d));try{ne.default.mkdirSync(d,s),p=p||d}catch{let m=ne.default.lstatSync(d);if(m.isDirectory())continue;if(c){ne.default.unlinkSync(d),ne.default.mkdirSync(d,s),p=p||d;continue}else if(m.isSymbolicLink())return new Xn(d,d+"/"+f.join("/"))}}return u(p)},ga=Object.create(null),Tu=1e4,Gt=new Set,Nw=e=>{Gt.has(e)?Gt.delete(e):ga[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Gt.add(e);let t=ga[e],i=Gt.size-Tu;if(i>Tu/10){for(let s of Gt)if(Gt.delete(s),delete ga[s],--i<=0)break}return t},Rw=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Pw=Rw==="win32",Iw=e=>e.split("/").slice(0,-1).reduce((t,i)=>{let s=t.at(-1);return s!==void 0&&(i=(0,tl.join)(s,i)),t.push(i||"/"),t},[]),Tw=class{#e=new Map;#i=new Map;#s=new Set;reserve(e,t){e=Pw?["win32 parallelization disabled"]:e.map(s=>Xi((0,tl.join)(Nw(s))));let i=new Set(e.map(s=>Iw(s)).reduce((s,n)=>s.concat(n)));this.#i.set(t,{dirs:i,paths:e});for(let s of e){let n=this.#e.get(s);n?n.push(t):this.#e.set(s,[t])}for(let s of i){let n=this.#e.get(s);if(!n)this.#e.set(s,[new Set([t])]);else{let r=n.at(-1);r instanceof Set?r.add(t):n.push(new Set([t]))}}return this.#n(t)}#r(e){let t=this.#i.get(e);if(!t)throw new Error("function does not have any path reservations");return{paths:t.paths.map(i=>this.#e.get(i)),dirs:[...t.dirs].map(i=>this.#e.get(i))}}check(e){let{paths:t,dirs:i}=this.#r(e);return t.every(s=>s&&s[0]===e)&&i.every(s=>s&&s[0]instanceof Set&&s[0].has(e))}#n(e){return this.#s.has(e)||!this.check(e)?!1:(this.#s.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#s.has(e))return!1;let t=this.#i.get(e);if(!t)throw new Error("invalid reservation");let{paths:i,dirs:s}=t,n=new Set;for(let r of i){let o=this.#e.get(r);if(!o||o?.[0]!==e)continue;let a=o[1];if(!a){this.#e.delete(r);continue}if(o.shift(),typeof a=="function")n.add(a);else for(let l of a)n.add(l)}for(let r of s){let o=this.#e.get(r),a=o?.[0];if(!(!o||!(a instanceof Set)))if(a.size===1&&o.length===1){this.#e.delete(r);continue}else if(a.size===1){o.shift();let l=o[0];typeof l=="function"&&n.add(l)}else a.delete(e)}return this.#s.delete(e),n.forEach(r=>this.#n(r)),!0}},Lw=()=>process.umask(),Lu=Symbol("onEntry"),xa=Symbol("checkFs"),Cu=Symbol("checkFs2"),qa=Symbol("isReusable"),le=Symbol("makeFs"),Ba=Symbol("file"),Fa=Symbol("directory"),Bn=Symbol("link"),Mu=Symbol("symlink"),Du=Symbol("hardlink"),Ji=Symbol("ensureNoSymlink"),$u=Symbol("unsupported"),xu=Symbol("checkPath"),ya=Symbol("stripAbsolutePath"),nt=Symbol("mkdir"),V=Symbol("onError"),Rn=Symbol("pending"),qu=Symbol("pend"),Wt=Symbol("unpend"),ba=Symbol("ended"),wa=Symbol("maybeClose"),ja=Symbol("skip"),Qi=Symbol("doChown"),es=Symbol("uid"),ts=Symbol("gid"),is=Symbol("checkedCwd"),Cw=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,ss=Cw==="win32",Mw=1024,Dw=(e,t)=>{if(!ss)return P.default.unlink(e,t);let i=e+".DELETE."+(0,Qa.randomBytes)(16).toString("hex");P.default.rename(e,i,s=>{if(s)return t(s);P.default.unlink(i,t)})},$w=e=>{if(!ss)return P.default.unlinkSync(e);let t=e+".DELETE."+(0,Qa.randomBytes)(16).toString("hex");P.default.renameSync(e,t),P.default.unlinkSync(t)},Bu=(e,t,i)=>e!==void 0&&e===e>>>0?e:t!==void 0&&t===t>>>0?t:i,il=class extends ns{[ba]=!1;[is]=!1;[Rn]=0;reservations=new Tw;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[ba]=!0,this[wa]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=e.preserveOwner===void 0&&typeof e.uid!="number"?!!(process.getuid&&process.getuid()===0):!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:Mw,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||ss,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=R(j.default.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:Lw():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[Lu](t))}warn(e,t,i={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(i.recoverable=!1),super.warn(e,t,i)}[wa](){this[ba]&&this[Rn]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[ya](e,t){let i=e[t],{type:s}=e;if(!i||this.preservePaths)return!0;let[n,r]=Ha(i),o=r.replaceAll(/\\/g,"/").split("/");if(o.includes("..")||ss&&/^[a-z]:\.\.$/i.test(o[0]??"")){if(t==="path"||s==="Link")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:i}),!1;let a=j.default.posix.dirname(e.path),l=j.default.posix.normalize(j.default.posix.join(a,o.join("/")));if(l.startsWith("../")||l==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:i}),!1}return n&&(e[t]=String(r),this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute ${t}`,{entry:e,[t]:i})),!0}[xu](e){let t=R(e.path),i=t.split("/");if(this.strip){if(i.length=this.strip)e.linkpath=s.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),e.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[ya](e,"path")||!this[ya](e,"linkpath"))return!1;if(e.absolute=j.default.isAbsolute(e.path)?R(j.default.resolve(e.path)):R(j.default.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:R(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:s}=j.default.win32.parse(String(e.absolute));e.absolute=s+Su(String(e.absolute).slice(s.length));let{root:n}=j.default.win32.parse(e.path);e.path=n+Su(e.path.slice(n.length))}return!0}[Lu](e){if(!this[xu](e))return e.resume();switch(cf.default.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[xa](e);default:return this[$u](e)}}[V](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[Wt](),t.resume())}[nt](e,t,i){Ow(R(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t},i)}[Qi](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[es](e){return Bu(this.uid,e.uid,this.processUid)}[ts](e){return Bu(this.gid,e.gid,this.processGid)}[Ba](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=new Yn(String(e.absolute),{flags:mf(e.size),mode:i,autoClose:!1});s.on("error",a=>{s.fd&&P.default.close(s.fd,()=>{}),s.write=()=>!0,this[V](a,e),t()});let n=1,r=a=>{if(a){s.fd&&P.default.close(s.fd,()=>{}),this[V](a,e),t();return}--n===0&&s.fd!==void 0&&P.default.close(s.fd,l=>{l?this[V](l,e):this[Wt](),t()})};s.on("finish",()=>{let a=String(e.absolute),l=s.fd;if(typeof l=="number"&&e.mtime&&!this.noMtime){n++;let c=e.atime||new Date,h=e.mtime;P.default.futimes(l,c,h,u=>u?P.default.utimes(a,c,h,f=>r(f&&u)):r())}if(typeof l=="number"&&this[Qi](e)){n++;let c=this[es](e),h=this[ts](e);typeof c=="number"&&typeof h=="number"&&P.default.fchown(l,c,h,u=>u?P.default.chown(a,c,h,f=>r(f&&u)):r())}r()});let o=this.transform&&this.transform(e)||e;o!==e&&(o.on("error",a=>{this[V](a,e),t()}),e.pipe(o)),o.pipe(s)}[Fa](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode;this[nt](String(e.absolute),i,s=>{if(s){this[V](s,e),t();return}let n=1,r=()=>{--n===0&&(t(),this[Wt](),e.resume())};e.mtime&&!this.noMtime&&(n++,P.default.utimes(String(e.absolute),e.atime||new Date,e.mtime,r)),this[Qi](e)&&(n++,P.default.chown(String(e.absolute),Number(this[es](e)),Number(this[ts](e)),r)),r()})}[$u](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[Mu](e,t){let i=R(j.default.relative(this.cwd,j.default.resolve(j.default.dirname(String(e.absolute)),String(e.linkpath)))).split("/");this[Ji](e,this.cwd,i,()=>this[Bn](e,String(e.linkpath),"symlink",t),s=>{this[V](s,e),t()})}[Du](e,t){let i=R(j.default.resolve(this.cwd,String(e.linkpath))),s=R(String(e.linkpath)).split("/");this[Ji](e,this.cwd,s,()=>this[Bn](e,i,"link",t),n=>{this[V](n,e),t()})}[Ji](e,t,i,s,n){let r=i.shift();if(this.preservePaths||r===void 0)return s();let o=j.default.resolve(t,r);P.default.lstat(o,(a,l)=>{if(a)return s();if(l?.isSymbolicLink())return n(new Xn(o,j.default.resolve(o,i.join("/"))));this[Ji](e,o,i,s,n)})}[qu](){this[Rn]++}[Wt](){this[Rn]--,this[wa]()}[ja](e){this[Wt](),e.resume()}[qa](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!ss}[xa](e){this[qu]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,i=>this[Cu](e,i))}[Cu](e,t){let i=o=>{t(o)},s=()=>{this[nt](this.cwd,this.dmode,o=>{if(o){this[V](o,e),i();return}this[is]=!0,n()})},n=()=>{if(e.absolute!==this.cwd){let o=R(j.default.dirname(String(e.absolute)));if(o!==this.cwd)return this[nt](o,this.dmode,a=>{if(a){this[V](a,e),i();return}r()})}r()},r=()=>{P.default.lstat(String(e.absolute),(o,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(e.mtime??a.mtime))){this[ja](e),i();return}if(o||this[qa](e,a))return this[le](null,e,i);if(a.isDirectory()){if(e.type==="Directory"){let l=this.chmod&&e.mode&&(a.mode&4095)!==e.mode,c=h=>this[le](h??null,e,i);return l?P.default.chmod(String(e.absolute),Number(e.mode),c):c()}if(e.absolute!==this.cwd)return P.default.rmdir(String(e.absolute),l=>this[le](l??null,e,i))}if(e.absolute===this.cwd)return this[le](null,e,i);Dw(String(e.absolute),l=>this[le](l??null,e,i))})};this[is]?n():s()}[le](e,t,i){if(e){this[V](e,t),i();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[Ba](t,i);case"Link":return this[Du](t,i);case"SymbolicLink":return this[Mu](t,i);case"Directory":case"GNUDumpDir":return this[Fa](t,i)}}[Bn](e,t,i,s){P.default[i](t,String(e.absolute),n=>{n?this[V](n,e):(this[Wt](),e.resume()),s()})}},Hi=e=>{try{return[null,e()]}catch(t){return[t,null]}},vf=class extends il{sync=!0;[le](e,t){return super[le](e,t,()=>{})}[xa](e){if(!this[is]){let n=this[nt](this.cwd,this.dmode);if(n)return this[V](n,e);this[is]=!0}if(e.absolute!==this.cwd){let n=R(j.default.dirname(String(e.absolute)));if(n!==this.cwd){let r=this[nt](n,this.dmode);if(r)return this[V](r,e)}}let[t,i]=Hi(()=>P.default.lstatSync(String(e.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(e.mtime??i.mtime)))return this[ja](e);if(t||this[qa](e,i))return this[le](null,e);if(i.isDirectory()){if(e.type==="Directory"){let r=this.chmod&&e.mode&&(i.mode&4095)!==e.mode,[o]=r?Hi(()=>{P.default.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[le](o,e)}let[n]=Hi(()=>P.default.rmdirSync(String(e.absolute)));this[le](n,e)}let[s]=e.absolute===this.cwd?[]:Hi(()=>$w(String(e.absolute)));this[le](s,e)}[Ba](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=o=>{let a;try{P.default.closeSync(n)}catch(l){a=l}(o||a)&&this[V](o||a,e),t()},n;try{n=P.default.openSync(String(e.absolute),mf(e.size),i)}catch(o){return s(o)}let r=this.transform&&this.transform(e)||e;r!==e&&(r.on("error",o=>this[V](o,e)),e.pipe(r)),r.on("data",o=>{try{P.default.writeSync(n,o,0,o.length)}catch(a){s(a)}}),r.on("end",()=>{let o=null;if(e.mtime&&!this.noMtime){let a=e.atime||new Date,l=e.mtime;try{P.default.futimesSync(n,a,l)}catch(c){try{P.default.utimesSync(String(e.absolute),a,l)}catch{o=c}}}if(this[Qi](e)){let a=this[es](e),l=this[ts](e);try{P.default.fchownSync(n,Number(a),Number(l))}catch(c){try{P.default.chownSync(String(e.absolute),Number(a),Number(l))}catch{o=o||c}}}s(o)})}[Fa](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode,s=this[nt](String(e.absolute),i);if(s){this[V](s,e),t();return}if(e.mtime&&!this.noMtime)try{P.default.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Qi](e))try{P.default.chownSync(String(e.absolute),Number(this[es](e)),Number(this[ts](e)))}catch{}t(),e.resume()}[nt](e,t){try{return Aw(R(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t})}catch(i){return i}}[Ji](e,t,i,s,n){if(this.preservePaths||i.length===0)return s();let r=t;for(let o of i){r=j.default.resolve(r,o);let[a,l]=Hi(()=>P.default.lstatSync(r));if(a)return s();if(l.isSymbolicLink())return n(new Xn(r,j.default.resolve(t,i.join("/"))))}s()}[Bn](e,t,i,s){let n=`${i}Sync`;try{P.default[n](t,String(e.absolute)),s(),e.resume()}catch(r){return this[V](r,e)}}},xw=e=>{let t=new vf(e),i=e.file,s=Xa.default.statSync(i),n=e.maxReadSize||16*1024*1024;new ub(i,{readSize:n,size:s.size}).pipe(t)},qw=(e,t)=>{let i=new il(e),s=e.maxReadSize||16*1024*1024,n=e.file;return new Promise((r,o)=>{i.on("error",o),i.on("close",r),Xa.default.stat(n,(a,l)=>{if(a)o(a);else{let c=new Ua(n,{readSize:s,size:l.size});c.on("error",o),c.pipe(i)}})})},cs=as(xw,qw,e=>new vf(e),e=>new il(e),(e,t)=>{t?.length&&ef(e,t)}),Bw=(e,t)=>{let i=new Za(e),s=!0,n,r;try{try{n=se.default.openSync(e.file,"r+")}catch(l){if(l?.code==="ENOENT")n=se.default.openSync(e.file,"w+");else throw l}let o=se.default.fstatSync(n),a=Buffer.alloc(512);e:for(r=0;ro.size)break;r+=c,e.mtimeCache&&l.mtime&&e.mtimeCache.set(String(l.path),l.mtime)}s=!1,Fw(e,i,r,n,t)}finally{if(s)try{se.default.closeSync(n)}catch{}}},Fw=(e,t,i,s,n)=>{let r=new Uu(e.file,{fd:s,start:i});t.pipe(r),Kw(t,n)},jw=(e,t)=>{t=Array.from(t);let i=new Zn(e),s=(n,r,o)=>{let a=(f,p)=>{f?se.default.close(n,g=>o(f)):o(null,p)},l=0;if(r===0)return a(null,0);let c=0,h=Buffer.alloc(512),u=(f,p)=>{if(f||p===void 0)return a(f);if(c+=p,c<512&&p)return se.default.read(n,h,c,h.length-c,l+c,u);if(l===0&&h[0]===31&&h[1]===139)return a(new Error("cannot append to compressed archives"));if(c<512)return a(null,l);let g=new Nt(h);if(!g.cksumValid)return a(null,l);let d=512*Math.ceil((g.size??0)/512);if(l+d+512>r||(l+=d+512,l>=r))return a(null,l);e.mtimeCache&&g.mtime&&e.mtimeCache.set(String(g.path),g.mtime),c=0,se.default.read(n,h,0,512,l,u)};se.default.read(n,h,0,512,l,u)};return new Promise((n,r)=>{i.on("error",r);let o="r+",a=(l,c)=>{if(l&&l.code==="ENOENT"&&o==="r+")return o="w+",se.default.open(e.file,o,a);if(l||!c)return r(l);se.default.fstat(c,(h,u)=>{if(h)return se.default.close(c,()=>r(h));s(c,u.size,(f,p)=>{if(f)return r(f);let g=new Yn(e.file,{fd:c,start:p});i.pipe(g),g.on("error",r),g.on("close",n),Uw(i,t)})})};se.default.open(e.file,o,a)})},Kw=(e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Vn({file:sl.default.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:s=>e.add(s)}):e.add(i)}),e.end()},Uw=async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Vn({file:sl.default.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:s=>e.add(s)}):e.add(i);e.end()},Vi=as(Bw,jw,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(e,t)=>{if(!yb(e))throw new TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!t?.length)throw new TypeError("no paths specified to add/replace")}),wv=as(Vi.syncFile,Vi.asyncFile,Vi.syncNoFile,Vi.asyncNoFile,(e,t=[])=>{Vi.validate?.(e,t),zw(e)}),zw=e=>{let t=e.filter;e.mtimeCache||(e.mtimeCache=new Map),e.filter=t?(i,s)=>t(i,s)&&!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(i,s)=>!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0))};var b=class extends Error{constructor(t){super(t),this.name="InstallException"}};function S(e){process.stdout.write(`${e} +`)}var Pt={IF_NOT_PRESENT:"IfNotPresent",ALWAYS:"Always"},ce="docker://",D="oci://",Yw=":latest!",nl="registry.access.redhat.com/rhdh/",rl="quay.io/rhdh/",ti="dynamic-plugin-config.hash",ol="dynamic-plugin-image.hash",Qn="dynamic-plugins.default.yaml",Of="install-dynamic-plugins.lock",al="app-config.dynamic-plugins.yaml",kf=4e7;function Gw(e=process.env.MAX_ENTRY_SIZE){if(!e)return kf;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=1?t:kf}var hs=Gw(),at=["sha512","sha384","sha256"];function er(e){return e.pullPolicy?e.pullPolicy:e.package.includes(Yw)?Pt.ALWAYS:Pt.IF_NOT_PRESENT}function De(e,t){let i=typeof e.enabled=="boolean",s=typeof e.disabled=="boolean";return e.enabled!==void 0&&!i&&t?.(`WARNING: Plugin ${e.package} has non-boolean 'enabled: ${String(e.enabled)}'. Expected true or false; ignoring the field.`),e.disabled!==void 0&&!s&&t?.(`WARNING: Plugin ${e.package} has non-boolean 'disabled: ${String(e.disabled)}'. Expected true or false; ignoring the field.`),i&&s?(t?.(`WARNING: Plugin ${e.package} specifies both 'enabled' and 'disabled'. The 'enabled' field takes precedence; please use only 'enabled'.`),!e.enabled):i?!e.enabled:s?e.disabled===!0:!1}async function ii(e,t){let{proto:i,raw:s}=Ww(t);if(!s.startsWith(nl))return t;let n=`${ce}${s}`;if(await e.exists(n))return t;let r=s.replace(nl,rl);return S(` ==> Falling back to ${rl} for ${s}`),`${i}${r}`}function Ww(e){return e.startsWith(D)?{proto:D,raw:e.slice(D.length)}:e.startsWith(ce)?{proto:ce,raw:e.slice(ce.length)}:{proto:"",raw:e}}var _f=O(require("node:fs/promises")),ll=O(require("node:path"));async function be(e){try{return await _f.access(e),!0}catch{return!1}}function si(e,t){let i=t.endsWith(ll.sep)?t:t+ll.sep;return e===t||e.startsWith(i)}function $e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tr(e){return e==="File"||e==="Directory"||e==="SymbolicLink"||e==="Link"||e==="OldFile"||e==="ContiguousFile"}function ir(e,t){for(let[i,s]of e)s===t&&e.delete(i)}async function Af(e,t,i,s){S(` +======= Extracting catalog index from ${t}`);let n=x.join(i,".catalog-index-temp");await q.mkdir(n,{recursive:!0});let r=x.resolve(n);await Nf(e,t,r);let o=x.join(n,Qn);if(!await be(o))throw new b(`dynamic-plugins.default.yaml not found in ${t}`);S(" ==> Extracted dynamic-plugins.default.yaml");for(let a of["catalog-entities/extensions","catalog-entities/marketplace"]){let l=x.join(n,a);if(await be(l)){await q.mkdir(s,{recursive:!0});let c=x.join(s,"catalog-entities");await q.rm(c,{recursive:!0,force:!0}),await hl(l,c),S(` ==> Extracted catalog entities from ${a}`);break}}return o}async function Nf(e,t,i){let s=await ii(e,t),n=await q.mkdtemp(x.join(cl.tmpdir(),"rhdh-catalog-index-"));try{let r=s.startsWith(ce)?s:`${ce}${s.replace(D,"")}`,o=x.join(n,"idx");S(" ==> Downloading catalog index image"),await e.copy(r,`dir:${o}`);let a=x.join(o,"manifest.json");if(!await be(a))throw new b(`manifest.json not found in catalog index image ${t}`);let c=JSON.parse(await q.readFile(a,"utf8")).layers??[],h=null;for(let u of c){if(h)break;let f=u.digest;if(!f)continue;let[,p]=f.split(":");if(!p)continue;let g=x.join(o,p);await be(g)&&await cs({file:g,cwd:i,preservePaths:!1,filter:(d,m)=>{if(h)return!1;let w=m;if(w.size>hs)return h=new b(`Zip bomb detected in ${d}`),!1;if(w.type==="SymbolicLink"||w.type==="Link"){let k=x.resolve(i,w.linkpath??"");if(!si(k,i))return!1}let E=x.resolve(i,d);return si(E,i)?tr(w.type):!1}})}if(h)throw h}finally{await q.rm(n,{recursive:!0,force:!0})}}async function Rf(e,t,i,s,n){if(!If(i))throw new b(`Refusing to extract extra catalog index into unsafe subdirectory '${i}'`);S(` +======= Extracting extra catalog index '${i}' from ${t}`),n&&S(` ==> WARNING: Subdirectory '${i}' was already used by '${n}'. The previous extraction will be overwritten.`);let r=await q.mkdtemp(x.join(cl.tmpdir(),"rhdh-extra-catalog-index-"));try{let o=x.join(r,"extracted");await q.mkdir(o,{recursive:!0}),await Nf(e,t,o);let a=x.join(s,i);S(` ==> Extracting extensions catalog entities to ${a}`);let l=null;for(let h of["catalog-entities/extensions","catalog-entities/marketplace"]){let u=x.join(o,h);if(await be(u)){l=u;break}}if(!l){S(` ==> WARNING: Extra catalog index image ${t} does not have neither 'catalog-entities/extensions/' nor 'catalog-entities/marketplace/' directory`);return}await q.mkdir(a,{recursive:!0});let c=x.join(a,"catalog-entities");await q.rm(c,{recursive:!0,force:!0}),await hl(l,c),S(` ==> Successfully extracted extensions catalog entities from extra index image to ${a}`)}finally{await q.rm(r,{recursive:!0,force:!0})}}function Hw(e){return e.replaceAll(/[/:@]/g,"_")}function Pf(e){let t=[];for(let i of e.split(",")){let s=i.trim();if(!s)continue;let n,r,o=s.indexOf("=");if(o===-1?(r=s,n=Hw(r)):(n=s.slice(0,o).trim(),r=s.slice(o+1).trim()),!r){S(`WARNING: Skipping EXTRA_CATALOG_INDEX_IMAGES entry with empty image reference: '${s}'`);continue}if(!If(n)){S(`WARNING: Skipping EXTRA_CATALOG_INDEX_IMAGES entry with unsafe subdirectory name '${n}' in '${s}'. Names must be non-empty and must not contain '/', '\\\\', or '..'.`);continue}t.push([n,r])}return t}function If(e){return!e||e==="."||e===".."?!1:!/[/\\]/.test(e)}async function Tf(e){await q.rm(x.join(e,".catalog-index-temp"),{recursive:!0,force:!0})}async function hl(e,t){await q.mkdir(t,{recursive:!0});let i=await q.readdir(e,{withFileTypes:!0});for(let s of i){let n=x.join(e,s.name),r=x.join(t,s.name);s.isDirectory()?await hl(n,r):s.isFile()&&await q.copyFile(n,r)}}var us=O(require("node:os")),ul=class{available;queue=[];constructor(t){if(t<1)throw new RangeError(`Semaphore max must be >= 1, got ${t}`);this.available=t}async acquire(){if(this.available>0){this.available--;return}return new Promise(t=>this.queue.push(t))}release(){let t=this.queue.shift();t?t():this.available++}};async function Lf(e,t,i){let s=new ul(Math.max(1,t));return Promise.all(e.map(async n=>{await s.acquire();try{return{ok:!0,value:await i(n),item:n}}catch(r){return{ok:!1,error:r,item:n}}finally{s.release()}}))}var Vw=6,Jw=3;function Cf(){return Df(process.env.DYNAMIC_PLUGINS_WORKERS,Vw)}function Mf(){return Df(process.env.DYNAMIC_PLUGINS_NPM_WORKERS,Jw)}function Df(e,t){let i=e??"auto";if(i!=="auto"){let n=Number.parseInt(i,10);return!Number.isFinite(n)||n<1?1:n}let s=typeof us.availableParallelism=="function"?us.availableParallelism():us.cpus().length;return Math.max(1,Math.min(Math.floor(s/2),t))}var $f=require("node:crypto"),rr=O(require("node:fs/promises")),sr=O(require("node:path"));var nr=class{constructor(t,i){this.skopeo=t;this.tmpDir=i}tarballs=new Map;async getTarball(t){let i=await ii(this.skopeo,t),s=this.tarballs.get(i);return s||(s=this.downloadAndLocateTarball(i),this.tarballs.set(i,s),s.catch(()=>this.tarballs.delete(i))),s}async getDigest(t){let s=(await ii(this.skopeo,t)).replace(D,ce),r=(await this.skopeo.inspect(s)).Digest;if(!r)throw new b(`No digest returned for ${t}`);let[,o]=r.split(":");if(!o)throw new b(`Malformed digest ${r} for ${t}`);return o}async getPluginPaths(t){let s=(await ii(this.skopeo,t)).replace(D,ce),r=(await this.skopeo.inspectRaw(s)).annotations?.["io.backstage.dynamic-packages"];if(!r)return[];let o;try{let l=Buffer.from(r,"base64").toString("utf8");o=JSON.parse(l)}catch(l){throw new b(`Could not decode 'io.backstage.dynamic-packages' annotation on ${t}: ${l.message}`)}if(!Array.isArray(o))return[];let a=[];for(let l of o)l&&typeof l=="object"&&a.push(...Object.keys(l));return a}async downloadAndLocateTarball(t){let i=(0,$f.createHash)("sha256").update(t).digest("hex"),s=sr.join(this.tmpDir,i);await rr.mkdir(s,{recursive:!0});let n=t.replace(D,ce);S(` ==> Downloading ${t}`),await this.skopeo.copy(n,`dir:${s}`);let r=sr.join(s,"manifest.json"),a=JSON.parse(await rr.readFile(r,"utf8")).layers?.[0]?.digest;if(!a)throw new b(`OCI manifest for ${t} has no layers`);let[,l]=a.split(":");if(!l)throw new b(`Malformed layer digest ${a} in ${t}`);return sr.join(s,l)}};var Gf=O(require("node:fs/promises")),or=O(require("node:path"));var qf=require("node:crypto"),Bf=require("node:fs"),Ff=require("node:stream/promises");async function jf(e,t,i){let s=i.indexOf("-");if(s===-1)throw new b(`Package integrity for ${e} must be a string of the form -`);let n=i.slice(0,s),r=i.slice(s+1);if(!Zw(n))throw new b(`${e}: Provided Package integrity algorithm ${n} is not supported, please use one of following algorithms ${at.join(", ")} instead`);if(!Xw(r))throw new b(`${e}: Provided Package integrity hash ${r} is not a valid base64 encoding`);let o=(0,qf.createHash)(n);await(0,Ff.pipeline)((0,Bf.createReadStream)(t),o);let a=o.digest("base64");if(a!==r)throw new b(`${e}: integrity check failed \u2014 got ${n}-${a}, expected ${i}`)}function Zw(e){return at.includes(e)}function Xw(e){if(e.length===0||!Qw(e))return!1;try{let t=Buffer.from(e,"base64");return xf(t.toString("base64"))===xf(e)}catch{return!1}}var Kf=61;function Qw(e){let t=0;for(let i=0;i2)return!1;continue}if(t>0||!eS(s))return!1}return!0}function eS(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function xf(e){let t=e.length;for(;t>0&&e.codePointAt(t-1)===Kf;)t--;return e.slice(0,t)}var Uf=require("node:child_process");async function fs(e,t,i={}){if(e.length===0)throw new b(`${t}: empty command`);let[s,...n]=e;return new Promise((r,o)=>{let a=(0,Uf.spawn)(s,n,{...i,stdio:["ignore","pipe","pipe"]}),l="",c="";a.stdout?.on("data",h=>l+=h.toString()),a.stderr?.on("data",h=>c+=h.toString()),a.on("error",h=>o(new b(`${t}: ${h.message}`))),a.on("close",h=>{if(h===0)r({stdout:l,stderr:c});else{let u=[`${t}: exit code ${h}`,`cmd: ${e.join(" ")}`];c.trim()&&u.push(`stderr: ${c.trim()}`),o(new b(u.join(` +`)))}})})}var It=O(require("node:fs/promises")),we=O(require("node:path"));var ds="package/";async function zf(e,t,i){tS(t);let s=we.resolve(i),n=we.join(s,t);await It.rm(n,{recursive:!0,force:!0}),await It.mkdir(s,{recursive:!0});let r=t.endsWith("/")?t:`${t}/`,o=null;if(await cs({file:e,cwd:s,preservePaths:!1,filter:(a,l)=>{if(o)return!1;let c=l;if(a!==t&&!a.startsWith(r))return!1;if(c.size>hs)return o=new b(`Zip bomb detected in ${a}`),!1;if(c.type==="SymbolicLink"||c.type==="Link"){let h=c.linkpath??"",u=we.resolve(s,h);if(!si(u,s))return S(` ==> WARNING: skipping file containing link outside of the archive: ${a} -> ${h}`),!1}return tr(c.type)?!0:(o=new b(`Disallowed tar entry type ${c.type} for ${a}`),!1)}}),o)throw o}async function Yf(e){if(!e.endsWith(".tgz"))throw new b(`Expected .tgz archive, got ${e}`);let t=e.slice(0,-4),i=we.resolve(t);await It.rm(t,{recursive:!0,force:!0}),await It.mkdir(t,{recursive:!0});let s=null;if(await cs({file:e,cwd:t,preservePaths:!1,filter:(n,r)=>{if(s)return!1;let o=r;if(o.type==="Directory")return!1;if(o.type==="File")return n.startsWith(ds)?o.size>hs?(s=new b(`Zip bomb detected in ${n}`),!1):(o.path=n.slice(ds.length),!0):(s=new b(`NPM package archive does not start with 'package/' as it should: ${n}`),!1);if(o.type==="SymbolicLink"||o.type==="Link"){let a=o.linkpath??"";if(!a.startsWith(ds))return s=new b(`NPM package archive contains a link outside of the archive: ${n} -> ${a}`),!1;o.path=n.slice(ds.length),o.linkpath=a.slice(ds.length);let l=we.resolve(t,o.linkpath);return si(l,i)?!0:(s=new b(`NPM package archive contains a link outside of the archive: ${o.path} -> ${o.linkpath}`),!1)}return s=new b(`NPM package archive contains a non-regular file: ${n}`),!1}}),s)throw s;return await It.rm(e,{force:!0}),we.basename(i)}function tS(e){if(we.isAbsolute(e))throw new b(`Invalid plugin path (absolute): ${e}`);if(e.length===0)throw new b("Invalid plugin path (empty)");let t=e.split(/[/\\]/);for(let i of t)if(i===""||i==="."||i==="..")throw new b(`Invalid plugin path (path traversal detected): ${e}`)}async function Wf(e,t,i,s){if(De(e,S))return{pluginPath:null,pluginConfig:{}};let n=e.plugin_hash;if(!n)throw new b(`Internal error: plugin ${e.package} missing plugin_hash`);let r=e.package,o=e.pluginConfig??{},a=r.startsWith("./"),l=a?or.join(process.cwd(),r.slice(2)):r,c=!a&&!i;if(c&&!e.integrity)throw new b(`No integrity hash provided for Package ${r}. This is an insecure installation. To ignore this error, set the SKIP_INTEGRITY_CHECK environment variable to 'true'.`);S(" ==> Running npm pack");let h=await iS(l,t);if(!nS(h))throw new b(`npm pack returned an unsafe filename for ${r}: '${h}'`);let u=or.join(t,h);c&&(S(" ==> Verifying package integrity"),await jf(r,u,e.integrity));let f=await Yf(u);return await Gf.writeFile(or.join(t,f,ti),n),ir(s,f),{pluginPath:f,pluginConfig:o}}async function iS(e,t){let{stdout:i}=await fs(["npm","pack","--json","--ignore-scripts",e],`npm pack failed for ${e}`,{cwd:t}),s;try{s=JSON.parse(i)}catch(r){throw new b(`npm pack produced invalid JSON for ${e}: ${r.message}`)}if(!Array.isArray(s)||s.length===0)throw new b(`npm pack produced no archives for ${e}`);let n=s[0];if(!sS(n))throw new b(`npm pack output missing 'filename' for ${e}`);return n.filename}function sS(e){return!!e&&typeof e=="object"&&typeof e.filename=="string"}function nS(e){return!e||e==="."||e===".."||e.startsWith("..")?!1:!/[/\\]/.test(e)}var Tt=O(require("node:fs/promises")),ps=O(require("node:path"));function Hf(e){let t=e.indexOf("!");if(t===-1)return null;let i=e.slice(0,t),s=e.slice(t+1);return!i||!s?null:{imagePart:i,pluginPath:s}}async function Vf(e,t,i,s){if(De(e,S))return{pluginPath:null,pluginConfig:{}};let n=e.plugin_hash;if(!n)throw new b(`Internal error: plugin ${e.package} missing plugin_hash`);let r=e.package,o=e.pluginConfig??{},a=er(e);if(await rS(r,n,a,t,i,s))return s.delete(n),{pluginPath:null,pluginConfig:o};if(!e.version)throw new b(`No version for ${r}`);let l=Hf(r);if(!l)throw new b(`OCI package ${r} missing !plugin-path suffix`);let{imagePart:c,pluginPath:h}=l,u=await i.getTarball(c);await zf(u,h,t);let f=ps.join(t,h);return await Tt.mkdir(f,{recursive:!0}),await Tt.writeFile(ps.join(f,ol),await i.getDigest(c)),await Tt.writeFile(ps.join(f,ti),n),ir(s,h),{pluginPath:h,pluginConfig:o}}async function rS(e,t,i,s,n,r){let o=r.get(t);if(o===void 0)return!1;if(i===Pt.IF_NOT_PRESENT)return S(` ==> ${e}: already installed, skipping`),!0;if(i!==Pt.ALWAYS)return!1;let a=ps.join(s,o,ol);if(!await be(a))return!1;let l=(await Tt.readFile(a,"utf8")).trim(),c=Hf(e);if(!c)return!1;let h=await n.getDigest(c.imagePart);return l!==h?!1:(S(` ==> ${e}: digest unchanged, skipping`),!0)}var Zf=require("node:fs"),ni=O(require("node:fs/promises"));var oS=1e3,Jf=600*1e3;async function Xf(e){let t=aS(process.env.DYNAMIC_PLUGINS_LOCK_TIMEOUT_MS),i=Date.now()+t;for(;;){try{await ni.writeFile(e,String(process.pid),{flag:"wx"}),S(`======= Created lock file: ${e}`);return}catch(s){if(s.code!=="EEXIST")throw s}if(Date.now()>=i)throw new b(`Timed out after ${t}ms waiting for lock file ${e}. Another install may be stuck \u2014 remove the file manually to proceed.`);S(`======= Waiting for lock to be released: ${e}`),await lS(e,i)}}function aS(e){if(!e)return Jf;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=1?t:Jf}async function Qf(e){try{await ni.unlink(e),S(`======= Removed lock file: ${e}`)}catch(t){if(t.code!=="ENOENT")throw t}}function ed(e){let t=()=>{try{(0,Zf.unlinkSync)(e)}catch{}};process.on("exit",t),process.on("SIGTERM",()=>{t(),process.exit(0)}),process.on("SIGINT",()=>{t(),process.exit(130)})}async function lS(e,t){for(;;){try{await ni.access(e)}catch{return}if(Date.now()>=t)return;await cS(oS)}}function cS(e){return new Promise(t=>setTimeout(t,e))}var SS=O(Go());var hS=/^(@[^/]+\/)?([^@]+)(?:@(.+))?$/,uS=/^([^@]+)@npm:(@[^/]+\/)?([^@]+)(?:@(.+))?$/,fS=/^([^/@]+)\/([^/#]+)(?:#(.+))?$/,dS=[/^git\+https?:\/\/[^#]+(?:#(.+))?$/,/^git\+ssh:\/\/[^#]+(?:#(.+))?$/,/^git:\/\/[^#]+(?:#(.+))?$/,/^https:\/\/github\.com\/[^/]+\/[^/#]+(?:\.git)?(?:#(.+))?$/,/^git@github\.com:[^/]+\/[^/#]+(?:\.git)?(?:#(.+))?$/,/^github:([^/@]+)\/([^/#]+)(?:#(.+))?$/];function td(e){if(e.startsWith("./")||e.endsWith(".tgz"))return e;let t=pS(e);return t||(mS(e)?gS(e):yS(e))}function pS(e){let t=uS.exec(e);if(!t)return null;let[,i,s,n]=t;return`${i}@npm:${s??""}${n}`}function mS(e){return dS.some(t=>t.test(e))?!0:e.includes("://")||e.startsWith("@")?!1:fS.test(e)}function gS(e){let t=e.indexOf("#");return t>=0?e.slice(0,t):e}function yS(e){let t=hS.exec(e);if(!t)return e;let[,i,s]=t;return`${i??""}${s}`}var id=new RegExp("^("+wS(D)+String.raw`[^\s/:@]+`+String.raw`(?::\d+)?`+String.raw`(?:/[^\s:@]+)+`+")"+String.raw`(?::([^\s!@:]+)`+"|"+String.raw`@((?:sha256|sha512|blake3):[^\s!@:]+))`+String.raw`(?:!([^\s]+))?$`);async function sd(e,t){let i=id.exec(e);if(!i)throw new b(`oci package '${e}' is not in the expected format '${D}:' or '${D}@:' (optionally followed by '!') where may include a port (e.g. host:5000/path) and is one of ${at.join(", ")}`);let s=i[1],n=i[2],r=i[3],o=i[4]??null,a=n??r,l=n==="{{inherit}}"&&r===void 0;return l&&!o?{pluginKey:s,version:a,inherit:l,resolvedPath:null}:(o||(o=await bS(e,s,a,n!==void 0,t)),{pluginKey:`${s}:!${o}`,version:a,inherit:l,resolvedPath:o})}async function bS(e,t,i,s,n){if(!n)throw new b(`Cannot auto-detect plugin path for ${e}: no image cache provided`);let r=s?`${t}:${i}`:`${t}@${i}`;S(` ======= No plugin path specified for ${r}, auto-detecting from OCI manifest`);let o=await n.getPluginPaths(r);if(o.length===0)throw new b(`No plugins found in OCI image ${r}. The image might not contain the 'io.backstage.dynamic-packages' annotation. Please ensure it was packaged using the @red-hat-developer-hub/cli plugin package command.`);if(o.length>1){let l=o.map(c=>` - ${c}`).join(` `);throw new b(`Multiple plugins found in OCI image ${r}: ${l} Please specify which plugin to install using the syntax: ${r}!`)}let a=o[0];return S(` -======= Auto-resolving OCI package ${r} to use plugin path: ${a}`),a}function ul(e){let t=td.exec(e);return t?{registry:t[1],path:t[4]??null}:null}function bS(e){return e.replaceAll(/[.*+?^${}()|[\]\\/]/g,String.raw`\$&`)}function nd(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function fl(e,t,i){t==="__proto__"||t==="constructor"||t==="prototype"||Object.defineProperty(e,t,{value:i,writable:!0,enumerable:!0,configurable:!0})}function ar(e,t,i=""){for(let[s,n]of Object.entries(e)){if(nd(s))continue;let r=t;if(De(n)){let o=r[s],a=De(o)?o:{};fl(r,s,a),ar(n,a,`${i}${s}.`)}else{if(s in t&&!pl(r[s],n))throw new b(`Config key '${i}${s}' defined differently for 2 dynamic plugins`);fl(r,s,n)}}return t}async function dl(e,t,i,s,n){if(typeof e.package!="string")throw new b(`content of the 'plugins.package' field must be a string in ${i}`);e.package.startsWith(D)?await vS(e,t,i,s,n):SS(e,t,i,s)}function SS(e,t,i,s){let n=ed(e.package);kS(n,e,t,i,s)}async function vS(e,t,i,s,n){let r=await id(e.package,n);r.inherit&&r.resolvedPath===null?r=ES(e,t,r):!e.package.includes("!")&&r.resolvedPath&&(e.package=`${e.package}!${r.resolvedPath}`),e.version=r.version;let o=t[r.pluginKey];if(!o){if(r.inherit)throw new b(`ERROR: {{inherit}} tag is set and there is currently no resolved tag or digest for ${e.package} in ${i}.`);S(` +======= Auto-resolving OCI package ${r} to use plugin path: ${a}`),a}function fl(e){let t=id.exec(e);return t?{registry:t[1],path:t[4]??null}:null}function wS(e){return e.replaceAll(/[.*+?^${}()|[\]\\/]/g,String.raw`\$&`)}function rd(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function dl(e,t,i){t==="__proto__"||t==="constructor"||t==="prototype"||Object.defineProperty(e,t,{value:i,writable:!0,enumerable:!0,configurable:!0})}function lr(e,t,i=""){for(let[s,n]of Object.entries(e)){if(rd(s))continue;let r=t;if($e(n)){let o=r[s],a=$e(o)?o:{};dl(r,s,a),lr(n,a,`${i}${s}.`)}else{if(s in t&&!ml(r[s],n))throw new b(`Config key '${i}${s}' defined differently for 2 dynamic plugins`);dl(r,s,n)}}return t}async function pl(e,t,i,s,n){if(typeof e.package!="string")throw new b(`content of the 'plugins.package' field must be a string in ${i}`);e.package.startsWith(D)?await ES(e,t,i,s,n):vS(e,t,i,s)}function vS(e,t,i,s){let n=td(e.package);OS(n,e,t,i,s)}async function ES(e,t,i,s,n){let r=await sd(e.package,n);r.inherit&&r.resolvedPath===null?r=kS(e,t,r):!e.package.includes("!")&&r.resolvedPath&&(e.package=`${e.package}!${r.resolvedPath}`),e.version=r.version;let o=t[r.pluginKey];if(!o){if(r.inherit)throw new b(`ERROR: {{inherit}} tag is set and there is currently no resolved tag or digest for ${e.package} in ${i}.`);S(` ======= Adding new dynamic plugin configuration for version \`${r.version}\` of ${r.pluginKey}`),e.last_modified_level=s,t[r.pluginKey]=e;return}if(S(` -======= Overriding dynamic plugin configuration ${r.pluginKey}`),o.last_modified_level===s)throw new b(`Duplicate plugin configuration for ${e.package} found in ${i}.`);r.inherit||(o.package=e.package,o.version!==r.version&&S(`INFO: Overriding version for ${r.pluginKey} from \`${o.version??""}\` to \`${r.version}\``),o.version=r.version),rd(e,o,["package","version","last_modified_level"]),o.last_modified_level=s}function ES(e,t,i){let s=`${i.pluginKey}:!`,n=Object.keys(t).filter(h=>h.startsWith(s));if(n.length===0)throw new b(`Cannot use {{inherit}} for ${i.pluginKey}: no existing plugin configuration found. Ensure a plugin from this image is defined in an included file with an explicit version.`);if(n.length>1){let h=n.map(u=>{let f=t[u]?.version??"",p=u.split(":!")[0]??"",g=u.split(":!").at(-1)??"";return` - ${p}:${f}!${g}`}).join(` +======= Overriding dynamic plugin configuration ${r.pluginKey}`),o.last_modified_level===s)throw new b(`Duplicate plugin configuration for ${e.package} found in ${i}.`);r.inherit||(o.package=e.package,o.version!==r.version&&S(`INFO: Overriding version for ${r.pluginKey} from \`${o.version??""}\` to \`${r.version}\``),o.version=r.version),od(e,o,["package","version","last_modified_level"]),o.last_modified_level=s}function kS(e,t,i){let s=`${i.pluginKey}:!`,n=Object.keys(t).filter(h=>h.startsWith(s));if(n.length===0)throw new b(`Cannot use {{inherit}} for ${i.pluginKey}: no existing plugin configuration found. Ensure a plugin from this image is defined in an included file with an explicit version.`);if(n.length>1){let h=n.map(u=>{let f=t[u]?.version??"",p=u.split(":!")[0]??"",g=u.split(":!").at(-1)??"";return` - ${p}:${f}!${g}`}).join(` `);throw new b(`Cannot use {{inherit}} for ${i.pluginKey}: multiple plugins from this image are defined in the included files: ${h} Please specify which plugin configuration to inherit from using: ${i.pluginKey}:{{inherit}}!`)}let r=n[0],o=t[r];if(!o?.version)throw new b(`Internal: inherited plugin ${r} has no version`);let a=o.version,l=r.split(":!").at(-1)??"",c=r.split(":!")[0]??"";return e.package=`${c}:${a}!${l}`,S(` -======= Inheriting version \`${a}\` and plugin path \`${l}\` for ${r}`),{pluginKey:r,version:a,inherit:!0,resolvedPath:l}}function kS(e,t,i,s,n){let r=i[e];if(!r){S(` +======= Inheriting version \`${a}\` and plugin path \`${l}\` for ${r}`),{pluginKey:r,version:a,inherit:!0,resolvedPath:l}}function OS(e,t,i,s,n){let r=i[e];if(!r){S(` ======= Adding new dynamic plugin configuration for ${e}`),t.last_modified_level=n,i[e]=t;return}if(S(` -======= Overriding dynamic plugin configuration ${e}`),r.last_modified_level===n)throw new b(`Duplicate plugin configuration for ${t.package} found in ${s}.`);rd(t,r,["last_modified_level"]),r.last_modified_level=n}function rd(e,t,i){let s=new Set(i);for(let[n,r]of Object.entries(e))s.has(n)||nd(n)||fl(t,n,r)}function pl(e,t){return e===t?!0:typeof e!=typeof t?!1:Array.isArray(e)&&Array.isArray(t)?OS(e,t):De(e)&&De(t)?_S(e,t):!1}function OS(e,t){return e.length!==t.length?!1:e.every((i,s)=>pl(i,t[s]))}function _S(e,t){let i=Object.keys(e);return i.length!==Object.keys(t).length?!1:i.every(s=>pl(e[s],t[s]))}function or(e,t){return`${e} ${t??""}`}function AS(e,t,i){if(!i)throw new b(`oci package '${e}' is not in the expected format '${D}:' or '${D}@:' (optionally followed by '!') in ${t} where may include a port (e.g. host:5000/path) and is one of ${ot.join(", ")}`);S(`WARNING: Skipping disabled OCI plugin with invalid format: '${e}' in ${t}. Expected format: '${D}:' or '${D}@:' (optionally followed by '!') where may include a port (e.g. host:5000/path) and is one of ${ot.join(", ")}`)}function NS(e,t,i,s,n,r,o){let a=or(t,i),l=e.perEntryState.get(a);if(!l)return e.perEntryState.set(a,{disabled:n,level:s}),!0;if(l.level===s){let c=i?`!${i}`:"";if(!n)throw new b(`Duplicate OCI plugin configuration for ${t}${c} found at the same level in ${o}: ${r}`);return S(`WARNING: Skipping duplicate disabled OCI plugin configuration for ${t}${c} in ${o}`),!1}return s>l.level&&e.perEntryState.set(a,{disabled:n,level:s}),!0}function RS(e,t,i,s){if(!i){e.pathlessRegistries.set(t,s);return}let n=e.definedPaths.get(t);n||(n=new Map,e.definedPaths.set(t,n)),n.set(i,s)}function sd(e,t,i,s){let n=t.package;if(typeof n!="string"||!n.startsWith(D))return;let r=t.disabled===!0,o=ul(n);if(!o){AS(n,s,r);return}let{registry:a,path:l}=o;NS(e,a,l,i,r,n,s)&&RS(e,a,l,s)}function PS(e){return[...e.entries()].sort(([t],[i])=>t.localeCompare(i)).map(([t,i])=>`${t} (in ${i})`).join(` - - `)}function IS(e){for(let[t,i]of e.pathlessRegistries){let s=e.definedPaths.get(t);if(!s||s.size<=1)continue;let n=PS(s);if(e.perEntryState.get(or(t,null))?.disabled){S(`WARNING: Skipping disabled ambiguous path-less OCI reference for ${t} in ${i}: multiple path-specific entries exist: +======= Overriding dynamic plugin configuration ${e}`),r.last_modified_level===n)throw new b(`Duplicate plugin configuration for ${t.package} found in ${s}.`);od(t,r,["last_modified_level"]),r.last_modified_level=n}function od(e,t,i){let s=new Set(i);for(let[n,r]of Object.entries(e))s.has(n)||rd(n)||dl(t,n,r)}function ml(e,t){return e===t?!0:typeof e!=typeof t?!1:Array.isArray(e)&&Array.isArray(t)?_S(e,t):$e(e)&&$e(t)?AS(e,t):!1}function _S(e,t){return e.length!==t.length?!1:e.every((i,s)=>ml(i,t[s]))}function AS(e,t){let i=Object.keys(e);return i.length!==Object.keys(t).length?!1:i.every(s=>ml(e[s],t[s]))}function ar(e,t){return`${e} ${t??""}`}function NS(e,t,i){if(!i)throw new b(`oci package '${e}' is not in the expected format '${D}:' or '${D}@:' (optionally followed by '!') in ${t} where may include a port (e.g. host:5000/path) and is one of ${at.join(", ")}`);S(`WARNING: Skipping disabled OCI plugin with invalid format: '${e}' in ${t}. Expected format: '${D}:' or '${D}@:' (optionally followed by '!') where may include a port (e.g. host:5000/path) and is one of ${at.join(", ")}`)}function RS(e,t,i,s,n,r,o){let a=ar(t,i),l=e.perEntryState.get(a);if(!l)return e.perEntryState.set(a,{disabled:n,level:s}),!0;if(l.level===s){let c=i?`!${i}`:"";if(!n)throw new b(`Duplicate OCI plugin configuration for ${t}${c} found at the same level in ${o}: ${r}`);return S(`WARNING: Skipping duplicate disabled OCI plugin configuration for ${t}${c} in ${o}`),!1}return s>l.level&&e.perEntryState.set(a,{disabled:n,level:s}),!0}function PS(e,t,i,s){if(!i){e.pathlessRegistries.set(t,s);return}let n=e.definedPaths.get(t);n||(n=new Map,e.definedPaths.set(t,n)),n.set(i,s)}function nd(e,t,i,s){let n=t.package;if(typeof n!="string"||!n.startsWith(D))return;let r=De(t,S),o=fl(n);if(!o){NS(n,s,r);return}let{registry:a,path:l}=o;RS(e,a,l,i,r,n,s)&&PS(e,a,l,s)}function IS(e){return[...e.entries()].sort(([t],[i])=>t.localeCompare(i)).map(([t,i])=>`${t} (in ${i})`).join(` + - `)}function TS(e){for(let[t,i]of e.pathlessRegistries){let s=e.definedPaths.get(t);if(!s||s.size<=1)continue;let n=IS(s);if(e.perEntryState.get(ar(t,null))?.disabled){S(`WARNING: Skipping disabled ambiguous path-less OCI reference for ${t} in ${i}: multiple path-specific entries exist: - ${n} Cannot use path-less syntax for multi-plugin images. Please specify a ! suffix for the plugin`);continue}throw new b(`Ambiguous path-less OCI reference for ${t} in ${i}: multiple path-specific entries exist: - ${n} -Cannot use path-less syntax for multi-plugin images. Please specify a ! suffix for the plugin.`)}}function TS(e,t){let i=e.perEntryState.get(or(t,null));if(!i)return!1;let s=e.definedPaths.get(t);if(s?.size!==1)return i.disabled;let[n]=s.keys();if(n===void 0)return i.disabled;let r=e.perEntryState.get(or(t,n));return r&&r.level>i.level?r.disabled:i.disabled}function LS(e){let t=new Set;for(let i of e.pathlessRegistries.keys())TS(e,i)&&t.add(i);return t}function od(e,t,i){let s={perEntryState:new Map,pathlessRegistries:new Map,definedPaths:new Map};for(let[n,r]of e)for(let o of r)sd(s,o,0,n);for(let n of t)sd(s,n,1,i);return IS(s),LS(s)}function ml(e,t){let i=[];for(let s of e){let n=s.package;if(typeof n=="string"&&n.startsWith(D)){let r=ul(n);if(r&&t.has(r.registry)){S(` -======= Disabling OCI plugin ${n}`);continue}if(!r&&s.disabled===!0){S(` -======= Disabling OCI plugin ${n}`);continue}}i.push(s)}return i}var ad=require("node:crypto"),$e=require("node:fs"),ni=O(require("node:path"));function ld(e){let t={};for(let[s,n]of Object.entries(e))s==="pluginConfig"||s==="version"||s==="plugin_hash"||(t[s]=n);e.package.startsWith("./")&&(t._local_package_info=CS(e.package));let i=yl(t);return(0,ad.createHash)("sha256").update(i).digest("hex")}function CS(e){let t=ni.isAbsolute(e)?e:ni.join(process.cwd(),e.slice(2)),i=ni.join(t,"package.json");if(!(0,$e.existsSync)(i))try{return{_directory_mtime:gl((0,$e.statSync)(t).mtimeMs)}}catch{return{_not_found:!0}}try{let s={_package_json:JSON.parse((0,$e.readFileSync)(i,"utf8")),_package_json_mtime:gl((0,$e.statSync)(i).mtimeMs)};for(let n of["package-lock.json","yarn.lock"]){let r=ni.join(t,n);(0,$e.existsSync)(r)&&(s[`_${n}_mtime`]=gl((0,$e.statSync)(r).mtimeMs))}return s}catch(s){return{_error:s.message}}}function gl(e){return e/1e3}function MS(e,t){return et?1:0}function yl(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(yl).join(", ")}]`;let t=e;return`{${Object.keys(t).sort(MS).map(s=>`${JSON.stringify(s)}: ${yl(t[s])}`).join(", ")}}`}var ud=require("node:child_process");var lr=require("node:fs"),cd=O(require("node:path"));function hd(e){let t=process.env.PATH??"",i=process.platform==="win32"?";":":",s=process.platform==="win32"?(process.env.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";"):[""];for(let n of t.split(i))if(n)for(let r of s){let o=cd.join(n,e+r);try{return(0,lr.accessSync)(o,lr.constants.X_OK),o}catch{}}return null}var cr=class{path;inspectRawCache=new Map;inspectCache=new Map;existsCache=new Map;constructor(t){let i=t??hd("skopeo");if(!i)throw new b("skopeo not found in PATH");this.path=i}async copy(t,i){await us([this.path,"copy","--override-os=linux","--override-arch=amd64",t,i],`skopeo copy failed: ${t}`)}async inspectRaw(t){let i=this.inspectRawCache.get(t);if(i)return i;let s=this.runInspect(t,!0);this.inspectRawCache.set(t,s);try{return await s}catch(n){throw this.inspectRawCache.delete(t),n}}async inspect(t){let i=this.inspectCache.get(t);if(i)return i;let s=this.runInspect(t,!1);this.inspectCache.set(t,s);try{return await s}catch(n){throw this.inspectCache.delete(t),n}}async exists(t){let i=this.existsCache.get(t);if(i)return i;let s=new Promise(n=>{let r=(0,ud.spawn)(this.path,["inspect","--no-tags",t],{stdio:"ignore"});r.on("error",()=>n(!1)),r.on("close",o=>n(o===0))});return this.existsCache.set(t,s),s}async runInspect(t,i){let s=["inspect","--no-tags",t];i&&s.splice(1,0,"--raw");let{stdout:n}=await us([this.path,...s],`skopeo inspect failed: ${t}`);return JSON.parse(n)}};var dd="dynamic-plugins.yaml";async function DS(){let[e]=process.argv.slice(2);e||(process.stderr.write(`Usage: install-dynamic-plugins -`),process.exit(1));let t=K.resolve(e),i=K.join(t,kf);Qf(i),await X.mkdir(t,{recursive:!0}),await Zf(i);let s=0;try{s=await $S(t)}finally{await If(t).catch(()=>{}),await Xf(i).catch(()=>{})}process.exit(s)}async function $S(e){let t=new cr,i=Lf();S(`======= Workers: ${i} (CPUs: ${ps.cpus().length})`);let s=K.resolve(dd),n=K.dirname(s),r=K.join(e,ol);S(`======= Config file: ${s}`);let o=process.env.CATALOG_ENTITIES_EXTRACT_DIR??K.join(ps.tmpdir(),"extensions"),a=await xS(t,e,o);await qS(t,o);let l=await BS(s,r);if(!l)return 0;let c=new sr(t,await X.mkdtemp(K.join(ps.tmpdir(),"rhdh-oci-cache-"))),h=await FS(l,s,n,a,c),u=await JS(e),f={dynamicPlugins:{rootDirectory:"dynamic-plugins-root"}},{oci:p,npm:g,skipped:d}=KS(h);US(d,f);let m=(process.env.SKIP_INTEGRITY_CHECK??"").toLowerCase()==="true",w=[];return await zS(p,e,c,u,i,f,w),await YS(g,e,m,u,f,w),pd(w,r,f,e,u)}async function xS(e,t,i){let s=process.env.CATALOG_INDEX_IMAGE??"";return s?_f(e,s,t,i):null}async function qS(e,t){let i=process.env.EXTRA_CATALOG_INDEX_IMAGES??"";if(!i)return;let s=K.join(t,"extra"),n=new Map;for(let[r,o]of Rf(i)){let a=n.get(r)??null;n.set(r,o),await Nf(e,o,r,s,a)}}async function BS(e,t){if(!await be(e))return S(`No ${dd} found at ${e}. Skipping.`),await X.writeFile(t,""),null;let i=await X.readFile(e,"utf8"),s=(0,ms.parse)(i);return s||(S(`${e} is empty. Skipping.`),await X.writeFile(t,""),null)}async function FS(e,t,i,s,n){let r={},o=jS(e.includes??[],i,s),a=[];for(let h of o){if(!await be(h)){S(`WARNING: include file ${h} not found, skipping`);continue}S(` -======= Including plugins from ${h}`);let u=(0,ms.parse)(await X.readFile(h,"utf8"));if(u&&!De(u))throw new b(`${h} must contain a mapping`);let f=u?.plugins??[];if(!Array.isArray(f))throw new b(`${h} must contain a 'plugins' list (got ${typeof f})`);a.push([h,f])}let l=e.plugins??[],c=od(a,l,t);for(let[h,u]of a)for(let f of ml(u,c))await dl(f,r,h,0,n);for(let h of ml(l,c))await dl(h,r,t,1,n);for(let h of Object.values(r))h.plugin_hash=ld(h);return r}function jS(e,t,i){let s=e.map(n=>K.isAbsolute(n)?n:K.resolve(t,n));if(i){let n=s.findIndex(r=>K.basename(r)===Xn);n!==-1&&(s[n]=i)}return s}async function pd(e,t,i,s,n){if(e.length>0){S(` +Cannot use path-less syntax for multi-plugin images. Please specify a ! suffix for the plugin.`)}}function LS(e,t){let i=e.perEntryState.get(ar(t,null));if(!i)return!1;let s=e.definedPaths.get(t);if(s?.size!==1)return i.disabled;let[n]=s.keys();if(n===void 0)return i.disabled;let r=e.perEntryState.get(ar(t,n));return r&&r.level>i.level?r.disabled:i.disabled}function CS(e){let t=new Set;for(let i of e.pathlessRegistries.keys())LS(e,i)&&t.add(i);return t}function ad(e,t,i){let s={perEntryState:new Map,pathlessRegistries:new Map,definedPaths:new Map};for(let[n,r]of e)for(let o of r)nd(s,o,0,n);for(let n of t)nd(s,n,1,i);return TS(s),CS(s)}function gl(e,t){let i=[];for(let s of e){let n=s.package;if(typeof n=="string"&&n.startsWith(D)){let r=fl(n);if(r&&t.has(r.registry)){S(` +======= Disabling OCI plugin ${n}`);continue}if(!r&&De(s)){S(` +======= Disabling OCI plugin ${n}`);continue}}i.push(s)}return i}var ld=require("node:crypto"),xe=require("node:fs"),ri=O(require("node:path"));function cd(e){let t={};for(let[s,n]of Object.entries(e))s==="pluginConfig"||s==="version"||s==="plugin_hash"||(t[s]=n);e.package.startsWith("./")&&(t._local_package_info=MS(e.package));let i=bl(t);return(0,ld.createHash)("sha256").update(i).digest("hex")}function MS(e){let t=ri.isAbsolute(e)?e:ri.join(process.cwd(),e.slice(2)),i=ri.join(t,"package.json");if(!(0,xe.existsSync)(i))try{return{_directory_mtime:yl((0,xe.statSync)(t).mtimeMs)}}catch{return{_not_found:!0}}try{let s={_package_json:JSON.parse((0,xe.readFileSync)(i,"utf8")),_package_json_mtime:yl((0,xe.statSync)(i).mtimeMs)};for(let n of["package-lock.json","yarn.lock"]){let r=ri.join(t,n);(0,xe.existsSync)(r)&&(s[`_${n}_mtime`]=yl((0,xe.statSync)(r).mtimeMs))}return s}catch(s){return{_error:s.message}}}function yl(e){return e/1e3}function DS(e,t){return et?1:0}function bl(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(bl).join(", ")}]`;let t=e;return`{${Object.keys(t).sort(DS).map(s=>`${JSON.stringify(s)}: ${bl(t[s])}`).join(", ")}}`}var fd=require("node:child_process");var cr=require("node:fs"),hd=O(require("node:path"));function ud(e){let t=process.env.PATH??"",i=process.platform==="win32"?";":":",s=process.platform==="win32"?(process.env.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";"):[""];for(let n of t.split(i))if(n)for(let r of s){let o=hd.join(n,e+r);try{return(0,cr.accessSync)(o,cr.constants.X_OK),o}catch{}}return null}var hr=class{path;inspectRawCache=new Map;inspectCache=new Map;existsCache=new Map;constructor(t){let i=t??ud("skopeo");if(!i)throw new b("skopeo not found in PATH");this.path=i}async copy(t,i){await fs([this.path,"copy","--override-os=linux","--override-arch=amd64",t,i],`skopeo copy failed: ${t}`)}async inspectRaw(t){let i=this.inspectRawCache.get(t);if(i)return i;let s=this.runInspect(t,!0);this.inspectRawCache.set(t,s);try{return await s}catch(n){throw this.inspectRawCache.delete(t),n}}async inspect(t){let i=this.inspectCache.get(t);if(i)return i;let s=this.runInspect(t,!1);this.inspectCache.set(t,s);try{return await s}catch(n){throw this.inspectCache.delete(t),n}}async exists(t){let i=this.existsCache.get(t);if(i)return i;let s=new Promise(n=>{let r=(0,fd.spawn)(this.path,["inspect","--no-tags",t],{stdio:"ignore"});r.on("error",()=>n(!1)),r.on("close",o=>n(o===0))});return this.existsCache.set(t,s),s}async runInspect(t,i){let s=["inspect","--no-tags",t];i&&s.splice(1,0,"--raw");let{stdout:n}=await fs([this.path,...s],`skopeo inspect failed: ${t}`);return JSON.parse(n)}};var pd="dynamic-plugins.yaml";async function $S(){let[e]=process.argv.slice(2);e||(process.stderr.write(`Usage: install-dynamic-plugins +`),process.exit(1));let t=K.resolve(e),i=K.join(t,Of);ed(i),await X.mkdir(t,{recursive:!0}),await Xf(i);let s=0;try{s=await xS(t)}finally{await Tf(t).catch(()=>{}),await Qf(i).catch(()=>{})}process.exit(s)}async function xS(e){let t=new hr,i=Cf();S(`======= Workers: ${i} (CPUs: ${ms.cpus().length})`);let s=K.resolve(pd),n=K.dirname(s),r=K.join(e,al);S(`======= Config file: ${s}`);let o=process.env.CATALOG_ENTITIES_EXTRACT_DIR??K.join(ms.tmpdir(),"extensions"),a=await qS(t,e,o);await BS(t,o);let l=await FS(s,r);if(!l)return 0;let c=new nr(t,await X.mkdtemp(K.join(ms.tmpdir(),"rhdh-oci-cache-"))),h=await jS(l,s,n,a,c),u=await ZS(e),f={dynamicPlugins:{rootDirectory:"dynamic-plugins-root"}},{oci:p,npm:g,skipped:d}=US(h);zS(d,f);let m=(process.env.SKIP_INTEGRITY_CHECK??"").toLowerCase()==="true",w=[];return await YS(p,e,c,u,i,f,w),await GS(g,e,m,u,f,w),md(w,r,f,e,u)}async function qS(e,t,i){let s=process.env.CATALOG_INDEX_IMAGE??"";return s?Af(e,s,t,i):null}async function BS(e,t){let i=process.env.EXTRA_CATALOG_INDEX_IMAGES??"";if(!i)return;let s=K.join(t,"extra"),n=new Map;for(let[r,o]of Pf(i)){let a=n.get(r)??null;n.set(r,o),await Rf(e,o,r,s,a)}}async function FS(e,t){if(!await be(e))return S(`No ${pd} found at ${e}. Skipping.`),await X.writeFile(t,""),null;let i=await X.readFile(e,"utf8"),s=(0,gs.parse)(i);return s||(S(`${e} is empty. Skipping.`),await X.writeFile(t,""),null)}async function jS(e,t,i,s,n){let r={},o=KS(e.includes??[],i,s),a=[];for(let h of o){if(!await be(h)){S(`WARNING: include file ${h} not found, skipping`);continue}S(` +======= Including plugins from ${h}`);let u=(0,gs.parse)(await X.readFile(h,"utf8"));if(u&&!$e(u))throw new b(`${h} must contain a mapping`);let f=u?.plugins??[];if(!Array.isArray(f))throw new b(`${h} must contain a 'plugins' list (got ${typeof f})`);a.push([h,f])}let l=e.plugins??[],c=ad(a,l,t);for(let[h,u]of a)for(let f of gl(u,c))await pl(f,r,h,0,n);for(let h of gl(l,c))await pl(h,r,t,1,n);for(let h of Object.values(r))h.plugin_hash=cd(h);return r}function KS(e,t,i){let s=e.map(n=>K.isAbsolute(n)?n:K.resolve(t,n));if(i){let n=s.findIndex(r=>K.basename(r)===Qn);n!==-1&&(s[n]=i)}return s}async function md(e,t,i,s,n){if(e.length>0){S(` ======= ${e.length} plugin(s) failed:`);for(let r of e)S(` - ${r}`);return S(` -======= Skipping ${ol} write and cleanup because of install failures. Fix the errors above and re-run; the previous successful state is preserved.`),1}return await X.writeFile(t,(0,ms.stringify)(i)),await VS(s,n),S(` -======= All plugins installed successfully`),0}function KS(e){let t=[],i=[],s=[];for(let n of Object.values(e)){if(n.disabled){S(` -======= Skipping disabled plugin ${n.package}`);continue}if(n.package.startsWith(D)){t.push(n);continue}if(n.package.startsWith("./")){let r=K.join(process.cwd(),n.package.slice(2));(0,fd.existsSync)(r)?i.push(n):s.push(n);continue}i.push(n)}return{oci:t,npm:i,skipped:s}}function US(e,t){if(e.length!==0){S(` -======= Skipping ${e.length} local plugins (directories not found)`);for(let i of e){let s=K.join(process.cwd(),i.package.slice(2));S(` ==> ${i.package} (not found at ${s})`),De(i.pluginConfig)&&ar(i.pluginConfig,t)}}}async function zS(e,t,i,s,n,r,o){await md({plugins:e,workers:n,label:"OCI",installFn:a=>Hf(a,t,i,s),installed:s,globalConfig:r,errors:o})}async function YS(e,t,i,s,n,r){await md({plugins:e,workers:Cf(),label:"NPM",installFn:o=>Gf(o,t,i,s),installed:s,globalConfig:n,errors:r})}async function md(e){let{plugins:t,workers:i,label:s,installFn:n,installed:r,globalConfig:o,errors:a}=e;if(t.length===0)return;let l=GS(t,r,o,a);if(l.length===0)return;let c=i===1?"":"s";S(` -======= Installing ${l.length} ${s} plugin(s) (${i} worker${c})`);let h=await Tf(l,i,async u=>(S(` -======= Installing ${s} plugin ${u.package}`),n(u)));WS(h,o,a)}function GS(e,t,i,s){let n=[];for(let r of e)HS(r,t)?(S(` ==> ${r.package}: already installed, skipping`),t.delete(r.plugin_hash),gd(r.pluginConfig,i,r.package,s)):n.push(r);return n}function WS(e,t,i){for(let s of e){if(!s.ok){i.push(`${s.item.package}: ${s.error.message}`),S(` ==> ERROR: ${s.item.package}: ${s.error.message}`);continue}let{value:n,item:r}=s;gd(n.pluginConfig,t,r.package,i)&&n.pluginPath&&S(` ==> Installed ${r.package}`)}}function gd(e,t,i,s){if(!De(e))return!0;try{return ar(e,t),!0}catch(n){return s.push(`${i}: ${n.message}`),!1}}function HS(e,t){return!e.plugin_hash||!t.has(e.plugin_hash)||e.forceDownload?!1:Qn(e)!==Rt.ALWAYS}async function VS(e,t){for(let[,i]of t){let s=K.join(e,i);S(` -======= Removing obsolete plugin ${i}`),await X.rm(s,{recursive:!0,force:!0})}}async function JS(e){let t=new Map,i;try{i=await X.readdir(e)}catch{return t}for(let s of i){let n=K.join(e,s,ei);try{let r=(await X.readFile(n,"utf8")).trim();r&&t.set(r,s)}catch{}}return t}require.main===module&&DS().catch(e=>{let t=e instanceof b?e.message:String(e);process.stderr.write(` +======= Skipping ${al} write and cleanup because of install failures. Fix the errors above and re-run; the previous successful state is preserved.`),1}return await X.writeFile(t,(0,gs.stringify)(i)),await JS(s,n),S(` +======= All plugins installed successfully`),0}function US(e){let t=[],i=[],s=[];for(let n of Object.values(e)){if(De(n,S)){S(` +======= Skipping disabled plugin ${n.package}`);continue}if(n.package.startsWith(D)){t.push(n);continue}if(n.package.startsWith("./")){let r=K.join(process.cwd(),n.package.slice(2));(0,dd.existsSync)(r)?i.push(n):s.push(n);continue}i.push(n)}return{oci:t,npm:i,skipped:s}}function zS(e,t){if(e.length!==0){S(` +======= Skipping ${e.length} local plugins (directories not found)`);for(let i of e){let s=K.join(process.cwd(),i.package.slice(2));S(` ==> ${i.package} (not found at ${s})`),$e(i.pluginConfig)&&lr(i.pluginConfig,t)}}}async function YS(e,t,i,s,n,r,o){await gd({plugins:e,workers:n,label:"OCI",installFn:a=>Vf(a,t,i,s),installed:s,globalConfig:r,errors:o})}async function GS(e,t,i,s,n,r){await gd({plugins:e,workers:Mf(),label:"NPM",installFn:o=>Wf(o,t,i,s),installed:s,globalConfig:n,errors:r})}async function gd(e){let{plugins:t,workers:i,label:s,installFn:n,installed:r,globalConfig:o,errors:a}=e;if(t.length===0)return;let l=WS(t,r,o,a);if(l.length===0)return;let c=i===1?"":"s";S(` +======= Installing ${l.length} ${s} plugin(s) (${i} worker${c})`);let h=await Lf(l,i,async u=>(S(` +======= Installing ${s} plugin ${u.package}`),n(u)));HS(h,o,a)}function WS(e,t,i,s){let n=[];for(let r of e)VS(r,t)?(S(` ==> ${r.package}: already installed, skipping`),t.delete(r.plugin_hash),yd(r.pluginConfig,i,r.package,s)):n.push(r);return n}function HS(e,t,i){for(let s of e){if(!s.ok){i.push(`${s.item.package}: ${s.error.message}`),S(` ==> ERROR: ${s.item.package}: ${s.error.message}`);continue}let{value:n,item:r}=s;yd(n.pluginConfig,t,r.package,i)&&n.pluginPath&&S(` ==> Installed ${r.package}`)}}function yd(e,t,i,s){if(!$e(e))return!0;try{return lr(e,t),!0}catch(n){return s.push(`${i}: ${n.message}`),!1}}function VS(e,t){return!e.plugin_hash||!t.has(e.plugin_hash)||e.forceDownload?!1:er(e)!==Pt.ALWAYS}async function JS(e,t){for(let[,i]of t){let s=K.join(e,i);S(` +======= Removing obsolete plugin ${i}`),await X.rm(s,{recursive:!0,force:!0})}}async function ZS(e){let t=new Map,i;try{i=await X.readdir(e)}catch{return t}for(let s of i){let n=K.join(e,s,ti);try{let r=(await X.readFile(n,"utf8")).trim();r&&t.set(r,s)}catch{}}return t}require.main===module&&$S().catch(e=>{let t=e instanceof b?e.message:String(e);process.stderr.write(` install-dynamic-plugins failed: ${t} `),process.exit(1)});0&&(module.exports={finalizeInstall}); diff --git a/scripts/install-dynamic-plugins/src/index.ts b/scripts/install-dynamic-plugins/src/index.ts index d895488eb5..c353675b90 100644 --- a/scripts/install-dynamic-plugins/src/index.ts +++ b/scripts/install-dynamic-plugins/src/index.ts @@ -30,6 +30,7 @@ import { type DynamicPluginsConfig, effectivePullPolicy, GLOBAL_CONFIG_FILENAME, + isPluginDisabled, LOCK_FILENAME, OCI_PROTO, type Plugin, @@ -281,7 +282,7 @@ function categorize(allPlugins: PluginMap): Categorized { const npm: Plugin[] = []; const skipped: Plugin[] = []; for (const plugin of Object.values(allPlugins)) { - if (plugin.disabled) { + if (isPluginDisabled(plugin, log)) { log(`\n======= Skipping disabled plugin ${plugin.package}`); continue; } diff --git a/scripts/install-dynamic-plugins/src/installer-npm.ts b/scripts/install-dynamic-plugins/src/installer-npm.ts index 29a535f68e..49ecebe333 100644 --- a/scripts/install-dynamic-plugins/src/installer-npm.ts +++ b/scripts/install-dynamic-plugins/src/installer-npm.ts @@ -5,7 +5,7 @@ import { verifyIntegrity } from './integrity.js'; import { log } from './log.js'; import { run } from './run.js'; import { extractNpmPackage } from './tar-extract.js'; -import { CONFIG_HASH_FILE, type Plugin } from './types.js'; +import { CONFIG_HASH_FILE, isPluginDisabled, type Plugin } from './types.js'; import { markAsFresh } from './util.js'; export type NpmInstallResult = { @@ -30,7 +30,7 @@ export async function installNpmPlugin( skipIntegrity: boolean, installed: Map, ): Promise { - if (plugin.disabled) { + if (isPluginDisabled(plugin, log)) { return { pluginPath: null, pluginConfig: {} }; } const hash = plugin.plugin_hash; diff --git a/scripts/install-dynamic-plugins/src/installer-oci.ts b/scripts/install-dynamic-plugins/src/installer-oci.ts index 66fe5cd19d..f8fb65313c 100644 --- a/scripts/install-dynamic-plugins/src/installer-oci.ts +++ b/scripts/install-dynamic-plugins/src/installer-oci.ts @@ -8,6 +8,7 @@ import { CONFIG_HASH_FILE, effectivePullPolicy, IMAGE_HASH_FILE, + isPluginDisabled, type Plugin, PullPolicy, } from './types.js'; @@ -45,7 +46,7 @@ export async function installOciPlugin( imageCache: OciImageCache, installed: Map, ): Promise { - if (plugin.disabled) { + if (isPluginDisabled(plugin, log)) { return { pluginPath: null, pluginConfig: {} }; } const hash = plugin.plugin_hash; diff --git a/scripts/install-dynamic-plugins/src/merger.ts b/scripts/install-dynamic-plugins/src/merger.ts index d1aae83c57..9de6aaa626 100644 --- a/scripts/install-dynamic-plugins/src/merger.ts +++ b/scripts/install-dynamic-plugins/src/merger.ts @@ -7,6 +7,7 @@ import { npmPluginKey } from './npm-key.js'; import { ociPluginKey, type ParsedOciKey, tryParseOciRegistryAndPath } from './oci-key.js'; import { type DynamicPluginsConfig, + isPluginDisabled, OCI_PROTO, type Plugin, type PluginMap, @@ -378,7 +379,7 @@ function processOciEntry( ): void { const pkg = plugin.package; if (typeof pkg !== 'string' || !pkg.startsWith(OCI_PROTO)) return; - const disabled = plugin.disabled === true; + const disabled = isPluginDisabled(plugin, log); const parsed = tryParseOciRegistryAndPath(pkg); if (!parsed) { logInvalidOciFormat(pkg, sourceFile, disabled); @@ -497,7 +498,7 @@ export function filterDisabledOciPlugins( log(`\n======= Disabling OCI plugin ${pkg}`); continue; } - if (!parsed && plugin.disabled === true) { + if (!parsed && isPluginDisabled(plugin)) { log(`\n======= Disabling OCI plugin ${pkg}`); continue; } diff --git a/scripts/install-dynamic-plugins/src/types.ts b/scripts/install-dynamic-plugins/src/types.ts index 3af6254f2d..f1b3dd7fa0 100644 --- a/scripts/install-dynamic-plugins/src/types.ts +++ b/scripts/install-dynamic-plugins/src/types.ts @@ -11,7 +11,17 @@ export type PullPolicy = (typeof PullPolicy)[keyof typeof PullPolicy]; */ export type PluginSpec = { package: string; + /** + * Recommended: Use `enabled` instead. + * When both `enabled` and `disabled` are present, `enabled` takes precedence. + */ disabled?: boolean; + /** + * Whether the plugin is active. Preferred over `disabled` (positive logic). + * When both `enabled` and `disabled` are present, `enabled` takes precedence + * and a warning is logged. + */ + enabled?: boolean; pullPolicy?: PullPolicy; forceDownload?: boolean; integrity?: string; @@ -86,3 +96,48 @@ export function effectivePullPolicy(plugin: { pullPolicy?: PullPolicy; package: if (plugin.pullPolicy) return plugin.pullPolicy; return plugin.package.includes(LATEST_TAG_MARKER) ? PullPolicy.ALWAYS : PullPolicy.IF_NOT_PRESENT; } + +/** + * Resolve the effective disabled state from the `enabled` and `disabled` + * fields on a plugin spec. Precedence rules (per RHIDP-11983): + * + * 1. When only `enabled` is set → `disabled = !enabled`. + * 2. When only `disabled` is set → use it directly (backward compat). + * 3. When both are set → `enabled` wins and a warning is emitted + * via the optional `warn` callback. + * 4. When neither is set → default to `false` (not disabled). + * + * The `warn` callback receives the warning message string. Pass `log` or + * leave it out for silent resolution (unit tests, hashing). + */ +export function isPluginDisabled( + plugin: { package: string; disabled?: boolean; enabled?: boolean }, + warn?: (msg: string) => void, +): boolean { + const hasEnabled = typeof plugin.enabled === 'boolean'; + const hasDisabled = typeof plugin.disabled === 'boolean'; + + if (plugin.enabled !== undefined && !hasEnabled) { + warn?.( + `WARNING: Plugin ${plugin.package} has non-boolean 'enabled: ${String(plugin.enabled)}'. ` + + `Expected true or false; ignoring the field.`, + ); + } + if (plugin.disabled !== undefined && !hasDisabled) { + warn?.( + `WARNING: Plugin ${plugin.package} has non-boolean 'disabled: ${String(plugin.disabled)}'. ` + + `Expected true or false; ignoring the field.`, + ); + } + + if (hasEnabled && hasDisabled) { + warn?.( + `WARNING: Plugin ${plugin.package} specifies both 'enabled' and 'disabled'. ` + + `The 'enabled' field takes precedence; please use only 'enabled'.`, + ); + return !plugin.enabled; + } + if (hasEnabled) return !plugin.enabled; + if (hasDisabled) return plugin.disabled === true; + return false; +}