/
githubmirror
/
obsidian-headless
Обзор
Документация
Войти
/
githubmirror
/
obsidian-headless
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.0.13
cli.js
168 строк
211 KB
lishid
Fix WebSocket sometimes can get stuck in CONNECTING state indefinitely. Fix changing sync filters can cause remote files to be deleted rather than downloading those files.
05 июл 2026, 18:56
05 июл 2026, 18:56
5b37d63
Код
Авторство
О чём код?
#!/usr/bin/env node var qc=Object.create;var Lr=Object.defineProperty;var Mc=Object.getOwnPropertyDescriptor;var Rc=Object.getOwnPropertyNames;var Bc=Object.getPrototypeOf,$c=Object.prototype.hasOwnProperty;var A=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var jc=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Rc(e))!$c.call(s,n)&&n!==t&&Lr(s,n,{get:()=>e[n],enumerable:!(i=Mc(e,n))||i.enumerable});return s};var pe=(s,e,t)=>(t=s!=null?qc(Bc(s)):{},jc(e||!s||!s.__esModule?Lr(t,"default",{value:s,enumerable:!0}):t,s));var L=A(q=>{"use strict";var Ms=Symbol.for("yaml.alias"),go=Symbol.for("yaml.document"),Gt=Symbol.for("yaml.map"),mo=Symbol.for("yaml.pair"),Rs=Symbol.for("yaml.scalar"),Yt=Symbol.for("yaml.seq"),z=Symbol.for("yaml.node.type"),Jc=s=>!!s&&typeof s=="object"&&s[z]===Ms,Qc=s=>!!s&&typeof s=="object"&&s[z]===go,Xc=s=>!!s&&typeof s=="object"&&s[z]===Gt,zc=s=>!!s&&typeof s=="object"&&s[z]===mo,yo=s=>!!s&&typeof s=="object"&&s[z]===Rs,Zc=s=>!!s&&typeof s=="object"&&s[z]===Yt;function bo(s){if(s&&typeof s=="object")switch(s[z]){case Gt:case Yt:return!0}return!1}function eu(s){if(s&&typeof s=="object")switch(s[z]){case Ms:case Gt:case Rs:case Yt:return!0}return!1}var tu=s=>(yo(s)||bo(s))&&!!s.anchor;q.ALIAS=Ms;q.DOC=go;q.MAP=Gt;q.NODE_TYPE=z;q.PAIR=mo;q.SCALAR=Rs;q.SEQ=Yt;q.hasAnchor=tu;q.isAlias=Jc;q.isCollection=bo;q.isDocument=Qc;q.isMap=Xc;q.isNode=eu;q.isPair=zc;q.isScalar=yo;q.isSeq=Zc});var Qe=A(Bs=>{"use strict";var k=L(),R=Symbol("break visit"),wo=Symbol("skip children"),J=Symbol("remove node");function Jt(s,e){let t=So(e);k.isDocument(s)?Ce(null,s.contents,t,Object.freeze([s]))===J&&(s.contents=null):Ce(null,s,t,Object.freeze([]))}Jt.BREAK=R;Jt.SKIP=wo;Jt.REMOVE=J;function Ce(s,e,t,i){let n=vo(s,e,t,i);if(k.isNode(n)||k.isPair(n))return Fo(s,i,n),Ce(s,n,t,i);if(typeof n!="symbol"){if(k.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=Ce(r,e.items[r],t,i);if(typeof o=="number")r=o-1;else{if(o===R)return R;o===J&&(e.items.splice(r,1),r-=1)}}}else if(k.isPair(e)){i=Object.freeze(i.concat(e));let r=Ce("key",e.key,t,i);if(r===R)return R;r===J&&(e.key=null);let o=Ce("value",e.value,t,i);if(o===R)return R;o===J&&(e.value=null)}}return n}async function Qt(s,e){let t=So(e);k.isDocument(s)?await Oe(null,s.contents,t,Object.freeze([s]))===J&&(s.contents=null):await Oe(null,s,t,Object.freeze([]))}Qt.BREAK=R;Qt.SKIP=wo;Qt.REMOVE=J;async function Oe(s,e,t,i){let n=await vo(s,e,t,i);if(k.isNode(n)||k.isPair(n))return Fo(s,i,n),Oe(s,n,t,i);if(typeof n!="symbol"){if(k.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=await Oe(r,e.items[r],t,i);if(typeof o=="number")r=o-1;else{if(o===R)return R;o===J&&(e.items.splice(r,1),r-=1)}}}else if(k.isPair(e)){i=Object.freeze(i.concat(e));let r=await Oe("key",e.key,t,i);if(r===R)return R;r===J&&(e.key=null);let o=await Oe("value",e.value,t,i);if(o===R)return R;o===J&&(e.value=null)}}return n}function So(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function vo(s,e,t,i){if(typeof t=="function")return t(s,e,i);if(k.isMap(e))return t.Map?.(s,e,i);if(k.isSeq(e))return t.Seq?.(s,e,i);if(k.isPair(e))return t.Pair?.(s,e,i);if(k.isScalar(e))return t.Scalar?.(s,e,i);if(k.isAlias(e))return t.Alias?.(s,e,i)}function Fo(s,e,t){let i=e[e.length-1];if(k.isCollection(i))i.items[s]=t;else if(k.isPair(i))s==="key"?i.key=t:i.value=t;else if(k.isDocument(i))i.contents=t;else{let n=k.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}Bs.visit=Jt;Bs.visitAsync=Qt});var $s=A(Ao=>{"use strict";var Eo=L(),iu=Qe(),su={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},nu=s=>s.replace(/[!,[\]{}]/g,e=>su[e]),Xe=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[r,o]=i;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=i;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,i,n]=e.match(/^(.*!)([^!]*)$/s);n||t(`The ${e} tag has no suffix`);let r=this.tags[i];if(r)try{return r+decodeURIComponent(n)}catch(o){return t(String(o)),null}return i==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,i]of Object.entries(this.tags))if(e.startsWith(i))return t+nu(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(e&&i.length>0&&Eo.isNode(e.contents)){let r={};iu.visit(e.contents,(o,a)=>{Eo.isNode(a)&&a.tag&&(r[a.tag]=!0)}),n=Object.keys(r)}else n=[];for(let[r,o]of i)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||n.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(` `)}};Xe.defaultYaml={explicit:!1,version:"1.2"};Xe.defaultTags={"!!":"tag:yaml.org,2002:"};Ao.Directives=Xe});var Xt=A(ze=>{"use strict";var Po=L(),ru=Qe();function ou(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Do(s){let e=new Set;return ru.visit(s,{Value(t,i){i.anchor&&e.add(i.anchor)}}),e}function To(s,e){for(let t=1;;++t){let i=`${s}${t}`;if(!e.has(i))return i}}function au(s,e){let t=[],i=new Map,n=null;return{onAnchor:r=>{t.push(r),n||(n=Do(s));let o=To(e,n);return n.add(o),o},setAnchors:()=>{for(let r of t){let o=i.get(r);if(typeof o=="object"&&o.anchor&&(Po.isScalar(o.node)||Po.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:i}}ze.anchorIsValid=ou;ze.anchorNames=Do;ze.createNodeAnchors=au;ze.findNewAnchor=To});var js=A(Lo=>{"use strict";function Ze(s,e,t,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let o=i[n],a=Ze(s,i,String(n),o);a===void 0?delete i[n]:a!==o&&(i[n]=a)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),o=Ze(s,i,n,r);o===void 0?i.delete(n):o!==r&&i.set(n,o)}else if(i instanceof Set)for(let n of Array.from(i)){let r=Ze(s,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let o=Ze(s,i,n,r);o===void 0?delete i[n]:o!==r&&(i[n]=o)}return s.call(e,t,i)}Lo.applyReviver=Ze});var ne=A(No=>{"use strict";var lu=L();function _o(s,e,t){if(Array.isArray(s))return s.map((i,n)=>_o(i,String(n),t));if(s&&typeof s.toJSON=="function"){if(!t||!lu.hasAnchor(s))return s.toJSON(e,t);let i={aliasCount:0,count:1,res:void 0};t.anchors.set(s,i),t.onCreate=r=>{i.res=r,delete t.onCreate};let n=s.toJSON(e,t);return t.onCreate&&t.onCreate(n),n}return typeof s=="bigint"&&!t?.keep?Number(s):s}No.toJS=_o});var zt=A(Oo=>{"use strict";var cu=js(),Co=L(),uu=ne(),Us=class{constructor(e){Object.defineProperty(this,Co.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:i,onAnchor:n,reviver:r}={}){if(!Co.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=uu.toJS(this,"",o);if(typeof n=="function")for(let{count:l,res:c}of o.anchors.values())n(c,l);return typeof r=="function"?cu.applyReviver(r,{"":a},"",a):a}};Oo.NodeBase=Us});var et=A(ko=>{"use strict";var fu=Xt(),Io=Qe(),Zt=L(),hu=zt(),pu=ne(),Ks=class extends hu.NodeBase{constructor(e){super(Zt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return Io.visit(e,{Node:(i,n)=>{if(n===this)return Io.visit.BREAK;n.anchor===this.source&&(t=n)}}),t}toJSON(e,t){if(!t)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:r}=t,o=this.resolve(n);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=i.get(o);if(a||(pu.toJS(o,null,t),a=i.get(o)),!a||a.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ei(n,o,i)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,i){let n=`*${this.source}`;if(e){if(fu.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${n} `}return n}};function ei(s,e,t){if(Zt.isAlias(e)){let i=e.resolve(s),n=t&&i&&t.get(i);return n?n.count*n.aliasCount:0}else if(Zt.isCollection(e)){let i=0;for(let n of e.items){let r=ei(s,n,t);r>i&&(i=r)}return i}else if(Zt.isPair(e)){let i=ei(s,e.key,t),n=ei(s,e.value,t);return Math.max(i,n)}return 1}ko.Alias=Ks});var I=A(Vs=>{"use strict";var du=L(),gu=zt(),mu=ne(),yu=s=>!s||typeof s!="function"&&typeof s!="object",re=class extends gu.NodeBase{constructor(e){super(du.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:mu.toJS(this.value,e,t)}toString(){return String(this.value)}};re.BLOCK_FOLDED="BLOCK_FOLDED";re.BLOCK_LITERAL="BLOCK_LITERAL";re.PLAIN="PLAIN";re.QUOTE_DOUBLE="QUOTE_DOUBLE";re.QUOTE_SINGLE="QUOTE_SINGLE";Vs.Scalar=re;Vs.isScalarValue=yu});var tt=A(qo=>{"use strict";var bu=et(),be=L(),xo=I(),wu="tag:yaml.org,2002:";function Su(s,e,t){if(e){let i=t.filter(r=>r.tag===e),n=i.find(r=>!r.format)??i[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return t.find(i=>i.identify?.(s)&&!i.format)}function vu(s,e,t){if(be.isDocument(s)&&(s=s.contents),be.isNode(s))return s;if(be.isPair(s)){let u=t.schema[be.MAP].createNode?.(t.schema,null,t);return u.items.push(s),u}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:r,schema:o,sourceObjects:a}=t,l;if(i&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor||(l.anchor=n(s)),new bu.Alias(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=wu+e.slice(2));let c=Su(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let u=new xo.Scalar(s);return l&&(l.node=u),u}c=s instanceof Map?o[be.MAP]:Symbol.iterator in Object(s)?o[be.SEQ]:o[be.MAP]}r&&(r(c),delete t.onTagObj);let f=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new xo.Scalar(s);return e?f.tag=e:c.default||(f.tag=c.tag),l&&(l.node=f),f}qo.createNode=vu});var ii=A(ti=>{"use strict";var Fu=tt(),Q=L(),Eu=zt();function Ws(s,e,t){let i=t;for(let n=e.length-1;n>=0;--n){let r=e[n];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=i,i=o}else i=new Map([[r,i]])}return Fu.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var Mo=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,Hs=class extends Eu.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(i=>Q.isNode(i)||Q.isPair(i)?i.clone(e):i),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Mo(e))this.add(t);else{let[i,...n]=e,r=this.get(i,!0);if(Q.isCollection(r))r.addIn(n,t);else if(r===void 0&&this.schema)this.set(i,Ws(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(e){let[t,...i]=e;if(i.length===0)return this.delete(t);let n=this.get(t,!0);if(Q.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${i}`)}getIn(e,t){let[i,...n]=e,r=this.get(i,!0);return n.length===0?!t&&Q.isScalar(r)?r.value:r:Q.isCollection(r)?r.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Q.isPair(t))return!1;let i=t.value;return i==null||e&&Q.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[t,...i]=e;if(i.length===0)return this.has(t);let n=this.get(t,!0);return Q.isCollection(n)?n.hasIn(i):!1}setIn(e,t){let[i,...n]=e;if(n.length===0)this.set(i,t);else{let r=this.get(i,!0);if(Q.isCollection(r))r.setIn(n,t);else if(r===void 0&&this.schema)this.set(i,Ws(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};ti.Collection=Hs;ti.collectionFromPath=Ws;ti.isEmptyPath=Mo});var it=A(si=>{"use strict";var Au=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Gs(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var Pu=(s,e,t)=>s.endsWith(` `)?Gs(t,e):t.includes(` `)?` `+Gs(t,e):(s.endsWith(" ")?"":" ")+t;si.indentComment=Gs;si.lineComment=Pu;si.stringifyComment=Au});var Bo=A(st=>{"use strict";var Du="flow",Ys="block",ni="quoted";function Tu(s,e,t="flow",{indentAtStart:i,lineWidth:n=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!n||n<0)return s;n<r&&(r=0);let l=Math.max(1+r,1+n-e.length);if(s.length<=l)return s;let c=[],f={},u=n-e.length;typeof i=="number"&&(i>n-Math.max(2,r)?c.push(0):u=n-i);let h,y,S=!1,d=-1,p=-1,m=-1;t===Ys&&(d=Ro(s,d,e.length),d!==-1&&(u=d+l));for(let F;F=s[d+=1];){if(t===ni&&F==="\\"){switch(p=d,s[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}m=d}if(F===` `)t===Ys&&(d=Ro(s,d,e.length)),u=d+e.length+l,h=void 0;else{if(F===" "&&y&&y!==" "&&y!==` `&&y!==" "){let b=s[d+1];b&&b!==" "&&b!==` `&&b!==" "&&(h=d)}if(d>=u)if(h)c.push(h),u=h+l,h=void 0;else if(t===ni){for(;y===" "||y===" ";)y=F,F=s[d+=1],S=!0;let b=d>m+1?d-2:p-1;if(f[b])return s;c.push(b),f[b]=!0,u=b+l,h=void 0}else S=!0}y=F}if(S&&a&&a(),c.length===0)return s;o&&o();let g=s.slice(0,c[0]);for(let F=0;F<c.length;++F){let b=c[F],w=c[F+1]||s.length;b===0?g=` ${e}${s.slice(0,w)}`:(t===ni&&f[b]&&(g+=`${s[b]}\\`),g+=` ${e}${s.slice(b+1,w)}`)}return g}function Ro(s,e,t){let i=e,n=e+1,r=s[n];for(;r===" "||r===" ";)if(e<n+t)r=s[++e];else{do r=s[++e];while(r&&r!==` `);i=e,n=e+1,r=s[n]}return i}st.FOLD_BLOCK=Ys;st.FOLD_FLOW=Du;st.FOLD_QUOTED=ni;st.foldFlowLines=Tu});var rt=A($o=>{"use strict";var H=I(),oe=Bo(),oi=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),ai=s=>/^(%|---|\.\.\.)/m.test(s);function Lu(s,e,t){if(!e||e<0)return!1;let i=e-t,n=s.length;if(n<=i)return!1;for(let r=0,o=0;r<n;++r)if(s[r]===` `){if(r-o>i)return!0;if(o=r+1,n-o<=i)return!1}return!0}function nt(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:i}=e,n=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(ai(s)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let f=t.substr(l+2,4);switch(f){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:f.substr(0,2)==="00"?o+="\\x"+f.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(i||t[l+2]==='"'||t.length<n)l+=1;else{for(o+=t.slice(a,l)+` `;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=` `,l+=2;o+=r,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,i?o:oe.foldFlowLines(o,r,oe.FOLD_QUOTED,oi(e,!1))}function Js(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(` `)||/[ \t]\n|\n[ \t]/.test(s))return nt(s,e);let t=e.indent||(ai(s)?" ":""),i="'"+s.replace(/'/g,"''").replace(/\n+/g,`$& ${t}`)+"'";return e.implicitKey?i:oe.foldFlowLines(i,t,oe.FOLD_FLOW,oi(e,!1))}function Ie(s,e){let{singleQuote:t}=e.options,i;if(t===!1)i=nt;else{let n=s.includes('"'),r=s.includes("'");n&&!r?i=Js:r&&!n?i=nt:i=t?Js:nt}return i(s,e)}var Qs;try{Qs=new RegExp(`(^|(?<! )) +(?! |$)`,"g")}catch{Qs=/\n+(?!\n|$)/g}function ri({comment:s,type:e,value:t},i,n,r){let{blockQuote:o,commentString:a,lineWidth:l}=i.options;if(!o||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return Ie(t,i);let c=i.indent||(i.forceBlockIndent||ai(t)?" ":""),f=o==="literal"?!0:o==="folded"||e===H.Scalar.BLOCK_FOLDED?!1:e===H.Scalar.BLOCK_LITERAL?!0:!Lu(t,l,c.length);if(!t)return f?`| `:`> `;let u,h;for(h=t.length;h>0;--h){let w=t[h-1];if(w!==` `&&w!==" "&&w!==" ")break}let y=t.substring(h),S=y.indexOf(` `);S===-1?u="-":t===y||S!==y.length-1?(u="+",r&&r()):u="",y&&(t=t.slice(0,-y.length),y[y.length-1]===` `&&(y=y.slice(0,-1)),y=y.replace(Qs,`$&${c}`));let d=!1,p,m=-1;for(p=0;p<t.length;++p){let w=t[p];if(w===" ")d=!0;else if(w===` `)m=p;else break}let g=t.substring(0,m<p?m+1:p);g&&(t=t.substring(g.length),g=g.replace(/\n+/g,`$&${c}`));let b=(d?c?"2":"1":"")+u;if(s&&(b+=" "+a(s.replace(/ ?[\r\n]+/g," ")),n&&n()),!f){let w=t.replace(/\n+/g,` $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),v=!1,P=oi(i,!0);o!=="folded"&&e!==H.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{v=!0});let E=oe.foldFlowLines(`${g}${w}${y}`,c,oe.FOLD_BLOCK,P);if(!v)return`>${b} ${c}${E}`}return t=t.replace(/\n+/g,`$&${c}`),`|${b} ${c}${g}${t}${y}`}function _u(s,e,t,i){let{type:n,value:r}=s,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:f}=e;if(a&&r.includes(` `)||f&&/[[\]{},]/.test(r))return Ie(r,e);if(!r||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||f||!r.includes(` `)?Ie(r,e):ri(s,e,t,i);if(!a&&!f&&n!==H.Scalar.PLAIN&&r.includes(` `))return ri(s,e,t,i);if(ai(r)){if(l==="")return e.forceBlockIndent=!0,ri(s,e,t,i);if(a&&l===c)return Ie(r,e)}let u=r.replace(/\n+/g,`$& ${l}`);if(o){let h=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(u),{compat:y,tags:S}=e.doc.schema;if(S.some(h)||y?.some(h))return Ie(r,e)}return a?u:oe.foldFlowLines(u,l,oe.FOLD_FLOW,oi(e,!1))}function Nu(s,e,t,i){let{implicitKey:n,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==H.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=H.Scalar.QUOTE_DOUBLE);let l=f=>{switch(f){case H.Scalar.BLOCK_FOLDED:case H.Scalar.BLOCK_LITERAL:return n||r?Ie(o.value,e):ri(o,e,t,i);case H.Scalar.QUOTE_DOUBLE:return nt(o.value,e);case H.Scalar.QUOTE_SINGLE:return Js(o.value,e);case H.Scalar.PLAIN:return _u(o,e,t,i);default:return null}},c=l(a);if(c===null){let{defaultKeyType:f,defaultStringType:u}=e.options,h=n&&f||u;if(c=l(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}$o.stringifyString=Nu});var ot=A(Xs=>{"use strict";var Cu=Xt(),ae=L(),Ou=it(),Iu=rt();function ku(s,e){let t=Object.assign({blockQuote:!0,commentString:Ou.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,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),i;switch(t.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:i,options:t}}function xu(s,e){if(e.tag){let n=s.filter(r=>r.tag===e.tag);if(n.length>0)return n.find(r=>r.format===e.format)??n[0]}let t,i;if(ae.isScalar(e)){i=e.value;let n=s.filter(r=>r.identify?.(i));if(n.length>1){let r=n.filter(o=>o.test);r.length>0&&(n=r)}t=n.find(r=>r.format===e.format)??n.find(r=>!r.format)}else i=e,t=s.find(n=>n.nodeClass&&i instanceof n.nodeClass);if(!t){let n=i?.constructor?.name??typeof i;throw new Error(`Tag not resolved for ${n} value`)}return t}function qu(s,e,{anchors:t,doc:i}){if(!i.directives)return"";let n=[],r=(ae.isScalar(s)||ae.isCollection(s))&&s.anchor;r&&Cu.anchorIsValid(r)&&(t.add(r),n.push(`&${r}`));let o=s.tag?s.tag:e.default?null:e.tag;return o&&n.push(i.directives.tagString(o)),n.join(" ")}function Mu(s,e,t,i){if(ae.isPair(s))return s.toString(e,t,i);if(ae.isAlias(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let n,r=ae.isNode(s)?s:e.doc.createNode(s,{onTagObj:l=>n=l});n||(n=xu(e.doc.schema.tags,r));let o=qu(r,n,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof n.stringify=="function"?n.stringify(r,e,t,i):ae.isScalar(r)?Iu.stringifyString(r,e,t,i):r.toString(e,t,i);return o?ae.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o} ${e.indent}${a}`:a}Xs.createStringifyContext=ku;Xs.stringify=Mu});var Vo=A(Ko=>{"use strict";var Z=L(),jo=I(),Uo=ot(),at=it();function Ru({key:s,value:e},t,i,n){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:f,simpleKeys:u}}=t,h=Z.isNode(s)&&s.comment||null;if(u){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Z.isCollection(s)||!Z.isNode(s)&&typeof s=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let y=!u&&(!s||h&&e==null&&!t.inFlow||Z.isCollection(s)||(Z.isScalar(s)?s.type===jo.Scalar.BLOCK_FOLDED||s.type===jo.Scalar.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!y&&(u||!r),indent:a+l});let S=!1,d=!1,p=Uo.stringify(s,t,()=>S=!0,()=>d=!0);if(!y&&!t.inFlow&&p.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");y=!0}if(t.inFlow){if(r||e==null)return S&&i&&i(),p===""?"?":y?`? ${p}`:p}else if(r&&!u||e==null&&y)return p=`? ${p}`,h&&!S?p+=at.lineComment(p,t.indent,c(h)):d&&n&&n(),p;S&&(h=null),y?(h&&(p+=at.lineComment(p,t.indent,c(h))),p=`? ${p} ${a}:`):(p=`${p}:`,h&&(p+=at.lineComment(p,t.indent,c(h))));let m,g,F;Z.isNode(e)?(m=!!e.spaceBefore,g=e.commentBefore,F=e.comment):(m=!1,g=null,F=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!y&&!h&&Z.isScalar(e)&&(t.indentAtStart=p.length+1),d=!1,!f&&l.length>=2&&!t.inFlow&&!y&&Z.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let b=!1,w=Uo.stringify(e,t,()=>b=!0,()=>d=!0),v=" ";if(h||m||g){if(v=m?` `:"",g){let P=c(g);v+=` ${at.indentComment(P,t.indent)}`}w===""&&!t.inFlow?v===` `&&(v=` `):v+=` ${t.indent}`}else if(!y&&Z.isCollection(e)){let P=w[0],E=w.indexOf(` `),N=E!==-1,M=t.inFlow??e.flow??e.items.length===0;if(N||!M){let te=!1;if(N&&(P==="&"||P==="!")){let O=w.indexOf(" ");P==="&"&&O!==-1&&O<E&&w[O+1]==="!"&&(O=w.indexOf(" ",O+1)),(O===-1||E<O)&&(te=!0)}te||(v=` ${t.indent}`)}}else(w===""||w[0]===` `)&&(v="");return p+=v+w,t.inFlow?b&&i&&i():F&&!b?p+=at.lineComment(p,t.indent,c(F)):d&&n&&n(),p}Ko.stringifyPair=Ru});var Zs=A(zs=>{"use strict";var Wo=require("node:process");function Bu(s,...e){s==="debug"&&console.log(...e)}function $u(s,e){(s==="debug"||s==="warn")&&(typeof Wo.emitWarning=="function"?Wo.emitWarning(e):console.warn(e))}zs.debug=Bu;zs.warn=$u});var fi=A(ui=>{"use strict";var lt=L(),Ho=I(),li="<<",ci={identify:s=>s===li||typeof s=="symbol"&&s.description===li,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ho.Scalar(Symbol(li)),{addToJSMap:Go}),stringify:()=>li},ju=(s,e)=>(ci.identify(e)||lt.isScalar(e)&&(!e.type||e.type===Ho.Scalar.PLAIN)&&ci.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===ci.tag&&t.default);function Go(s,e,t){if(t=s&<.isAlias(t)?t.resolve(s.doc):t,lt.isSeq(t))for(let i of t.items)en(s,e,i);else if(Array.isArray(t))for(let i of t)en(s,e,i);else en(s,e,t)}function en(s,e,t){let i=s&<.isAlias(t)?t.resolve(s.doc):t;if(!lt.isMap(i))throw new Error("Merge sources must be maps or map aliases");let n=i.toJSON(null,s,Map);for(let[r,o]of n)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}ui.addMergeToJSMap=Go;ui.isMergeKey=ju;ui.merge=ci});var sn=A(Qo=>{"use strict";var Uu=Zs(),Yo=fi(),Ku=ot(),Jo=L(),tn=ne();function Vu(s,e,{key:t,value:i}){if(Jo.isNode(t)&&t.addToJSMap)t.addToJSMap(s,e,i);else if(Yo.isMergeKey(s,t))Yo.addMergeToJSMap(s,e,i);else{let n=tn.toJS(t,"",s);if(e instanceof Map)e.set(n,tn.toJS(i,n,s));else if(e instanceof Set)e.add(n);else{let r=Wu(t,n,s),o=tn.toJS(i,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function Wu(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(Jo.isNode(s)&&t?.doc){let i=Ku.createStringifyContext(t.doc,{});i.anchors=new Set;for(let r of t.anchors.keys())i.anchors.add(r.anchor);i.inFlow=!0,i.inStringifyKey=!0;let n=s.toString(i);if(!t.mapKeyWarned){let r=JSON.stringify(n);r.length>40&&(r=r.substring(0,36)+'..."'),Uu.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return n}return JSON.stringify(e)}Qo.addPairToJSMap=Vu});var le=A(nn=>{"use strict";var Xo=tt(),Hu=Vo(),Gu=sn(),hi=L();function Yu(s,e,t){let i=Xo.createNode(s,void 0,t),n=Xo.createNode(e,void 0,t);return new pi(i,n)}var pi=class s{constructor(e,t=null){Object.defineProperty(this,hi.NODE_TYPE,{value:hi.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:i}=this;return hi.isNode(t)&&(t=t.clone(e)),hi.isNode(i)&&(i=i.clone(e)),new s(t,i)}toJSON(e,t){let i=t?.mapAsMap?new Map:{};return Gu.addPairToJSMap(t,i,this)}toString(e,t,i){return e?.doc?Hu.stringifyPair(this,e,t,i):JSON.stringify(this)}};nn.Pair=pi;nn.createPair=Yu});var rn=A(Zo=>{"use strict";var we=L(),zo=ot(),di=it();function Ju(s,e,t){return(e.inFlow??s.flow?Xu:Qu)(s,e,t)}function Qu({comment:s,items:e},t,{blockItemPrefix:i,flowChars:n,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,f=Object.assign({},t,{indent:r,type:null}),u=!1,h=[];for(let S=0;S<e.length;++S){let d=e[S],p=null;if(we.isNode(d))!u&&d.spaceBefore&&h.push(""),gi(t,h,d.commentBefore,u),d.comment&&(p=d.comment);else if(we.isPair(d)){let g=we.isNode(d.key)?d.key:null;g&&(!u&&g.spaceBefore&&h.push(""),gi(t,h,g.commentBefore,u))}u=!1;let m=zo.stringify(d,f,()=>p=null,()=>u=!0);p&&(m+=di.lineComment(m,r,c(p))),u&&p&&(u=!1),h.push(i+m)}let y;if(h.length===0)y=n.start+n.end;else{y=h[0];for(let S=1;S<h.length;++S){let d=h[S];y+=d?` ${l}${d}`:` `}}return s?(y+=` `+di.indentComment(c(s),l),a&&a()):u&&o&&o(),y}function Xu({items:s},e,{flowChars:t,itemIndent:i}){let{indent:n,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=e;i+=r;let l=Object.assign({},e,{indent:i,inFlow:!0,type:null}),c=!1,f=0,u=[];for(let S=0;S<s.length;++S){let d=s[S],p=null;if(we.isNode(d))d.spaceBefore&&u.push(""),gi(e,u,d.commentBefore,!1),d.comment&&(p=d.comment);else if(we.isPair(d)){let g=we.isNode(d.key)?d.key:null;g&&(g.spaceBefore&&u.push(""),gi(e,u,g.commentBefore,!1),g.comment&&(c=!0));let F=we.isNode(d.value)?d.value:null;F?(F.comment&&(p=F.comment),F.commentBefore&&(c=!0)):d.value==null&&g?.comment&&(p=g.comment)}p&&(c=!0);let m=zo.stringify(d,l,()=>p=null);S<s.length-1&&(m+=","),p&&(m+=di.lineComment(m,i,a(p))),!c&&(u.length>f||m.includes(` `))&&(c=!0),u.push(m),f=u.length}let{start:h,end:y}=t;if(u.length===0)return h+y;if(!c){let S=u.reduce((d,p)=>d+p.length+2,2);c=e.options.lineWidth>0&&S>e.options.lineWidth}if(c){let S=h;for(let d of u)S+=d?` ${r}${n}${d}`:` `;return`${S} ${n}${y}`}else return`${h}${o}${u.join(" ")}${o}${y}`}function gi({indent:s,options:{commentString:e}},t,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let r=di.indentComment(e(i),s);t.push(r.trimStart())}}Zo.stringifyCollection=Ju});var ue=A(an=>{"use strict";var zu=rn(),Zu=sn(),ef=ii(),ce=L(),mi=le(),tf=I();function ct(s,e){let t=ce.isScalar(e)?e.value:e;for(let i of s)if(ce.isPair(i)&&(i.key===e||i.key===t||ce.isScalar(i.key)&&i.key.value===t))return i}var on=class extends ef.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ce.MAP,e),this.items=[]}static from(e,t,i){let{keepUndefined:n,replacer:r}=i,o=new this(e),a=(l,c)=>{if(typeof r=="function")c=r.call(t,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||n)&&o.items.push(mi.createPair(l,c,i))};if(t instanceof Map)for(let[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let i;ce.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new mi.Pair(e,e?.value):i=new mi.Pair(e.key,e.value);let n=ct(this.items,i.key),r=this.schema?.sortMapEntries;if(n){if(!t)throw new Error(`Key ${i.key} already set`);ce.isScalar(n.value)&&tf.isScalarValue(i.value)?n.value.value=i.value:n.value=i.value}else if(r){let o=this.items.findIndex(a=>r(i,a)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(e){let t=ct(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=ct(this.items,e)?.value;return(!t&&ce.isScalar(n)?n.value:n)??void 0}has(e){return!!ct(this.items,e)}set(e,t){this.add(new mi.Pair(e,t),!0)}toJSON(e,t,i){let n=i?new i:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(n);for(let r of this.items)Zu.addPairToJSMap(t,n,r);return n}toString(e,t,i){if(!e)return JSON.stringify(this);for(let n of this.items)if(!ce.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),zu.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:t})}};an.YAMLMap=on;an.findPair=ct});var ke=A(ta=>{"use strict";var sf=L(),ea=ue(),nf={collection:"map",default:!0,nodeClass:ea.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(s,e){return sf.isMap(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>ea.YAMLMap.from(s,e,t)};ta.map=nf});var fe=A(ia=>{"use strict";var rf=tt(),of=rn(),af=ii(),bi=L(),lf=I(),cf=ne(),ln=class extends af.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(bi.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=yi(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let i=yi(e);if(typeof i!="number")return;let n=this.items[i];return!t&&bi.isScalar(n)?n.value:n}has(e){let t=yi(e);return typeof t=="number"&&t<this.items.length}set(e,t){let i=yi(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[i];bi.isScalar(n)&&lf.isScalarValue(t)?n.value=t:this.items[i]=t}toJSON(e,t){let i=[];t?.onCreate&&t.onCreate(i);let n=0;for(let r of this.items)i.push(cf.toJS(r,String(n++),t));return i}toString(e,t,i){return e?of.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:t}):JSON.stringify(this)}static from(e,t,i){let{replacer:n}=i,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof n=="function"){let l=t instanceof Set?a:String(o++);a=n.call(t,l,a)}r.items.push(rf.createNode(a,void 0,i))}}return r}};function yi(s){let e=bi.isScalar(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}ia.YAMLSeq=ln});var xe=A(na=>{"use strict";var uf=L(),sa=fe(),ff={collection:"seq",default:!0,nodeClass:sa.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(s,e){return uf.isSeq(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>sa.YAMLSeq.from(s,e,t)};na.seq=ff});var ut=A(ra=>{"use strict";var hf=rt(),pf={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,i){return e=Object.assign({actualString:!0},e),hf.stringifyString(s,e,t,i)}};ra.string=pf});var wi=A(la=>{"use strict";var oa=I(),aa={identify:s=>s==null,createNode:()=>new oa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new oa.Scalar(null),stringify:({source:s},e)=>typeof s=="string"&&aa.test.test(s)?s:e.options.nullStr};la.nullTag=aa});var cn=A(ua=>{"use strict";var df=I(),ca={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new df.Scalar(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&ca.test.test(s)){let i=s[0]==="t"||s[0]==="T";if(e===i)return s}return e?t.options.trueStr:t.options.falseStr}};ua.boolTag=ca});var qe=A(fa=>{"use strict";function gf({format:s,minFractionDigits:e,tag:t,value:i}){if(typeof i=="bigint")return String(i);let n=typeof i=="number"?i:Number(i);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let r=JSON.stringify(i);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}fa.stringifyNumber=gf});var fn=A(Si=>{"use strict";var mf=I(),un=qe(),yf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:un.stringifyNumber},bf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():un.stringifyNumber(s)}},wf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){let e=new mf.Scalar(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:un.stringifyNumber};Si.float=wf;Si.floatExp=bf;Si.floatNaN=yf});var pn=A(Fi=>{"use strict";var ha=qe(),vi=s=>typeof s=="bigint"||Number.isInteger(s),hn=(s,e,t,{intAsBigInt:i})=>i?BigInt(s):parseInt(s.substring(e),t);function pa(s,e,t){let{value:i}=s;return vi(i)&&i>=0?t+i.toString(e):ha.stringifyNumber(s)}var Sf={identify:s=>vi(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>hn(s,2,8,t),stringify:s=>pa(s,8,"0o")},vf={identify:vi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>hn(s,0,10,t),stringify:ha.stringifyNumber},Ff={identify:s=>vi(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>hn(s,2,16,t),stringify:s=>pa(s,16,"0x")};Fi.int=vf;Fi.intHex=Ff;Fi.intOct=Sf});var ga=A(da=>{"use strict";var Ef=ke(),Af=wi(),Pf=xe(),Df=ut(),Tf=cn(),dn=fn(),gn=pn(),Lf=[Ef.map,Pf.seq,Df.string,Af.nullTag,Tf.boolTag,gn.intOct,gn.int,gn.intHex,dn.floatNaN,dn.floatExp,dn.float];da.schema=Lf});var ba=A(ya=>{"use strict";var _f=I(),Nf=ke(),Cf=xe();function ma(s){return typeof s=="bigint"||Number.isInteger(s)}var Ei=({value:s})=>JSON.stringify(s),Of=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Ei},{identify:s=>s==null,createNode:()=>new _f.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ei},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:Ei},{identify:ma,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>ma(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Ei}],If={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},kf=[Nf.map,Cf.seq].concat(Of,If);ya.schema=kf});var yn=A(wa=>{"use strict";var ft=require("node:buffer"),mn=I(),xf=rt(),qf={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof ft.Buffer=="function")return ft.Buffer.from(s,"base64");if(typeof atob=="function"){let t=atob(s.replace(/[\n\r]/g,"")),i=new Uint8Array(t.length);for(let n=0;n<t.length;++n)i[n]=t.charCodeAt(n);return i}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},i,n,r){let o=t,a;if(typeof ft.Buffer=="function")a=o instanceof ft.Buffer?o.toString("base64"):ft.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e||(e=mn.Scalar.BLOCK_LITERAL),e!==mn.Scalar.QUOTE_DOUBLE){let l=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),c=Math.ceil(a.length/l),f=new Array(c);for(let u=0,h=0;u<c;++u,h+=l)f[u]=a.substr(h,l);a=f.join(e===mn.Scalar.BLOCK_LITERAL?` `:" ")}return xf.stringifyString({comment:s,type:e,value:a},i,n,r)}};wa.binary=qf});var Di=A(Pi=>{"use strict";var Ai=L(),bn=le(),Mf=I(),Rf=fe();function Sa(s,e){if(Ai.isSeq(s))for(let t=0;t<s.items.length;++t){let i=s.items[t];if(!Ai.isPair(i)){if(Ai.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let n=i.items[0]||new bn.Pair(new Mf.Scalar(null));if(i.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${i.commentBefore} ${n.key.commentBefore}`:i.commentBefore),i.comment){let r=n.value??n.key;r.comment=r.comment?`${i.comment} ${r.comment}`:i.comment}i=n}s.items[t]=Ai.isPair(i)?i:new bn.Pair(i)}}else e("Expected a sequence for this tag");return s}function va(s,e,t){let{replacer:i}=t,n=new Rf.YAMLSeq(s);n.tag="tag:yaml.org,2 … [Строка слишком длинная. Вы можете скачать файл] `)?(t.push("..."),t.push(mt.indentComment(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=s.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(mt.indentComment(r(l),"")))}return t.join(` `)+` `}Ya.stringifyDocument=Fh});var yt=A(Qa=>{"use strict";var Eh=et(),Me=ii(),K=L(),Ah=le(),Ph=ne(),Dh=qn(),Th=Ja(),Rn=Xt(),Lh=js(),_h=tt(),Bn=$s(),$n=class s{constructor(e,t,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,K.NODE_TYPE,{value:K.DOC});let n=null;typeof t=="function"||Array.isArray(t)?n=t:i===void 0&&t&&(i=t,t=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=r;let{version:o}=r;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Bn.Directives({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,n,i)}clone(){let e=Object.create(s.prototype,{[K.NODE_TYPE]:{value:K.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=K.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Re(this.contents)&&this.contents.add(e)}addIn(e,t){Re(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let i=Rn.anchorNames(this);e.anchor=!t||i.has(t)?Rn.findNewAnchor(t||"a",i):t}return new Eh.Alias(e.anchor)}createNode(e,t,i){let n;if(typeof t=="function")e=t.call({"":e},"",e),n=t;else if(Array.isArray(t)){let p=g=>typeof g=="number"||g instanceof String||g instanceof Number,m=t.filter(p).map(String);m.length>0&&(t=t.concat(m)),n=t}else i===void 0&&t&&(i=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:f}=i??{},{onAnchor:u,setAnchors:h,sourceObjects:y}=Rn.createNodeAnchors(this,o||"a"),S={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:y},d=_h.createNode(e,f,S);return a&&K.isCollection(d)&&(d.flow=!0),h(),d}createPair(e,t,i={}){let n=this.createNode(e,null,i),r=this.createNode(t,null,i);return new Ah.Pair(n,r)}delete(e){return Re(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Me.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Re(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return K.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Me.isEmptyPath(e)?!t&&K.isScalar(this.contents)?this.contents.value:this.contents:K.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return K.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Me.isEmptyPath(e)?this.contents!==void 0:K.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Me.collectionFromPath(this.schema,[e],t):Re(this.contents)&&this.contents.set(e,t)}setIn(e,t){Me.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=Me.collectionFromPath(this.schema,Array.from(e),t):Re(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Bn.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Bn.Directives({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(i)this.schema=new Dh.Schema(Object.assign(i,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:i,maxAliasCount:n,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=Ph.toJS(this.contents,t??"",a);if(typeof r=="function")for(let{count:c,res:f}of a.anchors.values())r(f,c);return typeof o=="function"?Lh.applyReviver(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Th.stringifyDocument(this,e)}};function Re(s){if(K.isCollection(s))return!0;throw new Error("Expected a YAML collection as document contents")}Qa.Document=$n});var St=A(wt=>{"use strict";var bt=class extends Error{constructor(e,t,i,n){super(),this.name=e,this.code=i,this.message=n,this.pos=t}},jn=class extends bt{constructor(e,t,i){super("YAMLParseError",e,t,i)}},Un=class extends bt{constructor(e,t,i){super("YAMLWarning",e,t,i)}},Nh=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:i,col:n}=t.linePos[0];t.message+=` at line ${i}, column ${n}`;let r=n-1,o=s.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),i>1&&/^ *$/.test(o.substring(0,r))){let a=s.substring(e.lineStarts[i-2],e.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l&&l.line===i&&l.col>n&&(a=Math.max(1,Math.min(l.col-n,80-r)));let c=" ".repeat(r)+"^".repeat(a);t.message+=`: ${o} ${c} `}};wt.YAMLError=bt;wt.YAMLParseError=jn;wt.YAMLWarning=Un;wt.prettifyError=Nh});var vt=A(Xa=>{"use strict";function Ch(s,{flow:e,indicator:t,next:i,offset:n,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,f=a,u="",h="",y=!1,S=!1,d=null,p=null,m=null,g=null,F=null,b=null,w=null;for(let E of s)switch(S&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&r(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),S=!1),d&&(c&&E.type!=="comment"&&E.type!=="newline"&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),d=null),E.type){case"space":!e&&(t!=="doc-start"||i?.type!=="flow-collection")&&E.source.includes(" ")&&(d=E),f=!0;break;case"comment":{f||r(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let N=E.source.substring(1)||" ";u?u+=h+N:u=N,h="",c=!1;break}case"newline":c?u?u+=E.source:(!b||t!=="seq-item-ind")&&(l=!0):h+=E.source,c=!0,y=!0,(p||m)&&(g=E),f=!0;break;case"anchor":p&&r(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&r(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=E,w===null&&(w=E.offset),c=!1,f=!1,S=!0;break;case"tag":{m&&r(E,"MULTIPLE_TAGS","A node can have at most one tag"),m=E,w===null&&(w=E.offset),c=!1,f=!1,S=!0;break}case t:(p||m)&&r(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),b&&r(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),b=E,c=t==="seq-item-ind"||t==="explicit-key-ind",f=!1;break;case"comma":if(e){F&&r(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),F=E,c=!1,f=!1;break}default:r(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),c=!1,f=!1}let v=s[s.length-1],P=v?v.offset+v.source.length:n;return S&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&r(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d&&(c&&d.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:F,found:b,spaceBefore:l,comment:u,hasNewline:y,anchor:p,tag:m,newlineAfterProp:g,end:P,start:w??P}}Xa.resolveProps=Ch});var qi=A(za=>{"use strict";function Kn(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(` `))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(Kn(e.key)||Kn(e.value))return!0}return!1;default:return!0}}za.containsNewline=Kn});var Vn=A(Za=>{"use strict";var Oh=qi();function Ih(s,e,t){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===s&&(i.source==="]"||i.source==="}")&&Oh.containsNewline(e)&&t(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Za.flowIndentCheck=Ih});var Wn=A(tl=>{"use strict";var el=L();function kh(s,e,t){let{uniqueKeys:i}=s.options;if(i===!1)return!1;let n=typeof i=="function"?i:(r,o)=>r===o||el.isScalar(r)&&el.isScalar(o)&&r.value===o.value;return e.some(r=>n(r.key,t))}tl.mapIncludes=kh});var al=A(ol=>{"use strict";var il=le(),xh=ue(),sl=vt(),qh=qi(),nl=Vn(),Mh=Wn(),rl="All mapping items must start at the same column";function Rh({composeNode:s,composeEmptyNode:e},t,i,n,r){let o=r?.nodeClass??xh.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=i.offset,c=null;for(let f of i.items){let{start:u,key:h,sep:y,value:S}=f,d=sl.resolveProps(u,{indicator:"explicit-key-ind",next:h??y?.[0],offset:l,onError:n,parentIndent:i.indent,startOnNewline:!0}),p=!d.found;if(p){if(h&&(h.type==="block-seq"?n(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==i.indent&&n(l,"BAD_INDENT",rl)),!d.anchor&&!d.tag&&!y){c=d.end,d.comment&&(a.comment?a.comment+=` `+d.comment:a.comment=d.comment);continue}(d.newlineAfterProp||qh.containsNewline(h))&&n(h??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else d.found?.indent!==i.indent&&n(l,"BAD_INDENT",rl);t.atKey=!0;let m=d.end,g=h?s(t,h,d,n):e(t,m,u,null,d,n);t.schema.compat&&nl.flowIndentCheck(i.indent,h,n),t.atKey=!1,Mh.mapIncludes(t,a.items,g)&&n(m,"DUPLICATE_KEY","Map keys must be unique");let F=sl.resolveProps(y??[],{indicator:"map-value-ind",next:S,offset:g.range[2],onError:n,parentIndent:i.indent,startOnNewline:!h||h.type==="block-scalar"});if(l=F.end,F.found){p&&(S?.type==="block-map"&&!F.hasNewline&&n(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&d.start<F.found.offset-1024&&n(g.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let b=S?s(t,S,F,n):e(t,l,y,null,F,n);t.schema.compat&&nl.flowIndentCheck(i.indent,S,n),l=b.range[2];let w=new il.Pair(g,b);t.options.keepSourceTokens&&(w.srcToken=f),a.items.push(w)}else{p&&n(g.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),F.comment&&(g.comment?g.comment+=` `+F.comment:g.comment=F.comment);let b=new il.Pair(g);t.options.keepSourceTokens&&(b.srcToken=f),a.items.push(b)}}return c&&c<l&&n(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,l,c??l],a}ol.resolveBlockMap=Rh});var cl=A(ll=>{"use strict";var Bh=fe(),$h=vt(),jh=Vn();function Uh({composeNode:s,composeEmptyNode:e},t,i,n,r){let o=r?.nodeClass??Bh.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=i.offset,c=null;for(let{start:f,value:u}of i.items){let h=$h.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:l,onError:n,parentIndent:i.indent,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||u)u&&u.type==="block-seq"?n(h.end,"BAD_INDENT","All sequence items must start at the same column"):n(l,"MISSING_CHAR","Sequence item without - indicator");else{c=h.end,h.comment&&(a.comment=h.comment);continue}let y=u?s(t,u,h,n):e(t,h.end,f,null,h,n);t.schema.compat&&jh.flowIndentCheck(i.indent,u,n),l=y.range[2],a.items.push(y)}return a.range=[i.offset,l,c??l],a}ll.resolveBlockSeq=Uh});var Be=A(ul=>{"use strict";function Kh(s,e,t,i){let n="";if(s){let r=!1,o="";for(let a of s){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=l.substring(1)||" ";n?n+=o+f:n=f,o="";break}case"newline":n&&(o+=l),r=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:n,offset:e}}ul.resolveEnd=Kh});var dl=A(pl=>{"use strict";var Vh=L(),Wh=le(),fl=ue(),Hh=fe(),Gh=Be(),hl=vt(),Yh=qi(),Jh=Wn(),Hn="Block collections are not allowed within flow collections",Gn=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Qh({composeNode:s,composeEmptyNode:e},t,i,n,r){let o=i.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?fl.YAMLMap:Hh.YAMLSeq),c=new l(t.schema);c.flow=!0;let f=t.atRoot;f&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let u=i.offset+i.start.source.length;for(let p=0;p<i.items.length;++p){let m=i.items[p],{start:g,key:F,sep:b,value:w}=m,v=hl.resolveProps(g,{flow:a,indicator:"explicit-key-ind",next:F??b?.[0],offset:u,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!b&&!w){p===0&&v.comma?n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):p<i.items.length-1&&n(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),v.comment&&(c.comment?c.comment+=` `+v.comment:c.comment=v.comment),u=v.end;continue}!o&&t.options.strict&&Yh.containsNewline(F)&&n(F,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)v.comma&&n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(v.comma||n(v.start,"MISSING_CHAR",`Missing , between ${a} items`),v.comment){let P="";e:for(let E of g)switch(E.type){case"comma":case"space":break;case"comment":P=E.source.substring(1);break e;default:break e}if(P){let E=c.items[c.items.length-1];Vh.isPair(E)&&(E=E.value??E.key),E.comment?E.comment+=` `+P:E.comment=P,v.comment=v.comment.substring(P.length+1)}}if(!o&&!b&&!v.found){let P=w?s(t,w,v,n):e(t,v.end,b,null,v,n);c.items.push(P),u=P.range[2],Gn(w)&&n(P.range,"BLOCK_IN_FLOW",Hn)}else{t.atKey=!0;let P=v.end,E=F?s(t,F,v,n):e(t,P,g,null,v,n);Gn(F)&&n(E.range,"BLOCK_IN_FLOW",Hn),t.atKey=!1;let N=hl.resolveProps(b??[],{flow:a,indicator:"map-value-ind",next:w,offset:E.range[2],onError:n,parentIndent:i.indent,startOnNewline:!1});if(N.found){if(!o&&!v.found&&t.options.strict){if(b)for(let O of b){if(O===N.found)break;if(O.type==="newline"){n(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<N.found.offset-1024&&n(N.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else w&&("source"in w&&w.source&&w.source[0]===":"?n(w,"MISSING_CHAR",`Missing space after : in ${a}`):n(N.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let M=w?s(t,w,N,n):N.found?e(t,N.end,b,null,N,n):null;M?Gn(w)&&n(M.range,"BLOCK_IN_FLOW",Hn):N.comment&&(E.comment?E.comment+=` `+N.comment:E.comment=N.comment);let te=new Wh.Pair(E,M);if(t.options.keepSourceTokens&&(te.srcToken=m),o){let O=c;Jh.mapIncludes(t,O.items,E)&&n(P,"DUPLICATE_KEY","Map keys must be unique"),O.items.push(te)}else{let O=new fl.YAMLMap(t.schema);O.flow=!0,O.items.push(te);let qt=(M??E).range;O.range=[E.range[0],qt[1],qt[2]],c.items.push(O)}u=M?M.range[2]:N.end}}let h=o?"}":"]",[y,...S]=i.end,d=u;if(y&&y.source===h)d=y.offset+y.source.length;else{let p=a[0].toUpperCase()+a.substring(1),m=f?`${p} must end with a ${h}`:`${p} in block collection must be sufficiently indented and end with a ${h}`;n(u,f?"MISSING_CHAR":"BAD_INDENT",m),y&&y.source.length!==1&&S.unshift(y)}if(S.length>0){let p=Gh.resolveEnd(S,d,t.options.strict,n);p.comment&&(c.comment?c.comment+=` `+p.comment:c.comment=p.comment),c.range=[i.offset,d,p.offset]}else c.range=[i.offset,d,d];return c}pl.resolveFlowCollection=Qh});var ml=A(gl=>{"use strict";var Xh=L(),zh=I(),Zh=ue(),ep=fe(),tp=al(),ip=cl(),sp=dl();function Yn(s,e,t,i,n,r){let o=t.type==="block-map"?tp.resolveBlockMap(s,e,t,i,r):t.type==="block-seq"?ip.resolveBlockSeq(s,e,t,i,r):sp.resolveFlowCollection(s,e,t,i,r),a=o.constructor;return n==="!"||n===a.tagName?(o.tag=a.tagName,o):(n&&(o.tag=n),o)}function np(s,e,t,i,n){let r=i.tag,o=r?e.directives.tagName(r.source,h=>n(r,"TAG_RESOLVE_FAILED",h)):null;if(t.type==="block-seq"){let{anchor:h,newlineAfterProp:y}=i,S=h&&r?h.offset>r.offset?h:r:h??r;S&&(!y||y.offset<S.offset)&&n(S,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===Zh.YAMLMap.tagName&&a==="map"||o===ep.YAMLSeq.tagName&&a==="seq")return Yn(s,e,t,n,o);let l=e.schema.tags.find(h=>h.tag===o&&h.collection===a);if(!l){let h=e.schema.knownTags[o];if(h&&h.collection===a)e.schema.tags.push(Object.assign({},h,{default:!1})),l=h;else return h?.collection?n(r,"BAD_COLLECTION_TYPE",`${h.tag} used for ${a} collection, but expects ${h.collection}`,!0):n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Yn(s,e,t,n,o)}let c=Yn(s,e,t,n,o,l),f=l.resolve?.(c,h=>n(r,"TAG_RESOLVE_FAILED",h),e.options)??c,u=Xh.isNode(f)?f:new zh.Scalar(f);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}gl.composeCollection=np});var Qn=A(yl=>{"use strict";var Jn=I();function rp(s,e,t){let i=e.offset,n=op(e,s.options.strict,t);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let r=n.mode===">"?Jn.Scalar.BLOCK_FOLDED:Jn.Scalar.BLOCK_LITERAL,o=e.source?ap(e.source):[],a=o.length;for(let d=o.length-1;d>=0;--d){let p=o[d][1];if(p===""||p==="\r")a=d;else break}if(a===0){let d=n.chomp==="+"&&o.length>0?` `.repeat(Math.max(1,o.length-1)):"",p=i+n.length;return e.source&&(p+=e.source.length),{value:d,type:r,comment:n.comment,range:[i,p,p]}}let l=e.indent+n.indent,c=e.offset+n.length,f=0;for(let d=0;d<a;++d){let[p,m]=o[d];if(m===""||m==="\r")n.indent===0&&p.length>l&&(l=p.length);else{p.length<l&&t(c+p.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(l=p.length),f=d,l===0&&!s.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=p.length+m.length+1}for(let d=o.length-1;d>=a;--d)o[d][0].length>l&&(a=d+1);let u="",h="",y=!1;for(let d=0;d<f;++d)u+=o[d][0].slice(l)+` `;for(let d=f;d<a;++d){let[p,m]=o[d];c+=p.length+m.length+1;let g=m[m.length-1]==="\r";if(g&&(m=m.slice(0,-1)),m&&p.length<l){let b=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;t(c-m.length-(g?2:1),"BAD_INDENT",b),p=""}r===Jn.Scalar.BLOCK_LITERAL?(u+=h+p.slice(l)+m,h=` `):p.length>l||m[0]===" "?(h===" "?h=` `:!y&&h===` `&&(h=` `),u+=h+p.slice(l)+m,h=` `,y=!0):m===""?h===` `?u+=` `:h=` `:(u+=h+m,h=" ",y=!1)}switch(n.chomp){case"-":break;case"+":for(let d=a;d<o.length;++d)u+=` `+o[d][0].slice(l);u[u.length-1]!==` `&&(u+=` `);break;default:u+=` `}let S=i+n.length+e.source.length;return{value:u,type:r,comment:n.comment,range:[i,S,S]}}function op({offset:s,props:e},t,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=e[0],r=n[0],o=0,a="",l=-1;for(let h=1;h<n.length;++h){let y=n[h];if(!a&&(y==="-"||y==="+"))a=y;else{let S=Number(y);!o&&S?o=S:l===-1&&(l=s+h)}}l!==-1&&i(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let c=!1,f="",u=n.length;for(let h=1;h<e.length;++h){let y=e[h];switch(y.type){case"space":c=!0;case"newline":u+=y.source.length;break;case"comment":t&&!c&&i(y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=y.source.length,f=y.source.substring(1);break;case"error":i(y,"UNEXPECTED_TOKEN",y.message),u+=y.source.length;break;default:{let S=`Unexpected token in block scalar header: ${y.type}`;i(y,"UNEXPECTED_TOKEN",S);let d=y.source;d&&typeof d=="string"&&(u+=d.length)}}}return{mode:r,indent:o,chomp:a,comment:f,length:u}}function ap(s){let e=s.split(/\n( *)/),t=e[0],i=t.match(/^( *)/),r=[i?.[1]?[i[1],t.slice(i[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}yl.resolveBlockScalar=rp});var zn=A(wl=>{"use strict";var Xn=I(),lp=Be();function cp(s,e,t){let{offset:i,type:n,source:r,end:o}=s,a,l,c=(h,y,S)=>t(i+h,y,S);switch(n){case"scalar":a=Xn.Scalar.PLAIN,l=up(r,c);break;case"single-quoted-scalar":a=Xn.Scalar.QUOTE_SINGLE,l=fp(r,c);break;case"double-quoted-scalar":a=Xn.Scalar.QUOTE_DOUBLE,l=hp(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[i,i+r.length,i+r.length]}}let f=i+r.length,u=lp.resolveEnd(o,f,e,t);return{value:l,type:a,comment:u.comment,range:[i,f,u.offset]}}function up(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),bl(s)}function fp(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),bl(s.slice(1,-1)).replace(/''/g,"'")}function bl(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r? `,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r? `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=e.exec(s);if(!i)return s;let n=i[1],r=" ",o=e.lastIndex;for(t.lastIndex=o;i=t.exec(s);)i[1]===""?r===` `?n+=r:r=` `:(n+=r+i[1],r=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,i=a.exec(s),n+r+(i?.[1]??"")}function hp(s,e){let t="";for(let i=1;i<s.length-1;++i){let n=s[i];if(!(n==="\r"&&s[i+1]===` `))if(n===` `){let{fold:r,offset:o}=pp(s,i);t+=r,i=o}else if(n==="\\"){let r=s[++i],o=dp[r];if(o)t+=o;else if(r===` `)for(r=s[i+1];r===" "||r===" ";)r=s[++i+1];else if(r==="\r"&&s[i+1]===` `)for(r=s[++i+1];r===" "||r===" ";)r=s[++i+1];else if(r==="x"||r==="u"||r==="U"){let a={x:2,u:4,U:8}[r];t+=gp(s,i+1,a,e),i+=a}else{let a=s.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(n===" "||n===" "){let r=i,o=s[i+1];for(;o===" "||o===" ";)o=s[++i+1];o!==` `&&!(o==="\r"&&s[i+2]===` `)&&(t+=i>r?s.slice(r,i+1):n)}else t+=n}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function pp(s,e){let t="",i=s[e+1];for(;(i===" "||i===" "||i===` `||i==="\r")&&!(i==="\r"&&s[e+2]!==` `);)i===` `&&(t+=` `),e+=1,i=s[e+1];return t||(t=" "),{fold:t,offset:e}}var dp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function gp(s,e,t,i){let n=s.substr(e,t),o=n.length===t&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;if(isNaN(o)){let a=s.substr(e-2,t+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}wl.resolveFlowScalar=cp});var Fl=A(vl=>{"use strict";var Fe=L(),Sl=I(),mp=Qn(),yp=zn();function bp(s,e,t,i){let{value:n,type:r,comment:o,range:a}=e.type==="block-scalar"?mp.resolveBlockScalar(s,e,i):yp.resolveFlowScalar(e,s.options.strict,i),l=t?s.directives.tagName(t.source,u=>i(t,"TAG_RESOLVE_FAILED",u)):null,c;s.options.stringKeys&&s.atKey?c=s.schema[Fe.SCALAR]:l?c=wp(s.schema,n,l,t,i):e.type==="scalar"?c=Sp(s,n,e,i):c=s.schema[Fe.SCALAR];let f;try{let u=c.resolve(n,h=>i(t??e,"TAG_RESOLVE_FAILED",h),s.options);f=Fe.isScalar(u)?u:new Sl.Scalar(u)}catch(u){let h=u instanceof Error?u.message:String(u);i(t??e,"TAG_RESOLVE_FAILED",h),f=new Sl.Scalar(n)}return f.range=a,f.source=n,r&&(f.type=r),l&&(f.tag=l),c.format&&(f.format=c.format),o&&(f.comment=o),f}function wp(s,e,t,i,n){if(t==="!")return s[Fe.SCALAR];let r=[];for(let a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(e))return a;let o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[Fe.SCALAR])}function Sp({atKey:s,directives:e,schema:t},i,n,r){let o=t.tags.find(a=>(a.default===!0||s&&a.default==="key")&&a.test?.test(i))||t[Fe.SCALAR];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(i))??t[Fe.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),f=`Value may be parsed as either ${l} or ${c}`;r(n,"TAG_RESOLVE_FAILED",f,!0)}}return o}vl.composeScalar=bp});var Al=A(El=>{"use strict";function vp(s,e,t){if(e){t===null&&(t=e.length);for(let i=t-1;i>=0;--i){let n=e[i];switch(n.type){case"space":case"comment":case"newline":s-=n.source.length;continue}for(n=e[++i];n?.type==="space";)s+=n.source.length,n=e[++i];break}}return s}El.emptyScalarPosition=vp});var Tl=A(er=>{"use strict";var Fp=et(),Ep=L(),Ap=ml(),Pl=Fl(),Pp=Be(),Dp=Al(),Tp={composeNode:Dl,composeEmptyNode:Zn};function Dl(s,e,t,i){let n=s.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=t,c,f=!0;switch(e.type){case"alias":c=Lp(s,e,i),(a||l)&&i(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=Pl.composeScalar(s,e,l,i),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":c=Ap.composeCollection(Tp,s,e,t,i),a&&(c.anchor=a.source.substring(1));break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",u),c=Zn(s,e.offset,void 0,null,t,i),f=!1}}return a&&c.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),n&&s.options.stringKeys&&(!Ep.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&i(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),s.options.keepSourceTokens&&f&&(c.srcToken=e),c}function Zn(s,e,t,i,{spaceBefore:n,comment:r,anchor:o,tag:a,end:l},c){let f={type:"scalar",offset:Dp.emptyScalarPosition(e,t,i),indent:-1,source:""},u=Pl.composeScalar(s,f,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(u.spaceBefore=!0),r&&(u.comment=r,u.range[2]=l),u}function Lp({options:s},{offset:e,source:t,end:i},n){let r=new Fp.Alias(t.substring(1));r.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&n(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=Pp.resolveEnd(i,o,s.strict,n);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}er.composeEmptyNode=Zn;er.composeNode=Dl});var Nl=A(_l=>{"use strict";var _p=yt(),Ll=Tl(),Np=Be(),Cp=vt();function Op(s,e,{offset:t,start:i,value:n,end:r},o){let a=Object.assign({_directives:e},s),l=new _p.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=Cp.resolveProps(i,{indicator:"doc-start",next:n??r?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(l.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=n?Ll.composeNode(c,n,f,o):Ll.composeEmptyNode(c,f.end,i,null,f,o);let u=l.contents.range[2],h=Np.resolveEnd(r,u,!1,o);return h.comment&&(l.comment=h.comment),l.range=[t,u,h.offset],l}_l.composeDoc=Op});var ir=A(Il=>{"use strict";var Ip=require("node:process"),kp=$s(),xp=yt(),Ft=St(),Cl=L(),qp=Nl(),Mp=Be();function Et(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Ol(s){let e="",t=!1,i=!1;for(let n=0;n<s.length;++n){let r=s[n];switch(r[0]){case"#":e+=(e===""?"":i?` `:` `)+(r.substring(1)||" "),t=!0,i=!1;break;case"%":s[n+1]?.[0]!=="#"&&(n+=1),t=!1;break;default:t||(i=!0),t=!1}}return{comment:e,afterEmptyLine:i}}var tr=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,i,n,r)=>{let o=Et(t);r?this.warnings.push(new Ft.YAMLWarning(o,i,n)):this.errors.push(new Ft.YAMLParseError(o,i,n))},this.directives=new kp.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:i,afterEmptyLine:n}=Ol(this.prelude);if(i){let r=e.contents;if(t)e.comment=e.comment?`${e.comment} ${i}`:i;else if(n||e.directives.docStart||!r)e.commentBefore=i;else if(Cl.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];Cl.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i} ${a}`:i}else{let o=r.commentBefore;r.commentBefore=o?`${i} ${o}`:i}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Ol(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,i=-1){for(let n of e)yield*this.next(n);yield*this.end(t,i)}*next(e){switch(Ip.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,i,n)=>{let r=Et(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",i,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=qp.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new Ft.YAMLParseError(Et(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new Ft.YAMLParseError(Et(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let t=Mp.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let i=this.doc.comment;this.doc.comment=i?`${i} ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Ft.YAMLParseError(Et(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let i=Object.assign({_directives:this.directives},this.options),n=new xp.Document(void 0,i);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,t,t],this.decorate(n,!1),yield n}}};Il.Composer=tr});var ql=A(Mi=>{"use strict";var Rp=Qn(),Bp=zn(),$p=St(),kl=rt();function jp(s,e=!0,t){if(s){let i=(n,r,o)=>{let a=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(t)t(a,r,o);else throw new $p.YAMLParseError([a,a+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Bp.resolveFlowScalar(s,e,i);case"block-scalar":return Rp.resolveBlockScalar({options:{strict:e}},s,i)}}return null}function Up(s,e){let{implicitKey:t=!1,indent:i,inFlow:n=!1,offset:r=-1,type:o="PLAIN"}=e,a=kl.stringifyString({type:o,value:s},{implicitKey:t,indent:i>0?" ".repeat(i):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:i,source:` `}];switch(a[0]){case"|":case">":{let c=a.indexOf(` `),f=a.substring(0,c),u=a.substring(c+1)+` `,h=[{type:"block-scalar-header",offset:r,indent:i,source:f}];return xl(h,l)||h.push({type:"newline",offset:-1,indent:i,source:` `}),{type:"block-scalar",offset:r,indent:i,props:h,source:u}}case'"':return{type:"double-quoted-scalar",offset:r,indent:i,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:i,source:a,end:l};default:return{type:"scalar",offset:r,indent:i,source:a,end:l}}}function Kp(s,e,t={}){let{afterKey:i=!1,implicitKey:n=!1,inFlow:r=!1,type:o}=t,a="indent"in s?s.indent:null;if(i&&typeof a=="number"&&(a+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=kl.stringifyString({type:o,value:e},{implicitKey:n||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":Vp(s,l);break;case'"':sr(s,l,"double-quoted-scalar");break;case"'":sr(s,l,"single-quoted-scalar");break;default:sr(s,l,"scalar")}}function Vp(s,e){let t=e.indexOf(` `),i=e.substring(0,t),n=e.substring(t+1)+` `;if(s.type==="block-scalar"){let r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=i,s.source=n}else{let{offset:r}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:i}];xl(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:` `});for(let l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:n})}}function xl(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function sr(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let i=s.props.slice(1),n=e.length;s.props[0].type==="block-scalar-header"&&(n-=s.props[0].source.length);for(let r of i)r.offset+=n;delete s.props,Object.assign(s,{type:t,source:e,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:s.offset+e.length,indent:s.indent,source:` `};delete s.items,Object.assign(s,{type:t,source:e,end:[n]});break}default:{let i="indent"in s?s.indent:-1,n="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:i,source:e,end:n})}}}Mi.createScalarToken=Up;Mi.resolveAsScalar=jp;Mi.setScalarValue=Kp});var Rl=A(Ml=>{"use strict";var Wp=s=>"type"in s?Bi(s):Ri(s);function Bi(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=Bi(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=Ri(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=Ri(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=Ri(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function Ri({start:s,key:e,sep:t,value:i}){let n="";for(let r of s)n+=r.source;if(e&&(n+=Bi(e)),t)for(let r of t)n+=r.source;return i&&(n+=Bi(i)),n}Ml.stringify=Wp});var Ul=A(jl=>{"use strict";var nr=Symbol("break visit"),Hp=Symbol("skip children"),Bl=Symbol("remove item");function Ee(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),$l(Object.freeze([]),s,e)}Ee.BREAK=nr;Ee.SKIP=Hp;Ee.REMOVE=Bl;Ee.itemAtPath=(s,e)=>{let t=s;for(let[i,n]of e){let r=t?.[i];if(r&&"items"in r)t=r.items[n];else return}return t};Ee.parentCollection=(s,e)=>{let t=Ee.itemAtPath(s,e.slice(0,-1)),i=e[e.length-1][0],n=t?.[i];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function $l(s,e,t){let i=t(e,s);if(typeof i=="symbol")return i;for(let n of["key","value"]){let r=e[n];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=$l(Object.freeze(s.concat([[n,o]])),r.items[o],t);if(typeof a=="number")o=a-1;else{if(a===nr)return nr;a===Bl&&(r.items.splice(o,1),o-=1)}}typeof i=="function"&&n==="key"&&(i=i(e,s))}}return typeof i=="function"?i(e,s):i}jl.visit=Ee});var $i=A(B=>{"use strict";var rr=ql(),Gp=Rl(),Yp=Ul(),or="\uFEFF",ar="",lr="",cr="",Jp=s=>!!s&&"items"in s,Qp=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function Xp(s){switch(s){case or:return"<BOM>";case ar:return"<DOC>";case lr:return"<FLOW_END>";case cr:return"<SCALAR>";default:return JSON.stringify(s)}}function zp(s){switch(s){case or:return"byte-order-mark";case ar:return"doc-mode";case lr:return"flow-error-end";case cr:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}B.createScalarToken=rr.createScalarToken;B.resolveAsScalar=rr.resolveAsScalar;B.setScalarValue=rr.setScalarValue;B.stringify=Gp.stringify;B.visit=Yp.visit;B.BOM=or;B.DOCUMENT=ar;B.FLOW_END=lr;B.SCALAR=cr;B.isCollection=Jp;B.isScalar=Qp;B.prettyToken=Xp;B.tokenType=zp});var hr=A(Vl=>{"use strict";var At=$i();function G(s){switch(s){case void 0:case" ":case` `:case"\r":case" ":return!0;default:return!1}}var Kl=new Set("0123456789ABCDEFabcdef"),Zp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),ji=new Set(",[]{}"),ed=new Set(` ,[]{} \r `),ur=s=>!s||ed.has(s),fr=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let i=this.next??"stream";for(;i&&(t||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===` `?!0:t==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let i=0;for(;t===" ";)t=this.buffer[++i+e];if(t==="\r"){let n=this.buffer[i+e+1];if(n===` `||!n&&!this.atEnd)return e+i+1}return t===` `||i>=this.indentNext||!t&&!this.atEnd?e+i:-1}if(t==="-"||t==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&G(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(` `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===At.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,i=e.indexOf("#");for(;i!==-1;){let r=e[i-1];if(r===" "||r===" "){t=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let r=e[t-1];if(r===" "||r===" ")t-=1;else break}let n=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield At.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&G(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!G(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&G(t)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(ur),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,i=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=i=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&n[0]!=="#"||i===0&&(n.startsWith("---")||n.startsWith("..."))&&G(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield At.FLOW_END,yield*this.parseLineStart();let r=0;for(;n[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),n[r]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-r),"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(ur),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||G(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}let i=this.buffer.substring(0,t),n=i.indexOf(` `,this.pos);if(n!==-1){for(;n!==-1;){let r=this.continueScalar(n+1);if(r===-1)break;n=i.indexOf(` `,r)}n!==-1&&(t=n-(i[n-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>G(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,i;e:for(let r=this.pos;i=this.buffer[r];++r)switch(i){case" ":t+=1;break;case` `:e=r,t=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===` `)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(` `,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;for(i=this.buffer[n];i===" ";)i=this.buffer[++n];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===` `;)i=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===` `&&r>=this.pos&&r+1+t>a)e=r;else break}while(!0);return yield At.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,i=this.pos-1,n;for(;n=this.buffer[++i];)if(n===":"){let r=this.buffer[i+1];if(G(r)||e&&ji.has(r))break;t=i}else if(G(n)){let r=this.buffer[i+1];if(n==="\r"&&(r===` `?(i+=1,n=` `,r=this.buffer[i+1]):t=i),r==="#"||e&&ji.has(r))break;if(n===` `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&ji.has(n))break;t=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield At.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(ur))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(G(t)||e&&ji.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!G(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Zp.has(t))t=this.buffer[++e];else if(t==="%"&&Kl.has(this.buffer[e+1])&&Kl.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,i;do i=this.buffer[++t];while(i===" "||e&&i===" ");let n=t-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=t),n}*pushUntil(e){let t=this.pos,i=this.buffer[t];for(;!e(i);)i=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};Vl.Lexer=fr});var dr=A(Wl=>{"use strict";var pr=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,i=this.lineStarts.length;for(;t<i;){let r=t+i>>1;this.lineStarts[r]<e?t=r+1:i=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let n=this.lineStarts[t-1];return{line:t,col:e-n+1}}}};Wl.LineCounter=pr});var mr=A(Ql=>{"use strict";var td=require("node:process"),Hl=$i(),id=hr();function Ae(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Gl(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Jl(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ui(s){switch(s.type){case"document":return s.start;case"block-map":{let e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function $e(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function Yl(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!Ae(e.start,"explicit-key-ind")&&!Ae(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Jl(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var gr=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new id.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,t))yield*this.next(i);t||(yield*this.end())}*next(e){if(this.source=e,td.env.LOG_TOKENS&&console.log("|",Hl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Hl.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let i=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in i?i.indent:0:t.type==="flow-collection"&&i.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Yl(t),i.type){case"document":i.value=t;break;case"block-scalar":i.props.push(t);break;case"block-map":{let n=i.items[i.items.length-1];if(n.value){i.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=i.items[i.items.length-1];n.value?i.items.push({start:[],value:t}):n.value=t;break}case"flow-collection":{let n=i.items[i.items.length-1];!n||n.value?i.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Gl(n.start)===-1&&(t.indent===0||n.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(i.type==="document"?i.end=n.start:i.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Gl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=Ui(this.peek(2)),i=$e(t),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(` `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(` `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let i="end"in t.value?t.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,n=i&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",r=[];if(n&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):n||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ae(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(Jl(t.key)&&!Ae(t.sep,"newline")){let o=$e(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(Ae(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=$e(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||n?e.items.push({start:r,key:null,sep:[this.sourceToken]}):Ae(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){i&&o.type!=="block-seq"&&e.items.push({start:r}),this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let i="end"in t.value?t.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||Ae(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i&&i.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=Ui(i),r=$e(n);Yl(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(` `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(` `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Ui(e),i=$e(t);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Ui(e),i=$e(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Ql.Parser=gr});var tc=A(Dt=>{"use strict";var Xl=ir(),sd=yt(),Pt=St(),nd=Zs(),rd=L(),od=dr(),zl=mr();function Zl(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new od.LineCounter||null,prettyErrors:e}}function ad(s,e={}){let{lineCounter:t,prettyErrors:i}=Zl(e),n=new zl.Parser(t?.addNewLine),r=new Xl.Composer(e),o=Array.from(r.compose(n.parse(s)));if(i&&t)for(let a of o)a.errors.forEach(Pt.prettifyError(s,t)),a.warnings.forEach(Pt.prettifyError(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function ec(s,e={}){let{lineCounter:t,prettyErrors:i}=Zl(e),n=new zl.Parser(t?.addNewLine),r=new Xl.Composer(e),o=null;for(let a of r.compose(n.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Pt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&t&&(o.errors.forEach(Pt.prettifyError(s,t)),o.warnings.forEach(Pt.prettifyError(s,t))),o}function ld(s,e,t){let i;typeof e=="function"?i=e:t===void 0&&e&&typeof e=="object"&&(t=e);let n=ec(s,t);if(!n)return null;if(n.warnings.forEach(r=>nd.warn(n.options.logLevel,r)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:i},t))}function cd(s,e,t){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let n=Math.round(t);t=n<1?void 0:n>8?{indent:8}:{indent:n}}if(s===void 0){let{keepUndefined:n}=t??e??{};if(!n)return}return rd.isDocument(s)&&!i?s.toString(t):new sd.Document(s,i,t).toString(t)}Dt.parse=ld;Dt.parseAllDocuments=ad;Dt.parseDocument=ec;Dt.stringify=cd});var sc=A(_=>{"use strict";var ud=ir(),fd=yt(),hd=qn(),yr=St(),pd=et(),he=L(),dd=le(),gd=I(),md=ue(),yd=fe(),bd=$i(),wd=hr(),Sd=dr(),vd=mr(),Ki=tc(),ic=Qe();_.Composer=ud.Composer;_.Document=fd.Document;_.Schema=hd.Schema;_.YAMLError=yr.YAMLError;_.YAMLParseError=yr.YAMLParseError;_.YAMLWarning=yr.YAMLWarning;_.Alias=pd.Alias;_.isAlias=he.isAlias;_.isCollection=he.isCollection;_.isDocument=he.isDocument;_.isMap=he.isMap;_.isNode=he.isNode;_.isPair=he.isPair;_.isScalar=he.isScalar;_.isSeq=he.isSeq;_.Pair=dd.Pair;_.Scalar=gd.Scalar;_.YAMLMap=md.YAMLMap;_.YAMLSeq=yd.YAMLSeq;_.CST=bd;_.Lexer=wd.Lexer;_.LineCounter=Sd.LineCounter;_.Parser=vd.Parser;_.parse=Ki.parse;_.parseAllDocuments=Ki.parseAllDocuments;_.parseDocument=Ki.parseDocument;_.stringify=Ki.stringify;_.visit=ic.visit;_.visitAsync=ic.visitAsync});var Cc=require("commander");var _r=pe(require("node:crypto")),D=pe(require("node:fs")),de=pe(require("node:os")),T=pe(require("node:path")),os=pe(require("node:url"));global.nodeCrypto=_r.default;var Mt=null;try{let s=T.default.join(__dirname,"btime",process.platform+"-"+process.arch);Mt=require(T.default.join(s,"btime.node")).btime}catch{}function Nr(){return Mt!==null}function Cr(s,e){if(!Mt)return;let t=Buffer.alloc(Buffer.byteLength(s,"utf-8")+1);t.write(s,0,t.length-1,"utf-8"),t[t.length-1]=0,Mt(t,e)}var as=["image","audio","video","pdf","unsupported"],Le=["image","audio","pdf","video"],ls=["app","appearance","appearance-data","hotkey","core-plugin","core-plugin-data","community-plugin","community-plugin-data"],cs=["app","appearance","appearance-data","hotkey","core-plugin","core-plugin-data"];var Or="obsidian-headless",ge=de.default.platform()==="linux"?T.default.join(process.env.XDG_CONFIG_HOME||T.default.join(de.default.homedir(),".config"),Or):T.default.join(de.default.homedir(),"."+Or),Ir="OBSIDIAN_AUTH_TOKEN",us=T.default.join(ge,"auth_token");function Ke(){if(process.env[Ir])return process.env[Ir];try{return D.default.readFileSync(us,"utf8")}catch{return null}}function kr(s){D.default.existsSync(ge)||D.default.mkdirSync(ge,{recursive:!0,mode:448}),D.default.writeFileSync(us,s,{mode:384})}function fs(){D.default.rmSync(us,{force:!0})}function Ve(s){return T.default.join(ge,"sync",s)}function hs(s){return T.default.join(Ve(s),"state.db")}function xr(s){return T.default.join(Ve(s),"sync.log")}function qr(s){return T.default.join(Ve(s),"config.json")}function ps(s){let e=Ve(s);return D.default.existsSync(e)||D.default.mkdirSync(e,{recursive:!0,mode:448}),e}function ds(s){let e=qr(s);if(!D.default.existsSync(e))return null;try{let t=D.default.readFileSync(e,"utf-8");return JSON.parse(t)}catch{return null}}function gs(s,e){ps(s);let t=qr(s);D.default.writeFileSync(t,JSON.stringify(e,null,2),{mode:384})}function Mr(s,e){return T.default.join(s,e,".sync.lock")}function Rr(s){let e=Ve(s);D.default.existsSync(e)&&D.default.rmSync(e,{recursive:!0,force:!0})}function ms(){let s=T.default.join(ge,"sync");if(!D.default.existsSync(s))return[];let e=D.default.readdirSync(s,{withFileTypes:!0}),t=[];for(let i of e)if(i.isDirectory()){let n=T.default.join(s,i.name,"config.json");D.default.existsSync(n)&&t.push(i.name)}return t}function We(s){let e=T.default.resolve(s),t=ms();for(let i of t){let n=ds(i);if(n&&T.default.resolve(n.vaultPath)===e)return n}return null}function Br(s){let e=s.split(",").map(t=>t.trim().toLowerCase());for(let t of e)if(!as.includes(t))throw new Error(`Invalid file type: "${t}". Valid values: ${as.join(", ")}`);return e}function $r(s){let e=s.split(",").map(t=>t.trim().toLowerCase());for(let t of e)if(!ls.includes(t))throw new Error(`Invalid config: "${t}". Valid values: ${ls.join(", ")}`);return e}function ys(s){if(s){if(!s.startsWith(".")||s.includes("/")||s.includes("\\"))throw new Error(`Invalid config directory: "${s}". Must be a dotfolder name (e.g. .obsidian).`);return s}}function Rt(s){return T.default.join(ge,"publish",s)}function jr(s){return T.default.join(Rt(s),"config.json")}function bs(s){return T.default.join(Rt(s),"cache.json")}function ws(s){let e=Rt(s);return D.default.existsSync(e)||D.default.mkdirSync(e,{recursive:!0,mode:448}),e}function Uc(s){let e=jr(s);if(!D.default.existsSync(e))return null;try{let t=D.default.readFileSync(e,"utf-8");return JSON.parse(t)}catch{return null}}function Ss(s,e){ws(s);let t=jr(s);D.default.writeFileSync(t,JSON.stringify(e,null,2),{mode:384})}function Ur(s){let e=Rt(s);D.default.existsSync(e)&&D.default.rmSync(e,{recursive:!0,force:!0})}function Kc(){let s=T.default.join(ge,"publish");if(!D.default.existsSync(s))return[];let e=D.default.readdirSync(s,{withFileTypes:!0}),t=[];for(let i of e)if(i.isDirectory()){let n=T.default.join(s,i.name,"config.json");D.default.existsSync(n)&&t.push(i.name)}return t}function He(s){let e=T.default.resolve(s),t=Kc();for(let i of t){let n=Uc(i);if(n&&T.default.resolve(n.vaultPath)===e)return n}return null}function vs(){let s=de.default.hostname(),e=de.default.platform();return`${s} (${e==="darwin"?"macOS":e==="win32"?"Windows":e==="linux"?"Linux":e})`}function Kr(s){let e=T.default.dirname(s);D.default.existsSync(e)||D.default.mkdirSync(e,{recursive:!0});let t=D.default.createWriteStream(s,{flags:"a"}),i=console.log,n=console.warn,r=console.error,o=console.debug;function a(...l){let c=new Date().toISOString(),f=l.map(u=>typeof u=="object"?JSON.stringify(u):String(u)).join(" ");t.write(`[${c}] ${f} `)}return console.log=(...l)=>{i(...l),a(...l)},console.warn=(...l)=>{n(...l),a(...l)},console.error=(...l)=>{r(...l),a(...l)},console.debug=(...l)=>{o(...l),a(...l)},()=>{console.log=i,console.warn=n,console.error=r,console.debug=o,t.end()}}var Bt=fetch,Vr="https://"+["api","obsidian","md"].join("."),Vc="https://publish.obsidian.md",Ge=class s extends Error{constructor(e){super(e.error),this.response=e,this.error=e.error,Object.setPrototypeOf(this,s.prototype)}},Fs="";function Wr(s){Fs=s}async function X(s,e,t){let{preflight:i,headers:n}=t||{};n||(n={}),Fs&&(n["User-Agent"]=Fs),i&&await Bt(Vr+s,{method:"OPTIONS",headers:n}),n["Content-Type"]="application/json";let r=await Bt(Vr+s,{method:"POST",body:JSON.stringify(e),headers:n});if(!r.ok)throw new Error("HTTP Error "+r.status);let o=await r.json();if("error"in o)throw new Ge(o);return o}async function Es(s,e,t){return X("/user/signin",{email:s,password:e,mfa:t},{preflight:!0,headers:{Origin:"https://obsidian.md"}})}function As(s){return X("/user/signout",{token:s})}function Hr(s){return X("/user/info",{token:s})}function Gr(s,e){return X("/vault/regions",{token:s,host:e})}function Ps(s,e){return X("/vault/list",{token:s,supported_encryption_version:e})}function Yr(s,e,t,i,n,r){return X("/vault/create",{token:s,name:e,keyhash:t,salt:i,region:n,encryption_version:r})}function Jr(s,e,t,i,n){return X("/vault/access",{token:s,vault_uid:e,keyhash:t,host:i,encryption_version:n})}function Ds(s){return X("/publish/list",{token:s})}function Qr(s){return X("/publish/create",{token:s})}var $t=class s extends Error{constructor(e,t){super(t),this.name="RequestError",this.code=e,Object.setPrototypeOf(this,s.prototype)}};async function Xr(s,e,t){let i=await(await Bt(s+e,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})).json();if(i.code&&i.message)throw new $t(i.code,i.message);return i}function zr(s){return s.startsWith("127.0.0.1")||s.startsWith("localhost")?"http://"+s:"https://"+s}function Zr(s,e){return Xr(Vc,s,e)}function eo(s,e,t,i){return Zr("/api/slug",{token:s,id:e,host:t,slug:i})}function Ts(s,e){return Zr("/api/slugs",{token:s,ids:e})}function Ls(s,e,t){return Xr(zr(s),e,t)}function to(s,e,t){return Ls(e,"/api/list",{token:s,id:t,version:2})}function _s(s,e,t,i){return Ls(e,"/api/options",{token:s,id:t,options:i})}function io(s,e,t,i){return Ls(e,"/api/remove",{token:s,id:t,path:i})}async function so(s,e,t,i,n,r){let o=zr(e)+"/api/upload",a=await(await Bt(o,{method:"POST",headers:{"obs-token":s,"obs-id":t,"obs-path":encodeURIComponent(i),"obs-hash":n,"Content-Type":"application/octet-stream"},body:r})).json();if(a.code&&a.message)throw new $t(a.code,a.message);return a}var no=["obsidian.css","publish.css","favicon.ico","publish.js"];var Wc=/\u00A0|\u202F/g;function Ns(s){return s.replace(Wc," ")}function V(s){let e=s.lastIndexOf("/");return e===-1?s:s.slice(e+1)}function me(s){let e=s.lastIndexOf("/");return e===-1?"":s.slice(0,e)}function Cs(s){for(;s;){if(V(s).startsWith("."))return!0;s=me(s)}return!1}function ro(s){let e=V(s),t=e.lastIndexOf(".");return t===-1||t===e.length-1||t===0?e:e.substr(0,t)}function oo(s){let e=s.lastIndexOf(".");return e===-1||e===s.length-1||e===0?s:s.substr(0,e)}function $(s){let e=s.lastIndexOf(".");return e===-1||e===s.length-1||e===0?"":s.substr(e+1).toLowerCase()}function _e(s){return Ns(Ne(s)).normalize("NFC")}function Ne(s){return s=s.replace(/([\\/])+/g,"/").replace(/(^\/+|\/+$)/g,""),s===""&&(s="/"),s}var jt=["bmp","png","jpg","jpeg","gif","svg","webp","avif"],Ut=["mp3","wav","m4a","3gp","flac","ogg","oga","opus"],Kt=["mp4","webm","ogv","mov","mkv"],Vt=["pdf"],ao=["md"],Os=["canvas"],lo=["base"];var og=ao.concat(Os,lo),Hc=[].concat(jt,Ut,Kt,Vt,ao,Os);function co(s){return Hc.includes(s)}var ag=[...jt,...Ut,...Kt,...Vt,...lo,...Os];function ie(s){return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}function Is(s){return Buffer.from(s)}var uo=crypto,j=uo?.subtle,ks="AES-GCM";function fo(s){return j.importKey("raw",s,ks,!1,["encrypt","decrypt"])}async function Wt(s,e,t){t||(t=uo.getRandomValues(new Uint8Array(12)));let i=await j.encrypt({name:ks,iv:t},e,s),n=new ArrayBuffer(t.byteLength+i.byteLength),r=new Uint8Array(n);return r.set(new Uint8Array(t),0),r.set(new Uint8Array(i),t.byteLength),n}async function Ht(s,e){if(s.byteLength<12)throw new Error("Encrypted data is bad");if(s.byteLength===12)return new ArrayBuffer(0);let t=new Uint8Array(s,0,12),i=new Uint8Array(s,12);return await j.decrypt({name:ks,iv:t},e,i)}function Ye(s){return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}function U(s){return Ye(new TextEncoder().encode(s))}function ye(s){return new TextDecoder().decode(new Uint8Array(s))}function ho(s){let e=atob(s),t=e.length,i=new Uint8Array(t);for(let n=0;n<t;n++)i[n]=e.charCodeAt(n);return i.buffer}function po(s){return Gc(new Uint8Array(s))}function Gc(s){let e=[],t=s.byteLength;for(let i=0;i<t;i++)e.push(String.fromCharCode(s[i]));return btoa(e.join(""))}function xs(s){let e=s.length/2,t=new ArrayBuffer(e),i=new Uint8Array(t);for(let n=0;n<e;n++)i[n]=parseInt(s.substr(n*2,2),16);return t}function W(s){let e=new Uint8Array(s),t=[];for(let i=0;i<e.length;i++){let n=e[i];t.push((n>>>4).toString(16)),t.push((n&15).toString(16))}return t.join("")}function qs(s){if(s<=0)return"0 B";let e=["B","KB","MB","GB","TB","PB"],t=e.length-1,i=1024;for(let r=0;r<e.length;r++)if(s<Math.pow(i,r+1)){t=r;break}let n=s/Math.pow(i,t);return`${Yc(n,t===0?0:2)} ${e[t]}`}function Yc(s,e=2,t=".",i=","){let n=s<0?"-":"";s=Math.abs(s);let r=parseInt(s.toFixed(e),10)+"",o=r.length>3?r.length%3:0;return n+(o?r.substr(0,o)+i:"")+r.substr(o).replace(/(\d{3})(?=\d)/g,"$1"+i)+(e?t+Math.abs(s-Math.floor(s)).toFixed(e).slice(2):"")}async function se(s){return W(await Je(s))}async function Je(s){return j.digest("SHA-256",new Uint8Array(s))}var nc=pe(sc()),Vi=class{constructor(e,t){this.cache={};this.token=e,this.config=t,this.loadCache()}async scanForChanges(e){let{config:t,token:i,cache:n}=this,r=[],o=await to(i,t.host,t.siteId),a={};for(let c of o.files)a[c.path]=c;let l=this.walkLocalFiles();for(let c of l){let f=n[c.path],u,h;if(f&&f.mtime===c.mtime&&f.size===c.size)u=f.publish,h=f.hash;else{let S=T.default.join(t.vaultPath,c.path),d;try{d=D.default.readFileSync(S)}catch{continue}u=T.default.extname(c.path).toLowerCase()===".md"?this.parseFrontmatterPublishFlag(d.toString("utf-8")):null,h=await se(ie(d)),n[c.path]={mtime:c.mtime,size:c.size,hash:h,publish:u}}if(u===null&&(u=this.getFolderPublishFlag(c.path)),u===!1)continue;u===null&&e&&(u=!0);let y=a[c.path];y?(h!==y.hash&&r.push({path:c.path,type:"changed"}),delete a[c.path]):u===!0&&r.push({path:c.path,type:"new"})}for(let c in a)r.push({path:c,type:"deleted"});return this.saveCache(),r}async uploadFile(e){let{config:t,token:i}=this,n=T.default.join(t.vaultPath,e),r=D.default.readFileSync(n);if(r.byteLength>52428800)throw new Error(`File exceeds 50MB upload limit: ${e}`);let o=ie(r),a=await se(o);await so(i,t.host,t.siteId,e,a,o)}async removeFile(e){let{config:t,token:i}=this;await io(i,t.host,t.siteId,e)}async publish(e,t){let i=e.length,n=0;for(let r of e)r.type==="new"||r.type==="changed"?await this.uploadFile(r.path):r.type==="deleted"&&await this.removeFile(r.path),n++,t?.(n,i);this.saveCache()}walkLocalFiles(){let{config:e}=this,t=e.vaultPath,i=[],n=r=>{let o;try{o=D.default.readdirSync(T.default.join(t,r),{withFileTypes:!0})}catch{return}for(let a of o){let l=a.name;if(l.startsWith("."))continue;let c=r?r+"/"+l:l;if(a.isDirectory())n(c);else if(a.isFile()&&this.isFileSupported(l,c)){let f;try{f=D.default.statSync(T.default.join(t,c))}catch{continue}i.push({path:c,mtime:f.mtimeMs,size:f.size})}}};return n(""),i}isFileSupported(e,t){if(no.includes(e))return!0;let i=T.default.extname(t);return i.startsWith(".")&&(i=i.slice(1)),co(i)}getFolderPublishFlag(e){let{config:t}=this;if(t.excludes){for(let i of t.excludes)if(e.startsWith(i+"/"))return!1}if(t.includes){for(let i of t.includes)if(e.startsWith(i+"/"))return!0}return null}parseFrontmatterPublishFlag(e){if(!e.startsWith("---"))return null;let t=e.indexOf(` ---`,3);if(t===-1)return null;let i=e.slice(4,t),n;try{n=(0,nc.parse)(i)}catch{return null}if(!n||typeof n!="object")return null;let r=n.publish;if(r==null)return null;if(typeof r=="string"){let o=r.t … [Строка слишком длинная. Вы можете скачать файл] `),n=0,r=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;for(;n<i.length;){let o=i[n].match(r);if(!o)throw new Error("Invalid patch string: "+i[n]);let a=new Te;t.push(a),a.start1=parseInt(o[1],10),o[2]===""?(a.start1--,a.length1=1):o[2]==="0"?a.length1=0:(a.start1--,a.length1=parseInt(o[2],10)),a.start2=parseInt(o[3],10),o[4]===""?(a.start2--,a.length2=1):o[4]==="0"?a.length2=0:(a.start2--,a.length2=parseInt(o[4],10)),n++;let l,c,f;for(;n<i.length;){l=i[n].charAt(0),f=i[n].substring(1);try{c=decodeURI(f)}catch{throw new Error("Illegal escape in patch_fromText: "+f)}if(l==="-")a.diffs.push([-1,c]);else if(l==="+")a.diffs.push([1,c]);else if(l===" ")a.diffs.push([0,c]);else{if(l==="@")break;if(l!=="")throw new Error('Invalid patch mode "'+l+'" in: '+c)}n++}}return t}diff_compute_(e,t,i,n){let r;if(!e)return[[1,t]];if(!t)return[[-1,e]];let o=e.length>t.length?e:t,a=e.length>t.length?t:e,l=o.indexOf(a);if(l!==-1)return r=[[1,o.substring(0,l)],[0,a],[1,o.substring(l+a.length)]],e.length>t.length&&(r[0][0]=-1,r[2][0]=-1),r;if(a.length===1)return[[-1,e],[1,t]];let c=this.diff_halfMatch_(e,t);if(c){let f=c[0],u=c[1],h=c[2],y=c[3],S=c[4],d=this.diff_main(f,h,i,n),p=this.diff_main(u,y,i,n);return d.concat([[0,S]],p)}return i&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,n):this.diff_bisect_(e,t,n)}diff_lineMode_(e,t,i){let n=this.diff_linesToChars_(e,t);e=n.chars1,t=n.chars2;let r=n.lineArray,o=this.diff_main(e,t,!1,i);this.diff_charsToLines_(o,r),this.diff_cleanupSemantic(o),o.push([0,""]);let a=0,l=0,c=0,f="",u="";for(;a<o.length;){switch(o[a][0]){case 1:c++,u+=o[a][1];break;case-1:l++,f+=o[a][1];break;case 0:if(l>=1&&c>=1){o.splice(a-l-c,l+c),a=a-l-c;let h=this.diff_main(f,u,!1,i);for(let y=h.length-1;y>=0;y--)o.splice(a,0,h[y]);a=a+h.length}c=0,l=0,f="",u="";break}a++}return o.pop(),o}diff_bisect_(e,t,i){let n=e.length,r=t.length,o=Math.ceil((n+r)/2),a=o,l=2*o,c=new Array(l),f=new Array(l);for(let m=0;m<l;m++)c[m]=-1,f[m]=-1;c[a+1]=0,f[a+1]=0;let u=n-r,h=u%2!==0,y=0,S=0,d=0,p=0;for(let m=0;m<o&&!(Date.now()>i);m++){for(let g=-m+y;g<=m-S;g+=2){let F=a+g,b;g===-m||g!==m&&c[F-1]<c[F+1]?b=c[F+1]:b=c[F-1]+1;let w=b-g;for(;b<n&&w<r&&e.charAt(b)===t.charAt(w);)b++,w++;if(c[F]=b,b>n)S+=2;else if(w>r)y+=2;else if(h){let v=a+u-g;if(v>=0&&v<l&&f[v]!==-1){let P=n-f[v];if(b>=P)return this.diff_bisectSplit_(e,t,b,w,i)}}}for(let g=-m+d;g<=m-p;g+=2){let F=a+g,b;g===-m||g!==m&&f[F-1]<f[F+1]?b=f[F+1]:b=f[F-1]+1;let w=b-g;for(;b<n&&w<r&&e.charAt(n-b-1)===t.charAt(r-w-1);)b++,w++;if(f[F]=b,b>n)p+=2;else if(w>r)d+=2;else if(!h){let v=a+u-g;if(v>=0&&v<l&&c[v]!==-1){let P=c[v],E=a+P-v;if(b=n-b,P>=b)return this.diff_bisectSplit_(e,t,P,E,i)}}}}return[[-1,e],[1,t]]}diff_bisectSplit_(e,t,i,n,r){let o=e.substring(0,i),a=t.substring(0,n),l=e.substring(i),c=t.substring(n),f=this.diff_main(o,a,!1,r),u=this.diff_main(l,c,!1,r);return f.concat(u)}diff_linesToChars_(e,t){let i=[],n={};i[0]="";let r=this.diff_linesToCharsMunge_(e,i,n,4e4),o=this.diff_linesToCharsMunge_(t,i,n,65535);return{chars1:r,chars2:o,lineArray:i}}diff_linesToCharsMunge_(e,t,i,n){let r="",o=0,a=-1,l=t.length;for(;a<e.length-1;){a=e.indexOf(` `,o),a===-1&&(a=e.length-1);let c=e.substring(o,a+1);(i.hasOwnProperty?i.hasOwnProperty(c):i[c]!==void 0)?r+=String.fromCharCode(i[c]):(l===n&&(c=e.substring(o),a=e.length),r+=String.fromCharCode(l),i[c]=l,t[l++]=c),o=a+1}return r}diff_charsToLines_(e,t){for(let i=0;i<e.length;i++){let n=e[i][1],r=[];for(let o=0;o<n.length;o++)r[o]=t[n.charCodeAt(o)];e[i][1]=r.join("")}}diff_commonOverlap_(e,t){let i=e.length,n=t.length;if(i===0||n===0)return 0;i>n?e=e.substring(i-n):i<n&&(t=t.substring(0,i));let r=Pe(i,n);if(e===t)return r;let o=0,a=1;for(;;){let l=e.substring(r-a),c=t.indexOf(l);if(c===-1)return o;a+=c,(c===0||e.substring(r-a)===t.substring(0,a))&&(o=a,a++)}}diff_halfMatch_(e,t){if(this.diffTimeout<=0)return null;let i=e.length>t.length?e:t,n=e.length>t.length?t:e;if(i.length<4||n.length*2<i.length)return null;let r=this.diff_halfMatchI_(i,n,Math.ceil(i.length/4)),o=this.diff_halfMatchI_(i,n,Math.ceil(i.length/2)),a;if(!r&&!o)return null;o?r?a=r[4].length>o[4].length?r:o:a=o:a=r;let l,c,f,u,h=a[4];return e.length>t.length?(l=a[0],c=a[1],f=a[2],u=a[3]):(f=a[0],u=a[1],l=a[2],c=a[3]),[l,c,f,u,h]}diff_halfMatchI_(e,t,i){let n=e.substring(i,i+Math.floor(e.length/4)),r="",o,a,l,c,f=t.indexOf(n,0);for(;f!==-1;){let u=this.diff_commonPrefix(e.substring(i),t.substring(f)),h=this.diff_commonSuffix(e.substring(0,i),t.substring(0,f));r.length<h+u&&(r=t.substring(f-h,f)+t.substring(f,f+u),o=e.substring(0,i-h),a=e.substring(i+u),l=t.substring(0,f-h),c=t.substring(f+u)),f=t.indexOf(n,f+1)}return r.length*2>=e.length?[o,a,l,c,r]:null}diff_cleanupSemanticScore_(e,t){if(!e||!t)return 6;let i=e.charAt(e.length-1),n=t.charAt(0),r=i.match(fc),o=n.match(fc),a=r&&i.match(hc),l=o&&n.match(hc),c=a&&i.match(pc),f=l&&n.match(pc),u=c&&e.match(Dd),h=f&&t.match(Td);return u||h?5:c||f?4:r&&!a&&l?3:a||l?2:r||o?1:0}match_bitap_(e,t,i){if(t.length>this.matchMaxBits)throw new Error("Pattern too long for this browser");let n=this.match_alphabet_(t),r=this.matchThreshold,o=e.indexOf(t,i);o!==-1&&(r=Pe(this.match_bitapScore_(0,o,t,i),r),o=e.lastIndexOf(t,i+t.length),o!==-1&&(r=Pe(this.match_bitapScore_(0,o,t,i),r)));let a=1<<t.length-1;o=-1;let l,c,f=t.length+e.length,u;for(let h=0;h<t.length;h++){for(l=0,c=f;l<c;)this.match_bitapScore_(h,i+c,t,i)<=r?l=c:f=c,c=Math.floor((f-l)/2+l);f=c;let y=De(1,i-c+1),S=Pe(i+c,e.length)+t.length,d=Array(S+2);d[S+1]=(1<<h)-1;for(let p=S;p>=y;p--){let m=n[e.charAt(p-1)];if(h===0?d[p]=(d[p+1]<<1|1)&m:d[p]=(d[p+1]<<1|1)&m|((u[p+1]|u[p])<<1|1)|u[p+1],d[p]&a){let g=this.match_bitapScore_(h,p-1,t,i);if(g<=r)if(r=g,o=p-1,o>i)y=De(1,2*i-o);else break}}if(this.match_bitapScore_(h+1,i,t,i)>r)break;u=d}return o}match_bitapScore_(e,t,i,n){let r=e/i.length,o=Math.abs(n-t);return this.matchDistance?r+o/this.matchDistance:o?1:r}match_alphabet_(e){let t={};for(let i=0;i<e.length;i++)t[e.charAt(i)]=0;for(let i=0;i<e.length;i++)t[e.charAt(i)]|=1<<e.length-i-1;return t}patch_addContext_(e,t){if(t.length===0)return;if(e.start2==null)throw Error("patch not initialized");let i=t.substring(e.start2,e.start2+e.length1),n=0;for(;t.indexOf(i)!==t.lastIndexOf(i)&&i.length<this.matchMaxBits-this.patchMargin-this.patchMargin;)n+=this.patchMargin,i=t.substring(e.start2-n,e.start2+e.length1+n);n+=this.patchMargin;let r=t.substring(e.start2-n,e.start2);r&&e.diffs.unshift([0,r]);let o=t.substring(e.start2+e.length1,e.start2+e.length1+n);o&&e.diffs.push([0,o]),e.start1-=r.length,e.start2-=r.length,e.length1+=r.length+o.length,e.length2+=r.length+o.length}},Te=class{constructor(){this.diffs=[];this.start1=0;this.start2=0;this.length1=0;this.length2=0}toString(){let e,t;this.length1===0?e=this.start1+",0":this.length1===1?e=this.start1+1:e=this.start1+1+","+this.length1,this.length2===0?t=this.start2+",0":this.length2===1?t=this.start2+1:t=this.start2+1+","+this.length2;let i=["@@ -"+e+" +"+t+` @@ `],n;for(let r=0;r<this.diffs.length;r++){switch(this.diffs[r][0]){case 1:n="+";break;case-1:n="-";break;case 0:n=" ";break}i[r+1]=n+encodeURI(this.diffs[r][1])+` `}return i.join("").replace(/%20/g," ")}};function dc(s,e,t){let i=new Gi,n=i.diff_main(s,e,!0,0);n.length>2&&(i.diff_cleanupSemantic(n),i.diff_cleanupEfficiency(n));let r=i.patch_make(s,n);return i.p … [Строка слишком длинная. Вы можете скачать файл] Vaults:`);let t=i=>console.log(` ${i.id} "${i.name}" (${i.region})`);for(let i of e.vaults)t(i);if(e.shared.length>0){console.log(` Shared vaults:`);for(let i of e.shared)t(i)}}catch(s){console.error("Failed to list vaults:",s),process.exit(1)}});x.command("sync-list-local").description("List locally configured vaults").action(()=>{try{let s=ms();if(s.length===0){console.log("No vaults configured.");return}console.log("Configured vaults:");for(let e of s){let t=ds(e);t&&(console.log(` ${e}`),console.log(` Path: ${t.vaultPath}`),console.log(` Host: ${t.host}`))}}catch(s){console.error("Failed to list vaults:",s),process.exit(1)}});x.command("sync-create-remote").description("Create a new remote vault").requiredOption("--name <name>","Vault name").option("--encryption <standard|e2ee>","Encryption").option("--password <encryption-password>","End-to-end encryption password (prompt if omitted)").option("--region <region>","Vault region (leave empty for automatic)").action(async s=>{try{let e=ee(),t=s.name,i=s.password;!i&&s.encryption!=="standard"&&(i=await Ue("End-to-end encryption password (leave empty for standard encryption): "));let n=s.region||"";if(n){let c=(await Gr(e)).regions;if(!c.some(f=>f.value===n)){console.error(`Invalid region: "${n}". Available regions:`);for(let f of c)console.error(` ${f.value} (${f.name})`);process.exit(1)}}console.log("Creating vault...");let r,o=null;if(i){r=W(crypto.getRandomValues(new Uint8Array(16)));let l=await Dr(i,r);o=await Tr(l,r,Ar)}let a=await Yr(e,t,o,r,n,Ar);console.log(` Vault created successfully!`),console.log(` Vault ID: ${a.id}`),console.log(` Vault name: ${a.name}`),console.log(` Region: ${a.region}`),console.log(` Encryption: ${i?"end-to-end":"managed"}`),console.log(` Run '${Y} sync-setup --vault "${a.id}"' to configure sync.`)}catch(e){console.error("Failed to create vault:",e),process.exit(1)}});x.command("sync-setup").description("Setup sync from a local path to a remote vault").requiredOption("--vault <vault>","Remote vault ID or name").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--password <encryption-password>","End-to-end encryption password (prompted if omitted)").option("--device-name <name>","Device name to identify this client in the sync version history").option("--config-dir <name>","Config directory name (default: .obsidian)").action(async s=>{try{let e=ee(),t=s.vault,i=T.default.resolve(s.path||"."),n=s.password,r=s.deviceName||"",o=ys(s.configDir);console.log("Fetching vault info...");let a=await Ps(e,Pr),l=[...a.vaults,...a.shared],c=l.find(S=>S.id===t);if(!c){let S=l.filter(d=>d.name===t);if(S.length===1)c=S[0];else if(S.length>1){console.error(`Multiple vaults named "${t}". Use the vault ID instead:`);for(let d of S)console.error(` ${d.id} "${d.name}"`);process.exit(1)}}c||(console.error(`Vault "${t}" not found.`),process.exit(3));let f=c.id;c.password?n=c.password:n||(n=await Ue("End-to-end encryption password: ")),n||(console.error("Password not provided."),process.exit(2)),console.log("Setting up...");let u=await Dr(n,c.salt),h=await Tr(u,c.salt,c.encryption_version);try{await Jr(e,f,h,c.host,c.encryption_version)}catch(S){console.error("Failed to validate password.",S),process.exit(2)}let y={vaultId:f,vaultName:c.name,vaultPath:i,host:c.host,encryptionVersion:c.encryption_version,encryptionKey:po(u),encryptionSalt:c.salt,conflictStrategy:"merge",deviceName:r,configDir:o};ps(f),gs(f,y),console.log(` Vault configured successfully!`),rs(y),D.default.existsSync(i)?D.default.readdirSync(i).filter(p=>!p.startsWith(".")).length>0&&(console.log(` Warning: Your local vault already contains some notes.`),console.log("If you start syncing, notes in your local vault will be merged with notes from your remote vault."),console.log("In case of conflicts, the most recent version of the note will be preserved.")):D.default.mkdirSync(i,{recursive:!0}),kc(),console.log(` Run '${Y} sync' to start syncing.`)}catch(e){console.error("Setup failed:",e),process.exit(1)}});x.command("sync-config").description("Change sync configuration for a vault").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--conflict-strategy <strategy>","Conflict resolution strategy (merge or conflict)").option("--excluded-folders <folders>","Folders to exclude, comma-separated (empty string to clear)").option("--file-types <types>","Attachment types to sync, comma-separated: image, audio, video, pdf, unsupported (empty to clear)").option("--configs <settings>","Config categories to sync, comma-separated: app, appearance, appearance-data, hotkey, core-plugin, core-plugin-data, community-plugin, community-plugin-data (empty to clear)").option("--device-name <name>","Device name to identify this client in the sync version history").option("--mode <mode>","Sync mode: bidirectional (default), pull-only (only download, ignore local changes), or mirror-remote (only download, revert local changes)").option("--config-dir <name>","Config directory name (default: .obsidian)").action(s=>{try{let e=T.default.resolve(s.path||"."),t=We(e);t||(console.error(`No sync configuration found for ${e}`),console.error(`Run '${Y} sync-setup' first.`),process.exit(3));let i=!1;s.mode!==void 0&&(s.mode!=="bidirectional"&&s.mode!=="pull-only"&&s.mode!=="mirror-remote"&&(console.error(`Invalid sync mode: "${s.mode}". Must be "bidirectional", "pull-only", or "mirror-remote".`),process.exit(1)),s.mode==="bidirectional"?delete t.syncMode:t.syncMode=s.mode,i=!0),s.conflictStrategy!==void 0&&(s.conflictStrategy!=="merge"&&s.conflictStrategy!=="conflict"&&(console.error(`Invalid conflict strategy: "${s.conflictStrategy}". Must be "merge" or "conflict".`),process.exit(1)),t.conflictStrategy=s.conflictStrategy,i=!0),s.excludedFolders!==void 0&&(es(t,()=>{s.excludedFolders===""?delete t.ignoreFolders:t.ignoreFolders=s.excludedFolders.split(",").map(n=>n.trim())}),i=!0),s.fileTypes!==void 0&&(es(t,()=>{s.fileTypes===""?delete t.allowTypes:t.allowTypes=Br(s.fileTypes)}),i=!0),s.configs!==void 0&&(es(t,()=>{s.configs===""?delete t.allowSpecialFiles:t.allowSpecialFiles=$r(s.configs)}),i=!0),s.deviceName!==void 0&&(t.deviceName=s.deviceName,i=!0),s.configDir!==void 0&&(t.configDir=ys(s.configDir),i=!0),i?(gs(t.vaultId,t),console.log("Configuration updated:")):console.log("No options provided. Current configuration:"),rs(t)}catch(e){console.error("Config update failed:",e),process.exit(1)}});x.command("sync-status").description("Show sync status for a vault").option("--path <local-path>","Local vault path (use current directory if omitted)").action(async s=>{try{let e=T.default.resolve(s.path||"."),t=We(e);t||(console.error(`No sync configuration found for ${e}`),process.exit(3)),Ke()||console.log("Not logged in."),t.encryptionKey||console.log("End-to-end encryption key missing. Run setup again."),console.log("Sync Configuration:"),rs(t)}catch(e){console.error("Status check failed:",e),process.exit(1)}});x.command("sync-unlink").description("Disconnect a vault from sync and remove stored credentials").option("--path <local-path>","Local vault path (use current directory if omitted)").action(async s=>{try{let e=T.default.resolve(s.path||"."),t=We(e);t||(console.error(`No sync configuration found for ${e}`),process.exit(3)),Rr(t.vaultId),console.log(`Sync configuration removed for ${e}`)}catch(e){console.error("Unlink failed:",e),process.exit(1)}});x.command("sync").description("Sync a vault").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--continuous","Run in continuous sync mode").action(async s=>{try{let e=T.default.resolve(s.path||"."),t=We(e);t||(console.error(`No sync configuration found for ${e}`),console.error(`Run '${Y} sync-setup' first.`),process.exit(3));let i=ee();(!t.encryptionKey||!t.encryptionSalt||t.encryptionVersion==null)&&(console.error("Encryption key not found. Run setup again."),process.exit(2));let n=await Nc(t.encryptionVersion,ho(t.encryptionKey),t.encryptionSalt),r=Kr(xr(t.vaultId));t.deviceName||(t.deviceName=vs()),(!t.configDir||!t.configDir.startsWith("."))&&(t.configDir=".obsidian"),kc();let o=new ss(D.default,T.default,Mr(t.vaultPath,t.configDir));try{o.acquire()}catch{console.error("Another sync instance is already running for this vault."),r(),process.exit(1)}let a;try{a=new Zi({config:t,token:i,encryption:n,continuous:s.continuous});let l=()=>{console.log(` Received signal to shut down...`),a.stop()};process.on("SIGINT",l),process.on("SIGTERM",l),console.log("Starting sync:"),rs(t),await a.sync()}finally{o.release(),r(),a?.stop()}process.exit(0)}catch(e){console.error("Sync failed:",e),process.exit(1)}});function rs(s){console.log(` Vault: ${s.vaultName} (${s.vaultId})`),console.log(` Location: ${s.vaultPath}`),console.log(` Sync mode: ${s.syncMode||"bidirectional"}`),console.log(` Conflict strategy: ${s.conflictStrategy}`),console.log(` Device name: ${s.deviceName||vs()}`),s.configDir&&console.log(` Config directory: ${s.configDir}`);let{allowTypes:e,allowSpecialFiles:t,ignoreFolders:i}=s;console.log(` File types: ${(e||Le).join(", ")}`),console.log(` Configs: ${t?.length?(t||[]).join(", "):"none (config syncing disabled)"}`),i&&i.length>0&&console.log(` Excluded folders: ${i.join(", ")}`)}x.command("publish-list-sites").description("List publish sites").action(async()=>{try{let s=ee();console.log("Fetching sites...");let e=await Ds(s);if(e.sites.length===0&&e.shared.length===0){console.log("No publish sites found.");return}let t=[...e.sites,...e.shared],i={};try{i=await Ts(s,t.map(r=>r.id))}catch{}console.log(` Sites:`);let n=r=>{let o=i[r.id]||"";console.log(` ${r.id} ${o?'"'+o+'"':"(no slug)"}`)};for(let r of e.sites)n(r);if(e.shared.length>0){console.log("Shared sites:");for(let r of e.shared)n(r)}}catch(s){console.error("Failed to list sites:",s),process.exit(1)}});x.command("publish-create-site").description("Create a new Publish site").requiredOption("--slug <slug>","Site slug (URL identifier)").action(async s=>{try{let e=ee();console.log("Creating site...");let t=await Qr(e);await eo(e,t.id,t.host,s.slug),console.log(` Site created successfully!`),console.log(` Site ID: ${t.id}`),console.log(` Slug: ${s.slug}`),console.log(` Host: ${t.host}`),console.log(` Run '${Y} publish-setup --site "${t.id}"' to connect a vault.`)}catch(e){console.error("Failed to create site:",e),process.exit(1)}});x.command("publish-setup").description("Connect a local vault to a Publish site").requiredOption("--site <id-or-slug>","Site ID or slug").option("--path <local-path>","Local vault path (use current directory if omitted)").action(async s=>{try{let e=ee(),t=T.default.resolve(s.path||"."),i=s.site;console.log("Fetching sites...");let n=await Ds(e),r=[...n.sites,...n.shared],o=r.find(l=>l.id===i);if(!o){let l={};try{l=await Ts(e,r.map(f=>f.id))}catch{}let c=Object.entries(l).find(([,f])=>f===i)?.[0];c&&(o=r.find(f=>f.id===c))}o||(console.error(`Site "${i}" not found.`),process.exit(1));let a={siteId:o.id,host:o.host,vaultPath:t};Ss(o.id,a),console.log(` Site connected successfully!`),Ic(a),D.default.existsSync(t)||D.default.mkdirSync(t,{recursive:!0}),console.log(` Run '${Y} publish --dry-run' to preview changes.`)}catch(e){console.error("Setup failed:",e),process.exit(1)}});x.command("publish").description("Publish vault changes to site").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--dry-run","Show changes without publishing").option("--yes","Publish without prompting for confirmation").option("--all","Include files without a publish flag").action(async s=>{try{let e=T.default.resolve(s.path||"."),t=He(e);t||(console.error(`No publish configuration found for ${e}`),console.error(`Run '${Y} publish-setup' first.`),process.exit(1));let i=ee(),n=new Vi(i,t);console.log("Scanning for changes...");let r=await n.scanForChanges(s.all);r.length===0&&(console.log("No changes to publish."),process.exit(0));let o=r.filter(u=>u.type==="new"),a=r.filter(u=>u.type==="changed"),l=r.filter(u=>u.type==="deleted");if(o.length>0){console.log(` New (${o.length}):`);for(let u of o)console.log(` + ${u.path}`)}if(a.length>0){console.log(` Changed (${a.length}):`);for(let u of a)console.log(` ~ ${u.path}`)}if(l.length>0){console.log(` Deleted (${l.length}):`);for(let u of l)console.log(` - ${u.path}`)}console.log(` Total: ${r.length} changes`),s.dryRun&&process.exit(0),s.yes||(await Ue("Publish these changes? (y/N) ",!0)).toLowerCase()!=="y"&&(console.log("Cancelled."),process.exit(1)),console.log(` Publishing...`);let c=r.length,f=0;for(let u of r)u.type==="new"||u.type==="changed"?(console.log(`Uploading (${f}/${c}) ${u.path}`),await n.uploadFile(u.path)):u.type==="deleted"&&(console.log(`Deleting (${f}/${c}) ${u.path}`),await n.removeFile(u.path)),f++;console.log(` Done.`),process.exit(0)}catch(e){console.error("Publish failed:",e),process.exit(1)}});x.command("publish-config").description("Configure publish settings for a vault").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--includes <folders>","Folders to include, comma-separated (empty string to clear)").option("--excludes <folders>","Folders to exclude, comma-separated (empty string to clear)").action(s=>{try{let e=T.default.resolve(s.path||"."),t=He(e);t||(console.error(`No publish configuration found for ${e}`),console.error(`Run '${Y} publish-setup' first.`),process.exit(1));let i=!1;s.includes!==void 0&&(s.includes===""?delete t.includes:t.includes=s.includes.split(",").map(n=>n.trim()),i=!0),s.excludes!==void 0&&(s.excludes===""?delete t.excludes:t.excludes=s.excludes.split(",").map(n=>n.trim()),i=!0),i?(Ss(t.siteId,t),console.log("Configuration updated:")):console.log("No options provided. Current configuration:"),Ic(t)}catch(e){console.error("Config update failed:",e),process.exit(1)}});x.command("publish-site-options").description("View or update publish site options").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--site-name <name>","Site name").option("--index-file <path>","Home page file path").option("--logo <path>","Logo file path (empty string to clear)").option("--show-navigation <bool>","Show navigation sidebar").option("--show-graph <bool>","Show graph view").option("--show-outline <bool>","Show table of contents").option("--show-search <bool>","Show search").option("--show-backlinks <bool>","Show backlinks").option("--show-hover-preview <bool>","Show hover preview").option("--show-theme-toggle <bool>","Show theme toggle").option("--default-theme <theme>","Default theme: light or dark").option("--readable-line-length <bool>","Readable line length").option("--strict-line-breaks <bool>","Strict line breaks").option("--hide-title <bool>","Hide inline title").option("--sliding-window <bool>","Sliding window mode").option("--nav-order <paths>","Navigation ordering, comma-separated paths in display order (empty string to clear)").option("--nav-hidden <paths>","Navigation hidden items, comma-separated paths (empty string to clear)").action(async s=>{try{let e=T.default.resolve(s.path||"."),t=He(e);t||(console.error(`No publish configuration found for ${e}`),console.error(`Run '${Y} publish-setup' first.`),process.exit(1));let i=ee(),n=l=>{let c=l.toLowerCase();if(c==="true"||c==="1"||c==="yes")return!0;if(c==="false"||c==="0"||c==="no")return!1;throw new Error(`Invalid boolean value: "${l}". Use true/false.`)},r={showNavigation:"showNavigation",showGraph:"showGraph",showOutline:"showOutline",showSearch:"showSearch",showBacklinks:"showBacklinks",showHoverPreview:"showHoverPreview",showThemeToggle:"showThemeToggle",readableLineLength:"readableLineLength",strictLineBreaks:"strictLineBreaks",hideTitle:"hideTitle",slidingWindow:"slidingWindowMode"},o={};for(let[l,c]of Object.entries(r))s[l]!==void 0&&(o[c]=n(s[l]));s.siteName!==void 0&&(o.siteName=s.siteName),s.indexFile!==void 0&&(o.indexFile=s.indexFile),s.logo!==void 0&&(o.logo=s.logo),s.defaultTheme!==void 0&&(s.defaultTheme!=="light"&&s.defaultTheme!=="dark"&&(console.error('Invalid theme. Use "light" or "dark".'),process.exit(1)),o.defaultTheme=s.defaultTheme),s.navOrder!==void 0&&(o.navigationOrdering=s.navOrder===""?null:s.navOrder.split(",").map(l=>l.trim())),s.navHidden!==void 0&&(o.navigationHiddenItems=s.navHidden===""?null:s.navHidden.split(",").map(l=>l.trim()));let a;Object.keys(o).length>0?(a=await _s(i,t.host,t.siteId,o),console.log("Site options updated.")):a=await _s(i,t.host,t.siteId),console.log(` Current site options:`);for(let[l,c]of Object.entries(a))console.log(` ${l}: ${JSON.stringify(c)}`)}catch(e){console.error("Site options failed:",e),process.exit(1)}});x.command("publish-unlink").description("Disconnect a vault from a publish site").option("--path <local-path>","Local vault path (use current directory if omitted)").action(s=>{try{let e=T.default.resolve(s.path||"."),t=He(e);t||(console.error(`No publish configuration found for ${e}`),process.exit(1)),Ur(t.siteId),console.log(`Publish configuration removed for ${e}`)}catch(e){console.error("Unlink failed:",e),process.exit(1)}});function Ic(s){console.log(` Site: ${s.siteId}`),console.log(` Host: ${s.host}`),console.log(` Location: ${s.vaultPath}`),s.includes?.length&&console.log(` Includes: ${s.includes.join(", ")}`),s.excludes?.length&&console.log(` Excludes: ${s.excludes.join(", ")}`)}function Ue(s,e){return new Promise(t=>{if(process.stdin.isTTY){process.stdout.write(s),process.stdin.setRawMode(!0),process.stdin.resume();let i="",n=()=>{process.stdout.clearLine(0),process.stdout.cursorTo(0),process.stdout.write(s+(e?i:"*".repeat(i.length)))},r=o=>{let a=o.toString();a===` `||a==="\r"?(process.stdin.setRawMode(!1),process.stdin.pause(),process.stdin.removeListener("data",r),process.stdout.write(` `),t(i)):a===""?(process.stdin.setRawMode(!1),process.exit(1)):a==="\x7F"||a==="\b"?(i=i.slice(0,-1),n()):(i+=a,process.stdout.write(e?a:"*".repeat(a.length)))};process.stdin.on("data",r)}else{let i="";process.stdin.setEncoding("utf-8"),process.stdin.on("data",n=>{i+=n}),process.stdin.on("end",()=>{t(i.trimEnd())}),process.stdin.resume()}})}function kc(){(process.platform==="win32"||process.platform==="darwin")&&!Nr()&&console.warn("Warning: btime native module failed to load. File creation times will not be preserved.")}function ee(){let s=Ke();return s||(console.error(`No account logged in. Run "${Y} login" first.`),process.exit(2)),s}x.parse();