@codehourra/llm-iwiki 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.js +292 -180
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
3
|
-
`)}}
|
|
4
|
-
`)?
|
|
2
|
+
import{createRequire as ii}from"node:module";var P=(u,_)=>()=>(_||u((_={exports:{}}).exports,_),_.exports);var s_=ii(import.meta.url);var X=P((Ui)=>{var us=Symbol.for("yaml.alias"),N$=Symbol.for("yaml.document"),$_=Symbol.for("yaml.map"),V$=Symbol.for("yaml.pair"),_s=Symbol.for("yaml.scalar"),w_=Symbol.for("yaml.seq"),x=Symbol.for("yaml.node.type"),Ri=(u)=>!!u&&typeof u==="object"&&u[x]===us,Si=(u)=>!!u&&typeof u==="object"&&u[x]===N$,Ii=(u)=>!!u&&typeof u==="object"&&u[x]===$_,Ti=(u)=>!!u&&typeof u==="object"&&u[x]===V$,j$=(u)=>!!u&&typeof u==="object"&&u[x]===_s,qi=(u)=>!!u&&typeof u==="object"&&u[x]===w_;function b$(u){if(u&&typeof u==="object")switch(u[x]){case $_:case w_:return!0}return!1}function Li(u){if(u&&typeof u==="object")switch(u[x]){case us:case $_:case _s:case w_:return!0}return!1}var Oi=(u)=>(j$(u)||b$(u))&&!!u.anchor;Ui.ALIAS=us;Ui.DOC=N$;Ui.MAP=$_;Ui.NODE_TYPE=x;Ui.PAIR=V$;Ui.SCALAR=_s;Ui.SEQ=w_;Ui.hasAnchor=Oi;Ui.isAlias=Ri;Ui.isCollection=b$;Ui.isDocument=Si;Ui.isMap=Ii;Ui.isNode=Li;Ui.isPair=Ti;Ui.isScalar=j$;Ui.isSeq=qi});var Mu=P((Vi)=>{var Q=X(),E=Symbol("break visit"),E$=Symbol("skip children"),d=Symbol("remove node");function f_(u,_){let s=C$(_);if(Q.isDocument(u)){if(Hu(null,u.contents,s,Object.freeze([u]))===d)u.contents=null}else Hu(null,u,s,Object.freeze([]))}f_.BREAK=E;f_.SKIP=E$;f_.REMOVE=d;function Hu(u,_,s,$){let w=l$(u,_,s,$);if(Q.isNode(w)||Q.isPair(w))return K$(u,$,w),Hu(u,w,s,$);if(typeof w!=="symbol"){if(Q.isCollection(_)){$=Object.freeze($.concat(_));for(let f=0;f<_.items.length;++f){let g=Hu(f,_.items[f],s,$);if(typeof g==="number")f=g-1;else if(g===E)return E;else if(g===d)_.items.splice(f,1),f-=1}}else if(Q.isPair(_)){$=Object.freeze($.concat(_));let f=Hu("key",_.key,s,$);if(f===E)return E;else if(f===d)_.key=null;let g=Hu("value",_.value,s,$);if(g===E)return E;else if(g===d)_.value=null}}return w}async function g_(u,_){let s=C$(_);if(Q.isDocument(u)){if(await Pu(null,u.contents,s,Object.freeze([u]))===d)u.contents=null}else await Pu(null,u,s,Object.freeze([]))}g_.BREAK=E;g_.SKIP=E$;g_.REMOVE=d;async function Pu(u,_,s,$){let w=await l$(u,_,s,$);if(Q.isNode(w)||Q.isPair(w))return K$(u,$,w),Pu(u,w,s,$);if(typeof w!=="symbol"){if(Q.isCollection(_)){$=Object.freeze($.concat(_));for(let f=0;f<_.items.length;++f){let g=await Pu(f,_.items[f],s,$);if(typeof g==="number")f=g-1;else if(g===E)return E;else if(g===d)_.items.splice(f,1),f-=1}}else if(Q.isPair(_)){$=Object.freeze($.concat(_));let f=await Pu("key",_.key,s,$);if(f===E)return E;else if(f===d)_.key=null;let g=await Pu("value",_.value,s,$);if(g===E)return E;else if(g===d)_.value=null}}return w}function C$(u){if(typeof u==="object"&&(u.Collection||u.Node||u.Value))return Object.assign({Alias:u.Node,Map:u.Node,Scalar:u.Node,Seq:u.Node},u.Value&&{Map:u.Value,Scalar:u.Value,Seq:u.Value},u.Collection&&{Map:u.Collection,Seq:u.Collection},u);return u}function l$(u,_,s,$){if(typeof s==="function")return s(u,_,$);if(Q.isMap(_))return s.Map?.(u,_,$);if(Q.isSeq(_))return s.Seq?.(u,_,$);if(Q.isPair(_))return s.Pair?.(u,_,$);if(Q.isScalar(_))return s.Scalar?.(u,_,$);if(Q.isAlias(_))return s.Alias?.(u,_,$);return}function K$(u,_,s){let $=_[_.length-1];if(Q.isCollection($))$.items[u]=s;else if(Q.isPair($))if(u==="key")$.key=s;else $.value=s;else if(Q.isDocument($))$.contents=s;else{let w=Q.isAlias($)?"alias":"scalar";throw Error(`Cannot replace node with ${w} parent`)}}Vi.visit=f_;Vi.visitAsync=g_});var ss=P((Ki)=>{var r$=X(),Ei=Mu(),Ci={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},li=(u)=>u.replace(/[!,[\]{}]/g,(_)=>Ci[_]);class C{constructor(u,_){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},C.defaultYaml,u),this.tags=Object.assign({},C.defaultTags,_)}clone(){let u=new C(this.yaml,this.tags);return u.docStart=this.docStart,u}atDocument(){let u=new C(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:C.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},C.defaultTags);break}return u}add(u,_){if(this.atNextDocument)this.yaml={explicit:C.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},C.defaultTags),this.atNextDocument=!1;let s=u.trim().split(/[ \t]+/),$=s.shift();switch($){case"%TAG":{if(s.length!==2){if(_(0,"%TAG directive should contain exactly two parts"),s.length<2)return!1}let[w,f]=s;return this.tags[w]=f,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return _(0,"%YAML directive should contain exactly one part"),!1;let[w]=s;if(w==="1.1"||w==="1.2")return this.yaml.version=w,!0;else{let f=/^\d+\.\d+$/.test(w);return _(6,`Unsupported YAML version ${w}`,f),!1}}default:return _(0,`Unknown directive ${$}`,!0),!1}}tagName(u,_){if(u==="!")return"!";if(u[0]!=="!")return _(`Not a valid tag: ${u}`),null;if(u[1]==="<"){let f=u.slice(2,-1);if(f==="!"||f==="!!")return _(`Verbatim tags aren't resolved, so ${u} is invalid.`),null;if(u[u.length-1]!==">")_("Verbatim tags must end with a >");return f}let[,s,$]=u.match(/^(.*!)([^!]*)$/s);if(!$)_(`The ${u} tag has no suffix`);let w=this.tags[s];if(w)try{return w+decodeURIComponent($)}catch(f){return _(String(f)),null}if(s==="!")return u;return _(`Could not resolve tag: ${u}`),null}tagString(u){for(let[_,s]of Object.entries(this.tags))if(u.startsWith(s))return _+li(u.substring(s.length));return u[0]==="!"?u:`!<${u}>`}toString(u){let _=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),$;if(u&&s.length>0&&r$.isNode(u.contents)){let w={};Ei.visit(u.contents,(f,g)=>{if(r$.isNode(g)&&g.tag)w[g.tag]=!0}),$=Object.keys(w)}else $=[];for(let[w,f]of s){if(w==="!!"&&f==="tag:yaml.org,2002:")continue;if(!u||$.some((g)=>g.startsWith(f)))_.push(`%TAG ${w} ${f}`)}return _.join(`
|
|
3
|
+
`)}}C.defaultYaml={explicit:!1,version:"1.2"};C.defaultTags={"!!":"tag:yaml.org,2002:"};Ki.Directives=C});var i_=P((hi)=>{var y$=X(),yi=Mu();function di(u){if(/[\x00-\x19\s,[\]{}]/.test(u)){let s=`Anchor must not contain whitespace or control characters: ${JSON.stringify(u)}`;throw Error(s)}return!0}function d$(u){let _=new Set;return yi.visit(u,{Value(s,$){if($.anchor)_.add($.anchor)}}),_}function n$(u,_){for(let s=1;;++s){let $=`${u}${s}`;if(!_.has($))return $}}function ni(u,_){let s=[],$=new Map,w=null;return{onAnchor:(f)=>{s.push(f),w??(w=d$(u));let g=n$(_,w);return w.add(g),g},setAnchors:()=>{for(let f of s){let g=$.get(f);if(typeof g==="object"&&g.anchor&&(y$.isScalar(g.node)||y$.isCollection(g.node)))g.node.anchor=g.anchor;else{let i=Error("Failed to resolve repeated object (this should not happen)");throw i.source=f,i}}},sourceObjects:$}}hi.anchorIsValid=di;hi.anchorNames=d$;hi.createNodeAnchors=ni;hi.findNewAnchor=n$});var $s=P((ki)=>{function Qu(u,_,s,$){if($&&typeof $==="object")if(Array.isArray($))for(let w=0,f=$.length;w<f;++w){let g=$[w],i=Qu(u,$,String(w),g);if(i===void 0)delete $[w];else if(i!==g)$[w]=i}else if($ instanceof Map)for(let w of Array.from($.keys())){let f=$.get(w),g=Qu(u,$,w,f);if(g===void 0)$.delete(w);else if(g!==f)$.set(w,g)}else if($ instanceof Set)for(let w of Array.from($)){let f=Qu(u,$,w,w);if(f===void 0)$.delete(w);else if(f!==w)$.delete(w),$.add(f)}else for(let[w,f]of Object.entries($)){let g=Qu(u,$,w,f);if(g===void 0)delete $[w];else if(g!==f)$[w]=g}return u.call(_,s,$)}ki.applyReviver=Qu});var t=P((vi)=>{var ti=X();function h$(u,_,s){if(Array.isArray(u))return u.map(($,w)=>h$($,String(w),s));if(u&&typeof u.toJSON==="function"){if(!s||!ti.hasAnchor(u))return u.toJSON(_,s);let $={aliasCount:0,count:1,res:void 0};s.anchors.set(u,$),s.onCreate=(f)=>{$.res=f,delete s.onCreate};let w=u.toJSON(_,s);if(s.onCreate)s.onCreate(w);return w}if(typeof u==="bigint"&&!s?.keep)return Number(u);return u}vi.toJS=h$});var R_=P((_0)=>{var ei=$s(),m$=X(),u0=t();class c${constructor(u){Object.defineProperty(this,m$.NODE_TYPE,{value:u})}clone(){let u=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)u.range=this.range.slice();return u}toJS(u,{mapAsMap:_,maxAliasCount:s,onAnchor:$,reviver:w}={}){if(!m$.isDocument(u))throw TypeError("A document argument is required");let f={anchors:new Map,doc:u,keep:!0,mapAsMap:_===!0,mapKeyWarned:!1,maxAliasCount:typeof s==="number"?s:100},g=u0.toJS(this,"",f);if(typeof $==="function")for(let{count:i,res:R}of f.anchors.values())$(R,i);return typeof w==="function"?ei.applyReviver(w,{"":g},"",g):g}}_0.NodeBase=c$});var Nu=P((i0)=>{var $0=i_(),w0=Mu(),Du=X(),f0=R_(),g0=t();class x$ extends f0.NodeBase{constructor(u){super(Du.ALIAS);this.source=u,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(u,_){if(_?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let s;if(_?.aliasResolveCache)s=_.aliasResolveCache;else if(s=[],w0.visit(u,{Node:(w,f)=>{if(Du.isAlias(f)||Du.hasAnchor(f))s.push(f)}}),_)_.aliasResolveCache=s;let $=void 0;for(let w of s){if(w===this)break;if(w.anchor===this.source)$=w}return $}toJSON(u,_){if(!_)return{source:this.source};let{anchors:s,doc:$,maxAliasCount:w}=_,f=this.resolve($,_);if(!f){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(i)}let g=s.get(f);if(!g)g0.toJS(f,null,_),g=s.get(f);if(g?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(w>=0){if(g.count+=1,g.aliasCount===0)g.aliasCount=S_($,f,s);if(g.count*g.aliasCount>w)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return g.res}toString(u,_,s){let $=`*${this.source}`;if(u){if($0.anchorIsValid(this.source),u.options.verifyAliasOrder&&!u.anchors.has(this.source)){let w=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(w)}if(u.implicitKey)return`${$} `}return $}}function S_(u,_,s){if(Du.isAlias(_)){let $=_.resolve(u),w=s&&$&&s.get($);return w?w.count*w.aliasCount:0}else if(Du.isCollection(_)){let $=0;for(let w of _.items){let f=S_(u,w,s);if(f>$)$=f}return $}else if(Du.isPair(_)){let $=S_(u,_.key,s),w=S_(u,_.value,s);return Math.max($,w)}return 1}i0.Alias=x$});var B=P((L0)=>{var S0=X(),I0=R_(),T0=t(),q0=(u)=>!u||typeof u!=="function"&&typeof u!=="object";class iu extends I0.NodeBase{constructor(u){super(S0.SCALAR);this.value=u}toJSON(u,_){return _?.keep?this.value:T0.toJS(this.value,u,_)}toString(){return String(this.value)}}iu.BLOCK_FOLDED="BLOCK_FOLDED";iu.BLOCK_LITERAL="BLOCK_LITERAL";iu.PLAIN="PLAIN";iu.QUOTE_DOUBLE="QUOTE_DOUBLE";iu.QUOTE_SINGLE="QUOTE_SINGLE";L0.Scalar=iu;L0.isScalarValue=q0});var Vu=P((F0)=>{var H0=Nu(),Ru=X(),p$=B(),P0="tag:yaml.org,2002:";function D0(u,_,s){if(_){let $=s.filter((f)=>f.tag===_),w=$.find((f)=>!f.format)??$[0];if(!w)throw Error(`Tag ${_} not found`);return w}return s.find(($)=>$.identify?.(u)&&!$.format)}function A0(u,_,s){if(Ru.isDocument(u))u=u.contents;if(Ru.isNode(u))return u;if(Ru.isPair(u)){let I=s.schema[Ru.MAP].createNode?.(s.schema,null,s);return I.items.push(u),I}if(u instanceof String||u instanceof Number||u instanceof Boolean||typeof BigInt<"u"&&u instanceof BigInt)u=u.valueOf();let{aliasDuplicateObjects:$,onAnchor:w,onTagObj:f,schema:g,sourceObjects:i}=s,R=void 0;if($&&u&&typeof u==="object")if(R=i.get(u),R)return R.anchor??(R.anchor=w(u)),new H0.Alias(R.anchor);else R={anchor:null,node:null},i.set(u,R);if(_?.startsWith("!!"))_=P0+_.slice(2);let S=D0(u,_,g.tags);if(!S){if(u&&typeof u.toJSON==="function")u=u.toJSON();if(!u||typeof u!=="object"){let I=new p$.Scalar(u);if(R)R.node=I;return I}S=u instanceof Map?g[Ru.MAP]:(Symbol.iterator in Object(u))?g[Ru.SEQ]:g[Ru.MAP]}if(f)f(S),delete s.onTagObj;let L=S?.createNode?S.createNode(s.schema,u,s):typeof S?.nodeClass?.from==="function"?S.nodeClass.from(s.schema,u,s):new p$.Scalar(u);if(_)L.tag=_;else if(!S.default)L.tag=S.tag;if(R)R.node=L;return L}F0.createNode=A0});var I_=P((W0)=>{var Y0=Vu(),n=X(),G0=R_();function ws(u,_,s){let $=s;for(let w=_.length-1;w>=0;--w){let f=_[w];if(typeof f==="number"&&Number.isInteger(f)&&f>=0){let g=[];g[f]=$,$=g}else $=new Map([[f,$]])}return Y0.createNode($,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:u,sourceObjects:new Map})}var k$=(u)=>u==null||typeof u==="object"&&!!u[Symbol.iterator]().next().done;class a$ extends G0.NodeBase{constructor(u,_){super(u);Object.defineProperty(this,"schema",{value:_,configurable:!0,enumerable:!1,writable:!0})}clone(u){let _=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(u)_.schema=u;if(_.items=_.items.map((s)=>n.isNode(s)||n.isPair(s)?s.clone(u):s),this.range)_.range=this.range.slice();return _}addIn(u,_){if(k$(u))this.add(_);else{let[s,...$]=u,w=this.get(s,!0);if(n.isCollection(w))w.addIn($,_);else if(w===void 0&&this.schema)this.set(s,ws(this.schema,$,_));else throw Error(`Expected YAML collection at ${s}. Remaining path: ${$}`)}}deleteIn(u){let[_,...s]=u;if(s.length===0)return this.delete(_);let $=this.get(_,!0);if(n.isCollection($))return $.deleteIn(s);else throw Error(`Expected YAML collection at ${_}. Remaining path: ${s}`)}getIn(u,_){let[s,...$]=u,w=this.get(s,!0);if($.length===0)return!_&&n.isScalar(w)?w.value:w;else return n.isCollection(w)?w.getIn($,_):void 0}hasAllNullValues(u){return this.items.every((_)=>{if(!n.isPair(_))return!1;let s=_.value;return s==null||u&&n.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(u){let[_,...s]=u;if(s.length===0)return this.has(_);let $=this.get(_,!0);return n.isCollection($)?$.hasIn(s):!1}setIn(u,_){let[s,...$]=u;if($.length===0)this.set(s,_);else{let w=this.get(s,!0);if(n.isCollection(w))w.setIn($,_);else if(w===void 0&&this.schema)this.set(s,ws(this.schema,$,_));else throw Error(`Expected YAML collection at ${s}. Remaining path: ${$}`)}}}W0.Collection=a$;W0.collectionFromPath=ws;W0.isEmptyPath=k$});var ju=P((Q0)=>{var Z0=(u)=>u.replace(/^(?!$)(?: $)?/gm,"#");function fs(u,_){if(/^\n+$/.test(u))return u.substring(1);return _?u.replace(/^(?! *$)/gm,_):u}var M0=(u,_,s)=>u.endsWith(`
|
|
4
|
+
`)?fs(s,_):s.includes(`
|
|
5
5
|
`)?`
|
|
6
|
-
`+
|
|
7
|
-
`){if(s==="block")q=t$(u,q,_.length);I=q+_.length+R,T=void 0}else{if(z===" "&&
|
|
8
|
-
`&&
|
|
9
|
-
`&&
|
|
10
|
-
${_}${u.slice(0,G)}`;else{if(s==="quoted"&&
|
|
11
|
-
${_}${u.slice(
|
|
12
|
-
`);$=_,
|
|
13
|
-
`){if(
|
|
14
|
-
|
|
15
|
-
`;while(s[R+2]==="\\"&&s[R+3]==="n"&&s[R+4]!=='"')
|
|
16
|
-
`,R+=2;if(
|
|
17
|
-
`)||/[ \t]\n|\n[ \t]/.test(u))return
|
|
18
|
-
${s}`)+"'";return _.implicitKey?$:v.foldFlowLines($,s,v.FOLD_FLOW,q_(_,!1))}function Au(u,_){let{singleQuote:s}=_.options,$;if(s===!1)$=
|
|
6
|
+
`+fs(s,_):(u.endsWith(" ")?"":" ")+s;Q0.indentComment=fs;Q0.lineComment=M0;Q0.stringifyComment=Z0});var v$=P((E0)=>{function b0(u,_,s="flow",{indentAtStart:$,lineWidth:w=80,minContentWidth:f=20,onFold:g,onOverflow:i}={}){if(!w||w<0)return u;if(w<f)f=0;let R=Math.max(1+f,1+w-_.length);if(u.length<=R)return u;let S=[],L={},I=w-_.length;if(typeof $==="number")if($>w-Math.max(2,f))S.push(0);else I=w-$;let T=void 0,O=void 0,H=!1,q=-1,U=-1,D=-1;if(s==="block"){if(q=t$(u,q,_.length),q!==-1)I=q+R}for(let z;z=u[q+=1];){if(s==="quoted"&&z==="\\"){switch(U=q,u[q+1]){case"x":q+=3;break;case"u":q+=5;break;case"U":q+=9;break;default:q+=1}D=q}if(z===`
|
|
7
|
+
`){if(s==="block")q=t$(u,q,_.length);I=q+_.length+R,T=void 0}else{if(z===" "&&O&&O!==" "&&O!==`
|
|
8
|
+
`&&O!=="\t"){let Y=u[q+1];if(Y&&Y!==" "&&Y!==`
|
|
9
|
+
`&&Y!=="\t")T=q}if(q>=I)if(T)S.push(T),I=T+R,T=void 0;else if(s==="quoted"){while(O===" "||O==="\t")O=z,z=u[q+=1],H=!0;let Y=q>D+1?q-2:U-1;if(L[Y])return u;S.push(Y),L[Y]=!0,I=Y+R,T=void 0}else H=!0}O=z}if(H&&i)i();if(S.length===0)return u;if(g)g();let F=u.slice(0,S[0]);for(let z=0;z<S.length;++z){let Y=S[z],G=S[z+1]||u.length;if(Y===0)F=`
|
|
10
|
+
${_}${u.slice(0,G)}`;else{if(s==="quoted"&&L[Y])F+=`${u[Y]}\\`;F+=`
|
|
11
|
+
${_}${u.slice(Y+1,G)}`}}return F}function t$(u,_,s){let $=_,w=_+1,f=u[w];while(f===" "||f==="\t")if(_<w+s)f=u[++_];else{do f=u[++_];while(f&&f!==`
|
|
12
|
+
`);$=_,w=_+1,f=u[w]}return $}E0.FOLD_BLOCK="block";E0.FOLD_FLOW="flow";E0.FOLD_QUOTED="quoted";E0.foldFlowLines=b0});var Eu=P((h0)=>{var r=B(),v=v$(),q_=(u,_)=>({indentAtStart:_?u.indent.length:u.indentAtStart,lineWidth:u.options.lineWidth,minContentWidth:u.options.minContentWidth}),L_=(u)=>/^(%|---|\.\.\.)/m.test(u);function y0(u,_,s){if(!_||_<0)return!1;let $=_-s,w=u.length;if(w<=$)return!1;for(let f=0,g=0;f<w;++f)if(u[f]===`
|
|
13
|
+
`){if(f-g>$)return!0;if(g=f+1,w-g<=$)return!1}return!0}function bu(u,_){let s=JSON.stringify(u);if(_.options.doubleQuotedAsJSON)return s;let{implicitKey:$}=_,w=_.options.doubleQuotedMinMultiLineLength,f=_.indent||(L_(u)?" ":""),g="",i=0;for(let R=0,S=s[R];S;S=s[++R]){if(S===" "&&s[R+1]==="\\"&&s[R+2]==="n")g+=s.slice(i,R)+"\\ ",R+=1,i=R,S="\\";if(S==="\\")switch(s[R+1]){case"u":{g+=s.slice(i,R);let L=s.substr(R+2,4);switch(L){case"0000":g+="\\0";break;case"0007":g+="\\a";break;case"000b":g+="\\v";break;case"001b":g+="\\e";break;case"0085":g+="\\N";break;case"00a0":g+="\\_";break;case"2028":g+="\\L";break;case"2029":g+="\\P";break;default:if(L.substr(0,2)==="00")g+="\\x"+L.substr(2);else g+=s.substr(R,6)}R+=5,i=R+1}break;case"n":if($||s[R+2]==='"'||s.length<w)R+=1;else{g+=s.slice(i,R)+`
|
|
14
|
+
|
|
15
|
+
`;while(s[R+2]==="\\"&&s[R+3]==="n"&&s[R+4]!=='"')g+=`
|
|
16
|
+
`,R+=2;if(g+=f,s[R+2]===" ")g+="\\";R+=1,i=R+1}break;default:R+=1}}return g=i?g+s.slice(i):s,$?g:v.foldFlowLines(g,f,v.FOLD_QUOTED,q_(_,!1))}function gs(u,_){if(_.options.singleQuote===!1||_.implicitKey&&u.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test(u))return bu(u,_);let s=_.indent||(L_(u)?" ":""),$="'"+u.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${s}`)+"'";return _.implicitKey?$:v.foldFlowLines($,s,v.FOLD_FLOW,q_(_,!1))}function Au(u,_){let{singleQuote:s}=_.options,$;if(s===!1)$=bu;else{let w=u.includes('"'),f=u.includes("'");if(w&&!f)$=gs;else if(f&&!w)$=bu;else $=s?gs:bu}return $(u,_)}var is;try{is=new RegExp(`(^|(?<!
|
|
19
19
|
))
|
|
20
20
|
+(?!
|
|
21
|
-
|$)`,"g")}catch{
|
|
21
|
+
|$)`,"g")}catch{is=/\n+(?!\n|$)/g}function T_({comment:u,type:_,value:s},$,w,f){let{blockQuote:g,commentString:i,lineWidth:R}=$.options;if(!g||/\n[\t ]+$/.test(s))return Au(s,$);let S=$.indent||($.forceBlockIndent||L_(s)?" ":""),L=g==="literal"?!0:g==="folded"||_===r.Scalar.BLOCK_FOLDED?!1:_===r.Scalar.BLOCK_LITERAL?!0:!y0(s,R,S.length);if(!s)return L?`|
|
|
22
22
|
`:`>
|
|
23
23
|
`;let I,T;for(T=s.length;T>0;--T){let G=s[T-1];if(G!==`
|
|
24
|
-
`&&G!=="\t"&&G!==" ")break}let
|
|
25
|
-
`);if(H===-1)I="-";else if(s===
|
|
26
|
-
`)
|
|
27
|
-
`)D=U;else break}let F=s.substring(0,D<U?D+1:U);if(F)s=s.substring(F.length),F=F.replace(/\n+/g,`$&${S}`);let
|
|
28
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${S}`),
|
|
29
|
-
${S}${A}`}return s=s.replace(/\n+/g,`$&${S}`),`|${
|
|
30
|
-
${S}${F}${s}${
|
|
31
|
-
`)||
|
|
32
|
-
`)?Au(
|
|
33
|
-
`))return T_(u,_,s,$);if(
|
|
34
|
-
${R}`);if(
|
|
35
|
-
${_.indent}${
|
|
36
|
-
${
|
|
37
|
-
`:"",F){let J=S(F);
|
|
38
|
-
${
|
|
39
|
-
`&&z)
|
|
40
|
-
|
|
41
|
-
`}else
|
|
42
|
-
${s.indent}`}else if(!
|
|
43
|
-
`),Z=A!==-1,
|
|
24
|
+
`&&G!=="\t"&&G!==" ")break}let O=s.substring(T),H=O.indexOf(`
|
|
25
|
+
`);if(H===-1)I="-";else if(s===O||H!==O.length-1){if(I="+",f)f()}else I="";if(O){if(s=s.slice(0,-O.length),O[O.length-1]===`
|
|
26
|
+
`)O=O.slice(0,-1);O=O.replace(is,`$&${S}`)}let q=!1,U,D=-1;for(U=0;U<s.length;++U){let G=s[U];if(G===" ")q=!0;else if(G===`
|
|
27
|
+
`)D=U;else break}let F=s.substring(0,D<U?D+1:U);if(F)s=s.substring(F.length),F=F.replace(/\n+/g,`$&${S}`);let Y=(q?S?"2":"1":"")+I;if(u){if(Y+=" "+i(u.replace(/ ?[\r\n]+/g," ")),w)w()}if(!L){let G=s.replace(/\n+/g,`
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${S}`),W=!1,J=q_($,!0);if(g!=="folded"&&_!==r.Scalar.BLOCK_FOLDED)J.onOverflow=()=>{W=!0};let A=v.foldFlowLines(`${F}${G}${O}`,S,v.FOLD_BLOCK,J);if(!W)return`>${Y}
|
|
29
|
+
${S}${A}`}return s=s.replace(/\n+/g,`$&${S}`),`|${Y}
|
|
30
|
+
${S}${F}${s}${O}`}function d0(u,_,s,$){let{type:w,value:f}=u,{actualString:g,implicitKey:i,indent:R,indentStep:S,inFlow:L}=_;if(i&&f.includes(`
|
|
31
|
+
`)||L&&/[[\]{},]/.test(f))return Au(f,_);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(f))return i||L||!f.includes(`
|
|
32
|
+
`)?Au(f,_):T_(u,_,s,$);if(!i&&!L&&w!==r.Scalar.PLAIN&&f.includes(`
|
|
33
|
+
`))return T_(u,_,s,$);if(L_(f)){if(R==="")return _.forceBlockIndent=!0,T_(u,_,s,$);else if(i&&R===S)return Au(f,_)}let I=f.replace(/\n+/g,`$&
|
|
34
|
+
${R}`);if(g){let T=(q)=>q.default&&q.tag!=="tag:yaml.org,2002:str"&&q.test?.test(I),{compat:O,tags:H}=_.doc.schema;if(H.some(T)||O?.some(T))return Au(f,_)}return i?I:v.foldFlowLines(I,R,v.FOLD_FLOW,q_(_,!1))}function n0(u,_,s,$){let{implicitKey:w,inFlow:f}=_,g=typeof u.value==="string"?u:Object.assign({},u,{value:String(u.value)}),{type:i}=u;if(i!==r.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(g.value))i=r.Scalar.QUOTE_DOUBLE}let R=(L)=>{switch(L){case r.Scalar.BLOCK_FOLDED:case r.Scalar.BLOCK_LITERAL:return w||f?Au(g.value,_):T_(g,_,s,$);case r.Scalar.QUOTE_DOUBLE:return bu(g.value,_);case r.Scalar.QUOTE_SINGLE:return gs(g.value,_);case r.Scalar.PLAIN:return d0(g,_,s,$);default:return null}},S=R(i);if(S===null){let{defaultKeyType:L,defaultStringType:I}=_.options,T=w&&L||I;if(S=R(T),S===null)throw Error(`Unsupported default string type ${T}`)}return S}h0.stringifyString=n0});var Cu=P((o0)=>{var c0=i_(),o=X(),x0=ju(),p0=Eu();function k0(u,_){let s=Object.assign({blockQuote:!0,commentString:x0.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},u.schema.toStringOptions,_),$;switch(s.collectionStyle){case"block":$=!1;break;case"flow":$=!0;break;default:$=null}return{anchors:new Set,doc:u,flowCollectionPadding:s.flowCollectionPadding?" ":"",indent:"",indentStep:typeof s.indent==="number"?" ".repeat(s.indent):" ",inFlow:$,options:s}}function a0(u,_){if(_.tag){let w=u.filter((f)=>f.tag===_.tag);if(w.length>0)return w.find((f)=>f.format===_.format)??w[0]}let s=void 0,$;if(o.isScalar(_)){$=_.value;let w=u.filter((f)=>f.identify?.($));if(w.length>1){let f=w.filter((g)=>g.test);if(f.length>0)w=f}s=w.find((f)=>f.format===_.format)??w.find((f)=>!f.format)}else $=_,s=u.find((w)=>w.nodeClass&&$ instanceof w.nodeClass);if(!s){let w=$?.constructor?.name??($===null?"null":typeof $);throw Error(`Tag not resolved for ${w} value`)}return s}function t0(u,_,{anchors:s,doc:$}){if(!$.directives)return"";let w=[],f=(o.isScalar(u)||o.isCollection(u))&&u.anchor;if(f&&c0.anchorIsValid(f))s.add(f),w.push(`&${f}`);let g=u.tag??(_.default?null:_.tag);if(g)w.push($.directives.tagString(g));return w.join(" ")}function v0(u,_,s,$){if(o.isPair(u))return u.toString(_,s,$);if(o.isAlias(u)){if(_.doc.directives)return u.toString(_);if(_.resolvedAliases?.has(u))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(_.resolvedAliases)_.resolvedAliases.add(u);else _.resolvedAliases=new Set([u]);u=u.resolve(_.doc)}}let w=void 0,f=o.isNode(u)?u:_.doc.createNode(u,{onTagObj:(R)=>w=R});w??(w=a0(_.doc.schema.tags,f));let g=t0(f,w,_);if(g.length>0)_.indentAtStart=(_.indentAtStart??0)+g.length+1;let i=typeof w.stringify==="function"?w.stringify(f,_,s,$):o.isScalar(f)?p0.stringifyString(f,_,s,$):f.toString(_,s,$);if(!g)return i;return o.isScalar(f)||i[0]==="{"||i[0]==="["?`${g} ${i}`:`${g}
|
|
35
|
+
${_.indent}${i}`}o0.createStringifyContext=k0;o0.stringify=v0});var uw=P((sR)=>{var p=X(),o$=B(),e$=Cu(),lu=ju();function _R({key:u,value:_},s,$,w){let{allNullValues:f,doc:g,indent:i,indentStep:R,options:{commentString:S,indentSeq:L,simpleKeys:I}}=s,T=p.isNode(u)&&u.comment||null;if(I){if(T)throw Error("With simple keys, key nodes cannot have comments");if(p.isCollection(u)||!p.isNode(u)&&typeof u==="object")throw Error("With simple keys, collection cannot be used as a key value")}let O=!I&&(!u||T&&_==null&&!s.inFlow||p.isCollection(u)||(p.isScalar(u)?u.type===o$.Scalar.BLOCK_FOLDED||u.type===o$.Scalar.BLOCK_LITERAL:typeof u==="object"));s=Object.assign({},s,{allNullValues:!1,implicitKey:!O&&(I||!f),indent:i+R});let H=!1,q=!1,U=e$.stringify(u,s,()=>H=!0,()=>q=!0);if(!O&&!s.inFlow&&U.length>1024){if(I)throw Error("With simple keys, single line scalar must not span more than 1024 characters");O=!0}if(s.inFlow){if(f||_==null){if(H&&$)$();return U===""?"?":O?`? ${U}`:U}}else if(f&&!I||_==null&&O){if(U=`? ${U}`,T&&!H)U+=lu.lineComment(U,s.indent,S(T));else if(q&&w)w();return U}if(H)T=null;if(O){if(T)U+=lu.lineComment(U,s.indent,S(T));U=`? ${U}
|
|
36
|
+
${i}:`}else if(U=`${U}:`,T)U+=lu.lineComment(U,s.indent,S(T));let D,F,z;if(p.isNode(_))D=!!_.spaceBefore,F=_.commentBefore,z=_.comment;else if(D=!1,F=null,z=null,_&&typeof _==="object")_=g.createNode(_);if(s.implicitKey=!1,!O&&!T&&p.isScalar(_))s.indentAtStart=U.length+1;if(q=!1,!L&&R.length>=2&&!s.inFlow&&!O&&p.isSeq(_)&&!_.flow&&!_.tag&&!_.anchor)s.indent=s.indent.substring(2);let Y=!1,G=e$.stringify(_,s,()=>Y=!0,()=>q=!0),W=" ";if(T||D||F){if(W=D?`
|
|
37
|
+
`:"",F){let J=S(F);W+=`
|
|
38
|
+
${lu.indentComment(J,s.indent)}`}if(G===""&&!s.inFlow){if(W===`
|
|
39
|
+
`&&z)W=`
|
|
40
|
+
|
|
41
|
+
`}else W+=`
|
|
42
|
+
${s.indent}`}else if(!O&&p.isCollection(_)){let J=G[0],A=G.indexOf(`
|
|
43
|
+
`),Z=A!==-1,a=s.inFlow??_.flow??_.items.length===0;if(Z||!a){let Uu=!1;if(Z&&(J==="&"||J==="!")){let M=G.indexOf(" ");if(J==="&"&&M!==-1&&M<A&&G[M+1]==="!")M=G.indexOf(" ",M+1);if(M===-1||A<M)Uu=!0}if(!Uu)W=`
|
|
44
44
|
${s.indent}`}}else if(G===""||G[0]===`
|
|
45
|
-
`)
|
|
45
|
+
`)W="";if(U+=W+G,s.inFlow){if(Y&&$)$()}else if(z&&!Y)U+=lu.lineComment(U,s.indent,S(z));else if(q&&w)w();return U}sR.stringifyPair=_R});var Rs=P((gR)=>{var _w=s_("process");function wR(u,..._){if(u==="debug")console.log(..._)}function fR(u,_){if(u==="debug"||u==="warn")if(typeof _w.emitWarning==="function")_w.emitWarning(_);else console.warn(_)}gR.debug=wR;gR.warn=fR});var P_=P((IR)=>{var H_=X(),sw=B(),O_="<<",U_={identify:(u)=>u===O_||typeof u==="symbol"&&u.description===O_,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new sw.Scalar(Symbol(O_)),{addToJSMap:$w}),stringify:()=>O_},SR=(u,_)=>(U_.identify(_)||H_.isScalar(_)&&(!_.type||_.type===sw.Scalar.PLAIN)&&U_.identify(_.value))&&u?.doc.schema.tags.some((s)=>s.tag===U_.tag&&s.default);function $w(u,_,s){let $=ww(u,s);if(H_.isSeq($))for(let w of $.items)Ss(u,_,w);else if(Array.isArray($))for(let w of $)Ss(u,_,w);else Ss(u,_,$)}function Ss(u,_,s){let $=ww(u,s);if(!H_.isMap($))throw Error("Merge sources must be maps or map aliases");let w=$.toJSON(null,u,Map);for(let[f,g]of w)if(_ instanceof Map){if(!_.has(f))_.set(f,g)}else if(_ instanceof Set)_.add(f);else if(!Object.prototype.hasOwnProperty.call(_,f))Object.defineProperty(_,f,{value:g,writable:!0,enumerable:!0,configurable:!0});return _}function ww(u,_){return u&&H_.isAlias(_)?_.resolve(u.doc,u):_}IR.addMergeToJSMap=$w;IR.isMergeKey=SR;IR.merge=U_});var Ts=P((DR)=>{var OR=Rs(),fw=P_(),UR=Cu(),gw=X(),Is=t();function HR(u,_,{key:s,value:$}){if(gw.isNode(s)&&s.addToJSMap)s.addToJSMap(u,_,$);else if(fw.isMergeKey(u,s))fw.addMergeToJSMap(u,_,$);else{let w=Is.toJS(s,"",u);if(_ instanceof Map)_.set(w,Is.toJS($,w,u));else if(_ instanceof Set)_.add(w);else{let f=PR(s,w,u),g=Is.toJS($,f,u);if(f in _)Object.defineProperty(_,f,{value:g,writable:!0,enumerable:!0,configurable:!0});else _[f]=g}}return _}function PR(u,_,s){if(_===null)return"";if(typeof _!=="object")return String(_);if(gw.isNode(u)&&s?.doc){let $=UR.createStringifyContext(s.doc,{});$.anchors=new Set;for(let f of s.anchors.keys())$.anchors.add(f.anchor);$.inFlow=!0,$.inStringifyKey=!0;let w=u.toString($);if(!s.mapKeyWarned){let f=JSON.stringify(w);if(f.length>40)f=f.substring(0,36)+'..."';OR.warn(s.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${f}. Set mapAsMap: true to use object keys.`),s.mapKeyWarned=!0}return w}return JSON.stringify(_)}DR.addPairToJSMap=HR});var e=P((GR)=>{var iw=Vu(),FR=uw(),zR=Ts(),D_=X();function YR(u,_,s){let $=iw.createNode(u,void 0,s),w=iw.createNode(_,void 0,s);return new A_($,w)}class A_{constructor(u,_=null){Object.defineProperty(this,D_.NODE_TYPE,{value:D_.PAIR}),this.key=u,this.value=_}clone(u){let{key:_,value:s}=this;if(D_.isNode(_))_=_.clone(u);if(D_.isNode(s))s=s.clone(u);return new A_(_,s)}toJSON(u,_){let s=_?.mapAsMap?new Map:{};return zR.addPairToJSMap(_,s,this)}toString(u,_,s){return u?.doc?FR.stringifyPair(this,u,_,s):JSON.stringify(this)}}GR.Pair=A_;GR.createPair=YR});var qs=P((MR)=>{var Su=X(),Rw=Cu(),F_=ju();function JR(u,_,s){return(_.inFlow??u.flow?ZR:BR)(u,_,s)}function BR({comment:u,items:_},s,{blockItemPrefix:$,flowChars:w,itemIndent:f,onChompKeep:g,onComment:i}){let{indent:R,options:{commentString:S}}=s,L=Object.assign({},s,{indent:f,type:null}),I=!1,T=[];for(let H=0;H<_.length;++H){let q=_[H],U=null;if(Su.isNode(q)){if(!I&&q.spaceBefore)T.push("");if(z_(s,T,q.commentBefore,I),q.comment)U=q.comment}else if(Su.isPair(q)){let F=Su.isNode(q.key)?q.key:null;if(F){if(!I&&F.spaceBefore)T.push("");z_(s,T,F.commentBefore,I)}}I=!1;let D=Rw.stringify(q,L,()=>U=null,()=>I=!0);if(U)D+=F_.lineComment(D,f,S(U));if(I&&U)I=!1;T.push($+D)}let O;if(T.length===0)O=w.start+w.end;else{O=T[0];for(let H=1;H<T.length;++H){let q=T[H];O+=q?`
|
|
46
46
|
${R}${q}`:`
|
|
47
|
-
`}}if(u){if(
|
|
48
|
-
`+F_.indentComment(S(u),R),
|
|
49
|
-
`)),H<u.length-1)D+=",";else if(_.options.trailingComma){if(_.options.lineWidth>0)S||(S=I.reduce((F,z)=>F+z.length+2,2)+(D.length+2)>_.options.lineWidth);if(S)D+=","}if(U)D+=F_.lineComment(D,$,
|
|
50
|
-
${
|
|
47
|
+
`}}if(u){if(O+=`
|
|
48
|
+
`+F_.indentComment(S(u),R),i)i()}else if(I&&g)g();return O}function ZR({items:u},_,{flowChars:s,itemIndent:$}){let{indent:w,indentStep:f,flowCollectionPadding:g,options:{commentString:i}}=_;$+=f;let R=Object.assign({},_,{indent:$,inFlow:!0,type:null}),S=!1,L=0,I=[];for(let H=0;H<u.length;++H){let q=u[H],U=null;if(Su.isNode(q)){if(q.spaceBefore)I.push("");if(z_(_,I,q.commentBefore,!1),q.comment)U=q.comment}else if(Su.isPair(q)){let F=Su.isNode(q.key)?q.key:null;if(F){if(F.spaceBefore)I.push("");if(z_(_,I,F.commentBefore,!1),F.comment)S=!0}let z=Su.isNode(q.value)?q.value:null;if(z){if(z.comment)U=z.comment;if(z.commentBefore)S=!0}else if(q.value==null&&F?.comment)U=F.comment}if(U)S=!0;let D=Rw.stringify(q,R,()=>U=null);if(S||(S=I.length>L||D.includes(`
|
|
49
|
+
`)),H<u.length-1)D+=",";else if(_.options.trailingComma){if(_.options.lineWidth>0)S||(S=I.reduce((F,z)=>F+z.length+2,2)+(D.length+2)>_.options.lineWidth);if(S)D+=","}if(U)D+=F_.lineComment(D,$,i(U));I.push(D),L=I.length}let{start:T,end:O}=s;if(I.length===0)return T+O;else{if(!S){let H=I.reduce((q,U)=>q+U.length+2,2);S=_.options.lineWidth>0&&H>_.options.lineWidth}if(S){let H=T;for(let q of I)H+=q?`
|
|
50
|
+
${f}${w}${q}`:`
|
|
51
51
|
`;return`${H}
|
|
52
|
-
${
|
|
53
|
-
`:" ")}return nS.stringifyString({comment:u,type:_,value:
|
|
54
|
-
${
|
|
55
|
-
${w.comment}`:$.comment}$=f}u.items[s]=Z_.isPair($)?$:new Ws.Pair($)}else _("Expected a sequence for this tag");return u}function Gf(u,_,s){let{replacer:$}=s,f=new aS.YAMLSeq(u);f.tag="tag:yaml.org,2002:pairs";let w=0;if(_&&Symbol.iterator in Object(_))for(let i of _){if(typeof $==="function")i=$.call(_,String(w++),i);let g,R;if(Array.isArray(i))if(i.length===2)g=i[0],R=i[1];else throw TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){let S=Object.keys(i);if(S.length===1)g=S[0],R=i[g];else throw TypeError(`Expected tuple with one key, not ${S.length} keys`)}else g=i;f.items.push(Ws.createPair(g,R,s))}return f}var kS={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Wf,createNode:Gf};xS.createPairs=Gf;xS.pairs=kS;xS.resolvePairs=Wf});var Xs=P((_I)=>{var Xf=r(),Gs=t(),du=_u(),eS=su(),rf=Y_();class Iu extends eS.YAMLSeq{constructor(){super();this.add=du.YAMLMap.prototype.add.bind(this),this.delete=du.YAMLMap.prototype.delete.bind(this),this.get=du.YAMLMap.prototype.get.bind(this),this.has=du.YAMLMap.prototype.has.bind(this),this.set=du.YAMLMap.prototype.set.bind(this),this.tag=Iu.tag}toJSON(u,_){if(!_)return super.toJSON(u);let s=new Map;if(_?.onCreate)_.onCreate(s);for(let $ of this.items){let f,w;if(Xf.isPair($))f=Gs.toJS($.key,"",_),w=Gs.toJS($.value,f,_);else f=Gs.toJS($,"",_);if(s.has(f))throw Error("Ordered maps must not include duplicate keys");s.set(f,w)}return s}static from(u,_,s){let $=rf.createPairs(u,_,s),f=new this;return f.items=$.items,f}}Iu.tag="tag:yaml.org,2002:omap";var uI={collection:"seq",identify:(u)=>u instanceof Map,nodeClass:Iu,default:!1,tag:"tag:yaml.org,2002:omap",resolve(u,_){let s=rf.resolvePairs(u,_),$=[];for(let{key:f}of s.items)if(Xf.isScalar(f))if($.includes(f.value))_(`Ordered maps must not include duplicate keys: ${f.value}`);else $.push(f.value);return Object.assign(new Iu,s)},createNode:(u,_,s)=>Iu.from(u,_,s)};_I.YAMLOMap=Iu;_I.omap=uI});var jf=P((fI)=>{var Jf=B();function Bf({value:u,source:_},s){if(_&&(u?Zf:Yf).test.test(_))return _;return u?s.options.trueStr:s.options.falseStr}var Zf={identify:(u)=>u===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Jf.Scalar(!0),stringify:Bf},Yf={identify:(u)=>u===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Jf.Scalar(!1),stringify:Bf};fI.falseTag=Yf;fI.trueTag=Zf});var Qf=P((TI)=>{var gI=B(),rs=Wu(),RI={identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(u)=>u.slice(-3).toLowerCase()==="nan"?NaN:u[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:rs.stringifyNumber},SI={identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(u)=>parseFloat(u.replace(/_/g,"")),stringify(u){let _=Number(u.value);return isFinite(_)?_.toExponential():rs.stringifyNumber(u)}},II={identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(u){let _=new gI.Scalar(parseFloat(u.replace(/_/g,""))),s=u.indexOf(".");if(s!==-1){let $=u.substring(s+1).replace(/_/g,"");if($[$.length-1]==="0")_.minFractionDigits=$.length}return _},stringify:rs.stringifyNumber};TI.float=II;TI.floatExp=SI;TI.floatNaN=RI});var Vf=P((AI)=>{var Nf=Wu(),nu=(u)=>typeof u==="bigint"||Number.isInteger(u);function j_(u,_,s,{intAsBigInt:$}){let f=u[0];if(f==="-"||f==="+")_+=1;if(u=u.substring(_).replace(/_/g,""),$){switch(s){case 2:u=`0b${u}`;break;case 8:u=`0o${u}`;break;case 16:u=`0x${u}`;break}let i=BigInt(u);return f==="-"?BigInt(-1)*i:i}let w=parseInt(u,s);return f==="-"?-1*w:w}function Js(u,_,s){let{value:$}=u;if(nu($)){let f=$.toString(_);return $<0?"-"+s+f.substr(1):s+f}return Nf.stringifyNumber(u)}var UI={identify:nu,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(u,_,s)=>j_(u,2,2,s),stringify:(u)=>Js(u,2,"0b")},HI={identify:nu,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(u,_,s)=>j_(u,1,8,s),stringify:(u)=>Js(u,8,"0")},PI={identify:nu,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(u,_,s)=>j_(u,0,10,s),stringify:Nf.stringifyNumber},DI={identify:nu,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(u,_,s)=>j_(u,2,16,s),stringify:(u)=>Js(u,16,"0x")};AI.int=PI;AI.intBin=UI;AI.intHex=DI;AI.intOct=HI});var Bs=P((rI)=>{var V_=r(),Q_=e(),N_=_u();class Tu extends N_.YAMLMap{constructor(u){super(u);this.tag=Tu.tag}add(u){let _;if(V_.isPair(u))_=u;else if(u&&typeof u==="object"&&"key"in u&&"value"in u&&u.value===null)_=new Q_.Pair(u.key,null);else _=new Q_.Pair(u,null);if(!N_.findPair(this.items,_.key))this.items.push(_)}get(u,_){let s=N_.findPair(this.items,u);return!_&&V_.isPair(s)?V_.isScalar(s.key)?s.key.value:s.key:s}set(u,_){if(typeof _!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof _}`);let s=N_.findPair(this.items,u);if(s&&!_)this.items.splice(this.items.indexOf(s),1);else if(!s&&_)this.items.push(new Q_.Pair(u))}toJSON(u,_){return super.toJSON(u,_,Set)}toString(u,_,s){if(!u)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},u,{allNullValues:!0}),_,s);else throw Error("Set items must all have null values")}static from(u,_,s){let{replacer:$}=s,f=new this(u);if(_&&Symbol.iterator in Object(_))for(let w of _){if(typeof $==="function")w=$.call(_,w,w);f.items.push(Q_.createPair(w,null,s))}return f}}Tu.tag="tag:yaml.org,2002:set";var XI={collection:"map",identify:(u)=>u instanceof Set,nodeClass:Tu,default:!1,tag:"tag:yaml.org,2002:set",createNode:(u,_,s)=>Tu.from(u,_,s),resolve(u,_){if(V_.isMap(u))if(u.hasAllNullValues(!0))return Object.assign(new Tu,u);else _("Set items must all have null values");else _("Expected a mapping for this tag");return u}};rI.YAMLSet=Tu;rI.set=XI});var Ys=P((QI)=>{var ZI=Wu();function Zs(u,_){let s=u[0],$=s==="-"||s==="+"?u.substring(1):u,f=(i)=>_?BigInt(i):Number(i),w=$.replace(/_/g,"").split(":").reduce((i,g)=>i*f(60)+f(g),f(0));return s==="-"?f(-1)*w:w}function Mf(u){let{value:_}=u,s=(i)=>i;if(typeof _==="bigint")s=(i)=>BigInt(i);else if(isNaN(_)||!isFinite(_))return ZI.stringifyNumber(u);let $="";if(_<0)$="-",_*=s(-1);let f=s(60),w=[_%f];if(_<60)w.unshift(0);else if(_=(_-w[0])/f,w.unshift(_%f),_>=60)_=(_-w[0])/f,w.unshift(_);return $+w.map((i)=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var YI={identify:(u)=>typeof u==="bigint"||Number.isInteger(u),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(u,_,{intAsBigInt:s})=>Zs(u,s),stringify:Mf},jI={identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(u)=>Zs(u,!1),stringify:Mf},bf={identify:(u)=>u 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(u){let _=u.match(bf.test);if(!_)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,s,$,f,w,i,g]=_.map(Number),R=_[7]?Number((_[7]+"00").substr(1,3)):0,S=Date.UTC(s,$-1,f,w||0,i||0,g||0,R),O=_[8];if(O&&O!=="Z"){let I=Zs(O,!1);if(Math.abs(I)<30)I*=60;S-=60000*I}return new Date(S)},stringify:({value:u})=>u?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};QI.floatTime=jI;QI.intTime=YI;QI.timestamp=bf});var Cf=P((cI)=>{var bI=Fu(),EI=r_(),CI=zu(),lI=Ku(),KI=zs(),Ef=jf(),js=Qf(),M_=Vf(),yI=P_(),dI=Xs(),nI=Y_(),hI=Bs(),Qs=Ys(),pI=[bI.map,CI.seq,lI.string,EI.nullTag,Ef.trueTag,Ef.falseTag,M_.intBin,M_.intOct,M_.int,M_.intHex,js.floatNaN,js.floatExp,js.float,KI.binary,yI.merge,dI.omap,nI.pairs,hI.set,Qs.intTime,Qs.floatTime,Qs.timestamp];cI.schema=pI});var af=P((uT)=>{var df=Fu(),aI=r_(),nf=zu(),kI=Ku(),xI=Os(),Ns=Us(),Vs=Ps(),tI=Af(),vI=zf(),hf=zs(),hu=P_(),pf=Xs(),cf=Y_(),lf=Cf(),mf=Bs(),b_=Ys(),Kf=new Map([["core",tI.schema],["failsafe",[df.map,nf.seq,kI.string]],["json",vI.schema],["yaml11",lf.schema],["yaml-1.1",lf.schema]]),yf={binary:hf.binary,bool:xI.boolTag,float:Ns.float,floatExp:Ns.floatExp,floatNaN:Ns.floatNaN,floatTime:b_.floatTime,int:Vs.int,intHex:Vs.intHex,intOct:Vs.intOct,intTime:b_.intTime,map:df.map,merge:hu.merge,null:aI.nullTag,omap:pf.omap,pairs:cf.pairs,seq:nf.seq,set:mf.set,timestamp:b_.timestamp},oI={"tag:yaml.org,2002:binary":hf.binary,"tag:yaml.org,2002:merge":hu.merge,"tag:yaml.org,2002:omap":pf.omap,"tag:yaml.org,2002:pairs":cf.pairs,"tag:yaml.org,2002:set":mf.set,"tag:yaml.org,2002:timestamp":b_.timestamp};function eI(u,_,s){let $=Kf.get(_);if($&&!u)return s&&!$.includes(hu.merge)?$.concat(hu.merge):$.slice();let f=$;if(!f)if(Array.isArray(u))f=[];else{let w=Array.from(Kf.keys()).filter((i)=>i!=="yaml11").map((i)=>JSON.stringify(i)).join(", ");throw Error(`Unknown schema "${_}"; use one of ${w} or define customTags array`)}if(Array.isArray(u))for(let w of u)f=f.concat(w);else if(typeof u==="function")f=u(f.slice());if(s)f=f.concat(hu.merge);return f.reduce((w,i)=>{let g=typeof i==="string"?yf[i]:i;if(!g){let R=JSON.stringify(i),S=Object.keys(yf).map((O)=>JSON.stringify(O)).join(", ");throw Error(`Unknown custom tag ${R}; use one of ${S}`)}if(!w.includes(g))w.push(g);return w},[])}uT.coreKnownTags=oI;uT.getTags=eI});var Es=P((gT)=>{var Ms=r(),$T=Fu(),fT=zu(),wT=Ku(),E_=af(),iT=(u,_)=>u.key<_.key?-1:u.key>_.key?1:0;class bs{constructor({compat:u,customTags:_,merge:s,resolveKnownTags:$,schema:f,sortMapEntries:w,toStringDefaults:i}){this.compat=Array.isArray(u)?E_.getTags(u,"compat"):u?E_.getTags(null,u):null,this.name=typeof f==="string"&&f||"core",this.knownTags=$?E_.coreKnownTags:{},this.tags=E_.getTags(_,this.name,s),this.toStringOptions=i??null,Object.defineProperty(this,Ms.MAP,{value:$T.map}),Object.defineProperty(this,Ms.SCALAR,{value:wT.string}),Object.defineProperty(this,Ms.SEQ,{value:fT.seq}),this.sortMapEntries=typeof w==="function"?w:w===!0?iT:null}clone(){let u=Object.create(bs.prototype,Object.getOwnPropertyDescriptors(this));return u.tags=this.tags.slice(),u}}gT.Schema=bs});var kf=P((TT)=>{var ST=r(),Cs=Eu(),pu=Vu();function IT(u,_){let s=[],$=_.directives===!0;if(_.directives!==!1&&u.directives){let R=u.directives.toString(u);if(R)s.push(R),$=!0;else if(u.directives.docStart)$=!0}if($)s.push("---");let f=Cs.createStringifyContext(u,_),{commentString:w}=f.options;if(u.commentBefore){if(s.length!==1)s.unshift("");let R=w(u.commentBefore);s.unshift(pu.indentComment(R,""))}let i=!1,g=null;if(u.contents){if(ST.isNode(u.contents)){if(u.contents.spaceBefore&&$)s.push("");if(u.contents.commentBefore){let O=w(u.contents.commentBefore);s.push(pu.indentComment(O,""))}f.forceBlockIndent=!!u.comment,g=u.contents.comment}let R=g?void 0:()=>i=!0,S=Cs.stringify(u.contents,f,()=>g=null,R);if(g)S+=pu.lineComment(S,"",w(g));if((S[0]==="|"||S[0]===">")&&s[s.length-1]==="---")s[s.length-1]=`--- ${S}`;else s.push(S)}else s.push(Cs.stringify(u.contents,f));if(u.directives?.docEnd)if(u.comment){let R=w(u.comment);if(R.includes(`
|
|
56
|
-
`))s.push("..."),s.push(
|
|
52
|
+
${w}${O}`}else return`${T}${g}${I.join(" ")}${g}${O}`}}function z_({indent:u,options:{commentString:_}},s,$,w){if($&&w)$=$.replace(/^\n+/,"");if($){let f=F_.indentComment(_($),u);s.push(f.trimStart())}}MR.stringifyCollection=JR});var _u=P((ER)=>{var NR=qs(),VR=Ts(),jR=I_(),uu=X(),Y_=e(),bR=B();function Ku(u,_){let s=uu.isScalar(_)?_.value:_;for(let $ of u)if(uu.isPair($)){if($.key===_||$.key===s)return $;if(uu.isScalar($.key)&&$.key.value===s)return $}return}class Sw extends jR.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(u){super(uu.MAP,u);this.items=[]}static from(u,_,s){let{keepUndefined:$,replacer:w}=s,f=new this(u),g=(i,R)=>{if(typeof w==="function")R=w.call(_,i,R);else if(Array.isArray(w)&&!w.includes(i))return;if(R!==void 0||$)f.items.push(Y_.createPair(i,R,s))};if(_ instanceof Map)for(let[i,R]of _)g(i,R);else if(_&&typeof _==="object")for(let i of Object.keys(_))g(i,_[i]);if(typeof u.sortMapEntries==="function")f.items.sort(u.sortMapEntries);return f}add(u,_){let s;if(uu.isPair(u))s=u;else if(!u||typeof u!=="object"||!("key"in u))s=new Y_.Pair(u,u?.value);else s=new Y_.Pair(u.key,u.value);let $=Ku(this.items,s.key),w=this.schema?.sortMapEntries;if($){if(!_)throw Error(`Key ${s.key} already set`);if(uu.isScalar($.value)&&bR.isScalarValue(s.value))$.value.value=s.value;else $.value=s.value}else if(w){let f=this.items.findIndex((g)=>w(s,g)<0);if(f===-1)this.items.push(s);else this.items.splice(f,0,s)}else this.items.push(s)}delete(u){let _=Ku(this.items,u);if(!_)return!1;return this.items.splice(this.items.indexOf(_),1).length>0}get(u,_){let $=Ku(this.items,u)?.value;return(!_&&uu.isScalar($)?$.value:$)??void 0}has(u){return!!Ku(this.items,u)}set(u,_){this.add(new Y_.Pair(u,_),!0)}toJSON(u,_,s){let $=s?new s:_?.mapAsMap?new Map:{};if(_?.onCreate)_.onCreate($);for(let w of this.items)VR.addPairToJSMap(_,$,w);return $}toString(u,_,s){if(!u)return JSON.stringify(this);for(let $ of this.items)if(!uu.isPair($))throw Error(`Map items must all be pairs; found ${JSON.stringify($)} instead`);if(!u.allNullValues&&this.hasAllNullValues(!1))u=Object.assign({},u,{allNullValues:!0});return NR.stringifyCollection(this,u,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:u.indent||"",onChompKeep:s,onComment:_})}}ER.YAMLMap=Sw;ER.findPair=Ku});var Fu=P((yR)=>{var KR=X(),Iw=_u(),rR={collection:"map",default:!0,nodeClass:Iw.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(u,_){if(!KR.isMap(u))_("Expected a mapping for this tag");return u},createNode:(u,_,s)=>Iw.YAMLMap.from(u,_,s)};yR.map=rR});var su=P((pR)=>{var nR=Vu(),hR=qs(),mR=I_(),W_=X(),cR=B(),xR=t();class Tw extends mR.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(u){super(W_.SEQ,u);this.items=[]}add(u){this.items.push(u)}delete(u){let _=G_(u);if(typeof _!=="number")return!1;return this.items.splice(_,1).length>0}get(u,_){let s=G_(u);if(typeof s!=="number")return;let $=this.items[s];return!_&&W_.isScalar($)?$.value:$}has(u){let _=G_(u);return typeof _==="number"&&_<this.items.length}set(u,_){let s=G_(u);if(typeof s!=="number")throw Error(`Expected a valid index, not ${u}.`);let $=this.items[s];if(W_.isScalar($)&&cR.isScalarValue(_))$.value=_;else this.items[s]=_}toJSON(u,_){let s=[];if(_?.onCreate)_.onCreate(s);let $=0;for(let w of this.items)s.push(xR.toJS(w,String($++),_));return s}toString(u,_,s){if(!u)return JSON.stringify(this);return hR.stringifyCollection(this,u,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(u.indent||"")+" ",onChompKeep:s,onComment:_})}static from(u,_,s){let{replacer:$}=s,w=new this(u);if(_&&Symbol.iterator in Object(_)){let f=0;for(let g of _){if(typeof $==="function"){let i=_ instanceof Set?g:String(f++);g=$.call(_,i,g)}w.items.push(nR.createNode(g,void 0,s))}}return w}}function G_(u){let _=W_.isScalar(u)?u.value:u;if(_&&typeof _==="string")_=Number(_);return typeof _==="number"&&Number.isInteger(_)&&_>=0?_:null}pR.YAMLSeq=Tw});var zu=P((vR)=>{var aR=X(),qw=su(),tR={collection:"seq",default:!0,nodeClass:qw.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(u,_){if(!aR.isSeq(u))_("Expected a sequence for this tag");return u},createNode:(u,_,s)=>qw.YAMLSeq.from(u,_,s)};vR.seq=tR});var ru=P((_S)=>{var eR=Eu(),uS={identify:(u)=>typeof u==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(u)=>u,stringify(u,_,s,$){return _=Object.assign({actualString:!0},_),eR.stringifyString(u,_,s,$)}};_S.string=uS});var X_=P(($S)=>{var Lw=B(),Ow={identify:(u)=>u==null,createNode:()=>new Lw.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Lw.Scalar(null),stringify:({source:u},_)=>typeof u==="string"&&Ow.test.test(u)?u:_.options.nullStr};$S.nullTag=Ow});var Ls=P((gS)=>{var fS=B(),Uw={identify:(u)=>typeof u==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(u)=>new fS.Scalar(u[0]==="t"||u[0]==="T"),stringify({source:u,value:_},s){if(u&&Uw.test.test(u)){let $=u[0]==="t"||u[0]==="T";if(_===$)return u}return _?s.options.trueStr:s.options.falseStr}};gS.boolTag=Uw});var Yu=P((SS)=>{function RS({format:u,minFractionDigits:_,tag:s,value:$}){if(typeof $==="bigint")return String($);let w=typeof $==="number"?$:Number($);if(!isFinite(w))return isNaN(w)?".nan":w<0?"-.inf":".inf";let f=Object.is($,-0)?"-0":JSON.stringify($);if(!u&&_&&(!s||s==="tag:yaml.org,2002:float")&&/^-?\d/.test(f)&&!f.includes("e")){let g=f.indexOf(".");if(g<0)g=f.length,f+=".";let i=_-(f.length-g-1);while(i-- >0)f+="0"}return f}SS.stringifyNumber=RS});var Us=P((US)=>{var TS=B(),Os=Yu(),qS={identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(u)=>u.slice(-3).toLowerCase()==="nan"?NaN:u[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Os.stringifyNumber},LS={identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(u)=>parseFloat(u),stringify(u){let _=Number(u.value);return isFinite(_)?_.toExponential():Os.stringifyNumber(u)}},OS={identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(u){let _=new TS.Scalar(parseFloat(u)),s=u.indexOf(".");if(s!==-1&&u[u.length-1]==="0")_.minFractionDigits=u.length-s-1;return _},stringify:Os.stringifyNumber};US.float=OS;US.floatExp=LS;US.floatNaN=qS});var Ps=P((YS)=>{var Hw=Yu(),J_=(u)=>typeof u==="bigint"||Number.isInteger(u),Hs=(u,_,s,{intAsBigInt:$})=>$?BigInt(u):parseInt(u.substring(_),s);function Pw(u,_,s){let{value:$}=u;if(J_($)&&$>=0)return s+$.toString(_);return Hw.stringifyNumber(u)}var AS={identify:(u)=>J_(u)&&u>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(u,_,s)=>Hs(u,2,8,s),stringify:(u)=>Pw(u,8,"0o")},FS={identify:J_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(u,_,s)=>Hs(u,0,10,s),stringify:Hw.stringifyNumber},zS={identify:(u)=>J_(u)&&u>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(u,_,s)=>Hs(u,2,16,s),stringify:(u)=>Pw(u,16,"0x")};YS.int=FS;YS.intHex=zS;YS.intOct=AS});var Dw=P((VS)=>{var JS=Fu(),BS=X_(),ZS=zu(),MS=ru(),QS=Ls(),Ds=Us(),As=Ps(),NS=[JS.map,ZS.seq,MS.string,BS.nullTag,QS.boolTag,As.intOct,As.int,As.intHex,Ds.floatNaN,Ds.floatExp,Ds.float];VS.schema=NS});var Fw=P((yS)=>{var bS=B(),ES=Fu(),CS=zu();function Aw(u){return typeof u==="bigint"||Number.isInteger(u)}var B_=({value:u})=>JSON.stringify(u),lS=[{identify:(u)=>typeof u==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(u)=>u,stringify:B_},{identify:(u)=>u==null,createNode:()=>new bS.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:B_},{identify:(u)=>typeof u==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(u)=>u==="true",stringify:B_},{identify:Aw,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(u,_,{intAsBigInt:s})=>s?BigInt(u):parseInt(u,10),stringify:({value:u})=>Aw(u)?u.toString():JSON.stringify(u)},{identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(u)=>parseFloat(u),stringify:B_}],KS={default:!0,tag:"",test:/^/,resolve(u,_){return _(`Unresolved plain scalar ${JSON.stringify(u)}`),u}},rS=[ES.map,CS.seq].concat(lS,KS);yS.schema=rS});var zs=P((mS)=>{var yu=s_("buffer"),Fs=B(),nS=Eu(),hS={identify:(u)=>u instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(u,_){if(typeof yu.Buffer==="function")return yu.Buffer.from(u,"base64");else if(typeof atob==="function"){let s=atob(u.replace(/[\n\r]/g,"")),$=new Uint8Array(s.length);for(let w=0;w<s.length;++w)$[w]=s.charCodeAt(w);return $}else return _("This environment does not support reading binary tags; either Buffer or atob is required"),u},stringify({comment:u,type:_,value:s},$,w,f){if(!s)return"";let g=s,i;if(typeof yu.Buffer==="function")i=g instanceof yu.Buffer?g.toString("base64"):yu.Buffer.from(g.buffer).toString("base64");else if(typeof btoa==="function"){let R="";for(let S=0;S<g.length;++S)R+=String.fromCharCode(g[S]);i=btoa(R)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(_??(_=Fs.Scalar.BLOCK_LITERAL),_!==Fs.Scalar.QUOTE_DOUBLE){let R=Math.max($.options.lineWidth-$.indent.length,$.options.minContentWidth),S=Math.ceil(i.length/R),L=Array(S);for(let I=0,T=0;I<S;++I,T+=R)L[I]=i.substr(T,R);i=L.join(_===Fs.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return nS.stringifyString({comment:u,type:_,value:i},$,w,f)}};mS.binary=hS});var M_=P((aS)=>{var Z_=X(),Ys=e(),xS=B(),pS=su();function zw(u,_){if(Z_.isSeq(u))for(let s=0;s<u.items.length;++s){let $=u.items[s];if(Z_.isPair($))continue;else if(Z_.isMap($)){if($.items.length>1)_("Each pair must have its own sequence indicator");let w=$.items[0]||new Ys.Pair(new xS.Scalar(null));if($.commentBefore)w.key.commentBefore=w.key.commentBefore?`${$.commentBefore}
|
|
54
|
+
${w.key.commentBefore}`:$.commentBefore;if($.comment){let f=w.value??w.key;f.comment=f.comment?`${$.comment}
|
|
55
|
+
${f.comment}`:$.comment}$=w}u.items[s]=Z_.isPair($)?$:new Ys.Pair($)}else _("Expected a sequence for this tag");return u}function Yw(u,_,s){let{replacer:$}=s,w=new pS.YAMLSeq(u);w.tag="tag:yaml.org,2002:pairs";let f=0;if(_&&Symbol.iterator in Object(_))for(let g of _){if(typeof $==="function")g=$.call(_,String(f++),g);let i,R;if(Array.isArray(g))if(g.length===2)i=g[0],R=g[1];else throw TypeError(`Expected [key, value] tuple: ${g}`);else if(g&&g instanceof Object){let S=Object.keys(g);if(S.length===1)i=S[0],R=g[i];else throw TypeError(`Expected tuple with one key, not ${S.length} keys`)}else i=g;w.items.push(Ys.createPair(i,R,s))}return w}var kS={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:zw,createNode:Yw};aS.createPairs=Yw;aS.pairs=kS;aS.resolvePairs=zw});var Ws=P((_I)=>{var Gw=X(),Gs=t(),du=_u(),eS=su(),Ww=M_();class Iu extends eS.YAMLSeq{constructor(){super();this.add=du.YAMLMap.prototype.add.bind(this),this.delete=du.YAMLMap.prototype.delete.bind(this),this.get=du.YAMLMap.prototype.get.bind(this),this.has=du.YAMLMap.prototype.has.bind(this),this.set=du.YAMLMap.prototype.set.bind(this),this.tag=Iu.tag}toJSON(u,_){if(!_)return super.toJSON(u);let s=new Map;if(_?.onCreate)_.onCreate(s);for(let $ of this.items){let w,f;if(Gw.isPair($))w=Gs.toJS($.key,"",_),f=Gs.toJS($.value,w,_);else w=Gs.toJS($,"",_);if(s.has(w))throw Error("Ordered maps must not include duplicate keys");s.set(w,f)}return s}static from(u,_,s){let $=Ww.createPairs(u,_,s),w=new this;return w.items=$.items,w}}Iu.tag="tag:yaml.org,2002:omap";var uI={collection:"seq",identify:(u)=>u instanceof Map,nodeClass:Iu,default:!1,tag:"tag:yaml.org,2002:omap",resolve(u,_){let s=Ww.resolvePairs(u,_),$=[];for(let{key:w}of s.items)if(Gw.isScalar(w))if($.includes(w.value))_(`Ordered maps must not include duplicate keys: ${w.value}`);else $.push(w.value);return Object.assign(new Iu,s)},createNode:(u,_,s)=>Iu.from(u,_,s)};_I.YAMLOMap=Iu;_I.omap=uI});var Mw=P((wI)=>{var Xw=B();function Jw({value:u,source:_},s){if(_&&(u?Bw:Zw).test.test(_))return _;return u?s.options.trueStr:s.options.falseStr}var Bw={identify:(u)=>u===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Xw.Scalar(!0),stringify:Jw},Zw={identify:(u)=>u===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Xw.Scalar(!1),stringify:Jw};wI.falseTag=Zw;wI.trueTag=Bw});var Qw=P((TI)=>{var iI=B(),Xs=Yu(),RI={identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(u)=>u.slice(-3).toLowerCase()==="nan"?NaN:u[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Xs.stringifyNumber},SI={identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(u)=>parseFloat(u.replace(/_/g,"")),stringify(u){let _=Number(u.value);return isFinite(_)?_.toExponential():Xs.stringifyNumber(u)}},II={identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(u){let _=new iI.Scalar(parseFloat(u.replace(/_/g,""))),s=u.indexOf(".");if(s!==-1){let $=u.substring(s+1).replace(/_/g,"");if($[$.length-1]==="0")_.minFractionDigits=$.length}return _},stringify:Xs.stringifyNumber};TI.float=II;TI.floatExp=SI;TI.floatNaN=RI});var Vw=P((AI)=>{var Nw=Yu(),nu=(u)=>typeof u==="bigint"||Number.isInteger(u);function Q_(u,_,s,{intAsBigInt:$}){let w=u[0];if(w==="-"||w==="+")_+=1;if(u=u.substring(_).replace(/_/g,""),$){switch(s){case 2:u=`0b${u}`;break;case 8:u=`0o${u}`;break;case 16:u=`0x${u}`;break}let g=BigInt(u);return w==="-"?BigInt(-1)*g:g}let f=parseInt(u,s);return w==="-"?-1*f:f}function Js(u,_,s){let{value:$}=u;if(nu($)){let w=$.toString(_);return $<0?"-"+s+w.substr(1):s+w}return Nw.stringifyNumber(u)}var UI={identify:nu,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(u,_,s)=>Q_(u,2,2,s),stringify:(u)=>Js(u,2,"0b")},HI={identify:nu,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(u,_,s)=>Q_(u,1,8,s),stringify:(u)=>Js(u,8,"0")},PI={identify:nu,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(u,_,s)=>Q_(u,0,10,s),stringify:Nw.stringifyNumber},DI={identify:nu,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(u,_,s)=>Q_(u,2,16,s),stringify:(u)=>Js(u,16,"0x")};AI.int=PI;AI.intBin=UI;AI.intHex=DI;AI.intOct=HI});var Bs=P((XI)=>{var j_=X(),N_=e(),V_=_u();class Tu extends V_.YAMLMap{constructor(u){super(u);this.tag=Tu.tag}add(u){let _;if(j_.isPair(u))_=u;else if(u&&typeof u==="object"&&"key"in u&&"value"in u&&u.value===null)_=new N_.Pair(u.key,null);else _=new N_.Pair(u,null);if(!V_.findPair(this.items,_.key))this.items.push(_)}get(u,_){let s=V_.findPair(this.items,u);return!_&&j_.isPair(s)?j_.isScalar(s.key)?s.key.value:s.key:s}set(u,_){if(typeof _!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof _}`);let s=V_.findPair(this.items,u);if(s&&!_)this.items.splice(this.items.indexOf(s),1);else if(!s&&_)this.items.push(new N_.Pair(u))}toJSON(u,_){return super.toJSON(u,_,Set)}toString(u,_,s){if(!u)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},u,{allNullValues:!0}),_,s);else throw Error("Set items must all have null values")}static from(u,_,s){let{replacer:$}=s,w=new this(u);if(_&&Symbol.iterator in Object(_))for(let f of _){if(typeof $==="function")f=$.call(_,f,f);w.items.push(N_.createPair(f,null,s))}return w}}Tu.tag="tag:yaml.org,2002:set";var WI={collection:"map",identify:(u)=>u instanceof Set,nodeClass:Tu,default:!1,tag:"tag:yaml.org,2002:set",createNode:(u,_,s)=>Tu.from(u,_,s),resolve(u,_){if(j_.isMap(u))if(u.hasAllNullValues(!0))return Object.assign(new Tu,u);else _("Set items must all have null values");else _("Expected a mapping for this tag");return u}};XI.YAMLSet=Tu;XI.set=WI});var Ms=P((NI)=>{var ZI=Yu();function Zs(u,_){let s=u[0],$=s==="-"||s==="+"?u.substring(1):u,w=(g)=>_?BigInt(g):Number(g),f=$.replace(/_/g,"").split(":").reduce((g,i)=>g*w(60)+w(i),w(0));return s==="-"?w(-1)*f:f}function jw(u){let{value:_}=u,s=(g)=>g;if(typeof _==="bigint")s=(g)=>BigInt(g);else if(isNaN(_)||!isFinite(_))return ZI.stringifyNumber(u);let $="";if(_<0)$="-",_*=s(-1);let w=s(60),f=[_%w];if(_<60)f.unshift(0);else if(_=(_-f[0])/w,f.unshift(_%w),_>=60)_=(_-f[0])/w,f.unshift(_);return $+f.map((g)=>String(g).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var MI={identify:(u)=>typeof u==="bigint"||Number.isInteger(u),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(u,_,{intAsBigInt:s})=>Zs(u,s),stringify:jw},QI={identify:(u)=>typeof u==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(u)=>Zs(u,!1),stringify:jw},bw={identify:(u)=>u 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(u){let _=u.match(bw.test);if(!_)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,s,$,w,f,g,i]=_.map(Number),R=_[7]?Number((_[7]+"00").substr(1,3)):0,S=Date.UTC(s,$-1,w,f||0,g||0,i||0,R),L=_[8];if(L&&L!=="Z"){let I=Zs(L,!1);if(Math.abs(I)<30)I*=60;S-=60000*I}return new Date(S)},stringify:({value:u})=>u?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};NI.floatTime=QI;NI.intTime=MI;NI.timestamp=bw});var Cw=P((cI)=>{var EI=Fu(),CI=X_(),lI=zu(),KI=ru(),rI=zs(),Ew=Mw(),Qs=Qw(),b_=Vw(),yI=P_(),dI=Ws(),nI=M_(),hI=Bs(),Ns=Ms(),mI=[EI.map,lI.seq,KI.string,CI.nullTag,Ew.trueTag,Ew.falseTag,b_.intBin,b_.intOct,b_.int,b_.intHex,Qs.floatNaN,Qs.floatExp,Qs.float,rI.binary,yI.merge,dI.omap,nI.pairs,hI.set,Ns.intTime,Ns.floatTime,Ns.timestamp];cI.schema=mI});var xw=P((uT)=>{var yw=Fu(),pI=X_(),dw=zu(),kI=ru(),aI=Ls(),Vs=Us(),js=Ps(),tI=Dw(),vI=Fw(),nw=zs(),hu=P_(),hw=Ws(),mw=M_(),lw=Cw(),cw=Bs(),E_=Ms(),Kw=new Map([["core",tI.schema],["failsafe",[yw.map,dw.seq,kI.string]],["json",vI.schema],["yaml11",lw.schema],["yaml-1.1",lw.schema]]),rw={binary:nw.binary,bool:aI.boolTag,float:Vs.float,floatExp:Vs.floatExp,floatNaN:Vs.floatNaN,floatTime:E_.floatTime,int:js.int,intHex:js.intHex,intOct:js.intOct,intTime:E_.intTime,map:yw.map,merge:hu.merge,null:pI.nullTag,omap:hw.omap,pairs:mw.pairs,seq:dw.seq,set:cw.set,timestamp:E_.timestamp},oI={"tag:yaml.org,2002:binary":nw.binary,"tag:yaml.org,2002:merge":hu.merge,"tag:yaml.org,2002:omap":hw.omap,"tag:yaml.org,2002:pairs":mw.pairs,"tag:yaml.org,2002:set":cw.set,"tag:yaml.org,2002:timestamp":E_.timestamp};function eI(u,_,s){let $=Kw.get(_);if($&&!u)return s&&!$.includes(hu.merge)?$.concat(hu.merge):$.slice();let w=$;if(!w)if(Array.isArray(u))w=[];else{let f=Array.from(Kw.keys()).filter((g)=>g!=="yaml11").map((g)=>JSON.stringify(g)).join(", ");throw Error(`Unknown schema "${_}"; use one of ${f} or define customTags array`)}if(Array.isArray(u))for(let f of u)w=w.concat(f);else if(typeof u==="function")w=u(w.slice());if(s)w=w.concat(hu.merge);return w.reduce((f,g)=>{let i=typeof g==="string"?rw[g]:g;if(!i){let R=JSON.stringify(g),S=Object.keys(rw).map((L)=>JSON.stringify(L)).join(", ");throw Error(`Unknown custom tag ${R}; use one of ${S}`)}if(!f.includes(i))f.push(i);return f},[])}uT.coreKnownTags=oI;uT.getTags=eI});var Cs=P((iT)=>{var bs=X(),$T=Fu(),wT=zu(),fT=ru(),C_=xw(),gT=(u,_)=>u.key<_.key?-1:u.key>_.key?1:0;class Es{constructor({compat:u,customTags:_,merge:s,resolveKnownTags:$,schema:w,sortMapEntries:f,toStringDefaults:g}){this.compat=Array.isArray(u)?C_.getTags(u,"compat"):u?C_.getTags(null,u):null,this.name=typeof w==="string"&&w||"core",this.knownTags=$?C_.coreKnownTags:{},this.tags=C_.getTags(_,this.name,s),this.toStringOptions=g??null,Object.defineProperty(this,bs.MAP,{value:$T.map}),Object.defineProperty(this,bs.SCALAR,{value:fT.string}),Object.defineProperty(this,bs.SEQ,{value:wT.seq}),this.sortMapEntries=typeof f==="function"?f:f===!0?gT:null}clone(){let u=Object.create(Es.prototype,Object.getOwnPropertyDescriptors(this));return u.tags=this.tags.slice(),u}}iT.Schema=Es});var pw=P((TT)=>{var ST=X(),ls=Cu(),mu=ju();function IT(u,_){let s=[],$=_.directives===!0;if(_.directives!==!1&&u.directives){let R=u.directives.toString(u);if(R)s.push(R),$=!0;else if(u.directives.docStart)$=!0}if($)s.push("---");let w=ls.createStringifyContext(u,_),{commentString:f}=w.options;if(u.commentBefore){if(s.length!==1)s.unshift("");let R=f(u.commentBefore);s.unshift(mu.indentComment(R,""))}let g=!1,i=null;if(u.contents){if(ST.isNode(u.contents)){if(u.contents.spaceBefore&&$)s.push("");if(u.contents.commentBefore){let L=f(u.contents.commentBefore);s.push(mu.indentComment(L,""))}w.forceBlockIndent=!!u.comment,i=u.contents.comment}let R=i?void 0:()=>g=!0,S=ls.stringify(u.contents,w,()=>i=null,R);if(i)S+=mu.lineComment(S,"",f(i));if((S[0]==="|"||S[0]===">")&&s[s.length-1]==="---")s[s.length-1]=`--- ${S}`;else s.push(S)}else s.push(ls.stringify(u.contents,w));if(u.directives?.docEnd)if(u.comment){let R=f(u.comment);if(R.includes(`
|
|
56
|
+
`))s.push("..."),s.push(mu.indentComment(R,""));else s.push(`... ${R}`)}else s.push("...");else{let R=u.comment;if(R&&g)R=R.replace(/^\n+/,"");if(R){if((!g||i)&&s[s.length-1]!=="")s.push("");s.push(mu.indentComment(f(R),""))}}return s.join(`
|
|
57
57
|
`)+`
|
|
58
|
-
`}TT.stringifyDocument=IT});var cu=P((FT)=>{var
|
|
59
|
-
`;i
|
|
58
|
+
`}TT.stringifyDocument=IT});var cu=P((FT)=>{var LT=Nu(),Gu=I_(),l=X(),OT=e(),UT=t(),HT=Cs(),PT=pw(),Ks=i_(),DT=$s(),AT=Vu(),rs=ss();class ys{constructor(u,_,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,l.NODE_TYPE,{value:l.DOC});let $=null;if(typeof _==="function"||Array.isArray(_))$=_;else if(s===void 0&&_)s=_,_=void 0;let w=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=w;let{version:f}=w;if(s?._directives){if(this.directives=s._directives.atDocument(),this.directives.yaml.explicit)f=this.directives.yaml.version}else this.directives=new rs.Directives({version:f});this.setSchema(f,s),this.contents=u===void 0?null:this.createNode(u,$,s)}clone(){let u=Object.create(ys.prototype,{[l.NODE_TYPE]:{value:l.DOC}});if(u.commentBefore=this.commentBefore,u.comment=this.comment,u.errors=this.errors.slice(),u.warnings=this.warnings.slice(),u.options=Object.assign({},this.options),this.directives)u.directives=this.directives.clone();if(u.schema=this.schema.clone(),u.contents=l.isNode(this.contents)?this.contents.clone(u.schema):this.contents,this.range)u.range=this.range.slice();return u}add(u){if(Wu(this.contents))this.contents.add(u)}addIn(u,_){if(Wu(this.contents))this.contents.addIn(u,_)}createAlias(u,_){if(!u.anchor){let s=Ks.anchorNames(this);u.anchor=!_||s.has(_)?Ks.findNewAnchor(_||"a",s):_}return new LT.Alias(u.anchor)}createNode(u,_,s){let $=void 0;if(typeof _==="function")u=_.call({"":u},"",u),$=_;else if(Array.isArray(_)){let q=(D)=>typeof D==="number"||D instanceof String||D instanceof Number,U=_.filter(q).map(String);if(U.length>0)_=_.concat(U);$=_}else if(s===void 0&&_)s=_,_=void 0;let{aliasDuplicateObjects:w,anchorPrefix:f,flow:g,keepUndefined:i,onTagObj:R,tag:S}=s??{},{onAnchor:L,setAnchors:I,sourceObjects:T}=Ks.createNodeAnchors(this,f||"a"),O={aliasDuplicateObjects:w??!0,keepUndefined:i??!1,onAnchor:L,onTagObj:R,replacer:$,schema:this.schema,sourceObjects:T},H=AT.createNode(u,S,O);if(g&&l.isCollection(H))H.flow=!0;return I(),H}createPair(u,_,s={}){let $=this.createNode(u,null,s),w=this.createNode(_,null,s);return new OT.Pair($,w)}delete(u){return Wu(this.contents)?this.contents.delete(u):!1}deleteIn(u){if(Gu.isEmptyPath(u)){if(this.contents==null)return!1;return this.contents=null,!0}return Wu(this.contents)?this.contents.deleteIn(u):!1}get(u,_){return l.isCollection(this.contents)?this.contents.get(u,_):void 0}getIn(u,_){if(Gu.isEmptyPath(u))return!_&&l.isScalar(this.contents)?this.contents.value:this.contents;return l.isCollection(this.contents)?this.contents.getIn(u,_):void 0}has(u){return l.isCollection(this.contents)?this.contents.has(u):!1}hasIn(u){if(Gu.isEmptyPath(u))return this.contents!==void 0;return l.isCollection(this.contents)?this.contents.hasIn(u):!1}set(u,_){if(this.contents==null)this.contents=Gu.collectionFromPath(this.schema,[u],_);else if(Wu(this.contents))this.contents.set(u,_)}setIn(u,_){if(Gu.isEmptyPath(u))this.contents=_;else if(this.contents==null)this.contents=Gu.collectionFromPath(this.schema,Array.from(u),_);else if(Wu(this.contents))this.contents.setIn(u,_)}setSchema(u,_={}){if(typeof u==="number")u=String(u);let s;switch(u){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new rs.Directives({version:"1.1"});s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=u;else this.directives=new rs.Directives({version:u});s={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;s=null;break;default:{let $=JSON.stringify(u);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${$}`)}}if(_.schema instanceof Object)this.schema=_.schema;else if(s)this.schema=new HT.Schema(Object.assign(s,_));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:u,jsonArg:_,mapAsMap:s,maxAliasCount:$,onAnchor:w,reviver:f}={}){let g={anchors:new Map,doc:this,keep:!u,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof $==="number"?$:100},i=UT.toJS(this.contents,_??"",g);if(typeof w==="function")for(let{count:R,res:S}of g.anchors.values())w(S,R);return typeof f==="function"?DT.applyReviver(f,{"":i},"",i):i}toJSON(u,_){return this.toJS({json:!0,jsonArg:u,mapAsMap:!1,onAnchor:_})}toString(u={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in u&&(!Number.isInteger(u.indent)||Number(u.indent)<=0)){let _=JSON.stringify(u.indent);throw Error(`"indent" option must be a positive integer, not ${_}`)}return PT.stringifyDocument(this,u)}}function Wu(u){if(l.isCollection(u))return!0;throw Error("Expected a YAML collection as document contents")}FT.Document=ys});var xu=P((GT)=>{class l_ extends Error{constructor(u,_,s,$){super();this.name=u,this.code=s,this.message=$,this.pos=_}}class kw extends l_{constructor(u,_,s){super("YAMLParseError",u,_,s)}}class aw extends l_{constructor(u,_,s){super("YAMLWarning",u,_,s)}}var YT=(u,_)=>(s)=>{if(s.pos[0]===-1)return;s.linePos=s.pos.map((i)=>_.linePos(i));let{line:$,col:w}=s.linePos[0];s.message+=` at line ${$}, column ${w}`;let f=w-1,g=u.substring(_.lineStarts[$-1],_.lineStarts[$]).replace(/[\n\r]+$/,"");if(f>=60&&g.length>80){let i=Math.min(f-39,g.length-79);g="…"+g.substring(i),f-=i-1}if(g.length>80)g=g.substring(0,79)+"…";if($>1&&/^ *$/.test(g.substring(0,f))){let i=u.substring(_.lineStarts[$-2],_.lineStarts[$-1]);if(i.length>80)i=i.substring(0,79)+`…
|
|
59
|
+
`;g=i+g}if(/[^ ]/.test(g)){let i=1,R=s.linePos[1];if(R?.line===$&&R.col>w)i=Math.max(1,Math.min(R.col-w,80-f));let S=" ".repeat(f)+"^".repeat(i);s.message+=`:
|
|
60
60
|
|
|
61
|
-
${
|
|
61
|
+
${g}
|
|
62
62
|
${S}
|
|
63
|
-
`}};GT.YAMLError=
|
|
64
|
-
`))return!0;if(u.end){for(let _ of u.end)if(_.type==="newline")return!0}return!1;case"flow-collection":for(let _ of u.items){for(let s of _.start)if(s.type==="newline")return!0;if(_.sep){for(let s of _.sep)if(s.type==="newline")return!0}if(ds(_.key)||ds(_.value))return!0}return!1;default:return!0}}
|
|
65
|
-
`+q.comment;else
|
|
66
|
-
`+z.comment;else F.comment=z.comment;let
|
|
67
|
-
`+
|
|
68
|
-
`+J;else A.comment=J;
|
|
69
|
-
`+Z.comment;else A.comment=Z.comment;let Uu=new sq.Pair(A,
|
|
70
|
-
`+U.comment;else S.comment=U.comment;S.range=[$.offset,q,U.offset]}else S.range=[$.offset,q,q];return S}Rq.resolveFlowCollection=
|
|
71
|
-
`.repeat(Math.max(1,
|
|
72
|
-
`;for(let q=
|
|
63
|
+
`}};GT.YAMLError=l_;GT.YAMLParseError=kw;GT.YAMLWarning=aw;GT.prettifyError=YT});var pu=P((MT)=>{function ZT(u,{flow:_,indicator:s,next:$,offset:w,onError:f,parentIndent:g,startOnNewline:i}){let R=!1,S=i,L=i,I="",T="",O=!1,H=!1,q=null,U=null,D=null,F=null,z=null,Y=null,G=null;for(let A of u){if(H){if(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma")f(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");H=!1}if(q){if(S&&A.type!=="comment"&&A.type!=="newline")f(q,"TAB_AS_INDENT","Tabs are not allowed as indentation");q=null}switch(A.type){case"space":if(!_&&(s!=="doc-start"||$?.type!=="flow-collection")&&A.source.includes("\t"))q=A;L=!0;break;case"comment":{if(!L)f(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let Z=A.source.substring(1)||" ";if(!I)I=Z;else I+=T+Z;T="",S=!1;break}case"newline":if(S){if(I)I+=A.source;else if(!Y||s!=="seq-item-ind")R=!0}else T+=A.source;if(S=!0,O=!0,U||D)F=A;L=!0;break;case"anchor":if(U)f(A,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(A.source.endsWith(":"))f(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);U=A,G??(G=A.offset),S=!1,L=!1,H=!0;break;case"tag":{if(D)f(A,"MULTIPLE_TAGS","A node can have at most one tag");D=A,G??(G=A.offset),S=!1,L=!1,H=!0;break}case s:if(U||D)f(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`);if(Y)f(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${_??"collection"}`);Y=A,S=s==="seq-item-ind"||s==="explicit-key-ind",L=!1;break;case"comma":if(_){if(z)f(A,"UNEXPECTED_TOKEN",`Unexpected , in ${_}`);z=A,S=!1,L=!1;break}default:f(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),S=!1,L=!1}}let W=u[u.length-1],J=W?W.offset+W.source.length:w;if(H&&$&&$.type!=="space"&&$.type!=="newline"&&$.type!=="comma"&&($.type!=="scalar"||$.source!==""))f($.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(q&&(S&&q.indent<=g||$?.type==="block-map"||$?.type==="block-seq"))f(q,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:z,found:Y,spaceBefore:R,comment:I,hasNewline:O,anchor:U,tag:D,newlineAfterProp:F,end:J,start:G??J}}MT.resolveProps=ZT});var K_=P((NT)=>{function ds(u){if(!u)return null;switch(u.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(u.source.includes(`
|
|
64
|
+
`))return!0;if(u.end){for(let _ of u.end)if(_.type==="newline")return!0}return!1;case"flow-collection":for(let _ of u.items){for(let s of _.start)if(s.type==="newline")return!0;if(_.sep){for(let s of _.sep)if(s.type==="newline")return!0}if(ds(_.key)||ds(_.value))return!0}return!1;default:return!0}}NT.containsNewline=ds});var ns=P((ET)=>{var jT=K_();function bT(u,_,s){if(_?.type==="flow-collection"){let $=_.end[0];if($.indent===u&&($.source==="]"||$.source==="}")&&jT.containsNewline(_))s($,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}ET.flowIndentCheck=bT});var hs=P((KT)=>{var tw=X();function lT(u,_,s){let{uniqueKeys:$}=u.options;if($===!1)return!1;let w=typeof $==="function"?$:(f,g)=>f===g||tw.isScalar(f)&&tw.isScalar(g)&&f.value===g.value;return _.some((f)=>w(f.key,s))}KT.mapIncludes=lT});var _f=P((mT)=>{var vw=e(),yT=_u(),ow=pu(),dT=K_(),ew=ns(),nT=hs(),uf="All mapping items must start at the same column";function hT({composeNode:u,composeEmptyNode:_},s,$,w,f){let i=new(f?.nodeClass??yT.YAMLMap)(s.schema);if(s.atRoot)s.atRoot=!1;let R=$.offset,S=null;for(let L of $.items){let{start:I,key:T,sep:O,value:H}=L,q=ow.resolveProps(I,{indicator:"explicit-key-ind",next:T??O?.[0],offset:R,onError:w,parentIndent:$.indent,startOnNewline:!0}),U=!q.found;if(U){if(T){if(T.type==="block-seq")w(R,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in T&&T.indent!==$.indent)w(R,"BAD_INDENT",uf)}if(!q.anchor&&!q.tag&&!O){if(S=q.end,q.comment)if(i.comment)i.comment+=`
|
|
65
|
+
`+q.comment;else i.comment=q.comment;continue}if(q.newlineAfterProp||dT.containsNewline(T))w(T??I[I.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(q.found?.indent!==$.indent)w(R,"BAD_INDENT",uf);s.atKey=!0;let D=q.end,F=T?u(s,T,q,w):_(s,D,I,null,q,w);if(s.schema.compat)ew.flowIndentCheck($.indent,T,w);if(s.atKey=!1,nT.mapIncludes(s,i.items,F))w(D,"DUPLICATE_KEY","Map keys must be unique");let z=ow.resolveProps(O??[],{indicator:"map-value-ind",next:H,offset:F.range[2],onError:w,parentIndent:$.indent,startOnNewline:!T||T.type==="block-scalar"});if(R=z.end,z.found){if(U){if(H?.type==="block-map"&&!z.hasNewline)w(R,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(s.options.strict&&q.start<z.found.offset-1024)w(F.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let Y=H?u(s,H,z,w):_(s,R,O,null,z,w);if(s.schema.compat)ew.flowIndentCheck($.indent,H,w);R=Y.range[2];let G=new vw.Pair(F,Y);if(s.options.keepSourceTokens)G.srcToken=L;i.items.push(G)}else{if(U)w(F.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(z.comment)if(F.comment)F.comment+=`
|
|
66
|
+
`+z.comment;else F.comment=z.comment;let Y=new vw.Pair(F);if(s.options.keepSourceTokens)Y.srcToken=L;i.items.push(Y)}}if(S&&S<R)w(S,"IMPOSSIBLE","Map comment with trailing content");return i.range=[$.offset,R,S??R],i}mT.resolveBlockMap=hT});var sf=P((tT)=>{var xT=su(),pT=pu(),kT=ns();function aT({composeNode:u,composeEmptyNode:_},s,$,w,f){let i=new(f?.nodeClass??xT.YAMLSeq)(s.schema);if(s.atRoot)s.atRoot=!1;if(s.atKey)s.atKey=!1;let R=$.offset,S=null;for(let{start:L,value:I}of $.items){let T=pT.resolveProps(L,{indicator:"seq-item-ind",next:I,offset:R,onError:w,parentIndent:$.indent,startOnNewline:!0});if(!T.found)if(T.anchor||T.tag||I)if(I?.type==="block-seq")w(T.end,"BAD_INDENT","All sequence items must start at the same column");else w(R,"MISSING_CHAR","Sequence item without - indicator");else{if(S=T.end,T.comment)i.comment=T.comment;continue}let O=I?u(s,I,T,w):_(s,T.end,L,null,T,w);if(s.schema.compat)kT.flowIndentCheck($.indent,I,w);R=O.range[2],i.items.push(O)}return i.range=[$.offset,R,S??R],i}tT.resolveBlockSeq=aT});var Xu=P((eT)=>{function oT(u,_,s,$){let w="";if(u){let f=!1,g="";for(let i of u){let{source:R,type:S}=i;switch(S){case"space":f=!0;break;case"comment":{if(s&&!f)$(i,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let L=R.substring(1)||" ";if(!w)w=L;else w+=g+L;g="";break}case"newline":if(w)g+=R;f=!0;break;default:$(i,"UNEXPECTED_TOKEN",`Unexpected ${S} at node end`)}_+=R.length}}return{comment:w,offset:_}}eT.resolveEnd=oT});var ff=P((Rq)=>{var _q=X(),sq=e(),$f=_u(),$q=su(),wq=Xu(),wf=pu(),fq=K_(),gq=hs(),ms="Block collections are not allowed within flow collections",cs=(u)=>u&&(u.type==="block-map"||u.type==="block-seq");function iq({composeNode:u,composeEmptyNode:_},s,$,w,f){let g=$.start.source==="{",i=g?"flow map":"flow sequence",S=new(f?.nodeClass??(g?$f.YAMLMap:$q.YAMLSeq))(s.schema);S.flow=!0;let L=s.atRoot;if(L)s.atRoot=!1;if(s.atKey)s.atKey=!1;let I=$.offset+$.start.source.length;for(let U=0;U<$.items.length;++U){let D=$.items[U],{start:F,key:z,sep:Y,value:G}=D,W=wf.resolveProps(F,{flow:i,indicator:"explicit-key-ind",next:z??Y?.[0],offset:I,onError:w,parentIndent:$.indent,startOnNewline:!1});if(!W.found){if(!W.anchor&&!W.tag&&!Y&&!G){if(U===0&&W.comma)w(W.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${i}`);else if(U<$.items.length-1)w(W.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${i}`);if(W.comment)if(S.comment)S.comment+=`
|
|
67
|
+
`+W.comment;else S.comment=W.comment;I=W.end;continue}if(!g&&s.options.strict&&fq.containsNewline(z))w(z,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(U===0){if(W.comma)w(W.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${i}`)}else{if(!W.comma)w(W.start,"MISSING_CHAR",`Missing , between ${i} items`);if(W.comment){let J="";u:for(let A of F)switch(A.type){case"comma":case"space":break;case"comment":J=A.source.substring(1);break u;default:break u}if(J){let A=S.items[S.items.length-1];if(_q.isPair(A))A=A.value??A.key;if(A.comment)A.comment+=`
|
|
68
|
+
`+J;else A.comment=J;W.comment=W.comment.substring(J.length+1)}}}if(!g&&!Y&&!W.found){let J=G?u(s,G,W,w):_(s,W.end,Y,null,W,w);if(S.items.push(J),I=J.range[2],cs(G))w(J.range,"BLOCK_IN_FLOW",ms)}else{s.atKey=!0;let J=W.end,A=z?u(s,z,W,w):_(s,J,F,null,W,w);if(cs(z))w(A.range,"BLOCK_IN_FLOW",ms);s.atKey=!1;let Z=wf.resolveProps(Y??[],{flow:i,indicator:"map-value-ind",next:G,offset:A.range[2],onError:w,parentIndent:$.indent,startOnNewline:!1});if(Z.found){if(!g&&!W.found&&s.options.strict){if(Y)for(let M of Y){if(M===Z.found)break;if(M.type==="newline"){w(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(W.start<Z.found.offset-1024)w(Z.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(G)if("source"in G&&G.source?.[0]===":")w(G,"MISSING_CHAR",`Missing space after : in ${i}`);else w(Z.start,"MISSING_CHAR",`Missing , or : between ${i} items`);let a=G?u(s,G,Z,w):Z.found?_(s,Z.end,Y,null,Z,w):null;if(a){if(cs(G))w(a.range,"BLOCK_IN_FLOW",ms)}else if(Z.comment)if(A.comment)A.comment+=`
|
|
69
|
+
`+Z.comment;else A.comment=Z.comment;let Uu=new sq.Pair(A,a);if(s.options.keepSourceTokens)Uu.srcToken=D;if(g){let M=S;if(gq.mapIncludes(s,M.items,A))w(J,"DUPLICATE_KEY","Map keys must be unique");M.items.push(Uu)}else{let M=new $f.YAMLMap(s.schema);M.flow=!0,M.items.push(Uu);let Q$=(a??A).range;M.range=[A.range[0],Q$[1],Q$[2]],S.items.push(M)}I=a?a.range[2]:Z.end}}let T=g?"}":"]",[O,...H]=$.end,q=I;if(O?.source===T)q=O.offset+O.source.length;else{let U=i[0].toUpperCase()+i.substring(1),D=L?`${U} must end with a ${T}`:`${U} in block collection must be sufficiently indented and end with a ${T}`;if(w(I,L?"MISSING_CHAR":"BAD_INDENT",D),O&&O.source.length!==1)H.unshift(O)}if(H.length>0){let U=wq.resolveEnd(H,q,s.options.strict,w);if(U.comment)if(S.comment)S.comment+=`
|
|
70
|
+
`+U.comment;else S.comment=U.comment;S.range=[$.offset,q,U.offset]}else S.range=[$.offset,q,q];return S}Rq.resolveFlowCollection=iq});var gf=P((Dq)=>{var Iq=X(),Tq=B(),qq=_u(),Lq=su(),Oq=_f(),Uq=sf(),Hq=ff();function xs(u,_,s,$,w,f){let g=s.type==="block-map"?Oq.resolveBlockMap(u,_,s,$,f):s.type==="block-seq"?Uq.resolveBlockSeq(u,_,s,$,f):Hq.resolveFlowCollection(u,_,s,$,f),i=g.constructor;if(w==="!"||w===i.tagName)return g.tag=i.tagName,g;if(w)g.tag=w;return g}function Pq(u,_,s,$,w){let f=$.tag,g=!f?null:_.directives.tagName(f.source,(T)=>w(f,"TAG_RESOLVE_FAILED",T));if(s.type==="block-seq"){let{anchor:T,newlineAfterProp:O}=$,H=T&&f?T.offset>f.offset?T:f:T??f;if(H&&(!O||O.offset<H.offset))w(H,"MISSING_CHAR","Missing newline after block sequence props")}let i=s.type==="block-map"?"map":s.type==="block-seq"?"seq":s.start.source==="{"?"map":"seq";if(!f||!g||g==="!"||g===qq.YAMLMap.tagName&&i==="map"||g===Lq.YAMLSeq.tagName&&i==="seq")return xs(u,_,s,w,g);let R=_.schema.tags.find((T)=>T.tag===g&&T.collection===i);if(!R){let T=_.schema.knownTags[g];if(T?.collection===i)_.schema.tags.push(Object.assign({},T,{default:!1})),R=T;else{if(T)w(f,"BAD_COLLECTION_TYPE",`${T.tag} used for ${i} collection, but expects ${T.collection??"scalar"}`,!0);else w(f,"TAG_RESOLVE_FAILED",`Unresolved tag: ${g}`,!0);return xs(u,_,s,w,g)}}let S=xs(u,_,s,w,g,R),L=R.resolve?.(S,(T)=>w(f,"TAG_RESOLVE_FAILED",T),_.options)??S,I=Iq.isNode(L)?L:new Tq.Scalar(L);if(I.range=S.range,I.tag=g,R?.format)I.format=R.format;return I}Dq.composeCollection=Pq});var ks=P((Gq)=>{var ps=B();function Fq(u,_,s){let $=_.offset,w=zq(_,u.options.strict,s);if(!w)return{value:"",type:null,comment:"",range:[$,$,$]};let f=w.mode===">"?ps.Scalar.BLOCK_FOLDED:ps.Scalar.BLOCK_LITERAL,g=_.source?Yq(_.source):[],i=g.length;for(let q=g.length-1;q>=0;--q){let U=g[q][1];if(U===""||U==="\r")i=q;else break}if(i===0){let q=w.chomp==="+"&&g.length>0?`
|
|
71
|
+
`.repeat(Math.max(1,g.length-1)):"",U=$+w.length;if(_.source)U+=_.source.length;return{value:q,type:f,comment:w.comment,range:[$,U,U]}}let R=_.indent+w.indent,S=_.offset+w.length,L=0;for(let q=0;q<i;++q){let[U,D]=g[q];if(D===""||D==="\r"){if(w.indent===0&&U.length>R)R=U.length}else{if(U.length<R)s(S+U.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(w.indent===0)R=U.length;if(L=q,R===0&&!u.atRoot)s(S,"BAD_INDENT","Block scalar values in collections must be indented");break}S+=U.length+D.length+1}for(let q=g.length-1;q>=i;--q)if(g[q][0].length>R)i=q+1;let I="",T="",O=!1;for(let q=0;q<L;++q)I+=g[q][0].slice(R)+`
|
|
72
|
+
`;for(let q=L;q<i;++q){let[U,D]=g[q];S+=U.length+D.length+1;let F=D[D.length-1]==="\r";if(F)D=D.slice(0,-1);if(D&&U.length<R){let Y=`Block scalar lines must not be less indented than their ${w.indent?"explicit indentation indicator":"first line"}`;s(S-D.length-(F?2:1),"BAD_INDENT",Y),U=""}if(f===ps.Scalar.BLOCK_LITERAL)I+=T+U.slice(R)+D,T=`
|
|
73
73
|
`;else if(U.length>R||D[0]==="\t"){if(T===" ")T=`
|
|
74
|
-
`;else if(!
|
|
74
|
+
`;else if(!O&&T===`
|
|
75
75
|
`)T=`
|
|
76
76
|
|
|
77
77
|
`;I+=T+U.slice(R)+D,T=`
|
|
78
|
-
`,
|
|
78
|
+
`,O=!0}else if(D==="")if(T===`
|
|
79
79
|
`)I+=`
|
|
80
80
|
`;else T=`
|
|
81
|
-
`;else I+=T+D,T=" ",
|
|
82
|
-
`+
|
|
81
|
+
`;else I+=T+D,T=" ",O=!1}switch(w.chomp){case"-":break;case"+":for(let q=i;q<g.length;++q)I+=`
|
|
82
|
+
`+g[q][0].slice(R);if(I[I.length-1]!==`
|
|
83
83
|
`)I+=`
|
|
84
84
|
`;break;default:I+=`
|
|
85
|
-
`}let H=$+
|
|
85
|
+
`}let H=$+w.length+_.source.length;return{value:I,type:f,comment:w.comment,range:[$,H,H]}}function zq({offset:u,props:_},s,$){if(_[0].type!=="block-scalar-header")return $(_[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:w}=_[0],f=w[0],g=0,i="",R=-1;for(let T=1;T<w.length;++T){let O=w[T];if(!i&&(O==="-"||O==="+"))i=O;else{let H=Number(O);if(!g&&H)g=H;else if(R===-1)R=u+T}}if(R!==-1)$(R,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${w}`);let S=!1,L="",I=w.length;for(let T=1;T<_.length;++T){let O=_[T];switch(O.type){case"space":S=!0;case"newline":I+=O.source.length;break;case"comment":if(s&&!S)$(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");I+=O.source.length,L=O.source.substring(1);break;case"error":$(O,"UNEXPECTED_TOKEN",O.message),I+=O.source.length;break;default:{let H=`Unexpected token in block scalar header: ${O.type}`;$(O,"UNEXPECTED_TOKEN",H);let q=O.source;if(q&&typeof q==="string")I+=q.length}}}return{mode:f,indent:g,chomp:i,comment:L,length:I}}function Yq(u){let _=u.split(/\n( *)/),s=_[0],$=s.match(/^( *)/),f=[$?.[1]?[$[1],s.slice($[1].length)]:["",s]];for(let g=1;g<_.length;g+=2)f.push([_[g],_[g+1]]);return f}Gq.resolveBlockScalar=Fq});var ts=P((jq)=>{var as=B(),Xq=Xu();function Jq(u,_,s){let{offset:$,type:w,source:f,end:g}=u,i,R,S=(T,O,H)=>s($+T,O,H);switch(w){case"scalar":i=as.Scalar.PLAIN,R=Bq(f,S);break;case"single-quoted-scalar":i=as.Scalar.QUOTE_SINGLE,R=Zq(f,S);break;case"double-quoted-scalar":i=as.Scalar.QUOTE_DOUBLE,R=Mq(f,S);break;default:return s(u,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${w}`),{value:"",type:null,comment:"",range:[$,$+f.length,$+f.length]}}let L=$+f.length,I=Xq.resolveEnd(g,L,_,s);return{value:R,type:i,comment:I.comment,range:[$,L,I.offset]}}function Bq(u,_){let s="";switch(u[0]){case"\t":s="a tab character";break;case",":s="flow indicator character ,";break;case"%":s="directive indicator character %";break;case"|":case">":{s=`block scalar indicator ${u[0]}`;break}case"@":case"`":{s=`reserved character ${u[0]}`;break}}if(s)_(0,"BAD_SCALAR_START",`Plain value cannot start with ${s}`);return Rf(u)}function Zq(u,_){if(u[u.length-1]!=="'"||u.length===1)_(u.length,"MISSING_CHAR","Missing closing 'quote");return Rf(u.slice(1,-1)).replace(/''/g,"'")}function Rf(u){let _,s;try{_=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
86
86
|
`,"sy"),s=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
87
|
-
`,"sy")}catch{_=/(.*?)[ \t]*\r?\n/sy,s=/[ \t]*(.*?)[ \t]*\r?\n/sy}let $=_.exec(u);if(!$)return u;let
|
|
88
|
-
`)f
|
|
89
|
-
`;else f
|
|
90
|
-
`)continue;if(
|
|
91
|
-
`){let{fold:
|
|
92
|
-
`){
|
|
93
|
-
`){
|
|
94
|
-
`&&!(
|
|
95
|
-
`))s+=$>
|
|
87
|
+
`,"sy")}catch{_=/(.*?)[ \t]*\r?\n/sy,s=/[ \t]*(.*?)[ \t]*\r?\n/sy}let $=_.exec(u);if(!$)return u;let w=$[1],f=" ",g=_.lastIndex;s.lastIndex=g;while($=s.exec(u)){if($[1]==="")if(f===`
|
|
88
|
+
`)w+=f;else f=`
|
|
89
|
+
`;else w+=f+$[1],f=" ";g=s.lastIndex}let i=/[ \t]*(.*)/sy;return i.lastIndex=g,$=i.exec(u),w+f+($?.[1]??"")}function Mq(u,_){let s="";for(let $=1;$<u.length-1;++$){let w=u[$];if(w==="\r"&&u[$+1]===`
|
|
90
|
+
`)continue;if(w===`
|
|
91
|
+
`){let{fold:f,offset:g}=Qq(u,$);s+=f,$=g}else if(w==="\\"){let f=u[++$],g=Nq[f];if(g)s+=g;else if(f===`
|
|
92
|
+
`){f=u[$+1];while(f===" "||f==="\t")f=u[++$+1]}else if(f==="\r"&&u[$+1]===`
|
|
93
|
+
`){f=u[++$+1];while(f===" "||f==="\t")f=u[++$+1]}else if(f==="x"||f==="u"||f==="U"){let i=f==="x"?2:f==="u"?4:8;s+=Vq(u,$+1,i,_),$+=i}else{let i=u.substr($-1,2);_($-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${i}`),s+=i}}else if(w===" "||w==="\t"){let f=$,g=u[$+1];while(g===" "||g==="\t")g=u[++$+1];if(g!==`
|
|
94
|
+
`&&!(g==="\r"&&u[$+2]===`
|
|
95
|
+
`))s+=$>f?u.slice(f,$+1):w}else s+=w}if(u[u.length-1]!=='"'||u.length===1)_(u.length,"MISSING_CHAR",'Missing closing "quote');return s}function Qq(u,_){let s="",$=u[_+1];while($===" "||$==="\t"||$===`
|
|
96
96
|
`||$==="\r"){if($==="\r"&&u[_+2]!==`
|
|
97
97
|
`)break;if($===`
|
|
98
98
|
`)s+=`
|
|
99
|
-
`;_+=1,$=u[_+1]}if(!s)s=" ";return{fold:s,offset:_}}var
|
|
100
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function
|
|
99
|
+
`;_+=1,$=u[_+1]}if(!s)s=" ";return{fold:s,offset:_}}var Nq={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
100
|
+
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function Vq(u,_,s,$){let w=u.substr(_,s),g=w.length===s&&/^[0-9a-fA-F]+$/.test(w)?parseInt(w,16):NaN;try{return String.fromCodePoint(g)}catch{let i=u.substr(_-2,s+2);return $(_-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${i}`),i}}jq.resolveFlowScalar=Jq});var If=P((yq)=>{var qu=X(),Sf=B(),Eq=ks(),Cq=ts();function lq(u,_,s,$){let{value:w,type:f,comment:g,range:i}=_.type==="block-scalar"?Eq.resolveBlockScalar(u,_,$):Cq.resolveFlowScalar(_,u.options.strict,$),R=s?u.directives.tagName(s.source,(I)=>$(s,"TAG_RESOLVE_FAILED",I)):null,S;if(u.options.stringKeys&&u.atKey)S=u.schema[qu.SCALAR];else if(R)S=Kq(u.schema,w,R,s,$);else if(_.type==="scalar")S=rq(u,w,_,$);else S=u.schema[qu.SCALAR];let L;try{let I=S.resolve(w,(T)=>$(s??_,"TAG_RESOLVE_FAILED",T),u.options);L=qu.isScalar(I)?I:new Sf.Scalar(I)}catch(I){let T=I instanceof Error?I.message:String(I);$(s??_,"TAG_RESOLVE_FAILED",T),L=new Sf.Scalar(w)}if(L.range=i,L.source=w,f)L.type=f;if(R)L.tag=R;if(S.format)L.format=S.format;if(g)L.comment=g;return L}function Kq(u,_,s,$,w){if(s==="!")return u[qu.SCALAR];let f=[];for(let i of u.tags)if(!i.collection&&i.tag===s)if(i.default&&i.test)f.push(i);else return i;for(let i of f)if(i.test?.test(_))return i;let g=u.knownTags[s];if(g&&!g.collection)return u.tags.push(Object.assign({},g,{default:!1,test:void 0})),g;return w($,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,s!=="tag:yaml.org,2002:str"),u[qu.SCALAR]}function rq({atKey:u,directives:_,schema:s},$,w,f){let g=s.tags.find((i)=>(i.default===!0||u&&i.default==="key")&&i.test?.test($))||s[qu.SCALAR];if(s.compat){let i=s.compat.find((R)=>R.default&&R.test?.test($))??s[qu.SCALAR];if(g.tag!==i.tag){let R=_.tagString(g.tag),S=_.tagString(i.tag),L=`Value may be parsed as either ${R} or ${S}`;f(w,"TAG_RESOLVE_FAILED",L,!0)}}return g}yq.composeScalar=lq});var Tf=P((hq)=>{function nq(u,_,s){if(_){s??(s=_.length);for(let $=s-1;$>=0;--$){let w=_[$];switch(w.type){case"space":case"comment":case"newline":u-=w.source.length;continue}w=_[++$];while(w?.type==="space")u+=w.source.length,w=_[++$];break}}return u}hq.emptyScalarPosition=nq});var Of=P((oq)=>{var cq=Nu(),xq=X(),pq=gf(),qf=If(),kq=Xu(),aq=Tf(),tq={composeNode:Lf,composeEmptyNode:vs};function Lf(u,_,s,$){let w=u.atKey,{spaceBefore:f,comment:g,anchor:i,tag:R}=s,S,L=!0;switch(_.type){case"alias":if(S=vq(u,_,$),i||R)$(_,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(S=qf.composeScalar(u,_,R,$),i)S.anchor=i.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(S=pq.composeCollection(tq,u,_,s,$),i)S.anchor=i.source.substring(1)}catch(I){let T=I instanceof Error?I.message:String(I);$(_,"RESOURCE_EXHAUSTION",T)}break;default:{let I=_.type==="error"?_.message:`Unsupported token (type: ${_.type})`;$(_,"UNEXPECTED_TOKEN",I),L=!1}}if(S??(S=vs(u,_.offset,void 0,null,s,$)),i&&S.anchor==="")$(i,"BAD_ALIAS","Anchor cannot be an empty string");if(w&&u.options.stringKeys&&(!xq.isScalar(S)||typeof S.value!=="string"||S.tag&&S.tag!=="tag:yaml.org,2002:str"))$(R??_,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(f)S.spaceBefore=!0;if(g)if(_.type==="scalar"&&_.source==="")S.comment=g;else S.commentBefore=g;if(u.options.keepSourceTokens&&L)S.srcToken=_;return S}function vs(u,_,s,$,{spaceBefore:w,comment:f,anchor:g,tag:i,end:R},S){let L={type:"scalar",offset:aq.emptyScalarPosition(_,s,$),indent:-1,source:""},I=qf.composeScalar(u,L,i,S);if(g){if(I.anchor=g.source.substring(1),I.anchor==="")S(g,"BAD_ALIAS","Anchor cannot be an empty string")}if(w)I.spaceBefore=!0;if(f)I.comment=f,I.range[2]=R;return I}function vq({options:u},{offset:_,source:s,end:$},w){let f=new cq.Alias(s.substring(1));if(f.source==="")w(_,"BAD_ALIAS","Alias cannot be an empty string");if(f.source.endsWith(":"))w(_+s.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let g=_+s.length,i=kq.resolveEnd($,g,u.strict,w);if(f.range=[_,g,i.offset],i.comment)f.comment=i.comment;return f}oq.composeEmptyNode=vs;oq.composeNode=Lf});var Hf=P((fL)=>{var _L=cu(),Uf=Of(),sL=Xu(),$L=pu();function wL(u,_,{offset:s,start:$,value:w,end:f},g){let i=Object.assign({_directives:_},u),R=new _L.Document(void 0,i),S={atKey:!1,atRoot:!0,directives:R.directives,options:R.options,schema:R.schema},L=$L.resolveProps($,{indicator:"doc-start",next:w??f?.[0],offset:s,onError:g,parentIndent:0,startOnNewline:!0});if(L.found){if(R.directives.docStart=!0,w&&(w.type==="block-map"||w.type==="block-seq")&&!L.hasNewline)g(L.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}R.contents=w?Uf.composeNode(S,w,L,g):Uf.composeEmptyNode(S,L.end,$,null,L,g);let I=R.contents.range[2],T=sL.resolveEnd(f,I,!1,g);if(T.comment)R.comment=T.comment;return R.range=[s,I,T.offset],R}fL.composeDoc=wL});var os=P((qL)=>{var iL=s_("process"),RL=ss(),SL=cu(),ku=xu(),Pf=X(),IL=Hf(),TL=Xu();function au(u){if(typeof u==="number")return[u,u+1];if(Array.isArray(u))return u.length===2?u:[u[0],u[1]];let{offset:_,source:s}=u;return[_,_+(typeof s==="string"?s.length:1)]}function Df(u){let _="",s=!1,$=!1;for(let w=0;w<u.length;++w){let f=u[w];switch(f[0]){case"#":_+=(_===""?"":$?`
|
|
101
101
|
|
|
102
102
|
`:`
|
|
103
|
-
`)+(
|
|
104
|
-
${s}`:s;else if($||u.directives.docStart||!
|
|
105
|
-
${
|
|
106
|
-
${
|
|
107
|
-
${_.comment}`:_.comment}this.doc.range[2]=_.offset;break}default:this.errors.push(new ku.YAMLParseError(
|
|
108
|
-
`}];switch(
|
|
109
|
-
`),
|
|
110
|
-
`,T=[{type:"block-scalar-header",offset:
|
|
111
|
-
`});return{type:"block-scalar",offset:
|
|
112
|
-
`),$=_.substring(0,s),
|
|
113
|
-
`;if(u.type==="block-scalar"){let
|
|
114
|
-
`});for(let R of Object.keys(u))if(R!=="type"&&R!=="offset")delete u[R];Object.assign(u,{type:"block-scalar",indent:
|
|
115
|
-
`};delete u.items,Object.assign(u,{type:s,source:_,end:[
|
|
103
|
+
`)+(f.substring(1)||" "),s=!0,$=!1;break;case"%":if(u[w+1]?.[0]!=="#")w+=1;s=!1;break;default:if(!s)$=!0;s=!1}}return{comment:_,afterEmptyLine:$}}class Af{constructor(u={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(_,s,$,w)=>{let f=au(_);if(w)this.warnings.push(new ku.YAMLWarning(f,s,$));else this.errors.push(new ku.YAMLParseError(f,s,$))},this.directives=new RL.Directives({version:u.version||"1.2"}),this.options=u}decorate(u,_){let{comment:s,afterEmptyLine:$}=Df(this.prelude);if(s){let w=u.contents;if(_)u.comment=u.comment?`${u.comment}
|
|
104
|
+
${s}`:s;else if($||u.directives.docStart||!w)u.commentBefore=s;else if(Pf.isCollection(w)&&!w.flow&&w.items.length>0){let f=w.items[0];if(Pf.isPair(f))f=f.key;let g=f.commentBefore;f.commentBefore=g?`${s}
|
|
105
|
+
${g}`:s}else{let f=w.commentBefore;w.commentBefore=f?`${s}
|
|
106
|
+
${f}`:s}}if(_){for(let w=0;w<this.errors.length;++w)u.errors.push(this.errors[w]);for(let w=0;w<this.warnings.length;++w)u.warnings.push(this.warnings[w])}else u.errors=this.errors,u.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Df(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(u,_=!1,s=-1){for(let $ of u)yield*this.next($);yield*this.end(_,s)}*next(u){if(iL.env.LOG_STREAM)console.dir(u,{depth:null});switch(u.type){case"directive":this.directives.add(u.source,(_,s,$)=>{let w=au(u);w[0]+=_,this.onError(w,"BAD_DIRECTIVE",s,$)}),this.prelude.push(u.source),this.atDirectives=!0;break;case"document":{let _=IL.composeDoc(this.options,this.directives,u,this.onError);if(this.atDirectives&&!_.directives.docStart)this.onError(u,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(_,!1),this.doc)yield this.doc;this.doc=_,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(u.source);break;case"error":{let _=u.source?`${u.message}: ${JSON.stringify(u.source)}`:u.message,s=new ku.YAMLParseError(au(u),"UNEXPECTED_TOKEN",_);if(this.atDirectives||!this.doc)this.errors.push(s);else this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){this.errors.push(new ku.YAMLParseError(au(u),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let _=TL.resolveEnd(u.end,u.offset+u.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),_.comment){let s=this.doc.comment;this.doc.comment=s?`${s}
|
|
107
|
+
${_.comment}`:_.comment}this.doc.range[2]=_.offset;break}default:this.errors.push(new ku.YAMLParseError(au(u),"UNEXPECTED_TOKEN",`Unsupported token ${u.type}`))}}*end(u=!1,_=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(u){let s=Object.assign({_directives:this.directives},this.options),$=new SL.Document(void 0,s);if(this.atDirectives)this.onError(_,"MISSING_CHAR","Missing directives-end indicator line");$.range=[0,_,_],this.decorate($,!1),yield $}}}qL.Composer=Af});var Yf=P((zL)=>{var OL=ks(),UL=ts(),HL=xu(),Ff=Eu();function PL(u,_=!0,s){if(u){let $=(w,f,g)=>{let i=typeof w==="number"?w:Array.isArray(w)?w[0]:w.offset;if(s)s(i,f,g);else throw new HL.YAMLParseError([i,i+1],f,g)};switch(u.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return UL.resolveFlowScalar(u,_,$);case"block-scalar":return OL.resolveBlockScalar({options:{strict:_}},u,$)}}return null}function DL(u,_){let{implicitKey:s=!1,indent:$,inFlow:w=!1,offset:f=-1,type:g="PLAIN"}=_,i=Ff.stringifyString({type:g,value:u},{implicitKey:s,indent:$>0?" ".repeat($):"",inFlow:w,options:{blockQuote:!0,lineWidth:-1}}),R=_.end??[{type:"newline",offset:-1,indent:$,source:`
|
|
108
|
+
`}];switch(i[0]){case"|":case">":{let S=i.indexOf(`
|
|
109
|
+
`),L=i.substring(0,S),I=i.substring(S+1)+`
|
|
110
|
+
`,T=[{type:"block-scalar-header",offset:f,indent:$,source:L}];if(!zf(T,R))T.push({type:"newline",offset:-1,indent:$,source:`
|
|
111
|
+
`});return{type:"block-scalar",offset:f,indent:$,props:T,source:I}}case'"':return{type:"double-quoted-scalar",offset:f,indent:$,source:i,end:R};case"'":return{type:"single-quoted-scalar",offset:f,indent:$,source:i,end:R};default:return{type:"scalar",offset:f,indent:$,source:i,end:R}}}function AL(u,_,s={}){let{afterKey:$=!1,implicitKey:w=!1,inFlow:f=!1,type:g}=s,i="indent"in u?u.indent:null;if($&&typeof i==="number")i+=2;if(!g)switch(u.type){case"single-quoted-scalar":g="QUOTE_SINGLE";break;case"double-quoted-scalar":g="QUOTE_DOUBLE";break;case"block-scalar":{let S=u.props[0];if(S.type!=="block-scalar-header")throw Error("Invalid block scalar header");g=S.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:g="PLAIN"}let R=Ff.stringifyString({type:g,value:_},{implicitKey:w||i===null,indent:i!==null&&i>0?" ".repeat(i):"",inFlow:f,options:{blockQuote:!0,lineWidth:-1}});switch(R[0]){case"|":case">":FL(u,R);break;case'"':es(u,R,"double-quoted-scalar");break;case"'":es(u,R,"single-quoted-scalar");break;default:es(u,R,"scalar")}}function FL(u,_){let s=_.indexOf(`
|
|
112
|
+
`),$=_.substring(0,s),w=_.substring(s+1)+`
|
|
113
|
+
`;if(u.type==="block-scalar"){let f=u.props[0];if(f.type!=="block-scalar-header")throw Error("Invalid block scalar header");f.source=$,u.source=w}else{let{offset:f}=u,g="indent"in u?u.indent:-1,i=[{type:"block-scalar-header",offset:f,indent:g,source:$}];if(!zf(i,"end"in u?u.end:void 0))i.push({type:"newline",offset:-1,indent:g,source:`
|
|
114
|
+
`});for(let R of Object.keys(u))if(R!=="type"&&R!=="offset")delete u[R];Object.assign(u,{type:"block-scalar",indent:g,props:i,source:w})}}function zf(u,_){if(_)for(let s of _)switch(s.type){case"space":case"comment":u.push(s);break;case"newline":return u.push(s),!0}return!1}function es(u,_,s){switch(u.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":u.type=s,u.source=_;break;case"block-scalar":{let $=u.props.slice(1),w=_.length;if(u.props[0].type==="block-scalar-header")w-=u.props[0].source.length;for(let f of $)f.offset+=w;delete u.props,Object.assign(u,{type:s,source:_,end:$});break}case"block-map":case"block-seq":{let w={type:"newline",offset:u.offset+_.length,indent:u.indent,source:`
|
|
115
|
+
`};delete u.items,Object.assign(u,{type:s,source:_,end:[w]});break}default:{let $="indent"in u?u.indent:-1,w="end"in u&&Array.isArray(u.end)?u.end.filter((f)=>f.type==="space"||f.type==="comment"||f.type==="newline"):[];for(let f of Object.keys(u))if(f!=="type"&&f!=="offset")delete u[f];Object.assign(u,{type:s,indent:$,source:_,end:w})}}}zL.createScalarToken=DL;zL.resolveAsScalar=PL;zL.setScalarValue=AL});var Gf=P((JL)=>{var XL=(u)=>("type"in u)?y_(u):r_(u);function y_(u){switch(u.type){case"block-scalar":{let _="";for(let s of u.props)_+=y_(s);return _+u.source}case"block-map":case"block-seq":{let _="";for(let s of u.items)_+=r_(s);return _}case"flow-collection":{let _=u.start.source;for(let s of u.items)_+=r_(s);for(let s of u.end)_+=s.source;return _}case"document":{let _=r_(u);if(u.end)for(let s of u.end)_+=s.source;return _}default:{let _=u.source;if("end"in u&&u.end)for(let s of u.end)_+=s.source;return _}}}function r_({start:u,key:_,sep:s,value:$}){let w="";for(let f of u)w+=f.source;if(_)w+=y_(_);if(s)for(let f of s)w+=f.source;if($)w+=y_($);return w}JL.stringify=XL});var Jf=P((ML)=>{var u$=Symbol("break visit"),ZL=Symbol("skip children"),Wf=Symbol("remove item");function Lu(u,_){if("type"in u&&u.type==="document")u={start:u.start,value:u.value};Xf(Object.freeze([]),u,_)}Lu.BREAK=u$;Lu.SKIP=ZL;Lu.REMOVE=Wf;Lu.itemAtPath=(u,_)=>{let s=u;for(let[$,w]of _){let f=s?.[$];if(f&&"items"in f)s=f.items[w];else return}return s};Lu.parentCollection=(u,_)=>{let s=Lu.itemAtPath(u,_.slice(0,-1)),$=_[_.length-1][0],w=s?.[$];if(w&&"items"in w)return w;throw Error("Parent collection not found")};function Xf(u,_,s){let $=s(_,u);if(typeof $==="symbol")return $;for(let w of["key","value"]){let f=_[w];if(f&&"items"in f){for(let g=0;g<f.items.length;++g){let i=Xf(Object.freeze(u.concat([[w,g]])),f.items[g],s);if(typeof i==="number")g=i-1;else if(i===u$)return u$;else if(i===Wf)f.items.splice(g,1),g-=1}if(typeof $==="function"&&w==="key")$=$(_,u)}}return typeof $==="function"?$(_,u):$}ML.visit=Lu});var d_=P((lL)=>{var _$=Yf(),NL=Gf(),VL=Jf(),s$="\uFEFF",$$="\x02",w$="\x18",f$="\x1F",jL=(u)=>!!u&&("items"in u),bL=(u)=>!!u&&(u.type==="scalar"||u.type==="single-quoted-scalar"||u.type==="double-quoted-scalar"||u.type==="block-scalar");function EL(u){switch(u){case s$:return"<BOM>";case $$:return"<DOC>";case w$:return"<FLOW_END>";case f$:return"<SCALAR>";default:return JSON.stringify(u)}}function CL(u){switch(u){case s$:return"byte-order-mark";case $$:return"doc-mode";case w$:return"flow-error-end";case f$:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
116
116
|
`:case`\r
|
|
117
|
-
`: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(u[0]){case" ":case"\t":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}
|
|
118
|
-
`:case"\r":case"\t":return!0;default:return!1}}var
|
|
119
|
-
\r `),
|
|
117
|
+
`: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(u[0]){case" ":case"\t":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}lL.createScalarToken=_$.createScalarToken;lL.resolveAsScalar=_$.resolveAsScalar;lL.setScalarValue=_$.setScalarValue;lL.stringify=NL.stringify;lL.visit=VL.visit;lL.BOM=s$;lL.DOCUMENT=$$;lL.FLOW_END=w$;lL.SCALAR=f$;lL.isCollection=jL;lL.isScalar=bL;lL.prettyToken=EL;lL.tokenType=CL});var i$=P((eL)=>{var tu=d_();function y(u){switch(u){case void 0:case" ":case`
|
|
118
|
+
`:case"\r":case"\t":return!0;default:return!1}}var Bf=new Set("0123456789ABCDEFabcdef"),vL=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),n_=new Set(",[]{}"),oL=new Set(` ,[]{}
|
|
119
|
+
\r `),g$=(u)=>!u||oL.has(u);class Zf{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(u,_=!1){if(u){if(typeof u!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+u:u,this.lineEndPos=null}this.atEnd=!_;let s=this.next??"stream";while(s&&(_||this.hasChars(1)))s=yield*this.parseNext(s)}atLineEnd(){let u=this.pos,_=this.buffer[u];while(_===" "||_==="\t")_=this.buffer[++u];if(!_||_==="#"||_===`
|
|
120
120
|
`)return!0;if(_==="\r")return this.buffer[u+1]===`
|
|
121
121
|
`;return!1}charAt(u){return this.buffer[this.pos+u]}continueScalar(u){let _=this.buffer[u];if(this.indentNext>0){let s=0;while(_===" ")_=this.buffer[++s+u];if(_==="\r"){let $=this.buffer[s+u+1];if($===`
|
|
122
122
|
`||!$&&!this.atEnd)return u+s+1}return _===`
|
|
123
123
|
`||s>=this.indentNext||!_&&!this.atEnd?u+s:-1}if(_==="-"||_==="."){let s=this.buffer.substr(u,3);if((s==="---"||s==="...")&&y(this.buffer[u+3]))return-1}return u}getLine(){let u=this.lineEndPos;if(typeof u!=="number"||u!==-1&&u<this.pos)u=this.buffer.indexOf(`
|
|
124
|
-
`,this.pos),this.lineEndPos=u;if(u===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[u-1]==="\r")u-=1;return this.buffer.substring(this.pos,u)}hasChars(u){return this.pos+u<=this.buffer.length}setNext(u){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=u,null}peek(u){return this.buffer.substr(this.pos,u)}*parseNext(u){switch(u){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let u=this.getLine();if(u===null)return this.setNext("stream");if(u[0]===tu.BOM)yield*this.pushCount(1),u=u.substring(1);if(u[0]==="%"){let _=u.length,s=u.indexOf("#");while(s!==-1){let
|
|
125
|
-
`,this.pos);if($!==-1){while($!==-1){let
|
|
126
|
-
`,
|
|
127
|
-
`:u=
|
|
128
|
-
`)break}default:break u}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(_>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=_;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let
|
|
129
|
-
`,
|
|
130
|
-
`)s=this.buffer[++$];u=$-1}else if(!this.blockScalarKeep)do{let
|
|
131
|
-
`&&
|
|
124
|
+
`,this.pos),this.lineEndPos=u;if(u===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[u-1]==="\r")u-=1;return this.buffer.substring(this.pos,u)}hasChars(u){return this.pos+u<=this.buffer.length}setNext(u){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=u,null}peek(u){return this.buffer.substr(this.pos,u)}*parseNext(u){switch(u){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let u=this.getLine();if(u===null)return this.setNext("stream");if(u[0]===tu.BOM)yield*this.pushCount(1),u=u.substring(1);if(u[0]==="%"){let _=u.length,s=u.indexOf("#");while(s!==-1){let w=u[s-1];if(w===" "||w==="\t"){_=s-1;break}else s=u.indexOf("#",s+1)}while(!0){let w=u[_-1];if(w===" "||w==="\t")_-=1;else break}let $=(yield*this.pushCount(_))+(yield*this.pushSpaces(!0));return yield*this.pushCount(u.length-$),this.pushNewline(),"stream"}if(this.atLineEnd()){let _=yield*this.pushSpaces(!0);return yield*this.pushCount(u.length-_),yield*this.pushNewline(),"stream"}return yield tu.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let u=this.charAt(0);if(!u&&!this.atEnd)return this.setNext("line-start");if(u==="-"||u==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let _=this.peek(3);if((_==="---"||_==="...")&&y(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,_==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!y(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[u,_]=this.peek(2);if(!_&&!this.atEnd)return this.setNext("block-start");if((u==="-"||u==="?"||u===":")&&y(_)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let u=this.getLine();if(u===null)return this.setNext("doc");let _=yield*this.pushIndicators();switch(u[_]){case"#":yield*this.pushCount(u.length-_);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(g$),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return _+=yield*this.parseBlockScalarHeader(),_+=yield*this.pushSpaces(!0),yield*this.pushCount(u.length-_),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let u,_,s=-1;do{if(u=yield*this.pushNewline(),u>0)_=yield*this.pushSpaces(!1),this.indentValue=s=_;else _=0;_+=yield*this.pushSpaces(!0)}while(u+_>0);let $=this.getLine();if($===null)return this.setNext("flow");if(s!==-1&&s<this.indentNext&&$[0]!=="#"||s===0&&($.startsWith("---")||$.startsWith("..."))&&y($[3])){if(!(s===this.indentNext-1&&this.flowLevel===1&&($[0]==="]"||$[0]==="}")))return this.flowLevel=0,yield tu.FLOW_END,yield*this.parseLineStart()}let w=0;while($[w]===",")w+=yield*this.pushCount(1),w+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(w+=yield*this.pushIndicators(),$[w]){case void 0:return"flow";case"#":return yield*this.pushCount($.length-w),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(g$),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let f=this.charAt(1);if(this.flowKey||y(f)||f===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let u=this.charAt(0),_=this.buffer.indexOf(u,this.pos+1);if(u==="'")while(_!==-1&&this.buffer[_+1]==="'")_=this.buffer.indexOf("'",_+2);else while(_!==-1){let w=0;while(this.buffer[_-1-w]==="\\")w+=1;if(w%2===0)break;_=this.buffer.indexOf('"',_+1)}let s=this.buffer.substring(0,_),$=s.indexOf(`
|
|
125
|
+
`,this.pos);if($!==-1){while($!==-1){let w=this.continueScalar($+1);if(w===-1)break;$=s.indexOf(`
|
|
126
|
+
`,w)}if($!==-1)_=$-(s[$-1]==="\r"?2:1)}if(_===-1){if(!this.atEnd)return this.setNext("quoted-scalar");_=this.buffer.length}return yield*this.pushToIndex(_+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let u=this.pos;while(!0){let _=this.buffer[++u];if(_==="+")this.blockScalarKeep=!0;else if(_>"0"&&_<="9")this.blockScalarIndent=Number(_)-1;else if(_!=="-")break}return yield*this.pushUntil((_)=>y(_)||_==="#")}*parseBlockScalar(){let u=this.pos-1,_=0,s;u:for(let w=this.pos;s=this.buffer[w];++w)switch(s){case" ":_+=1;break;case`
|
|
127
|
+
`:u=w,_=0;break;case"\r":{let f=this.buffer[w+1];if(!f&&!this.atEnd)return this.setNext("block-scalar");if(f===`
|
|
128
|
+
`)break}default:break u}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(_>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=_;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let w=this.continueScalar(u+1);if(w===-1)break;u=this.buffer.indexOf(`
|
|
129
|
+
`,w)}while(u!==-1);if(u===-1){if(!this.atEnd)return this.setNext("block-scalar");u=this.buffer.length}}let $=u+1;s=this.buffer[$];while(s===" ")s=this.buffer[++$];if(s==="\t"){while(s==="\t"||s===" "||s==="\r"||s===`
|
|
130
|
+
`)s=this.buffer[++$];u=$-1}else if(!this.blockScalarKeep)do{let w=u-1,f=this.buffer[w];if(f==="\r")f=this.buffer[--w];let g=w;while(f===" ")f=this.buffer[--w];if(f===`
|
|
131
|
+
`&&w>=this.pos&&w+1+_>g)u=w;else break}while(!0);return yield tu.SCALAR,yield*this.pushToIndex(u+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let u=this.flowLevel>0,_=this.pos-1,s=this.pos-1,$;while($=this.buffer[++s])if($===":"){let w=this.buffer[s+1];if(y(w)||u&&n_.has(w))break;_=s}else if(y($)){let w=this.buffer[s+1];if($==="\r")if(w===`
|
|
132
132
|
`)s+=1,$=`
|
|
133
|
-
`,
|
|
134
|
-
`){let
|
|
133
|
+
`,w=this.buffer[s+1];else _=s;if(w==="#"||u&&n_.has(w))break;if($===`
|
|
134
|
+
`){let f=this.continueScalar(s+1);if(f===-1)break;s=Math.max(s,f-2)}}else{if(u&&n_.has($))break;_=s}if(!$&&!this.atEnd)return this.setNext("plain-scalar");return yield tu.SCALAR,yield*this.pushToIndex(_+1,!0),u?"flow":"doc"}*pushCount(u){if(u>0)return yield this.buffer.substr(this.pos,u),this.pos+=u,u;return 0}*pushToIndex(u,_){let s=this.buffer.slice(this.pos,u);if(s)return yield s,this.pos+=s.length,s.length;else if(_)yield"";return 0}*pushIndicators(){let u=0;u:while(!0){switch(this.charAt(0)){case"!":u+=yield*this.pushTag(),u+=yield*this.pushSpaces(!0);continue u;case"&":u+=yield*this.pushUntil(g$),u+=yield*this.pushSpaces(!0);continue u;case"-":case"?":case":":{let _=this.flowLevel>0,s=this.charAt(1);if(y(s)||_&&n_.has(s)){if(!_)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;u+=yield*this.pushCount(1),u+=yield*this.pushSpaces(!0);continue u}}}break u}return u}*pushTag(){if(this.charAt(1)==="<"){let u=this.pos+2,_=this.buffer[u];while(!y(_)&&_!==">")_=this.buffer[++u];return yield*this.pushToIndex(_===">"?u+1:u,!1)}else{let u=this.pos+1,_=this.buffer[u];while(_)if(vL.has(_))_=this.buffer[++u];else if(_==="%"&&Bf.has(this.buffer[u+1])&&Bf.has(this.buffer[u+2]))_=this.buffer[u+=3];else break;return yield*this.pushToIndex(u,!1)}}*pushNewline(){let u=this.buffer[this.pos];if(u===`
|
|
135
135
|
`)return yield*this.pushCount(1);else if(u==="\r"&&this.charAt(1)===`
|
|
136
|
-
`)return yield*this.pushCount(2);else return 0}*pushSpaces(u){let _=this.pos-1,s;do s=this.buffer[++_];while(s===" "||u&&s==="\t");let $=_-this.pos;if($>0)yield this.buffer.substr(this.pos,$),this.pos=_;return $}*pushUntil(u){let _=this.pos,s=this.buffer[_];while(!u(s))s=this.buffer[++_];return yield*this.pushToIndex(_,!1)}}
|
|
136
|
+
`)return yield*this.pushCount(2);else return 0}*pushSpaces(u){let _=this.pos-1,s;do s=this.buffer[++_];while(s===" "||u&&s==="\t");let $=_-this.pos;if($>0)yield this.buffer.substr(this.pos,$),this.pos=_;return $}*pushUntil(u){let _=this.pos,s=this.buffer[_];while(!u(s))s=this.buffer[++_];return yield*this.pushToIndex(_,!1)}}eL.Lexer=Zf});var R$=P((_1)=>{class Mf{constructor(){this.lineStarts=[],this.addNewLine=(u)=>this.lineStarts.push(u),this.linePos=(u)=>{let _=0,s=this.lineStarts.length;while(_<s){let w=_+s>>1;if(this.lineStarts[w]<u)_=w+1;else s=w}if(this.lineStarts[_]===u)return{line:_+1,col:1};if(_===0)return{line:0,col:u};let $=this.lineStarts[_-1];return{line:_,col:u-$+1}}}}_1.LineCounter=Mf});var S$=P((f1)=>{var $1=s_("process"),Qf=d_(),w1=i$();function $u(u,_){for(let s=0;s<u.length;++s)if(u[s].type===_)return!0;return!1}function Nf(u){for(let _=0;_<u.length;++_)switch(u[_].type){case"space":case"comment":case"newline":break;default:return _}return-1}function jf(u){switch(u?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function h_(u){switch(u.type){case"document":return u.start;case"block-map":{let _=u.items[u.items.length-1];return _.sep??_.start}case"block-seq":return u.items[u.items.length-1].start;default:return[]}}function Ju(u){if(u.length===0)return[];let _=u.length;u:while(--_>=0)switch(u[_].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break u}while(u[++_]?.type==="space");return u.splice(_,u.length)}function m_(u,_){if(_.length<1e5)Array.prototype.push.apply(u,_);else for(let s=0;s<_.length;++s)u.push(_[s])}function Vf(u){if(u.start.type==="flow-seq-start"){for(let _ of u.items)if(_.sep&&!_.value&&!$u(_.start,"explicit-key-ind")&&!$u(_.sep,"map-value-ind")){if(_.key)_.value=_.key;if(delete _.key,jf(_.value))if(_.value.end)m_(_.value.end,_.sep);else _.value.end=_.sep;else m_(_.start,_.sep);delete _.sep}}}class bf{constructor(u){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new w1.Lexer,this.onNewLine=u}*parse(u,_=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let s of this.lexer.lex(u,_))yield*this.next(s);if(!_)yield*this.end()}*next(u){if(this.source=u,$1.env.LOG_TOKENS)console.log("|",Qf.prettyToken(u));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=u.length;return}let _=Qf.tokenType(u);if(!_){let s=`Not a YAML token: ${u}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:u}),this.offset+=u.length}else if(_==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=_,yield*this.step(),_){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+u.length);break;case"space":if(this.atNewLine&&u[0]===" ")this.indent+=u.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=u.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=u.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let u=this.peek(1);if(this.type==="doc-end"&&u?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!u)return yield*this.stream();switch(u.type){case"document":return yield*this.document(u);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(u);case"block-scalar":return yield*this.blockScalar(u);case"block-map":return yield*this.blockMap(u);case"block-seq":return yield*this.blockSequence(u);case"flow-collection":return yield*this.flowCollection(u);case"doc-end":return yield*this.documentEnd(u)}yield*this.pop()}peek(u){return this.stack[this.stack.length-u]}*pop(u){let _=u??this.stack.pop();if(!_)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield _;else{let s=this.peek(1);if(_.type==="block-scalar")_.indent="indent"in s?s.indent:0;else if(_.type==="flow-collection"&&s.type==="document")_.indent=0;if(_.type==="flow-collection")Vf(_);switch(s.type){case"document":s.value=_;break;case"block-scalar":s.props.push(_);break;case"block-map":{let $=s.items[s.items.length-1];if($.value){s.items.push({start:[],key:_,sep:[]}),this.onKeyLine=!0;return}else if($.sep)$.value=_;else{Object.assign($,{key:_,sep:[]}),this.onKeyLine=!$.explicitKey;return}break}case"block-seq":{let $=s.items[s.items.length-1];if($.value)s.items.push({start:[],value:_});else $.value=_;break}case"flow-collection":{let $=s.items[s.items.length-1];if(!$||$.value)s.items.push({start:[],key:_,sep:[]});else if($.sep)$.value=_;else Object.assign($,{key:_,sep:[]});return}default:yield*this.pop(),yield*this.pop(_)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(_.type==="block-map"||_.type==="block-seq")){let $=_.items[_.items.length-1];if($&&!$.sep&&!$.value&&$.start.length>0&&Nf($.start)===-1&&(_.indent===0||$.start.every((w)=>w.type!=="comment"||w.indent<_.indent))){if(s.type==="document")s.end=$.start;else s.items.push({start:$.start});_.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let u={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")u.start.push(this.sourceToken);this.stack.push(u);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(u){if(u.value)return yield*this.lineEnd(u);switch(this.type){case"doc-start":{if(Nf(u.start)!==-1)yield*this.pop(),yield*this.step();else u.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":u.start.push(this.sourceToken);return}let _=this.startBlockValue(u);if(_)this.stack.push(_);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(u){if(this.type==="map-value-ind"){let _=h_(this.peek(2)),s=Ju(_),$;if(u.end)$=u.end,$.push(this.sourceToken),delete u.end;else $=[this.sourceToken];let w={type:"block-map",offset:u.offset,indent:u.indent,items:[{start:s,key:u,sep:$}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=w}else yield*this.lineEnd(u)}*blockScalar(u){switch(this.type){case"space":case"comment":case"newline":u.props.push(this.sourceToken);return;case"scalar":if(u.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let _=this.source.indexOf(`
|
|
137
137
|
`)+1;while(_!==0)this.onNewLine(this.offset+_),_=this.source.indexOf(`
|
|
138
|
-
`,_)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(u){let _=u.items[u.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,_.value){let s="end"in _.value?_.value.end:void 0;if((Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment")s?.push(this.sourceToken);else u.items.push({start:[this.sourceToken]})}else if(_.sep)_.sep.push(this.sourceToken);else _.start.push(this.sourceToken);return;case"space":case"comment":if(_.value)u.items.push({start:[this.sourceToken]});else if(_.sep)_.sep.push(this.sourceToken);else{if(this.atIndentedComment(_.start,u.indent)){let $=u.items[u.items.length-2]?.value?.end;if(Array.isArray($)){
|
|
138
|
+
`,_)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(u){let _=u.items[u.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,_.value){let s="end"in _.value?_.value.end:void 0;if((Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment")s?.push(this.sourceToken);else u.items.push({start:[this.sourceToken]})}else if(_.sep)_.sep.push(this.sourceToken);else _.start.push(this.sourceToken);return;case"space":case"comment":if(_.value)u.items.push({start:[this.sourceToken]});else if(_.sep)_.sep.push(this.sourceToken);else{if(this.atIndentedComment(_.start,u.indent)){let $=u.items[u.items.length-2]?.value?.end;if(Array.isArray($)){m_($,_.start),$.push(this.sourceToken),u.items.pop();return}}_.start.push(this.sourceToken)}return}if(this.indent>=u.indent){let s=!this.onKeyLine&&this.indent===u.indent,$=s&&(_.sep||_.explicitKey)&&this.type!=="seq-item-ind",w=[];if($&&_.sep&&!_.value){let f=[];for(let g=0;g<_.sep.length;++g){let i=_.sep[g];switch(i.type){case"newline":f.push(g);break;case"space":break;case"comment":if(i.indent>u.indent)f.length=0;break;default:f.length=0}}if(f.length>=2)w=_.sep.splice(f[1])}switch(this.type){case"anchor":case"tag":if($||_.value)w.push(this.sourceToken),u.items.push({start:w}),this.onKeyLine=!0;else if(_.sep)_.sep.push(this.sourceToken);else _.start.push(this.sourceToken);return;case"explicit-key-ind":if(!_.sep&&!_.explicitKey)_.start.push(this.sourceToken),_.explicitKey=!0;else if($||_.value)w.push(this.sourceToken),u.items.push({start:w,explicitKey:!0});else 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(_.explicitKey)if(!_.sep)if($u(_.start,"newline"))Object.assign(_,{key:null,sep:[this.sourceToken]});else{let f=Ju(_.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:f,key:null,sep:[this.sourceToken]}]})}else if(_.value)u.items.push({start:[],key:null,sep:[this.sourceToken]});else if($u(_.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:w,key:null,sep:[this.sourceToken]}]});else if(jf(_.key)&&!$u(_.sep,"newline")){let f=Ju(_.start),g=_.key,i=_.sep;i.push(this.sourceToken),delete _.key,delete _.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:f,key:g,sep:i}]})}else if(w.length>0)_.sep=_.sep.concat(w,this.sourceToken);else _.sep.push(this.sourceToken);else if(!_.sep)Object.assign(_,{key:null,sep:[this.sourceToken]});else if(_.value||$)u.items.push({start:w,key:null,sep:[this.sourceToken]});else if($u(_.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else _.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let f=this.flowScalar(this.type);if($||_.value)u.items.push({start:w,key:f,sep:[]}),this.onKeyLine=!0;else if(_.sep)this.stack.push(f);else Object.assign(_,{key:f,sep:[]}),this.onKeyLine=!0;return}default:{let f=this.startBlockValue(u);if(f){if(f.type==="block-seq"){if(!_.explicitKey&&_.sep&&!$u(_.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 if(s)u.items.push({start:w});this.stack.push(f);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(u){let _=u.items[u.items.length-1];switch(this.type){case"newline":if(_.value){let s="end"in _.value?_.value.end:void 0;if((Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment")s?.push(this.sourceToken);else u.items.push({start:[this.sourceToken]})}else _.start.push(this.sourceToken);return;case"space":case"comment":if(_.value)u.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(_.start,u.indent)){let $=u.items[u.items.length-2]?.value?.end;if(Array.isArray($)){m_($,_.start),$.push(this.sourceToken),u.items.pop();return}}_.start.push(this.sourceToken)}return;case"anchor":case"tag":if(_.value||this.indent<=u.indent)break;_.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==u.indent)break;if(_.value||$u(_.start,"seq-item-ind"))u.items.push({start:[this.sourceToken]});else _.start.push(this.sourceToken);return}if(this.indent>u.indent){let s=this.startBlockValue(u);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(u){let _=u.items[u.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(u.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!_||_.sep)u.items.push({start:[this.sourceToken]});else _.start.push(this.sourceToken);return;case"map-value-ind":if(!_||_.value)u.items.push({start:[],key:null,sep:[this.sourceToken]});else if(_.sep)_.sep.push(this.sourceToken);else Object.assign(_,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!_||_.value)u.items.push({start:[this.sourceToken]});else if(_.sep)_.sep.push(this.sourceToken);else _.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let $=this.flowScalar(this.type);if(!_||_.value)u.items.push({start:[],key:$,sep:[]});else if(_.sep)this.stack.push($);else Object.assign(_,{key:$,sep:[]});return}case"flow-map-end":case"flow-seq-end":u.end.push(this.sourceToken);return}let s=this.startBlockValue(u);if(s)this.stack.push(s);else yield*this.pop(),yield*this.step()}else{let s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===u.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 $=h_(s),w=Ju($);Vf(u);let f=u.end.splice(1,u.end.length);f.push(this.sourceToken);let g={type:"block-map",offset:u.offset,indent:u.indent,items:[{start:w,key:u,sep:f}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=g}else yield*this.lineEnd(u)}}flowScalar(u){if(this.onNewLine){let _=this.source.indexOf(`
|
|
139
139
|
`)+1;while(_!==0)this.onNewLine(this.offset+_),_=this.source.indexOf(`
|
|
140
|
-
`,_)+1}return{type:u,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(u){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 _=h_(u),s=Ju(_);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 _=h_(u),s=Ju(_);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(u,_){if(this.type!=="comment")return!1;if(this.indent<=_)return!1;return u.every((s)=>s.type==="newline"||s.type==="space")}*documentEnd(u){if(this.type!=="doc-mode"){if(u.end)u.end.push(this.sourceToken);else u.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(u){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:if(u.end)u.end.push(this.sourceToken);else u.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}
|
|
141
|
-
`)){let $=s.trim();if($===""||$.startsWith("#")||$.startsWith("["))continue;let
|
|
142
|
-
`),
|
|
140
|
+
`,_)+1}return{type:u,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(u){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 _=h_(u),s=Ju(_);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 _=h_(u),s=Ju(_);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(u,_){if(this.type!=="comment")return!1;if(this.indent<=_)return!1;return u.every((s)=>s.type==="newline"||s.type==="space")}*documentEnd(u){if(this.type!=="doc-mode"){if(u.end)u.end.push(this.sourceToken);else u.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(u){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:if(u.end)u.end.push(this.sourceToken);else u.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}f1.Parser=bf});var rf=P((O1)=>{var Ef=os(),i1=cu(),vu=xu(),R1=Rs(),S1=X(),I1=R$(),Cf=S$();function lf(u){let _=u.prettyErrors!==!1;return{lineCounter:u.lineCounter||_&&new I1.LineCounter||null,prettyErrors:_}}function T1(u,_={}){let{lineCounter:s,prettyErrors:$}=lf(_),w=new Cf.Parser(s?.addNewLine),f=new Ef.Composer(_),g=Array.from(f.compose(w.parse(u)));if($&&s)for(let i of g)i.errors.forEach(vu.prettifyError(u,s)),i.warnings.forEach(vu.prettifyError(u,s));if(g.length>0)return g;return Object.assign([],{empty:!0},f.streamInfo())}function Kf(u,_={}){let{lineCounter:s,prettyErrors:$}=lf(_),w=new Cf.Parser(s?.addNewLine),f=new Ef.Composer(_),g=null;for(let i of f.compose(w.parse(u),!0,u.length))if(!g)g=i;else if(g.options.logLevel!=="silent"){g.errors.push(new vu.YAMLParseError(i.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if($&&s)g.errors.forEach(vu.prettifyError(u,s)),g.warnings.forEach(vu.prettifyError(u,s));return g}function q1(u,_,s){let $=void 0;if(typeof _==="function")$=_;else if(s===void 0&&_&&typeof _==="object")s=_;let w=Kf(u,s);if(!w)return null;if(w.warnings.forEach((f)=>R1.warn(w.options.logLevel,f)),w.errors.length>0)if(w.options.logLevel!=="silent")throw w.errors[0];else w.errors=[];return w.toJS(Object.assign({reviver:$},s))}function L1(u,_,s){let $=null;if(typeof _==="function"||Array.isArray(_))$=_;else if(s===void 0&&_)s=_;if(typeof s==="string")s=s.length;if(typeof s==="number"){let w=Math.round(s);s=w<1?void 0:w>8?{indent:8}:{indent:w}}if(u===void 0){let{keepUndefined:w}=s??_??{};if(!w)return}if(S1.isDocument(u)&&!$)return u.toString(s);return new i1.Document(u,$,s).toString(s)}O1.parse=q1;O1.parseAllDocuments=T1;O1.parseDocument=Kf;O1.stringify=L1});import{existsSync as Z$,mkdirSync as e_,readFileSync as _i,writeFileSync as M$}from"node:fs";import{dirname as si,isAbsolute as BU,join as $i,resolve as ZU}from"node:path";var A1=os(),F1=cu(),z1=Cs(),I$=xu(),Y1=Nu(),wu=X(),G1=e(),W1=B(),X1=_u(),J1=su(),aH=d_(),B1=i$(),Z1=R$(),M1=S$(),c_=rf(),yf=Mu();var Q1=A1.Composer,N1=F1.Document,V1=z1.Schema,j1=I$.YAMLError,b1=I$.YAMLParseError,E1=I$.YAMLWarning,C1=Y1.Alias,l1=wu.isAlias,K1=wu.isCollection,r1=wu.isDocument,y1=wu.isMap,d1=wu.isNode,n1=wu.isPair,h1=wu.isScalar,m1=wu.isSeq,c1=G1.Pair,x1=W1.Scalar,p1=X1.YAMLMap,k1=J1.YAMLSeq;var a1=B1.Lexer,t1=Z1.LineCounter,v1=M1.Parser,x_=c_.parse,o1=c_.parseAllDocuments,e1=c_.parseDocument,T$=c_.stringify,uO=yf.visit,_O=yf.visitAsync;var sO=new Set(["none","low","medium","high"]),$O=new Set(["low","medium","high"]);function p_(u,_){if(!u||typeof u!=="object"||Array.isArray(u))throw Error(`${_} must be an object`);return u}function k(u,_,s=_){let $=u[_];if(typeof $!=="string"||$.trim()==="")throw Error(`Missing required string: ${s}`);return $}function df(u){if(!("confidence"in u))return null;let _=u.confidence;if(typeof _!=="string"||!$O.has(_))throw Error(`Invalid confidence: ${String(_)}`);return _}function nf(u){let _=p_(x_(u),"summaries.yaml"),s=k(_,"project_id");if(!Array.isArray(_.summaries))throw Error("summaries must be an array");return{projectId:s,summaries:_.summaries.map(($,w)=>{let f=`summaries[${w}]`,g=p_($,`summaries[${w}]`),i=k(g,"value",`${f}.value`);if(!sO.has(i))throw Error(`Invalid summary value: ${i}`);return df(g),{sessionId:k(g,"session_id",`${f}.session_id`),title:k(g,"title",`${f}.title`),value:i,summaryMarkdown:k(g,"summary_markdown",`${f}.summary_markdown`),metadata:g}})}}function hf(u){let _=p_(x_(u),"experiences.yaml"),s=k(_,"project_id");if(!Array.isArray(_.experiences))throw Error("experiences must be an array");return{projectId:s,experiences:_.experiences.map(($,w)=>{let f=`experiences[${w}]`,g=p_($,f),i=g.source_sessions;if(!Array.isArray(i)||i.some((S)=>typeof S!=="string"))throw Error(`experiences[${w}].source_sessions must be a string array`);let R=df(g);return{title:k(g,"title",`${f}.title`),slug:typeof g.slug==="string"?g.slug:null,summary:k(g,"summary",`${f}.summary`),bodyMarkdown:k(g,"body_markdown",`${f}.body_markdown`),sourceSessions:i,confidence:R,metadata:g}})}}import{existsSync as mf,readFileSync as cf,writeFileSync as wO}from"node:fs";var fO={"obsidian.vault":"obsidian_vault",obsidian_vault:"obsidian_vault"};function gO(u){let _={};for(let s of u.split(`
|
|
141
|
+
`)){let $=s.trim();if($===""||$.startsWith("#")||$.startsWith("["))continue;let w=$.match(/^([\w.]+)\s*=\s*(.*)$/);if(!w)continue;let f=w[1],g=w[2].trim();if(g.startsWith('"')&&g.endsWith('"')||g.startsWith("'")&&g.endsWith("'"))g=g.slice(1,-1);_[f]=g}return _}function q$(u){if(!mf(u))return{obsidianVault:null};let s=gO(cf(u,"utf8")).obsidian_vault;return{obsidianVault:s&&s.trim()!==""?s:null}}function xf(u,_,s){let $=fO[_];if(!$)throw Error(`Unknown config key: ${_}. Supported: obsidian.vault`);let f=(mf(u)?cf(u,"utf8"):"").split(`
|
|
142
|
+
`),g=`${$} = "${s}"`,i=!1,R=f.map((S)=>{if(S.trim().startsWith(`${$} `)||S.trim().startsWith(`${$}=`))return i=!0,g;return S});if(!i)R.push(g);return wO(u,`${R.filter((S,L)=>!(S===""&&L===R.length-1)).join(`
|
|
143
143
|
`)}
|
|
144
|
-
`),$}import{mkdirSync as
|
|
144
|
+
`),$}import{mkdirSync as iO}from"node:fs";import{createRequire as RO}from"node:module";import{dirname as SO}from"node:path";var pf=RO(import.meta.url),kf=typeof globalThis.Bun<"u";function af(u,_){let s=_?{readonly:!0}:void 0;if(kf){let{Database:f}=pf("bun:sqlite");return new f(u,s)}return new(pf("better-sqlite3"))(u,s)}function IO(u){return typeof u==="object"&&u!==null&&!Array.isArray(u)&&!Buffer.isBuffer(u)}function L$(u){if(u.length!==1||!IO(u[0]))return u;if(kf)return u;let _={};for(let[s,$]of Object.entries(u[0]))_[s.replace(/^[$@:]/,"")]=$;return[_]}class tf{statement;constructor(u){this.statement=u}get(...u){return this.statement.get(...L$(u))??null}all(...u){return this.statement.all(...L$(u))}run(...u){return this.statement.run(...L$(u))}}class O${raw;constructor(u){this.raw=u}query(u){return new tf(this.raw.prepare(u))}exec(u){this.raw.exec(u)}transaction(u){return this.raw.transaction(u)}close(){this.raw.close()}}function V(u){return iO(SO(u),{recursive:!0}),new O$(af(u,!1))}function vf(u){try{return new O$(af(u,!0))}catch{return null}}function j(u){u.exec(`
|
|
145
145
|
PRAGMA journal_mode = WAL;
|
|
146
146
|
|
|
147
147
|
CREATE TABLE IF NOT EXISTS projects (
|
|
@@ -279,7 +279,7 @@ ${_.comment}`:_.comment}this.doc.range[2]=_.offset;break}default:this.errors.pus
|
|
|
279
279
|
conflict_status TEXT NOT NULL,
|
|
280
280
|
UNIQUE(note_type, entity_id)
|
|
281
281
|
);
|
|
282
|
-
`)}import{createHash as
|
|
282
|
+
`)}import{createHash as TO}from"node:crypto";function h(u){return TO("sha1").update(u).digest("hex").slice(0,16)}import{spawnSync as qO}from"node:child_process";import{existsSync as LO}from"node:fs";import{basename as OO,resolve as ef}from"node:path";function UO(u){return u.trim().replace(/\/+$/,"").replace(/^ssh:\/\/git@([^/]+)\//,"$1/").replace(/^git@([^:]+):/,"$1/").replace(/^https?:\/\//,"").replace(/\.git$/,"")}function U$(u){return u.normalize("NFKD").replace(/[^\w\s./-]/g,"").trim().toLowerCase().replace(/[\s._/]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"project"}function of(u,_){let s=qO("git",_,{cwd:u,encoding:"utf8"});if(s.status!==0)return null;return s.stdout.trim()||null}function ug(u){let _=of(u,["rev-parse","--show-toplevel"]),s=of(u,["config","--get","remote.origin.url"]),$=s?UO(s):null,w=$??OO(_??u),f=U$(w);return{id:`proj_${h($??_??u)}`,canonicalName:w,slug:f,canonicalRepoUrl:$,identitySource:$?"git_remote":"path"}}function _g(u,_){let s=new Date().toISOString();return u.query(`
|
|
283
283
|
INSERT INTO projects (id, canonical_name, display_name, slug, canonical_repo_url, provider, identity_source, created_at, updated_at)
|
|
284
284
|
VALUES ($id, $canonicalName, NULL, $slug, $canonicalRepoUrl, NULL, $identitySource, $now, $now)
|
|
285
285
|
ON CONFLICT(id) DO UPDATE SET
|
|
@@ -288,7 +288,7 @@ ${_.comment}`:_.comment}this.doc.range[2]=_.offset;break}default:this.errors.pus
|
|
|
288
288
|
canonical_repo_url = excluded.canonical_repo_url,
|
|
289
289
|
identity_source = excluded.identity_source,
|
|
290
290
|
updated_at = excluded.updated_at
|
|
291
|
-
`).run({$id:_.id,$canonicalName:_.canonicalName,$slug:_.slug,$canonicalRepoUrl:_.canonicalRepoUrl,$identitySource:_.identitySource,$now:s}),k_(u,_.id)}function
|
|
291
|
+
`).run({$id:_.id,$canonicalName:_.canonicalName,$slug:_.slug,$canonicalRepoUrl:_.canonicalRepoUrl,$identitySource:_.identitySource,$now:s}),k_(u,_.id)}function fu(u,_){let s=ef(_);if(!LO(s))throw Error(`Path does not exist: ${s}`);return _g(u,ug(s))}function sg(u,_){let s=ef(_);return _g(u,ug(s))}function H$(u,_,s){let $=new Date().toISOString();if(u.query("UPDATE projects SET display_name = $displayName, updated_at = $now WHERE id = $projectId").run({$displayName:s,$projectId:_,$now:$}).changes===0)throw Error(`Project not found: ${_}`);return k_(u,_)}function $g(u){return u.query(`
|
|
292
292
|
SELECT
|
|
293
293
|
p.id,
|
|
294
294
|
p.canonical_name,
|
|
@@ -302,16 +302,26 @@ ${_.comment}`:_.comment}this.doc.range[2]=_.offset;break}default:this.errors.pus
|
|
|
302
302
|
LEFT JOIN sessions s ON s.project_id = p.id
|
|
303
303
|
GROUP BY p.id
|
|
304
304
|
ORDER BY session_count DESC, p.canonical_name ASC
|
|
305
|
-
`).all().map((s)=>({id:s.id,canonicalName:s.canonical_name,displayName:s.display_name,slug:s.slug,canonicalRepoUrl:s.canonical_repo_url,identitySource:s.identity_source,sessionCount:s.session_count,lastSeenAt:s.last_seen_at}))}function k_(u,_){let s=u.query("SELECT * FROM projects WHERE id = ?").get(_);if(!s)throw Error(`Project not found: ${_}`);return{id:s.id,canonicalName:s.canonical_name,displayName:s.display_name,slug:s.slug,canonicalRepoUrl:s.canonical_repo_url,identitySource:s.identity_source}}var
|
|
305
|
+
`).all().map((s)=>({id:s.id,canonicalName:s.canonical_name,displayName:s.display_name,slug:s.slug,canonicalRepoUrl:s.canonical_repo_url,identitySource:s.identity_source,sessionCount:s.session_count,lastSeenAt:s.last_seen_at}))}function k_(u,_){let s=u.query("SELECT * FROM projects WHERE id = ?").get(_);if(!s)throw Error(`Project not found: ${_}`);return{id:s.id,canonicalName:s.canonical_name,displayName:s.display_name,slug:s.slug,canonicalRepoUrl:s.canonical_repo_url,identitySource:s.identity_source}}var HO=`## 输出格式(务必遵守)
|
|
306
306
|
|
|
307
|
-
|
|
308
|
-
\`.llm-iwiki/
|
|
307
|
+
本文件(\`experiences-task.md\`)是任务说明,请勿修改它。
|
|
308
|
+
请**另外新建**一个纯 YAML 文件 \`.llm-iwiki/exchange/experiences.yaml\`,然后运行:
|
|
309
|
+
\`llm-iwiki experiences propose --project . --file .llm-iwiki/exchange/experiences.yaml\`
|
|
310
|
+
|
|
311
|
+
输出文件规则:
|
|
312
|
+
- 只能是 YAML 内容,不要写 Markdown 标题或说明文字,也不要用 \`\`\` 代码围栏把它包起来。
|
|
313
|
+
- 不要保留 \`<...>\` 占位符,全部替换成真实内容。
|
|
314
|
+
- 一条经验可以聚合多个会话,按主题归纳,不要逐会话复述。
|
|
315
|
+
- \`source_sessions\` 必须是字符串数组,填该经验来自哪些 session_id(与下方摘要块标题里的 id 一致)。
|
|
316
|
+
- \`confidence\` 可选,只能取 low / medium / high 其中之一。
|
|
317
|
+
|
|
318
|
+
按下面结构填真实内容(# 后是说明,可删):
|
|
309
319
|
|
|
310
320
|
\`\`\`yaml
|
|
311
|
-
project_id:
|
|
321
|
+
project_id: proj_xxxxxxxx # 用本文件顶部的 project_id
|
|
312
322
|
experiences:
|
|
313
|
-
- title:
|
|
314
|
-
slug:
|
|
323
|
+
- title: 经验标题
|
|
324
|
+
slug: stable-short-id # 可选,省略即可
|
|
315
325
|
summary: |
|
|
316
326
|
一句话说明这条经验。
|
|
317
327
|
body_markdown: |
|
|
@@ -319,24 +329,20 @@ experiences:
|
|
|
319
329
|
## 方案
|
|
320
330
|
## 结论
|
|
321
331
|
source_sessions:
|
|
322
|
-
-
|
|
323
|
-
confidence:
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
要求:
|
|
327
|
-
- 一条经验可以聚合多个会话,按主题归纳,不要逐会话复述。
|
|
328
|
-
- \`source_sessions\` 填写该经验来自哪些 session_id。`;function PL(u,_,s){let $=s==="changed-summaries"?"AND value IN ('medium', 'high')":"";return u.query(`
|
|
332
|
+
- cc_xxxxxxxx
|
|
333
|
+
confidence: medium
|
|
334
|
+
\`\`\``;function PO(u,_,s){let $=s==="changed-summaries"?"AND value IN ('medium', 'high')":"";return u.query(`
|
|
329
335
|
SELECT session_id, title, value, summary_markdown
|
|
330
336
|
FROM session_summaries
|
|
331
337
|
WHERE project_id = ? ${$}
|
|
332
338
|
ORDER BY updated_at DESC
|
|
333
|
-
`).all(_)}function
|
|
334
|
-
`));return{markdown:["# Experiences Task","",`project_id: ${_}`,`scope: ${s}`,`summaries: ${
|
|
339
|
+
`).all(_)}function wg(u,_,s){let w=PO(u,_,s).map((g)=>[`### ${g.session_id} — ${g.title}`,`- value: ${g.value}`,"",g.summary_markdown].join(`
|
|
340
|
+
`));return{markdown:["# Experiences Task","",`project_id: ${_}`,`scope: ${s}`,`summaries: ${w.length}`,"",HO,"","---","",w.join(`
|
|
335
341
|
|
|
336
342
|
---
|
|
337
343
|
|
|
338
344
|
`),""].join(`
|
|
339
|
-
`),summaryCount:
|
|
345
|
+
`),summaryCount:w.length}}function fg(u){return h(u)}function gg(u,_){let s=new Date().toISOString(),$=0;return u.transaction(()=>{for(let f of _.experiences){let g=f.slug&&f.slug.trim()!==""?f.slug:U$(f.title),i=`cand_${fg(`${_.projectId}\x00${g}`)}`;u.query(`
|
|
340
346
|
INSERT INTO experience_candidates (
|
|
341
347
|
id, project_id, proposed_title, proposed_slug, proposed_body_markdown, source_sessions_json, confidence, status, created_at
|
|
342
348
|
) VALUES ($id, $projectId, $title, $slug, $body, $sources, $confidence, 'proposed', $now)
|
|
@@ -345,7 +351,7 @@ experiences:
|
|
|
345
351
|
proposed_body_markdown = excluded.proposed_body_markdown,
|
|
346
352
|
source_sessions_json = excluded.source_sessions_json,
|
|
347
353
|
confidence = excluded.confidence
|
|
348
|
-
`).run({$id:
|
|
354
|
+
`).run({$id:i,$projectId:_.projectId,$title:f.title,$slug:g,$body:f.bodyMarkdown,$sources:JSON.stringify(f.sourceSessions),$confidence:f.confidence,$now:s}),$+=1}})(),{written:$}}function ig(u,_){if(_)return u.query("SELECT id, project_id, proposed_title, proposed_slug, confidence, status, source_sessions_json, created_at FROM experience_candidates WHERE project_id = ? ORDER BY created_at DESC").all(_);return u.query("SELECT id, project_id, proposed_title, proposed_slug, confidence, status, source_sessions_json, created_at FROM experience_candidates ORDER BY created_at DESC").all()}function Rg(u,_){let s=u.query("SELECT project_id, proposed_title, proposed_slug, proposed_body_markdown, confidence, source_sessions_json FROM experience_candidates WHERE id = ?").get(_);if(!s)throw Error(`Experience candidate not found: ${_}`);let $=[];try{let i=JSON.parse(s.source_sessions_json);if(Array.isArray(i))$=i.filter((R)=>typeof R==="string")}catch{$=[]}let w=new Date().toISOString(),f=`exp_${fg(`${s.project_id}\x00${s.proposed_slug}`)}`;return u.transaction(()=>{u.query(`
|
|
349
355
|
INSERT INTO experiences (
|
|
350
356
|
id, project_id, title, slug, body_markdown, confidence, status, created_at, updated_at
|
|
351
357
|
) VALUES ($id, $projectId, $title, $slug, $body, $confidence, 'accepted', $now, $now)
|
|
@@ -355,14 +361,14 @@ experiences:
|
|
|
355
361
|
confidence = excluded.confidence,
|
|
356
362
|
status = 'accepted',
|
|
357
363
|
updated_at = excluded.updated_at
|
|
358
|
-
`).run({$id:
|
|
364
|
+
`).run({$id:f,$projectId:s.project_id,$title:s.proposed_title,$slug:s.proposed_slug,$body:s.proposed_body_markdown,$confidence:s.confidence,$now:w});let R=u.query("SELECT id FROM experiences WHERE project_id = ? AND slug = ?").get(s.project_id,s.proposed_slug)?.id??f;for(let S of $)u.query(`
|
|
359
365
|
INSERT INTO session_experience_links (session_id, experience_id, relation)
|
|
360
366
|
VALUES (?, ?, 'source')
|
|
361
367
|
ON CONFLICT(session_id, experience_id) DO NOTHING
|
|
362
|
-
`).run(S,R);u.query("UPDATE experience_candidates SET status = 'accepted' WHERE id = ?").run(_)})(),{experienceId:
|
|
363
|
-
`)}function
|
|
368
|
+
`).run(S,R);u.query("UPDATE experience_candidates SET status = 'accepted' WHERE id = ?").run(_)})(),{experienceId:f,slug:s.proposed_slug,linkedSessions:$.length}}function Sg(u,_){if(u.query("UPDATE experience_candidates SET status = 'rejected' WHERE id = ?").run(_).changes===0)throw Error(`Experience candidate not found: ${_}`)}import{existsSync as Tg,mkdirSync as DO,readFileSync as qg,writeFileSync as Ig}from"node:fs";import{dirname as AO,join as ou}from"node:path";var t_="<!-- aiwiki:managed:start -->",Lg="<!-- aiwiki:managed:end -->";function v_(u){return h(u)}function D$(u){let _=u.replace(/[\\/:*?"<>|]/g," ").replace(/\s+/g," ").trim().slice(0,80);return _===""?"untitled":_}function FO(u){let _=T$(u.frontmatter).trimEnd(),s=u.userSectionHeading??"## 我的补充";return["---",_,"---","",`# ${u.title}`,"",t_,u.managedBody.trim(),Lg,"",s,"",""].join(`
|
|
369
|
+
`)}function Og(u){let _=u.indexOf(t_),s=u.indexOf(Lg);if(_===-1||s===-1||s<_)return null;return{before:u.slice(0,_+t_.length),managed:u.slice(_+t_.length,s).trim(),after:u.slice(s)}}function zO(u,_){return`${u.before}
|
|
364
370
|
${_.trim()}
|
|
365
|
-
${u.after}`}function
|
|
371
|
+
${u.after}`}function YO(u,_,s){return u.query("SELECT managed_hash, file_path FROM obsidian_notes WHERE note_type = ? AND entity_id = ?").get(_,s)}function a_(u,_,s,$,w,f){u.query(`
|
|
366
372
|
INSERT INTO obsidian_notes (id, note_type, entity_id, file_path, managed_hash, frontmatter_hash, last_exported_at, conflict_status)
|
|
367
373
|
VALUES ($id, $noteType, $entityId, $filePath, $managedHash, NULL, $now, $conflictStatus)
|
|
368
374
|
ON CONFLICT(note_type, entity_id) DO UPDATE SET
|
|
@@ -370,83 +376,189 @@ ${u.after}`}function WL(u,_,s){return u.query("SELECT managed_hash, file_path FR
|
|
|
370
376
|
managed_hash = excluded.managed_hash,
|
|
371
377
|
last_exported_at = excluded.last_exported_at,
|
|
372
378
|
conflict_status = excluded.conflict_status
|
|
373
|
-
`).run({$id:`note_${v_(`${_.noteType}\x00${_.entityId}`)}`,$noteType:_.noteType,$entityId:_.entityId,$filePath:s,$managedHash:$,$conflictStatus:
|
|
379
|
+
`).run({$id:`note_${v_(`${_.noteType}\x00${_.entityId}`)}`,$noteType:_.noteType,$entityId:_.entityId,$filePath:s,$managedHash:$,$conflictStatus:w,$now:f})}function P$(u,_,s,$,w){let f=ou(_,s.relPath),g=v_(s.managedBody.trim());if(!Tg(f))return DO(AO(f),{recursive:!0}),Ig(f,FO(s)),a_(u,s,f,g,"clean",w),"created";let i=qg(f,"utf8"),R=Og(i);if(!R)return a_(u,s,f,g,"no_managed_block",w),"conflict";let S=v_(R.managed),L=YO(u,s.noteType,s.entityId),I=!L||L.managed_hash!==S;if(I&&!$.force)return a_(u,s,f,L?.managed_hash??S,"managed_conflict",w),"conflict";return Ig(f,zO(R,s.managedBody)),a_(u,s,f,g,"clean",w),I?"forced":"updated"}function GO(u){return D$(u.displayName??u.canonicalName??u.slug)}function Ug(u,_,s,$){let w=new Date().toISOString(),f={created:0,updated:0,forced:0,conflicts:[]},g=GO(s),i=ou("LLM-iWiki","Projects",g),R=s.displayName??s.canonicalName,S=(q,U)=>{if(q==="created")f.created+=1;else if(q==="updated")f.updated+=1;else if(q==="forced")f.forced+=1;else f.conflicts.push(U)},L=u.query(`
|
|
374
380
|
SELECT id, session_id, title, value, summary_markdown, updated_at
|
|
375
381
|
FROM session_summaries WHERE project_id = ? ORDER BY updated_at DESC
|
|
376
|
-
`).all(s.id);for(let q of
|
|
382
|
+
`).all(s.id);for(let q of L){let U=ou(i,"Sessions",`${D$(q.title)}.md`),D={noteType:"session-summary",entityId:q.id,relPath:U,title:q.title,managedBody:q.summary_markdown,frontmatter:{type:"session-summary",aiwiki_id:q.id,aiwiki_project_id:s.id,project:R,session_id:q.session_id,value:q.value,updated_at:q.updated_at??w}};S(P$(u,_,D,$,w),U)}let I=u.query(`
|
|
377
383
|
SELECT id, title, slug, body_markdown, confidence, status, updated_at
|
|
378
384
|
FROM experiences WHERE project_id = ? AND status = 'accepted' ORDER BY updated_at DESC
|
|
379
|
-
`).all(s.id);for(let q of I){let U=ou(
|
|
380
|
-
`),H={noteType:"project-summary",entityId:s.id,relPath:T,title:R,managedBody:
|
|
385
|
+
`).all(s.id);for(let q of I){let U=ou(i,"Experiences",`${D$(q.slug||q.title)}.md`),D=u.query("SELECT session_id FROM session_experience_links WHERE experience_id = ?").all(q.id).map((z)=>z.session_id),F={noteType:"experience",entityId:q.id,relPath:U,title:q.title,managedBody:q.body_markdown,frontmatter:{type:"experience",aiwiki_id:q.id,aiwiki_project_id:s.id,project:R,slug:q.slug,confidence:q.confidence,status:q.status,source_sessions:D,updated_at:q.updated_at}};S(P$(u,_,F,$,w),U)}let T=ou(i,"Project Summary.md"),O=[`- canonical: \`${s.canonicalName}\``,s.canonicalRepoUrl?`- repo: ${s.canonicalRepoUrl}`:null,`- session summaries: ${L.length}`,`- experiences: ${I.length}`].filter((q)=>q!=null).join(`
|
|
386
|
+
`),H={noteType:"project-summary",entityId:s.id,relPath:T,title:R,managedBody:O,frontmatter:{type:"project-summary",aiwiki_project_id:s.id,project:R,canonical_repo_url:s.canonicalRepoUrl,updated_at:w}};return S(P$(u,_,H,$,w),T),f}function Hg(u){let _=u.query("SELECT note_type, entity_id, file_path, managed_hash FROM obsidian_notes ORDER BY file_path ASC").all(),s=[],$=0;for(let w of _){let f;if(!Tg(w.file_path))f="missing";else{let g=Og(qg(w.file_path,"utf8"));if(!g)f="no_managed_block";else if(w.managed_hash&&v_(g.managed)===w.managed_hash)f="clean";else f="drift"}if(f==="clean")$+=1;else s.push({noteType:w.note_type,entityId:w.entity_id,filePath:w.file_path,status:f})}return{total:_.length,clean:$,entries:s}}import{homedir as WO}from"node:os";import{join as A$,resolve as XO}from"node:path";function N(u=WO()){let _=A$(u,".llm-iwiki");return{homeDir:u,configDir:_,configFile:A$(_,"config.toml"),databaseFile:A$(_,"llm-iwiki.db")}}function F$(u){return XO(u,".llm-iwiki","exchange")}function Pg(u){return{id:u.id,sourceId:u.source_id,sourceSessionId:u.source_session_id,title:u.title,messageCount:u.message_count,status:u.status,rawProjectPath:u.raw_project_path,updatedAt:u.updated_at,lastSeenAt:u.last_seen_at}}function JO(u,_,s=100){return u.query(`
|
|
381
387
|
SELECT id, source_id, source_session_id, title, message_count, status, raw_project_path, updated_at, last_seen_at
|
|
382
388
|
FROM sessions
|
|
383
389
|
WHERE project_id = ?
|
|
384
390
|
ORDER BY COALESCE(updated_at, last_seen_at) DESC
|
|
385
391
|
LIMIT ?
|
|
386
|
-
`).all(_,s).map(
|
|
392
|
+
`).all(_,s).map(Pg)}function Dg(u,_){return u.query("SELECT role, content FROM messages WHERE session_id = ? ORDER BY seq_order ASC").all(_)}function Ag(u,_,s){let $=s==="changed"?"AND status IN ('new', 'changed')":"";return u.query(`
|
|
387
393
|
SELECT id, source_id, source_session_id, title, message_count, status, raw_project_path, updated_at, last_seen_at
|
|
388
394
|
FROM sessions
|
|
389
395
|
WHERE project_id = ? ${$}
|
|
390
396
|
ORDER BY COALESCE(updated_at, last_seen_at) DESC
|
|
391
|
-
`).all(_).map(
|
|
397
|
+
`).all(_).map(Pg)}function Fg(u,_){return{sources:u.query(`
|
|
392
398
|
SELECT source_id, COUNT(*) AS session_count
|
|
393
399
|
FROM sessions
|
|
394
400
|
WHERE project_id = ?
|
|
395
401
|
GROUP BY source_id
|
|
396
402
|
ORDER BY session_count DESC
|
|
397
|
-
`).all(_).map(($)=>({source:$.source_id,sessionCount:$.session_count})),sessions:
|
|
398
|
-
name: aiwiki-
|
|
399
|
-
description:
|
|
403
|
+
`).all(_).map(($)=>({source:$.source_id,sessionCount:$.session_count})),sessions:JO(u,_)}}import{existsSync as BO,mkdirSync as ZO,writeFileSync as zg}from"node:fs";import{dirname as MO,join as z$}from"node:path";var Y$=["codex","claude-code","cursor"],G$=z$(".agents","skills"),Yg={codex:"Codex","claude-code":"Claude Code",cursor:"Cursor"},Gg=[{directory:"aiwiki-knowledge",content:`---
|
|
404
|
+
name: aiwiki-knowledge
|
|
405
|
+
description: 用 llm-iwiki 把当前项目跨 AI 工具的会话沉淀成知识库——采集会话、生成总结与经验、导出到 Obsidian。当用户提到"沉淀/总结这次工作""存进知识库""项目复盘""跑一下 llm-iwiki"或想把会话经验归档时使用。
|
|
400
406
|
---
|
|
401
407
|
|
|
402
|
-
# AIWiki
|
|
408
|
+
# AIWiki 知识沉淀
|
|
409
|
+
|
|
410
|
+
用 \`llm-iwiki\` 把当前项目里跨 AI 工具(Claude Code / Cursor / Codex / CodeBuddy / Gemini)的会话,沉淀为「会话总结 → 可复用经验 → Obsidian 笔记」。
|
|
403
411
|
|
|
404
|
-
|
|
412
|
+
## 何时使用
|
|
405
413
|
|
|
406
|
-
|
|
414
|
+
- 完成一段有价值的编码 / 设计工作后,想把过程沉淀进知识库。
|
|
415
|
+
- 用户说「沉淀这次工作」「总结到知识库」「项目复盘」「跑一下 llm-iwiki」。
|
|
407
416
|
|
|
408
|
-
|
|
417
|
+
## 整体流程
|
|
418
|
+
|
|
419
|
+
\`采集(命令) → 生成总结任务(命令) → 你产出 summaries.yaml → 落库(命令) → 生成经验任务(命令) → 你产出 experiences.yaml → 落库为候选(命令) → 人工审核 → 导出 Obsidian(命令)\`
|
|
420
|
+
|
|
421
|
+
其中**只有「产出两个 YAML」需要你来做**,其余都是直接跑命令。务必先读下方「YAML 输出规则」再动手,这是最容易出错的地方。
|
|
422
|
+
|
|
423
|
+
## 步骤(在项目根目录执行)
|
|
424
|
+
|
|
425
|
+
1. 采集并确认项目已识别,记下顶部的 project_id(形如 \`proj_xxxx\`):
|
|
409
426
|
\`\`\`bash
|
|
410
|
-
llm-iwiki
|
|
427
|
+
llm-iwiki sync
|
|
428
|
+
llm-iwiki projects inspect .
|
|
411
429
|
\`\`\`
|
|
412
|
-
|
|
413
|
-
3. Report whether related history was found, and name the most relevant item when it was found.
|
|
414
|
-
`},{directory:"aiwiki-project-retrospective",content:`---
|
|
415
|
-
name: aiwiki-project-retrospective
|
|
416
|
-
description: Review recent project knowledge and extract retrospective themes from llm-iwiki.
|
|
417
|
-
---
|
|
430
|
+
若显示 \`sessions: 0\`,说明本机暂无该项目会话,停止并告知用户。
|
|
418
431
|
|
|
419
|
-
|
|
432
|
+
2. 生成总结任务文件(想覆盖全部历史把 \`changed\` 换成 \`all\`):
|
|
433
|
+
\`\`\`bash
|
|
434
|
+
llm-iwiki summarize prepare changed --project . --out .llm-iwiki/exchange/summaries-task.md
|
|
435
|
+
\`\`\`
|
|
436
|
+
|
|
437
|
+
3. 阅读 \`.llm-iwiki/exchange/summaries-task.md\`,据此**新建** \`.llm-iwiki/exchange/summaries.yaml\`(纯 YAML,见下方规则)。
|
|
438
|
+
|
|
439
|
+
4. 落库;若报解析 / 校验错,按报错修正 YAML 后重跑:
|
|
440
|
+
\`\`\`bash
|
|
441
|
+
llm-iwiki summarize apply --project . --file .llm-iwiki/exchange/summaries.yaml
|
|
442
|
+
\`\`\`
|
|
443
|
+
|
|
444
|
+
5. 生成经验任务文件(只吃 value=medium/high 的总结):
|
|
445
|
+
\`\`\`bash
|
|
446
|
+
llm-iwiki experiences prepare --project . --from changed-summaries --out .llm-iwiki/exchange/experiences-task.md
|
|
447
|
+
\`\`\`
|
|
448
|
+
|
|
449
|
+
6. 阅读 \`.llm-iwiki/exchange/experiences-task.md\`,据此**新建** \`.llm-iwiki/exchange/experiences.yaml\`(纯 YAML)。
|
|
420
450
|
|
|
421
|
-
|
|
451
|
+
7. 落库为候选:
|
|
452
|
+
\`\`\`bash
|
|
453
|
+
llm-iwiki experiences propose --project . --file .llm-iwiki/exchange/experiences.yaml
|
|
454
|
+
\`\`\`
|
|
422
455
|
|
|
423
|
-
|
|
456
|
+
8. 列出候选交用户决定,**不要自行 accept**:
|
|
457
|
+
\`\`\`bash
|
|
458
|
+
llm-iwiki experiences candidates --project .
|
|
459
|
+
# 用户确认后再:llm-iwiki experiences accept <candidate-id>
|
|
460
|
+
\`\`\`
|
|
424
461
|
|
|
425
|
-
|
|
462
|
+
9. 导出到 Obsidian(只导出已 accept 的经验;库路径仅首次需配置):
|
|
426
463
|
\`\`\`bash
|
|
427
|
-
llm-iwiki
|
|
464
|
+
llm-iwiki config set obsidian.vault <库目录>
|
|
465
|
+
llm-iwiki obsidian export --project .
|
|
428
466
|
\`\`\`
|
|
429
|
-
2. Review the prepared task for repeated themes, unresolved questions, and process improvements.
|
|
430
|
-
3. Capture any accepted learnings through the normal llm-iwiki experience proposal flow.
|
|
431
|
-
`}];function jL(u,_){if(!_)return u;return`${u}
|
|
432
|
-
## Tool Target
|
|
433
467
|
|
|
434
|
-
|
|
435
|
-
|
|
468
|
+
## YAML 输出规则(最重要,避免格式错误)
|
|
469
|
+
|
|
470
|
+
- \`*-task.md\` 是**输入说明**,绝不要修改它,更不要把它改名当成输出。
|
|
471
|
+
- 输出文件(\`summaries.yaml\` / \`experiences.yaml\`)**只能包含 YAML**:
|
|
472
|
+
- 不要写 Markdown 标题或说明文字;
|
|
473
|
+
- 不要用 \`\`\` 代码围栏把整段内容包起来;
|
|
474
|
+
- 不要保留 \`<...>\` 占位符,全部换成真实内容。
|
|
475
|
+
- \`project_id\` 用对应任务文件顶部给出的值。
|
|
476
|
+
- summaries 每条:\`session_id\`(与任务文件里会话块标题的 id 完全一致)、\`title\`、\`value\`(只能是 none / low / medium / high 之一)、\`summary_markdown\`(用 \`|\` 块标量,正文缩进保持一致)。
|
|
477
|
+
- experiences 每条:\`title\`、\`summary\`、\`body_markdown\`、\`source_sessions\`(字符串数组)必填;\`slug\`、\`confidence\`(low / medium / high)可选。
|
|
478
|
+
|
|
479
|
+
### summaries.yaml 正确示例
|
|
480
|
+
|
|
481
|
+
\`\`\`yaml
|
|
482
|
+
project_id: proj_071be0c7a2e9ccc6
|
|
483
|
+
summaries:
|
|
484
|
+
- session_id: cc_ab12cd34
|
|
485
|
+
title: 修复切换租户后登录态丢失
|
|
486
|
+
value: high
|
|
487
|
+
summary_markdown: |
|
|
488
|
+
## 问题
|
|
489
|
+
切换租户后登录态丢失。
|
|
490
|
+
## 关键决策
|
|
491
|
+
统一在中间件按租户刷新 token。
|
|
492
|
+
## 结论
|
|
493
|
+
已修复并补了回归测试。
|
|
494
|
+
\`\`\`
|
|
495
|
+
|
|
496
|
+
### experiences.yaml 正确示例
|
|
497
|
+
|
|
498
|
+
\`\`\`yaml
|
|
499
|
+
project_id: proj_071be0c7a2e9ccc6
|
|
500
|
+
experiences:
|
|
501
|
+
- title: 多租户下的登录态刷新策略
|
|
502
|
+
summary: |
|
|
503
|
+
切换租户必须按租户维度刷新会话凭证。
|
|
504
|
+
body_markdown: |
|
|
505
|
+
## 背景
|
|
506
|
+
多租户切换会丢登录态。
|
|
507
|
+
## 方案
|
|
508
|
+
中间件按租户统一刷新 token。
|
|
509
|
+
## 结论
|
|
510
|
+
回归通过,沉淀为团队规范。
|
|
511
|
+
source_sessions:
|
|
512
|
+
- cc_ab12cd34
|
|
513
|
+
confidence: medium
|
|
514
|
+
\`\`\`
|
|
515
|
+
`}];function QO(u,_){if(!_)return u;return`${u}
|
|
516
|
+
## 适配工具
|
|
517
|
+
|
|
518
|
+
本 skill 为 ${Yg[_]} 初始化。
|
|
519
|
+
`}function NO(u){return u instanceof Error&&"code"in u&&u.code==="EEXIST"}function Wg(){return Y$.map((u)=>({id:u,name:Yg[u]}))}function Xg(){return Gg.map((u)=>({directory:u.directory,relPath:z$(G$,u.directory,"SKILL.md")}))}function Jg(u){let _=[],s=[];for(let $ of Gg){let w=z$(u.cwd,".agents","skills",$.directory,"SKILL.md");if(BO(w)&&!u.force){s.push(w);continue}if(_.push(w),u.dryRun)continue;ZO(MO(w),{recursive:!0});let f=QO($.content,u.target);if(u.force){zg(w,f);continue}try{zg(w,f,{flag:"wx"})}catch(g){if(!NO(g))throw g;_.pop(),s.push(w)}}return{written:_,skipped:s}}var VO={maxPerMessage:1200,maxMessages:60};function jO(u){return u.replace(/[ \t]+\n/g,`
|
|
436
520
|
`).replace(/\n{3,}/g,`
|
|
437
521
|
|
|
438
|
-
`).trim()}function
|
|
439
|
-
…[truncated ${s.length-_} chars]`}function
|
|
522
|
+
`).trim()}function bO(u,_){let s=jO(u);if(s.length<=_)return s;return`${s.slice(0,_)}
|
|
523
|
+
…[truncated ${s.length-_} chars]`}function Bg(u,_={}){let s={...VO,..._},$=u.filter((i)=>i.content.trim()!==""),w=$,f="";if($.length>s.maxMessages){let i=Math.ceil(s.maxMessages*0.6),R=s.maxMessages-i;w=[...$.slice(0,i),...$.slice($.length-R)],f=`
|
|
440
524
|
…[omitted ${$.length-s.maxMessages} middle messages]
|
|
441
|
-
`}let
|
|
525
|
+
`}let g=[];return w.forEach((i,R)=>{if(f&&R===Math.ceil(s.maxMessages*0.6))g.push(f);let S=i.role==="user"?"User":i.role==="assistant"?"Assistant":i.role;g.push(`**${S}:** ${bO(i.content,s.maxPerMessage)}`)}),g.join(`
|
|
442
526
|
|
|
443
|
-
`)}var
|
|
444
|
-
|
|
527
|
+
`)}var EO=`## 输出格式(务必遵守)
|
|
528
|
+
|
|
529
|
+
本文件(\`summaries-task.md\`)是任务说明,请勿修改它。
|
|
530
|
+
请**另外新建**一个纯 YAML 文件 \`.llm-iwiki/exchange/summaries.yaml\`,然后运行:
|
|
531
|
+
\`llm-iwiki summarize apply --project . --file .llm-iwiki/exchange/summaries.yaml\`
|
|
532
|
+
|
|
533
|
+
输出文件规则:
|
|
534
|
+
- 只能是 YAML 内容,不要写 Markdown 标题或说明文字,也不要用 \`\`\` 代码围栏把它包起来。
|
|
535
|
+
- 不要保留 \`<...>\` 占位符,全部替换成真实内容。
|
|
536
|
+
- \`value\` 只能取 none / low / medium / high 其中之一(不要照抄“none | low | medium | high”整行);medium / high 才会进入经验提取。
|
|
537
|
+
- \`session_id\` 必须与下方各会话块标题里的 id 完全一致。
|
|
538
|
+
- 没价值的会话直接省略,不必每个都写。
|
|
539
|
+
|
|
540
|
+
按下面结构填真实内容(# 后是说明,可删):
|
|
541
|
+
|
|
542
|
+
\`\`\`yaml
|
|
543
|
+
project_id: proj_xxxxxxxx # 用本文件顶部的 project_id
|
|
544
|
+
summaries:
|
|
545
|
+
- session_id: cc_xxxxxxxx # 与下方会话块标题里的 id 完全一致
|
|
546
|
+
title: 一句话标题
|
|
547
|
+
value: high
|
|
548
|
+
summary_markdown: |
|
|
549
|
+
## 问题
|
|
550
|
+
这次会话要解决什么。
|
|
551
|
+
## 关键决策
|
|
552
|
+
做了哪些选择、为什么。
|
|
553
|
+
## 结论
|
|
554
|
+
最终结果与后续动作。
|
|
555
|
+
\`\`\``;function Zg(u,_,s){let $=Ag(u,_,s),w=[];for(let g of $){let i=Dg(u,g.id);if(i.length===0)continue;let R=Bg(i);w.push([`### ${g.id}`,`- source: ${g.sourceId}`,`- title: ${g.title??"(无标题)"}`,`- messages: ${g.messageCount}`,"",R].join(`
|
|
556
|
+
`))}return{markdown:["# Summaries Task","",`project_id: ${_}`,`scope: ${s}`,`sessions: ${w.length}`,"",EO,"","---","",w.join(`
|
|
445
557
|
|
|
446
558
|
---
|
|
447
559
|
|
|
448
560
|
`),""].join(`
|
|
449
|
-
`),sessionCount:
|
|
561
|
+
`),sessionCount:w.length}}function CO(u){return h(u)}function Mg(u,_){let s=new Date().toISOString(),$=0,w=[];return u.transaction(()=>{for(let g of _.summaries){let i=u.query("SELECT project_id FROM sessions WHERE id = ?").get(g.sessionId);if(!i){w.push(g.sessionId);continue}u.query(`
|
|
450
562
|
INSERT INTO session_summaries (id, session_id, project_id, title, value, summary_markdown, metadata_json, created_at, updated_at)
|
|
451
563
|
VALUES ($id, $sessionId, $projectId, $title, $value, $summaryMarkdown, $metadata, $now, $now)
|
|
452
564
|
ON CONFLICT(id) DO UPDATE SET
|
|
@@ -455,18 +567,18 @@ This skill is initialized for ${Wi[_]}.
|
|
|
455
567
|
summary_markdown = excluded.summary_markdown,
|
|
456
568
|
metadata_json = excluded.metadata_json,
|
|
457
569
|
updated_at = excluded.updated_at
|
|
458
|
-
`).run({$id:`sum_${
|
|
459
|
-
`)){let s=_.trim();if(s===""||/^[-=*#>`~]+$/.test(s))continue;return s}return null}function c(u){for(let _ of u){if(_.role!=="user")continue;let s=
|
|
460
|
-
`).trim();if(u==null)return"";return JSON.stringify(u)}var
|
|
461
|
-
`),$=[],
|
|
462
|
-
`)){let R=
|
|
463
|
-
`)&&_.length<256}function DU(u,_,s){let $;try{$=JSON.parse(
|
|
570
|
+
`).run({$id:`sum_${CO(g.sessionId)}`,$sessionId:g.sessionId,$projectId:i.project_id??_.projectId,$title:g.title,$value:g.value,$summaryMarkdown:g.summaryMarkdown,$metadata:JSON.stringify(g.metadata),$now:s}),$+=1}})(),{written:$,skipped:w}}import{existsSync as Vg,readdirSync as Ng,readFileSync as yO,realpathSync as dO,statSync as nO}from"node:fs";import{basename as hO,join as o_}from"node:path";import{tmpdir as lO}from"node:os";var Qg=120,KO=["/tmp/","/private/tmp/","/var/folders/","/private/var/folders/"];function m(u){if(!u)return!1;let _=lO();if(u===_)return!0;let s=u.endsWith("/")?u:`${u}/`;return[...KO,`${_}/`].some((w)=>s.startsWith(w))}function eu(u){return u.length>Qg?`${u.slice(0,Qg)}…`:u}function rO(u){for(let _ of u.split(`
|
|
571
|
+
`)){let s=_.trim();if(s===""||/^[-=*#>`~]+$/.test(s))continue;return s}return null}function c(u){for(let _ of u){if(_.role!=="user")continue;let s=rO(_.content);if(s)return eu(s)}return null}function Bu(u){if(typeof u==="string")return u;if(Array.isArray(u))return u.map((_)=>{if(typeof _==="string")return _;if(_&&typeof _==="object"){let s=_;if(typeof s.text==="string")return s.text;return JSON.stringify(s)}return String(_)}).join(`
|
|
572
|
+
`).trim();if(u==null)return"";return JSON.stringify(u)}var jg=[".claude/projects",".claude-internal/projects"];function mO(u){let s=yO(u,"utf8").split(`
|
|
573
|
+
`),$=[],w=null,f=null;for(let i of s){let R=i.trim();if(R==="")continue;let S;try{S=JSON.parse(R)}catch{continue}if(typeof S.sessionId==="string"&&!f)f=S.sessionId;if(typeof S.cwd==="string"&&!w)w=S.cwd;let L=S.type;if(L!=="user"&&L!=="assistant")continue;if(S.isSidechain===!0)continue;let I=S.message;if(!I||typeof I!=="object")continue;let T=I,O=typeof T.role==="string"?T.role:L,H=Bu(T.content);if(H.trim()==="")continue;$.push({role:O,content:H,timestamp:typeof S.timestamp==="string"?S.timestamp:null})}if($.length===0)return null;if(m(w))return null;f??=hO(u).replace(/\.jsonl$/,"");let g=$.map((i)=>i.timestamp).filter((i)=>i!=null);return{sourceSessionId:f,rawPath:u,rawProjectPath:w,title:c($),createdAt:g[0]??null,updatedAt:g[g.length-1]??null,messages:$}}function cO(u){let _=[],s=new Set;for(let $ of jg){let w=o_(u,$);if(!Vg(w))continue;let f;try{f=dO(w)}catch{f=w}if(s.has(f))continue;s.add(f);for(let g of Ng(w,{withFileTypes:!0})){if(!g.isDirectory())continue;let i=o_(w,g.name);for(let R of Ng(i,{withFileTypes:!0}))if(R.isFile()&&R.name.endsWith(".jsonl"))_.push(o_(i,R.name))}}return _}var bg={id:"claude-code",name:"Claude Code",detect(u){return jg.some((_)=>Vg(o_(u,_)))},collect(u){let _=[];for(let s of cO(u))try{if(!nO(s).isFile())continue;let $=mO(s);if($)_.push($)}catch{continue}return _}};import{existsSync as Cg,readdirSync as lg,readFileSync as xO,statSync as pO}from"node:fs";import{join as gu}from"node:path";var kO="Library/Application Support",aO=["CodeBuddyExtension","CodeBuddy CN"];function Kg(u,_,s=0){if(s>6)return;let $;try{$=lg(u,{withFileTypes:!0})}catch{return}for(let w of $){if(!w.isDirectory())continue;let f=gu(u,w.name);if(w.name==="history")_.push(f);else if(w.name!=="messages")Kg(f,_,s+1)}}function W$(u){try{return JSON.parse(xO(u,"utf8"))}catch{return null}}function tO(u){if(typeof u!=="string")return Bu(u);let _=u.trim();if(_.startsWith("{")||_.startsWith("["))try{let s=JSON.parse(_);if(s&&typeof s==="object"&&"content"in s)return Bu(s.content);return Bu(s)}catch{return u}return u}function vO(u){let _=u.match(/Workspace Folder:\s*(.+)/);if(!_)return null;let s=_[1].trim();return s===""?null:s}function oO(u,_,s){let $=W$(gu(u,"index.json"));if(!$?.messages)return null;let w=[],f=null;for(let i of $.messages){let R=W$(gu(u,"messages",`${i.id}.json`));if(!R)continue;let S=i.role??R.role??"user";if(S!=="user"&&S!=="assistant")continue;let L=tO(R.message);if(L.trim()==="")continue;if(!f&&S==="user")f=vO(L);w.push({role:S,content:L,timestamp:null})}if(w.length===0)return null;if(m(f))return null;let g=s.name&&s.name.trim()!==""?eu(s.name.trim()):c(w);return{sourceSessionId:_,rawPath:u,rawProjectPath:f,title:g,createdAt:s.createdAt??null,updatedAt:s.lastMessageAt??null,messages:w}}function eO(u,_){for(let s of lg(u,{withFileTypes:!0})){if(!s.isDirectory())continue;let $=gu(u,s.name),w=W$(gu($,"index.json"));if(!w?.conversations?.length)continue;for(let f of w.conversations){if(!f.id)continue;let g=gu($,f.id);if(!Cg(g))continue;try{let i=oO(g,f.id,f);if(i)_.push(i)}catch{continue}}}}function Eg(u){return aO.map((_)=>gu(u,kO,_)).filter((_)=>Cg(_))}var rg={id:"codebuddy",name:"CodeBuddy",detect(u){return Eg(u).length>0},collect(u){let _=[],s=new Set;for(let $ of Eg(u)){let w=[];Kg(gu($,"Data"),w);for(let f of w){try{if(!pO(f).isDirectory())continue}catch{continue}eO(f,_)}}return _.filter(($)=>{if(s.has($.sourceSessionId))return!1;return s.add($.sourceSessionId),!0})}};import{existsSync as yg,readdirSync as uU,readFileSync as _U,realpathSync as sU,statSync as $U}from"node:fs";import{basename as wU,join as X$}from"node:path";var dg=[".codex/sessions",".codex-internal/sessions"];function fU(u){return u.replace(/\[REQ:[0-9a-f-]+\]/gi,"").replace(/\[AMP_DONE:[0-9a-f-]+\]/gi,"").trim()}function ng(u,_){for(let s of uU(u,{withFileTypes:!0})){let $=X$(u,s.name);if(s.isDirectory())ng($,_);else if(s.isFile()&&s.name.startsWith("rollout-")&&s.name.endsWith(".jsonl"))_.push($)}}function gU(u){let _=_U(u,"utf8"),s=[],$=null,w=null,f=null;for(let i of _.split(`
|
|
574
|
+
`)){let R=i.trim();if(R==="")continue;let S;try{S=JSON.parse(R)}catch{continue}let L=S.payload;if(!L||typeof L!=="object")continue;let I=L,T=typeof S.timestamp==="string"?S.timestamp:null;if(S.type==="session_meta"){if(typeof I.id==="string")w=I.id;if(typeof I.cwd==="string")$=I.cwd;if(typeof I.timestamp==="string")f=I.timestamp;continue}if(S.type!=="event_msg")continue;let O=I.type;if(O!=="user_message"&&O!=="agent_message")continue;if(typeof I.message!=="string")continue;let H=fU(I.message);if(H==="")continue;s.push({role:O==="user_message"?"user":"assistant",content:H,timestamp:T})}if(s.length===0)return null;if(m($))return null;w??=wU(u).replace(/\.jsonl$/,"");let g=s.map((i)=>i.timestamp).filter((i)=>i!=null);return{sourceSessionId:w,rawPath:u,rawProjectPath:$,title:c(s),createdAt:f??g[0]??null,updatedAt:g[g.length-1]??null,messages:s}}function iU(u){let _=[],s=new Set;for(let $ of dg){let w=X$(u,$);if(!yg(w))continue;let f;try{f=sU(w)}catch{f=w}if(s.has(f))continue;s.add(f),ng(w,_)}return _}var hg={id:"codex",name:"Codex",detect(u){return dg.some((_)=>yg(X$(u,_)))},collect(u){let _=[];for(let s of iU(u))try{if(!$U(s).isFile())continue;let $=gU(s);if($)_.push($)}catch{continue}return _}};import{existsSync as u_,readdirSync as RU,readFileSync as SU}from"node:fs";import{join as Ou}from"node:path";var mg="Library/Application Support/Cursor/User";function J$(u){if(typeof u!=="number"||!Number.isFinite(u))return null;let _=new Date(u);return Number.isNaN(_.getTime())?null:_.toISOString()}function IU(u){if(!u.startsWith("file://"))return null;try{return decodeURIComponent(u.replace(/^file:\/\//,"")).replace(/\/+$/,"")}catch{return null}}function cg(u){return vf(u)}function TU(u){let _=new Map,s=Ou(u,"workspaceStorage");if(!u_(s))return _;for(let $ of RU(s,{withFileTypes:!0})){if(!$.isDirectory())continue;let w=Ou(s,$.name),f=null,g=Ou(w,"workspace.json");if(u_(g))try{let S=JSON.parse(SU(g,"utf8"));if(typeof S.folder==="string")f=IU(S.folder)}catch{}let i=Ou(w,"state.vscdb");if(!u_(i))continue;let R=cg(i);if(!R)continue;try{let S=R.query("SELECT value FROM ItemTable WHERE key = ?").get("composer.composerData");if(!S)continue;let L=JSON.parse(S.value);for(let I of L.allComposers??[]){let T=I.composerId;if(typeof T!=="string")continue;if(_.has(T))continue;_.set(T,{cwd:f,name:typeof I.name==="string"?I.name:null,createdAt:J$(I.createdAt),updatedAt:J$(I.lastUpdatedAt)})}}catch{}finally{R.close()}}return _}function qU(u,_,s,$){let w=u.query("SELECT value FROM cursorDiskKV WHERE key = ?").get(`composerData:${s}`);if(!w)return null;let f;try{f=JSON.parse(w.value)}catch{return null}let g=f.fullConversationHeadersOnly??[];if(g.length===0)return null;let i=u.query("SELECT value FROM cursorDiskKV WHERE key = ?"),R=[];for(let I of g){if(I.type!==1&&I.type!==2)continue;let T=i.get(`bubbleId:${s}:${I.bubbleId}`);if(!T)continue;let O;try{O=JSON.parse(T.value)}catch{continue}let H=typeof O.text==="string"?O.text.trim():"";if(H==="")continue;R.push({role:I.type===1?"user":"assistant",content:H,timestamp:null})}if(R.length===0)return null;if(m($.cwd))return null;let S=$.name??f.name??null,L=S&&S.trim()!==""?eu(S.trim()):c(R);return{sourceSessionId:s,rawPath:`${_}#${s}`,rawProjectPath:$.cwd,title:L,createdAt:$.createdAt??J$(f.createdAt),updatedAt:$.updatedAt,messages:R}}var xg={id:"cursor",name:"Cursor",detect(u){return u_(Ou(u,mg,"globalStorage","state.vscdb"))},collect(u){let _=Ou(u,mg),s=Ou(_,"globalStorage","state.vscdb");if(!u_(s))return[];let $=TU(_);if($.size===0)return[];let w=cg(s);if(!w)return[];let f=[];try{for(let[g,i]of $)try{let R=qU(w,s,g,i);if(R)f.push(R)}catch{continue}}finally{w.close()}return f}};import{existsSync as __,readdirSync as pg,readFileSync as tg,realpathSync as LU,statSync as OU}from"node:fs";import{basename as vg,dirname as kg,join as Zu}from"node:path";var UU=[".gemini-internal",".gemini"];function HU(u){let _=new Map,s=Zu(u,"projects.json");if(!__(s))return _;try{let $=JSON.parse(tg(s,"utf8"));for(let[w,f]of Object.entries($.projects??{}))if(typeof f==="string"&&!_.has(f))_.set(f,w)}catch{}return _}function PU(u){let _=u.trim();return _.startsWith("/")&&!_.includes(`
|
|
575
|
+
`)&&_.length<256}function DU(u,_,s){let $;try{$=JSON.parse(tg(u,"utf8"))}catch{return null}let w=[];for(let i of $.messages??[]){if(i.type!=="user"&&i.type!=="gemini")continue;let R=typeof i.content==="string"?i.content:"";if(R.trim()==="")continue;w.push({role:i.type==="user"?"user":"assistant",content:R,timestamp:typeof i.timestamp==="string"?i.timestamp:null})}if(w.length===0)return null;let f=s.get(_)??null;if(!f){let i=w.find((R)=>R.role==="user");if(i&&PU(i.content))f=i.content.trim().replace(/\/+$/,"")}if(m(f))return null;let g=w.map((i)=>i.timestamp).filter((i)=>i!=null);return{sourceSessionId:$.sessionId??vg(u).replace(/\.json$/,""),rawPath:u,rawProjectPath:f,title:c(w),createdAt:$.startTime??g[0]??null,updatedAt:$.lastUpdated??g[g.length-1]??null,messages:w}}function ag(u){let _=new Set;for(let s of UU){let $=Zu(u,s);if(!__($))continue;let w;try{w=LU($)}catch{w=$}if(_.has(w))continue;return _.add(w),$}return null}function AU(u){let _=Zu(u,"tmp");if(!__(_))return[];let s=[];for(let $ of pg(_,{withFileTypes:!0})){if(!$.isDirectory())continue;let w=Zu(_,$.name,"chats");if(!__(w))continue;for(let f of pg(w,{withFileTypes:!0}))if(f.isFile()&&f.name.startsWith("session-")&&f.name.endsWith(".json"))s.push(Zu(w,f.name))}return s}var og={id:"gemini",name:"Gemini",detect(u){let _=ag(u);return _!=null&&__(Zu(_,"tmp"))},collect(u){let _=ag(u);if(!_)return[];let s=HU(_),$=[];for(let w of AU(_))try{if(!OU(w).isFile())continue;let f=vg(kg(kg(w))),g=DU(w,f,s);if(g)$.push(g)}catch{continue}return $}};var eg=[bg,hg,xg,og,rg];function B$(u){return h(u)}function FU(u,_){return`ses_${B$(`${u}\x00${_.sourceSessionId}\x00${_.rawPath}`)}`}function zU(u,_){return B$(`${u}\x00${_}`)}function YU(u){return B$(`${u.length}\x00${u.join("\x00")}`)}function GU(u,_,s){u.query(`
|
|
464
576
|
INSERT INTO sources (id, name, enabled, scan_paths, config_json, last_sync_at)
|
|
465
577
|
VALUES ($id, $name, 1, NULL, NULL, $now)
|
|
466
578
|
ON CONFLICT(id) DO UPDATE SET
|
|
467
579
|
name = excluded.name,
|
|
468
580
|
last_sync_at = excluded.last_sync_at
|
|
469
|
-
`).run({$id:_.id,$name:_.name,$now:s})}function
|
|
581
|
+
`).run({$id:_.id,$name:_.name,$now:s})}function WU(u,_){if(!_)return null;try{return sg(u,_).id}catch{return null}}function XU(u,_,s,$,w){let f=FU(_.id,s),g=s.messages.map((T)=>zU(T.role,T.content)),i=YU(g),R=WU(u,s.rawProjectPath),S=u.query("SELECT content_hash, first_seen_at FROM sessions WHERE id = ?").get(f);if(S&&S.content_hash===i)return u.query("UPDATE sessions SET project_id = $projectId, status = $status, last_seen_at = $now WHERE id = $id").run({$projectId:R,$status:"unchanged",$now:$,$id:f}),w.unchanged+=1,f;let L=S?"changed":"new",I=S?.first_seen_at??$;if(u.query(`
|
|
470
582
|
INSERT INTO sessions (
|
|
471
583
|
id, source_id, source_session_id, project_id, checkout_id, raw_project_path, raw_path,
|
|
472
584
|
title, message_count, content_hash, status, created_at, updated_at, first_seen_at, last_seen_at
|
|
@@ -484,10 +596,10 @@ This skill is initialized for ${Wi[_]}.
|
|
|
484
596
|
created_at = excluded.created_at,
|
|
485
597
|
updated_at = excluded.updated_at,
|
|
486
598
|
last_seen_at = excluded.last_seen_at
|
|
487
|
-
`).run({$id:
|
|
599
|
+
`).run({$id:f,$sourceId:_.id,$sourceSessionId:s.sourceSessionId,$projectId:R,$rawProjectPath:s.rawProjectPath,$rawPath:s.rawPath,$title:s.title,$messageCount:s.messages.length,$contentHash:i,$status:L,$createdAt:s.createdAt,$updatedAt:s.updatedAt,$firstSeenAt:I,$now:$}),u.query("DELETE FROM messages WHERE session_id = ?").run(f),s.messages.forEach((T,O)=>{u.query(`
|
|
488
600
|
INSERT INTO messages (id, session_id, role, content, timestamp, seq_order, content_hash)
|
|
489
601
|
VALUES ($id, $sessionId, $role, $content, $timestamp, $seqOrder, $contentHash)
|
|
490
|
-
`).run({$id:`msg_${
|
|
602
|
+
`).run({$id:`msg_${f}_${O}`,$sessionId:f,$role:T.role,$content:T.content,$timestamp:T.timestamp,$seqOrder:O,$contentHash:g[O]})}),L==="new")w.new+=1;else w.changed+=1;return f}function JU(u,_,s,$,w){let f=u.query("SELECT id FROM sessions WHERE source_id = ? AND status != 'source_missing'").all(_);for(let g of f){if(s.has(g.id))continue;u.query("UPDATE sessions SET status = $status, last_seen_at = $now WHERE id = $id").run({$status:"source_missing",$now:$,$id:g.id}),w.sourceMissing+=1}}function ui(u,_){let s=new Date().toISOString(),$=[];for(let w of eg){if(!w.detect(_.homeDir))continue;GU(u,w,s);let f={source:w.id,new:0,changed:0,unchanged:0,sourceMissing:0,total:0},g=w.collect(_.homeDir),i=new Set;u.transaction(()=>{for(let S of g){if(_.projectFilter&&S.rawProjectPath!==_.projectFilter)continue;let L=XU(u,w,S,s,f);i.add(L),f.total+=1}if(!_.projectFilter)JU(u,w.id,i,s,f)})(),$.push(f)}return{bySource:$}}var wi=`llm-iwiki
|
|
491
603
|
|
|
492
604
|
Usage:
|
|
493
605
|
llm-iwiki init
|
|
@@ -510,7 +622,7 @@ Usage:
|
|
|
510
622
|
llm-iwiki config set <key> <value>
|
|
511
623
|
llm-iwiki skills [list]
|
|
512
624
|
llm-iwiki skills init [--target codex|claude-code|cursor] [--force] [--dry-run]
|
|
513
|
-
`,
|
|
625
|
+
`,fi=`用法:
|
|
514
626
|
llm-iwiki skills list # 列出可用 target 与将写入的 skill
|
|
515
|
-
llm-iwiki skills init [--target codex|claude-code|cursor] [--force] [--dry-run]`;function
|
|
516
|
-
`);let $=
|
|
627
|
+
llm-iwiki skills init [--target codex|claude-code|cursor] [--force] [--dry-run]`;function b(u,_){return BU(_)?_:ZU(u,_)}function K(u,_){let s=u.indexOf(_);if(s===-1)return null;let $=u[s+1];if(!$||$.startsWith("--"))return null;return $}async function gi(u,_){if(u.length===0||u[0]==="--help"||u[0]==="-h")return _.stdout(wi),0;if(u[0]==="init"){let s=N(_.homeDir);if(e_(s.configDir,{recursive:!0}),!Z$(s.configFile))M$(s.configFile,`obsidian_vault = ""
|
|
628
|
+
`);let $=V(s.databaseFile);try{j($)}finally{$.close()}return _.stdout(`Initialized llm-iwiki at ${s.configDir}`),0}if(u[0]==="doctor"){let s=N(_.homeDir);if(!Z$(s.configFile))return _.stderr("llm-iwiki is not initialized. Run: llm-iwiki init"),1;if(!Z$(s.databaseFile))return _.stderr("llm-iwiki database is missing. Run: llm-iwiki init"),1;let $=V(s.databaseFile);try{j($)}finally{$.close()}return _.stdout(`config: ${s.configFile}`),_.stdout(`database: ${s.databaseFile}`),_.stdout("status: ok"),0}if(u[0]==="sync"){let s=K(u,"--project"),$=N(_.homeDir),w=V($.databaseFile);try{j(w);let f=ui(w,{homeDir:_.homeDir??$.homeDir,projectFilter:s?b(_.cwd,s):null});if(f.bySource.length===0)return _.stdout("No collectors detected on this machine."),0;for(let g of f.bySource)_.stdout(`${g.source}: ${g.total} sessions (new ${g.new}, changed ${g.changed}, unchanged ${g.unchanged}, missing ${g.sourceMissing})`);return 0}catch(f){return _.stderr(f instanceof Error?f.message:String(f)),1}finally{w.close()}}if(u[0]==="projects"&&u[1]==="list"){let s=N(_.homeDir),$=V(s.databaseFile);try{j($);let w=$g($);if(w.length===0)return _.stdout("No projects yet. Run: llm-iwiki sync"),0;for(let f of w){let g=f.displayName??f.canonicalName;_.stdout(`${f.id} ${f.sessionCount} sessions ${g}`)}return 0}finally{$.close()}}if(u[0]==="projects"&&u[1]==="inspect"){let s=u[2];if(!s)return _.stderr("Usage: llm-iwiki projects inspect <path-or-project-id>"),1;let $=N(_.homeDir),w=V($.databaseFile);try{j(w);let f=s.startsWith("proj_")?k_(w,s):fu(w,b(_.cwd,s)),g=Fg(w,f.id);if(_.stdout(`project: ${f.displayName??f.canonicalName}`),_.stdout(`id: ${f.id}`),f.canonicalRepoUrl)_.stdout(`repo: ${f.canonicalRepoUrl}`);_.stdout(`sources: ${g.sources.map((i)=>`${i.source}(${i.sessionCount})`).join(", ")||"none"}`),_.stdout(`sessions: ${g.sessions.length}`);for(let i of g.sessions)_.stdout(` [${i.sourceId}] ${i.title??i.sourceSessionId} (${i.messageCount} msgs, ${i.status})`);return 0}catch(f){return _.stderr(f instanceof Error?f.message:String(f)),1}finally{w.close()}}if(u[0]==="projects"&&u[1]==="resolve"){let s=u[2]??_.cwd,$=N(_.homeDir),w=V($.databaseFile);try{j(w);let f=fu(w,b(_.cwd,s));return _.stdout(JSON.stringify(f,null,2)),0}catch(f){return _.stderr(f instanceof Error?f.message:String(f)),1}finally{w.close()}}if(u[0]==="projects"&&u[1]==="rename"){let s=u[2],$=u[3];if(!s||!$)return _.stderr("Usage: llm-iwiki projects rename <path-or-project-id> <display-name>"),1;let w=N(_.homeDir),f=V(w.databaseFile);try{j(f);let g=s.startsWith("proj_")?H$(f,s,$):H$(f,fu(f,b(_.cwd,s)).id,$);return _.stdout(JSON.stringify(g,null,2)),0}catch(g){return _.stderr(g instanceof Error?g.message:String(g)),1}finally{f.close()}}if(u[0]==="summarize"&&u[1]==="prepare"){let s=u[2]&&!u[2].startsWith("--")?u[2]:"changed";if(s!=="changed"&&s!=="all")return _.stderr("Usage: llm-iwiki summarize prepare [changed|all] --project <path> [--out <file>]"),1;let $=b(_.cwd,K(u,"--project")??_.cwd),w=K(u,"--out")??$i(F$($),"summaries-task.md"),f=N(_.homeDir),g=V(f.databaseFile);try{j(g);let i=fu(g,$),R=Zg(g,i.id,s);return e_(si(b(_.cwd,w)),{recursive:!0}),M$(b(_.cwd,w),R.markdown),_.stdout(`prepared summaries task: ${R.sessionCount} sessions -> ${w}`),0}catch(i){return _.stderr(i instanceof Error?i.message:String(i)),1}finally{g.close()}}if(u[0]==="summarize"&&u[1]==="apply"){let s=K(u,"--file");if(!s)return _.stderr("Usage: llm-iwiki summarize apply --project <path> --file <summaries.yaml>"),1;let $=N(_.homeDir),w=V($.databaseFile);try{j(w);let f=nf(_i(b(_.cwd,s),"utf8")),g=Mg(w,f);if(_.stdout(`applied summaries: ${g.written}`),g.skipped.length>0)_.stdout(`skipped (unknown session): ${g.skipped.length}`);return 0}catch(f){return _.stderr(f instanceof Error?f.message:String(f)),1}finally{w.close()}}if(u[0]==="experiences"&&u[1]==="prepare"){let s=K(u,"--from")??"changed-summaries";if(s!=="changed-summaries"&&s!=="all-recent")return _.stderr("Invalid --from. Use changed-summaries or all-recent."),1;let $=b(_.cwd,K(u,"--project")??_.cwd),w=K(u,"--out")??$i(F$($),"experiences-task.md"),f=N(_.homeDir),g=V(f.databaseFile);try{j(g);let i=fu(g,$),R=wg(g,i.id,s);return e_(si(b(_.cwd,w)),{recursive:!0}),M$(b(_.cwd,w),R.markdown),_.stdout(`prepared experiences task: ${R.summaryCount} summaries -> ${w}`),0}catch(i){return _.stderr(i instanceof Error?i.message:String(i)),1}finally{g.close()}}if(u[0]==="experiences"&&u[1]==="propose"){let s=K(u,"--file");if(!s)return _.stderr("Usage: llm-iwiki experiences propose --project <path> --file <experiences.yaml>"),1;let $=N(_.homeDir),w=V($.databaseFile);try{j(w);let f=hf(_i(b(_.cwd,s),"utf8")),g=gg(w,f);return _.stdout(`proposed experiences: ${g.written}`),0}catch(f){return _.stderr(f instanceof Error?f.message:String(f)),1}finally{w.close()}}if(u[0]==="experiences"&&u[1]==="candidates"){let s=K(u,"--project"),$=N(_.homeDir),w=V($.databaseFile);try{j(w);let f=s?fu(w,b(_.cwd,s)).id:null,g=ig(w,f);if(g.length===0)return _.stdout("No experience candidates. Run: llm-iwiki experiences propose"),0;for(let i of g)_.stdout(`${i.id} [${i.status}] ${i.confidence??"-"} ${i.proposed_title}`);return 0}catch(f){return _.stderr(f instanceof Error?f.message:String(f)),1}finally{w.close()}}if(u[0]==="experiences"&&(u[1]==="accept"||u[1]==="reject")){let s=u[2];if(!s)return _.stderr(`Usage: llm-iwiki experiences ${u[1]} <candidate-id>`),1;let $=N(_.homeDir),w=V($.databaseFile);try{if(j(w),u[1]==="accept"){let f=Rg(w,s);_.stdout(`accepted: ${f.experienceId} (${f.slug}), linked sessions: ${f.linkedSessions}`)}else Sg(w,s),_.stdout(`rejected: ${s}`);return 0}catch(f){return _.stderr(f instanceof Error?f.message:String(f)),1}finally{w.close()}}if(u[0]==="config"&&u[1]==="show"){let s=N(_.homeDir),$=q$(s.configFile);return _.stdout(`config: ${s.configFile}`),_.stdout(`obsidian.vault: ${$.obsidianVault??"(unset)"}`),0}if(u[0]==="config"&&u[1]==="set"){let s=u[2],$=u[3];if(!s||$===void 0)return _.stderr("Usage: llm-iwiki config set <key> <value>"),1;let w=N(_.homeDir);e_(w.configDir,{recursive:!0});try{let f=xf(w.configFile,s,$);return _.stdout(`set ${f} = ${$}`),0}catch(f){return _.stderr(f instanceof Error?f.message:String(f)),1}}if(u[0]==="obsidian"&&u[1]==="export"){let s=N(_.homeDir),$=K(u,"--vault"),w=$?b(_.cwd,$):q$(s.configFile).obsidianVault;if(!w)return _.stderr("No Obsidian vault configured. Run: llm-iwiki config set obsidian.vault <dir>"),1;let f=b(_.cwd,K(u,"--project")??_.cwd),g=u.includes("--force"),i=V(s.databaseFile);try{j(i);let R=fu(i,f),S=Ug(i,w,R,{force:g});_.stdout(`vault: ${w}`),_.stdout(`exported: created ${S.created}, updated ${S.updated}, forced ${S.forced}, conflicts ${S.conflicts.length}`);for(let L of S.conflicts)_.stdout(` conflict (skipped): ${L}`);if(S.conflicts.length>0&&!g)_.stdout("Re-run with --force to overwrite managed blocks of conflicting notes.");return 0}catch(R){return _.stderr(R instanceof Error?R.message:String(R)),1}finally{i.close()}}if(u[0]==="obsidian"&&u[1]==="check"){let s=N(_.homeDir),$=V(s.databaseFile);try{j($);let w=Hg($);_.stdout(`notes: ${w.total}, clean: ${w.clean}, needs attention: ${w.entries.length}`);for(let f of w.entries)_.stdout(` ${f.status}: ${f.filePath}`);return 0}finally{$.close()}}if(u[0]==="skills"&&u[1]==="init"){let s=K(u,"--target");if(u.includes("--target")&&!s)return _.stderr("Invalid --target. Use codex, claude-code, or cursor."),1;if(s&&!Y$.includes(s))return _.stderr("Invalid --target. Use codex, claude-code, or cursor."),1;let $=s,w=Jg({cwd:_.cwd,target:$,force:u.includes("--force"),dryRun:u.includes("--dry-run")});return _.stdout(`skills written: ${w.written.length}`),_.stdout(`skills skipped: ${w.skipped.length}`),0}if(u[0]==="skills"&&(u[1]===void 0||u[1]==="list")){_.stdout(fi),_.stdout(""),_.stdout("可用 target:");for(let s of Wg())_.stdout(` ${s.id} (${s.name})`);_.stdout(""),_.stdout(`将写入的 skill (位于 ${G$}/):`);for(let s of Xg())_.stdout(` ${s.directory} -> ${s.relPath}`);return 0}if(u[0]==="skills")return _.stderr(`Unknown skills subcommand: ${u[1]}`),_.stderr(fi),1;return _.stderr(`Unknown command: ${u.join(" ")}`),_.stderr(wi),1}var MU=await gi(process.argv.slice(2),{cwd:process.cwd(),stdout:console.log,stderr:console.error});process.exit(MU);
|