faf-cli 7.15.0 → 7.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/cli.js +275 -275
- package/dist/cli.js.map +6 -6
- package/dist/index.js +161 -161
- package/dist/index.js.map +4 -4
- package/dist/interop/cards.d.ts +32 -8
- package/dist/interop/pack.d.ts +32 -1
- package/dist/pack.js +44 -44
- package/dist/pack.js.map +3 -3
- package/package.json +1 -1
- package/project.faf +3 -3
package/dist/interop/cards.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { FafData } from '../core/types.js';
|
|
2
2
|
import { type RenderedResult } from '../core/render-hash.js';
|
|
3
|
-
import { type FafaDoc, type ProjectedA2A } from './pack.js';
|
|
3
|
+
import { type CatalogHost, type FafaDoc, type ProjectedA2A } from './pack.js';
|
|
4
4
|
import { type ServerCardOptions } from './servercard.js';
|
|
5
5
|
/** A2A extension URI — dereference, not the MCP `_meta` key `one.faf/context`. */
|
|
6
6
|
export declare const A2A_CONTEXT_URI = "https://faf.one/ext/context/v1";
|
|
7
7
|
export { A2A_PROTOCOL_BINDING, A2A_PROTOCOL_VERSION, FAF_MEDIA_TYPES, a2aEndpoints, a2aDoors, } from './pack.js';
|
|
8
8
|
export type { FafaAgent, FafaCapability, FafaEndpoint, FafaDoc, ProjectedA2A } from './pack.js';
|
|
9
|
-
export type CardTarget = 'a2a' | 'mcp' | 'registry' | 'catalog';
|
|
9
|
+
export type CardTarget = 'a2a' | 'mcp' | 'registry' | 'catalog' | 'ard';
|
|
10
10
|
export declare const CARD_TARGETS: CardTarget[];
|
|
11
11
|
export interface ProjectCardsOptions extends ServerCardOptions {
|
|
12
12
|
/** Public URL of the emitted A2A card (catalog row). */
|
|
@@ -21,6 +21,9 @@ export interface CatalogEntry {
|
|
|
21
21
|
description?: string;
|
|
22
22
|
url: string;
|
|
23
23
|
updatedAt?: string;
|
|
24
|
+
/** ARD's search hints — on the ARD manifest's rows only. */
|
|
25
|
+
tags?: string[];
|
|
26
|
+
representativeQueries?: string[];
|
|
24
27
|
}
|
|
25
28
|
export interface AiCatalog {
|
|
26
29
|
specVersion: string;
|
|
@@ -38,6 +41,11 @@ export interface ProjectedCards {
|
|
|
38
41
|
_meta: Record<string, unknown>;
|
|
39
42
|
};
|
|
40
43
|
catalog?: CatalogEntry[];
|
|
44
|
+
/** The same rows, carrying ARD's search hints — the ARD manifest. */
|
|
45
|
+
ard?: CatalogEntry[];
|
|
46
|
+
/** Who publishes the catalog — written only into a catalog that names
|
|
47
|
+
* nobody yet. An existing `host` is the site's, and is never touched. */
|
|
48
|
+
catalogHost?: CatalogHost;
|
|
41
49
|
}
|
|
42
50
|
export declare function readFafa(path: string): FafaDoc;
|
|
43
51
|
/** Discover agent.fafa / .fafa (cwd, then one parent). */
|
|
@@ -47,22 +55,38 @@ export declare function findFafaFile(dir?: string): string | null;
|
|
|
47
55
|
export declare function buildA2ACard(fafa: FafaDoc, faf: FafData, opts?: ProjectCardsOptions): ProjectedA2A;
|
|
48
56
|
/** @deprecated Use {@link buildA2ACard}. Removed in the next major. */
|
|
49
57
|
export declare const generateA2ACard: typeof buildA2ACard;
|
|
58
|
+
/**
|
|
59
|
+
* The catalog rows for this agent, keyed exactly as the pack projector keys
|
|
60
|
+
* them: `urn:air:{publisher}:{namespace}:{name}`, where the publisher is the
|
|
61
|
+
* domain the `.fafa` *declares* (`agent.id`'s urn:air, `metadata.cards.domain`,
|
|
62
|
+
* else the homepage host) and the name is the handle — never the display name,
|
|
63
|
+
* which is free text and may carry spaces a URN may not.
|
|
64
|
+
*
|
|
65
|
+
* Throws, rather than inventing either half, when the `.fafa` names no domain:
|
|
66
|
+
* an identifier is a catalog's primary key, and `urn:air:local:…` published to
|
|
67
|
+
* the world is worse than a refusal a line of YAML fixes.
|
|
68
|
+
*/
|
|
50
69
|
export declare function catalogEntriesFor(fafa: FafaDoc, faf: FafData, opts?: ProjectCardsOptions): CatalogEntry[];
|
|
51
70
|
/** Upsert projector entries into an existing catalog. Leaves every other row
|
|
52
71
|
* alone: a row is faf's only when its identifier is exactly faf's (never by
|
|
53
72
|
* type or URL). On match, only url / type / updatedAt move — host copy
|
|
54
|
-
* (title, tags) stays; any other faf row is appended.
|
|
55
|
-
|
|
73
|
+
* (title, tags) stays; any other faf row is appended. `host` names the
|
|
74
|
+
* publisher on a catalog that names none — an existing one is the site's own
|
|
75
|
+
* and stays as it is. */
|
|
76
|
+
export declare function upsertCatalog(existing: AiCatalog | undefined, incoming: CatalogEntry[], host?: CatalogHost): AiCatalog;
|
|
56
77
|
/**
|
|
57
78
|
* {@link upsertCatalog} as a text edit of the catalog's JSON: faf's own rows
|
|
58
79
|
* (identifier exactly faf's) get their url / type / updatedAt values changed
|
|
59
80
|
* in place, faf's other rows are appended after the last entry, and every
|
|
60
81
|
* other byte — your rows, their order and layout, other keys — stays. With no
|
|
61
|
-
* text (no catalog yet) a new catalog is returned.
|
|
62
|
-
*
|
|
63
|
-
*
|
|
82
|
+
* text (no catalog yet) a new catalog is returned. `host` names the publisher
|
|
83
|
+
* (AI Catalog Level 2 "discoverable") and is added, after `specVersion`, only
|
|
84
|
+
* to a catalog that names none: a `host` already in the file is the site's own
|
|
85
|
+
* and is left byte for byte. Throws a JsonEditError, changing nothing, when
|
|
86
|
+
* the catalog cannot be edited that way (not a JSON object, `entries` not an
|
|
87
|
+
* array, faf's row there twice, …).
|
|
64
88
|
*/
|
|
65
|
-
export declare function upsertCatalogText(text: string | null, incoming: CatalogEntry[]): {
|
|
89
|
+
export declare function upsertCatalogText(text: string | null, incoming: CatalogEntry[], host?: CatalogHost): {
|
|
66
90
|
text: string;
|
|
67
91
|
changed: boolean;
|
|
68
92
|
};
|
package/dist/interop/pack.d.ts
CHANGED
|
@@ -148,6 +148,10 @@ export declare function answersToFafa(a: PackAnswers): FafaDoc;
|
|
|
148
148
|
export declare function fafaYaml(fafa: FafaDoc): string;
|
|
149
149
|
/** Where the `.fafa` says it is published: `agent.id` (urn:air), else metadata, else the homepage host. */
|
|
150
150
|
export declare function fafaDomain(fafa: FafaDoc): string;
|
|
151
|
+
/** The stable short name a card is filed under: `agent.name`, lowercased and
|
|
152
|
+
* reduced to the characters an identifier may carry. The `{name}` of
|
|
153
|
+
* `urn:air:{publisher}:{namespace}:{name}` — never a display string. */
|
|
154
|
+
export declare function fafaHandle(fafa: FafaDoc): string;
|
|
151
155
|
/** MCP names are reverse-DNS: example.com + weather → com.example/weather. */
|
|
152
156
|
export declare function mcpName(fafa: FafaDoc): string;
|
|
153
157
|
/** The MCP Server Card for a remote MCP server. */
|
|
@@ -169,12 +173,39 @@ export declare function catalogRows(fafa: FafaDoc, cards: PackCard[], opts?: {
|
|
|
169
173
|
now?: string;
|
|
170
174
|
listFafa?: boolean;
|
|
171
175
|
}): CatalogRow[];
|
|
176
|
+
/** Who publishes a catalog: AI Catalog's `host` object. */
|
|
177
|
+
export interface CatalogHost {
|
|
178
|
+
displayName: string;
|
|
179
|
+
identifier?: string;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The catalog's `host` — who publishes these entries. Naming one is what
|
|
183
|
+
* lifts a catalog from Level 1 "minimal" to Level 2 "discoverable", and
|
|
184
|
+
* `displayName` is the field that does it: the validator takes an empty one
|
|
185
|
+
* as *invalid*, not as minimal. So a `.fafa` that names nobody gets no host
|
|
186
|
+
* at all — a minimal catalog that validates beats a discoverable one that
|
|
187
|
+
* does not. `identifier` rides along whenever the `.fafa` says where it
|
|
188
|
+
* lives, and is left off when it does not.
|
|
189
|
+
*/
|
|
190
|
+
export declare function catalogHost(fafa: FafaDoc): CatalogHost | undefined;
|
|
172
191
|
/** The AI Catalog for the domain: every row above, with the host named. */
|
|
173
192
|
export declare function projectAiCatalog(fafa: FafaDoc, cards: PackCard[], opts?: {
|
|
174
193
|
now?: string;
|
|
175
194
|
listFafa?: boolean;
|
|
176
195
|
}): Record<string, unknown>;
|
|
177
|
-
/**
|
|
196
|
+
/**
|
|
197
|
+
* The search hints ARD reads, from the `.fafa`: `metadata.cards.keywords` and
|
|
198
|
+
* `metadata.cards.examples`. An entry with no `representativeQueries` is, in
|
|
199
|
+
* the conformance CLI's own words, "a valid catalog entry but not a
|
|
200
|
+
* discoverable ARD entry" — the semantic index is built from that term.
|
|
201
|
+
*/
|
|
202
|
+
export declare function ardHints(fafa: FafaDoc): {
|
|
203
|
+
tags?: string[];
|
|
204
|
+
representativeQueries?: string[];
|
|
205
|
+
};
|
|
206
|
+
/** The ARD manifest: the catalog, plus the search hints ARD reads. ARD builds
|
|
207
|
+
* on ai-catalog (spec §4), so the document is the same shape — the entries
|
|
208
|
+
* carry more. */
|
|
178
209
|
export declare function projectArd(fafa: FafaDoc, cards: PackCard[], opts?: {
|
|
179
210
|
now?: string;
|
|
180
211
|
listFafa?: boolean;
|
package/dist/pack.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
var C0=Symbol.for("yaml.alias"),E0=Symbol.for("yaml.document"),x=Symbol.for("yaml.map"),J$=Symbol.for("yaml.pair"),
|
|
2
|
-
`)}}S.defaultYaml={explicit:!1,version:"1.2"};S.defaultTags={"!!":"tag:yaml.org,2002:"};function y0($){if(/[\x00-\x19\s,[\]{}]/.test($)){let
|
|
3
|
-
`)?y(
|
|
1
|
+
var C0=Symbol.for("yaml.alias"),E0=Symbol.for("yaml.document"),x=Symbol.for("yaml.map"),J$=Symbol.for("yaml.pair"),Z0=Symbol.for("yaml.scalar"),r=Symbol.for("yaml.seq"),g=Symbol.for("yaml.node.type"),u=($)=>!!$&&typeof $==="object"&&$[g]===C0,m=($)=>!!$&&typeof $==="object"&&$[g]===E0,v=($)=>!!$&&typeof $==="object"&&$[g]===x,L=($)=>!!$&&typeof $==="object"&&$[g]===J$,O=($)=>!!$&&typeof $==="object"&&$[g]===Z0,d=($)=>!!$&&typeof $==="object"&&$[g]===r;function w($){if($&&typeof $==="object")switch($[g]){case x:case r:return!0}return!1}function D($){if($&&typeof $==="object")switch($[g]){case C0:case x:case Z0:case r:return!0}return!1}var g0=($)=>(O($)||w($))&&!!$.anchor;var f=Symbol("break visit"),f$=Symbol("skip children"),i=Symbol("remove node");function s($,U){let X=y$(U);if(m($)){if(W0(null,$.contents,X,Object.freeze([$]))===i)$.contents=null}else W0(null,$,X,Object.freeze([]))}s.BREAK=f;s.SKIP=f$;s.REMOVE=i;function W0($,U,X,Z){let H=h$($,U,X,Z);if(D(H)||L(H))return k$($,Z,H),W0($,H,X,Z);if(typeof H!=="symbol"){if(w(U)){Z=Object.freeze(Z.concat(U));for(let G=0;G<U.items.length;++G){let z=W0(G,U.items[G],X,Z);if(typeof z==="number")G=z-1;else if(z===f)return f;else if(z===i)U.items.splice(G,1),G-=1}}else if(L(U)){Z=Object.freeze(Z.concat(U));let G=W0("key",U.key,X,Z);if(G===f)return f;else if(G===i)U.key=null;let z=W0("value",U.value,X,Z);if(z===f)return f;else if(z===i)U.value=null}}return H}async function f0($,U){let X=y$(U);if(m($)){if(await T0(null,$.contents,X,Object.freeze([$]))===i)$.contents=null}else await T0(null,$,X,Object.freeze([]))}f0.BREAK=f;f0.SKIP=f$;f0.REMOVE=i;async function T0($,U,X,Z){let H=await h$($,U,X,Z);if(D(H)||L(H))return k$($,Z,H),T0($,H,X,Z);if(typeof H!=="symbol"){if(w(U)){Z=Object.freeze(Z.concat(U));for(let G=0;G<U.items.length;++G){let z=await T0(G,U.items[G],X,Z);if(typeof z==="number")G=z-1;else if(z===f)return f;else if(z===i)U.items.splice(G,1),G-=1}}else if(L(U)){Z=Object.freeze(Z.concat(U));let G=await T0("key",U.key,X,Z);if(G===f)return f;else if(G===i)U.key=null;let z=await T0("value",U.value,X,Z);if(z===f)return f;else if(z===i)U.value=null}}return H}function y$($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function h$($,U,X,Z){if(typeof X==="function")return X($,U,Z);if(v(U))return X.Map?.($,U,Z);if(d(U))return X.Seq?.($,U,Z);if(L(U))return X.Pair?.($,U,Z);if(O(U))return X.Scalar?.($,U,Z);if(u(U))return X.Alias?.($,U,Z);return}function k$($,U,X){let Z=U[U.length-1];if(w(Z))Z.items[$]=X;else if(L(Z))if($==="key")Z.key=X;else Z.value=X;else if(m(Z))Z.contents=X;else{let H=u(Z)?"alias":"scalar";throw Error(`Cannot replace node with ${H} parent`)}}var L2={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},D2=($)=>$.replace(/[!,[\]{}]/g,(U)=>L2[U]);class S{constructor($,U){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},S.defaultYaml,$),this.tags=Object.assign({},S.defaultTags,U)}clone(){let $=new S(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new S(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:S.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},S.defaultTags);break}return $}add($,U){if(this.atNextDocument)this.yaml={explicit:S.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},S.defaultTags),this.atNextDocument=!1;let X=$.trim().split(/[ \t]+/),Z=X.shift();switch(Z){case"%TAG":{if(X.length!==2){if(U(0,"%TAG directive should contain exactly two parts"),X.length<2)return!1}let[H,G]=X;return this.tags[H]=G,!0}case"%YAML":{if(this.yaml.explicit=!0,X.length!==1)return U(0,"%YAML directive should contain exactly one part"),!1;let[H]=X;if(H==="1.1"||H==="1.2")return this.yaml.version=H,!0;else{let G=/^\d+\.\d+$/.test(H);return U(6,`Unsupported YAML version ${H}`,G),!1}}default:return U(0,`Unknown directive ${Z}`,!0),!1}}tagName($,U){if($==="!")return"!";if($[0]!=="!")return U(`Not a valid tag: ${$}`),null;if($[1]==="<"){let G=$.slice(2,-1);if(G==="!"||G==="!!")return U(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")U("Verbatim tags must end with a >");return G}let[,X,Z]=$.match(/^(.*!)([^!]*)$/s);if(!Z)U(`The ${$} tag has no suffix`);let H=this.tags[X];if(H)try{return H+decodeURIComponent(Z)}catch(G){return U(String(G)),null}if(X==="!")return $;return U(`Could not resolve tag: ${$}`),null}tagString($){for(let[U,X]of Object.entries(this.tags))if($.startsWith(X))return U+D2($.substring(X.length));return $[0]==="!"?$:`!<${$}>`}toString($){let U=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],X=Object.entries(this.tags),Z;if($&&X.length>0&&D($.contents)){let H={};s($.contents,(G,z)=>{if(D(z)&&z.tag)H[z.tag]=!0}),Z=Object.keys(H)}else Z=[];for(let[H,G]of X){if(H==="!!"&&G==="tag:yaml.org,2002:")continue;if(!$||Z.some((z)=>z.startsWith(G)))U.push(`%TAG ${H} ${G}`)}return U.join(`
|
|
2
|
+
`)}}S.defaultYaml={explicit:!1,version:"1.2"};S.defaultTags={"!!":"tag:yaml.org,2002:"};function y0($){if(/[\x00-\x19\s,[\]{}]/.test($)){let X=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(X)}return!0}function Q$($){let U=new Set;return s($,{Value(X,Z){if(Z.anchor)U.add(Z.anchor)}}),U}function B$($,U){for(let X=1;;++X){let Z=`${$}${X}`;if(!U.has(Z))return Z}}function x$($,U){let X=[],Z=new Map,H=null;return{onAnchor:(G)=>{X.push(G),H??(H=Q$($));let z=B$(U,H);return H.add(z),z},setAnchors:()=>{for(let G of X){let z=Z.get(G);if(typeof z==="object"&&z.anchor&&(O(z.node)||w(z.node)))z.node.anchor=z.anchor;else{let Q=Error("Failed to resolve repeated object (this should not happen)");throw Q.source=G,Q}}},sourceObjects:Z}}function e($,U,X,Z){if(Z&&typeof Z==="object")if(Array.isArray(Z))for(let H=0,G=Z.length;H<G;++H){let z=Z[H],Q=e($,Z,String(H),z);if(Q===void 0)delete Z[H];else if(Q!==z)Z[H]=Q}else if(Z instanceof Map)for(let H of Array.from(Z.keys())){let G=Z.get(H),z=e($,Z,H,G);if(z===void 0)Z.delete(H);else if(z!==G)Z.set(H,z)}else if(Z instanceof Set)for(let H of Array.from(Z)){let G=e($,Z,H,H);if(G===void 0)Z.delete(H);else if(G!==H)Z.delete(H),Z.add(G)}else for(let[H,G]of Object.entries(Z)){let z=e($,Z,H,G);if(z===void 0)delete Z[H];else if(z!==G)Z[H]=z}return $.call(U,X,Z)}function N($,U,X){if(Array.isArray($))return $.map((Z,H)=>N(Z,String(H),X));if($&&typeof $.toJSON==="function"){if(!X||!g0($))return $.toJSON(U,X);let Z={aliasCount:0,count:1,res:void 0};X.anchors.set($,Z),X.onCreate=(G)=>{Z.res=G,delete X.onCreate};let H=$.toJSON(U,X);if(X.onCreate)X.onCreate(H);return H}if(typeof $==="bigint"&&!X?.keep)return Number($);return $}class H0{constructor($){Object.defineProperty(this,g,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:U,maxAliasCount:X,onAnchor:Z,reviver:H}={}){if(!m($))throw TypeError("A document argument is required");let G={anchors:new Map,doc:$,keep:!0,mapAsMap:U===!0,mapKeyWarned:!1,maxAliasCount:typeof X==="number"?X:100},z=N(this,"",G);if(typeof Z==="function")for(let{count:Q,res:J}of G.anchors.values())Z(J,Q);return typeof H==="function"?e(H,{"":z},"",z):z}}class G0 extends H0{constructor($){super(C0);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,U){if(U?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let X;if(U?.aliasResolveCache)X=U.aliasResolveCache;else if(X=[],s($,{Node:(H,G)=>{if(u(G)||g0(G))X.push(G)}}),U)U.aliasResolveCache=X;let Z=void 0;for(let H of X){if(H===this)break;if(H.anchor===this.source)Z=H}return Z}toJSON($,U){if(!U)return{source:this.source};let{anchors:X,doc:Z,maxAliasCount:H}=U,G=this.resolve(Z,U);if(!G){let Q=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(Q)}let z=X.get(G);if(!z)N(G,null,U),z=X.get(G);if(z?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(H>=0){if(z.count+=1,z.aliasCount===0)z.aliasCount=h0(Z,G,X);if(z.count*z.aliasCount>H)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return z.res}toString($,U,X){let Z=`*${this.source}`;if($){if(y0(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let H=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(H)}if($.implicitKey)return`${Z} `}return Z}}function h0($,U,X){if(u(U)){let Z=U.resolve($),H=X&&Z&&X.get(Z);return H?H.count*H.aliasCount:0}else if(w(U)){let Z=0;for(let H of U.items){let G=h0($,H,X);if(G>Z)Z=G}return Z}else if(L(U)){let Z=h0($,U.key,X),H=h0($,U.value,X);return Math.max(Z,H)}return 1}var k0=($)=>!$||typeof $!=="function"&&typeof $!=="object";class I extends H0{constructor($){super(Z0);this.value=$}toJSON($,U){return U?.keep?this.value:N(this.value,$,U)}toString(){return String(this.value)}}I.BLOCK_FOLDED="BLOCK_FOLDED";I.BLOCK_LITERAL="BLOCK_LITERAL";I.PLAIN="PLAIN";I.QUOTE_DOUBLE="QUOTE_DOUBLE";I.QUOTE_SINGLE="QUOTE_SINGLE";var K2="tag:yaml.org,2002:";function w2($,U,X){if(U){let Z=X.filter((G)=>G.tag===U),H=Z.find((G)=>!G.format)??Z[0];if(!H)throw Error(`Tag ${U} not found`);return H}return X.find((Z)=>Z.identify?.($)&&!Z.format)}function o($,U,X){if(m($))$=$.contents;if(D($))return $;if(L($)){let W=X.schema[x].createNode?.(X.schema,null,X);return W.items.push($),W}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:Z,onAnchor:H,onTagObj:G,schema:z,sourceObjects:Q}=X,J=void 0;if(Z&&$&&typeof $==="object")if(J=Q.get($),J)return J.anchor??(J.anchor=H($)),new G0(J.anchor);else J={anchor:null,node:null},Q.set($,J);if(U?.startsWith("!!"))U=K2+U.slice(2);let B=w2($,U,z.tags);if(!B){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let W=new I($);if(J)J.node=W;return W}B=$ instanceof Map?z[x]:(Symbol.iterator in Object($))?z[r]:z[x]}if(G)G(B),delete X.onTagObj;let F=B?.createNode?B.createNode(X.schema,$,X):typeof B?.nodeClass?.from==="function"?B.nodeClass.from(X.schema,$,X):new I($);if(U)F.tag=U;else if(!B.default)F.tag=B.tag;if(J)J.node=F;return F}function L0($,U,X){let Z=X;for(let H=U.length-1;H>=0;--H){let G=U[H];if(typeof G==="number"&&Number.isInteger(G)&&G>=0){let z=[];z[G]=Z,Z=z}else Z=new Map([[G,Z]])}return o(Z,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var V0=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class D0 extends H0{constructor($,U){super($);Object.defineProperty(this,"schema",{value:U,configurable:!0,enumerable:!1,writable:!0})}clone($){let U=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)U.schema=$;if(U.items=U.items.map((X)=>D(X)||L(X)?X.clone($):X),this.range)U.range=this.range.slice();return U}addIn($,U){if(V0($))this.add(U);else{let[X,...Z]=$,H=this.get(X,!0);if(w(H))H.addIn(Z,U);else if(H===void 0&&this.schema)this.set(X,L0(this.schema,Z,U));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${Z}`)}}deleteIn($){let[U,...X]=$;if(X.length===0)return this.delete(U);let Z=this.get(U,!0);if(w(Z))return Z.deleteIn(X);else throw Error(`Expected YAML collection at ${U}. Remaining path: ${X}`)}getIn($,U){let[X,...Z]=$,H=this.get(X,!0);if(Z.length===0)return!U&&O(H)?H.value:H;else return w(H)?H.getIn(Z,U):void 0}hasAllNullValues($){return this.items.every((U)=>{if(!L(U))return!1;let X=U.value;return X==null||$&&O(X)&&X.value==null&&!X.commentBefore&&!X.comment&&!X.tag})}hasIn($){let[U,...X]=$;if(X.length===0)return this.has(U);let Z=this.get(U,!0);return w(Z)?Z.hasIn(X):!1}setIn($,U){let[X,...Z]=$;if(Z.length===0)this.set(X,U);else{let H=this.get(X,!0);if(w(H))H.setIn(Z,U);else if(H===void 0&&this.schema)this.set(X,L0(this.schema,Z,U));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${Z}`)}}}var u$=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function y($,U){if(/^\n+$/.test($))return $.substring(1);return U?$.replace(/^(?! *$)/gm,U):$}var a=($,U,X)=>$.endsWith(`
|
|
3
|
+
`)?y(X,U):X.includes(`
|
|
4
4
|
`)?`
|
|
5
|
-
`+y(
|
|
6
|
-
`){if(
|
|
5
|
+
`+y(X,U):($.endsWith(" ")?"":" ")+X;var W$="flow",v$="block",d$="quoted";function K0($,U,X="flow",{indentAtStart:Z,lineWidth:H=80,minContentWidth:G=20,onFold:z,onOverflow:Q}={}){if(!H||H<0)return $;if(H<G)G=0;let J=Math.max(1+G,1+H-U.length);if($.length<=J)return $;let B=[],F={},W=H-U.length;if(typeof Z==="number")if(Z>H-Math.max(2,G))B.push(0);else W=H-Z;let V=void 0,R=void 0,_=!1,T=-1,Y=-1,P=-1;if(X==="block"){if(T=m$($,T,U.length),T!==-1)W=T+J}for(let M;M=$[T+=1];){if(X==="quoted"&&M==="\\"){switch(Y=T,$[T+1]){case"x":T+=3;break;case"u":T+=5;break;case"U":T+=9;break;default:T+=1}P=T}if(M===`
|
|
6
|
+
`){if(X==="block")T=m$($,T,U.length);W=T+U.length+J,V=void 0}else{if(M===" "&&R&&R!==" "&&R!==`
|
|
7
7
|
`&&R!=="\t"){let b=$[T+1];if(b&&b!==" "&&b!==`
|
|
8
|
-
`&&b!=="\t")V=T}if(T>=W)if(V)B.push(V),W=V+J,V=void 0;else if(
|
|
9
|
-
${U}${$.slice(0,A)}`;else{if(
|
|
10
|
-
${U}${$.slice(b+1,A)}`}}return K}function
|
|
11
|
-
`);
|
|
12
|
-
`){if(G-z>
|
|
8
|
+
`&&b!=="\t")V=T}if(T>=W)if(V)B.push(V),W=V+J,V=void 0;else if(X==="quoted"){while(R===" "||R==="\t")R=M,M=$[T+=1],_=!0;let b=T>P+1?T-2:Y-1;if(F[b])return $;B.push(b),F[b]=!0,W=b+J,V=void 0}else _=!0}R=M}if(_&&Q)Q();if(B.length===0)return $;if(z)z();let K=$.slice(0,B[0]);for(let M=0;M<B.length;++M){let b=B[M],A=B[M+1]||$.length;if(b===0)K=`
|
|
9
|
+
${U}${$.slice(0,A)}`;else{if(X==="quoted"&&F[b])K+=`${$[b]}\\`;K+=`
|
|
10
|
+
${U}${$.slice(b+1,A)}`}}return K}function m$($,U,X){let Z=U,H=U+1,G=$[H];while(G===" "||G==="\t")if(U<H+X)G=$[++U];else{do G=$[++U];while(G&&G!==`
|
|
11
|
+
`);Z=U,H=U+1,G=$[H]}return Z}var u0=($,U)=>({indentAtStart:U?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),m0=($)=>/^(%|---|\.\.\.)/m.test($);function P2($,U,X){if(!U||U<0)return!1;let Z=U-X,H=$.length;if(H<=Z)return!1;for(let G=0,z=0;G<H;++G)if($[G]===`
|
|
12
|
+
`){if(G-z>Z)return!0;if(z=G+1,H-z<=Z)return!1}return!0}function w0($,U){let X=JSON.stringify($);if(U.options.doubleQuotedAsJSON)return X;let{implicitKey:Z}=U,H=U.options.doubleQuotedMinMultiLineLength,G=U.indent||(m0($)?" ":""),z="",Q=0;for(let J=0,B=X[J];B;B=X[++J]){if(B===" "&&X[J+1]==="\\"&&X[J+2]==="n")z+=X.slice(Q,J)+"\\ ",J+=1,Q=J,B="\\";if(B==="\\")switch(X[J+1]){case"u":{z+=X.slice(Q,J);let F=X.substr(J+2,4);switch(F){case"0000":z+="\\0";break;case"0007":z+="\\a";break;case"000b":z+="\\v";break;case"001b":z+="\\e";break;case"0085":z+="\\N";break;case"00a0":z+="\\_";break;case"2028":z+="\\L";break;case"2029":z+="\\P";break;default:if(F.substr(0,2)==="00")z+="\\x"+F.substr(2);else z+=X.substr(J,6)}J+=5,Q=J+1}break;case"n":if(Z||X[J+2]==='"'||X.length<H)J+=1;else{z+=X.slice(Q,J)+`
|
|
13
13
|
|
|
14
|
-
`;while(
|
|
15
|
-
`,J+=2;if(z+=G,
|
|
16
|
-
`)||/[ \t]\n|\n[ \t]/.test($))return
|
|
17
|
-
${
|
|
14
|
+
`;while(X[J+2]==="\\"&&X[J+3]==="n"&&X[J+4]!=='"')z+=`
|
|
15
|
+
`,J+=2;if(z+=G,X[J+2]===" ")z+="\\";J+=1,Q=J+1}break;default:J+=1}}return z=Q?z+X.slice(Q):X,Z?z:K0(z,G,d$,u0(U,!1))}function T$($,U){if(U.options.singleQuote===!1||U.implicitKey&&$.includes(`
|
|
16
|
+
`)||/[ \t]\n|\n[ \t]/.test($))return w0($,U);let X=U.indent||(m0($)?" ":""),Z="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
17
|
+
${X}`)+"'";return U.implicitKey?Z:K0(Z,X,W$,u0(U,!1))}function q0($,U){let{singleQuote:X}=U.options,Z;if(X===!1)Z=w0;else{let H=$.includes('"'),G=$.includes("'");if(H&&!G)Z=T$;else if(G&&!H)Z=w0;else Z=X?T$:w0}return Z($,U)}var V$;try{V$=new RegExp(`(^|(?<!
|
|
18
18
|
))
|
|
19
19
|
+(?!
|
|
20
|
-
|$)`,"g")}catch{V$=/\n+(?!\n|$)/g}function x0({comment:$,type:U,value:
|
|
20
|
+
|$)`,"g")}catch{V$=/\n+(?!\n|$)/g}function x0({comment:$,type:U,value:X},Z,H,G){let{blockQuote:z,commentString:Q,lineWidth:J}=Z.options;if(!z||/\n[\t ]+$/.test(X))return q0(X,Z);let B=Z.indent||(Z.forceBlockIndent||m0(X)?" ":""),F=z==="literal"?!0:z==="folded"||U===I.BLOCK_FOLDED?!1:U===I.BLOCK_LITERAL?!0:!P2(X,J,B.length);if(!X)return F?`|
|
|
21
21
|
`:`>
|
|
22
|
-
`;let W,V;for(V=
|
|
23
|
-
`&&A!=="\t"&&A!==" ")break}let R=
|
|
24
|
-
`);if(_===-1)W="-";else if(
|
|
25
|
-
`)R=R.slice(0,-1);R=R.replace(V$,`$&${B}`)}let T=!1,Y,
|
|
26
|
-
`)
|
|
27
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${B}`),k=!1,n=u0(
|
|
28
|
-
${B}${O0}`}return
|
|
29
|
-
${B}${K}${
|
|
22
|
+
`;let W,V;for(V=X.length;V>0;--V){let A=X[V-1];if(A!==`
|
|
23
|
+
`&&A!=="\t"&&A!==" ")break}let R=X.substring(V),_=R.indexOf(`
|
|
24
|
+
`);if(_===-1)W="-";else if(X===R||_!==R.length-1){if(W="+",G)G()}else W="";if(R){if(X=X.slice(0,-R.length),R[R.length-1]===`
|
|
25
|
+
`)R=R.slice(0,-1);R=R.replace(V$,`$&${B}`)}let T=!1,Y,P=-1;for(Y=0;Y<X.length;++Y){let A=X[Y];if(A===" ")T=!0;else if(A===`
|
|
26
|
+
`)P=Y;else break}let K=X.substring(0,P<Y?P+1:Y);if(K)X=X.substring(K.length),K=K.replace(/\n+/g,`$&${B}`);let b=(T?B?"2":"1":"")+W;if($){if(b+=" "+Q($.replace(/ ?[\r\n]+/g," ")),H)H()}if(!F){let A=X.replace(/\n+/g,`
|
|
27
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${B}`),k=!1,n=u0(Z,!0);if(z!=="folded"&&U!==I.BLOCK_FOLDED)n.onOverflow=()=>{k=!0};let O0=K0(`${K}${A}${R}`,B,v$,n);if(!k)return`>${b}
|
|
28
|
+
${B}${O0}`}return X=X.replace(/\n+/g,`$&${B}`),`|${b}
|
|
29
|
+
${B}${K}${X}${R}`}function M2($,U,X,Z){let{type:H,value:G}=$,{actualString:z,implicitKey:Q,indent:J,indentStep:B,inFlow:F}=U;if(Q&&G.includes(`
|
|
30
30
|
`)||F&&/[[\]{},]/.test(G))return q0(G,U);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(G))return Q||F||!G.includes(`
|
|
31
|
-
`)?q0(G,U):x0($,U,
|
|
32
|
-
`))return x0($,U,
|
|
33
|
-
${J}`);if(z){let V=(T)=>T.default&&T.tag!=="tag:yaml.org,2002:str"&&T.test?.test(W),{compat:R,tags:_}=U.doc.schema;if(_.some(V)||R?.some(V))return q0(G,U)}return Q?W:K0(W,J,W$,u0(U,!1))}function z0($,U,
|
|
34
|
-
${U.indent}${Q}`}function
|
|
35
|
-
${Q}:`}else if(Y=`${Y}:`,V)Y+=a(Y,
|
|
31
|
+
`)?q0(G,U):x0($,U,X,Z);if(!Q&&!F&&H!==I.PLAIN&&G.includes(`
|
|
32
|
+
`))return x0($,U,X,Z);if(m0(G)){if(J==="")return U.forceBlockIndent=!0,x0($,U,X,Z);else if(Q&&J===B)return q0(G,U)}let W=G.replace(/\n+/g,`$&
|
|
33
|
+
${J}`);if(z){let V=(T)=>T.default&&T.tag!=="tag:yaml.org,2002:str"&&T.test?.test(W),{compat:R,tags:_}=U.doc.schema;if(_.some(V)||R?.some(V))return q0(G,U)}return Q?W:K0(W,J,W$,u0(U,!1))}function z0($,U,X,Z){let{implicitKey:H,inFlow:G}=U,z=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:Q}=$;if(Q!==I.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(z.value))Q=I.QUOTE_DOUBLE}let J=(F)=>{switch(F){case I.BLOCK_FOLDED:case I.BLOCK_LITERAL:return H||G?q0(z.value,U):x0(z,U,X,Z);case I.QUOTE_DOUBLE:return w0(z.value,U);case I.QUOTE_SINGLE:return T$(z.value,U);case I.PLAIN:return M2(z,U,X,Z);default:return null}},B=J(Q);if(B===null){let{defaultKeyType:F,defaultStringType:W}=U.options,V=H&&F||W;if(B=J(V),B===null)throw Error(`Unsupported default string type ${V}`)}return B}function v0($,U){let X=Object.assign({blockQuote:!0,commentString:u$,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},$.schema.toStringOptions,U),Z;switch(X.collectionStyle){case"block":Z=!1;break;case"flow":Z=!0;break;default:Z=null}return{anchors:new Set,doc:$,flowCollectionPadding:X.flowCollectionPadding?" ":"",indent:"",indentStep:typeof X.indent==="number"?" ".repeat(X.indent):" ",inFlow:Z,options:X}}function b2($,U){if(U.tag){let H=$.filter((G)=>G.tag===U.tag);if(H.length>0)return H.find((G)=>G.format===U.format)??H[0]}let X=void 0,Z;if(O(U)){Z=U.value;let H=$.filter((G)=>G.identify?.(Z));if(H.length>1){let G=H.filter((z)=>z.test);if(G.length>0)H=G}X=H.find((G)=>G.format===U.format)??H.find((G)=>!G.format)}else Z=U,X=$.find((H)=>H.nodeClass&&Z instanceof H.nodeClass);if(!X){let H=Z?.constructor?.name??(Z===null?"null":typeof Z);throw Error(`Tag not resolved for ${H} value`)}return X}function A2($,U,{anchors:X,doc:Z}){if(!Z.directives)return"";let H=[],G=(O($)||w($))&&$.anchor;if(G&&y0(G))X.add(G),H.push(`&${G}`);let z=$.tag??(U.default?null:U.tag);if(z)H.push(Z.directives.tagString(z));return H.join(" ")}function t($,U,X,Z){if(L($))return $.toString(U,X,Z);if(u($)){if(U.doc.directives)return $.toString(U);if(U.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(U.resolvedAliases)U.resolvedAliases.add($);else U.resolvedAliases=new Set([$]);$=$.resolve(U.doc)}}let H=void 0,G=D($)?$:U.doc.createNode($,{onTagObj:(J)=>H=J});H??(H=b2(U.doc.schema.tags,G));let z=A2(G,H,U);if(z.length>0)U.indentAtStart=(U.indentAtStart??0)+z.length+1;let Q=typeof H.stringify==="function"?H.stringify(G,U,X,Z):O(G)?z0(G,U,X,Z):G.toString(U,X,Z);if(!z)return Q;return O(G)||Q[0]==="{"||Q[0]==="["?`${z} ${Q}`:`${z}
|
|
34
|
+
${U.indent}${Q}`}function p$({key:$,value:U},X,Z,H){let{allNullValues:G,doc:z,indent:Q,indentStep:J,options:{commentString:B,indentSeq:F,simpleKeys:W}}=X,V=D($)&&$.comment||null;if(W){if(V)throw Error("With simple keys, key nodes cannot have comments");if(w($)||!D($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let R=!W&&(!$||V&&U==null&&!X.inFlow||w($)||(O($)?$.type===I.BLOCK_FOLDED||$.type===I.BLOCK_LITERAL:typeof $==="object"));X=Object.assign({},X,{allNullValues:!1,implicitKey:!R&&(W||!G),indent:Q+J});let _=!1,T=!1,Y=t($,X,()=>_=!0,()=>T=!0);if(!R&&!X.inFlow&&Y.length>1024){if(W)throw Error("With simple keys, single line scalar must not span more than 1024 characters");R=!0}if(X.inFlow){if(G||U==null){if(_&&Z)Z();return Y===""?"?":R?`? ${Y}`:Y}}else if(G&&!W||U==null&&R){if(Y=`? ${Y}`,V&&!_)Y+=a(Y,X.indent,B(V));else if(T&&H)H();return Y}if(_)V=null;if(R){if(V)Y+=a(Y,X.indent,B(V));Y=`? ${Y}
|
|
35
|
+
${Q}:`}else if(Y=`${Y}:`,V)Y+=a(Y,X.indent,B(V));let P,K,M;if(D(U))P=!!U.spaceBefore,K=U.commentBefore,M=U.comment;else if(P=!1,K=null,M=null,U&&typeof U==="object")U=z.createNode(U);if(X.implicitKey=!1,!R&&!V&&O(U))X.indentAtStart=Y.length+1;if(T=!1,!F&&J.length>=2&&!X.inFlow&&!R&&d(U)&&!U.flow&&!U.tag&&!U.anchor)X.indent=X.indent.substring(2);let b=!1,A=t(U,X,()=>b=!0,()=>T=!0),k=" ";if(V||P||K){if(k=P?`
|
|
36
36
|
`:"",K){let n=B(K);k+=`
|
|
37
|
-
${y(n,
|
|
37
|
+
${y(n,X.indent)}`}if(A===""&&!X.inFlow){if(k===`
|
|
38
38
|
`&&M)k=`
|
|
39
39
|
|
|
40
40
|
`}else k+=`
|
|
41
|
-
${
|
|
42
|
-
`),
|
|
43
|
-
${
|
|
44
|
-
`)k="";if(Y+=k+A,
|
|
41
|
+
${X.indent}`}else if(!R&&w(U)){let n=A[0],O0=A.indexOf(`
|
|
42
|
+
`),E$=O0!==-1,O2=X.inFlow??U.flow??U.items.length===0;if(E$||!O2){let g$=!1;if(E$&&(n==="&"||n==="!")){let X0=A.indexOf(" ");if(n==="&"&&X0!==-1&&X0<O0&&A[X0+1]==="!")X0=A.indexOf(" ",X0+1);if(X0===-1||O0<X0)g$=!0}if(!g$)k=`
|
|
43
|
+
${X.indent}`}}else if(A===""||A[0]===`
|
|
44
|
+
`)k="";if(Y+=k+A,X.inFlow){if(b&&Z)Z()}else if(M&&!b)Y+=a(Y,X.indent,B(M));else if(T&&H)H();return Y}function q$($,U){if($==="debug"||$==="warn")console.warn(U)}var d0="<<",p={identify:($)=>$===d0||typeof $==="symbol"&&$.description===d0,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new I(Symbol(d0)),{addToJSMap:I$}),stringify:()=>d0},l$=($,U)=>(p.identify(U)||O(U)&&(!U.type||U.type===I.PLAIN)&&p.identify(U.value))&&$?.doc.schema.tags.some((X)=>X.tag===p.tag&&X.default);function I$($,U,X){let Z=c$($,X);if(d(Z))for(let H of Z.items)Y$($,U,H);else if(Array.isArray(Z))for(let H of Z)Y$($,U,H);else Y$($,U,Z)}function Y$($,U,X){let Z=c$($,X);if(!v(Z))throw Error("Merge sources must be maps or map aliases");let H=Z.toJSON(null,$,Map);for(let[G,z]of H)if(U instanceof Map){if(!U.has(G))U.set(G,z)}else if(U instanceof Set)U.add(G);else if(!Object.prototype.hasOwnProperty.call(U,G))Object.defineProperty(U,G,{value:z,writable:!0,enumerable:!0,configurable:!0});return U}function c$($,U){return $&&u(U)?U.resolve($.doc,$):U}function p0($,U,{key:X,value:Z}){if(D(X)&&X.addToJSMap)X.addToJSMap($,U,Z);else if(l$($,X))I$($,U,Z);else{let H=N(X,"",$);if(U instanceof Map)U.set(H,N(Z,H,$));else if(U instanceof Set)U.add(H);else{let G=N2(X,H,$),z=N(Z,G,$);if(G in U)Object.defineProperty(U,G,{value:z,writable:!0,enumerable:!0,configurable:!0});else U[G]=z}}return U}function N2($,U,X){if(U===null)return"";if(typeof U!=="object")return String(U);if(D($)&&X?.doc){let Z=v0(X.doc,{});Z.anchors=new Set;for(let G of X.anchors.keys())Z.anchors.add(G.anchor);Z.inFlow=!0,Z.inStringifyKey=!0;let H=$.toString(Z);if(!X.mapKeyWarned){let G=JSON.stringify(H);if(G.length>40)G=G.substring(0,36)+'..."';q$(X.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${G}. Set mapAsMap: true to use object keys.`),X.mapKeyWarned=!0}return H}return JSON.stringify(U)}function Y0($,U,X){let Z=o($,void 0,X),H=o(U,void 0,X);return new j(Z,H)}class j{constructor($,U=null){Object.defineProperty(this,g,{value:J$}),this.key=$,this.value=U}clone($){let{key:U,value:X}=this;if(D(U))U=U.clone($);if(D(X))X=X.clone($);return new j(U,X)}toJSON($,U){let X=U?.mapAsMap?new Map:{};return p0(U,X,this)}toString($,U,X){return $?.doc?p$(this,$,U,X):JSON.stringify(this)}}function c0($,U,X){return(U.inFlow??$.flow?S2:j2)($,U,X)}function j2({comment:$,items:U},X,{blockItemPrefix:Z,flowChars:H,itemIndent:G,onChompKeep:z,onComment:Q}){let{indent:J,options:{commentString:B}}=X,F=Object.assign({},X,{indent:G,type:null}),W=!1,V=[];for(let _=0;_<U.length;++_){let T=U[_],Y=null;if(D(T)){if(!W&&T.spaceBefore)V.push("");if(l0(X,V,T.commentBefore,W),T.comment)Y=T.comment}else if(L(T)){let K=D(T.key)?T.key:null;if(K){if(!W&&K.spaceBefore)V.push("");l0(X,V,K.commentBefore,W)}}W=!1;let P=t(T,F,()=>Y=null,()=>W=!0);if(Y)P+=a(P,G,B(Y));if(W&&Y)W=!1;V.push(Z+P)}let R;if(V.length===0)R=H.start+H.end;else{R=V[0];for(let _=1;_<V.length;++_){let T=V[_];R+=T?`
|
|
45
45
|
${J}${T}`:`
|
|
46
46
|
`}}if($){if(R+=`
|
|
47
|
-
`+y(B($),J),Q)Q()}else if(W&&z)z();return R}function
|
|
48
|
-
`)),_<$.length-1)
|
|
49
|
-
${G}${
|
|
47
|
+
`+y(B($),J),Q)Q()}else if(W&&z)z();return R}function S2({items:$},U,{flowChars:X,itemIndent:Z}){let{indent:H,indentStep:G,flowCollectionPadding:z,options:{commentString:Q}}=U;Z+=G;let J=Object.assign({},U,{indent:Z,inFlow:!0,type:null}),B=!1,F=0,W=[];for(let _=0;_<$.length;++_){let T=$[_],Y=null;if(D(T)){if(T.spaceBefore)W.push("");if(l0(U,W,T.commentBefore,!1),T.comment)Y=T.comment}else if(L(T)){let K=D(T.key)?T.key:null;if(K){if(K.spaceBefore)W.push("");if(l0(U,W,K.commentBefore,!1),K.comment)B=!0}let M=D(T.value)?T.value:null;if(M){if(M.comment)Y=M.comment;if(M.commentBefore)B=!0}else if(T.value==null&&K?.comment)Y=K.comment}if(Y)B=!0;let P=t(T,J,()=>Y=null);if(B||(B=W.length>F||P.includes(`
|
|
48
|
+
`)),_<$.length-1)P+=",";else if(U.options.trailingComma){if(U.options.lineWidth>0)B||(B=W.reduce((K,M)=>K+M.length+2,2)+(P.length+2)>U.options.lineWidth);if(B)P+=","}if(Y)P+=a(P,Z,Q(Y));W.push(P),F=W.length}let{start:V,end:R}=X;if(W.length===0)return V+R;else{if(!B){let _=W.reduce((T,Y)=>T+Y.length+2,2);B=U.options.lineWidth>0&&_>U.options.lineWidth}if(B){let _=V;for(let T of W)_+=T?`
|
|
49
|
+
${G}${H}${T}`:`
|
|
50
50
|
`;return`${_}
|
|
51
|
-
${
|
|
52
|
-
`:" ")}return z0({comment:$,type:U,value:Q},
|
|
53
|
-
${
|
|
54
|
-
${G.comment}`:
|
|
55
|
-
`))
|
|
51
|
+
${H}${R}`}else return`${V}${z}${W.join(" ")}${z}${R}`}}function l0({indent:$,options:{commentString:U}},X,Z,H){if(Z&&H)Z=Z.replace(/^\n+/,"");if(Z){let G=y(U(Z),$);X.push(G.trimStart())}}function $0($,U){let X=O(U)?U.value:U;for(let Z of $)if(L(Z)){if(Z.key===U||Z.key===X)return Z;if(O(Z.key)&&Z.key.value===X)return Z}return}class C extends D0{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(x,$);this.items=[]}static from($,U,X){let{keepUndefined:Z,replacer:H}=X,G=new this($),z=(Q,J)=>{if(typeof H==="function")J=H.call(U,Q,J);else if(Array.isArray(H)&&!H.includes(Q))return;if(J!==void 0||Z)G.items.push(Y0(Q,J,X))};if(U instanceof Map)for(let[Q,J]of U)z(Q,J);else if(U&&typeof U==="object")for(let Q of Object.keys(U))z(Q,U[Q]);if(typeof $.sortMapEntries==="function")G.items.sort($.sortMapEntries);return G}add($,U){let X;if(L($))X=$;else if(!$||typeof $!=="object"||!("key"in $))X=new j($,$?.value);else X=new j($.key,$.value);let Z=$0(this.items,X.key),H=this.schema?.sortMapEntries;if(Z){if(!U)throw Error(`Key ${X.key} already set`);if(O(Z.value)&&k0(X.value))Z.value.value=X.value;else Z.value=X.value}else if(H){let G=this.items.findIndex((z)=>H(X,z)<0);if(G===-1)this.items.push(X);else this.items.splice(G,0,X)}else this.items.push(X)}delete($){let U=$0(this.items,$);if(!U)return!1;return this.items.splice(this.items.indexOf(U),1).length>0}get($,U){let Z=$0(this.items,$)?.value;return(!U&&O(Z)?Z.value:Z)??void 0}has($){return!!$0(this.items,$)}set($,U){this.add(new j($,U),!0)}toJSON($,U,X){let Z=X?new X:U?.mapAsMap?new Map:{};if(U?.onCreate)U.onCreate(Z);for(let H of this.items)p0(U,Z,H);return Z}toString($,U,X){if(!$)return JSON.stringify(this);for(let Z of this.items)if(!L(Z))throw Error(`Map items must all be pairs; found ${JSON.stringify(Z)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return c0(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:X,onComment:U})}}var l={collection:"map",default:!0,nodeClass:C,tag:"tag:yaml.org,2002:map",resolve($,U){if(!v($))U("Expected a mapping for this tag");return $},createNode:($,U,X)=>C.from($,U,X)};class h extends D0{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(r,$);this.items=[]}add($){this.items.push($)}delete($){let U=i0($);if(typeof U!=="number")return!1;return this.items.splice(U,1).length>0}get($,U){let X=i0($);if(typeof X!=="number")return;let Z=this.items[X];return!U&&O(Z)?Z.value:Z}has($){let U=i0($);return typeof U==="number"&&U<this.items.length}set($,U){let X=i0($);if(typeof X!=="number")throw Error(`Expected a valid index, not ${$}.`);let Z=this.items[X];if(O(Z)&&k0(U))Z.value=U;else this.items[X]=U}toJSON($,U){let X=[];if(U?.onCreate)U.onCreate(X);let Z=0;for(let H of this.items)X.push(N(H,String(Z++),U));return X}toString($,U,X){if(!$)return JSON.stringify(this);return c0(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:X,onComment:U})}static from($,U,X){let{replacer:Z}=X,H=new this($);if(U&&Symbol.iterator in Object(U)){let G=0;for(let z of U){if(typeof Z==="function"){let Q=U instanceof Set?z:String(G++);z=Z.call(U,Q,z)}H.items.push(o(z,void 0,X))}}return H}}function i0($){let U=O($)?$.value:$;if(U&&typeof U==="string")U=Number(U);return typeof U==="number"&&Number.isInteger(U)&&U>=0?U:null}var c={collection:"seq",default:!0,nodeClass:h,tag:"tag:yaml.org,2002:seq",resolve($,U){if(!d($))U("Expected a sequence for this tag");return $},createNode:($,U,X)=>h.from($,U,X)};var U0={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,U,X,Z){return U=Object.assign({actualString:!0},U),z0($,U,X,Z)}};var J0={identify:($)=>$==null,createNode:()=>new I(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new I(null),stringify:({source:$},U)=>typeof $==="string"&&J0.test.test($)?$:U.options.nullStr};var P0={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new I($[0]==="t"||$[0]==="T"),stringify({source:$,value:U},X){if($&&P0.test.test($)){let Z=$[0]==="t"||$[0]==="T";if(U===Z)return $}return U?X.options.trueStr:X.options.falseStr}};function E({format:$,minFractionDigits:U,tag:X,value:Z}){if(typeof Z==="bigint")return String(Z);let H=typeof Z==="number"?Z:Number(Z);if(!isFinite(H))return isNaN(H)?".nan":H<0?"-.inf":".inf";let G=Object.is(Z,-0)?"-0":JSON.stringify(Z);if(!$&&U&&(!X||X==="tag:yaml.org,2002:float")&&/^-?\d/.test(G)&&!G.includes("e")){let z=G.indexOf(".");if(z<0)z=G.length,G+=".";let Q=U-(G.length-z-1);while(Q-- >0)G+="0"}return G}var s0={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:E},a0={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let U=Number($.value);return isFinite(U)?U.toExponential():E($)}},n0={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let U=new I(parseFloat($)),X=$.indexOf(".");if(X!==-1&&$[$.length-1]==="0")U.minFractionDigits=$.length-X-1;return U},stringify:E};var r0=($)=>typeof $==="bigint"||Number.isInteger($),R$=($,U,X,{intAsBigInt:Z})=>Z?BigInt($):parseInt($.substring(U),X);function i$($,U,X){let{value:Z}=$;if(r0(Z)&&Z>=0)return X+Z.toString(U);return E($)}var o0={identify:($)=>r0($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,U,X)=>R$($,2,8,X),stringify:($)=>i$($,8,"0o")},t0={identify:r0,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,U,X)=>R$($,0,10,X),stringify:E},e0={identify:($)=>r0($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,U,X)=>R$($,2,16,X),stringify:($)=>i$($,16,"0x")};var s$=[l,c,U0,J0,P0,o0,t0,e0,s0,a0,n0];function a$($){return typeof $==="bigint"||Number.isInteger($)}var $$=({value:$})=>JSON.stringify($),C2=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:$$},{identify:($)=>$==null,createNode:()=>new I(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:$$},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:$$},{identify:a$,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,U,{intAsBigInt:X})=>X?BigInt($):parseInt($,10),stringify:({value:$})=>a$($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:$$}],E2={default:!0,tag:"",test:/^/,resolve($,U){return U(`Unresolved plain scalar ${JSON.stringify($)}`),$}},n$=[l,c].concat(C2,E2);var M0={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,U){if(typeof atob==="function"){let X=atob($.replace(/[\n\r]/g,"")),Z=new Uint8Array(X.length);for(let H=0;H<X.length;++H)Z[H]=X.charCodeAt(H);return Z}else return U("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:U,value:X},Z,H,G){if(!X)return"";let z=X,Q;if(typeof btoa==="function"){let J="";for(let B=0;B<z.length;++B)J+=String.fromCharCode(z[B]);Q=btoa(J)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(U??(U=I.BLOCK_LITERAL),U!==I.QUOTE_DOUBLE){let J=Math.max(Z.options.lineWidth-Z.indent.length,Z.options.minContentWidth),B=Math.ceil(Q.length/J),F=Array(B);for(let W=0,V=0;W<B;++W,V+=J)F[W]=Q.substr(V,J);Q=F.join(U===I.BLOCK_LITERAL?`
|
|
52
|
+
`:" ")}return z0({comment:$,type:U,value:Q},Z,H,G)}};function F$($,U){if(d($))for(let X=0;X<$.items.length;++X){let Z=$.items[X];if(L(Z))continue;else if(v(Z)){if(Z.items.length>1)U("Each pair must have its own sequence indicator");let H=Z.items[0]||new j(new I(null));if(Z.commentBefore)H.key.commentBefore=H.key.commentBefore?`${Z.commentBefore}
|
|
53
|
+
${H.key.commentBefore}`:Z.commentBefore;if(Z.comment){let G=H.value??H.key;G.comment=G.comment?`${Z.comment}
|
|
54
|
+
${G.comment}`:Z.comment}Z=H}$.items[X]=L(Z)?Z:new j(Z)}else U("Expected a sequence for this tag");return $}function _$($,U,X){let{replacer:Z}=X,H=new h($);H.tag="tag:yaml.org,2002:pairs";let G=0;if(U&&Symbol.iterator in Object(U))for(let z of U){if(typeof Z==="function")z=Z.call(U,String(G++),z);let Q,J;if(Array.isArray(z))if(z.length===2)Q=z[0],J=z[1];else throw TypeError(`Expected [key, value] tuple: ${z}`);else if(z&&z instanceof Object){let B=Object.keys(z);if(B.length===1)Q=B[0],J=z[Q];else throw TypeError(`Expected tuple with one key, not ${B.length} keys`)}else Q=z;H.items.push(Y0(Q,J,X))}return H}var b0={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:F$,createNode:_$};class I0 extends h{constructor(){super();this.add=C.prototype.add.bind(this),this.delete=C.prototype.delete.bind(this),this.get=C.prototype.get.bind(this),this.has=C.prototype.has.bind(this),this.set=C.prototype.set.bind(this),this.tag=I0.tag}toJSON($,U){if(!U)return super.toJSON($);let X=new Map;if(U?.onCreate)U.onCreate(X);for(let Z of this.items){let H,G;if(L(Z))H=N(Z.key,"",U),G=N(Z.value,H,U);else H=N(Z,"",U);if(X.has(H))throw Error("Ordered maps must not include duplicate keys");X.set(H,G)}return X}static from($,U,X){let Z=_$($,U,X),H=new this;return H.items=Z.items,H}}I0.tag="tag:yaml.org,2002:omap";var A0={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:I0,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,U){let X=F$($,U),Z=[];for(let{key:H}of X.items)if(O(H))if(Z.includes(H.value))U(`Ordered maps must not include duplicate keys: ${H.value}`);else Z.push(H.value);return Object.assign(new I0,X)},createNode:($,U,X)=>I0.from($,U,X)};function r$({value:$,source:U},X){if(U&&($?O$:L$).test.test(U))return U;return $?X.options.trueStr:X.options.falseStr}var O$={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new I(!0),stringify:r$},L$={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new I(!1),stringify:r$};var o$={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:E},t$={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let U=Number($.value);return isFinite(U)?U.toExponential():E($)}},e$={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let U=new I(parseFloat($.replace(/_/g,""))),X=$.indexOf(".");if(X!==-1){let Z=$.substring(X+1).replace(/_/g,"");if(Z[Z.length-1]==="0")U.minFractionDigits=Z.length}return U},stringify:E};var N0=($)=>typeof $==="bigint"||Number.isInteger($);function U$($,U,X,{intAsBigInt:Z}){let H=$[0];if(H==="-"||H==="+")U+=1;if($=$.substring(U).replace(/_/g,""),Z){switch(X){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let z=BigInt($);return H==="-"?BigInt(-1)*z:z}let G=parseInt($,X);return H==="-"?-1*G:G}function D$($,U,X){let{value:Z}=$;if(N0(Z)){let H=Z.toString(U);return Z<0?"-"+X+H.substr(1):X+H}return E($)}var $2={identify:N0,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,U,X)=>U$($,2,2,X),stringify:($)=>D$($,2,"0b")},U2={identify:N0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,U,X)=>U$($,1,8,X),stringify:($)=>D$($,8,"0")},X2={identify:N0,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,U,X)=>U$($,0,10,X),stringify:E},Z2={identify:N0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,U,X)=>U$($,2,16,X),stringify:($)=>D$($,16,"0x")};class R0 extends C{constructor($){super($);this.tag=R0.tag}add($){let U;if(L($))U=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)U=new j($.key,null);else U=new j($,null);if(!$0(this.items,U.key))this.items.push(U)}get($,U){let X=$0(this.items,$);return!U&&L(X)?O(X.key)?X.key.value:X.key:X}set($,U){if(typeof U!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof U}`);let X=$0(this.items,$);if(X&&!U)this.items.splice(this.items.indexOf(X),1);else if(!X&&U)this.items.push(new j($))}toJSON($,U){return super.toJSON($,U,Set)}toString($,U,X){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),U,X);else throw Error("Set items must all have null values")}static from($,U,X){let{replacer:Z}=X,H=new this($);if(U&&Symbol.iterator in Object(U))for(let G of U){if(typeof Z==="function")G=Z.call(U,G,G);H.items.push(Y0(G,null,X))}return H}}R0.tag="tag:yaml.org,2002:set";var j0={collection:"map",identify:($)=>$ instanceof Set,nodeClass:R0,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,U,X)=>R0.from($,U,X),resolve($,U){if(v($))if($.hasAllNullValues(!0))return Object.assign(new R0,$);else U("Set items must all have null values");else U("Expected a mapping for this tag");return $}};function K$($,U){let X=$[0],Z=X==="-"||X==="+"?$.substring(1):$,H=(z)=>U?BigInt(z):Number(z),G=Z.replace(/_/g,"").split(":").reduce((z,Q)=>z*H(60)+H(Q),H(0));return X==="-"?H(-1)*G:G}function H2($){let{value:U}=$,X=(z)=>z;if(typeof U==="bigint")X=(z)=>BigInt(z);else if(isNaN(U)||!isFinite(U))return E($);let Z="";if(U<0)Z="-",U*=X(-1);let H=X(60),G=[U%H];if(U<60)G.unshift(0);else if(U=(U-G[0])/H,G.unshift(U%H),U>=60)U=(U-G[0])/H,G.unshift(U);return Z+G.map((z)=>String(z).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var X$={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,U,{intAsBigInt:X})=>K$($,X),stringify:H2},Z$={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>K$($,!1),stringify:H2},F0={identify:($)=>$ 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($){let U=$.match(F0.test);if(!U)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,X,Z,H,G,z,Q]=U.map(Number),J=U[7]?Number((U[7]+"00").substr(1,3)):0,B=Date.UTC(X,Z-1,H,G||0,z||0,Q||0,J),F=U[8];if(F&&F!=="Z"){let W=K$(F,!1);if(Math.abs(W)<30)W*=60;B-=60000*W}return new Date(B)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var w$=[l,c,U0,J0,O$,L$,$2,U2,X2,Z2,o$,t$,e$,M0,p,A0,b0,j0,X$,Z$,F0];var G2=new Map([["core",s$],["failsafe",[l,c,U0]],["json",n$],["yaml11",w$],["yaml-1.1",w$]]),z2={binary:M0,bool:P0,float:n0,floatExp:a0,floatNaN:s0,floatTime:Z$,int:t0,intHex:e0,intOct:o0,intTime:X$,map:l,merge:p,null:J0,omap:A0,pairs:b0,seq:c,set:j0,timestamp:F0},J2={"tag:yaml.org,2002:binary":M0,"tag:yaml.org,2002:merge":p,"tag:yaml.org,2002:omap":A0,"tag:yaml.org,2002:pairs":b0,"tag:yaml.org,2002:set":j0,"tag:yaml.org,2002:timestamp":F0};function H$($,U,X){let Z=G2.get(U);if(Z&&!$)return X&&!Z.includes(p)?Z.concat(p):Z.slice();let H=Z;if(!H)if(Array.isArray($))H=[];else{let G=Array.from(G2.keys()).filter((z)=>z!=="yaml11").map((z)=>JSON.stringify(z)).join(", ");throw Error(`Unknown schema "${U}"; use one of ${G} or define customTags array`)}if(Array.isArray($))for(let G of $)H=H.concat(G);else if(typeof $==="function")H=$(H.slice());if(X)H=H.concat(p);return H.reduce((G,z)=>{let Q=typeof z==="string"?z2[z]:z;if(!Q){let J=JSON.stringify(z),B=Object.keys(z2).map((F)=>JSON.stringify(F)).join(", ");throw Error(`Unknown custom tag ${J}; use one of ${B}`)}if(!G.includes(Q))G.push(Q);return G},[])}var g2=($,U)=>$.key<U.key?-1:$.key>U.key?1:0;class S0{constructor({compat:$,customTags:U,merge:X,resolveKnownTags:Z,schema:H,sortMapEntries:G,toStringDefaults:z}){this.compat=Array.isArray($)?H$($,"compat"):$?H$(null,$):null,this.name=typeof H==="string"&&H||"core",this.knownTags=Z?J2:{},this.tags=H$(U,this.name,X),this.toStringOptions=z??null,Object.defineProperty(this,x,{value:l}),Object.defineProperty(this,Z0,{value:U0}),Object.defineProperty(this,r,{value:c}),this.sortMapEntries=typeof G==="function"?G:G===!0?g2:null}clone(){let $=Object.create(S0.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}function Q2($,U){let X=[],Z=U.directives===!0;if(U.directives!==!1&&$.directives){let J=$.directives.toString($);if(J)X.push(J),Z=!0;else if($.directives.docStart)Z=!0}if(Z)X.push("---");let H=v0($,U),{commentString:G}=H.options;if($.commentBefore){if(X.length!==1)X.unshift("");let J=G($.commentBefore);X.unshift(y(J,""))}let z=!1,Q=null;if($.contents){if(D($.contents)){if($.contents.spaceBefore&&Z)X.push("");if($.contents.commentBefore){let F=G($.contents.commentBefore);X.push(y(F,""))}H.forceBlockIndent=!!$.comment,Q=$.contents.comment}let J=Q?void 0:()=>z=!0,B=t($.contents,H,()=>Q=null,J);if(Q)B+=a(B,"",G(Q));if((B[0]==="|"||B[0]===">")&&X[X.length-1]==="---")X[X.length-1]=`--- ${B}`;else X.push(B)}else X.push(t($.contents,H));if($.directives?.docEnd)if($.comment){let J=G($.comment);if(J.includes(`
|
|
55
|
+
`))X.push("..."),X.push(y(J,""));else X.push(`... ${J}`)}else X.push("...");else{let J=$.comment;if(J&&z)J=J.replace(/^\n+/,"");if(J){if((!z||Q)&&X[X.length-1]!=="")X.push("");X.push(y(G(J),""))}}return X.join(`
|
|
56
56
|
`)+`
|
|
57
|
-
`}class Q0{constructor($,U,
|
|
58
|
-
\r `);function A$($,U,
|
|
57
|
+
`}class Q0{constructor($,U,X){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,g,{value:E0});let Z=null;if(typeof U==="function"||Array.isArray(U))Z=U;else if(X===void 0&&U)X=U,U=void 0;let H=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},X);this.options=H;let{version:G}=H;if(X?._directives){if(this.directives=X._directives.atDocument(),this.directives.yaml.explicit)G=this.directives.yaml.version}else this.directives=new S({version:G});this.setSchema(G,X),this.contents=$===void 0?null:this.createNode($,Z,X)}clone(){let $=Object.create(Q0.prototype,{[g]:{value:E0}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=D(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(_0(this.contents))this.contents.add($)}addIn($,U){if(_0(this.contents))this.contents.addIn($,U)}createAlias($,U){if(!$.anchor){let X=Q$(this);$.anchor=!U||X.has(U)?B$(U||"a",X):U}return new G0($.anchor)}createNode($,U,X){let Z=void 0;if(typeof U==="function")$=U.call({"":$},"",$),Z=U;else if(Array.isArray(U)){let T=(P)=>typeof P==="number"||P instanceof String||P instanceof Number,Y=U.filter(T).map(String);if(Y.length>0)U=U.concat(Y);Z=U}else if(X===void 0&&U)X=U,U=void 0;let{aliasDuplicateObjects:H,anchorPrefix:G,flow:z,keepUndefined:Q,onTagObj:J,tag:B}=X??{},{onAnchor:F,setAnchors:W,sourceObjects:V}=x$(this,G||"a"),R={aliasDuplicateObjects:H??!0,keepUndefined:Q??!1,onAnchor:F,onTagObj:J,replacer:Z,schema:this.schema,sourceObjects:V},_=o($,B,R);if(z&&w(_))_.flow=!0;return W(),_}createPair($,U,X={}){let Z=this.createNode($,null,X),H=this.createNode(U,null,X);return new j(Z,H)}delete($){return _0(this.contents)?this.contents.delete($):!1}deleteIn($){if(V0($)){if(this.contents==null)return!1;return this.contents=null,!0}return _0(this.contents)?this.contents.deleteIn($):!1}get($,U){return w(this.contents)?this.contents.get($,U):void 0}getIn($,U){if(V0($))return!U&&O(this.contents)?this.contents.value:this.contents;return w(this.contents)?this.contents.getIn($,U):void 0}has($){return w(this.contents)?this.contents.has($):!1}hasIn($){if(V0($))return this.contents!==void 0;return w(this.contents)?this.contents.hasIn($):!1}set($,U){if(this.contents==null)this.contents=L0(this.schema,[$],U);else if(_0(this.contents))this.contents.set($,U)}setIn($,U){if(V0($))this.contents=U;else if(this.contents==null)this.contents=L0(this.schema,Array.from($),U);else if(_0(this.contents))this.contents.setIn($,U)}setSchema($,U={}){if(typeof $==="number")$=String($);let X;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new S({version:"1.1"});X={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new S({version:$});X={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;X=null;break;default:{let Z=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${Z}`)}}if(U.schema instanceof Object)this.schema=U.schema;else if(X)this.schema=new S0(Object.assign(X,U));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:U,mapAsMap:X,maxAliasCount:Z,onAnchor:H,reviver:G}={}){let z={anchors:new Map,doc:this,keep:!$,mapAsMap:X===!0,mapKeyWarned:!1,maxAliasCount:typeof Z==="number"?Z:100},Q=N(this.contents,U??"",z);if(typeof H==="function")for(let{count:J,res:B}of z.anchors.values())H(B,J);return typeof G==="function"?e(G,{"":Q},"",Q):Q}toJSON($,U){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:U})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let U=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${U}`)}return Q2(this,$)}}function _0($){if(w($))return!0;throw Error("Expected a YAML collection as document contents")}var b$=Symbol("break visit"),u2=Symbol("skip children"),W2=Symbol("remove item");function B0($,U){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};T2(Object.freeze([]),$,U)}B0.BREAK=b$;B0.SKIP=u2;B0.REMOVE=W2;B0.itemAtPath=($,U)=>{let X=$;for(let[Z,H]of U){let G=X?.[Z];if(G&&"items"in G)X=G.items[H];else return}return X};B0.parentCollection=($,U)=>{let X=B0.itemAtPath($,U.slice(0,-1)),Z=U[U.length-1][0],H=X?.[Z];if(H&&"items"in H)return H;throw Error("Parent collection not found")};function T2($,U,X){let Z=X(U,$);if(typeof Z==="symbol")return Z;for(let H of["key","value"]){let G=U[H];if(G&&"items"in G){for(let z=0;z<G.items.length;++z){let Q=T2(Object.freeze($.concat([[H,z]])),G.items[z],X);if(typeof Q==="number")z=Q-1;else if(Q===b$)return b$;else if(Q===W2)G.items.splice(z,1),z-=1}if(typeof Z==="function"&&H==="key")Z=Z(U,$)}}return typeof Z==="function"?Z(U,$):Z}var fZ=new Set("0123456789ABCDEFabcdef"),yZ=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),hZ=new Set(",[]{}"),kZ=new Set(` ,[]{}
|
|
58
|
+
\r `);function A$($,U,X){let Z=null;if(typeof U==="function"||Array.isArray(U))Z=U;else if(X===void 0&&U)X=U;if(typeof X==="string")X=X.length;if(typeof X==="number"){let H=Math.round(X);X=H<1?void 0:H>8?{indent:8}:{indent:H}}if($===void 0){let{keepUndefined:H}=X??U??{};if(!H)return}if(m($)&&!Z)return $.toString(X);return new Q0($,Z,X).toString(X)}var i2="JSONRPC",q2="1.0",Y2=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],s2="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",a2="https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",I2="1.0",n2="1.0",N$={a2a:"application/a2a-agent-card+json",server_card:"application/mcp-server-card+json",fafa:"application/vnd.fafa+yaml"};function r2($){return($.endpoints??[]).filter((U)=>String(U.protocol??"").toLowerCase()==="a2a"&&U.location)}function o2($,U={}){let X=r2($);if(X.length>0)return X;let Z=U.doorUrl?.trim();if(Z)return[{protocol:"a2a",location:Z,version:q2}];return[]}function t2($){let U=new Set;for(let X of $.capabilities??[])if(X.cites_spec&&Y2.includes(X.cites_spec))U.add(X.cites_spec);return["text/plain",...U]}function e2($,U={}){let X=$.agent??{},Z=o2($,U);if(Z.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let H=String(X.displayName??$.metadata?.persona??X.name??"").trim(),G=String(X.description??"").trim(),z=String(X.version??"").trim();if(!H||!G||!z)throw Error("A2A card needs agent.displayName|name, description, version in .fafa");let Q=String(X.vendor??"").trim(),J=String(X.homepage??"").trim(),B=Q&&J?{organization:Q,url:J}:void 0,F=($.capabilities??[]).map((W)=>{let V=String(W.name??"").trim();if(!V)throw Error("A2A skill missing capabilities[].name");let R=Array.isArray(W.tags)?W.tags.map(String):[],_=W.cites_spec&&Y2.includes(W.cites_spec)?[W.cites_spec,"text/plain"]:void 0;return{id:V,name:V,description:String(W.description??"").trim()||V,tags:R,..._?{inputModes:_}:{}}});return{name:H,description:G,supportedInterfaces:Z.map((W)=>({url:String(W.location),protocolBinding:i2,protocolVersion:String(W.version??q2)})),...B?{provider:B}:{},version:z,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...U.extensions??[]]},defaultInputModes:t2($),defaultOutputModes:["text/plain","application/json"],skills:F}}var $9=/^[a-z0-9][a-z0-9._-]*$/,U9=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function q($){return String($??"").trim()}function z$($){return Array.isArray($)?$.map(q).filter(Boolean):[]}function X9($){return q($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function Z9($,U,X){let Z=["display_name","description","version"].filter((H)=>!q($[H]));if(Z.length)throw Error(`Missing answer: ${Z.join(", ")}`);if(!$9.test(U))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!U9.test(X))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function H9($,U){return($.skills??[]).filter((X)=>q(X.name)).map((X)=>({name:q(X.name),type:q(X.type)||"tool",description:q(X.description)||q(X.name),tags:U.length?U:[q(X.name).toLowerCase()]}))}function G9($){return($.packages??[]).filter((U)=>q(U.registryType)&&q(U.identifier)).map((U)=>({registryType:q(U.registryType),identifier:q(U.identifier),...q(U.version)?{version:q(U.version)}:{}}))}function z9($,U){let X=[...($.endpoints??[]).filter((Z)=>q(Z.url)).map((Z)=>({protocol:q(Z.protocol).toLowerCase(),transport:"http",location:q(Z.url)})),...U.map((Z)=>({protocol:"mcp",transport:"stdio",location:Z.identifier}))];if(X.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return X}function J9($,U,X,Z){let H={domain:U},G=[["repository",q($.repository)],["icon",q($.icon)],["organizationUrl",q($.organization_url)]];for(let[Q,J]of G)if(J)H[Q]=J;if(X.length)H.keywords=X;let z=z$($.example_requests);if(z.length)H.examples=z;if(Z.length)H.packages=Z;return H}function Q9($){let U=q($.handle).toLowerCase(),X=X9($.domain);Z9($,U,X);let Z=z$($.tags),H=G9($),G={name:U,displayName:q($.display_name),id:`urn:air:${X}:agent:${U}`,...q($.organization)?{vendor:q($.organization)}:{},version:q($.version),description:q($.description),homepage:q($.homepage)||`https://${X}`,...q($.license)?{license:q($.license)}:{}};return{version:n2,agent:G,capabilities:H9($,Z),endpoints:z9($,H),metadata:{cards:J9($,X,Z,H)}}}function B9($){return A$($,{lineWidth:0})}function j$($){let U=q($.agent?.id),X=/^urn:air:([^:]+):/.exec(U);if(X)return X[1];let Z=q($.metadata?.cards?.domain);if(Z)return Z;try{return new URL(q($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function D5($){return S$($)}function S$($){let U=q($.agent?.name).toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/^-+|-+$/g,"");if(!U)throw Error("The .fafa needs agent.name (the short name).");return U}function W9($){return`${j$($).split(".").reverse().join(".")}/${S$($)}`}function V2($){let U=$.replace(/\s+/g," ").trim();return U.length<=100?U:`${U.slice(0,97).trimEnd()}...`}function C$($){return($.endpoints??[]).filter((U)=>q(U.protocol).toLowerCase()==="mcp"&&/^https?:\/\//.test(q(U.location))).map((U)=>({type:"streamable-http",url:q(U.location)}))}function T9($){if(!$)return;try{let U=new URL($).hostname.replace(/^www\./,"");return{url:$,source:U.split(".")[0]}}catch{return}}function R2($){let U=$.agent??{},X=$.metadata?.cards??{},Z=q(U.description),H=q(U.version);if(!Z||!H)throw Error("An MCP card needs agent.description and agent.version in .fafa");let G={name:W9($),version:H,description:V2(Z)},z=q(U.displayName);if(z)G.title=V2(z);let Q=q(U.homepage);if(Q)G.websiteUrl=Q;let J=T9(q(X.repository));if(J)G.repository=J;if(q(X.icon))G.icons=[{src:q(X.icon)}];return G}function V9($){let U=C$($);if(U.length===0)throw Error("A Server Card describes a remote MCP server: the .fafa has no mcp endpoint at an http(s) URL.");return{$schema:s2,...R2($),remotes:U}}function q9($){let U=C$($),X=($.metadata?.cards?.packages??[]).map((Z)=>({registryType:q(Z.registryType),identifier:q(Z.identifier),...q(Z.version)?{version:q(Z.version)}:{},transport:{type:"stdio"}}));if(U.length===0&&X.length===0)throw Error("A registry entry needs a package people install or a remote MCP URL.");return{$schema:a2,...R2($),...X.length?{packages:X}:{},...U.length?{remotes:U}:{}}}function F2($,U,X={}){let Z=j$($),H=S$($),G=$.agent??{},z=q(G.displayName)||q(G.name),Q=q(G.description),J=q(G.version),B=X.now??new Date().toISOString(),F=(V,R,_)=>({identifier:`urn:air:${Z}:${V}:${H}`,displayName:z,type:R,description:Q,url:_,...J?{version:J}:{},updatedAt:B}),W=[];if(U.includes("a2a"))W.push(F("a2a",N$.a2a,`https://${Z}/.well-known/agent-card.json`));if(U.includes("server_card")){let V=C$($)[0];if(V)W.push(F("mcp",N$.server_card,`${V.url.replace(/\/+$/,"")}/server-card`))}if(X.listFafa)W.push(F("agent",N$.fafa,`https://${Z}/.well-known/fafa`));return W}function _2($){let U=$.agent??{},X=q(U.vendor)||q(U.displayName)||q(U.name);if(!X)return;let Z;try{Z=j$($)}catch{Z=void 0}return{displayName:X,...Z?{identifier:Z}:{}}}function Y9($,U,X={}){let Z=_2($);return{specVersion:I2,...Z?{host:Z}:{},entries:F2($,U,X)}}function I9($){let U=$.metadata?.cards??{},X=z$(U.keywords),Z=z$(U.examples);return{...X.length?{tags:X}:{},...Z.length?{representativeQueries:Z}:{}}}function R9($,U,X={}){let Z=_2($),H=I9($);return{specVersion:I2,...Z?{host:Z}:{},entries:F2($,U,X).map((G)=>({...G,...H}))}}function F9($,U){let X=new Set(U.cards),Z={fafa:$,fafaText:B9($)};if(X.has("a2a"))Z.a2a=e2($,{extensions:U.a2aExtensions});if(X.has("server_card"))Z.server_card=V9($);if(X.has("server_json"))Z.server_json=q9($);let H={now:U.now,listFafa:U.listFafa};if(X.has("ai_catalog"))Z.ai_catalog=Y9($,U.cards,H);if(X.has("ard"))Z.ard=R9($,U.cards,H);return Z}function K5($,U){return F9(Q9($),U)}export{q9 as projectServerJson,V9 as projectServerCard,F9 as projectPack,R9 as projectArd,Y9 as projectAiCatalog,e2 as projectA2ACard,W9 as mcpName,B9 as fafaYaml,D5 as fafaHandle,j$ as fafaDomain,F2 as catalogRows,_2 as catalogHost,K5 as buildPack,I9 as ardHints,Q9 as answersToFafa,r2 as a2aEndpoints,o2 as a2aDoors,a2 as SERVER_JSON_SCHEMA,s2 as SERVER_CARD_SCHEMA,Y2 as FAF_MEDIA_TYPES,n2 as FAFA_SPEC_VERSION,N$ as CARD_MEDIA_TYPES,I2 as AI_CATALOG_SPEC_VERSION,q2 as A2A_PROTOCOL_VERSION,i2 as A2A_PROTOCOL_BINDING};
|
|
59
59
|
|
|
60
|
-
//# debugId=
|
|
60
|
+
//# debugId=7885AAE26E02C17964756E2164756E21
|
|
61
61
|
//# sourceMappingURL=pack.js.map
|