comet-dsh-plugin 0.0.0-stage → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +176 -0
- package/README.md +152 -2
- package/client.js +349 -0
- package/cordis.patch.yml +4 -0
- package/icon.png +0 -0
- package/index.js +183 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +58 -4
- package/rules/comet-workflow-guard.md +65 -0
- package/rules/migration-assets.json +218 -0
- package/server/comet-plugin-setup.mjs +192 -0
- package/skills/comet/SKILL.md +37 -0
- package/skills/comet/agents/openai.yaml +3 -0
- package/skills/comet/reference/change-walkthrough.md +77 -0
- package/skills/comet/reference/edit-review.md +26 -0
- package/skills/comet/reference/host-check.md +11 -0
- package/skills/comet/reference/platform-execution.md +34 -0
- package/skills/comet/reference/task-learning.md +39 -0
- package/skills/comet/runtime/classic/checks.yaml +6 -0
- package/skills/comet/runtime/classic/guardrails.yaml +13 -0
- package/skills/comet/runtime/classic/skill.yaml +122 -0
- package/skills/comet/scripts/comet-archive.mjs +310 -0
- package/skills/comet/scripts/comet-check.mjs +179 -0
- package/skills/comet/scripts/comet-entry-runtime.mjs +151 -0
- package/skills/comet/scripts/comet-env.mjs +15 -0
- package/skills/comet/scripts/comet-guard.mjs +335 -0
- package/skills/comet/scripts/comet-handoff.mjs +289 -0
- package/skills/comet/scripts/comet-hook-guard.mjs +295 -0
- package/skills/comet/scripts/comet-hook-router-guard.mjs +629 -0
- package/skills/comet/scripts/comet-hook-router.mjs +17 -0
- package/skills/comet/scripts/comet-intent.mjs +181 -0
- package/skills/comet/scripts/comet-plugin-hook.mjs +213 -0
- package/skills/comet/scripts/comet-resume-probe.mjs +205 -0
- package/skills/comet/scripts/comet-runtime.mjs +572 -0
- package/skills/comet/scripts/comet-state.mjs +381 -0
- package/skills/comet/scripts/comet-yaml-validate.mjs +182 -0
- package/skills/comet-any/SKILL.md +47 -0
- package/skills/comet-any/agents/openai.yaml +5 -0
- package/skills/comet-any/reference/sdk-creation.md +100 -0
- package/skills/comet-archive/SKILL.md +28 -0
- package/skills/comet-archive/agents/openai.yaml +5 -0
- package/skills/comet-archive/reference/compat.md +188 -0
- package/skills/comet-build/SKILL.md +35 -0
- package/skills/comet-build/agents/openai.yaml +5 -0
- package/skills/comet-build/reference/compat.md +191 -0
- package/skills/comet-classic/SKILL.md +98 -0
- package/skills/comet-classic/agents/openai.yaml +3 -0
- package/skills/comet-classic/reference/auto-transition.md +34 -0
- package/skills/comet-classic/reference/classic-layout.md +36 -0
- package/skills/comet-classic/reference/comet-yaml-fields.md +82 -0
- package/skills/comet-classic/reference/context-recovery.md +128 -0
- package/skills/comet-classic/reference/debug-gate.md +30 -0
- package/skills/comet-classic/reference/decision-point.md +109 -0
- package/skills/comet-classic/reference/dirty-worktree.md +59 -0
- package/skills/comet-classic/reference/file-structure.md +32 -0
- package/skills/comet-classic/reference/intent-frame.md +132 -0
- package/skills/comet-classic/reference/scripts.md +144 -0
- package/skills/comet-classic/reference/sdk-methods.md +136 -0
- package/skills/comet-classic/reference/subagent-dispatch.md +75 -0
- package/skills/comet-classic/reference/workspace.md +23 -0
- package/skills/comet-design/SKILL.md +25 -0
- package/skills/comet-design/agents/openai.yaml +5 -0
- package/skills/comet-design/reference/compat.md +191 -0
- package/skills/comet-hotfix/SKILL.md +46 -0
- package/skills/comet-hotfix/agents/openai.yaml +5 -0
- package/skills/comet-hotfix/reference/compat.md +240 -0
- package/skills/comet-memory/SKILL.md +68 -0
- package/skills/comet-memory/agents/openai.yaml +5 -0
- package/skills/comet-native/SKILL.md +139 -0
- package/skills/comet-native/agents/openai.yaml +3 -0
- package/skills/comet-native/reference/artifacts.md +118 -0
- package/skills/comet-native/reference/clarification.md +120 -0
- package/skills/comet-native/reference/commands.md +321 -0
- package/skills/comet-native/reference/edit-review.md +26 -0
- package/skills/comet-native/reference/recovery.md +64 -0
- package/skills/comet-native/reference/workspace.md +70 -0
- package/skills/comet-native/scripts/comet-native-archive.mjs +475 -0
- package/skills/comet-native/scripts/comet-native-cancel.mjs +461 -0
- package/skills/comet-native/scripts/comet-native-doctor.mjs +475 -0
- package/skills/comet-native/scripts/comet-native-hook-guard.mjs +470 -0
- package/skills/comet-native/scripts/comet-native-init.mjs +465 -0
- package/skills/comet-native/scripts/comet-native-new.mjs +478 -0
- package/skills/comet-native/scripts/comet-native-next.mjs +470 -0
- package/skills/comet-native/scripts/comet-native-root.mjs +472 -0
- package/skills/comet-native/scripts/comet-native-runtime.mjs +525 -0
- package/skills/comet-native/scripts/comet-native-select.mjs +468 -0
- package/skills/comet-native/scripts/comet-native-show.mjs +462 -0
- package/skills/comet-native/scripts/comet-native-spec.mjs +468 -0
- package/skills/comet-native/scripts/comet-native-status.mjs +467 -0
- package/skills/comet-native/scripts/comet-native-transfer.mjs +466 -0
- package/skills/comet-open/SKILL.md +265 -0
- package/skills/comet-open/agents/openai.yaml +5 -0
- package/skills/comet-open/reference/batch-changes.md +51 -0
- package/skills/comet-review/SKILL.md +121 -0
- package/skills/comet-review/agents/openai.yaml +5 -0
- package/skills/comet-tweak/SKILL.md +49 -0
- package/skills/comet-tweak/agents/openai.yaml +5 -0
- package/skills/comet-tweak/reference/compat.md +232 -0
- package/skills/comet-verify/SKILL.md +30 -0
- package/skills/comet-verify/agents/openai.yaml +5 -0
- package/skills/comet-verify/reference/compat.md +202 -0
package/index.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import {createRequire as __cometCreateRequire} from 'node:module'; const require=__cometCreateRequire(import.meta.url);
|
|
2
|
+
var sl=Object.create;var Ni=Object.defineProperty;var al=Object.getOwnPropertyDescriptor;var ll=Object.getOwnPropertyNames;var cl=Object.getPrototypeOf,ul=Object.prototype.hasOwnProperty;var kt=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var v=(n,e)=>()=>{try{return e||n((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var fl=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ll(e))!ul.call(n,i)&&i!==t&&Ni(n,i,{get:()=>e[i],enumerable:!(r=al(e,i))||r.enumerable});return n};var Nn=(n,e,t)=>(t=n!=null?sl(cl(n)):{},fl(e||!n||!n.__esModule?Ni(t,"default",{value:n,enumerable:!0}):t,n));var _=v(R=>{"use strict";var Tn=Symbol.for("yaml.alias"),$i=Symbol.for("yaml.document"),St=Symbol.for("yaml.map"),Fi=Symbol.for("yaml.pair"),Rn=Symbol.for("yaml.scalar"),Ct=Symbol.for("yaml.seq"),G=Symbol.for("yaml.node.type"),yl=n=>!!n&&typeof n=="object"&&n[G]===Tn,kl=n=>!!n&&typeof n=="object"&&n[G]===$i,bl=n=>!!n&&typeof n=="object"&&n[G]===St,vl=n=>!!n&&typeof n=="object"&&n[G]===Fi,Wi=n=>!!n&&typeof n=="object"&&n[G]===Rn,Sl=n=>!!n&&typeof n=="object"&&n[G]===Ct;function Bi(n){if(n&&typeof n=="object")switch(n[G]){case St:case Ct:return!0}return!1}function Cl(n){if(n&&typeof n=="object")switch(n[G]){case Tn:case St:case Rn:case Ct:return!0}return!1}var El=n=>(Wi(n)||Bi(n))&&!!n.anchor;R.ALIAS=Tn;R.DOC=$i;R.MAP=St;R.NODE_TYPE=G;R.PAIR=Fi;R.SCALAR=Rn;R.SEQ=Ct;R.hasAnchor=El;R.isAlias=yl;R.isCollection=Bi;R.isDocument=kl;R.isMap=bl;R.isNode=Cl;R.isPair=vl;R.isScalar=Wi;R.isSeq=Sl});var qe=v(Ln=>{"use strict";var T=_(),M=Symbol("break visit"),Hi=Symbol("skip children"),z=Symbol("remove node");function Et(n,e){let t=Ki(e);T.isDocument(n)?Ee(null,n.contents,t,Object.freeze([n]))===z&&(n.contents=null):Ee(null,n,t,Object.freeze([]))}Et.BREAK=M;Et.SKIP=Hi;Et.REMOVE=z;function Ee(n,e,t,r){let i=Ji(n,e,t,r);if(T.isNode(i)||T.isPair(i))return zi(n,r,i),Ee(n,i,t,r);if(typeof i!="symbol"){if(T.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=Ee(o,e.items[o],t,r);if(typeof s=="number")o=s-1;else{if(s===M)return M;s===z&&(e.items.splice(o,1),o-=1)}}}else if(T.isPair(e)){r=Object.freeze(r.concat(e));let o=Ee("key",e.key,t,r);if(o===M)return M;o===z&&(e.key=null);let s=Ee("value",e.value,t,r);if(s===M)return M;s===z&&(e.value=null)}}return i}async function Pt(n,e){let t=Ki(e);T.isDocument(n)?await Pe(null,n.contents,t,Object.freeze([n]))===z&&(n.contents=null):await Pe(null,n,t,Object.freeze([]))}Pt.BREAK=M;Pt.SKIP=Hi;Pt.REMOVE=z;async function Pe(n,e,t,r){let i=await Ji(n,e,t,r);if(T.isNode(i)||T.isPair(i))return zi(n,r,i),Pe(n,i,t,r);if(typeof i!="symbol"){if(T.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=await Pe(o,e.items[o],t,r);if(typeof s=="number")o=s-1;else{if(s===M)return M;s===z&&(e.items.splice(o,1),o-=1)}}}else if(T.isPair(e)){r=Object.freeze(r.concat(e));let o=await Pe("key",e.key,t,r);if(o===M)return M;o===z&&(e.key=null);let s=await Pe("value",e.value,t,r);if(s===M)return M;s===z&&(e.value=null)}}return i}function Ki(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function Ji(n,e,t,r){if(typeof t=="function")return t(n,e,r);if(T.isMap(e))return t.Map?.(n,e,r);if(T.isSeq(e))return t.Seq?.(n,e,r);if(T.isPair(e))return t.Pair?.(n,e,r);if(T.isScalar(e))return t.Scalar?.(n,e,r);if(T.isAlias(e))return t.Alias?.(n,e,r)}function zi(n,e,t){let r=e[e.length-1];if(T.isCollection(r))r.items[n]=t;else if(T.isPair(r))n==="key"?r.key=t:r.value=t;else if(T.isDocument(r))r.contents=t;else{let i=T.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}Ln.visit=Et;Ln.visitAsync=Pt});var Dn=v(Yi=>{"use strict";var Ui=_(),Pl=qe(),_l={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Al=n=>n.replace(/[!,[\]{}]/g,e=>_l[e]),$e=class n{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},n.defaultYaml,e),this.tags=Object.assign({},n.defaultTags,t)}clone(){let e=new n(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new n(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:n.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},n.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:n.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},n.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,s]=r;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return t(6,`Unsupported YAML version ${o}`,s),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),s)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(s){return t(String(s)),null}return r==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,r]of Object.entries(this.tags))if(e.startsWith(r))return t+Al(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&Ui.isNode(e.contents)){let o={};Pl.visit(e.contents,(s,a)=>{Ui.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of r)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&t.push(`%TAG ${o} ${s}`);return t.join(`
|
|
3
|
+
`)}};$e.defaultYaml={explicit:!1,version:"1.2"};$e.defaultTags={"!!":"tag:yaml.org,2002:"};Yi.Directives=$e});var _t=v(Fe=>{"use strict";var Vi=_(),Il=qe();function Ol(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function Gi(n){let e=new Set;return Il.visit(n,{Value(t,r){r.anchor&&e.add(r.anchor)}}),e}function Qi(n,e){for(let t=1;;++t){let r=`${n}${t}`;if(!e.has(r))return r}}function Nl(n,e){let t=[],r=new Map,i=null;return{onAnchor:o=>{t.push(o),i??(i=Gi(n));let s=Qi(e,i);return i.add(s),s},setAnchors:()=>{for(let o of t){let s=r.get(o);if(typeof s=="object"&&s.anchor&&(Vi.isScalar(s.node)||Vi.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}Fe.anchorIsValid=Ol;Fe.anchorNames=Gi;Fe.createNodeAnchors=Nl;Fe.findNewAnchor=Qi});var Mn=v(Xi=>{"use strict";function We(n,e,t,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let s=r[i],a=We(n,r,String(i),s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),s=We(n,r,i,o);s===void 0?r.delete(i):s!==o&&r.set(i,s)}else if(r instanceof Set)for(let i of Array.from(r)){let o=We(n,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let s=We(n,r,i,o);s===void 0?delete r[i]:s!==o&&(r[i]=s)}return n.call(e,t,r)}Xi.applyReviver=We});var te=v(eo=>{"use strict";var jl=_();function Zi(n,e,t){if(Array.isArray(n))return n.map((r,i)=>Zi(r,String(i),t));if(n&&typeof n.toJSON=="function"){if(!t||!jl.hasAnchor(n))return n.toJSON(e,t);let r={aliasCount:0,count:1,res:void 0};t.anchors.set(n,r),t.onCreate=o=>{r.res=o,delete t.onCreate};let i=n.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof n=="bigint"&&!t?.keep?Number(n):n}eo.toJS=Zi});var At=v(no=>{"use strict";var xl=Mn(),to=_(),Tl=te(),qn=class{constructor(e){Object.defineProperty(this,to.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:r,onAnchor:i,reviver:o}={}){if(!to.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Tl.toJS(this,"",s);if(typeof i=="function")for(let{count:l,res:c}of s.anchors.values())i(c,l);return typeof o=="function"?xl.applyReviver(o,{"":a},"",a):a}};no.NodeBase=qn});var Be=v(ro=>{"use strict";var Rl=_t(),Ll=qe(),_e=_(),Dl=At(),Ml=te(),$n=class extends Dl.NodeBase{constructor(e){super(_e.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;t?.aliasResolveCache?r=t.aliasResolveCache:(r=[],Ll.visit(e,{Node:(o,s)=>{(_e.isAlias(s)||_e.hasAnchor(s))&&r.push(s)}}),t&&(t.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,t){if(!t)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:o}=t,s=this.resolve(i,t);if(!s){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=r.get(s);if(a||(Ml.toJS(s,null,t),a=r.get(s)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=It(i,s,r)),a.count*a.aliasCount>o)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,r){let i=`*${this.source}`;if(e){if(Rl.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function It(n,e,t){if(_e.isAlias(e)){let r=e.resolve(n),i=t&&r&&t.get(r);return i?i.count*i.aliasCount:0}else if(_e.isCollection(e)){let r=0;for(let i of e.items){let o=It(n,i,t);o>r&&(r=o)}return r}else if(_e.isPair(e)){let r=It(n,e.key,t),i=It(n,e.value,t);return Math.max(r,i)}return 1}ro.Alias=$n});var j=v(Fn=>{"use strict";var ql=_(),$l=At(),Fl=te(),Wl=n=>!n||typeof n!="function"&&typeof n!="object",ne=class extends $l.NodeBase{constructor(e){super(ql.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:Fl.toJS(this.value,e,t)}toString(){return String(this.value)}};ne.BLOCK_FOLDED="BLOCK_FOLDED";ne.BLOCK_LITERAL="BLOCK_LITERAL";ne.PLAIN="PLAIN";ne.QUOTE_DOUBLE="QUOTE_DOUBLE";ne.QUOTE_SINGLE="QUOTE_SINGLE";Fn.Scalar=ne;Fn.isScalarValue=Wl});var He=v(oo=>{"use strict";var Bl=Be(),he=_(),io=j(),Hl="tag:yaml.org,2002:";function Kl(n,e,t){if(e){let r=t.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(r=>r.identify?.(n)&&!r.format)}function Jl(n,e,t){if(he.isDocument(n)&&(n=n.contents),he.isNode(n))return n;if(he.isPair(n)){let f=t.schema[he.MAP].createNode?.(t.schema,null,t);return f.items.push(n),f}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=t,l;if(r&&n&&typeof n=="object"){if(l=a.get(n),l)return l.anchor??(l.anchor=i(n)),new Bl.Alias(l.anchor);l={anchor:null,node:null},a.set(n,l)}e?.startsWith("!!")&&(e=Hl+e.slice(2));let c=Kl(n,e,s.tags);if(!c){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){let f=new io.Scalar(n);return l&&(l.node=f),f}c=n instanceof Map?s[he.MAP]:Symbol.iterator in Object(n)?s[he.SEQ]:s[he.MAP]}o&&(o(c),delete t.onTagObj);let m=c?.createNode?c.createNode(t.schema,n,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,n,t):new io.Scalar(n);return e?m.tag=e:c.default||(m.tag=c.tag),l&&(l.node=m),m}oo.createNode=Jl});var Nt=v(Ot=>{"use strict";var zl=He(),U=_(),Ul=At();function Wn(n,e,t){let r=t;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=r,r=s}else r=new Map([[o,r]])}return zl.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}var so=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done,Bn=class extends Ul.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(r=>U.isNode(r)||U.isPair(r)?r.clone(e):r),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(so(e))this.add(t);else{let[r,...i]=e,o=this.get(r,!0);if(U.isCollection(o))o.addIn(i,t);else if(o===void 0&&this.schema)this.set(r,Wn(this.schema,i,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(U.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!t&&U.isScalar(o)?o.value:o:U.isCollection(o)?o.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!U.isPair(t))return!1;let r=t.value;return r==null||e&&U.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return U.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...i]=e;if(i.length===0)this.set(r,t);else{let o=this.get(r,!0);if(U.isCollection(o))o.setIn(i,t);else if(o===void 0&&this.schema)this.set(r,Wn(this.schema,i,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};Ot.Collection=Bn;Ot.collectionFromPath=Wn;Ot.isEmptyPath=so});var Ke=v(jt=>{"use strict";var Yl=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function Hn(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}var Vl=(n,e,t)=>n.endsWith(`
|
|
4
|
+
`)?Hn(t,e):t.includes(`
|
|
5
|
+
`)?`
|
|
6
|
+
`+Hn(t,e):(n.endsWith(" ")?"":" ")+t;jt.indentComment=Hn;jt.lineComment=Vl;jt.stringifyComment=Yl});var lo=v(Je=>{"use strict";var Gl="flow",Kn="block",xt="quoted";function Ql(n,e,t="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return n;i<o&&(o=0);let l=Math.max(1+o,1+i-e.length);if(n.length<=l)return n;let c=[],m={},f=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?c.push(0):f=i-r);let u,p,g=!1,d=-1,h=-1,w=-1;t===Kn&&(d=ao(n,d,e.length),d!==-1&&(f=d+l));for(let b;b=n[d+=1];){if(t===xt&&b==="\\"){switch(h=d,n[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}w=d}if(b===`
|
|
7
|
+
`)t===Kn&&(d=ao(n,d,e.length)),f=d+e.length+l,u=void 0;else{if(b===" "&&p&&p!==" "&&p!==`
|
|
8
|
+
`&&p!==" "){let k=n[d+1];k&&k!==" "&&k!==`
|
|
9
|
+
`&&k!==" "&&(u=d)}if(d>=f)if(u)c.push(u),f=u+l,u=void 0;else if(t===xt){for(;p===" "||p===" ";)p=b,b=n[d+=1],g=!0;let k=d>w+1?d-2:h-1;if(m[k])return n;c.push(k),m[k]=!0,f=k+l,u=void 0}else g=!0}p=b}if(g&&a&&a(),c.length===0)return n;s&&s();let y=n.slice(0,c[0]);for(let b=0;b<c.length;++b){let k=c[b],E=c[b+1]||n.length;k===0?y=`
|
|
10
|
+
${e}${n.slice(0,E)}`:(t===xt&&m[k]&&(y+=`${n[k]}\\`),y+=`
|
|
11
|
+
${e}${n.slice(k+1,E)}`)}return y}function ao(n,e,t){let r=e,i=e+1,o=n[i];for(;o===" "||o===" ";)if(e<i+t)o=n[++e];else{do o=n[++e];while(o&&o!==`
|
|
12
|
+
`);r=e,i=e+1,o=n[i]}return r}Je.FOLD_BLOCK=Kn;Je.FOLD_FLOW=Gl;Je.FOLD_QUOTED=xt;Je.foldFlowLines=Ql});var Ue=v(co=>{"use strict";var K=j(),re=lo(),Rt=(n,e)=>({indentAtStart:e?n.indent.length:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),Lt=n=>/^(%|---|\.\.\.)/m.test(n);function Xl(n,e,t){if(!e||e<0)return!1;let r=e-t,i=n.length;if(i<=r)return!1;for(let o=0,s=0;o<i;++o)if(n[o]===`
|
|
13
|
+
`){if(o-s>r)return!0;if(s=o+1,i-s<=r)return!1}return!0}function ze(n,e){let t=JSON.stringify(n);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Lt(n)?" ":""),s="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(s+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{s+=t.slice(a,l);let m=t.substr(l+2,4);switch(m){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:m.substr(0,2)==="00"?s+="\\x"+m.substr(2):s+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(r||t[l+2]==='"'||t.length<i)l+=1;else{for(s+=t.slice(a,l)+`
|
|
14
|
+
|
|
15
|
+
`;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)s+=`
|
|
16
|
+
`,l+=2;s+=o,t[l+2]===" "&&(s+="\\"),l+=1,a=l+1}break;default:l+=1}return s=a?s+t.slice(a):t,r?s:re.foldFlowLines(s,o,re.FOLD_QUOTED,Rt(e,!1))}function Jn(n,e){if(e.options.singleQuote===!1||e.implicitKey&&n.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test(n))return ze(n,e);let t=e.indent||(Lt(n)?" ":""),r="'"+n.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${t}`)+"'";return e.implicitKey?r:re.foldFlowLines(r,t,re.FOLD_FLOW,Rt(e,!1))}function Ae(n,e){let{singleQuote:t}=e.options,r;if(t===!1)r=ze;else{let i=n.includes('"'),o=n.includes("'");i&&!o?r=Jn:o&&!i?r=ze:r=t?Jn:ze}return r(n,e)}var zn;try{zn=new RegExp(`(^|(?<!
|
|
19
|
+
))
|
|
20
|
+
+(?!
|
|
21
|
+
|$)`,"g")}catch{zn=/\n+(?!\n|$)/g}function Tt({comment:n,type:e,value:t},r,i,o){let{blockQuote:s,commentString:a,lineWidth:l}=r.options;if(!s||/\n[\t ]+$/.test(t))return Ae(t,r);let c=r.indent||(r.forceBlockIndent||Lt(t)?" ":""),m=s==="literal"?!0:s==="folded"||e===K.Scalar.BLOCK_FOLDED?!1:e===K.Scalar.BLOCK_LITERAL?!0:!Xl(t,l,c.length);if(!t)return m?`|
|
|
22
|
+
`:`>
|
|
23
|
+
`;let f,u;for(u=t.length;u>0;--u){let E=t[u-1];if(E!==`
|
|
24
|
+
`&&E!==" "&&E!==" ")break}let p=t.substring(u),g=p.indexOf(`
|
|
25
|
+
`);g===-1?f="-":t===p||g!==p.length-1?(f="+",o&&o()):f="",p&&(t=t.slice(0,-p.length),p[p.length-1]===`
|
|
26
|
+
`&&(p=p.slice(0,-1)),p=p.replace(zn,`$&${c}`));let d=!1,h,w=-1;for(h=0;h<t.length;++h){let E=t[h];if(E===" ")d=!0;else if(E===`
|
|
27
|
+
`)w=h;else break}let y=t.substring(0,w<h?w+1:h);y&&(t=t.substring(y.length),y=y.replace(/\n+/g,`$&${c}`));let k=(d?c?"2":"1":"")+f;if(n&&(k+=" "+a(n.replace(/ ?[\r\n]+/g," ")),i&&i()),!m){let E=t.replace(/\n+/g,`
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),C=!1,P=Rt(r,!0);s!=="folded"&&e!==K.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{C=!0});let S=re.foldFlowLines(`${y}${E}${p}`,c,re.FOLD_BLOCK,P);if(!C)return`>${k}
|
|
29
|
+
${c}${S}`}return t=t.replace(/\n+/g,`$&${c}`),`|${k}
|
|
30
|
+
${c}${y}${t}${p}`}function Zl(n,e,t,r){let{type:i,value:o}=n,{actualString:s,implicitKey:a,indent:l,indentStep:c,inFlow:m}=e;if(a&&o.includes(`
|
|
31
|
+
`)||m&&/[[\]{},]/.test(o))return Ae(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||m||!o.includes(`
|
|
32
|
+
`)?Ae(o,e):Tt(n,e,t,r);if(!a&&!m&&i!==K.Scalar.PLAIN&&o.includes(`
|
|
33
|
+
`))return Tt(n,e,t,r);if(Lt(o)){if(l==="")return e.forceBlockIndent=!0,Tt(n,e,t,r);if(a&&l===c)return Ae(o,e)}let f=o.replace(/\n+/g,`$&
|
|
34
|
+
${l}`);if(s){let u=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(f),{compat:p,tags:g}=e.doc.schema;if(g.some(u)||p?.some(u))return Ae(o,e)}return a?f:re.foldFlowLines(f,l,re.FOLD_FLOW,Rt(e,!1))}function ec(n,e,t,r){let{implicitKey:i,inFlow:o}=e,s=typeof n.value=="string"?n:Object.assign({},n,{value:String(n.value)}),{type:a}=n;a!==K.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=K.Scalar.QUOTE_DOUBLE);let l=m=>{switch(m){case K.Scalar.BLOCK_FOLDED:case K.Scalar.BLOCK_LITERAL:return i||o?Ae(s.value,e):Tt(s,e,t,r);case K.Scalar.QUOTE_DOUBLE:return ze(s.value,e);case K.Scalar.QUOTE_SINGLE:return Jn(s.value,e);case K.Scalar.PLAIN:return Zl(s,e,t,r);default:return null}},c=l(a);if(c===null){let{defaultKeyType:m,defaultStringType:f}=e.options,u=i&&m||f;if(c=l(u),c===null)throw new Error(`Unsupported default string type ${u}`)}return c}co.stringifyString=ec});var Ye=v(Un=>{"use strict";var tc=_t(),ie=_(),nc=Ke(),rc=Ue();function ic(n,e){let t=Object.assign({blockQuote:!0,commentString:nc.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},n.schema.toStringOptions,e),r;switch(t.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:n,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:r,options:t}}function oc(n,e){if(e.tag){let i=n.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let t,r;if(ie.isScalar(e)){r=e.value;let i=n.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}t=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,t=n.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!t){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return t}function sc(n,e,{anchors:t,doc:r}){if(!r.directives)return"";let i=[],o=(ie.isScalar(n)||ie.isCollection(n))&&n.anchor;o&&tc.anchorIsValid(o)&&(t.add(o),i.push(`&${o}`));let s=n.tag??(e.default?null:e.tag);return s&&i.push(r.directives.tagString(s)),i.join(" ")}function ac(n,e,t,r){if(ie.isPair(n))return n.toString(e,t,r);if(ie.isAlias(n)){if(e.doc.directives)return n.toString(e);if(e.resolvedAliases?.has(n))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(n):e.resolvedAliases=new Set([n]),n=n.resolve(e.doc)}let i,o=ie.isNode(n)?n:e.doc.createNode(n,{onTagObj:l=>i=l});i??(i=oc(e.doc.schema.tags,o));let s=sc(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,t,r):ie.isScalar(o)?rc.stringifyString(o,e,t,r):o.toString(e,t,r);return s?ie.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
|
|
35
|
+
${e.indent}${a}`:a}Un.createStringifyContext=ic;Un.stringify=ac});var po=v(mo=>{"use strict";var Q=_(),uo=j(),fo=Ye(),Ve=Ke();function lc({key:n,value:e},t,r,i){let{allNullValues:o,doc:s,indent:a,indentStep:l,options:{commentString:c,indentSeq:m,simpleKeys:f}}=t,u=Q.isNode(n)&&n.comment||null;if(f){if(u)throw new Error("With simple keys, key nodes cannot have comments");if(Q.isCollection(n)||!Q.isNode(n)&&typeof n=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let p=!f&&(!n||u&&e==null&&!t.inFlow||Q.isCollection(n)||(Q.isScalar(n)?n.type===uo.Scalar.BLOCK_FOLDED||n.type===uo.Scalar.BLOCK_LITERAL:typeof n=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(f||!o),indent:a+l});let g=!1,d=!1,h=fo.stringify(n,t,()=>g=!0,()=>d=!0);if(!p&&!t.inFlow&&h.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(o||e==null)return g&&r&&r(),h===""?"?":p?`? ${h}`:h}else if(o&&!f||e==null&&p)return h=`? ${h}`,u&&!g?h+=Ve.lineComment(h,t.indent,c(u)):d&&i&&i(),h;g&&(u=null),p?(u&&(h+=Ve.lineComment(h,t.indent,c(u))),h=`? ${h}
|
|
36
|
+
${a}:`):(h=`${h}:`,u&&(h+=Ve.lineComment(h,t.indent,c(u))));let w,y,b;Q.isNode(e)?(w=!!e.spaceBefore,y=e.commentBefore,b=e.comment):(w=!1,y=null,b=null,e&&typeof e=="object"&&(e=s.createNode(e))),t.implicitKey=!1,!p&&!u&&Q.isScalar(e)&&(t.indentAtStart=h.length+1),d=!1,!m&&l.length>=2&&!t.inFlow&&!p&&Q.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let k=!1,E=fo.stringify(e,t,()=>k=!0,()=>d=!0),C=" ";if(u||w||y){if(C=w?`
|
|
37
|
+
`:"",y){let P=c(y);C+=`
|
|
38
|
+
${Ve.indentComment(P,t.indent)}`}E===""&&!t.inFlow?C===`
|
|
39
|
+
`&&b&&(C=`
|
|
40
|
+
|
|
41
|
+
`):C+=`
|
|
42
|
+
${t.indent}`}else if(!p&&Q.isCollection(e)){let P=E[0],S=E.indexOf(`
|
|
43
|
+
`),O=S!==-1,Z=t.inFlow??e.flow??e.items.length===0;if(O||!Z){let Ce=!1;if(O&&(P==="&"||P==="!")){let x=E.indexOf(" ");P==="&"&&x!==-1&&x<S&&E[x+1]==="!"&&(x=E.indexOf(" ",x+1)),(x===-1||S<x)&&(Ce=!0)}Ce||(C=`
|
|
44
|
+
${t.indent}`)}}else(E===""||E[0]===`
|
|
45
|
+
`)&&(C="");return h+=C+E,t.inFlow?k&&r&&r():b&&!k?h+=Ve.lineComment(h,t.indent,c(b)):d&&i&&i(),h}mo.stringifyPair=lc});var Vn=v(Yn=>{"use strict";var ho=kt("process");function cc(n,...e){n==="debug"&&console.log(...e)}function uc(n,e){(n==="debug"||n==="warn")&&(typeof ho.emitWarning=="function"?ho.emitWarning(e):console.warn(e))}Yn.debug=cc;Yn.warn=uc});var Ft=v($t=>{"use strict";var qt=_(),go=j(),Dt="<<",Mt={identify:n=>n===Dt||typeof n=="symbol"&&n.description===Dt,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new go.Scalar(Symbol(Dt)),{addToJSMap:wo}),stringify:()=>Dt},fc=(n,e)=>(Mt.identify(e)||qt.isScalar(e)&&(!e.type||e.type===go.Scalar.PLAIN)&&Mt.identify(e.value))&&n?.doc.schema.tags.some(t=>t.tag===Mt.tag&&t.default);function wo(n,e,t){let r=yo(n,t);if(qt.isSeq(r))for(let i of r.items)Gn(n,e,i);else if(Array.isArray(r))for(let i of r)Gn(n,e,i);else Gn(n,e,r)}function Gn(n,e,t){let r=yo(n,t);if(!qt.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,n,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function yo(n,e){return n&&qt.isAlias(e)?e.resolve(n.doc,n):e}$t.addMergeToJSMap=wo;$t.isMergeKey=fc;$t.merge=Mt});var Xn=v(vo=>{"use strict";var dc=Vn(),ko=Ft(),mc=Ye(),bo=_(),Qn=te();function pc(n,e,{key:t,value:r}){if(bo.isNode(t)&&t.addToJSMap)t.addToJSMap(n,e,r);else if(ko.isMergeKey(n,t))ko.addMergeToJSMap(n,e,r);else{let i=Qn.toJS(t,"",n);if(e instanceof Map)e.set(i,Qn.toJS(r,i,n));else if(e instanceof Set)e.add(i);else{let o=hc(t,i,n),s=Qn.toJS(r,o,n);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function hc(n,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(bo.isNode(n)&&t?.doc){let r=mc.createStringifyContext(t.doc,{});r.anchors=new Set;for(let o of t.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=n.toString(r);if(!t.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),dc.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}vo.addPairToJSMap=pc});var oe=v(Zn=>{"use strict";var So=He(),gc=po(),wc=Xn(),Wt=_();function yc(n,e,t){let r=So.createNode(n,void 0,t),i=So.createNode(e,void 0,t);return new Bt(r,i)}var Bt=class n{constructor(e,t=null){Object.defineProperty(this,Wt.NODE_TYPE,{value:Wt.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:r}=this;return Wt.isNode(t)&&(t=t.clone(e)),Wt.isNode(r)&&(r=r.clone(e)),new n(t,r)}toJSON(e,t){let r=t?.mapAsMap?new Map:{};return wc.addPairToJSMap(t,r,this)}toString(e,t,r){return e?.doc?gc.stringifyPair(this,e,t,r):JSON.stringify(this)}};Zn.Pair=Bt;Zn.createPair=yc});var er=v(Eo=>{"use strict";var ge=_(),Co=Ye(),Ht=Ke();function kc(n,e,t){return(e.inFlow??n.flow?vc:bc)(n,e,t)}function bc({comment:n,items:e},t,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:l,options:{commentString:c}}=t,m=Object.assign({},t,{indent:o,type:null}),f=!1,u=[];for(let g=0;g<e.length;++g){let d=e[g],h=null;if(ge.isNode(d))!f&&d.spaceBefore&&u.push(""),Kt(t,u,d.commentBefore,f),d.comment&&(h=d.comment);else if(ge.isPair(d)){let y=ge.isNode(d.key)?d.key:null;y&&(!f&&y.spaceBefore&&u.push(""),Kt(t,u,y.commentBefore,f))}f=!1;let w=Co.stringify(d,m,()=>h=null,()=>f=!0);h&&(w+=Ht.lineComment(w,o,c(h))),f&&h&&(f=!1),u.push(r+w)}let p;if(u.length===0)p=i.start+i.end;else{p=u[0];for(let g=1;g<u.length;++g){let d=u[g];p+=d?`
|
|
46
|
+
${l}${d}`:`
|
|
47
|
+
`}}return n?(p+=`
|
|
48
|
+
`+Ht.indentComment(c(n),l),a&&a()):f&&s&&s(),p}function vc({items:n},e,{flowChars:t,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;r+=o;let l=Object.assign({},e,{indent:r,inFlow:!0,type:null}),c=!1,m=0,f=[];for(let g=0;g<n.length;++g){let d=n[g],h=null;if(ge.isNode(d))d.spaceBefore&&f.push(""),Kt(e,f,d.commentBefore,!1),d.comment&&(h=d.comment);else if(ge.isPair(d)){let y=ge.isNode(d.key)?d.key:null;y&&(y.spaceBefore&&f.push(""),Kt(e,f,y.commentBefore,!1),y.comment&&(c=!0));let b=ge.isNode(d.value)?d.value:null;b?(b.comment&&(h=b.comment),b.commentBefore&&(c=!0)):d.value==null&&y?.comment&&(h=y.comment)}h&&(c=!0);let w=Co.stringify(d,l,()=>h=null);c||(c=f.length>m||w.includes(`
|
|
49
|
+
`)),g<n.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=f.reduce((y,b)=>y+b.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=",")),h&&(w+=Ht.lineComment(w,r,a(h))),f.push(w),m=f.length}let{start:u,end:p}=t;if(f.length===0)return u+p;if(!c){let g=f.reduce((d,h)=>d+h.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=u;for(let d of f)g+=d?`
|
|
50
|
+
${o}${i}${d}`:`
|
|
51
|
+
`;return`${g}
|
|
52
|
+
${i}${p}`}else return`${u}${s}${f.join(" ")}${s}${p}`}function Kt({indent:n,options:{commentString:e}},t,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=Ht.indentComment(e(r),n);t.push(o.trimStart())}}Eo.stringifyCollection=kc});var ae=v(nr=>{"use strict";var Sc=er(),Cc=Xn(),Ec=Nt(),se=_(),Jt=oe(),Pc=j();function Ge(n,e){let t=se.isScalar(e)?e.value:e;for(let r of n)if(se.isPair(r)&&(r.key===e||r.key===t||se.isScalar(r.key)&&r.key.value===t))return r}var tr=class extends Ec.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(se.MAP,e),this.items=[]}static from(e,t,r){let{keepUndefined:i,replacer:o}=r,s=new this(e),a=(l,c)=>{if(typeof o=="function")c=o.call(t,l,c);else if(Array.isArray(o)&&!o.includes(l))return;(c!==void 0||i)&&s.items.push(Jt.createPair(l,c,r))};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"&&s.items.sort(e.sortMapEntries),s}add(e,t){let r;se.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Jt.Pair(e,e?.value):r=new Jt.Pair(e.key,e.value);let i=Ge(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${r.key} already set`);se.isScalar(i.value)&&Pc.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let s=this.items.findIndex(a=>o(r,a)<0);s===-1?this.items.push(r):this.items.splice(s,0,r)}else this.items.push(r)}delete(e){let t=Ge(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let i=Ge(this.items,e)?.value;return(!t&&se.isScalar(i)?i.value:i)??void 0}has(e){return!!Ge(this.items,e)}set(e,t){this.add(new Jt.Pair(e,t),!0)}toJSON(e,t,r){let i=r?new r:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(let o of this.items)Cc.addPairToJSMap(t,i,o);return i}toString(e,t,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!se.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Sc.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}};nr.YAMLMap=tr;nr.findPair=Ge});var Ie=v(_o=>{"use strict";var _c=_(),Po=ae(),Ac={collection:"map",default:!0,nodeClass:Po.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(n,e){return _c.isMap(n)||e("Expected a mapping for this tag"),n},createNode:(n,e,t)=>Po.YAMLMap.from(n,e,t)};_o.map=Ac});var le=v(Ao=>{"use strict";var Ic=He(),Oc=er(),Nc=Nt(),Ut=_(),jc=j(),xc=te(),rr=class extends Nc.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ut.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=zt(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let r=zt(e);if(typeof r!="number")return;let i=this.items[r];return!t&&Ut.isScalar(i)?i.value:i}has(e){let t=zt(e);return typeof t=="number"&&t<this.items.length}set(e,t){let r=zt(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];Ut.isScalar(i)&&jc.isScalarValue(t)?i.value=t:this.items[r]=t}toJSON(e,t){let r=[];t?.onCreate&&t.onCreate(r);let i=0;for(let o of this.items)r.push(xc.toJS(o,String(i++),t));return r}toString(e,t,r){return e?Oc.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:t}):JSON.stringify(this)}static from(e,t,r){let{replacer:i}=r,o=new this(e);if(t&&Symbol.iterator in Object(t)){let s=0;for(let a of t){if(typeof i=="function"){let l=t instanceof Set?a:String(s++);a=i.call(t,l,a)}o.items.push(Ic.createNode(a,void 0,r))}}return o}};function zt(n){let e=Ut.isScalar(n)?n.value:n;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Ao.YAMLSeq=rr});var Oe=v(Oo=>{"use strict";var Tc=_(),Io=le(),Rc={collection:"seq",default:!0,nodeClass:Io.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(n,e){return Tc.isSeq(n)||e("Expected a sequence for this tag"),n},createNode:(n,e,t)=>Io.YAMLSeq.from(n,e,t)};Oo.seq=Rc});var Qe=v(No=>{"use strict";var Lc=Ue(),Dc={identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify(n,e,t,r){return e=Object.assign({actualString:!0},e),Lc.stringifyString(n,e,t,r)}};No.string=Dc});var Yt=v(To=>{"use strict";var jo=j(),xo={identify:n=>n==null,createNode:()=>new jo.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new jo.Scalar(null),stringify:({source:n},e)=>typeof n=="string"&&xo.test.test(n)?n:e.options.nullStr};To.nullTag=xo});var ir=v(Lo=>{"use strict";var Mc=j(),Ro={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new Mc.Scalar(n[0]==="t"||n[0]==="T"),stringify({source:n,value:e},t){if(n&&Ro.test.test(n)){let r=n[0]==="t"||n[0]==="T";if(e===r)return n}return e?t.options.trueStr:t.options.falseStr}};Lo.boolTag=Ro});var Ne=v(Do=>{"use strict";function qc({format:n,minFractionDigits:e,tag:t,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!n&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}Do.stringifyNumber=qc});var sr=v(Vt=>{"use strict";var $c=j(),or=Ne(),Fc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:or.stringifyNumber},Wc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():or.stringifyNumber(n)}},Bc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(n){let e=new $c.Scalar(parseFloat(n)),t=n.indexOf(".");return t!==-1&&n[n.length-1]==="0"&&(e.minFractionDigits=n.length-t-1),e},stringify:or.stringifyNumber};Vt.float=Bc;Vt.floatExp=Wc;Vt.floatNaN=Fc});var lr=v(Qt=>{"use strict";var Mo=Ne(),Gt=n=>typeof n=="bigint"||Number.isInteger(n),ar=(n,e,t,{intAsBigInt:r})=>r?BigInt(n):parseInt(n.substring(e),t);function qo(n,e,t){let{value:r}=n;return Gt(r)&&r>=0?t+r.toString(e):Mo.stringifyNumber(n)}var Hc={identify:n=>Gt(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(n,e,t)=>ar(n,2,8,t),stringify:n=>qo(n,8,"0o")},Kc={identify:Gt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(n,e,t)=>ar(n,0,10,t),stringify:Mo.stringifyNumber},Jc={identify:n=>Gt(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(n,e,t)=>ar(n,2,16,t),stringify:n=>qo(n,16,"0x")};Qt.int=Kc;Qt.intHex=Jc;Qt.intOct=Hc});var Fo=v($o=>{"use strict";var zc=Ie(),Uc=Yt(),Yc=Oe(),Vc=Qe(),Gc=ir(),cr=sr(),ur=lr(),Qc=[zc.map,Yc.seq,Vc.string,Uc.nullTag,Gc.boolTag,ur.intOct,ur.int,ur.intHex,cr.floatNaN,cr.floatExp,cr.float];$o.schema=Qc});var Ho=v(Bo=>{"use strict";var Xc=j(),Zc=Ie(),eu=Oe();function Wo(n){return typeof n=="bigint"||Number.isInteger(n)}var Xt=({value:n})=>JSON.stringify(n),tu=[{identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify:Xt},{identify:n=>n==null,createNode:()=>new Xc.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Xt},{identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:n=>n==="true",stringify:Xt},{identify:Wo,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(n,e,{intAsBigInt:t})=>t?BigInt(n):parseInt(n,10),stringify:({value:n})=>Wo(n)?n.toString():JSON.stringify(n)},{identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:n=>parseFloat(n),stringify:Xt}],nu={default:!0,tag:"",test:/^/,resolve(n,e){return e(`Unresolved plain scalar ${JSON.stringify(n)}`),n}},ru=[Zc.map,eu.seq].concat(tu,nu);Bo.schema=ru});var dr=v(Ko=>{"use strict";var Xe=kt("buffer"),fr=j(),iu=Ue(),ou={identify:n=>n instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(n,e){if(typeof Xe.Buffer=="function")return Xe.Buffer.from(n,"base64");if(typeof atob=="function"){let t=atob(n.replace(/[\n\r]/g,"")),r=new Uint8Array(t.length);for(let i=0;i<t.length;++i)r[i]=t.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),n},stringify({comment:n,type:e,value:t},r,i,o){if(!t)return"";let s=t,a;if(typeof Xe.Buffer=="function")a=s instanceof Xe.Buffer?s.toString("base64"):Xe.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<s.length;++c)l+=String.fromCharCode(s[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=fr.Scalar.BLOCK_LITERAL),e!==fr.Scalar.QUOTE_DOUBLE){let l=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),c=Math.ceil(a.length/l),m=new Array(c);for(let f=0,u=0;f<c;++f,u+=l)m[f]=a.substr(u,l);a=m.join(e===fr.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return iu.stringifyString({comment:n,type:e,value:a},r,i,o)}};Ko.binary=ou});var tn=v(en=>{"use strict";var Zt=_(),mr=oe(),su=j(),au=le();function Jo(n,e){if(Zt.isSeq(n))for(let t=0;t<n.items.length;++t){let r=n.items[t];if(!Zt.isPair(r)){if(Zt.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new mr.Pair(new su.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
|
|
54
|
+
${i.key.commentBefore}`:r.commentBefore),r.comment){let o=i.value??i.key;o.comment=o.comment?`${r.comment}
|
|
55
|
+
${o.comment}`:r.comment}r=i}n.items[t]=Zt.isPair(r)?r:new mr.Pair(r)}}else e("Expected a sequence for this tag");return n}function zo(n,e,t){let{replacer:r}=t,i=new au.YAMLSeq(n);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof r=="function"&&(s=r.call(e,String(o++),s));let a,l;if(Array.isArray(s))if(s.length===2)a=s[0],l=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let c=Object.keys(s);if(c.length===1)a=c[0],l=s[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=s;i.items.push(mr.createPair(a,l,t))}return i}var lu={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Jo,createNode:zo};en.createPairs=zo;en.pairs=lu;en.resolvePairs=Jo});var gr=v(hr=>{"use strict";var Uo=_(),pr=te(),Ze=ae(),cu=le(),Yo=tn(),we=class n extends cu.YAMLSeq{constructor(){super(),this.add=Ze.YAMLMap.prototype.add.bind(this),this.delete=Ze.YAMLMap.prototype.delete.bind(this),this.get=Ze.YAMLMap.prototype.get.bind(this),this.has=Ze.YAMLMap.prototype.has.bind(this),this.set=Ze.YAMLMap.prototype.set.bind(this),this.tag=n.tag}toJSON(e,t){if(!t)return super.toJSON(e);let r=new Map;t?.onCreate&&t.onCreate(r);for(let i of this.items){let o,s;if(Uo.isPair(i)?(o=pr.toJS(i.key,"",t),s=pr.toJS(i.value,o,t)):o=pr.toJS(i,"",t),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(e,t,r){let i=Yo.createPairs(e,t,r),o=new this;return o.items=i.items,o}};we.tag="tag:yaml.org,2002:omap";var uu={collection:"seq",identify:n=>n instanceof Map,nodeClass:we,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){let t=Yo.resolvePairs(n,e),r=[];for(let{key:i}of t.items)Uo.isScalar(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new we,t)},createNode:(n,e,t)=>we.from(n,e,t)};hr.YAMLOMap=we;hr.omap=uu});var Zo=v(wr=>{"use strict";var Vo=j();function Go({value:n,source:e},t){return e&&(n?Qo:Xo).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}var Qo={identify:n=>n===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Vo.Scalar(!0),stringify:Go},Xo={identify:n=>n===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Vo.Scalar(!1),stringify:Go};wr.falseTag=Xo;wr.trueTag=Qo});var es=v(nn=>{"use strict";var fu=j(),yr=Ne(),du={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:yr.stringifyNumber},mu={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n.replace(/_/g,"")),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():yr.stringifyNumber(n)}},pu={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(n){let e=new fu.Scalar(parseFloat(n.replace(/_/g,""))),t=n.indexOf(".");if(t!==-1){let r=n.substring(t+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:yr.stringifyNumber};nn.float=pu;nn.floatExp=mu;nn.floatNaN=du});var ns=v(tt=>{"use strict";var ts=Ne(),et=n=>typeof n=="bigint"||Number.isInteger(n);function rn(n,e,t,{intAsBigInt:r}){let i=n[0];if((i==="-"||i==="+")&&(e+=1),n=n.substring(e).replace(/_/g,""),r){switch(t){case 2:n=`0b${n}`;break;case 8:n=`0o${n}`;break;case 16:n=`0x${n}`;break}let s=BigInt(n);return i==="-"?BigInt(-1)*s:s}let o=parseInt(n,t);return i==="-"?-1*o:o}function kr(n,e,t){let{value:r}=n;if(et(r)){let i=r.toString(e);return r<0?"-"+t+i.substr(1):t+i}return ts.stringifyNumber(n)}var hu={identify:et,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>rn(n,2,2,t),stringify:n=>kr(n,2,"0b")},gu={identify:et,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>rn(n,1,8,t),stringify:n=>kr(n,8,"0")},wu={identify:et,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>rn(n,0,10,t),stringify:ts.stringifyNumber},yu={identify:et,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>rn(n,2,16,t),stringify:n=>kr(n,16,"0x")};tt.int=wu;tt.intBin=hu;tt.intHex=yu;tt.intOct=gu});var vr=v(br=>{"use strict";var an=_(),on=oe(),sn=ae(),ye=class n extends sn.YAMLMap{constructor(e){super(e),this.tag=n.tag}add(e){let t;an.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new on.Pair(e.key,null):t=new on.Pair(e,null),sn.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let r=sn.findPair(this.items,e);return!t&&an.isPair(r)?an.isScalar(r.key)?r.key.value:r.key:r}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let r=sn.findPair(this.items,e);r&&!t?this.items.splice(this.items.indexOf(r),1):!r&&t&&this.items.push(new on.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,r);throw new Error("Set items must all have null values")}static from(e,t,r){let{replacer:i}=r,o=new this(e);if(t&&Symbol.iterator in Object(t))for(let s of t)typeof i=="function"&&(s=i.call(t,s,s)),o.items.push(on.createPair(s,null,r));return o}};ye.tag="tag:yaml.org,2002:set";var ku={collection:"map",identify:n=>n instanceof Set,nodeClass:ye,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>ye.from(n,e,t),resolve(n,e){if(an.isMap(n)){if(n.hasAllNullValues(!0))return Object.assign(new ye,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};br.YAMLSet=ye;br.set=ku});var Cr=v(ln=>{"use strict";var bu=Ne();function Sr(n,e){let t=n[0],r=t==="-"||t==="+"?n.substring(1):n,i=s=>e?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return t==="-"?i(-1)*o:o}function rs(n){let{value:e}=n,t=s=>s;if(typeof e=="bigint")t=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return bu.stringifyNumber(n);let r="";e<0&&(r="-",e*=t(-1));let i=t(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var vu={identify:n=>typeof n=="bigint"||Number.isInteger(n),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(n,e,{intAsBigInt:t})=>Sr(n,t),stringify:rs},Su={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:n=>Sr(n,!1),stringify:rs},is={identify:n=>n instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(n){let e=n.match(is.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,r,i,o,s,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,r-1,i,o||0,s||0,a||0,l),m=e[8];if(m&&m!=="Z"){let f=Sr(m,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:n})=>n?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ln.floatTime=Su;ln.intTime=vu;ln.timestamp=is});var as=v(ss=>{"use strict";var Cu=Ie(),Eu=Yt(),Pu=Oe(),_u=Qe(),Au=dr(),os=Zo(),Er=es(),cn=ns(),Iu=Ft(),Ou=gr(),Nu=tn(),ju=vr(),Pr=Cr(),xu=[Cu.map,Pu.seq,_u.string,Eu.nullTag,os.trueTag,os.falseTag,cn.intBin,cn.intOct,cn.int,cn.intHex,Er.floatNaN,Er.floatExp,Er.float,Au.binary,Iu.merge,Ou.omap,Nu.pairs,ju.set,Pr.intTime,Pr.floatTime,Pr.timestamp];ss.schema=xu});var ws=v(Ir=>{"use strict";var fs=Ie(),Tu=Yt(),ds=Oe(),Ru=Qe(),Lu=ir(),_r=sr(),Ar=lr(),Du=Fo(),Mu=Ho(),ms=dr(),nt=Ft(),ps=gr(),hs=tn(),ls=as(),gs=vr(),un=Cr(),cs=new Map([["core",Du.schema],["failsafe",[fs.map,ds.seq,Ru.string]],["json",Mu.schema],["yaml11",ls.schema],["yaml-1.1",ls.schema]]),us={binary:ms.binary,bool:Lu.boolTag,float:_r.float,floatExp:_r.floatExp,floatNaN:_r.floatNaN,floatTime:un.floatTime,int:Ar.int,intHex:Ar.intHex,intOct:Ar.intOct,intTime:un.intTime,map:fs.map,merge:nt.merge,null:Tu.nullTag,omap:ps.omap,pairs:hs.pairs,seq:ds.seq,set:gs.set,timestamp:un.timestamp},qu={"tag:yaml.org,2002:binary":ms.binary,"tag:yaml.org,2002:merge":nt.merge,"tag:yaml.org,2002:omap":ps.omap,"tag:yaml.org,2002:pairs":hs.pairs,"tag:yaml.org,2002:set":gs.set,"tag:yaml.org,2002:timestamp":un.timestamp};function $u(n,e,t){let r=cs.get(e);if(r&&!n)return t&&!r.includes(nt.merge)?r.concat(nt.merge):r.slice();let i=r;if(!i)if(Array.isArray(n))i=[];else{let o=Array.from(cs.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(n))for(let o of n)i=i.concat(o);else typeof n=="function"&&(i=n(i.slice()));return t&&(i=i.concat(nt.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?us[s]:s;if(!a){let l=JSON.stringify(s),c=Object.keys(us).map(m=>JSON.stringify(m)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return o.includes(a)||o.push(a),o},[])}Ir.coreKnownTags=qu;Ir.getTags=$u});var jr=v(ys=>{"use strict";var Or=_(),Fu=Ie(),Wu=Oe(),Bu=Qe(),fn=ws(),Hu=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0,Nr=class n{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?fn.getTags(e,"compat"):e?fn.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?fn.coreKnownTags:{},this.tags=fn.getTags(t,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Or.MAP,{value:Fu.map}),Object.defineProperty(this,Or.SCALAR,{value:Bu.string}),Object.defineProperty(this,Or.SEQ,{value:Wu.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Hu:null}clone(){let e=Object.create(n.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};ys.Schema=Nr});var bs=v(ks=>{"use strict";var Ku=_(),xr=Ye(),rt=Ke();function Ju(n,e){let t=[],r=e.directives===!0;if(e.directives!==!1&&n.directives){let l=n.directives.toString(n);l?(t.push(l),r=!0):n.directives.docStart&&(r=!0)}r&&t.push("---");let i=xr.createStringifyContext(n,e),{commentString:o}=i.options;if(n.commentBefore){t.length!==1&&t.unshift("");let l=o(n.commentBefore);t.unshift(rt.indentComment(l,""))}let s=!1,a=null;if(n.contents){if(Ku.isNode(n.contents)){if(n.contents.spaceBefore&&r&&t.push(""),n.contents.commentBefore){let m=o(n.contents.commentBefore);t.push(rt.indentComment(m,""))}i.forceBlockIndent=!!n.comment,a=n.contents.comment}let l=a?void 0:()=>s=!0,c=xr.stringify(n.contents,i,()=>a=null,l);a&&(c+=rt.lineComment(c,"",o(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(xr.stringify(n.contents,i));if(n.directives?.docEnd)if(n.comment){let l=o(n.comment);l.includes(`
|
|
56
|
+
`)?(t.push("..."),t.push(rt.indentComment(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=n.comment;l&&s&&(l=l.replace(/^\n+/,"")),l&&((!s||a)&&t[t.length-1]!==""&&t.push(""),t.push(rt.indentComment(o(l),"")))}return t.join(`
|
|
57
|
+
`)+`
|
|
58
|
+
`}ks.stringifyDocument=Ju});var it=v(vs=>{"use strict";var zu=Be(),je=Nt(),H=_(),Uu=oe(),Yu=te(),Vu=jr(),Gu=bs(),Tr=_t(),Qu=Mn(),Xu=He(),Rr=Dn(),Lr=class n{constructor(e,t,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,H.NODE_TYPE,{value:H.DOC});let i=null;typeof t=="function"||Array.isArray(t)?i=t:r===void 0&&t&&(r=t,t=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:s}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new Rr.Directives({version:s}),this.setSchema(s,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(n.prototype,{[H.NODE_TYPE]:{value:H.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=H.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){xe(this.contents)&&this.contents.add(e)}addIn(e,t){xe(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let r=Tr.anchorNames(this);e.anchor=!t||r.has(t)?Tr.findNewAnchor(t||"a",r):t}return new zu.Alias(e.anchor)}createNode(e,t,r){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){let h=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=t.filter(h).map(String);w.length>0&&(t=t.concat(w)),i=t}else r===void 0&&t&&(r=t,t=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:l,onTagObj:c,tag:m}=r??{},{onAnchor:f,setAnchors:u,sourceObjects:p}=Tr.createNodeAnchors(this,s||"a"),g={aliasDuplicateObjects:o??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},d=Xu.createNode(e,m,g);return a&&H.isCollection(d)&&(d.flow=!0),u(),d}createPair(e,t,r={}){let i=this.createNode(e,null,r),o=this.createNode(t,null,r);return new Uu.Pair(i,o)}delete(e){return xe(this.contents)?this.contents.delete(e):!1}deleteIn(e){return je.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):xe(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return H.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return je.isEmptyPath(e)?!t&&H.isScalar(this.contents)?this.contents.value:this.contents:H.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return H.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return je.isEmptyPath(e)?this.contents!==void 0:H.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=je.collectionFromPath(this.schema,[e],t):xe(this.contents)&&this.contents.set(e,t)}setIn(e,t){je.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=je.collectionFromPath(this.schema,Array.from(e),t):xe(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Rr.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Rr.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(r)this.schema=new Vu.Schema(Object.assign(r,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=Yu.toJS(this.contents,t??"",a);if(typeof o=="function")for(let{count:c,res:m}of a.anchors.values())o(m,c);return typeof s=="function"?Qu.applyReviver(s,{"":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 Gu.stringifyDocument(this,e)}};function xe(n){if(H.isCollection(n))return!0;throw new Error("Expected a YAML collection as document contents")}vs.Document=Lr});var at=v(st=>{"use strict";var ot=class extends Error{constructor(e,t,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=t}},Dr=class extends ot{constructor(e,t,r){super("YAMLParseError",e,t,r)}},Mr=class extends ot{constructor(e,t,r){super("YAMLWarning",e,t,r)}},Zu=(n,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:r,col:i}=t.linePos[0];t.message+=` at line ${r}, column ${i}`;let o=i-1,s=n.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(s.substring(0,o))){let a=n.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
59
|
+
`),s=a+s}if(/[^ ]/.test(s)){let a=1,l=t.linePos[1];l?.line===r&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-o)));let c=" ".repeat(o)+"^".repeat(a);t.message+=`:
|
|
60
|
+
|
|
61
|
+
${s}
|
|
62
|
+
${c}
|
|
63
|
+
`}};st.YAMLError=ot;st.YAMLParseError=Dr;st.YAMLWarning=Mr;st.prettifyError=Zu});var lt=v(Ss=>{"use strict";function ef(n,{flow:e,indicator:t,next:r,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let l=!1,c=a,m=a,f="",u="",p=!1,g=!1,d=null,h=null,w=null,y=null,b=null,k=null,E=null;for(let S of n)switch(g&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&o(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),d&&(c&&S.type!=="comment"&&S.type!=="newline"&&o(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),d=null),S.type){case"space":!e&&(t!=="doc-start"||r?.type!=="flow-collection")&&S.source.includes(" ")&&(d=S),m=!0;break;case"comment":{m||o(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let O=S.source.substring(1)||" ";f?f+=u+O:f=O,u="",c=!1;break}case"newline":c?f?f+=S.source:(!k||t!=="seq-item-ind")&&(l=!0):u+=S.source,c=!0,p=!0,(h||w)&&(y=S),m=!0;break;case"anchor":h&&o(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&o(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=S,E??(E=S.offset),c=!1,m=!1,g=!0;break;case"tag":{w&&o(S,"MULTIPLE_TAGS","A node can have at most one tag"),w=S,E??(E=S.offset),c=!1,m=!1,g=!0;break}case t:(h||w)&&o(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),k&&o(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${e??"collection"}`),k=S,c=t==="seq-item-ind"||t==="explicit-key-ind",m=!1;break;case"comma":if(e){b&&o(S,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=S,c=!1,m=!1;break}default:o(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),c=!1,m=!1}let C=n[n.length-1],P=C?C.offset+C.source.length:i;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d&&(c&&d.indent<=s||r?.type==="block-map"||r?.type==="block-seq")&&o(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:k,spaceBefore:l,comment:f,hasNewline:p,anchor:h,tag:w,newlineAfterProp:y,end:P,start:E??P}}Ss.resolveProps=ef});var dn=v(Cs=>{"use strict";function qr(n){if(!n)return null;switch(n.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(n.source.includes(`
|
|
64
|
+
`))return!0;if(n.end){for(let e of n.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of n.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(qr(e.key)||qr(e.value))return!0}return!1;default:return!0}}Cs.containsNewline=qr});var $r=v(Es=>{"use strict";var tf=dn();function nf(n,e,t){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===n&&(r.source==="]"||r.source==="}")&&tf.containsNewline(e)&&t(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Es.flowIndentCheck=nf});var Fr=v(_s=>{"use strict";var Ps=_();function rf(n,e,t){let{uniqueKeys:r}=n.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,s)=>o===s||Ps.isScalar(o)&&Ps.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,t))}_s.mapIncludes=rf});var xs=v(js=>{"use strict";var As=oe(),of=ae(),Is=lt(),sf=dn(),Os=$r(),af=Fr(),Ns="All mapping items must start at the same column";function lf({composeNode:n,composeEmptyNode:e},t,r,i,o){let s=o?.nodeClass??of.YAMLMap,a=new s(t.schema);t.atRoot&&(t.atRoot=!1);let l=r.offset,c=null;for(let m of r.items){let{start:f,key:u,sep:p,value:g}=m,d=Is.resolveProps(f,{indicator:"explicit-key-ind",next:u??p?.[0],offset:l,onError:i,parentIndent:r.indent,startOnNewline:!0}),h=!d.found;if(h){if(u&&(u.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==r.indent&&i(l,"BAD_INDENT",Ns)),!d.anchor&&!d.tag&&!p){c=d.end,d.comment&&(a.comment?a.comment+=`
|
|
65
|
+
`+d.comment:a.comment=d.comment);continue}(d.newlineAfterProp||sf.containsNewline(u))&&i(u??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else d.found?.indent!==r.indent&&i(l,"BAD_INDENT",Ns);t.atKey=!0;let w=d.end,y=u?n(t,u,d,i):e(t,w,f,null,d,i);t.schema.compat&&Os.flowIndentCheck(r.indent,u,i),t.atKey=!1,af.mapIncludes(t,a.items,y)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let b=Is.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type==="block-scalar"});if(l=b.end,b.found){h&&(g?.type==="block-map"&&!b.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&d.start<b.found.offset-1024&&i(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=g?n(t,g,b,i):e(t,l,p,null,b,i);t.schema.compat&&Os.flowIndentCheck(r.indent,g,i),l=k.range[2];let E=new As.Pair(y,k);t.options.keepSourceTokens&&(E.srcToken=m),a.items.push(E)}else{h&&i(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(y.comment?y.comment+=`
|
|
66
|
+
`+b.comment:y.comment=b.comment);let k=new As.Pair(y);t.options.keepSourceTokens&&(k.srcToken=m),a.items.push(k)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,l,c??l],a}js.resolveBlockMap=lf});var Rs=v(Ts=>{"use strict";var cf=le(),uf=lt(),ff=$r();function df({composeNode:n,composeEmptyNode:e},t,r,i,o){let s=o?.nodeClass??cf.YAMLSeq,a=new s(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=r.offset,c=null;for(let{start:m,value:f}of r.items){let u=uf.resolveProps(m,{indicator:"seq-item-ind",next:f,offset:l,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||f)f?.type==="block-seq"?i(u.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=u.end,u.comment&&(a.comment=u.comment);continue}let p=f?n(t,f,u,i):e(t,u.end,m,null,u,i);t.schema.compat&&ff.flowIndentCheck(r.indent,f,i),l=p.range[2],a.items.push(p)}return a.range=[r.offset,l,c??l],a}Ts.resolveBlockSeq=df});var Te=v(Ls=>{"use strict";function mf(n,e,t,r){let i="";if(n){let o=!1,s="";for(let a of n){let{source:l,type:c}=a;switch(c){case"space":o=!0;break;case"comment":{t&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let m=l.substring(1)||" ";i?i+=s+m:i=m,s="";break}case"newline":i&&(s+=l),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}Ls.resolveEnd=mf});var $s=v(qs=>{"use strict";var pf=_(),hf=oe(),Ds=ae(),gf=le(),wf=Te(),Ms=lt(),yf=dn(),kf=Fr(),Wr="Block collections are not allowed within flow collections",Br=n=>n&&(n.type==="block-map"||n.type==="block-seq");function bf({composeNode:n,composeEmptyNode:e},t,r,i,o){let s=r.start.source==="{",a=s?"flow map":"flow sequence",l=o?.nodeClass??(s?Ds.YAMLMap:gf.YAMLSeq),c=new l(t.schema);c.flow=!0;let m=t.atRoot;m&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let f=r.offset+r.start.source.length;for(let h=0;h<r.items.length;++h){let w=r.items[h],{start:y,key:b,sep:k,value:E}=w,C=Ms.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:b??k?.[0],offset:f,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!C.found){if(!C.anchor&&!C.tag&&!k&&!E){h===0&&C.comma?i(C.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<r.items.length-1&&i(C.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),C.comment&&(c.comment?c.comment+=`
|
|
67
|
+
`+C.comment:c.comment=C.comment),f=C.end;continue}!s&&t.options.strict&&yf.containsNewline(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)C.comma&&i(C.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(C.comma||i(C.start,"MISSING_CHAR",`Missing , between ${a} items`),C.comment){let P="";e:for(let S of y)switch(S.type){case"comma":case"space":break;case"comment":P=S.source.substring(1);break e;default:break e}if(P){let S=c.items[c.items.length-1];pf.isPair(S)&&(S=S.value??S.key),S.comment?S.comment+=`
|
|
68
|
+
`+P:S.comment=P,C.comment=C.comment.substring(P.length+1)}}if(!s&&!k&&!C.found){let P=E?n(t,E,C,i):e(t,C.end,k,null,C,i);c.items.push(P),f=P.range[2],Br(E)&&i(P.range,"BLOCK_IN_FLOW",Wr)}else{t.atKey=!0;let P=C.end,S=b?n(t,b,C,i):e(t,P,y,null,C,i);Br(b)&&i(S.range,"BLOCK_IN_FLOW",Wr),t.atKey=!1;let O=Ms.resolveProps(k??[],{flow:a,indicator:"map-value-ind",next:E,offset:S.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(O.found){if(!s&&!C.found&&t.options.strict){if(k)for(let x of k){if(x===O.found)break;if(x.type==="newline"){i(x,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}C.start<O.found.offset-1024&&i(O.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?i(E,"MISSING_CHAR",`Missing space after : in ${a}`):i(O.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let Z=E?n(t,E,O,i):O.found?e(t,O.end,k,null,O,i):null;Z?Br(E)&&i(Z.range,"BLOCK_IN_FLOW",Wr):O.comment&&(S.comment?S.comment+=`
|
|
69
|
+
`+O.comment:S.comment=O.comment);let Ce=new hf.Pair(S,Z);if(t.options.keepSourceTokens&&(Ce.srcToken=w),s){let x=c;kf.mapIncludes(t,x.items,S)&&i(P,"DUPLICATE_KEY","Map keys must be unique"),x.items.push(Ce)}else{let x=new Ds.YAMLMap(t.schema);x.flow=!0,x.items.push(Ce);let Oi=(Z??S).range;x.range=[S.range[0],Oi[1],Oi[2]],c.items.push(x)}f=Z?Z.range[2]:O.end}}let u=s?"}":"]",[p,...g]=r.end,d=f;if(p?.source===u)d=p.offset+p.source.length;else{let h=a[0].toUpperCase()+a.substring(1),w=m?`${h} must end with a ${u}`:`${h} in block collection must be sufficiently indented and end with a ${u}`;i(f,m?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&g.unshift(p)}if(g.length>0){let h=wf.resolveEnd(g,d,t.options.strict,i);h.comment&&(c.comment?c.comment+=`
|
|
70
|
+
`+h.comment:c.comment=h.comment),c.range=[r.offset,d,h.offset]}else c.range=[r.offset,d,d];return c}qs.resolveFlowCollection=bf});var Ws=v(Fs=>{"use strict";var vf=_(),Sf=j(),Cf=ae(),Ef=le(),Pf=xs(),_f=Rs(),Af=$s();function Hr(n,e,t,r,i,o){let s=t.type==="block-map"?Pf.resolveBlockMap(n,e,t,r,o):t.type==="block-seq"?_f.resolveBlockSeq(n,e,t,r,o):Af.resolveFlowCollection(n,e,t,r,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function If(n,e,t,r,i){let o=r.tag,s=o?e.directives.tagName(o.source,u=>i(o,"TAG_RESOLVE_FAILED",u)):null;if(t.type==="block-seq"){let{anchor:u,newlineAfterProp:p}=r,g=u&&o?u.offset>o.offset?u:o:u??o;g&&(!p||p.offset<g.offset)&&i(g,"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(!o||!s||s==="!"||s===Cf.YAMLMap.tagName&&a==="map"||s===Ef.YAMLSeq.tagName&&a==="seq")return Hr(n,e,t,i,s);let l=e.schema.tags.find(u=>u.tag===s&&u.collection===a);if(!l){let u=e.schema.knownTags[s];if(u?.collection===a)e.schema.tags.push(Object.assign({},u,{default:!1})),l=u;else return u?i(o,"BAD_COLLECTION_TYPE",`${u.tag} used for ${a} collection, but expects ${u.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),Hr(n,e,t,i,s)}let c=Hr(n,e,t,i,s,l),m=l.resolve?.(c,u=>i(o,"TAG_RESOLVE_FAILED",u),e.options)??c,f=vf.isNode(m)?m:new Sf.Scalar(m);return f.range=c.range,f.tag=s,l?.format&&(f.format=l.format),f}Fs.composeCollection=If});var Jr=v(Bs=>{"use strict";var Kr=j();function Of(n,e,t){let r=e.offset,i=Nf(e,n.options.strict,t);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?Kr.Scalar.BLOCK_FOLDED:Kr.Scalar.BLOCK_LITERAL,s=e.source?jf(e.source):[],a=s.length;for(let d=s.length-1;d>=0;--d){let h=s[d][1];if(h===""||h==="\r")a=d;else break}if(a===0){let d=i.chomp==="+"&&s.length>0?`
|
|
71
|
+
`.repeat(Math.max(1,s.length-1)):"",h=r+i.length;return e.source&&(h+=e.source.length),{value:d,type:o,comment:i.comment,range:[r,h,h]}}let l=e.indent+i.indent,c=e.offset+i.length,m=0;for(let d=0;d<a;++d){let[h,w]=s[d];if(w===""||w==="\r")i.indent===0&&h.length>l&&(l=h.length);else{h.length<l&&t(c+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(l=h.length),m=d,l===0&&!n.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=h.length+w.length+1}for(let d=s.length-1;d>=a;--d)s[d][0].length>l&&(a=d+1);let f="",u="",p=!1;for(let d=0;d<m;++d)f+=s[d][0].slice(l)+`
|
|
72
|
+
`;for(let d=m;d<a;++d){let[h,w]=s[d];c+=h.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&h.length<l){let k=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;t(c-w.length-(y?2:1),"BAD_INDENT",k),h=""}o===Kr.Scalar.BLOCK_LITERAL?(f+=u+h.slice(l)+w,u=`
|
|
73
|
+
`):h.length>l||w[0]===" "?(u===" "?u=`
|
|
74
|
+
`:!p&&u===`
|
|
75
|
+
`&&(u=`
|
|
76
|
+
|
|
77
|
+
`),f+=u+h.slice(l)+w,u=`
|
|
78
|
+
`,p=!0):w===""?u===`
|
|
79
|
+
`?f+=`
|
|
80
|
+
`:u=`
|
|
81
|
+
`:(f+=u+w,u=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let d=a;d<s.length;++d)f+=`
|
|
82
|
+
`+s[d][0].slice(l);f[f.length-1]!==`
|
|
83
|
+
`&&(f+=`
|
|
84
|
+
`);break;default:f+=`
|
|
85
|
+
`}let g=r+i.length+e.source.length;return{value:f,type:o,comment:i.comment,range:[r,g,g]}}function Nf({offset:n,props:e},t,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",l=-1;for(let u=1;u<i.length;++u){let p=i[u];if(!a&&(p==="-"||p==="+"))a=p;else{let g=Number(p);!s&&g?s=g:l===-1&&(l=n+u)}}l!==-1&&r(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,m="",f=i.length;for(let u=1;u<e.length;++u){let p=e[u];switch(p.type){case"space":c=!0;case"newline":f+=p.source.length;break;case"comment":t&&!c&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,m=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{let g=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",g);let d=p.source;d&&typeof d=="string"&&(f+=d.length)}}}return{mode:o,indent:s,chomp:a,comment:m,length:f}}function jf(n){let e=n.split(/\n( *)/),t=e[0],r=t.match(/^( *)/),o=[r?.[1]?[r[1],t.slice(r[1].length)]:["",t]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}Bs.resolveBlockScalar=Of});var Ur=v(Ks=>{"use strict";var zr=j(),xf=Te();function Tf(n,e,t){let{offset:r,type:i,source:o,end:s}=n,a,l,c=(u,p,g)=>t(r+u,p,g);switch(i){case"scalar":a=zr.Scalar.PLAIN,l=Rf(o,c);break;case"single-quoted-scalar":a=zr.Scalar.QUOTE_SINGLE,l=Lf(o,c);break;case"double-quoted-scalar":a=zr.Scalar.QUOTE_DOUBLE,l=Df(o,c);break;default:return t(n,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let m=r+o.length,f=xf.resolveEnd(s,m,e,t);return{value:l,type:a,comment:f.comment,range:[r,m,f.offset]}}function Rf(n,e){let t="";switch(n[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 ${n[0]}`;break}case"@":case"`":{t=`reserved character ${n[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Hs(n)}function Lf(n,e){return(n[n.length-1]!=="'"||n.length===1)&&e(n.length,"MISSING_CHAR","Missing closing 'quote"),Hs(n.slice(1,-1)).replace(/''/g,"'")}function Hs(n){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
86
|
+
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
87
|
+
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(n);if(!r)return n;let i=r[1],o=" ",s=e.lastIndex;for(t.lastIndex=s;r=t.exec(n);)r[1]===""?o===`
|
|
88
|
+
`?i+=o:o=`
|
|
89
|
+
`:(i+=o+r[1],o=" "),s=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,r=a.exec(n),i+o+(r?.[1]??"")}function Df(n,e){let t="";for(let r=1;r<n.length-1;++r){let i=n[r];if(!(i==="\r"&&n[r+1]===`
|
|
90
|
+
`))if(i===`
|
|
91
|
+
`){let{fold:o,offset:s}=Mf(n,r);t+=o,r=s}else if(i==="\\"){let o=n[++r],s=qf[o];if(s)t+=s;else if(o===`
|
|
92
|
+
`)for(o=n[r+1];o===" "||o===" ";)o=n[++r+1];else if(o==="\r"&&n[r+1]===`
|
|
93
|
+
`)for(o=n[++r+1];o===" "||o===" ";)o=n[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;t+=$f(n,r+1,a,e),r+=a}else{let a=n.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(i===" "||i===" "){let o=r,s=n[r+1];for(;s===" "||s===" ";)s=n[++r+1];s!==`
|
|
94
|
+
`&&!(s==="\r"&&n[r+2]===`
|
|
95
|
+
`)&&(t+=r>o?n.slice(o,r+1):i)}else t+=i}return(n[n.length-1]!=='"'||n.length===1)&&e(n.length,"MISSING_CHAR",'Missing closing "quote'),t}function Mf(n,e){let t="",r=n[e+1];for(;(r===" "||r===" "||r===`
|
|
96
|
+
`||r==="\r")&&!(r==="\r"&&n[e+2]!==`
|
|
97
|
+
`);)r===`
|
|
98
|
+
`&&(t+=`
|
|
99
|
+
`),e+=1,r=n[e+1];return t||(t=" "),{fold:t,offset:e}}var qf={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
100
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function $f(n,e,t,r){let i=n.substr(e,t),s=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=n.substr(e-2,t+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Ks.resolveFlowScalar=Tf});var Us=v(zs=>{"use strict";var ke=_(),Js=j(),Ff=Jr(),Wf=Ur();function Bf(n,e,t,r){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Ff.resolveBlockScalar(n,e,r):Wf.resolveFlowScalar(e,n.options.strict,r),l=t?n.directives.tagName(t.source,f=>r(t,"TAG_RESOLVE_FAILED",f)):null,c;n.options.stringKeys&&n.atKey?c=n.schema[ke.SCALAR]:l?c=Hf(n.schema,i,l,t,r):e.type==="scalar"?c=Kf(n,i,e,r):c=n.schema[ke.SCALAR];let m;try{let f=c.resolve(i,u=>r(t??e,"TAG_RESOLVE_FAILED",u),n.options);m=ke.isScalar(f)?f:new Js.Scalar(f)}catch(f){let u=f instanceof Error?f.message:String(f);r(t??e,"TAG_RESOLVE_FAILED",u),m=new Js.Scalar(i)}return m.range=a,m.source=i,o&&(m.type=o),l&&(m.tag=l),c.format&&(m.format=c.format),s&&(m.comment=s),m}function Hf(n,e,t,r,i){if(t==="!")return n[ke.SCALAR];let o=[];for(let a of n.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=n.knownTags[t];return s&&!s.collection?(n.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),n[ke.SCALAR])}function Kf({atKey:n,directives:e,schema:t},r,i,o){let s=t.tags.find(a=>(a.default===!0||n&&a.default==="key")&&a.test?.test(r))||t[ke.SCALAR];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(r))??t[ke.SCALAR];if(s.tag!==a.tag){let l=e.tagString(s.tag),c=e.tagString(a.tag),m=`Value may be parsed as either ${l} or ${c}`;o(i,"TAG_RESOLVE_FAILED",m,!0)}}return s}zs.composeScalar=Bf});var Vs=v(Ys=>{"use strict";function Jf(n,e,t){if(e){t??(t=e.length);for(let r=t-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":n-=i.source.length;continue}for(i=e[++r];i?.type==="space";)n+=i.source.length,i=e[++r];break}}return n}Ys.emptyScalarPosition=Jf});var Xs=v(Vr=>{"use strict";var zf=Be(),Uf=_(),Yf=Ws(),Gs=Us(),Vf=Te(),Gf=Vs(),Qf={composeNode:Qs,composeEmptyNode:Yr};function Qs(n,e,t,r){let i=n.atKey,{spaceBefore:o,comment:s,anchor:a,tag:l}=t,c,m=!0;switch(e.type){case"alias":c=Xf(n,e,r),(a||l)&&r(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=Gs.composeScalar(n,e,l,r),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Yf.composeCollection(Qf,n,e,t,r),a&&(c.anchor=a.source.substring(1))}catch(f){let u=f instanceof Error?f.message:String(f);r(e,"RESOURCE_EXHAUSTION",u)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",f),m=!1}}return c??(c=Yr(n,e.offset,void 0,null,t,r)),a&&c.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&n.options.stringKeys&&(!Uf.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&r(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(c.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?c.comment=s:c.commentBefore=s),n.options.keepSourceTokens&&m&&(c.srcToken=e),c}function Yr(n,e,t,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:l},c){let m={type:"scalar",offset:Gf.emptyScalarPosition(e,t,r),indent:-1,source:""},f=Gs.composeScalar(n,m,a,c);return s&&(f.anchor=s.source.substring(1),f.anchor===""&&c(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),o&&(f.comment=o,f.range[2]=l),f}function Xf({options:n},{offset:e,source:t,end:r},i){let o=new zf.Alias(t.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+t.length,a=Vf.resolveEnd(r,s,n.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}Vr.composeEmptyNode=Yr;Vr.composeNode=Qs});var ta=v(ea=>{"use strict";var Zf=it(),Zs=Xs(),ed=Te(),td=lt();function nd(n,e,{offset:t,start:r,value:i,end:o},s){let a=Object.assign({_directives:e},n),l=new Zf.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},m=td.resolveProps(r,{indicator:"doc-start",next:i??o?.[0],offset:t,onError:s,parentIndent:0,startOnNewline:!0});m.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!m.hasNewline&&s(m.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?Zs.composeNode(c,i,m,s):Zs.composeEmptyNode(c,m.end,r,null,m,s);let f=l.contents.range[2],u=ed.resolveEnd(o,f,!1,s);return u.comment&&(l.comment=u.comment),l.range=[t,f,u.offset],l}ea.composeDoc=nd});var Qr=v(ia=>{"use strict";var rd=kt("process"),id=Dn(),od=it(),ct=at(),na=_(),sd=ta(),ad=Te();function ut(n){if(typeof n=="number")return[n,n+1];if(Array.isArray(n))return n.length===2?n:[n[0],n[1]];let{offset:e,source:t}=n;return[e,e+(typeof t=="string"?t.length:1)]}function ra(n){let e="",t=!1,r=!1;for(let i=0;i<n.length;++i){let o=n[i];switch(o[0]){case"#":e+=(e===""?"":r?`
|
|
101
|
+
|
|
102
|
+
`:`
|
|
103
|
+
`)+(o.substring(1)||" "),t=!0,r=!1;break;case"%":n[i+1]?.[0]!=="#"&&(i+=1),t=!1;break;default:t||(r=!0),t=!1}}return{comment:e,afterEmptyLine:r}}var Gr=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,i,o)=>{let s=ut(t);o?this.warnings.push(new ct.YAMLWarning(s,r,i)):this.errors.push(new ct.YAMLParseError(s,r,i))},this.directives=new id.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:i}=ra(this.prelude);if(r){let o=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
104
|
+
${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(na.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];na.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${r}
|
|
105
|
+
${a}`:r}else{let s=o.commentBefore;o.commentBefore=s?`${r}
|
|
106
|
+
${s}`:r}}if(t){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ra(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(t,r)}*next(e){switch(rd.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,r,i)=>{let o=ut(e);o[0]+=t,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=sd.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,r=new ct.YAMLParseError(ut(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new ct.YAMLParseError(ut(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let t=ad.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
107
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new ct.YAMLParseError(ut(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 r=Object.assign({_directives:this.directives},this.options),i=new od.Document(void 0,r);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}};ia.Composer=Gr});var aa=v(mn=>{"use strict";var ld=Jr(),cd=Ur(),ud=at(),oa=Ue();function fd(n,e=!0,t){if(n){let r=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(a,o,s);else throw new ud.YAMLParseError([a,a+1],o,s)};switch(n.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return cd.resolveFlowScalar(n,e,r);case"block-scalar":return ld.resolveBlockScalar({options:{strict:e}},n,r)}}return null}function dd(n,e){let{implicitKey:t=!1,indent:r,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=oa.stringifyString({type:s,value:n},{implicitKey:t,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:r,source:`
|
|
108
|
+
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
109
|
+
`),m=a.substring(0,c),f=a.substring(c+1)+`
|
|
110
|
+
`,u=[{type:"block-scalar-header",offset:o,indent:r,source:m}];return sa(u,l)||u.push({type:"newline",offset:-1,indent:r,source:`
|
|
111
|
+
`}),{type:"block-scalar",offset:o,indent:r,props:u,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:r,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:o,indent:r,source:a,end:l};default:return{type:"scalar",offset:o,indent:r,source:a,end:l}}}function md(n,e,t={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=t,a="indent"in n?n.indent:null;if(r&&typeof a=="number"&&(a+=2),!s)switch(n.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let c=n.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let l=oa.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":pd(n,l);break;case'"':Xr(n,l,"double-quoted-scalar");break;case"'":Xr(n,l,"single-quoted-scalar");break;default:Xr(n,l,"scalar")}}function pd(n,e){let t=e.indexOf(`
|
|
112
|
+
`),r=e.substring(0,t),i=e.substring(t+1)+`
|
|
113
|
+
`;if(n.type==="block-scalar"){let o=n.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=r,n.source=i}else{let{offset:o}=n,s="indent"in n?n.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:r}];sa(a,"end"in n?n.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
|
|
114
|
+
`});for(let l of Object.keys(n))l!=="type"&&l!=="offset"&&delete n[l];Object.assign(n,{type:"block-scalar",indent:s,props:a,source:i})}}function sa(n,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":n.push(t);break;case"newline":return n.push(t),!0}return!1}function Xr(n,e,t){switch(n.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":n.type=t,n.source=e;break;case"block-scalar":{let r=n.props.slice(1),i=e.length;n.props[0].type==="block-scalar-header"&&(i-=n.props[0].source.length);for(let o of r)o.offset+=i;delete n.props,Object.assign(n,{type:t,source:e,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:n.offset+e.length,indent:n.indent,source:`
|
|
115
|
+
`};delete n.items,Object.assign(n,{type:t,source:e,end:[i]});break}default:{let r="indent"in n?n.indent:-1,i="end"in n&&Array.isArray(n.end)?n.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(n))o!=="type"&&o!=="offset"&&delete n[o];Object.assign(n,{type:t,indent:r,source:e,end:i})}}}mn.createScalarToken=dd;mn.resolveAsScalar=fd;mn.setScalarValue=md});var ca=v(la=>{"use strict";var hd=n=>"type"in n?hn(n):pn(n);function hn(n){switch(n.type){case"block-scalar":{let e="";for(let t of n.props)e+=hn(t);return e+n.source}case"block-map":case"block-seq":{let e="";for(let t of n.items)e+=pn(t);return e}case"flow-collection":{let e=n.start.source;for(let t of n.items)e+=pn(t);for(let t of n.end)e+=t.source;return e}case"document":{let e=pn(n);if(n.end)for(let t of n.end)e+=t.source;return e}default:{let e=n.source;if("end"in n&&n.end)for(let t of n.end)e+=t.source;return e}}}function pn({start:n,key:e,sep:t,value:r}){let i="";for(let o of n)i+=o.source;if(e&&(i+=hn(e)),t)for(let o of t)i+=o.source;return r&&(i+=hn(r)),i}la.stringify=hd});var ma=v(da=>{"use strict";var Zr=Symbol("break visit"),gd=Symbol("skip children"),ua=Symbol("remove item");function be(n,e){"type"in n&&n.type==="document"&&(n={start:n.start,value:n.value}),fa(Object.freeze([]),n,e)}be.BREAK=Zr;be.SKIP=gd;be.REMOVE=ua;be.itemAtPath=(n,e)=>{let t=n;for(let[r,i]of e){let o=t?.[r];if(o&&"items"in o)t=o.items[i];else return}return t};be.parentCollection=(n,e)=>{let t=be.itemAtPath(n,e.slice(0,-1)),r=e[e.length-1][0],i=t?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function fa(n,e,t){let r=t(e,n);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=fa(Object.freeze(n.concat([[i,s]])),o.items[s],t);if(typeof a=="number")s=a-1;else{if(a===Zr)return Zr;a===ua&&(o.items.splice(s,1),s-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,n))}}return typeof r=="function"?r(e,n):r}da.visit=be});var gn=v(q=>{"use strict";var ei=aa(),wd=ca(),yd=ma(),ti="\uFEFF",ni="",ri="",ii="",kd=n=>!!n&&"items"in n,bd=n=>!!n&&(n.type==="scalar"||n.type==="single-quoted-scalar"||n.type==="double-quoted-scalar"||n.type==="block-scalar");function vd(n){switch(n){case ti:return"<BOM>";case ni:return"<DOC>";case ri:return"<FLOW_END>";case ii:return"<SCALAR>";default:return JSON.stringify(n)}}function Sd(n){switch(n){case ti:return"byte-order-mark";case ni:return"doc-mode";case ri:return"flow-error-end";case ii:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
116
|
+
`:case`\r
|
|
117
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(n[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}q.createScalarToken=ei.createScalarToken;q.resolveAsScalar=ei.resolveAsScalar;q.setScalarValue=ei.setScalarValue;q.stringify=wd.stringify;q.visit=yd.visit;q.BOM=ti;q.DOCUMENT=ni;q.FLOW_END=ri;q.SCALAR=ii;q.isCollection=kd;q.isScalar=bd;q.prettyToken=vd;q.tokenType=Sd});var ai=v(ha=>{"use strict";var ft=gn();function J(n){switch(n){case void 0:case" ":case`
|
|
118
|
+
`:case"\r":case" ":return!0;default:return!1}}var pa=new Set("0123456789ABCDEFabcdef"),Cd=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),wn=new Set(",[]{}"),Ed=new Set(` ,[]{}
|
|
119
|
+
\r `),oi=n=>!n||Ed.has(n),si=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 r=this.next??"stream";for(;r&&(t||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
120
|
+
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
121
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let r=0;for(;t===" ";)t=this.buffer[++r+e];if(t==="\r"){let i=this.buffer[r+e+1];if(i===`
|
|
122
|
+
`||!i&&!this.atEnd)return e+r+1}return t===`
|
|
123
|
+
`||r>=this.indentNext||!t&&!this.atEnd?e+r:-1}if(t==="-"||t==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&J(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(`
|
|
124
|
+
`,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]===ft.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){t=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[t-1];if(o===" "||o===" ")t-=1;else break}let i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),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 ft.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==="...")&&J(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&&!J(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===":")&&J(t)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(oi),"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,r=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=r=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&J(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield ft.FLOW_END,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"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(oi),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||J(s)||s===",")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 o=0;for(;this.buffer[t-1-o]==="\\";)o+=1;if(o%2===0)break;t=this.buffer.indexOf('"',t+1)}let r=this.buffer.substring(0,t),i=r.indexOf(`
|
|
125
|
+
`,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=r.indexOf(`
|
|
126
|
+
`,o)}i!==-1&&(t=i-(r[i-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=>J(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":t+=1;break;case`
|
|
127
|
+
`:e=o,t=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
|
|
128
|
+
`)break}default:break e}if(!r&&!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 o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
|
|
129
|
+
`,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
130
|
+
`;)r=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
|
|
131
|
+
`&&o>=this.pos&&o+1+t>a)e=o;else break}while(!0);return yield ft.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(J(o)||e&&wn.has(o))break;t=r}else if(J(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
|
|
132
|
+
`?(r+=1,i=`
|
|
133
|
+
`,o=this.buffer[r+1]):t=r),o==="#"||e&&wn.has(o))break;if(i===`
|
|
134
|
+
`){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(e&&wn.has(i))break;t=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield ft.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 r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(t&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(oi),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,r=this.charAt(1);if(J(r)||t&&wn.has(r)){t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!J(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(Cd.has(t))t=this.buffer[++e];else if(t==="%"&&pa.has(this.buffer[e+1])&&pa.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===`
|
|
135
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
136
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,r;do r=this.buffer[++t];while(r===" "||e&&r===" ");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,r=this.buffer[t];for(;!e(r);)r=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};ha.Lexer=si});var ci=v(ga=>{"use strict";var li=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,r=this.lineStarts.length;for(;t<r;){let o=t+r>>1;this.lineStarts[o]<e?t=o+1:r=o}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}};ga.LineCounter=li});var fi=v(va=>{"use strict";var Pd=kt("process"),wa=gn(),_d=ai();function ce(n,e){for(let t=0;t<n.length;++t)if(n[t].type===e)return!0;return!1}function ya(n){for(let e=0;e<n.length;++e)switch(n[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function ba(n){switch(n?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function yn(n){switch(n.type){case"document":return n.start;case"block-map":{let e=n.items[n.items.length-1];return e.sep??e.start}case"block-seq":return n.items[n.items.length-1].start;default:return[]}}function Re(n){if(n.length===0)return[];let e=n.length;e:for(;--e>=0;)switch(n[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;n[++e]?.type==="space";);return n.splice(e,n.length)}function kn(n,e){if(e.length<1e5)Array.prototype.push.apply(n,e);else for(let t=0;t<e.length;++t)n.push(e[t])}function ka(n){if(n.start.type==="flow-seq-start")for(let e of n.items)e.sep&&!e.value&&!ce(e.start,"explicit-key-ind")&&!ce(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,ba(e.value)?e.value.end?kn(e.value.end,e.sep):e.value.end=e.sep:kn(e.start,e.sep),delete e.sep)}var ui=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 _d.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,t))yield*this.next(r);t||(yield*this.end())}*next(e){if(this.source=e,Pd.env.LOG_TOKENS&&console.log("|",wa.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=wa.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 r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,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?.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 r=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in r?r.indent:0:t.type==="flow-collection"&&r.type==="document"&&(t.indent=0),t.type==="flow-collection"&&ka(t),r.type){case"document":r.value=t;break;case"block-scalar":r.props.push(t);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&ya(i.start)===-1&&(t.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<t.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.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":{ya(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=yn(this.peek(2)),r=Re(t),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}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(`
|
|
137
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
138
|
+
`,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 r="end"in t.value?t.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.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 i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){kn(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&t.sep&&!t.value){let s=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":s.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=t.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||t.value?(o.push(this.sourceToken),e.items.push({start:o}),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):i||t.value?(o.push(this.sourceToken),e.items.push({start:o,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(ce(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(ba(t.key)&&!ce(t.sep,"newline")){let s=Re(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:s,key:a,sep:l}]})}else o.length>0?t.sep=t.sep.concat(o,this.sourceToken):t.sep.push(this.sourceToken);else if(ce(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let s=Re(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):ce(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 s=this.flowScalar(this.type);i||t.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(s):(Object.assign(t,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!t.explicitKey&&t.sep&&!ce(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:o});this.stack.push(s);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 r="end"in t.value?t.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.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 i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){kn(i,t.start),i.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||ce(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.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 i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=yn(r),o=Re(i);ka(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};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(`
|
|
139
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
140
|
+
`,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=yn(e),r=Re(t);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=yn(e),r=Re(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};va.Parser=ui});var _a=v(mt=>{"use strict";var Sa=Qr(),Ad=it(),dt=at(),Id=Vn(),Od=_(),Nd=ci(),Ca=fi();function Ea(n){let e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new Nd.LineCounter||null,prettyErrors:e}}function jd(n,e={}){let{lineCounter:t,prettyErrors:r}=Ea(e),i=new Ca.Parser(t?.addNewLine),o=new Sa.Composer(e),s=Array.from(o.compose(i.parse(n)));if(r&&t)for(let a of s)a.errors.forEach(dt.prettifyError(n,t)),a.warnings.forEach(dt.prettifyError(n,t));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function Pa(n,e={}){let{lineCounter:t,prettyErrors:r}=Ea(e),i=new Ca.Parser(t?.addNewLine),o=new Sa.Composer(e),s=null;for(let a of o.compose(i.parse(n),!0,n.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new dt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&t&&(s.errors.forEach(dt.prettifyError(n,t)),s.warnings.forEach(dt.prettifyError(n,t))),s}function xd(n,e,t){let r;typeof e=="function"?r=e:t===void 0&&e&&typeof e=="object"&&(t=e);let i=Pa(n,t);if(!i)return null;if(i.warnings.forEach(o=>Id.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},t))}function Td(n,e,t){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(n===void 0){let{keepUndefined:i}=t??e??{};if(!i)return}return Od.isDocument(n)&&!r?n.toString(t):new Ad.Document(n,r,t).toString(t)}mt.parse=xd;mt.parseAllDocuments=jd;mt.parseDocument=Pa;mt.stringify=Td});var vn=v(A=>{"use strict";var Rd=Qr(),Ld=it(),Dd=jr(),di=at(),Md=Be(),ue=_(),qd=oe(),$d=j(),Fd=ae(),Wd=le(),Bd=gn(),Hd=ai(),Kd=ci(),Jd=fi(),bn=_a(),Aa=qe();A.Composer=Rd.Composer;A.Document=Ld.Document;A.Schema=Dd.Schema;A.YAMLError=di.YAMLError;A.YAMLParseError=di.YAMLParseError;A.YAMLWarning=di.YAMLWarning;A.Alias=Md.Alias;A.isAlias=ue.isAlias;A.isCollection=ue.isCollection;A.isDocument=ue.isDocument;A.isMap=ue.isMap;A.isNode=ue.isNode;A.isPair=ue.isPair;A.isScalar=ue.isScalar;A.isSeq=ue.isSeq;A.Pair=qd.Pair;A.Scalar=$d.Scalar;A.YAMLMap=Fd.YAMLMap;A.YAMLSeq=Wd.YAMLSeq;A.CST=Bd;A.Lexer=Hd.Lexer;A.LineCounter=Kd.LineCounter;A.Parser=Jd.Parser;A.parse=bn.parse;A.parseAllDocuments=bn.parseAllDocuments;A.parseDocument=bn.parseDocument;A.stringify=bn.stringify;A.visit=Aa.visit;A.visitAsync=Aa.visitAsync});import{spawn as nl}from"node:child_process";import{chmodSync as Dm,mkdtempSync as Mm,readFileSync as _i,readdirSync as qm,rmSync as $m,writeFileSync as Fm}from"node:fs";import el from"node:http";import{createRequire as rl}from"node:module";import{connect as Wm}from"node:net";import{tmpdir as Bm}from"node:os";import W from"node:path";import{fileURLToPath as Hm,pathToFileURL as Km}from"node:url";import{promises as V}from"node:fs";import N from"node:path";import Tm from"node:os";import{createHash as Rm}from"node:crypto";import{randomUUID as hl}from"node:crypto";import{promises as ee}from"node:fs";import Me from"node:path";import{performance as Li}from"node:perf_hooks";import{createRequire as dl}from"node:module";var ml=dl(import.meta.url??__filename),bt;function ji(n,e){if(!bt){let t=process.emitWarning;process.emitWarning=((r,...i)=>{String(r instanceof Error?r.message:r).startsWith("SQLite is an experimental feature and might change at any time")||Reflect.apply(t,process,[r,...i])});try{bt=ml("node:sqlite").DatabaseSync}finally{process.emitWarning=t}}return e===void 0?new bt(n):new bt(n,e)}import{AsyncLocalStorage as pl}from"node:async_hooks";var xi=new pl,jn=class extends Error{code="OPERATION_BUDGET_EXCEEDED";constructor(){super("Operation time budget exceeded; unfinished work can be resumed.")}};function Ti(n){return Math.max(0,Math.min(n,(xi.getStore()?.deadline??1/0)-performance.now()))}function Ri(){let n=xi.getStore();if(n&&(n.signal.aborted||performance.now()>=n.deadline))throw new jn}async function Di(n){let e,t;try{let r=await ee.lstat(n);if(!r.isFile()||r.isSymbolicLink())throw new Error("File lock metadata must be a regular file: "+n);t=[r.dev,r.ino,r.size,r.mtimeMs].join(":"),e=await ee.readFile(n,"utf8")}catch(r){if(r.code==="ENOENT")return null;throw r}try{let r=JSON.parse(e),i=r.nonce??r.id,o=typeof r.createdAt=="number"?r.createdAt:Date.parse(r.createdAt);if(typeof i=="string"&&i&&Number.isFinite(o))return{owner:{nonce:i,createdAt:o,...r.protocolVersion===2?{protocolVersion:2}:{},...typeof r.operation=="string"?{operation:r.operation}:{}},token:i,legacy:r.protocolVersion!==2}}catch{}return{owner:null,token:t,legacy:!0}}async function gl(n){let e=n+".sqlite";try{let r=await ee.lstat(e);if(!r.isFile()||r.isSymbolicLink())throw new Error("File lock database must be a regular file: "+e)}catch(r){if(r.code!=="ENOENT")throw r}let t;try{t=ji(Me.toNamespacedPath(e))}catch(r){throw new Error("Unable to open Runtime lock database "+e,{cause:r})}try{return t.exec("PRAGMA busy_timeout=0; BEGIN IMMEDIATE;"),t}catch(r){if(t.close(),/database is (?:locked|busy)/iu.test(String(r)))return null;throw new Error("Unable to acquire Runtime lock transaction "+e,{cause:r})}}function Mi(n){try{n.exec("ROLLBACK;")}finally{n.close()}}async function wl(n,e={}){n=Me.resolve(n),await ee.mkdir(Me.dirname(n),{recursive:!0});let t=await ee.lstat(Me.dirname(n));if(!t.isDirectory()||t.isSymbolicLink())throw new Error("File lock parent must be a real directory: "+Me.dirname(n));let r=Li.now()+Ti(e.timeoutMs??3e4),i;for(;Ri(),i=await gl(n),!i;){if(Li.now()>=r)throw new Error("Timed out waiting for file lock: "+n);await new Promise(a=>setTimeout(a,e.retryMs??20))}let o={protocolVersion:2,nonce:hl(),createdAt:Date.now(),...e.operation?{operation:e.operation}:{}};try{let a=await Di(n);if(a?.legacy)throw new Error("Legacy lock requires confirmation that its previous operation stopped: "+n+`
|
|
141
|
+
Inspect argv: `+JSON.stringify(["comet","doctor","--lock-file",n,"--json"]));a&&await ee.unlink(n),await ee.writeFile(n,JSON.stringify(o),{mode:384,flag:"wx"})}catch(a){throw Mi(i),a}let s=!1;return{owner:o,async release(){if(s)return!0;s=!0;let a=!0;try{let l=await Di(n);l?.token===o.nonce?l.owner?.createdAt===o.createdAt&&l.owner.operation===o.operation?await ee.unlink(n):(a=!1,process.stderr.write("[comet] lock metadata changed while held; kept "+n+`
|
|
142
|
+
`)):l&&(a=!1,process.stderr.write("[comet] lock owned by another holder; kept "+n+`
|
|
143
|
+
`))}finally{Mi(i)}return a}}}async function xn(n,e,t={}){let r=await wl(n,t),i;try{i=await e()}catch(o){try{await r.release()}catch(s){process.stderr.write("[comet] lock cleanup failed; preserved the original operation error: "+String(s)+`
|
|
144
|
+
`)}throw o}return await r.release(),i}function vt(n){let e=Buffer.from(JSON.stringify(n)).toString("base64");if(!/^[A-Za-z0-9+/]*={0,2}$/u.test(e))throw new TypeError("Hook \u53C2\u6570\u7F16\u7801\u5305\u542B\u65E0\u6548\u5B57\u7B26");return`node -e "const r=require('node:child_process').spawnSync(process.execPath,JSON.parse(Buffer.from('${e}','base64').toString()),{stdio:'inherit'});process.exit(r.status??1)"`}function qi(n){if(typeof n!="string")return null;let e=/Buffer\.from\('([A-Za-z0-9+/=]+)','base64'\)/u.exec(n)?.[1];if(!e)return null;try{let t=JSON.parse(Buffer.from(e,"base64").toString());return!Array.isArray(t)||!t.every(r=>typeof r=="string")?null:vt(t)===n?t:null}catch{return null}}import Cm from"path";import{fileURLToPath as Em}from"url";var zd=Nn(vn(),1),Ia=[{id:"en",label:"English"},{id:"zh-CN",label:"Simplified Chinese"}];function Ud(){return Ia.map(n=>n.id).join(" | ")}function Oa(n){let e=n??"en",t=Ia.find(r=>r.id===e);if(!t)throw new Error(`Invalid artifact language: '${e}'. Valid values: ${Ud()}`);return t}import{promises as Y}from"fs";import I from"path";import{AsyncLocalStorage as Zd}from"node:async_hooks";import{constants as de,promises as $}from"fs";import{createHash as Yd}from"node:crypto";function fe(n){return n!==0&&n!==0n&&n!=="0"}function Na(n,e){return fe(n.dev)&&fe(e.dev)&&fe(n.ino)&&fe(e.ino)}function Le(n,e){let t=fe(n.dev)&&fe(e.dev);if(t&&n.dev!==e.dev)return!1;let r=fe(n.ino)&&fe(e.ino);return r&&n.ino!==e.ino?!1:t&&r?!0:n.birthtime===e.birthtime}var F=class extends Error{reason;constructor(e,t,r){super(t,r),this.name="RaceSafeReadError",this.reason=e}};function mi(n){return"birthtimeNs"in n&&typeof n.birthtimeNs=="bigint"?n.birthtimeNs:n.birthtimeMs}function Sn(n){return"ctimeNs"in n&&typeof n.ctimeNs=="bigint"?n.ctimeNs:n.ctimeMs}function pe(n){return{dev:n.dev,ino:n.ino,birthtime:mi(n)}}function Vd(n,e){let t=pe(n),r=pe(e);return Na(t,r)?Le(t,r):Le(t,r)&&mi(n)===mi(e)&&Sn(n)===Sn(e)&&n.size===e.size}function me(n,e){let t=r=>"mtimeNs"in r?r.mtimeNs:r.mtimeMs;return Vd(n,e)&&n.size===e.size&&n.mode===e.mode&&t(n)===t(e)&&Sn(n)===Sn(e)}async function xa(n,e,t={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=t.label??"file",i=t.bigint===!0,o=await $.lstat(n,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new F("not-regular-file",`${r} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new F("too-large",`${r} exceeds ${e} bytes`);let s=await $.realpath(n);await t.verify?.("pre-open",{realPath:s,identity:pe(o)});let a=process.platform==="win32"?de.O_RDONLY:de.O_RDONLY|de.O_NOFOLLOW|de.O_NONBLOCK,l;try{l=await $.open(n,a)}catch(c){throw c.code==="ELOOP"?new F("not-regular-file",`${r} must be a regular file`,{cause:c}):c}try{let[c,m,f]=await Promise.all([l.stat({bigint:i}),$.lstat(n,{bigint:i}),$.realpath(n)]);if(!c.isFile()||!m.isFile()||m.isSymbolicLink()||f!==s||!me(o,c)||!me(o,m))throw new F("changed",`${r} changed while opening`);await t.verify?.("post-open",{realPath:f,identity:pe(c)}),await t.hooks?.afterOpen?.();let u=[],p=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let b=e+1-p,{bytesRead:k}=await l.read(g,0,Math.min(g.length,b),null);if(k===0)break;if(p+=k,p>e)throw new F("too-large",`${r} exceeds ${e} bytes`);u.push(Buffer.from(g.subarray(0,k)))}let d=Buffer.concat(u,p);if(await t.hooks?.beforeFinalCheck?.(),process.platform==="win32"){let b=0;for(;;){let{bytesRead:k}=await l.read(g,0,Math.min(g.length,p+1-b),b);if(k===0&&b===p)break;if(k===0||b+k>p||!g.subarray(0,k).equals(d.subarray(b,b+k)))throw new F("changed",`${r} changed while reading`);b+=k}}let[h,w,y]=await Promise.all([l.stat({bigint:i}),$.lstat(n,{bigint:i}),$.realpath(n)]);if(!w.isFile()||w.isSymbolicLink()||y!==s||!me(o,h)||!me(o,w))throw new F("changed",`${r} changed while reading`);return await t.verify?.("post-read",{realPath:y,identity:pe(h)}),{bytes:d,stat:h,realPath:y}}finally{await l.close()}}async function Ta(n,e={}){let t=e.label??"file",r=e.bigint===!0,i=await $.lstat(n,{bigint:r});if(!i.isFile()||i.isSymbolicLink())throw new F("not-regular-file",`${t} must be a regular file`);let o=await $.realpath(n);await e.verify?.("pre-open",{realPath:o,identity:pe(i)});let s=process.platform==="win32"?de.O_RDONLY:de.O_RDONLY|de.O_NOFOLLOW|de.O_NONBLOCK,a;try{a=await $.open(n,s)}catch(l){throw l.code==="ELOOP"?new F("not-regular-file",`${t} must be a regular file`,{cause:l}):l}try{let[l,c,m]=await Promise.all([a.stat({bigint:r}),$.lstat(n,{bigint:r}),$.realpath(n)]);if(!l.isFile()||!c.isFile()||c.isSymbolicLink()||m!==o||!me(i,l)||!me(i,c))throw new F("changed",`${t} changed while opening`);await e.verify?.("post-open",{realPath:m,identity:pe(l)}),await e.hooks?.afterOpen?.();let f=e.algorithm??"sha256",u=await ja(a,f);if(await e.hooks?.beforeFinalCheck?.(),process.platform==="win32"&&await ja(a,f)!==u)throw new F("changed",`${t} changed while reading`);let[p,g,d]=await Promise.all([a.stat({bigint:r}),$.lstat(n,{bigint:r}),$.realpath(n)]);if(!g.isFile()||g.isSymbolicLink()||d!==o||!me(i,p)||!me(i,g))throw new F("changed",`${t} changed while reading`);return await e.verify?.("post-read",{realPath:d,identity:pe(p)}),{digest:u,stat:p,realPath:d}}finally{await a.close()}}async function ja(n,e){let t=Yd(e),r=Buffer.allocUnsafe(64*1024),i=0;for(;;){let{bytesRead:o}=await n.read(r,0,r.length,i);if(o===0)break;t.update(r.subarray(0,o)),i+=o}return t.digest("hex")}import Ra from"path";var ve=Nn(vn(),1),pi=Number.MAX_SAFE_INTEGER;var Gd={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",change_walkthrough:`# Generate a standalone HTML change walkthrough for Native and Classic. Enabling it uses extra explanation tokens.
|
|
145
|
+
# change_walkthrough: true | false (default: true)`,ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
|
|
146
|
+
# ambient_resume: true | false`,memory:"# Project policy for automatic personal-memory learning and retrieval.","memory.learning":`# Allows workflow events in this project to form new personal memories automatically.
|
|
147
|
+
# learning: true | false`,"memory.retrieval":`# Allows personal memories to be injected into Agent context for this project.
|
|
148
|
+
# retrieval: true | false`,knowledge:"# Project knowledge retrieval provider used by ordinary Comet tasks.","knowledge.provider":`# Provider for project knowledge.
|
|
149
|
+
# provider: local | remote`,"knowledge.local":"# Additional project-relative Markdown globs used by the local provider.","knowledge.local.include":"# One project-relative Markdown glob per list item; appended to the built-in corpus.","knowledge.local.max_file_mb":"# Maximum size in MB for one local Markdown document. Increase it for long specifications or verification reports.","knowledge.local.max_total_mb":"# Maximum total size in MB of the local Markdown retrieval corpus.","knowledge.remote":"# Fixed Comet Retrieval API v1 settings used when provider is remote.","knowledge.remote.endpoint":"# HTTPS endpoint; loopback HTTP is allowed.","knowledge.remote.token_env":"# Optional environment variable containing the bearer token.","knowledge.remote.scope":"# Optional opaque remote knowledge scope.","knowledge.remote.timeout_ms":"# Remote request timeout in milliseconds (100-30000).",hook:"# Hook write policy shared by Native and Classic. Paths are project-relative.","hook.allow_paths":"# Project-relative directories allowed during guarded phases. Use one path per list item; empty by default.",native:"# Native workflow settings. They do not change Classic state or behavior.","native.artifact_root":"# Root directory where Native stores Comet specs and changes. Runtime data stays under .comet.","native.language":`# Artifact language used by Native workflow documents.
|
|
150
|
+
# language: en | zh-CN`,"native.clarification_mode":`# Controls how Native asks clarifying questions: batch asks every currently answerable question per round (default), sequential asks one at a time.
|
|
151
|
+
# clarification_mode: batch | sequential`,"native.archive_confirmation":`# Controls whether Native archives automatically after a successful preview or waits for explicit user confirmation.
|
|
152
|
+
# archive_confirmation: automatic | required`,"native.max_verify_failures":"# Maximum failed Verify outcomes allowed for one confirmed acceptance target before Native stops the completion loop.","native.max_parallel_children":"# Maximum dispatched Supervisor children awaiting integration and archive. Defaults to 2; single-session always uses 1. Changes apply at the next dispatch.","native.document_writes":`# Controls documentation file writes during Shape, Verify, and Archive: allow treats them as neutral instead of returning the change to Build, revert restores the strict behavior.
|
|
153
|
+
# document_writes: allow | revert`,"native.finish":"# Optional repository-owned finish providers. Native keeps commit, push, generic remote verification, and recovery ownership.",classic:"# Classic workflow settings. They do not change Native state or behavior.","classic.artifact_layout":`# Selects the Classic artifact layout. The default is docs; update preserves detected root-level legacy artifacts.
|
|
154
|
+
# artifact_layout: legacy | docs`,"classic.language":`# Artifact language used by Classic workflow documents.
|
|
155
|
+
# language: en | zh-CN`,"classic.context_compression":`# Controls beta context compression for new Classic changes.
|
|
156
|
+
# context_compression: off | beta`,"classic.review_mode":`# Sets the default review depth for new Classic changes.
|
|
157
|
+
# review_mode: off | standard | thorough`,"classic.auto_transition":`# Automatically enters the next Classic phase after a phase passes.
|
|
158
|
+
# auto_transition: true | false`,"classic.check_timeout_ms":"# Default check timeout in milliseconds (1-3600000); --timeout-ms overrides it. Default: 300000.","classic.document_evidence":`# Controls how documentation edits affect recorded check evidence: neutral keeps build and verify evidence valid when only documentation files changed, strict binds every working-tree file again.
|
|
159
|
+
# document_evidence: neutral | strict`},"zh-CN":{schema:"# Comet \u4F7F\u7528\u7684\u914D\u7F6E\u683C\u5F0F\u7248\u672C\uFF0C\u8BF7\u52FF\u4FEE\u6539\u6B64\u503C\u3002",default_workflow:"# `/comet` \u9ED8\u8BA4\u8FDB\u5165\u7684\u5DE5\u4F5C\u6D41\uFF1B\u8BE5\u503C\u4E5F\u5FC5\u987B\u51FA\u73B0\u5728 workflows \u4E2D\u3002",workflows:"# \u6B64\u9879\u76EE\u542F\u7528\u7684\u5DE5\u4F5C\u6D41\uFF0C\u53EF\u586B\u5199 native\u3001classic \u6216\u540C\u65F6\u542F\u7528\u4E24\u8005\u3002",change_walkthrough:`# \u662F\u5426\u751F\u6210\u53EF\u76F4\u63A5\u6253\u5F00\u7684 HTML \u53D8\u66F4\u8BF4\u660E\uFF0C\u540C\u65F6\u4F5C\u7528\u4E8E Native \u548C Classic\uFF1B\u5F00\u542F\u4F1A\u589E\u52A0\u8BB2\u89E3\u5185\u5BB9\u7684 token \u6D88\u8017\u3002
|
|
160
|
+
# change_walkthrough: true | false\uFF08\u9ED8\u8BA4 true\uFF09`,ambient_resume:`# \u662F\u5426\u542F\u7528\u53EA\u8BFB\u7684\u73AF\u5883\u611F\u77E5\u6062\u590D\u63A2\u9488\uFF0C\u540C\u65F6\u4F5C\u7528\u4E8E Native \u548C Classic\uFF1B\u8BBE\u4E3A false \u53EF\u5173\u95ED\u81EA\u52A8\u5DE5\u4F5C\u6D41\u6062\u590D\u3002
|
|
161
|
+
# ambient_resume: true | false`,memory:"# \u5F53\u524D\u9879\u76EE\u7684\u4E2A\u4EBA\u8BB0\u5FC6\u81EA\u52A8\u5B66\u4E60\u4E0E\u6CE8\u5165\u7B56\u7565\u3002","memory.learning":`# \u662F\u5426\u5141\u8BB8\u5F53\u524D\u9879\u76EE\u901A\u8FC7\u5DE5\u4F5C\u6D41\u4E8B\u4EF6\u81EA\u52A8\u6C89\u6DC0\u65B0\u7684\u4E2A\u4EBA\u8BB0\u5FC6\u3002
|
|
162
|
+
# \u53EF\u9009\u503C\uFF1Atrue | false`,"memory.retrieval":`# \u662F\u5426\u5141\u8BB8\u5F53\u524D\u9879\u76EE\u628A\u4E2A\u4EBA\u8BB0\u5FC6\u81EA\u52A8\u6CE8\u5165 Agent \u4E0A\u4E0B\u6587\u3002
|
|
163
|
+
# \u53EF\u9009\u503C\uFF1Atrue | false`,knowledge:"# \u666E\u901A Comet \u4EFB\u52A1\u4F7F\u7528\u7684\u9879\u76EE\u77E5\u8BC6\u68C0\u7D22 Provider\u3002","knowledge.provider":`# \u9879\u76EE\u77E5\u8BC6 Provider\u3002
|
|
164
|
+
# \u53EF\u9009\u503C\uFF1Alocal | remote`,"knowledge.local":"# Local Provider \u989D\u5916\u52A0\u8F7D\u7684\u9879\u76EE\u76F8\u5BF9 Markdown \u8DEF\u5F84\u3002","knowledge.local.include":"# \u6BCF\u9879\u586B\u5199\u4E00\u4E2A\u9879\u76EE\u76F8\u5BF9 Markdown glob\uFF1B\u4F1A\u8FFD\u52A0\u5230\u5185\u7F6E\u8BED\u6599\u3002","knowledge.local.max_file_mb":"# \u5355\u4E2A\u672C\u5730 Markdown \u6587\u6863\u5141\u8BB8\u53C2\u4E0E\u68C0\u7D22\u7684\u6700\u5927 MB \u6570\uFF1B\u8F83\u957F\u7684\u89C4\u683C\u6216\u9A8C\u8BC1\u62A5\u544A\u53EF\u6309\u9700\u63D0\u9AD8\u3002","knowledge.local.max_total_mb":"# \u672C\u5730 Markdown \u68C0\u7D22\u8BED\u6599\u5141\u8BB8\u8BFB\u53D6\u7684\u603B MB \u6570\u3002","knowledge.remote":"# provider \u4E3A remote \u65F6\u4F7F\u7528\u7684\u56FA\u5B9A Comet Retrieval API v1 \u914D\u7F6E\u3002","knowledge.remote.endpoint":"# HTTPS \u5730\u5740\uFF1Bloopback \u5730\u5740\u5141\u8BB8\u4F7F\u7528 HTTP\u3002","knowledge.remote.token_env":"# \u53EF\u9009\u7684 Bearer Token \u73AF\u5883\u53D8\u91CF\u540D\u3002","knowledge.remote.scope":"# \u53EF\u9009\u7684\u4E0D\u900F\u660E\u8FDC\u7AEF\u77E5\u8BC6\u5E93\u8303\u56F4\u3002","knowledge.remote.timeout_ms":"# \u8FDC\u7AEF\u8BF7\u6C42\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF0C100-30000\uFF09\u3002",hook:"# Native \u548C Classic \u5171\u4EAB\u7684 Hook \u5199\u5165\u7B56\u7565\uFF1B\u8DEF\u5F84\u5FC5\u987B\u662F\u9879\u76EE\u76F8\u5BF9\u8DEF\u5F84\u3002","hook.allow_paths":"# \u5728\u53D7\u4FDD\u62A4\u9636\u6BB5\u5141\u8BB8\u5199\u5165\u7684\u9879\u76EE\u76F8\u5BF9\u76EE\u5F55\uFF1B\u6BCF\u9879\u586B\u5199\u4E00\u4E2A\u76EE\u5F55\uFF0C\u9ED8\u8BA4\u4E3A\u7A7A\u3002",native:"# Native \u5DE5\u4F5C\u6D41\u914D\u7F6E\uFF0C\u4E0D\u4F1A\u6539\u53D8 Classic \u7684\u72B6\u6001\u6216\u884C\u4E3A\u3002","native.artifact_root":"# Native \u89C4\u683C\u548C change \u7684\u5B58\u653E\u6839\u76EE\u5F55\uFF1B\u8FD0\u884C\u65F6\u6570\u636E\u59CB\u7EC8\u4F4D\u4E8E .comet\u3002","native.language":`# Native \u5DE5\u4F5C\u6D41\u6587\u6863\u4F7F\u7528\u7684\u4EA7\u7269\u8BED\u8A00\u3002
|
|
165
|
+
# \u53EF\u9009\u503C\uFF1Aen | zh-CN`,"native.clarification_mode":`# Native \u63D0\u95EE\u6F84\u6E05\u95EE\u9898\u7684\u65B9\u5F0F\uFF1Abatch \u6BCF\u8F6E\u4E00\u6B21\u63D0\u51FA\u5F53\u524D\u6240\u6709\u53EF\u56DE\u7B54\u7684\u95EE\u9898\uFF08\u9ED8\u8BA4\uFF09\uFF0Csequential \u6BCF\u8F6E\u53EA\u95EE\u4E00\u4E2A\u3002
|
|
166
|
+
# \u53EF\u9009\u503C\uFF1Abatch | sequential`,"native.archive_confirmation":`# Native \u5F52\u6863\u68C0\u67E5\u6210\u529F\u540E\u81EA\u52A8\u5F52\u6863\uFF0C\u6216\u7B49\u5F85\u7528\u6237\u660E\u786E\u786E\u8BA4\u3002
|
|
167
|
+
# \u53EF\u9009\u503C\uFF1Aautomatic | required`,"native.max_verify_failures":"# \u540C\u4E00\u4E2A\u5DF2\u786E\u8BA4\u9A8C\u6536\u76EE\u6807\u6700\u591A\u5141\u8BB8\u7684 Verify \u5931\u8D25\u6B21\u6570\uFF1B\u8FBE\u5230\u4E0A\u9650\u540E\u505C\u6B62\u5B8C\u6210\u5FAA\u73AF\u3002","native.max_parallel_children":"# Supervisor \u5DF2\u6D3E\u53D1\u4E14\u5C1A\u672A\u5B8C\u6210\u96C6\u6210\u5F52\u6863\u7684\u5B50\u4EFB\u52A1\u4E0A\u9650\uFF1B\u9ED8\u8BA4 2\uFF0Csingle-session \u56FA\u5B9A\u4E3A 1\uFF1B\u8C03\u6574\u4ECE\u4E0B\u4E00\u8F6E\u6D3E\u53D1\u751F\u6548\u3002","native.document_writes":`# Shape\u3001Verify \u548C Archive \u9636\u6BB5\u7684\u6587\u6863\u7C7B\u5199\u5165\u5904\u7406\u65B9\u5F0F\uFF1Aallow \u89C6\u4E3A\u4E2D\u6027\u5199\u5165\u3001\u4E0D\u518D\u628A change \u6253\u56DE Build\uFF0Crevert \u6062\u590D\u4E25\u683C\u884C\u4E3A\u3002
|
|
168
|
+
# \u53EF\u9009\u503C\uFF1Aallow | revert`,"native.finish":"# \u53EF\u9009\u7684\u4ED3\u5E93\u81EA\u6709\u6536\u5C3E provider\uFF1B\u63D0\u4EA4\u3001\u63A8\u9001\u3001\u901A\u7528\u8FDC\u7AEF\u6838\u9A8C\u548C\u6062\u590D\u4ECD\u7531 Native \u8D1F\u8D23\u3002",classic:"# Classic \u5DE5\u4F5C\u6D41\u914D\u7F6E\uFF0C\u4E0D\u4F1A\u6539\u53D8 Native \u7684\u72B6\u6001\u6216\u884C\u4E3A\u3002","classic.artifact_layout":`# Classic \u4EA7\u7269\u5E03\u5C40\uFF1B\u9ED8\u8BA4\u4F7F\u7528 docs\uFF0Cupdate \u68C0\u6D4B\u5230\u6839\u76EE\u5F55 legacy \u4EA7\u7269\u65F6\u4E88\u4EE5\u4FDD\u7559\u3002
|
|
169
|
+
# \u53EF\u9009\u503C\uFF1Alegacy | docs`,"classic.language":`# Classic \u5DE5\u4F5C\u6D41\u6587\u6863\u4F7F\u7528\u7684\u4EA7\u7269\u8BED\u8A00\u3002
|
|
170
|
+
# \u53EF\u9009\u503C\uFF1Aen | zh-CN`,"classic.context_compression":`# \u65B0\u5EFA Classic change \u662F\u5426\u542F\u7528 beta \u4E0A\u4E0B\u6587\u538B\u7F29\u3002
|
|
171
|
+
# \u53EF\u9009\u503C\uFF1Aoff | beta`,"classic.review_mode":`# \u65B0\u5EFA Classic change \u9ED8\u8BA4\u4F7F\u7528\u7684\u5BA1\u67E5\u6DF1\u5EA6\u3002
|
|
172
|
+
# \u53EF\u9009\u503C\uFF1Aoff | standard | thorough`,"classic.auto_transition":`# Classic \u9636\u6BB5\u901A\u8FC7\u540E\u662F\u5426\u81EA\u52A8\u8FDB\u5165\u4E0B\u4E00\u9636\u6BB5\u3002
|
|
173
|
+
# \u53EF\u9009\u503C\uFF1Atrue | false`,"classic.check_timeout_ms":"# \u68C0\u67E5\u547D\u4EE4\u9ED8\u8BA4\u8D85\u65F6\uFF0C\u5355\u4F4D\u6BEB\u79D2\uFF0C\u8303\u56F4 1-3600000\uFF0C\u7F3A\u7701\u4E3A 300000\uFF1B\u547D\u4EE4\u884C --timeout-ms \u4F18\u5148\u3002","classic.document_evidence":`# \u6587\u6863\u7F16\u8F91\u5BF9\u5DF2\u8BB0\u5F55\u68C0\u67E5\u8BC1\u636E\u7684\u5F71\u54CD\uFF1Aneutral \u5728\u53EA\u6709\u6587\u6863\u6587\u4EF6\u53D8\u5316\u65F6\u4FDD\u6301 build \u548C verify \u8BC1\u636E\u6709\u6548\uFF0Cstrict \u91CD\u65B0\u7ED1\u5B9A\u5DE5\u4F5C\u533A\u7684\u5168\u90E8\u6587\u4EF6\u3002
|
|
174
|
+
# \u53EF\u9009\u503C\uFF1Aneutral | strict`}};function B(n,e){return Gd[e][n]}function hi(n,e,t=!1){if(typeof n!="string")throw new Error(`${e} must be a string`);let r=n.trim().replaceAll("\\","/");if(r.length===0||Ra.posix.isAbsolute(r)||Ra.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let i=r.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!t&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}import{AsyncLocalStorage as Qd}from"node:async_hooks";var Xd=new Qd;function La(){let n=Xd.getStore();return n?.active?n:null}function Da(n,e){let t=n;for(let r of e)t+="\0"+(typeof r=="string"?r:JSON.stringify(r));return t}function pt(n,e){return(...t)=>{let r=La();if(r===null)return e(...t);let i=Da(`async:${n}`,t),o=r.entries.get(i);if(o)return o.value;let s=e(...t).catch(a=>{throw r.entries.get(i)?.value===s&&r.entries.delete(i),a});return r.entries.set(i,{value:s}),s}}function Ma(n,e){return(...t)=>{let r=La();if(r===null)return e(...t);let i=Da(`sync:${n}`,t),o=r.entries.get(i);if(o)return o.value;let s=e(...t);return r.entries.set(i,{value:s}),s}}var em=new Zd;async function qa(n,e,t={}){let r=I.resolve(n),i=await Wa(r,e),o=new Map,s=!1,a=u=>[u.dev,u.ino,u.mode,u.birthtimeNs,u.mtimeNs,u.ctimeNs].join(":"),l=u=>[u.dev,u.ino,u.mode,u.birthtimeNs].join(":"),c=async(u,p)=>JSON.stringify((await Y.readdir(u,{withFileTypes:!0})).filter(g=>!p(g)).map(g=>[g.name,g.isDirectory(),g.isSymbolicLink()]).sort((g,d)=>String(g[0]).localeCompare(String(d[0]),"en"))),m=u=>{let p=o.get(u);return p||(p=(async()=>{let g=await Y.lstat(u,{bigint:!0});if(!g.isDirectory()||g.isSymbolicLink())throw new Error(`${e} crosses a symbolic link, junction or invalid directory at ${I.relative(r,u)||"."}`);let d=await Y.realpath(u);if(!ht(i,d))throw new Error(`${e} resolves outside the project root`);let h=t.ignoredDirectoryEntries?.(I.relative(r,u).replaceAll("\\","/")||".");return{stat:g,real:d,...h?{ignoreEntry:h,namespace:await c(u,h)}:{}}})(),p=p.catch(g=>{throw o.delete(u),g}),o.set(u,p)),p};await m(r);let f=async u=>{if(s)throw new Error(`${e} read session is already finished`);let p=hi(u,e),g=r;for(let d of p.split("/").slice(0,-1))g=I.join(g,d),await m(g);return I.resolve(r,...p.split("/"))};return{observePath:f,async observeDirectory(u){let p=await f(u);return await m(p),p},async stat(u){let p=await f(u),g=await Y.lstat(p,{bigint:!0});if(!g.isFile()||g.isSymbolicLink())throw new Error(`${e} must be a real file: ${u}`);return{target:p,stat:g}},async hash(u){let p=await f(u);return Ta(p,{bigint:!0,label:`${e} ${u}`,verify:async(g,d)=>{if(!ht(i,d.realPath))throw new Error(`${e} resolves outside the project root`);let h=r,w=[r];for(let y of I.relative(r,I.dirname(p)).split(I.sep).filter(Boolean))h=I.join(h,y),w.push(h);for(let y of w){let b=await o.get(y),k=await Y.lstat(y,{bigint:!0});if(!k.isDirectory()||k.isSymbolicLink()||l(k)!==l(b.stat))throw new Error(`${e} directory changed while reading: ${I.relative(r,y)||"."}`)}}})},async read(u,p,g={}){let d=await f(u);return xa(d,p,{...g,label:`${e} ${u}`,verify:async(h,w)=>{if(!ht(i,w.realPath))throw new Error(`${e} resolves outside the project root`);if(t.deferDirectoryChecks)return;let y=r,b=[r];for(let k of I.relative(r,I.dirname(d)).split(I.sep).filter(Boolean))y=I.join(y,k),b.push(y);for(let k of b){let E=await o.get(k),C=await Y.lstat(k,{bigint:!0});if(!C.isDirectory()||C.isSymbolicLink()||l(C)!==l(E.stat))throw new Error(`${e} directory changed while reading: ${I.relative(r,k)||"."}`)}}})},async finish(u={}){if(s)throw new Error(`${e} read session is already finished`);s=!0;let p=[];for(let[g,d]of o){let h=await d,w=await Y.lstat(g,{bigint:!0});if(!w.isDirectory()||w.isSymbolicLink()||l(h.stat)!==l(w)||!u.allowDirectoryContentChanges&&a(h.stat)!==a(w)&&(!h.ignoreEntry||await c(g,h.ignoreEntry)!==h.namespace)||await Y.realpath(g)!==h.real)throw new Error(`${e} directory changed while observing: ${I.relative(r,g)||"."}`);a(h.stat)!==a(w)&&p.push(I.relative(r,g).replaceAll("\\","/")||".")}return{changedDirectories:p}}}}function tm(n){let e=n?.code;return e==="ENOENT"||e==="ENOTDIR"}function ht(n,e){let t=I.relative(n,e);return t===""||!I.isAbsolute(t)&&t!==".."&&!t.startsWith(`..${I.sep}`)}var $a=pt("protectedChainLstat",n=>Y.lstat(n)),Fa=pt("protectedChainRealpath",n=>Y.realpath(n)),nm=Ma("protectedChainInside",ht);async function Wa(n,e){let t=I.resolve(n),r=await $a(t);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Fa(t)}async function rm(n,e,t,r){let i=n;for(let o=0;o<t.length;o++){i=I.join(i,t[o]);let s;try{s=await $a(i)}catch(c){if(tm(c))return{exists:!1,kind:"missing"};throw c}if(s.isSymbolicLink()){let c=I.relative(n,i).replaceAll("\\","/");throw new Error(`${r.label} crosses a symbolic link or junction at ${c}`)}let a=o===t.length-1;if(!a&&!s.isDirectory()){let c=I.relative(n,i).replaceAll("\\","/");throw new Error(`${r.label} ancestor ${c} must be a real directory`)}if(a&&(r.expected==="file"&&!s.isFile()||r.expected==="directory"&&!s.isDirectory()||r.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await Fa(i);if(!nm(e,l))throw new Error(`${r.label} resolves outside the project root`);if(a)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function im(n,e,t){let r=hi(e,t.label),i=I.resolve(n),o=await Wa(i,t.label),s=r.split("/"),a=I.resolve(i,...s);if(!ht(i,a))throw new Error(`${t.label} must stay inside the project root`);let l=await rm(i,o,s,t);return{projectRoot:i,target:a,relative:r,exists:l.exists,kind:l.kind}}var og=pt("protectedInspectPath",(n,e,t)=>im(n,e,{label:"Protected project path",expected:t}));async function om(n,e,t,r){let i=!r.hooks&&!r.bigint?em.getStore():void 0;if(i){let a=I.resolve(n),l=i.get(a);return l||(l=qa(a,r.label,{deferDirectoryChecks:!0}).catch(c=>{throw i.delete(a),c}),i.set(a,l)),(await l).read(e,t,r)}let o=await qa(n,r.label),s=await o.read(e,t,r);return await o.finish({allowDirectoryContentChanges:!0}),s}var sm="Cached protected project read",sg=pt("protectedReadFile",(n,e,t)=>om(n,e,t,{label:sm}));import{promises as Ha}from"node:fs";var am=new Set(["EPERM","EACCES","EBUSY","ENOTEMPTY"]),wi=[50,100,200];async function Ka(n,e){let t;for(let r=0;r<=wi.length;r+=1)try{return await n()}catch(i){t=i;let o=i.code;if(r===wi.length||!am.has(o??""))throw i;await new Promise(s=>setTimeout(s,wi[r]))}throw t}async function Ja(n,e){await Ka(()=>Ha.rename(n,e),`rename ${e}`)}async function yi(n,e){await Ka(()=>Ha.link(n,e),`link ${e}`)}import{randomUUID as lm}from"crypto";import{constants as cm,promises as D}from"fs";import L from"path";async function ki(n,e){try{return await yi(n,e),{linked:!0}}catch(t){let r=t.code;if(r!=="ENOTSUP"&&r!=="EOPNOTSUPP")throw t}return await D.copyFile(n,e,cm.COPYFILE_EXCL),{linked:!1}}function De(n,e){let t=L.relative(n,e);return t===""||!L.isAbsolute(t)&&t!==".."&&!t.startsWith(`..${L.sep}`)}function Cn(n){return{dev:n.dev,ino:n.ino,birthtime:n.birthtimeMs}}function um(n,e){return Le(n,Cn(e))}function En(n,e){return Le(Cn(n),Cn(e))}function fm(n,e){return En(n,e)&&n.birthtimeMs===e.birthtimeMs&&n.ctimeMs===e.ctimeMs&&n.mtimeMs===e.mtimeMs&&n.size===e.size}async function Pn(n){let e=await D.lstat(n);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${n}`);return{path:n,realPath:await D.realpath(n),...Cn(e)}}async function Se(n){for(let e of n){let t=await D.lstat(e.path);if(!t.isDirectory()||t.isSymbolicLink()||!um(e,t)||await D.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function dm(n,e,t){let[r,i]=await Promise.all([D.lstat(n),D.realpath(n),Se(t)]);if(!r.isFile()||r.isSymbolicLink()||!En(r,e)||!De(t[0].realPath,i))throw new Error("Contained atomic write temporary file changed after close");return r}async function mm(n,e){let t=await pm(n,e);if(t)return t;let r=L.resolve(n),i=L.resolve(e);if(!De(r,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let o=[await Pn(r)],s=L.relative(r,i).split(L.sep).filter(Boolean),a=r;for(let l of s){await Se(o),a=L.join(a,l);try{await D.mkdir(a)}catch(m){if(m.code!=="EEXIST")throw m}let c=await Pn(a);if(!De(o[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${a}`);o.push(c)}return await Se(o),o}async function pm(n,e){let t=L.resolve(n),r=L.resolve(e);if(!De(t,r))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await Pn(t)],o=L.relative(t,r).split(L.sep).filter(Boolean),s=t;for(let a of o){s=L.join(s,a);try{let l=await Pn(s);if(!De(i[0].realPath,l.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(l)}catch(l){if(l.code==="ENOENT")return null;throw l}}return await Se(i),i}async function hm(n){let e;try{e=await D.open(n,"r"),await e.sync()}catch(t){let r=t.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw t}finally{await e?.close()}}async function za(n,e,t){let r=L.dirname(n),i=await mm(t.containedRoot,r),o=L.join(r,`.${L.basename(n)}.${lm()}.tmp`),s,a,l;try{await t.beforeTemporaryOpen?.(),s=await D.open(o,"wx"),a=await s.stat();let[c,m]=await Promise.all([D.lstat(o),D.realpath(o)]);if(await Se(i),!c.isFile()||c.isSymbolicLink()||!En(a,c)||!De(i[0].realPath,m))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),l=await s.stat(),!En(a,l))throw new Error("Contained atomic write temporary file changed while writing");if(await s.close(),s=void 0,await t.afterTemporaryClose?.(),!l)throw new Error("Contained atomic write temporary file was not written");l=await dm(o,l,i),await t.beforeCommit?.(),await Se(i);let f=await D.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!l||!fm(f,l))throw new Error("Contained atomic write temporary file changed before commit");t.exclusive?(t.requireAtomicPublication?await yi(o,n):await ki(o,n),await D.unlink(o)):await Ja(o,n),await hm(r)}catch(c){await s?.close();try{await Se(i),await D.rm(o,{force:!0})}catch{}throw c}}async function gt(n,e,t){await za(n,e,t)}async function bi(n,e,t){await za(n,e,t)}var xg=Number.MAX_SAFE_INTEGER;var An=Nn(vn(),1);var vm="<!-- COMET:DSH:START -->",Sm="<!-- COMET:DSH:END -->";var pw=new RegExp(`${Va(vm)}[\\s\\S]*?${Va(Sm)}`,"u");function Va(n){return n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}var Pm=Em(import.meta.url),Fw=Cm.dirname(Pm);function _m(n){let e=[],t="",r,i=!1,o=!1;for(let s=0;s<n.length;s++){let a=n[s];if(r){a===r?(r=void 0,o=!0):a==="\\"&&n[s+1]===r?(t+=r,s++):t+=a;continue}if(a==="\r"||a===`
|
|
175
|
+
`||";|&<>`".includes(a))return;if(/\s/u.test(a)){i&&(e.push(t),t="",i=!1,o=!1);continue}if(o)return;if(a==='"'||a==="'"){if(i)return;r=a,i=!0;continue}t+=a,i=!0}if(!r)return i&&e.push(t),e}function Qa(n,e,t){if(typeof n!="string")return!1;let r=a=>a.replace(/\\/g,"/").replace(/\.(?:sh|mjs)$/u,""),i=a=>e.some(l=>r(a).endsWith(`/skills/${r(l.replace(/\\/g,"/"))}`));if(Array.isArray(t)){let a=n.replace(/\\/g,"/").split("/").pop()?.toLowerCase(),l=t[0];return(a==="node"||a==="node.exe")&&typeof l=="string"&&i(l)}let o=qi(n);if(o)return typeof o[0]=="string"&&i(o[0]);let s=_m(n.trim());return!s||s.length<2||!["node","bash","sh"].includes(s[0])?!1:i(s[1].replace(/\\/g,"/"))}function Xa(n,e,t){return[...n.flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[i];let o=i;if(!Array.isArray(o.hooks))return[o];let s=o.hooks.filter(c=>{let m=c&&typeof c=="object"?c:{};return!Qa(m.command,t,m.args)}),a=s.length!==o.hooks.length,l=Object.keys(o).every(c=>c==="matcher"||c==="hooks");return a&&s.length===0&&l?[]:[{...o,hooks:s}]}),...e]}function Am(n="en"){let e=Oa(n),t=e.id==="zh-CN"?"zh-CN":"en",r=[{key:"change_walkthrough",def:"true",comment:B("change_walkthrough",t)},{key:"ambient_resume",def:"true",comment:B("ambient_resume",t)}],i=[{key:"artifact_layout",def:"docs",comment:B("classic.artifact_layout",t)},{key:"language",def:e.id,comment:B("classic.language",t)},{key:"context_compression",def:"off",comment:B("classic.context_compression",t)},{key:"review_mode",def:"standard",comment:B("classic.review_mode",t)},{key:"auto_transition",def:"true",comment:B("classic.auto_transition",t)}],o=[{key:"artifact_root",def:"docs",comment:B("native.artifact_root",t)},{key:"language",def:"en",comment:B("native.language",t)},{key:"clarification_mode",def:"batch",comment:B("native.clarification_mode",t)},{key:"archive_confirmation",def:"automatic",comment:B("native.archive_confirmation",t)},{key:"max_verify_failures",def:"5",comment:B("native.max_verify_failures",t)}];return{top:r,native:o,classic:i}}var Ww=Am();var my=!!"".isWellFormed;var Ei="comet/scripts/comet-plugin-hook.mjs";async function Lm(n){let e=Rm("sha256").update(N.resolve(n));async function t(r){for(let i of(await V.readdir(r)).sort()){let o=N.join(r,i),s=await V.lstat(o);if(s.isSymbolicLink())throw new Error(`Comet \u63D2\u4EF6\u8D44\u6E90\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\uFF1A${o}`);s.isDirectory()?await t(o):(await yt(o),e.update(N.relative(n,o)),e.update("\0"),e.update(await V.readFile(o)))}}return await t(N.join(n,"skills")),await t(N.join(n,"rules")),e.digest("hex")}async function yt(n,e=!1){let t=await V.lstat(n).catch(r=>{if(e&&r.code==="ENOENT")return null;throw r});if(t&&(!t.isFile()||t.isSymbolicLink()))throw new Error(`Comet \u63D2\u4EF6\u6587\u4EF6\u4E0D\u662F\u666E\u901A\u6587\u4EF6\uFF1A${n}`)}async function Za(n){let{platform:e}=n,t=N.resolve(n.pluginRoot),r=n.homeDir??Tm.homedir(),i=n.env??process.env,o=N.resolve(e==="codex"?i.CODEX_HOME??N.join(r,".codex"):i.DSH_HOME??N.join(r,".dsh")),s=N.join(t,"skills",Ei);await yt(s),await yt(N.join(t,"rules/comet-workflow-guard.md"));let a=await V.readFile(s),l=await Lm(t),c=l.slice(0,24),m=N.join(o,"comet-plugin",c),f=N.join(m,"skills",Ei),u=e==="codex"?N.join(o,"hooks.json"):N.join(m,"hooks.json");if(await V.mkdir(o,{recursive:!0}),(await V.lstat(o)).isSymbolicLink())throw new Error("Comet \u63D2\u4EF6\u914D\u7F6E\u76EE\u5F55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5");if(await yt(f,!0),await V.readFile(f).catch(()=>null)===null&&await bi(f,a,{containedRoot:o,exclusive:!0}).catch(h=>{if(h.code!=="EEXIST")throw h}),!(await V.readFile(f)).equals(a))throw new Error("Comet \u63D2\u4EF6\u542F\u52A8\u5668\u5185\u5BB9\u4E0E\u5B89\u88C5\u5305\u4E0D\u4E00\u81F4");let g=N.basename(N.dirname(t))==="comet"?`comet@${N.basename(N.dirname(N.dirname(t)))}`:void 0,d=h=>vt([f,"--platform",e,"--plugin-root",t,"--event",h,"--config-root",o,"--package-hash",l,...g&&e==="codex"?["--plugin-key",g]:[],...n.cliEntry?["--cli-entry",n.cliEntry]:[]]);return await xn(N.join(o,"comet-plugin-setup.lock"),async()=>{await yt(u,!0);let h=await V.readFile(u,"utf8").catch(k=>{if(k.code==="ENOENT")return"{}";throw k}),w=JSON.parse(h);if(!w||typeof w!="object"||Array.isArray(w))throw new Error("Hook \u914D\u7F6E\u5FC5\u987B\u662F JSON \u5BF9\u8C61");if(w.hooks!==void 0&&(!w.hooks||typeof w.hooks!="object"||Array.isArray(w.hooks)))throw new Error("hooks \u5FC5\u987B\u662F JSON \u5BF9\u8C61");let y=w.hooks??{};for(let k of["SessionStart","PreToolUse"]){if(y[k]!==void 0&&!Array.isArray(y[k]))throw new Error(`${k} \u5FC5\u987B\u662F\u6570\u7EC4`);y[k]=Xa(y[k]??[],[{matcher:e==="dsh"&&k==="PreToolUse"?"write|edit":"",hooks:[{type:"command",command:d(k)}]}],[Ei])}w.hooks=y;let b=`${JSON.stringify(w,null,2)}
|
|
176
|
+
`;h!==b&&await gt(u,b,{containedRoot:o})},{timeoutMs:3e4,retryMs:50}),{platform:e,hookConfigPath:u,requiresHookTrust:e==="codex"}}var Zy="comet",ek=["skills"];async function Jm(){let n=[import.meta.url];process.argv[1]&&n.push(Km(W.resolve(process.argv[1])).href);for(let e of n){let t=rl(e);try{t.resolve("@deepseek-ai/dsh-hooks-claude-code")}catch{continue}return t("@deepseek-ai/dsh-hooks-claude-code")}throw new Error("Comet \u7F3A\u5C11\u5B98\u65B9 dsh-hooks-claude-code \u4F9D\u8D56\uFF0C\u8BF7\u91CD\u65B0\u5B89\u88C5\u63D2\u4EF6")}var On=W.dirname(Hm(import.meta.url)),Pi=W.join(On,"skills"),zm="/comet-plugin/status",Um="/comet-plugin/dashboard",il="comet.dsh-plugin.v1",Ym="comet.dsh-dashboard.v1",Ai=JSON.parse(_i(W.join(On,"package.json"),"utf8")).version,Vm=3e4,Gm=1500;function Qm(n){let e=n.trim();return e.length>=2&&e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1).replaceAll("''","'"):e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Xm(n,e){let t=W.join(e,"SKILL.md"),r=_i(t,"utf8"),i=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/u.exec(r);if(i===null)throw new Error(`Comet skill ${t} has no frontmatter block`);let o=/^description:[ \t]*(.+?)[ \t]*$/mu.exec(i[1]);if(o===null)throw new Error(`Comet skill ${t} has no description`);let s=r.slice(i[0].length).replace(/^\r?\n/u,""),a=Qm(o[1]);return{directory:e,description:a,registration:{name:n,description:a,content:s,invocation:{modelInvocable:!0,userInvocable:!0},source:"bundled",path:t,resourceBase:{kind:"directory",path:e}}}}var In;function ol(){if(In!==void 0)return In;let n=qm(Pi,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name).sort();if(n.length===0)throw new Error(`Comet bundle has no skills in ${Pi}`);return In=n.map(e=>Xm(e,W.join(Pi,e))),In}function Ii(){let n;try{n=rl(import.meta.url).resolve("@rpamis/comet/package.json")}catch{return}try{let e=JSON.parse(_i(n,"utf8")),t=typeof e.bin=="string"?e.bin:e.bin?.comet;return typeof t!="string"||t===""?void 0:{packageRoot:W.dirname(n),binPath:W.resolve(W.dirname(n),t),version:typeof e.version=="string"?e.version:void 0}}catch{return}}async function Zm(n,e=Ii()){return e!==void 0?{source:"bundled",version:e.version,command:process.execPath,argsPrefix:[e.binPath],env:{ELECTRON_RUN_AS_NODE:"1"}}:{source:"path",command:await n.resolveExecutable("comet"),argsPrefix:[],env:{}}}function ep(n){let e=Mm(W.join(Bm(),"comet-dsh-cli-")),t=process.platform==="win32",r=W.join(e,t?"comet.cmd":"comet"),i=n.argsPrefix.map(l=>`"${l}"`).join(" "),o=t?`@echo off\r
|
|
177
|
+
setlocal DisableDelayedExpansion\r
|
|
178
|
+
set "ELECTRON_RUN_AS_NODE=1"\r
|
|
179
|
+
"${n.command}" ${i} %*\r
|
|
180
|
+
`:`#!/bin/sh
|
|
181
|
+
export ELECTRON_RUN_AS_NODE=1
|
|
182
|
+
exec "${n.command}" ${i} "$@"
|
|
183
|
+
`;Fm(r,o),t||Dm(r,493);let s=t?Object.keys(process.env).find(l=>l.toUpperCase()==="PATH")??"PATH":"PATH",a=process.env[s];return process.env[s]=a?`${e}${W.delimiter}${a}`:e,{file:r,dispose(){if(process.env[s]!==void 0){let l=process.env[s].split(W.delimiter).filter(c=>c!==e).join(W.delimiter);l===""&&a===void 0?delete process.env[s]:process.env[s]=l}$m(e,{recursive:!0,force:!0})}}}function tp(n,e,t=process.platform,r=process.env.ComSpec){let i=n.command,o=i.toLowerCase(),s=n.env??{};if(t==="win32"&&(o.endsWith(".cmd")||o.endsWith(".bat"))){if(/["\r\n\0]/u.test(i)||/["\r\n\0]/u.test(e))throw new Error("Comet Dashboard paths cannot contain double quotes");return{command:r||"cmd.exe",args:["/d","/v:off","/s","/c",'""%COMET_DSH_CLI%" dashboard "%COMET_DSH_CWD%" --no-open"'],verbatim:!0,env:{...s,COMET_DSH_CLI:i,COMET_DSH_CWD:e}}}return{command:i,args:[...n.argsPrefix??[],"dashboard",e,"--no-open"],verbatim:!1,env:s}}function np(n){return new Promise(e=>{let t;try{t=new URL(n)}catch{e(!1);return}let r=Number(t.port===""?t.protocol==="https:"?443:80:t.port),i=Wm({host:t.hostname,port:r}),o=s=>{i.destroy(),e(s)};i.setTimeout(Gm,()=>o(!1)),i.once("connect",()=>o(!0)),i.once("error",()=>o(!1))})}function rp(n,e){if(e==="win32"&&n.pid!==void 0){nl("taskkill",["/pid",String(n.pid),"/T","/F"],{windowsHide:!0,stdio:"ignore"});return}n.kill()}function ip(n){return new Promise((e,t)=>{let r;try{r=new URL(n)}catch(s){t(s);return}let i=r.port===""?r.protocol==="https:"?443:80:Number(r.port),o=el.createServer((s,a)=>{let l={...s.headers,host:r.host};delete l.origin,delete l["sec-fetch-site"],delete l["sec-fetch-dest"],delete l["sec-fetch-mode"];let c=el.request({hostname:r.hostname,port:i,path:s.url,method:s.method,headers:l},m=>{a.writeHead(m.statusCode??502,m.headers),m.pipe(a)});c.on("error",()=>{a.headersSent||a.writeHead(502,{"content-type":"text/plain; charset=utf-8"}),a.end("Comet Dashboard is unavailable")}),s.pipe(c)});o.once("error",t),o.listen(0,"127.0.0.1",()=>{let s=o.address(),a=typeof s=="object"&&s!==null?s.port:0;e({origin:`http://127.0.0.1:${a}`,close(){return typeof o.closeAllConnections=="function"&&o.closeAllConnections(),new Promise(l=>o.close(()=>l()))}})})})}function op({spawnProcess:n=nl,probe:e=np,stopProcess:t=rp,createProxy:r=ip,timeoutMs:i=Vm,platform:o=process.platform}={}){let s=new Map,a=new Map,l=u=>o==="win32"?u.toLowerCase():u,c=u=>{try{t(u,o)}catch{}},m=u=>{u!==void 0&&Promise.resolve(u.close()).catch(()=>{})},f=async(u,p)=>{let g=tp(u,p,o),d=n(g.command,g.args,{cwd:p,env:{...process.env,...g.env},stdio:["ignore","pipe","pipe"],windowsHide:!0,windowsVerbatimArguments:g.verbatim}),h="",w=await new Promise((b,k)=>{let E=setTimeout(()=>k(new Error(`Comet Dashboard did not report a URL within ${i} ms`)),i),C=(P,S)=>{clearTimeout(E),P(S)};d.stdout?.on("data",P=>{let S=String(P);if(!S.includes("Comet Dashboard running at"))return;let O=/Comet Dashboard running at (https?:\/\/\S+)/u.exec(S);O!==null&&C(b,O[1])}),d.stderr?.on("data",P=>{h=`${h}${String(P)}`.slice(-2e3)}),d.once("error",P=>C(k,P)),d.once("exit",P=>{C(k,new Error(`Comet Dashboard exited with code ${P}: ${h.trim()}`))})}).catch(b=>{throw c(d),b}),y;try{y=await r(w)}catch(b){throw c(d),b}return s.set(l(p),{child:d,url:w,proxy:y}),{url:w,webUrl:y.origin}};return{async open(u,p){let g=l(p),d=s.get(g);if(d!==void 0&&await e(d.url))return{url:d.url,webUrl:d.proxy.origin,started:!1};d!==void 0&&(c(d.child),m(d.proxy),s.delete(g));let h=a.get(g);if(h!==void 0)return{...await h,started:!0};let w=f(u,p);a.set(g,w);try{return{...await w,started:!0}}finally{a.delete(g)}},dispose(){for(let u of s.values())c(u.child),m(u.proxy);s.clear(),a.clear()}}}function tl(n,e=200){return new Response(JSON.stringify(n),{status:e,headers:{"content-type":"application/json; charset=utf-8","cache-control":"no-store"}})}function sp(){return new Response("Method Not Allowed",{status:405,headers:{allow:"GET, HEAD"}})}function X(n,e,t,r={}){n.writeHead(e,{"content-type":"application/json; charset=utf-8","cache-control":"no-store",...r}),n.end(JSON.stringify(t))}async function ap(n,e=16384){let t=[],r=0;for await(let o of n){let s=Buffer.isBuffer(o)?o:Buffer.from(String(o));if(r+=s.length,r>e)return{error:"body-too-large"};t.push(s)}let i=Buffer.concat(t).toString("utf8");if(i==="")return{value:{}};try{return{value:JSON.parse(i)}}catch{return{error:"invalid-json"}}}async function lp(n,e){let t=await n.skills.list(),r=new Map(t.map(o=>[o.name,o])),i=Ii();return{schema:il,version:Ai,integration:e,cli:i!==void 0&&i.version!==void 0?{source:"bundled",version:i.version}:{source:"path"},skills:ol().map(o=>{let s=r.get(o.registration.name);return{name:o.registration.name,description:s?.description??o.description,provider:s?.provider??null,source:s?.source??null,pluginOwned:s?.provider==="runtime"}})}}async function cp({agents:n,workingDirectory:e,subprocess:t,launcher:r},i,o){if(i.method!=="POST"){X(o,405,{error:"method-not-allowed"},{allow:"POST"});return}if(String(i.headers["content-type"]??"").split(";",1)[0].trim().toLowerCase()!=="application/json"){X(o,415,{error:"json-required"});return}let a=await ap(i);if(a.error!==void 0){X(o,a.error==="body-too-large"?413:400,{error:a.error});return}let l=typeof a.value?.sessionId=="string"?a.value.sessionId.trim():"";if(l===""){X(o,400,{error:"session-required"});return}let c=n.get(l);if(c===void 0){X(o,404,{error:"unknown-session"});return}let m;try{m=await e.ensure(c)}catch(u){X(o,409,{error:"workspace-unavailable",message:String(u?.message??u)});return}let f;try{f=await Zm(t)}catch(u){X(o,503,{error:"cli-unavailable",message:String(u?.message??u)});return}try{let u=await r.open(f,m);X(o,200,{schema:Ym,version:Ai,cwd:m,cli:{source:f.source,...f.version===void 0?{}:{cliVersion:f.version}},...u})}catch(u){X(o,503,{error:"dashboard-unavailable",message:String(u?.message??u)})}}function tk(n){let e={status:"starting"},t=ol();n.effect(()=>{let o=t.map(s=>n.skills.register(s.registration));return()=>{for(let s of o.reverse())s()}},"comet: bundled skills"),n.logger?.info?.(`Comet plugin registered ${t.length} bundled skills`);let r=op();n.effect(()=>()=>r.dispose(),"comet: dashboard processes");let i=Ii();if(i!==void 0){let o;try{o=ep({command:process.execPath,argsPrefix:[i.binPath]})}catch(s){n.logger?.warn?.(`Comet plugin could not prepare its bundled CLI: ${String(s?.message??s)}`)}o!==void 0&&n.effect(()=>()=>o.dispose(),"comet: bundled CLI shim")}n.inject(["agents","workingDirectory","subprocess","webServer"],o=>{let s=!1,a;o.effect(()=>()=>{s=!0,a?.dispose()},"comet: workflow bridge"),typeof o.plugin!="function"?(e.status="unavailable",e.message="\u5F53\u524D DSH \u672A\u63D0\u4F9B Cordis \u63D2\u4EF6\u6302\u8F7D\u5165\u53E3"):(async()=>{let c=await Za({platform:"dsh",pluginRoot:On}),m=await Jm();s||(a=o.plugin(m,{configPath:c.hookConfigPath,pluginRoot:On}),e.status="ready",e.hookConfigPath=c.hookConfigPath)})().catch(c=>{e.status="failed",e.message=String(c?.message??c),n.logger?.warn?.(`Comet \u81EA\u52A8\u63A5\u5165\u5931\u8D25\uFF1A${e.message}`)});let l={agents:o.agents,workingDirectory:o.workingDirectory,subprocess:o.subprocess,launcher:r};o.effect(()=>o.webServer.register({kind:"exact",path:zm,resource:async c=>{let m=c.method.toUpperCase();if(m!=="GET"&&m!=="HEAD")return sp();try{return tl(await lp(n,e))}catch(f){return tl({schema:il,version:Ai,error:String(f?.message??f)},500)}}}),"comet: status route"),o.effect(()=>o.webServer.register({kind:"exact",path:Um,handler:(c,m)=>cp(l,c,m)}),"comet: dashboard route")})}export{tk as apply,ep as createCometShim,op as createDashboardLauncher,tp as dashboardCommand,ek as inject,Zy as name,Ii as resolveBundledComet,Zm as resolveCometCli,Jm as resolveDshHookBridge,ip as startDashboardProxy};
|
package/locale/en.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Comet",
|
|
4
|
+
"description": "Comet is a resumable long-running workflow and Skill platform for agents. Move from requirements through implementation, verification and archiving while retaining personal memory and project knowledge. In DeepSeek Harness, open the current project Dashboard from the sidebar and use the matching Comet CLI installed with the plugin.",
|
|
5
|
+
"detail": "README.en.md"
|
|
6
|
+
}
|
|
7
|
+
}
|