vskill 1.2.10 → 1.2.12
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/agents.json +1 -1
- package/dist/commands/submit.d.ts +2 -0
- package/dist/commands/submit.js +4 -0
- package/dist/commands/submit.js.map +1 -1
- package/dist/eval-server/install-engine-routes.d.ts +12 -7
- package/dist/eval-server/install-engine-routes.js +2 -39
- package/dist/eval-server/install-engine-routes.js.map +1 -1
- package/dist/eval-server/install-jobs.js +31 -19
- package/dist/eval-server/install-jobs.js.map +1 -1
- package/dist/eval-server/install-skill-routes.js +7 -6
- package/dist/eval-server/install-skill-routes.js.map +1 -1
- package/dist/eval-server/install-state-routes.d.ts +2 -2
- package/dist/eval-server/install-state-routes.js +22 -9
- package/dist/eval-server/install-state-routes.js.map +1 -1
- package/dist/eval-server/remove-skill-routes.js +226 -156
- package/dist/eval-server/remove-skill-routes.js.map +1 -1
- package/dist/eval-server/skill-authoring-engine.d.ts +10 -0
- package/dist/eval-server/skill-authoring-engine.js +58 -0
- package/dist/eval-server/skill-authoring-engine.js.map +1 -0
- package/dist/eval-server/skill-authoring-path.d.ts +15 -0
- package/dist/eval-server/skill-authoring-path.js +38 -0
- package/dist/eval-server/skill-authoring-path.js.map +1 -0
- package/dist/eval-server/skill-authoring-route.d.ts +3 -0
- package/dist/eval-server/skill-authoring-route.js +37 -0
- package/dist/eval-server/skill-authoring-route.js.map +1 -0
- package/dist/eval-server/skill-create-routes.d.ts +74 -2
- package/dist/eval-server/skill-create-routes.js +59 -160
- package/dist/eval-server/skill-create-routes.js.map +1 -1
- package/dist/eval-server/skill-generate-route.d.ts +2 -0
- package/dist/eval-server/skill-generate-route.js +130 -0
- package/dist/eval-server/skill-generate-route.js.map +1 -0
- package/dist/eval-server/skill-install-paths.d.ts +39 -0
- package/dist/eval-server/skill-install-paths.js +167 -0
- package/dist/eval-server/skill-install-paths.js.map +1 -0
- package/dist/eval-server/skill-md-emitter.js +4 -2
- package/dist/eval-server/skill-md-emitter.js.map +1 -1
- package/dist/eval-server/supported-agents-routes.d.ts +8 -2
- package/dist/eval-server/supported-agents-routes.js +10 -2
- package/dist/eval-server/supported-agents-routes.js.map +1 -1
- package/dist/eval-ui/assets/{AdvancedTab-6VlfqCuD.js → AdvancedTab-DX3v5Q7O.js} +1 -1
- package/dist/eval-ui/assets/CreateSkillPage-CwreCn22.js +151 -0
- package/dist/eval-ui/assets/{FindSkillsPalette-M6Ot4Qeq.js → FindSkillsPalette-B5-3ZLEo.js} +2 -2
- package/dist/eval-ui/assets/{GeneralTab-BpFlJ2ue.js → GeneralTab-BfFbcbuP.js} +1 -1
- package/dist/eval-ui/assets/{PrivacyTab-UfO7QLy_.js → PrivacyTab-Bq2N7Iam.js} +1 -1
- package/dist/eval-ui/assets/{SearchPaletteCore-CufFV6OR.js → SearchPaletteCore-Bgld3QTz.js} +1 -1
- package/dist/eval-ui/assets/SkillDetailPanel-B5LYvcry.js +1 -0
- package/dist/eval-ui/assets/{UpdateDropdown-CVM2xW6V.js → UpdateDropdown-VRCYPtXG.js} +1 -1
- package/dist/eval-ui/assets/{UpdatesTab-C38-n7V3.js → UpdatesTab-w6h18GPp.js} +1 -1
- package/dist/eval-ui/assets/core-DgHXlyD_.js +1 -0
- package/dist/eval-ui/assets/{event-QtOCMXAv.js → event-CABB5pUM.js} +1 -1
- package/dist/eval-ui/assets/{fonts-i7Lkz2zN.css → fonts-BZeyWEAn.css} +1 -1
- package/dist/eval-ui/assets/{index-DlQYQHDO.js → index-Bje294df.js} +1 -1
- package/dist/eval-ui/assets/{index-DDNzcrhv.js → index-D0lWXViJ.js} +1 -1
- package/dist/eval-ui/assets/{index-CUEYzTVL.js → index-DCV9_0X4.js} +1 -1
- package/dist/eval-ui/assets/main-DIkxEshL.js +86 -0
- package/dist/eval-ui/assets/{preferences-BN-jNWS0.js → preferences-VTBvoXmM.js} +2 -2
- package/dist/eval-ui/assets/source-serif-4-cyrillic-ext-wght-normal-DHTKMUil.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-cyrillic-wght-normal-B1g8a0vD.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-greek-wght-normal-BpXpdlRW.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-latin-ext-wght-normal-BVZ5su8S.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-latin-wght-normal-DMe4EKeb.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-vietnamese-wght-normal-BsaNuasd.woff2 +0 -0
- package/dist/eval-ui/assets/{useDesktopBridge-Cm4zPght.js → useDesktopBridge-C8dT34x9.js} +2 -2
- package/dist/eval-ui/index.html +3 -3
- package/dist/eval-ui/lifecycle.html +2 -2
- package/dist/eval-ui/preferences.html +3 -3
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/shared/authoring-engine-commands.d.ts +14 -0
- package/dist/shared/authoring-engine-commands.js +10 -0
- package/dist/shared/authoring-engine-commands.js.map +1 -0
- package/dist/shared/skill-authoring-document.d.ts +28 -0
- package/dist/shared/skill-authoring-document.js +187 -0
- package/dist/shared/skill-authoring-document.js.map +1 -0
- package/dist/studio/routes/index.js +1 -1
- package/dist/studio/routes/index.js.map +1 -1
- package/dist/utils/semver.d.ts +1 -0
- package/dist/utils/semver.js +18 -0
- package/dist/utils/semver.js.map +1 -1
- package/dist/utils/skill-builder-detection.js +4 -9
- package/dist/utils/skill-builder-detection.js.map +1 -1
- package/package.json +5 -4
- package/dist/eval-ui/assets/CreateSkillPage-e3YH0sBH.js +0 -13
- package/dist/eval-ui/assets/SkillDetailPanel-B7f3UPBT.js +0 -1
- package/dist/eval-ui/assets/core-DZjBCfjp.js +0 -1
- package/dist/eval-ui/assets/main-C30fpcFP.js +0 -86
- package/dist/eval-ui/assets/source-serif-4-cyrillic-ext-wght-normal-cHuGMAiY.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-cyrillic-wght-normal-DwHjdM4S.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-greek-wght-normal-ece1310W.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-latin-ext-wght-normal-CxNHBx-q.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-latin-wght-normal-D9elroTD.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-vietnamese-wght-normal-D-yuW59g.woff2 +0 -0
- /package/dist/eval-ui/assets/{lifecycle-n00yue6r.js → lifecycle-DC0khFSd.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supported-agents-routes.js","sourceRoot":"","sources":["../../src/eval-server/supported-agents-routes.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,gEAAgE;AAChE,EAAE;AACF,sDAAsD;AACtD,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,2EAA2E;AAC3E,qDAAqD;AACrD,kEAAkE;AAClE,0EAA0E;AAC1E,2BAA2B;AAC3B,mFAAmF;AACnF,oEAAoE;
|
|
1
|
+
{"version":3,"file":"supported-agents-routes.js","sourceRoot":"","sources":["../../src/eval-server/supported-agents-routes.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,gEAAgE;AAChE,EAAE;AACF,sDAAsD;AACtD,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,2EAA2E;AAC3E,qDAAqD;AACrD,kEAAkE;AAClE,0EAA0E;AAC1E,2BAA2B;AAC3B,mFAAmF;AACnF,oEAAoE;AAGpE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAuB,MAAM,8BAA8B,CAAC;AAUvF,MAAM,UAAU,eAAe,CAAC,MAAwB,EAAE,IAAmB;IAC3E,IAAI,CAAC,IAAI;QAAE,OAAO,MAAM,CAAC;IACzB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAC1B,KAAK,CAAC,gBAAgB,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC;QAC3D,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,kBAAkB,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAE;QACtE,CAAC,CAAC,KAAK,CACV,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,GAAyB;IAC5C,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC;IAC5C,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,kBAAkB,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,MAAc,EAAE,OAAsB;IAClF,MAAM,CAAC,GAAG,CACR,8BAA8B,EAC9B,KAAK,EAAE,GAAyB,EAAE,GAAwB,EAAE,EAAE;QAC5D,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,QAAQ,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,yBAAyB,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;YAC9D,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,kBAAkB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,IAAI,CAAC,CAAC;YAChF,MAAM,IAAI,GAA4B,EAAE,MAAM,EAAE,CAAC;YACjD,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,QAAQ,CACN,GAAG,EACH,EAAE,KAAK,EAAE,+BAA+B,EAAE,MAAM,EAAE,OAAO,EAAE,EAC3D,GAAG,EACH,GAAG,CACJ,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as e}from"./globals-DmzftdEG.js";import{u as L,S as d,F as u,C as k,D as R}from"./preferences-
|
|
1
|
+
import{r as s,j as e}from"./globals-DmzftdEG.js";import{u as L,S as d,F as u,C as k,D as R}from"./preferences-VTBvoXmM.js";/* empty css */import"./useDesktopBridge-C8dT34x9.js";const g="~/.vskill/settings.json";function S(t){switch(t){case"ask":return"Show the lifecycle modal whenever another studio instance is detected.";case"use-existing":return"Always switch to the running instance — no modal, no extra sidecar.";case"stop-and-replace":return"SIGTERM the existing instance (3s grace, then SIGKILL) and start this app's sidecar.";case"run-alongside":return"Start this app's sidecar on a fresh port; both instances coexist.";default:return""}}function E({bridge:t,snapshot:i,onSnapshotChanged:r,pushToast:l}){var p;const{t:a}=L("preferences"),n=!t.available,[x,o]=s.useState(!1),[v,f]=s.useState(g);s.useEffect(()=>{if(n){f(a("advanced.settingsPath.browserValue"));return}f(g)},[n,a]);const y=(i==null?void 0:i.advanced.logLevel)??"info",h=((p=i==null?void 0:i.studio)==null?void 0:p.lifecycleDefault)??"ask",b=s.useCallback(async c=>{try{await t.setSetting("advanced.logLevel",c),await r()}catch{l({message:"Couldn't update log level.",variant:"error"})}},[t,r,l]),m=s.useCallback(async c=>{try{await t.setSetting("studio.lifecycleDefault",c),await r()}catch{l({message:"Couldn't update studio lifecycle default.",variant:"error"})}},[t,r,l]),j=s.useCallback(async()=>{try{await t.copyToClipboard(v),l({message:a("advanced.settingsPath.copied")})}catch{l({message:"Couldn't copy.",variant:"error"})}},[t,l,v,a]),w=s.useCallback(async()=>{try{await t.revealSettingsFile()}catch{l({message:"Couldn't open settings file.",variant:"error"})}},[t,l]),C=s.useCallback(async()=>{try{await t.resetSettings(),await r(),l({message:a("advanced.factoryReset.done"),variant:"success"})}catch{l({message:"Couldn't reset preferences.",variant:"error"})}finally{o(!1)}},[t,r,l,a]);return e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"preferences-content__heading",children:[e.jsx("h1",{children:a("advanced.heading")}),e.jsx("p",{children:a("advanced.subheading")})]}),e.jsx(d,{title:a("advanced.logLevel.label"),children:e.jsx(u,{label:a("advanced.logLevel.label"),help:a("advanced.logLevel.help"),control:e.jsxs("select",{className:"pref-select",value:y,onChange:c=>b(c.target.value),disabled:n,"aria-disabled":n||void 0,"aria-label":a("advanced.logLevel.label"),children:[e.jsx("option",{value:"error",children:a("advanced.logLevel.error")}),e.jsx("option",{value:"warn",children:a("advanced.logLevel.warn")}),e.jsx("option",{value:"info",children:a("advanced.logLevel.info")}),e.jsx("option",{value:"debug",children:a("advanced.logLevel.debug")}),e.jsx("option",{value:"trace",children:a("advanced.logLevel.trace")})]})})}),e.jsx(d,{title:"Studio lifecycle",children:e.jsx(u,{label:"When another Skill Studio is already running",help:"Choose what the desktop app should do at launch when an existing instance is detected. 'Ask each time' shows the modal; the others run silently.",control:e.jsxs("select",{className:"pref-select",value:h,onChange:c=>m(c.target.value),disabled:n,"aria-disabled":n||void 0,"aria-label":"Studio lifecycle default",title:S(h),children:[e.jsx("option",{value:"ask",children:"Ask each time (default)"}),e.jsx("option",{value:"use-existing",children:"Use existing instance"}),e.jsx("option",{value:"stop-and-replace",children:"Stop existing + use this app"}),e.jsx("option",{value:"run-alongside",children:"Run alongside"})]})})}),e.jsx(d,{title:a("advanced.settingsPath.label"),children:e.jsx(u,{stacked:!0,label:a("advanced.settingsPath.label"),help:a("advanced.settingsPath.help"),control:e.jsxs("div",{style:{display:"flex",gap:8,marginTop:6,flexWrap:"wrap"},children:[e.jsx("code",{className:"pref-path-display",style:{flex:1,minWidth:200},children:v}),e.jsx("button",{type:"button",className:"pref-button",onClick:j,children:a("advanced.settingsPath.copy")}),e.jsx("button",{type:"button",className:"pref-button",onClick:w,disabled:n,"aria-disabled":n||void 0,children:a("advanced.settingsPath.reveal")})]})})}),e.jsx(d,{title:a("advanced.factoryReset.label"),children:e.jsx(u,{label:a("advanced.factoryReset.label"),help:a("advanced.factoryReset.help"),control:e.jsx("button",{type:"button",className:"pref-button pref-button--danger",onClick:()=>o(!0),children:a("advanced.factoryReset.button")})})}),n?e.jsx(k,{variant:"info",children:a("app.browserCallout")}):null,e.jsxs(R,{open:x,onDismiss:()=>o(!1),ariaLabel:a("advanced.factoryReset.confirmTitle"),children:[e.jsx("h2",{className:"pref-dialog__title",children:a("advanced.factoryReset.confirmTitle")}),e.jsx("p",{className:"pref-dialog__body",children:a("advanced.factoryReset.confirmBody")}),e.jsxs("div",{className:"pref-dialog__actions",children:[e.jsx("button",{type:"button",className:"pref-button",onClick:()=>o(!1),children:a("advanced.factoryReset.cancel")}),e.jsx("button",{type:"button",className:"pref-button pref-button--danger",onClick:C,children:a("advanced.factoryReset.confirm")})]})]})]})}export{E as AdvancedTab};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import{j as u,R as D,r as P}from"./globals-DmzftdEG.js";import{i as yt,o as Rs,u as Fs,b as qs,g as Rt,r as Ft,w as Us,c as Vs,d as Gs,t as _e,p as Ys,L as at,P as Hs,E as Js,e as Ws,S as Qs}from"./main-DIkxEshL.js";import"./useDesktopBridge-C8dT34x9.js";/* empty css */const St=Symbol.for("yaml.alias"),bt=Symbol.for("yaml.document"),ne=Symbol.for("yaml.map"),Zt=Symbol.for("yaml.pair"),X=Symbol.for("yaml.scalar"),xe=Symbol.for("yaml.seq"),H=Symbol.for("yaml.node.type"),ae=s=>!!s&&typeof s=="object"&&s[H]===St,ze=s=>!!s&&typeof s=="object"&&s[H]===bt,ce=s=>!!s&&typeof s=="object"&&s[H]===ne,_=s=>!!s&&typeof s=="object"&&s[H]===Zt,L=s=>!!s&&typeof s=="object"&&s[H]===X,Le=s=>!!s&&typeof s=="object"&&s[H]===xe;function $(s){if(s&&typeof s=="object")switch(s[H]){case ne:case xe:return!0}return!1}function C(s){if(s&&typeof s=="object")switch(s[H]){case St:case ne:case X:case xe:return!0}return!1}const es=s=>(L(s)||$(s))&&!!s.anchor,ie=Symbol("break visit"),zs=Symbol("skip children"),Ae=Symbol("remove node");function ee(s,e){const t=Xs(e);ze(s)?he(null,s.contents,t,Object.freeze([s]))===Ae&&(s.contents=null):he(null,s,t,Object.freeze([]))}ee.BREAK=ie;ee.SKIP=zs;ee.REMOVE=Ae;function he(s,e,t,n){const i=Zs(s,e,t,n);if(C(i)||_(i))return en(s,n,i),he(s,i,t,n);if(typeof i!="symbol"){if($(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=he(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===ie)return ie;o===Ae&&(e.items.splice(r,1),r-=1)}}}else if(_(e)){n=Object.freeze(n.concat(e));const r=he("key",e.key,t,n);if(r===ie)return ie;r===Ae&&(e.key=null);const o=he("value",e.value,t,n);if(o===ie)return ie;o===Ae&&(e.value=null)}}return i}function Xs(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Zs(s,e,t,n){var i,r,o,l,a;if(typeof t=="function")return t(s,e,n);if(ce(e))return(i=t.Map)==null?void 0:i.call(t,s,e,n);if(Le(e))return(r=t.Seq)==null?void 0:r.call(t,s,e,n);if(_(e))return(o=t.Pair)==null?void 0:o.call(t,s,e,n);if(L(e))return(l=t.Scalar)==null?void 0:l.call(t,s,e,n);if(ae(e))return(a=t.Alias)==null?void 0:a.call(t,s,e,n)}function en(s,e,t){const n=e[e.length-1];if($(n))n.items[s]=t;else if(_(n))s==="key"?n.key=t:n.value=t;else if(ze(n))n.contents=t;else{const i=ae(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const tn={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},sn=s=>s.replace(/[!,[\]{}]/g,e=>tn[e]);class q{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},q.defaultYaml,e),this.tags=Object.assign({},q.defaultTags,t)}clone(){const e=new q(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new q(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:q.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},q.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:q.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},q.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!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]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);const r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+sn(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&C(e.contents)){const r={};ee(e.contents,(o,l)=>{C(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
2
|
+
`)}}q.defaultYaml={explicit:!1,version:"1.2"};q.defaultTags={"!!":"tag:yaml.org,2002:"};function ts(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function ss(s){const e=new Set;return ee(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function ns(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function nn(s,e){const t=[],n=new Map;let i=null;return{onAnchor:r=>{t.push(r),i??(i=ss(s));const o=ns(e,i);return i.add(o),o},setAnchors:()=>{for(const r of t){const o=n.get(r);if(typeof o=="object"&&o.anchor&&(L(o.node)||$(o.node)))o.node.anchor=o.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:n}}function pe(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){const o=n[i],l=pe(s,n,String(i),o);l===void 0?delete n[i]:l!==o&&(n[i]=l)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const r=n.get(i),o=pe(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(const i of Array.from(n)){const r=pe(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(const[i,r]of Object.entries(n)){const o=pe(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}function Y(s,e,t){if(Array.isArray(s))return s.map((n,i)=>Y(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!es(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};const i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!(t!=null&&t.keep)?Number(s):s}class jt{constructor(e){Object.defineProperty(this,H,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!ze(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=Y(this,"",o);if(typeof i=="function")for(const{count:a,res:c}of o.anchors.values())i(c,a);return typeof r=="function"?pe(r,{"":l},"",l):l}}class At extends jt{constructor(e){super(St),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if((t==null?void 0:t.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let n;t!=null&&t.aliasResolveCache?n=t.aliasResolveCache:(n=[],ee(e,{Node:(r,o)=>{(ae(o)||es(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(const r of n){if(r===this)break;r.anchor===this.source&&(i=r)}if(i&&t){const{anchors:r,doc:o,maxAliasCount:l}=t;let a=r.get(i);if(a||(Y(i,null,t),a=r.get(i)),(a==null?void 0:a.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(l>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Ue(o,i,r)),a.count*a.aliasCount>l)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}}return i}toJSON(e,t){if(!t)return{source:this.source};const n=this.resolve(t.doc,t);if(!n){const i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return t.anchors.get(n).res}toString(e,t,n){const i=`*${this.source}`;if(e){if(ts(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}}function Ue(s,e,t){if(ae(e)){const n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if($(e)){let n=0;for(const i of e.items){const r=Ue(s,i,t);r>n&&(n=r)}return n}else if(_(e)){const n=Ue(s,e.key,t),i=Ue(s,e.value,t);return Math.max(n,i)}return 1}const is=s=>!s||typeof s!="function"&&typeof s!="object";class I extends jt{constructor(e){super(X),this.value=e}toJSON(e,t){return t!=null&&t.keep?this.value:Y(this.value,e,t)}toString(){return String(this.value)}}I.BLOCK_FOLDED="BLOCK_FOLDED";I.BLOCK_LITERAL="BLOCK_LITERAL";I.PLAIN="PLAIN";I.QUOTE_DOUBLE="QUOTE_DOUBLE";I.QUOTE_SINGLE="QUOTE_SINGLE";const rn="tag:yaml.org,2002:";function on(s,e,t){if(e){const n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>{var i;return((i=n.identify)==null?void 0:i.call(n,s))&&!n.format})}function Te(s,e,t){var d,h,m;if(ze(s)&&(s=s.contents),C(s))return s;if(_(s)){const b=(h=(d=t.schema[ne]).createNode)==null?void 0:h.call(d,t.schema,null,t);return b.items.push(s),b}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=t;let a;if(n&&s&&typeof s=="object"){if(a=l.get(s),a)return a.anchor??(a.anchor=i(s)),new At(a.anchor);a={anchor:null,node:null},l.set(s,a)}e!=null&&e.startsWith("!!")&&(e=rn+e.slice(2));let c=on(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const b=new I(s);return a&&(a.node=b),b}c=s instanceof Map?o[ne]:Symbol.iterator in Object(s)?o[xe]:o[ne]}r&&(r(c),delete t.onTagObj);const p=c!=null&&c.createNode?c.createNode(t.schema,s,t):typeof((m=c==null?void 0:c.nodeClass)==null?void 0:m.from)=="function"?c.nodeClass.from(t.schema,s,t):new I(s);return e?p.tag=e:c.default||(p.tag=c.tag),a&&(a.node=p),p}function He(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return Te(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const je=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class rs extends jt{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>C(n)||_(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(je(e))this.add(t);else{const[n,...i]=e,r=this.get(n,!0);if($(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,He(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const i=this.get(t,!0);if($(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&L(r)?r.value:r:$(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!_(t))return!1;const n=t.value;return n==null||e&&L(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const i=this.get(t,!0);return $(i)?i.hasIn(n):!1}setIn(e,t){const[n,...i]=e;if(i.length===0)this.set(n,t);else{const r=this.get(n,!0);if($(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,He(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}const ln=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Z(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const re=(s,e,t)=>s.endsWith(`
|
|
3
|
+
`)?Z(t,e):t.includes(`
|
|
4
|
+
`)?`
|
|
5
|
+
`+Z(t,e):(s.endsWith(" ")?"":" ")+t,os="flow",wt="block",Ve="quoted";function Xe(s,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return s;i<r&&(r=0);const a=Math.max(1+r,1+i-e.length);if(s.length<=a)return s;const c=[],p={};let d=i-e.length;typeof n=="number"&&(n>i-Math.max(2,r)?c.push(0):d=i-n);let h,m,b=!1,g=-1,w=-1,x=-1;t===wt&&(g=qt(s,g,e.length),g!==-1&&(d=g+a));for(let S;S=s[g+=1];){if(t===Ve&&S==="\\"){switch(w=g,s[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}x=g}if(S===`
|
|
6
|
+
`)t===wt&&(g=qt(s,g,e.length)),d=g+e.length+a,h=void 0;else{if(S===" "&&m&&m!==" "&&m!==`
|
|
7
|
+
`&&m!==" "){const N=s[g+1];N&&N!==" "&&N!==`
|
|
8
|
+
`&&N!==" "&&(h=g)}if(g>=d)if(h)c.push(h),d=h+a,h=void 0;else if(t===Ve){for(;m===" "||m===" ";)m=S,S=s[g+=1],b=!0;const N=g>x+1?g-2:w-1;if(p[N])return s;c.push(N),p[N]=!0,d=N+a,h=void 0}else b=!0}m=S}if(b&&l&&l(),c.length===0)return s;o&&o();let k=s.slice(0,c[0]);for(let S=0;S<c.length;++S){const N=c[S],j=c[S+1]||s.length;N===0?k=`
|
|
9
|
+
${e}${s.slice(0,j)}`:(t===Ve&&p[N]&&(k+=`${s[N]}\\`),k+=`
|
|
10
|
+
${e}${s.slice(N+1,j)}`)}return k}function qt(s,e,t){let n=e,i=e+1,r=s[i];for(;r===" "||r===" ";)if(e<i+t)r=s[++e];else{do r=s[++e];while(r&&r!==`
|
|
11
|
+
`);n=e,i=e+1,r=s[i]}return n}const Ze=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),et=s=>/^(%|---|\.\.\.)/m.test(s);function an(s,e,t){if(!e||e<0)return!1;const n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;r<i;++r)if(s[r]===`
|
|
12
|
+
`){if(r-o>n)return!0;if(o=r+1,i-o<=n)return!1}return!0}function Ie(s,e){const t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(et(s)?" ":"");let o="",l=0;for(let a=0,c=t[a];c;c=t[++a])if(c===" "&&t[a+1]==="\\"&&t[a+2]==="n"&&(o+=t.slice(l,a)+"\\ ",a+=1,l=a,c="\\"),c==="\\")switch(t[a+1]){case"u":{o+=t.slice(l,a);const p=t.substr(a+2,4);switch(p){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:p.substr(0,2)==="00"?o+="\\x"+p.substr(2):o+=t.substr(a,6)}a+=5,l=a+1}break;case"n":if(n||t[a+2]==='"'||t.length<i)a+=1;else{for(o+=t.slice(l,a)+`
|
|
13
|
+
|
|
14
|
+
`;t[a+2]==="\\"&&t[a+3]==="n"&&t[a+4]!=='"';)o+=`
|
|
15
|
+
`,a+=2;o+=r,t[a+2]===" "&&(o+="\\"),a+=1,l=a+1}break;default:a+=1}return o=l?o+t.slice(l):t,n?o:Xe(o,r,Ve,Ze(e,!1))}function xt(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
|
|
16
|
+
`)||/[ \t]\n|\n[ \t]/.test(s))return Ie(s,e);const t=e.indent||(et(s)?" ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
17
|
+
${t}`)+"'";return e.implicitKey?n:Xe(n,t,os,Ze(e,!1))}function me(s,e){const{singleQuote:t}=e.options;let n;if(t===!1)n=Ie;else{const i=s.includes('"'),r=s.includes("'");i&&!r?n=xt:r&&!i?n=Ie:n=t?xt:Ie}return n(s,e)}let kt;try{kt=new RegExp(`(^|(?<!
|
|
18
|
+
))
|
|
19
|
+
+(?!
|
|
20
|
+
|$)`,"g")}catch{kt=/\n+(?!\n|$)/g}function Ge({comment:s,type:e,value:t},n,i,r){const{blockQuote:o,commentString:l,lineWidth:a}=n.options;if(!o||/\n[\t ]+$/.test(t))return me(t,n);const c=n.indent||(n.forceBlockIndent||et(t)?" ":""),p=o==="literal"?!0:o==="folded"||e===I.BLOCK_FOLDED?!1:e===I.BLOCK_LITERAL?!0:!an(t,a,c.length);if(!t)return p?`|
|
|
21
|
+
`:`>
|
|
22
|
+
`;let d,h;for(h=t.length;h>0;--h){const j=t[h-1];if(j!==`
|
|
23
|
+
`&&j!==" "&&j!==" ")break}let m=t.substring(h);const b=m.indexOf(`
|
|
24
|
+
`);b===-1?d="-":t===m||b!==m.length-1?(d="+",r&&r()):d="",m&&(t=t.slice(0,-m.length),m[m.length-1]===`
|
|
25
|
+
`&&(m=m.slice(0,-1)),m=m.replace(kt,`$&${c}`));let g=!1,w,x=-1;for(w=0;w<t.length;++w){const j=t[w];if(j===" ")g=!0;else if(j===`
|
|
26
|
+
`)x=w;else break}let k=t.substring(0,x<w?x+1:w);k&&(t=t.substring(k.length),k=k.replace(/\n+/g,`$&${c}`));let N=(g?c?"2":"1":"")+d;if(s&&(N+=" "+l(s.replace(/ ?[\r\n]+/g," ")),i&&i()),!p){const j=t.replace(/\n+/g,`
|
|
27
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);let T=!1;const A=Ze(n,!0);o!=="folded"&&e!==I.BLOCK_FOLDED&&(A.onOverflow=()=>{T=!0});const v=Xe(`${k}${j}${m}`,c,wt,A);if(!T)return`>${N}
|
|
28
|
+
${c}${v}`}return t=t.replace(/\n+/g,`$&${c}`),`|${N}
|
|
29
|
+
${c}${k}${t}${m}`}function cn(s,e,t,n){const{type:i,value:r}=s,{actualString:o,implicitKey:l,indent:a,indentStep:c,inFlow:p}=e;if(l&&r.includes(`
|
|
30
|
+
`)||p&&/[[\]{},]/.test(r))return me(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||p||!r.includes(`
|
|
31
|
+
`)?me(r,e):Ge(s,e,t,n);if(!l&&!p&&i!==I.PLAIN&&r.includes(`
|
|
32
|
+
`))return Ge(s,e,t,n);if(et(r)){if(a==="")return e.forceBlockIndent=!0,Ge(s,e,t,n);if(l&&a===c)return me(r,e)}const d=r.replace(/\n+/g,`$&
|
|
33
|
+
${a}`);if(o){const h=g=>{var w;return g.default&&g.tag!=="tag:yaml.org,2002:str"&&((w=g.test)==null?void 0:w.test(d))},{compat:m,tags:b}=e.doc.schema;if(b.some(h)||m!=null&&m.some(h))return me(r,e)}return l?d:Xe(d,a,os,Ze(e,!1))}function It(s,e,t,n){const{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)});let{type:l}=s;l!==I.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=I.QUOTE_DOUBLE);const a=p=>{switch(p){case I.BLOCK_FOLDED:case I.BLOCK_LITERAL:return i||r?me(o.value,e):Ge(o,e,t,n);case I.QUOTE_DOUBLE:return Ie(o.value,e);case I.QUOTE_SINGLE:return xt(o.value,e);case I.PLAIN:return cn(o,e,t,n);default:return null}};let c=a(l);if(c===null){const{defaultKeyType:p,defaultStringType:d}=e.options,h=i&&p||d;if(c=a(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function ls(s,e){const t=Object.assign({blockQuote:!0,commentString:ln,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},s.schema.toStringOptions,e);let n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function un(s,e){var i;if(e.tag){const r=s.filter(o=>o.tag===e.tag);if(r.length>0)return r.find(o=>o.format===e.format)??r[0]}let t,n;if(L(e)){n=e.value;let r=s.filter(o=>{var l;return(l=o.identify)==null?void 0:l.call(o,n)});if(r.length>1){const o=r.filter(l=>l.test);o.length>0&&(r=o)}t=r.find(o=>o.format===e.format)??r.find(o=>!o.format)}else n=e,t=s.find(r=>r.nodeClass&&n instanceof r.nodeClass);if(!t){const r=((i=n==null?void 0:n.constructor)==null?void 0:i.name)??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${r} value`)}return t}function fn(s,e,{anchors:t,doc:n}){if(!n.directives)return"";const i=[],r=(L(s)||$(s))&&s.anchor;r&&ts(r)&&(t.add(r),i.push(`&${r}`));const o=s.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function be(s,e,t,n){var a;if(_(s))return s.toString(e,t,n);if(ae(s)){if(e.doc.directives)return s.toString(e);if((a=e.resolvedAliases)!=null&&a.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i;const r=C(s)?s:e.doc.createNode(s,{onTagObj:c=>i=c});i??(i=un(e.doc.schema.tags,r));const o=fn(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const l=typeof i.stringify=="function"?i.stringify(r,e,t,n):L(r)?It(r,e,t,n):r.toString(e,t,n);return o?L(r)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
|
|
34
|
+
${e.indent}${l}`:l}function dn({key:s,value:e},t,n,i){const{allNullValues:r,doc:o,indent:l,indentStep:a,options:{commentString:c,indentSeq:p,simpleKeys:d}}=t;let h=C(s)&&s.comment||null;if(d){if(h)throw new Error("With simple keys, key nodes cannot have comments");if($(s)||!C(s)&&typeof s=="object"){const A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let m=!d&&(!s||h&&e==null&&!t.inFlow||$(s)||(L(s)?s.type===I.BLOCK_FOLDED||s.type===I.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!m&&(d||!r),indent:l+a});let b=!1,g=!1,w=be(s,t,()=>b=!0,()=>g=!0);if(!m&&!t.inFlow&&w.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(t.inFlow){if(r||e==null)return b&&n&&n(),w===""?"?":m?`? ${w}`:w}else if(r&&!d||e==null&&m)return w=`? ${w}`,h&&!b?w+=re(w,t.indent,c(h)):g&&i&&i(),w;b&&(h=null),m?(h&&(w+=re(w,t.indent,c(h))),w=`? ${w}
|
|
35
|
+
${l}:`):(w=`${w}:`,h&&(w+=re(w,t.indent,c(h))));let x,k,S;C(e)?(x=!!e.spaceBefore,k=e.commentBefore,S=e.comment):(x=!1,k=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!m&&!h&&L(e)&&(t.indentAtStart=w.length+1),g=!1,!p&&a.length>=2&&!t.inFlow&&!m&&Le(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let N=!1;const j=be(e,t,()=>N=!0,()=>g=!0);let T=" ";if(h||x||k){if(T=x?`
|
|
36
|
+
`:"",k){const A=c(k);T+=`
|
|
37
|
+
${Z(A,t.indent)}`}j===""&&!t.inFlow?T===`
|
|
38
|
+
`&&S&&(T=`
|
|
39
|
+
|
|
40
|
+
`):T+=`
|
|
41
|
+
${t.indent}`}else if(!m&&$(e)){const A=j[0],v=j.indexOf(`
|
|
42
|
+
`),E=v!==-1,B=t.inFlow??e.flow??e.items.length===0;if(E||!B){let f=!1;if(E&&(A==="&"||A==="!")){let M=j.indexOf(" ");A==="&"&&M!==-1&&M<v&&j[M+1]==="!"&&(M=j.indexOf(" ",M+1)),(M===-1||v<M)&&(f=!0)}f||(T=`
|
|
43
|
+
${t.indent}`)}}else(j===""||j[0]===`
|
|
44
|
+
`)&&(T="");return w+=T+j,t.inFlow?N&&n&&n():S&&!N?w+=re(w,t.indent,c(S)):g&&i&&i(),w}function hn(s,e){(s==="debug"||s==="warn")&&console.warn(e)}const Me="<<",te={identify:s=>s===Me||typeof s=="symbol"&&s.description===Me,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new I(Symbol(Me)),{addToJSMap:as}),stringify:()=>Me},pn=(s,e)=>(te.identify(e)||L(e)&&(!e.type||e.type===I.PLAIN)&&te.identify(e.value))&&(s==null?void 0:s.doc.schema.tags.some(t=>t.tag===te.tag&&t.default));function as(s,e,t){const n=cs(s,t);if(Le(n))for(const i of n.items)ct(s,e,i);else if(Array.isArray(n))for(const i of n)ct(s,e,i);else ct(s,e,n)}function ct(s,e,t){const n=cs(s,t);if(!ce(n))throw new Error("Merge sources must be maps or map aliases");const i=n.toJSON(null,s,Map);for(const[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function cs(s,e){return s&&ae(e)?e.resolve(s.doc,s):e}function us(s,e,{key:t,value:n}){if(C(t)&&t.addToJSMap)t.addToJSMap(s,e,n);else if(pn(s,t))as(s,e,n);else{const i=Y(t,"",s);if(e instanceof Map)e.set(i,Y(n,i,s));else if(e instanceof Set)e.add(i);else{const r=mn(t,i,s),o=Y(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function mn(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(C(s)&&(t!=null&&t.doc)){const n=ls(t.doc,{});n.anchors=new Set;for(const r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;const i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),hn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Tt(s,e,t){const n=Te(s,void 0,t),i=Te(e,void 0,t);return new U(n,i)}class U{constructor(e,t=null){Object.defineProperty(this,H,{value:Zt}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return C(t)&&(t=t.clone(e)),C(n)&&(n=n.clone(e)),new U(t,n)}toJSON(e,t){const n=t!=null&&t.mapAsMap?new Map:{};return us(t,n,this)}toString(e,t,n){return e!=null&&e.doc?dn(this,e,t,n):JSON.stringify(this)}}function fs(s,e,t){return(e.inFlow??s.flow?yn:gn)(s,e,t)}function gn({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:l}){const{indent:a,options:{commentString:c}}=t,p=Object.assign({},t,{indent:r,type:null});let d=!1;const h=[];for(let b=0;b<e.length;++b){const g=e[b];let w=null;if(C(g))!d&&g.spaceBefore&&h.push(""),Je(t,h,g.commentBefore,d),g.comment&&(w=g.comment);else if(_(g)){const k=C(g.key)?g.key:null;k&&(!d&&k.spaceBefore&&h.push(""),Je(t,h,k.commentBefore,d))}d=!1;let x=be(g,p,()=>w=null,()=>d=!0);w&&(x+=re(x,r,c(w))),d&&w&&(d=!1),h.push(n+x)}let m;if(h.length===0)m=i.start+i.end;else{m=h[0];for(let b=1;b<h.length;++b){const g=h[b];m+=g?`
|
|
45
|
+
${a}${g}`:`
|
|
46
|
+
`}}return s?(m+=`
|
|
47
|
+
`+Z(c(s),a),l&&l()):d&&o&&o(),m}function yn({items:s},e,{flowChars:t,itemIndent:n}){const{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:l}}=e;n+=r;const a=Object.assign({},e,{indent:n,inFlow:!0,type:null});let c=!1,p=0;const d=[];for(let b=0;b<s.length;++b){const g=s[b];let w=null;if(C(g))g.spaceBefore&&d.push(""),Je(e,d,g.commentBefore,!1),g.comment&&(w=g.comment);else if(_(g)){const k=C(g.key)?g.key:null;k&&(k.spaceBefore&&d.push(""),Je(e,d,k.commentBefore,!1),k.comment&&(c=!0));const S=C(g.value)?g.value:null;S?(S.comment&&(w=S.comment),S.commentBefore&&(c=!0)):g.value==null&&(k!=null&&k.comment)&&(w=k.comment)}w&&(c=!0);let x=be(g,a,()=>w=null);c||(c=d.length>p||x.includes(`
|
|
48
|
+
`)),b<s.length-1?x+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=d.reduce((k,S)=>k+S.length+2,2)+(x.length+2)>e.options.lineWidth)),c&&(x+=",")),w&&(x+=re(x,n,l(w))),d.push(x),p=d.length}const{start:h,end:m}=t;if(d.length===0)return h+m;if(!c){const b=d.reduce((g,w)=>g+w.length+2,2);c=e.options.lineWidth>0&&b>e.options.lineWidth}if(c){let b=h;for(const g of d)b+=g?`
|
|
49
|
+
${r}${i}${g}`:`
|
|
50
|
+
`;return`${b}
|
|
51
|
+
${i}${m}`}else return`${h}${o}${d.join(" ")}${o}${m}`}function Je({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){const r=Z(e(n),s);t.push(r.trimStart())}}function oe(s,e){const t=L(e)?e.value:e;for(const n of s)if(_(n)&&(n.key===e||n.key===t||L(n.key)&&n.key.value===t))return n}class G extends rs{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ne,e),this.items=[]}static from(e,t,n){const{keepUndefined:i,replacer:r}=n,o=new this(e),l=(a,c)=>{if(typeof r=="function")c=r.call(t,a,c);else if(Array.isArray(r)&&!r.includes(a))return;(c!==void 0||i)&&o.items.push(Tt(a,c,n))};if(t instanceof Map)for(const[a,c]of t)l(a,c);else if(t&&typeof t=="object")for(const a of Object.keys(t))l(a,t[a]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){var o;let n;_(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new U(e,e==null?void 0:e.value):n=new U(e.key,e.value);const i=oe(this.items,n.key),r=(o=this.schema)==null?void 0:o.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);L(i.value)&&is(n.value)?i.value.value=n.value:i.value=n.value}else if(r){const l=this.items.findIndex(a=>r(n,a)<0);l===-1?this.items.push(n):this.items.splice(l,0,n)}else this.items.push(n)}delete(e){const t=oe(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const n=oe(this.items,e),i=n==null?void 0:n.value;return(!t&&L(i)?i.value:i)??void 0}has(e){return!!oe(this.items,e)}set(e,t){this.add(new U(e,t),!0)}toJSON(e,t,n){const i=n?new n:t!=null&&t.mapAsMap?new Map:{};t!=null&&t.onCreate&&t.onCreate(i);for(const r of this.items)us(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(const i of this.items)if(!_(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})),fs(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}const ke={collection:"map",default:!0,nodeClass:G,tag:"tag:yaml.org,2002:map",resolve(s,e){return ce(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>G.from(s,e,t)};class le extends rs{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(xe,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=Pe(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const n=Pe(e);if(typeof n!="number")return;const i=this.items[n];return!t&&L(i)?i.value:i}has(e){const t=Pe(e);return typeof t=="number"&&t<this.items.length}set(e,t){const n=Pe(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);const i=this.items[n];L(i)&&is(t)?i.value=t:this.items[n]=t}toJSON(e,t){const n=[];t!=null&&t.onCreate&&t.onCreate(n);let i=0;for(const r of this.items)n.push(Y(r,String(i++),t));return n}toString(e,t,n){return e?fs(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){const{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let l of t){if(typeof i=="function"){const a=t instanceof Set?l:String(o++);l=i.call(t,a,l)}r.items.push(Te(l,void 0,n))}}return r}}function Pe(s){let e=L(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}const ve={collection:"seq",default:!0,nodeClass:le,tag:"tag:yaml.org,2002:seq",resolve(s,e){return Le(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>le.from(s,e,t)},tt={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),It(s,e,t,n)}},st={identify:s=>s==null,createNode:()=>new I(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new I(null),stringify:({source:s},e)=>typeof s=="string"&&st.test.test(s)?s:e.options.nullStr},Ot={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new I(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&Ot.test.test(s)){const n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function W({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);const i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(n,-0)?"-0":JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^-?\d/.test(r)&&!r.includes("e")){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let l=e-(r.length-o-1);for(;l-- >0;)r+="0"}return r}const ds={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:W},hs={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():W(s)}},ps={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){const e=new I(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:W},nt=s=>typeof s=="bigint"||Number.isInteger(s),Et=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function ms(s,e,t){const{value:n}=s;return nt(n)&&n>=0?t+n.toString(e):W(s)}const gs={identify:s=>nt(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>Et(s,2,8,t),stringify:s=>ms(s,8,"0o")},ys={identify:nt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>Et(s,0,10,t),stringify:W},bs={identify:s=>nt(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>Et(s,2,16,t),stringify:s=>ms(s,16,"0x")},bn=[ke,ve,tt,st,Ot,gs,ys,bs,ds,hs,ps];function Ut(s){return typeof s=="bigint"||Number.isInteger(s)}const Be=({value:s})=>JSON.stringify(s),wn=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Be},{identify:s=>s==null,createNode:()=>new I(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Be},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:Be},{identify:Ut,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>Ut(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Be}],xn={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},kn=[ke,ve].concat(wn,xn),Lt={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof atob=="function"){const t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,i,r){if(!t)return"";const o=t;let l;if(typeof btoa=="function"){let a="";for(let c=0;c<o.length;++c)a+=String.fromCharCode(o[c]);l=btoa(a)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=I.BLOCK_LITERAL),e!==I.QUOTE_DOUBLE){const a=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),c=Math.ceil(l.length/a),p=new Array(c);for(let d=0,h=0;d<c;++d,h+=a)p[d]=l.substr(h,a);l=p.join(e===I.BLOCK_LITERAL?`
|
|
52
|
+
`:" ")}return It({comment:s,type:e,value:l},n,i,r)}};function ws(s,e){if(Le(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!_(n)){if(ce(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");const i=n.items[0]||new U(new I(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
|
|
53
|
+
${i.key.commentBefore}`:n.commentBefore),n.comment){const r=i.value??i.key;r.comment=r.comment?`${n.comment}
|
|
54
|
+
${r.comment}`:n.comment}n=i}s.items[t]=_(n)?n:new U(n)}}else e("Expected a sequence for this tag");return s}function xs(s,e,t){const{replacer:n}=t,i=new le(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let l,a;if(Array.isArray(o))if(o.length===2)l=o[0],a=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const c=Object.keys(o);if(c.length===1)l=c[0],a=o[l];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else l=o;i.items.push(Tt(l,a,t))}return i}const Ct={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:ws,createNode:xs};class ge extends le{constructor(){super(),this.add=G.prototype.add.bind(this),this.delete=G.prototype.delete.bind(this),this.get=G.prototype.get.bind(this),this.has=G.prototype.has.bind(this),this.set=G.prototype.set.bind(this),this.tag=ge.tag}toJSON(e,t){if(!t)return super.toJSON(e);const n=new Map;t!=null&&t.onCreate&&t.onCreate(n);for(const i of this.items){let r,o;if(_(i)?(r=Y(i.key,"",t),o=Y(i.value,r,t)):r=Y(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}static from(e,t,n){const i=xs(e,t,n),r=new this;return r.items=i.items,r}}ge.tag="tag:yaml.org,2002:omap";const $t={collection:"seq",identify:s=>s instanceof Map,nodeClass:ge,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){const t=ws(s,e),n=[];for(const{key:i}of t.items)L(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ge,t)},createNode:(s,e,t)=>ge.from(s,e,t)};function ks({value:s,source:e},t){return e&&(s?vs:Ns).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}const vs={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new I(!0),stringify:ks},Ns={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new I(!1),stringify:ks},vn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:W},Nn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():W(s)}},Sn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){const e=new I(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){const n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:W},Ce=s=>typeof s=="bigint"||Number.isInteger(s);function it(s,e,t,{intAsBigInt:n}){const i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}const o=BigInt(s);return i==="-"?BigInt(-1)*o:o}const r=parseInt(s,t);return i==="-"?-1*r:r}function _t(s,e,t){const{value:n}=s;if(Ce(n)){const i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return W(s)}const jn={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>it(s,2,2,t),stringify:s=>_t(s,2,"0b")},An={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>it(s,1,8,t),stringify:s=>_t(s,8,"0")},In={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>it(s,0,10,t),stringify:W},Tn={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>it(s,2,16,t),stringify:s=>_t(s,16,"0x")};class ye extends G{constructor(e){super(e),this.tag=ye.tag}add(e){let t;_(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new U(e.key,null):t=new U(e,null),oe(this.items,t.key)||this.items.push(t)}get(e,t){const n=oe(this.items,e);return!t&&_(n)?L(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);const n=oe(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new U(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){const{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof i=="function"&&(o=i.call(t,o,o)),r.items.push(Tt(o,null,n));return r}}ye.tag="tag:yaml.org,2002:set";const Mt={collection:"map",identify:s=>s instanceof Set,nodeClass:ye,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>ye.from(s,e,t),resolve(s,e){if(ce(s)){if(s.hasAllNullValues(!0))return Object.assign(new ye,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};function Pt(s,e){const t=s[0],n=t==="-"||t==="+"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,"").split(":").reduce((o,l)=>o*i(60)+i(l),i(0));return t==="-"?i(-1)*r:r}function Ss(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return W(s);let n="";e<0&&(n="-",e*=t(-1));const i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const js={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>Pt(s,t),stringify:Ss},As={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>Pt(s,!1),stringify:Ss},rt={identify:s=>s 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(s){const e=s.match(rt.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,t,n,i,r,o,l]=e.map(Number),a=e[7]?Number((e[7]+"00").substr(1,3)):0;let c=Date.UTC(t,n-1,i,r||0,o||0,l||0,a);const p=e[8];if(p&&p!=="Z"){let d=Pt(p,!1);Math.abs(d)<30&&(d*=60),c-=6e4*d}return new Date(c)},stringify:({value:s})=>(s==null?void 0:s.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},Vt=[ke,ve,tt,st,vs,Ns,jn,An,In,Tn,vn,Nn,Sn,Lt,te,$t,Ct,Mt,js,As,rt],Gt=new Map([["core",bn],["failsafe",[ke,ve,tt]],["json",kn],["yaml11",Vt],["yaml-1.1",Vt]]),Yt={binary:Lt,bool:Ot,float:ps,floatExp:hs,floatNaN:ds,floatTime:As,int:ys,intHex:bs,intOct:gs,intTime:js,map:ke,merge:te,null:st,omap:$t,pairs:Ct,seq:ve,set:Mt,timestamp:rt},On={"tag:yaml.org,2002:binary":Lt,"tag:yaml.org,2002:merge":te,"tag:yaml.org,2002:omap":$t,"tag:yaml.org,2002:pairs":Ct,"tag:yaml.org,2002:set":Mt,"tag:yaml.org,2002:timestamp":rt};function ut(s,e,t){const n=Gt.get(e);if(n&&!s)return t&&!n.includes(te)?n.concat(te):n.slice();let i=n;if(!i)if(Array.isArray(s))i=[];else{const r=Array.from(Gt.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(s))for(const r of s)i=i.concat(r);else typeof s=="function"&&(i=s(i.slice()));return t&&(i=i.concat(te)),i.reduce((r,o)=>{const l=typeof o=="string"?Yt[o]:o;if(!l){const a=JSON.stringify(o),c=Object.keys(Yt).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${a}; use one of ${c}`)}return r.includes(l)||r.push(l),r},[])}const En=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0;class Bt{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?ut(e,"compat"):e?ut(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?On:{},this.tags=ut(t,this.name,n),this.toStringOptions=l??null,Object.defineProperty(this,ne,{value:ke}),Object.defineProperty(this,X,{value:tt}),Object.defineProperty(this,xe,{value:ve}),this.sortMapEntries=typeof o=="function"?o:o===!0?En:null}clone(){const e=Object.create(Bt.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function Ln(s,e){var a;const t=[];let n=e.directives===!0;if(e.directives!==!1&&s.directives){const c=s.directives.toString(s);c?(t.push(c),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");const i=ls(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift("");const c=r(s.commentBefore);t.unshift(Z(c,""))}let o=!1,l=null;if(s.contents){if(C(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){const d=r(s.contents.commentBefore);t.push(Z(d,""))}i.forceBlockIndent=!!s.comment,l=s.contents.comment}const c=l?void 0:()=>o=!0;let p=be(s.contents,i,()=>l=null,c);l&&(p+=re(p,"",r(l))),(p[0]==="|"||p[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${p}`:t.push(p)}else t.push(be(s.contents,i));if((a=s.directives)!=null&&a.docEnd)if(s.comment){const c=r(s.comment);c.includes(`
|
|
55
|
+
`)?(t.push("..."),t.push(Z(c,""))):t.push(`... ${c}`)}else t.push("...");else{let c=s.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||l)&&t[t.length-1]!==""&&t.push(""),t.push(Z(r(c),"")))}return t.join(`
|
|
56
|
+
`)+`
|
|
57
|
+
`}class ot{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,H,{value:bt});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=r;let{version:o}=r;n!=null&&n._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new q({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){const e=Object.create(ot.prototype,{[H]:{value:bt}});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=C(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){fe(this.contents)&&this.contents.add(e)}addIn(e,t){fe(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=ss(this);e.anchor=!t||n.has(t)?ns(t||"a",n):t}return new At(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){const w=k=>typeof k=="number"||k instanceof String||k instanceof Number,x=t.filter(w).map(String);x.length>0&&(t=t.concat(x)),i=t}else n===void 0&&t&&(n=t,t=void 0);const{aliasDuplicateObjects:r,anchorPrefix:o,flow:l,keepUndefined:a,onTagObj:c,tag:p}=n??{},{onAnchor:d,setAnchors:h,sourceObjects:m}=nn(this,o||"a"),b={aliasDuplicateObjects:r??!0,keepUndefined:a??!1,onAnchor:d,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:m},g=Te(e,p,b);return l&&$(g)&&(g.flow=!0),h(),g}createPair(e,t,n={}){const i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new U(i,r)}delete(e){return fe(this.contents)?this.contents.delete(e):!1}deleteIn(e){return je(e)?this.contents==null?!1:(this.contents=null,!0):fe(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return $(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return je(e)?!t&&L(this.contents)?this.contents.value:this.contents:$(this.contents)?this.contents.getIn(e,t):void 0}has(e){return $(this.contents)?this.contents.has(e):!1}hasIn(e){return je(e)?this.contents!==void 0:$(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=He(this.schema,[e],t):fe(this.contents)&&this.contents.set(e,t)}setIn(e,t){je(e)?this.contents=t:this.contents==null?this.contents=He(this.schema,Array.from(e),t):fe(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new q({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new q({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{const 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(n)this.schema=new Bt(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){const l={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=Y(this.contents,t??"",l);if(typeof r=="function")for(const{count:c,res:p}of l.anchors.values())r(p,c);return typeof o=="function"?pe(o,{"":a},"",a):a}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)){const t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Ln(this,e)}}function fe(s){if($(s))return!0;throw new Error("Expected a YAML collection as document contents")}class Is extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}}class Ke extends Is{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class Cn extends Is{constructor(e,t,n){super("YAMLWarning",e,t,n)}}function we(s,{flow:e,indicator:t,next:n,offset:i,onError:r,parentIndent:o,startOnNewline:l}){let a=!1,c=l,p=l,d="",h="",m=!1,b=!1,g=null,w=null,x=null,k=null,S=null,N=null,j=null;for(const v of s)switch(b&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&r(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b=!1),g&&(c&&v.type!=="comment"&&v.type!=="newline"&&r(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),v.type){case"space":!e&&(t!=="doc-start"||(n==null?void 0:n.type)!=="flow-collection")&&v.source.includes(" ")&&(g=v),p=!0;break;case"comment":{p||r(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const E=v.source.substring(1)||" ";d?d+=h+E:d=E,h="",c=!1;break}case"newline":c?d?d+=v.source:(!N||t!=="seq-item-ind")&&(a=!0):h+=v.source,c=!0,m=!0,(w||x)&&(k=v),p=!0;break;case"anchor":w&&r(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&r(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),w=v,j??(j=v.offset),c=!1,p=!1,b=!0;break;case"tag":{x&&r(v,"MULTIPLE_TAGS","A node can have at most one tag"),x=v,j??(j=v.offset),c=!1,p=!1,b=!0;break}case t:(w||x)&&r(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),N&&r(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${e??"collection"}`),N=v,c=t==="seq-item-ind"||t==="explicit-key-ind",p=!1;break;case"comma":if(e){S&&r(v,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=v,c=!1,p=!1;break}default:r(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),c=!1,p=!1}const T=s[s.length-1],A=T?T.offset+T.source.length:i;return b&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&r(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g&&(c&&g.indent<=o||(n==null?void 0:n.type)==="block-map"||(n==null?void 0:n.type)==="block-seq")&&r(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:N,spaceBefore:a,comment:d,hasNewline:m,anchor:w,tag:x,newlineAfterProp:k,end:A,start:j??A}}function Oe(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
|
|
58
|
+
`))return!0;if(s.end){for(const e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of s.items){for(const t of e.start)if(t.type==="newline")return!0;if(e.sep){for(const t of e.sep)if(t.type==="newline")return!0}if(Oe(e.key)||Oe(e.value))return!0}return!1;default:return!0}}function vt(s,e,t){if((e==null?void 0:e.type)==="flow-collection"){const n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&Oe(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Ts(s,e,t){const{uniqueKeys:n}=s.options;if(n===!1)return!1;const i=typeof n=="function"?n:(r,o)=>r===o||L(r)&&L(o)&&r.value===o.value;return e.some(r=>i(r.key,t))}const Ht="All mapping items must start at the same column";function $n({composeNode:s,composeEmptyNode:e},t,n,i,r){var p;const o=(r==null?void 0:r.nodeClass)??G,l=new o(t.schema);t.atRoot&&(t.atRoot=!1);let a=n.offset,c=null;for(const d of n.items){const{start:h,key:m,sep:b,value:g}=d,w=we(h,{indicator:"explicit-key-ind",next:m??(b==null?void 0:b[0]),offset:a,onError:i,parentIndent:n.indent,startOnNewline:!0}),x=!w.found;if(x){if(m&&(m.type==="block-seq"?i(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in m&&m.indent!==n.indent&&i(a,"BAD_INDENT",Ht)),!w.anchor&&!w.tag&&!b){c=w.end,w.comment&&(l.comment?l.comment+=`
|
|
59
|
+
`+w.comment:l.comment=w.comment);continue}(w.newlineAfterProp||Oe(m))&&i(m??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((p=w.found)==null?void 0:p.indent)!==n.indent&&i(a,"BAD_INDENT",Ht);t.atKey=!0;const k=w.end,S=m?s(t,m,w,i):e(t,k,h,null,w,i);t.schema.compat&&vt(n.indent,m,i),t.atKey=!1,Ts(t,l.items,S)&&i(k,"DUPLICATE_KEY","Map keys must be unique");const N=we(b??[],{indicator:"map-value-ind",next:g,offset:S.range[2],onError:i,parentIndent:n.indent,startOnNewline:!m||m.type==="block-scalar"});if(a=N.end,N.found){x&&((g==null?void 0:g.type)==="block-map"&&!N.hasNewline&&i(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&w.start<N.found.offset-1024&&i(S.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const j=g?s(t,g,N,i):e(t,a,b,null,N,i);t.schema.compat&&vt(n.indent,g,i),a=j.range[2];const T=new U(S,j);t.options.keepSourceTokens&&(T.srcToken=d),l.items.push(T)}else{x&&i(S.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),N.comment&&(S.comment?S.comment+=`
|
|
60
|
+
`+N.comment:S.comment=N.comment);const j=new U(S);t.options.keepSourceTokens&&(j.srcToken=d),l.items.push(j)}}return c&&c<a&&i(c,"IMPOSSIBLE","Map comment with trailing content"),l.range=[n.offset,a,c??a],l}function _n({composeNode:s,composeEmptyNode:e},t,n,i,r){const o=(r==null?void 0:r.nodeClass)??le,l=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let a=n.offset,c=null;for(const{start:p,value:d}of n.items){const h=we(p,{indicator:"seq-item-ind",next:d,offset:a,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||d)(d==null?void 0:d.type)==="block-seq"?i(h.end,"BAD_INDENT","All sequence items must start at the same column"):i(a,"MISSING_CHAR","Sequence item without - indicator");else{c=h.end,h.comment&&(l.comment=h.comment);continue}const m=d?s(t,d,h,i):e(t,h.end,p,null,h,i);t.schema.compat&&vt(n.indent,d,i),a=m.range[2],l.items.push(m)}return l.range=[n.offset,a,c??a],l}function $e(s,e,t,n){let i="";if(s){let r=!1,o="";for(const l of s){const{source:a,type:c}=l;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&n(l,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const p=a.substring(1)||" ";i?i+=o+p:i=p,o="";break}case"newline":i&&(o+=a),r=!0;break;default:n(l,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=a.length}}return{comment:i,offset:e}}const ft="Block collections are not allowed within flow collections",dt=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Mn({composeNode:s,composeEmptyNode:e},t,n,i,r){var w;const o=n.start.source==="{",l=o?"flow map":"flow sequence",a=(r==null?void 0:r.nodeClass)??(o?G:le),c=new a(t.schema);c.flow=!0;const p=t.atRoot;p&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let d=n.offset+n.start.source.length;for(let x=0;x<n.items.length;++x){const k=n.items[x],{start:S,key:N,sep:j,value:T}=k,A=we(S,{flow:l,indicator:"explicit-key-ind",next:N??(j==null?void 0:j[0]),offset:d,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!j&&!T){x===0&&A.comma?i(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`):x<n.items.length-1&&i(A.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${l}`),A.comment&&(c.comment?c.comment+=`
|
|
61
|
+
`+A.comment:c.comment=A.comment),d=A.end;continue}!o&&t.options.strict&&Oe(N)&&i(N,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(x===0)A.comma&&i(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`);else if(A.comma||i(A.start,"MISSING_CHAR",`Missing , between ${l} items`),A.comment){let v="";e:for(const E of S)switch(E.type){case"comma":case"space":break;case"comment":v=E.source.substring(1);break e;default:break e}if(v){let E=c.items[c.items.length-1];_(E)&&(E=E.value??E.key),E.comment?E.comment+=`
|
|
62
|
+
`+v:E.comment=v,A.comment=A.comment.substring(v.length+1)}}if(!o&&!j&&!A.found){const v=T?s(t,T,A,i):e(t,A.end,j,null,A,i);c.items.push(v),d=v.range[2],dt(T)&&i(v.range,"BLOCK_IN_FLOW",ft)}else{t.atKey=!0;const v=A.end,E=N?s(t,N,A,i):e(t,v,S,null,A,i);dt(N)&&i(E.range,"BLOCK_IN_FLOW",ft),t.atKey=!1;const B=we(j??[],{flow:l,indicator:"map-value-ind",next:T,offset:E.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(B.found){if(!o&&!A.found&&t.options.strict){if(j)for(const V of j){if(V===B.found)break;if(V.type==="newline"){i(V,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}A.start<B.found.offset-1024&&i(B.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else T&&("source"in T&&((w=T.source)==null?void 0:w[0])===":"?i(T,"MISSING_CHAR",`Missing space after : in ${l}`):i(B.start,"MISSING_CHAR",`Missing , or : between ${l} items`));const f=T?s(t,T,B,i):B.found?e(t,B.end,j,null,B,i):null;f?dt(T)&&i(f.range,"BLOCK_IN_FLOW",ft):B.comment&&(E.comment?E.comment+=`
|
|
63
|
+
`+B.comment:E.comment=B.comment);const M=new U(E,f);if(t.options.keepSourceTokens&&(M.srcToken=k),o){const V=c;Ts(t,V.items,E)&&i(v,"DUPLICATE_KEY","Map keys must be unique"),V.items.push(M)}else{const V=new G(t.schema);V.flow=!0,V.items.push(M);const y=(f??E).range;V.range=[E.range[0],y[1],y[2]],c.items.push(V)}d=f?f.range[2]:B.end}}const h=o?"}":"]",[m,...b]=n.end;let g=d;if((m==null?void 0:m.source)===h)g=m.offset+m.source.length;else{const x=l[0].toUpperCase()+l.substring(1),k=p?`${x} must end with a ${h}`:`${x} in block collection must be sufficiently indented and end with a ${h}`;i(d,p?"MISSING_CHAR":"BAD_INDENT",k),m&&m.source.length!==1&&b.unshift(m)}if(b.length>0){const x=$e(b,g,t.options.strict,i);x.comment&&(c.comment?c.comment+=`
|
|
64
|
+
`+x.comment:c.comment=x.comment),c.range=[n.offset,g,x.offset]}else c.range=[n.offset,g,g];return c}function ht(s,e,t,n,i,r){const o=t.type==="block-map"?$n(s,e,t,n,r):t.type==="block-seq"?_n(s,e,t,n,r):Mn(s,e,t,n,r),l=o.constructor;return i==="!"||i===l.tagName?(o.tag=l.tagName,o):(i&&(o.tag=i),o)}function Pn(s,e,t,n,i){var h;const r=n.tag,o=r?e.directives.tagName(r.source,m=>i(r,"TAG_RESOLVE_FAILED",m)):null;if(t.type==="block-seq"){const{anchor:m,newlineAfterProp:b}=n,g=m&&r?m.offset>r.offset?m:r:m??r;g&&(!b||b.offset<g.offset)&&i(g,"MISSING_CHAR","Missing newline after block sequence props")}const l=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===G.tagName&&l==="map"||o===le.tagName&&l==="seq")return ht(s,e,t,i,o);let a=e.schema.tags.find(m=>m.tag===o&&m.collection===l);if(!a){const m=e.schema.knownTags[o];if((m==null?void 0:m.collection)===l)e.schema.tags.push(Object.assign({},m,{default:!1})),a=m;else return m?i(r,"BAD_COLLECTION_TYPE",`${m.tag} used for ${l} collection, but expects ${m.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),ht(s,e,t,i,o)}const c=ht(s,e,t,i,o,a),p=((h=a.resolve)==null?void 0:h.call(a,c,m=>i(r,"TAG_RESOLVE_FAILED",m),e.options))??c,d=C(p)?p:new I(p);return d.range=c.range,d.tag=o,a!=null&&a.format&&(d.format=a.format),d}function Bn(s,e,t){const n=e.offset,i=Kn(e,s.options.strict,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};const r=i.mode===">"?I.BLOCK_FOLDED:I.BLOCK_LITERAL,o=e.source?Dn(e.source):[];let l=o.length;for(let g=o.length-1;g>=0;--g){const w=o[g][1];if(w===""||w==="\r")l=g;else break}if(l===0){const g=i.chomp==="+"&&o.length>0?`
|
|
65
|
+
`.repeat(Math.max(1,o.length-1)):"";let w=n+i.length;return e.source&&(w+=e.source.length),{value:g,type:r,comment:i.comment,range:[n,w,w]}}let a=e.indent+i.indent,c=e.offset+i.length,p=0;for(let g=0;g<l;++g){const[w,x]=o[g];if(x===""||x==="\r")i.indent===0&&w.length>a&&(a=w.length);else{w.length<a&&t(c+w.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(a=w.length),p=g,a===0&&!s.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=w.length+x.length+1}for(let g=o.length-1;g>=l;--g)o[g][0].length>a&&(l=g+1);let d="",h="",m=!1;for(let g=0;g<p;++g)d+=o[g][0].slice(a)+`
|
|
66
|
+
`;for(let g=p;g<l;++g){let[w,x]=o[g];c+=w.length+x.length+1;const k=x[x.length-1]==="\r";if(k&&(x=x.slice(0,-1)),x&&w.length<a){const N=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;t(c-x.length-(k?2:1),"BAD_INDENT",N),w=""}r===I.BLOCK_LITERAL?(d+=h+w.slice(a)+x,h=`
|
|
67
|
+
`):w.length>a||x[0]===" "?(h===" "?h=`
|
|
68
|
+
`:!m&&h===`
|
|
69
|
+
`&&(h=`
|
|
70
|
+
|
|
71
|
+
`),d+=h+w.slice(a)+x,h=`
|
|
72
|
+
`,m=!0):x===""?h===`
|
|
73
|
+
`?d+=`
|
|
74
|
+
`:h=`
|
|
75
|
+
`:(d+=h+x,h=" ",m=!1)}switch(i.chomp){case"-":break;case"+":for(let g=l;g<o.length;++g)d+=`
|
|
76
|
+
`+o[g][0].slice(a);d[d.length-1]!==`
|
|
77
|
+
`&&(d+=`
|
|
78
|
+
`);break;default:d+=`
|
|
79
|
+
`}const b=n+i.length+e.source.length;return{value:d,type:r,comment:i.comment,range:[n,b,b]}}function Kn({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:i}=e[0],r=i[0];let o=0,l="",a=-1;for(let h=1;h<i.length;++h){const m=i[h];if(!l&&(m==="-"||m==="+"))l=m;else{const b=Number(m);!o&&b?o=b:a===-1&&(a=s+h)}}a!==-1&&n(a,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,p="",d=i.length;for(let h=1;h<e.length;++h){const m=e[h];switch(m.type){case"space":c=!0;case"newline":d+=m.source.length;break;case"comment":t&&!c&&n(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=m.source.length,p=m.source.substring(1);break;case"error":n(m,"UNEXPECTED_TOKEN",m.message),d+=m.source.length;break;default:{const b=`Unexpected token in block scalar header: ${m.type}`;n(m,"UNEXPECTED_TOKEN",b);const g=m.source;g&&typeof g=="string"&&(d+=g.length)}}}return{mode:r,indent:o,chomp:l,comment:p,length:d}}function Dn(s){const e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),r=[n!=null&&n[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function Rn(s,e,t){const{offset:n,type:i,source:r,end:o}=s;let l,a;const c=(h,m,b)=>t(n+h,m,b);switch(i){case"scalar":l=I.PLAIN,a=Fn(r,c);break;case"single-quoted-scalar":l=I.QUOTE_SINGLE,a=qn(r,c);break;case"double-quoted-scalar":l=I.QUOTE_DOUBLE,a=Un(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+r.length,n+r.length]}}const p=n+r.length,d=$e(o,p,e,t);return{value:a,type:l,comment:d.comment,range:[n,p,d.offset]}}function Fn(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Os(s)}function qn(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),Os(s.slice(1,-1)).replace(/''/g,"'")}function Os(s){const e=/(.*?)\r?\n/sy;let t=e.exec(s);if(!t)return s;let n,i;try{n=new RegExp("(?<![ ])[ ]+$"),i=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{n=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let r=t[1].replace(n,""),o=" ",l=e.lastIndex;for(;t=e.exec(s);){const c=t[1].replace(i,"");c===""?o===`
|
|
80
|
+
`?r+=o:o=`
|
|
81
|
+
`:(r+=o+c,o=" "),l=e.lastIndex}const a=/[ \t]*(.*)/sy;return a.lastIndex=l,t=a.exec(s),r+o+((t==null?void 0:t[1])??"")}function Un(s,e){let t="";for(let n=1;n<s.length-1;++n){const i=s[n];if(!(i==="\r"&&s[n+1]===`
|
|
82
|
+
`))if(i===`
|
|
83
|
+
`){const{fold:r,offset:o}=Vn(s,n);t+=r,n=o}else if(i==="\\"){let r=s[++n];const o=Gn[r];if(o)t+=o;else if(r===`
|
|
84
|
+
`)for(r=s[n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="\r"&&s[n+1]===`
|
|
85
|
+
`)for(r=s[++n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="x"||r==="u"||r==="U"){const l=r==="x"?2:r==="u"?4:8;t+=Yn(s,n+1,l,e),n+=l}else{const l=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),t+=l}}else if(i===" "||i===" "){const r=n;let o=s[n+1];for(;o===" "||o===" ";)o=s[++n+1];o!==`
|
|
86
|
+
`&&!(o==="\r"&&s[n+2]===`
|
|
87
|
+
`)&&(t+=n>r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function Vn(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`
|
|
88
|
+
`||n==="\r")&&!(n==="\r"&&s[e+2]!==`
|
|
89
|
+
`);)n===`
|
|
90
|
+
`&&(t+=`
|
|
91
|
+
`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}const Gn={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
92
|
+
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Yn(s,e,t,n){const i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(o)}catch{const l=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}}function Es(s,e,t,n){const{value:i,type:r,comment:o,range:l}=e.type==="block-scalar"?Bn(s,e,n):Rn(e,s.options.strict,n),a=t?s.directives.tagName(t.source,d=>n(t,"TAG_RESOLVE_FAILED",d)):null;let c;s.options.stringKeys&&s.atKey?c=s.schema[X]:a?c=Hn(s.schema,i,a,t,n):e.type==="scalar"?c=Jn(s,i,e,n):c=s.schema[X];let p;try{const d=c.resolve(i,h=>n(t??e,"TAG_RESOLVE_FAILED",h),s.options);p=L(d)?d:new I(d)}catch(d){const h=d instanceof Error?d.message:String(d);n(t??e,"TAG_RESOLVE_FAILED",h),p=new I(i)}return p.range=l,p.source=i,r&&(p.type=r),a&&(p.tag=a),c.format&&(p.format=c.format),o&&(p.comment=o),p}function Hn(s,e,t,n,i){var l;if(t==="!")return s[X];const r=[];for(const a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(const a of r)if((l=a.test)!=null&&l.test(e))return a;const o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[X])}function Jn({atKey:s,directives:e,schema:t},n,i,r){const o=t.tags.find(l=>{var a;return(l.default===!0||s&&l.default==="key")&&((a=l.test)==null?void 0:a.test(n))})||t[X];if(t.compat){const l=t.compat.find(a=>{var c;return a.default&&((c=a.test)==null?void 0:c.test(n))})??t[X];if(o.tag!==l.tag){const a=e.tagString(o.tag),c=e.tagString(l.tag),p=`Value may be parsed as either ${a} or ${c}`;r(i,"TAG_RESOLVE_FAILED",p,!0)}}return o}function Wn(s,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++n];(i==null?void 0:i.type)==="space";)s+=i.source.length,i=e[++n];break}}return s}const Qn={composeNode:Ls,composeEmptyNode:Kt};function Ls(s,e,t,n){const i=s.atKey,{spaceBefore:r,comment:o,anchor:l,tag:a}=t;let c,p=!0;switch(e.type){case"alias":c=zn(s,e,n),(l||a)&&n(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=Es(s,e,a,n),l&&(c.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Pn(Qn,s,e,t,n),l&&(c.anchor=l.source.substring(1))}catch(d){const h=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",h)}break;default:{const d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),p=!1}}return c??(c=Kt(s,e.offset,void 0,null,t,n)),l&&c.anchor===""&&n(l,"BAD_ALIAS","Anchor cannot be an empty string"),i&&s.options.stringKeys&&(!L(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&n(a??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),s.options.keepSourceTokens&&p&&(c.srcToken=e),c}function Kt(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:l,end:a},c){const p={type:"scalar",offset:Wn(e,t,n),indent:-1,source:""},d=Es(s,p,l,c);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),r&&(d.comment=r,d.range[2]=a),d}function zn({options:s},{offset:e,source:t,end:n},i){const r=new At(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=e+t.length,l=$e(n,o,s.strict,i);return r.range=[e,o,l.offset],l.comment&&(r.comment=l.comment),r}function Xn(s,e,{offset:t,start:n,value:i,end:r},o){const l=Object.assign({_directives:e},s),a=new ot(void 0,l),c={atKey:!1,atRoot:!0,directives:a.directives,options:a.options,schema:a.schema},p=we(n,{indicator:"doc-start",next:i??(r==null?void 0:r[0]),offset:t,onError:o,parentIndent:0,startOnNewline:!0});p.found&&(a.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!p.hasNewline&&o(p.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),a.contents=i?Ls(c,i,p,o):Kt(c,p.end,n,null,p,o);const d=a.contents.range[2],h=$e(r,d,!1,o);return h.comment&&(a.comment=h.comment),a.range=[t,d,h.offset],a}function Ne(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];const{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Jt(s){var i;let e="",t=!1,n=!1;for(let r=0;r<s.length;++r){const o=s[r];switch(o[0]){case"#":e+=(e===""?"":n?`
|
|
93
|
+
|
|
94
|
+
`:`
|
|
95
|
+
`)+(o.substring(1)||" "),t=!0,n=!1;break;case"%":((i=s[r+1])==null?void 0:i[0])!=="#"&&(r+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}class Zn{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,i,r)=>{const o=Ne(t);r?this.warnings.push(new Cn(o,n,i)):this.errors.push(new Ke(o,n,i))},this.directives=new q({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:n,afterEmptyLine:i}=Jt(this.prelude);if(n){const r=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
96
|
+
${n}`:n;else if(i||e.directives.docStart||!r)e.commentBefore=n;else if($(r)&&!r.flow&&r.items.length>0){let o=r.items[0];_(o)&&(o=o.key);const l=o.commentBefore;o.commentBefore=l?`${n}
|
|
97
|
+
${l}`:n}else{const o=r.commentBefore;r.commentBefore=o?`${n}
|
|
98
|
+
${o}`:n}}if(t){for(let r=0;r<this.errors.length;++r)e.errors.push(this.errors[r]);for(let r=0;r<this.warnings.length;++r)e.warnings.push(this.warnings[r])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Jt(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(const i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{const r=Ne(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=Xn(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":{const t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Ke(Ne(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){const n="Unexpected doc-end without preceding document";this.errors.push(new Ke(Ne(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;const t=$e(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const n=this.doc.comment;this.doc.comment=n?`${n}
|
|
99
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Ke(Ne(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){const n=Object.assign({_directives:this.directives},this.options),i=new ot(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}}const pt=s=>"type"in s?We(s):Ye(s);function We(s){switch(s.type){case"block-scalar":{let e="";for(const t of s.props)e+=We(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(const t of s.items)e+=Ye(t);return e}case"flow-collection":{let e=s.start.source;for(const t of s.items)e+=Ye(t);for(const t of s.end)e+=t.source;return e}case"document":{let e=Ye(s);if(s.end)for(const t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(const t of s.end)e+=t.source;return e}}}function Ye({start:s,key:e,sep:t,value:n}){let i="";for(const r of s)i+=r.source;if(e&&(i+=We(e)),t)for(const r of t)i+=r.source;return n&&(i+=We(n)),i}const Cs="\uFEFF",$s="",_s="",Nt="";function ei(s){switch(s){case Cs:return"byte-order-mark";case $s:return"doc-mode";case _s:return"flow-error-end";case Nt:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
100
|
+
`:case`\r
|
|
101
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function J(s){switch(s){case void 0:case" ":case`
|
|
102
|
+
`:case"\r":case" ":return!0;default:return!1}}const Wt=new Set("0123456789ABCDEFabcdef"),ti=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),De=new Set(",[]{}"),si=new Set(` ,[]{}
|
|
103
|
+
\r `),mt=s=>!s||si.has(s);class ni{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 n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
104
|
+
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
105
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){const i=this.buffer[n+e+1];if(i===`
|
|
106
|
+
`||!i&&!this.atEnd)return e+n+1}return t===`
|
|
107
|
+
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){const n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&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(`
|
|
108
|
+
`,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]===Cs&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");for(;n!==-1;){const r=e[n-1];if(r===" "||r===" "){t=n-1;break}else n=e.indexOf("#",n+1)}for(;;){const r=e[t-1];if(r===" "||r===" ")t-=1;else break}const i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){const t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield $s,yield*this.parseLineStart()}*parseLineStart(){const 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");const 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(){const[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&J(t)){const n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const 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(mt),"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,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&J(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield _s,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(mt),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const o=this.charAt(1);if(this.flowKey||J(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const e=this.charAt(0);let t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}const n=this.buffer.substring(0,t);let i=n.indexOf(`
|
|
109
|
+
`,this.pos);if(i!==-1){for(;i!==-1;){const r=this.continueScalar(i+1);if(r===-1)break;i=n.indexOf(`
|
|
110
|
+
`,r)}i!==-1&&(t=i-(n[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(;;){const 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,n;e:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case" ":t+=1;break;case`
|
|
111
|
+
`:e=r,t=0;break;case"\r":{const o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
112
|
+
`)break}default:break e}if(!n&&!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{const r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(`
|
|
113
|
+
`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
114
|
+
`;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);const l=r;for(;o===" ";)o=this.buffer[--r];if(o===`
|
|
115
|
+
`&&r>=this.pos&&r+1+t>l)e=r;else break}while(!0);return yield Nt,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){const r=this.buffer[n+1];if(J(r)||e&&De.has(r))break;t=n}else if(J(i)){let r=this.buffer[n+1];if(i==="\r"&&(r===`
|
|
116
|
+
`?(n+=1,i=`
|
|
117
|
+
`,r=this.buffer[n+1]):t=n),r==="#"||e&&De.has(r))break;if(i===`
|
|
118
|
+
`){const o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&De.has(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Nt,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){const n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.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(mt),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const t=this.flowLevel>0,n=this.charAt(1);if(J(n)||t&&De.has(n)){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(ti.has(t))t=this.buffer[++e];else if(t==="%"&&Wt.has(this.buffer[e+1])&&Wt.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
|
|
119
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
120
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");const i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}function se(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Qt(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Ms(s){switch(s==null?void 0:s.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Re(s){switch(s.type){case"document":return s.start;case"block-map":{const e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function de(s){var t;if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((t=s[++e])==null?void 0:t.type)==="space";);return s.splice(e,s.length)}function Qe(s,e){if(e.length<1e5)Array.prototype.push.apply(s,e);else for(let t=0;t<e.length;++t)s.push(e[t])}function zt(s){if(s.start.type==="flow-seq-start")for(const e of s.items)e.sep&&!e.value&&!se(e.start,"explicit-key-ind")&&!se(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Ms(e.value)?e.value.end?Qe(e.value.end,e.sep):e.value.end=e.sep:Qe(e.start,e.sep),delete e.sep)}class Dt{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 ni,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const t=ei(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{const n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,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(){const e=this.peek(1);if(this.type==="doc-end"&&(e==null?void 0: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){const 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{const n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&zt(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{const i=n.items[n.items.length-1];if(i.value){n.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":{const i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{const i=n.items[n.items.length-1];!i||i.value?n.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((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){const i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Qt(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(n.type==="document"?n.end=i.start:n.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":{const 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":{Qt(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}const 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"){const t=Re(this.peek(2)),n=de(t);let i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];const r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
121
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
122
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){var n;const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const i="end"in t.value?t.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2],r=(n=i==null?void 0:i.value)==null?void 0:n.end;if(Array.isArray(r)){Qe(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const i=!this.onKeyLine&&this.indent===e.indent,r=i&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind";let o=[];if(r&&t.sep&&!t.value){const l=[];for(let a=0;a<t.sep.length;++a){const c=t.sep[a];switch(c.type){case"newline":l.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(o=t.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":r||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):r||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(se(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(Ms(t.key)&&!se(t.sep,"newline")){const l=de(t.start),a=t.key,c=t.sep;c.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:a,sep:c}]})}else o.length>0?t.sep=t.sep.concat(o,this.sourceToken):t.sep.push(this.sourceToken);else if(se(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const l=de(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||r?e.items.push({start:o,key:null,sep:[this.sourceToken]}):se(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":{const l=this.flowScalar(this.type);r||t.value?(e.items.push({start:o,key:l,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(l):(Object.assign(t,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(e);if(l){if(l.type==="block-seq"){if(!t.explicitKey&&t.sep&&!se(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 i&&e.items.push({start:o});this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var n;const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const i="end"in t.value?t.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2],r=(n=i==null?void 0:i.value)==null?void 0:n.end;if(Array.isArray(r)){Qe(r,t.start),r.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||se(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while((n==null?void 0:n.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":{const 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}const n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){const i=Re(n),r=de(i);zt(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const l={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
123
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
124
|
+
`,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;const t=Re(e),n=de(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=Re(e),n=de(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}const ii=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,ri=["vskill","anthropic-skill-creator","none"];class F extends Error{}const Ee=s=>!!s&&typeof s=="object"&&!Array.isArray(s),oi=s=>Array.isArray(s)&&s.every(e=>typeof e=="string");function Fe(s){var c,p,d,h;if(typeof s!="string")throw new F("Native skill must be a string");const e=s.match(ii);if(!e)throw new F("Native skill must contain valid SKILL.md YAML frontmatter");const t=`${e[1]}
|
|
125
|
+
`,n=[...new Dt().parse(t)],i=[...new Zn({keepSourceTokens:!0,strict:!0,uniqueKeys:!0,stringKeys:!0}).compose(n,!0,t.length)],r=i[0];if(i.length!==1||!r||r.errors.length||!ce(r.contents))throw new F(`Invalid native YAML: ${((c=r==null?void 0:r.errors[0])==null?void 0:c.message)??"expected one mapping"}`);let o;try{o=r.toJS({maxAliasCount:100})}catch(m){throw new F(`Invalid native YAML: ${m.message}`)}if(o.metadata!==void 0&&!Ee(o.metadata))throw new F("Native skill metadata must use a block mapping");if(typeof o.name!="string"||!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(o.name)||typeof o.description!="string"||!o.description.trim())throw new F("Native skill must contain valid SKILL.md name/description frontmatter");if(o.model!==void 0&&typeof o.model!="string")throw new F("Native model must be a string");if(o["allowed-tools"]!==void 0&&typeof o["allowed-tools"]!="string"&&!oi(o["allowed-tools"]))throw new F("Native allowed-tools must be a string or string list");for(const m of[o.version,(p=o.metadata)==null?void 0:p.version])if(m!==void 0&&(typeof m!="string"||!yt(m)))throw new F("Invalid native version");const l=(d=o.metadata)==null?void 0:d.engine;if(l!==void 0&&!ri.includes(l))throw new F("Invalid native engine");const a=o.version??((h=o.metadata)==null?void 0:h.version);return{doc:r,tokens:n,fields:o,version:a,body:s.slice(e[0].length).replace(/^\r?\n/,"")}}function Ps(s,e,t){const n=new Set;C(e)&&ee(e,(r,o)=>{C(o)&&n.add(o)});const i=new Set(n);ee(s,(r,o,l)=>{if(o===t){i.add(t);for(const a of l)C(a)&&i.add(a)}}),ee(s,(r,o)=>{if(ae(o)&&!n.has(o)&&i.has(o.resolve(s)))throw new F("Cannot edit a field referenced by a YAML alias; preserve or remove its dependent aliases first")})}function Bs(s){return!Ee(s)&&!Array.isArray(s)?[]:Ee(s)&&s.type==="comment"?[s,{type:"newline",source:`
|
|
126
|
+
`,offset:-1,indent:0}]:Object.values(s).flatMap(Bs)}function li(s,e,t,n,i=!1){var m;const r=e.srcToken;if((r==null?void 0:r.type)!=="block-map")throw new F("Native skill metadata must use a block mapping");const o=e.items.find(b=>Ee(b.key)&&b.key.value===t);Ps(s,o==null?void 0:o.value,e);const l=o==null?void 0:o.srcToken,a=Bs(l?[l.sep,l.value]:[]),c=l?r.items.indexOf(l):r.items.length,p=r.indent,d=n===void 0?void 0:[...new Dt().parse(`${t}: ${Array.isArray(n)?"[claude-code]":i?JSON.stringify(n):n}
|
|
127
|
+
`)][0],h=((m=d==null?void 0:d.value)==null?void 0:m.type)==="block-map"?d.value.items[0]:void 0;h!=null&&h.key?(h.start=(l==null?void 0:l.start)??[{type:"space",source:" ".repeat(p),indent:p,offset:-1}],l!=null&&l.key&&(h.key=l.key),"indent"in h.key&&(h.key.indent=p),h.value&&"end"in h.value&&(h.value.end=[...h.value.end??[],...a]),r.items.splice(c,l?1:0,h)):l&&r.items.splice(c,1,{start:[...l.start,...a]})}function ai(s,e,t){if(typeof e.body!="string")throw new F("Body is required and must be a string");let n=Fe(s);const i=s.includes(`\r
|
|
128
|
+
`)?`\r
|
|
129
|
+
`:`
|
|
130
|
+
`,r=(a,c,p=!1)=>{const d=a.reduce((b,g)=>Ee(b)?b[g]:void 0,n.fields);if(d===c||Array.isArray(c)&&Array.isArray(d)&&d.length===c.length&&d.every((b,g)=>b===c[g]))return;const h=a.length===1?n.doc.contents:n.doc.getIn(a.slice(0,-1),!0);if(!ce(h))throw new F("Native skill metadata must use a block mapping");li(n.doc,h,a[a.length-1],c,p);const m=n.tokens.map(pt).join("");n=Fe(`---
|
|
131
|
+
${m}---
|
|
132
|
+
${e.body}`)};r(["name"],e.name,!0),r(["description"],e.description,!0);for(const[a,c]of[["model",e.model],["allowed-tools",e.allowedTools]]){const p=n.fields[a],d=Array.isArray(p)?p.join(", "):p;c!==void 0&&(!c.trim()||c!==d)&&r([a],c.trim()?c:void 0,!0)}if(!n.doc.has("metadata")){const a=n.doc.contents.srcToken;if((a==null?void 0:a.type)!=="block-map")throw new F("Native skill metadata must use a block mapping");Ps(n.doc,void 0,n.doc.contents);const c=[...new Dt().parse(`metadata:
|
|
133
|
+
engine: vskill
|
|
134
|
+
`)][0];a.items.push(...c.value.items),n=Fe(`---
|
|
135
|
+
${n.tokens.map(pt).join("")}---
|
|
136
|
+
${e.body}`)}r(n.doc.has("version")?["version"]:["metadata","version"],e.version||"1.0.0",!0),r(["metadata","engine"],e.engine??"anthropic-skill-creator"),(e.engine??"anthropic-skill-creator")==="anthropic-skill-creator"&&r(["metadata","target-agents"],["claude-code"]);const o=n.tokens.map(pt).join("").replace(/\r?\n/g,i),l=`---${i}${o}---${i}${i}${e.body}`;return Fe(l),l}const ci=[{key:"slashCommands",label:"Slash"},{key:"hooks",label:"Hooks"},{key:"mcp",label:"MCP"},{key:"customSystemPrompt",label:"Prompt"}];function ui({supported:s,label:e}){return u.jsx("span",{style:{display:"inline-block",fontSize:10,padding:"1px 5px",borderRadius:3,marginRight:3,background:s?"var(--color-success-bg, #d4edda)":"var(--surface-3, #2a2a2a)",color:s?"var(--color-success, #28a745)":"var(--text-tertiary, #666)",border:`1px solid ${s?"var(--color-success, #28a745)":"var(--border-subtle, #333)"}`},children:e})}function Xt({agent:s,checked:e,onToggle:t}){return u.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:6,cursor:"pointer",border:s.installed?"1px solid var(--color-primary, #6366f1)":"1px solid var(--border-subtle, #333)",background:e?"var(--surface-2, #1e1e1e)":"transparent"},children:[u.jsx("input",{type:"checkbox",checked:e,onChange:t,style:{accentColor:"var(--color-primary, #6366f1)"}}),u.jsxs("div",{style:{flex:1},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[u.jsx("span",{style:{fontWeight:500,fontSize:13,color:"var(--text-primary, #fff)"},children:s.displayName}),s.installed&&u.jsx("span",{style:{fontSize:10,padding:"1px 5px",borderRadius:3,background:"var(--color-primary-bg, #312e81)",color:"var(--color-primary, #6366f1)"},children:"installed"})]}),u.jsx("div",{style:{marginTop:3},children:ci.map(n=>u.jsx(ui,{supported:s.featureSupport[n.key],label:n.label},n.key))})]})]})}function fi({agents:s,selectedIds:e,onChange:t}){const n=new Set(e),i=s.filter(l=>l.isUniversal),r=s.filter(l=>!l.isUniversal),o=l=>{const a=n.has(l)?e.filter(c=>c!==l):[...e,l];t(a)};return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[i.length>0&&u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Universal Agents"}),u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:i.map(l=>u.jsx(Xt,{agent:l,checked:n.has(l.id),onToggle:()=>o(l.id)},l.id))})]}),r.length>0&&u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Other Agents"}),u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:r.map(l=>u.jsx(Xt,{agent:l,checked:n.has(l.id),onToggle:()=>o(l.id)},l.id))})]})]})}const di={"anthropic-skill-creator":{command:"claude",args:["plugin","install","skill-creator"],prerequisite:"claude"},vskill:{command:"vskill",args:["install","anton-abyzov/vskill/skill-builder"],prerequisite:"vskill"}};function Ks(s){const{command:e,args:t}=di[s];return[e,...t].join(" ")}const hi="Cross-universal — emits the same skill to 8 universal agents (Claude, Codex, Cursor, Cline, Gemini CLI, OpenCode, Kimi, Amp). Constrains output to the common schema across all agents. Recommended for portable skills.",pi="Powerful Claude-native engine — Anthropic's built-in skill-creator with a slightly richer schema (more expressive on Claude) but Claude-only. Pick this when you only target Claude Code and want full expressiveness.",mi="Generate raw — no engine assistance, you provide the full SKILL.md body.";function gi(s){return[{engine:"vskill",label:"VSkill skill-builder",caption:s.vskillSkillBuilder?`installed${s.vskillVersion?` v${s.vskillVersion}`:""}`:"not installed",tooltip:hi,detected:s.vskillSkillBuilder,installable:!0},{engine:"anthropic-skill-creator",label:"Anthropic skill-creator",caption:s.anthropicSkillCreator?"installed":"not installed",tooltip:pi,detected:s.anthropicSkillCreator,installable:!0},{engine:"none",label:"No engine — generate raw",caption:"always available",tooltip:mi,detected:!0,installable:!1}]}function yi(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function bi(s){const{detection:e,selected:t,onSelect:n,onInstallClick:i}=s,r=D.useMemo(()=>yi(),[]),o=D.useMemo(()=>gi(e),[e]),l=r?"":"transition-colors";return u.jsxs("fieldset",{className:"flex flex-col gap-2",children:[u.jsx("legend",{className:"text-xs font-semibold text-gray-700",children:"Authoring engine"}),u.jsx("div",{role:"tablist","aria-label":"Authoring engine",className:"flex flex-col gap-1.5",children:o.map(a=>{var b;const c=t===a.engine,p=(b=s.installStates)==null?void 0:b[a.engine],d=!a.detected&&a.installable,h=["flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm cursor-pointer",l,c?"border-blue-600 bg-blue-50":"border-gray-300 bg-white hover:border-gray-400"].filter(Boolean).join(" "),m=a.detected?{}:{opacity:.6};return u.jsxs("div",{role:"tab",tabIndex:0,"data-testid":`engine-selector-${a.engine}`,"aria-selected":c?"true":"false",title:d?`Not installed. Click [Install] to run: ${Ks(a.engine)}`:a.tooltip,style:m,className:h,onClick:()=>n(a.engine),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),n(a.engine))},children:[u.jsxs("div",{className:"flex flex-col",children:[u.jsx("span",{className:"font-medium text-gray-900",children:a.label}),u.jsx("span",{className:"text-xs text-gray-500",children:a.caption}),p&&p.status!=="idle"&&u.jsxs("span",{role:"status","data-testid":`engine-install-status-${a.engine}`,className:"text-xs",children:[(p.status==="spawning"||p.status==="streaming")&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:r?"":"animate-spin",children:"◌"})," ",p.liveTail||"Installing…"]}),p.status==="success"&&u.jsx("span",{className:"text-green-700",children:"✓ Installed"}),p.status==="failure"&&u.jsx("span",{className:"text-red-700",children:"✗ Install failed"})]}),(p==null?void 0:p.status)==="failure"&&p.stderr&&u.jsxs("details",{onClick:g=>g.stopPropagation(),children:[u.jsx("summary",{children:"stderr"}),u.jsx("pre",{children:p.stderr})]})]}),d&&u.jsx("button",{type:"button","data-testid":`install-${a.engine}`,className:"rounded border border-blue-600 px-2 py-1 text-xs font-medium text-blue-700 hover:bg-blue-100",onClick:g=>{g.stopPropagation(),i(a.engine)},children:(p==null?void 0:p.status)==="failure"?"Retry":"Install"})]},a.engine)})})]})}const wi="Skill version (semver). Auto-bumps on update unless versioningMode=author.",xi="Must be valid semver (e.g. 1.0.0, 2.1.3-beta.1)";function ki(s){const{value:e,onChange:t,mode:n,onValidityChange:i,versionsHref:r,disabled:o}=s,[l,a]=D.useState(!1),[c,p]=D.useState(()=>yt(e)),d=yt(e);D.useEffect(()=>{d!==c?(p(d),i==null||i(d)):i&&i(d)},[d]);const h=l&&!d,m=["w-full rounded-md border px-3 py-2 text-sm font-mono",h?"border-red-500 bg-red-50 focus:outline-red-600":"border-gray-300 bg-white focus:outline-blue-600",o?"opacity-60 cursor-not-allowed":""].join(" ");return u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("label",{className:"text-xs font-semibold text-gray-700",htmlFor:"version-input",children:"Version"}),u.jsx("input",{id:"version-input","data-testid":"version-input",type:"text",title:wi,value:e,onChange:b=>t(b.currentTarget.value),onBlur:()=>a(!0),"aria-invalid":h?"true":"false","aria-describedby":h?"version-input-helper":void 0,disabled:o,className:m,placeholder:"1.0.0"}),h&&u.jsx("span",{id:"version-input-helper","data-testid":"version-input-helper",className:"text-xs text-red-600",role:"alert",children:xi}),n==="update"&&r&&u.jsx("a",{"data-testid":"version-input-versions-link",href:r,target:"_blank",rel:"noreferrer",className:"text-xs text-blue-600 hover:underline",children:"Versions →"})]})}const Se={status:"idle",liveTail:"",progress:[],exitCode:null,stderr:"",error:null};function vi(s={}){const e=s.fetchImpl??globalThis.fetch,[t,n]=D.useState(Se),i=D.useRef(null),r=D.useRef(null);D.useEffect(()=>()=>{var c;(c=r.current)==null||c.close()},[]);const o=D.useCallback(()=>{var c;(c=r.current)==null||c.close(),r.current=null,i.current=null,n(Se)},[]),l=D.useCallback(async c=>{i.current=c,n({...Se,status:"spawning"});let p;try{const h=await e("/api/studio/install-engine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({engine:c})});if(!h.ok){const b=await h.json().catch(()=>({}));n({...Se,status:"failure",error:b.remediation??b.error??`HTTP ${h.status}`});return}p=(await h.json()).jobId}catch(h){n({...Se,status:"failure",error:h.message});return}let d;d=Rs(`/api/studio/install-engine/${p}/stream`,{fetchImpl:e,timeoutMessage:"install-engine SSE stream timed out",onEvent:({event:h,data:m})=>{if(h==="progress"){try{const b=JSON.parse(m);n(g=>({...g,liveTail:b.line.length>60?b.line.slice(0,59)+"…":b.line,progress:[...g.progress,b].slice(-200)}))}catch{}return}if(h==="done")try{const b=JSON.parse(m);d.close(),r.current=null,n(g=>({...g,status:b.success?"success":"failure",exitCode:b.exitCode,stderr:b.stderr,error:b.success?null:b.stderr||`exit ${b.exitCode}`}))}catch{d.close(),r.current=null,n(b=>({...b,status:"failure",error:"malformed done event"}))}},onError:h=>{r.current=null,n(m=>({...m,status:m.status==="streaming"?"failure":m.status,error:m.error??h.message}))}}),r.current=d,n(h=>({...h,status:"streaming"}))},[e]),a=D.useCallback(async()=>{const c=i.current;c&&await l(c)},[l]);return{state:t,install:l,retry:a,reset:o}}const Ni={vskill:"VSkill skill-builder","anthropic-skill-creator":"Anthropic skill-creator"},Si="This runs the command in your terminal as your user. Inspect before approving.";function ji(s){const{engine:e,onClose:t,onSuccess:n,hookOpts:i}=s,{state:r,install:o,retry:l}=vi(i),a=Ks(e);D.useEffect(()=>{var d;(d=s.onStateChange)==null||d.call(s,r)},[r,s.onStateChange]);const c=Ni[e],p=D.useRef(!1);return D.useEffect(()=>{r.status==="success"&&!p.current&&(p.current=!0,n())},[r.status,n]),u.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"install-engine-title","data-testid":"install-engine-modal",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:u.jsxs("div",{className:"w-full max-w-lg rounded-lg bg-white p-6 shadow-xl",children:[u.jsxs("h2",{id:"install-engine-title",className:"text-lg font-semibold text-gray-900",children:["Install ",c]}),r.status==="idle"&&u.jsx(Ai,{command:a,onCancel:t,onRun:()=>o(e)}),(r.status==="spawning"||r.status==="streaming")&&u.jsx(Ii,{command:a,liveTail:r.liveTail}),r.status==="success"&&u.jsx(Ti,{label:c,onClose:t}),r.status==="failure"&&u.jsx(Oi,{error:r.error??"Install failed",stderr:r.stderr,progress:r.progress,onRetry:()=>l(),onClose:t})]})})}function Ds({command:s}){return u.jsxs("pre",{"data-testid":"install-command-preview",className:"my-3 overflow-x-auto rounded bg-gray-900 px-3 py-2 font-mono text-xs text-green-300",children:["$ ",s]})}function Ai(s){return u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Studio will run this command on your behalf:"}),u.jsx(Ds,{command:s.command}),u.jsx("p",{className:"text-xs text-amber-700","data-testid":"install-security-note",children:Si}),u.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[u.jsx("button",{type:"button","data-testid":"install-cancel",className:"rounded border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50",onClick:s.onCancel,children:"Cancel"}),u.jsx("button",{type:"button","data-testid":"install-run",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:s.onRun,children:"Run install"})]})]})}function Ii(s){return u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Installing…"}),u.jsx(Ds,{command:s.command}),u.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-gray-600",children:[u.jsx("span",{"data-testid":"install-spinner",className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-300 border-t-blue-600"}),u.jsx("span",{"data-testid":"install-live-tail",className:"font-mono",children:s.liveTail||"starting…"})]})]})}function Ti(s){return u.jsxs(u.Fragment,{children:[u.jsxs("p",{"data-testid":"install-success",className:"mt-3 text-sm font-medium text-green-700",children:["✓ ",s.label," installed"]}),u.jsx("div",{className:"mt-4 flex justify-end",children:u.jsx("button",{type:"button","data-testid":"install-close",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:s.onClose,children:"Done"})})]})}function Oi(s){const[e,t]=D.useState(!1),n=s.progress.filter(r=>r.stream==="stderr").map(r=>r.line),i=n.length>0?n.join(`
|
|
137
|
+
`):s.stderr;return u.jsxs(u.Fragment,{children:[u.jsx("p",{"data-testid":"install-failure",className:"mt-3 text-sm font-medium text-red-700",children:"✗ Install failed"}),u.jsx("p",{className:"mt-1 text-xs text-gray-700",children:s.error}),i&&u.jsxs("details",{className:"mt-3 text-xs",open:e,onToggle:r=>t(r.currentTarget.open),children:[u.jsx("summary",{className:"cursor-pointer text-gray-600",children:"stderr"}),u.jsx("pre",{"data-testid":"install-stderr",className:"mt-2 overflow-x-auto rounded bg-gray-900 px-3 py-2 font-mono text-xs text-red-300",children:i})]}),u.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[u.jsx("button",{type:"button","data-testid":"install-close",className:"rounded border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50",onClick:s.onClose,children:"Close"}),u.jsx("button",{type:"button","data-testid":"install-retry",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:s.onRetry,children:"Retry"})]})]})}const z={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Ei(s){return s?/API usage limits|usage limit/i.test(s)&&/regain access|reset/i.test(s):!1}function Li(s){const e=s.match(/regain access on ([^"\\]+?)(?:\s*UTC)?["\\]/i)??s.match(/regain access on ([^"\\]+)/i);return e?`Resets ${e[1].trim()} UTC`:"Quota resets at the start of your next billing period"}function qe(s){switch(s){case"claude-cli":return"Uses your logged-in Claude Code session — your existing CLI session handles quota. No API key needed. Overflow runs at standard API rates if extra usage is enabled in your account settings.";case"anthropic":return"Direct Anthropic API — pay-per-token. Full Opus / Sonnet / Haiku catalog. Requires ANTHROPIC_API_KEY.";case"openrouter":return"One API key → 300+ models from Anthropic, OpenAI (GPT-5 / o4-mini), Google (Gemini), Meta (Llama) and more. Same prices as direct.";case"ollama":return"Local models on your machine (Llama, Qwen, Mistral, etc.). Zero cost, zero data leaves your laptop.";case"lm-studio":return"Local models via LM Studio's OpenAI-compatible server. Works offline. Pick any model you've loaded in LM Studio.";default:return""}}function gt({size:s=14,color:e="currentColor"}){return u.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function Pi(){const{config:s}=Fs(),{refreshSkills:e,revealSkill:t}=qs(),[n,i]=P.useState(null),[r,o]=P.useState({}),l=P.useCallback(y=>{n&&o(O=>({...O,[n]:y}))},[n]),a=D.useMemo(()=>{if(typeof window>"u")return{};const y=window.location.hash,O=y.indexOf("?");if(O===-1)return{};const Q=new URLSearchParams(y.slice(O+1)),R={};for(const K of["mode","skillName","description","pluginName"]){const ue=Q.get(K);ue&&(R[K]=ue)}return R},[]),[c,p]=P.useState("claude-cli"),[d,h]=P.useState("sonnet"),[m,b]=P.useState(!1),[g,w]=P.useState(null),x=P.useRef(!1),[k,S]=P.useState([]),[N,j]=P.useState(()=>Rt("activeAgent",null));P.useEffect(()=>{function y(){j(Rt("activeAgent",null))}return window.addEventListener("studio:agent-changed",y),window.addEventListener("storage",y),()=>{window.removeEventListener("studio:agent-changed",y),window.removeEventListener("storage",y)}},[]);const T=N!=="claude-code";P.useEffect(()=>{fetch("/api/agents/installed").then(y=>y.json()).then(y=>{y.agents&&S(y.agents)}).catch(()=>{})},[]),P.useEffect(()=>{var R;if(!s)return;const y=s.providers.filter(K=>K.available),O=Ft().skillGenModel;if(y.length===0){x.current=!0;return}if(O&&typeof O=="object"&&typeof O.provider=="string"&&typeof O.model=="string"){const K=y.find(lt=>lt.id===O.provider),ue=K==null?void 0:K.models.some(lt=>lt.id===O.model);if(K&&ue){p(O.provider),h(O.model),b(!0),x.current=!0;return}w({provider:O.provider,model:O.model})}if(y.find(K=>K.id==="claude-cli"))p("claude-cli"),h("sonnet");else{const K=y[0];p(K.id),h(((R=K.models[0])==null?void 0:R.id)??"")}b(!1),x.current=!0},[s]),P.useEffect(()=>{const y=O=>{if(O.key!==null&&!O.key.includes("vskill.studio.prefs"))return;const R=Ft().skillGenModel;R&&typeof R=="object"&&typeof R.provider=="string"&&typeof R.model=="string"&&(p(R.provider),h(R.model),b(!0))};return window.addEventListener("storage",y),()=>window.removeEventListener("storage",y)},[]);const A=P.useCallback((y,O)=>{Us("skillGenModel",{provider:y,model:O}),b(!0)},[]),v=P.useCallback(()=>({provider:c,model:d}),[c,d]),E=a.mode==="standalone"?3:void 0,{flushBySkillName:B}=Vs(),f=Gs({onCreated:(y,O)=>{e(),setTimeout(()=>t(y,O),500)},resolveAiConfigOverride:v,forceLayout:E,updateTarget:a.mode==="update"&&a.skillName?{plugin:a.pluginName||"",skill:a.skillName}:void 0,flushPendingForSkillName:B});P.useEffect(()=>{a.skillName&&!f.name&&f.setName(_e(a.skillName)),a.description&&!f.description&&f.setDescription(a.description),a.description&&!f.aiPrompt&&f.setAiPrompt(a.description),a.pluginName&&!f.plugin&&f.setPlugin(_e(a.pluginName))},[]),P.useEffect(()=>{f.engine==="anthropic-skill-creator"&&c!=="claude-cli"&&(p("claude-cli"),h("sonnet"))},[f.engine,c]);const M=s==null?void 0:s.providers.find(y=>y.id===c&&y.available),V=P.useMemo(()=>{if(f.nativeSkillMd)try{return ai(f.nativeSkillMd,{name:f.name,description:f.description,body:f.body,version:f.version,...f.nativeFieldEdits,engine:f.engine},Ys(f.nativeSkillMd.replace(/\r\n/g,`
|
|
138
|
+
`)).metadata)}catch{return f.nativeSkillMd}const y=["---"];return f.description?y.push(`description: "${f.description.replace(/"/g,'\\"')}"`):y.push('description: ""'),f.allowedTools.trim()&&y.push(`allowed-tools: ${f.allowedTools.trim()}`),f.model&&y.push(`model: ${f.model}`),f.targetAgents.length>0&&y.push(`target-agents: ${f.targetAgents.join(", ")}`),y.push(`metadata:
|
|
139
|
+
version: ${JSON.stringify(f.version)}
|
|
140
|
+
engine: ${f.engine}`),y.push("---"),y.push(""),f.body.trim()?y.push(f.body.trim()):(y.push(`# /${f.name||"skill-name"}`),y.push(""),y.push("You are a helpful assistant.")),y.join(`
|
|
141
|
+
`)},[f.name,f.description,f.model,f.allowedTools,f.body,f.version,f.engine,f.nativeSkillMd,f.nativeFieldEdits]);return u.jsxs("div",{className:"px-4 py-6 sm:px-6 sm:py-7 lg:px-10 lg:py-8 max-w-6xl mx-auto w-full overflow-x-hidden",children:[u.jsxs("div",{className:"mb-6",children:[u.jsxs("div",{className:"flex items-center gap-2 text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:[u.jsx(at,{to:"/",className:"hover:underline",style:{color:"var(--text-tertiary)"},children:"Skills"}),u.jsx("span",{children:"/"}),u.jsx("span",{style:{color:"var(--text-secondary)"},children:"New Skill"})]}),u.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[u.jsx("h2",{className:"text-[22px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:f.authoringMode==="update"?"Update Skill":"Create a New Skill"}),f.standaloneLocked&&u.jsx("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider px-2 py-0.5 rounded whitespace-nowrap",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"1px solid var(--accent-muted)"},title:"You chose Standalone in the previous step. Plugin selection is disabled.",children:"Standalone"})]}),u.jsx("p",{className:"text-[13px] mt-1",style:{color:"var(--text-tertiary)"},children:"Define your skill's metadata, content, and placement"})]}),u.jsxs("div",{className:"inline-flex rounded-lg p-1 self-start sm:self-auto sm:flex-shrink-0 max-w-full",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},role:"tablist","aria-label":"Creation mode",children:[u.jsx("button",{onClick:()=>f.setMode("ai"),className:"px-4 py-2 rounded-md text-[13px] font-medium transition-all duration-200",style:{background:f.mode==="ai"?"var(--purple-muted)":"transparent",color:f.mode==="ai"?"var(--purple)":"var(--text-tertiary)",boxShadow:f.mode==="ai"?"0 1px 3px rgba(0,0,0,0.08)":"none"},children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(gt,{size:14}),"AI-Assisted"]})}),u.jsx("button",{onClick:()=>f.setMode("manual"),className:"px-4 py-2 rounded-md text-[13px] font-medium transition-all duration-200",style:{background:f.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:f.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:f.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none"},children:"Manual"})]})]})]}),f.engineDetection&&u.jsx("div",{className:"mb-4",children:u.jsx(bi,{installStates:r,detection:f.engineDetection,selected:f.engine,onSelect:y=>{f.setEngine(y),y==="anthropic-skill-creator"&&c!=="claude-cli"&&(p("claude-cli"),h("sonnet"))},onInstallClick:y=>i(y)})}),!f.engineDetection&&u.jsx("div",{className:"skeleton h-24 mb-4 rounded-lg","aria-label":"Detecting authoring engines"}),f.engineAvailable===!1&&u.jsx("p",{role:"status",children:"Install the selected engine before generating or saving."}),!f.layoutLoading&&u.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[u.jsxs("div",{className:"mb-4",children:[u.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:["Name ",u.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),u.jsx("input",{type:"text",disabled:f.authoringMode==="update",value:f.name,onChange:y=>f.setName(_e(y.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:z})]}),u.jsx("div",{className:"mb-4",children:u.jsx(ki,{value:f.version,onChange:f.setVersion,onValidityChange:f.setVersionValid,mode:f.authoringMode??"create",versionsHref:f.versionsHref})})]}),f.layoutLoading&&u.jsxs("div",{className:"space-y-3",children:[u.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),u.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),u.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!f.layoutLoading&&f.layout&&f.mode==="ai"&&u.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 animate-fade-in",children:[u.jsxs("div",{className:"flex-1 min-w-0 space-y-5",children:[u.jsxs("div",{className:"glass-card p-5",children:[u.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[u.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"var(--purple-muted)"},children:u.jsx(gt,{size:13,color:"var(--purple)"})}),"Describe Your Skill"]}),u.jsx("textarea",{ref:f.promptRef,value:f.aiPrompt,onChange:y=>f.setAiPrompt(y.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
|
|
142
|
+
|
|
143
|
+
Include any specific behaviors, constraints, or output formats you want.`,rows:6,disabled:f.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...z,minHeight:"140px"},onKeyDown:y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),f.handleGenerate())}}),u.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),u.jsxs("div",{className:"glass-card p-5",children:[u.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[u.jsx("span",{children:"Source Model"}),!m&&c==="claude-cli"&&d==="sonnet"&&u.jsx("span",{className:"text-[10px] font-normal uppercase tracking-wider px-1.5 py-0.5 rounded",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"Default"})]}),g&&u.jsxs("div",{role:"status",className:"mb-3 px-3 py-2 rounded-lg text-[12px] flex items-center justify-between gap-3",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:[u.jsxs("span",{children:["Previous selection ",u.jsxs("code",{children:[g.provider,"/",g.model]})," unavailable — reverted to default."]}),u.jsx("button",{onClick:()=>w(null),className:"text-[11px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},"aria-label":"Dismiss notice",children:"✕"})]}),u.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",title:M?void 0:"Install a provider (Ollama / LM Studio / OpenRouter) or run `claude login` to enable model selection.",children:[u.jsxs("div",{className:"flex-1",children:[u.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),u.jsx("select",{value:c,onChange:y=>{var K;const O=y.target.value;p(O);const Q=s==null?void 0:s.providers.find(ue=>ue.id===O),R=((K=Q==null?void 0:Q.models[0])==null?void 0:K.id)??d;Q!=null&&Q.models[0]&&h(R),A(O,R)},disabled:f.generating||!M||f.engine==="anthropic-skill-creator",title:M?qe(c)||void 0:"Install a provider (Ollama / LM Studio / OpenRouter) or run `claude login` to enable model selection.",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:z,children:s==null?void 0:s.providers.filter(y=>y.available).map(y=>u.jsx("option",{value:y.id,title:qe(y.id),children:y.label},y.id))}),qe(c)&&u.jsxs("div",{className:"mt-1.5 text-[11px]",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:[qe(c),c==="claude-cli"&&u.jsxs(u.Fragment,{children:[" ",u.jsx("a",{href:"https://claude.com/settings/usage",target:"_blank",rel:"noreferrer",style:{color:"var(--color-accent, #2f6f8f)",textDecoration:"underline"},children:"Enable extra usage →"})]})]})]}),u.jsxs("div",{className:"flex-1",children:[u.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Model"}),u.jsx("select",{value:d,onChange:y=>{const O=y.target.value;h(O),A(c,O)},disabled:f.generating||!M,className:"w-full px-3 py-2 rounded-lg text-[13px]",style:z,children:M==null?void 0:M.models.map(y=>u.jsx("option",{value:y.id,children:y.label},y.id))})]})]})]}),T&&k.length>0&&u.jsxs("div",{className:"glass-card p-5",children:[u.jsxs("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Target Agents",u.jsx("span",{className:"text-[11px] font-normal ml-2",style:{color:"var(--text-tertiary)"},children:"(optional — leave empty for Claude Code default)"})]}),u.jsx(fi,{agents:k,selectedIds:f.targetAgents,onChange:f.setTargetAgents})]}),f.generating&&f.aiProgress.length>0&&u.jsx("div",{children:u.jsx(Hs,{entries:f.aiProgress,isRunning:!0})}),f.aiError&&u.jsx("div",{children:Ei(f.aiError)?u.jsxs("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--yellow-muted)",color:"var(--text-primary)",border:"1px solid var(--yellow)"},children:[u.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Your Claude Code session quota is exhausted"}),u.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)",lineHeight:1.5,marginBottom:8},children:[Li(f.aiError),". Switch to another provider (Anthropic API, OpenRouter, or a local model) or enable extra usage to continue past your monthly quota."]}),u.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[u.jsx("a",{href:"https://claude.com/settings/usage",target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",padding:"4px 10px",fontSize:12,fontWeight:500,color:"var(--color-paper, #fff)",background:"var(--color-accent, #2f6f8f)",borderRadius:4,textDecoration:"none"},children:"Enable extra usage →"}),u.jsx("button",{onClick:f.clearAiError,style:{padding:"4px 10px",fontSize:12,color:"var(--text-primary)",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,cursor:"pointer"},children:"Dismiss"})]})]}):f.aiClassifiedError?u.jsx(Js,{error:f.aiClassifiedError,onRetry:f.handleGenerate,onDismiss:f.clearAiError}):u.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:f.aiError})}),u.jsxs("div",{className:"flex items-center gap-3",children:[f.generating?u.jsx("button",{onClick:f.handleCancelGenerate,className:"px-6 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:"Cancel Generation"}):u.jsxs("button",{onClick:f.handleGenerate,disabled:!f.aiPrompt.trim()||f.engineAvailable===!1||f.engine==="none"||!f.versionValid,className:"px-6 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:f.aiPrompt.trim()?"var(--color-action, #2F5B8E)":"var(--surface-3)",color:f.aiPrompt.trim()?"var(--color-action-ink, #FFFFFF)":"var(--text-tertiary)",cursor:f.aiPrompt.trim()?"pointer":"not-allowed"},children:[u.jsx(gt,{size:14})," Generate Skill"]}),u.jsx(at,{to:"/",className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)"},children:"Cancel"})]})]}),u.jsx("div",{className:"w-full lg:w-[340px] lg:flex-shrink-0 min-w-0",children:u.jsx("div",{className:"lg:sticky lg:top-8",children:u.jsxs("div",{className:"glass-card p-4",children:[u.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"SKILL.md Preview"}),u.jsx("pre",{className:"text-[11px] font-mono leading-relaxed overflow-auto max-h-[500px] p-3 rounded-lg",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:V})]})})})]}),!f.layoutLoading&&f.layout&&f.mode==="manual"&&u.jsx("div",{className:"animate-fade-in",children:u.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[u.jsxs("div",{className:"flex-1 min-w-0 space-y-5",children:[u.jsxs("div",{className:"glass-card p-5",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 mb-3",children:[u.jsx("h3",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Location"}),f.standaloneLocked&&u.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium px-2 py-1 rounded-md whitespace-nowrap",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"1px solid var(--accent-muted)"},title:"You chose Standalone in the previous step. To change, go back and pick a different destination.",children:[u.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),u.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Standalone skill"]})]}),f.standaloneLocked?u.jsxs("p",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:["Lives at ",u.jsxs("code",{style:{fontFamily:"var(--font-mono)",fontSize:11},children:["<project>/skills/","<name>","/SKILL.md"]})," — works with every agent. No plugin selected."]}):u.jsxs(u.Fragment,{children:[f.creatableLayouts.length>1&&u.jsxs("div",{className:"mb-4",children:[u.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),u.jsxs("div",{className:"flex gap-2 flex-wrap",children:[f.creatableLayouts.map(y=>u.jsx("button",{onClick:()=>{f.setSelectedLayout(y.layout);const O=y.existingPlugins[0];f.setPlugin(O||""),f.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150 whitespace-nowrap",style:{background:f.selectedLayout===y.layout?"var(--accent)":"var(--surface-3)",color:f.selectedLayout===y.layout?"var(--color-paper)":"var(--text-secondary)",border:`1px solid ${f.selectedLayout===y.layout?"var(--accent)":"var(--border-subtle)"}`},children:y.label},y.layout)),!f.creatableLayouts.find(y=>y.layout===3)&&u.jsx("button",{onClick:()=>{f.setSelectedLayout(3),f.setPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150 whitespace-nowrap",style:{background:f.selectedLayout===3?"var(--accent)":"var(--surface-3)",color:f.selectedLayout===3?"var(--color-paper)":"var(--text-secondary)",border:`1px solid ${f.selectedLayout===3?"var(--accent)":"var(--border-subtle)"}`},children:"Root skills/"})]})]}),f.selectedLayout!==3&&u.jsxs("div",{className:"mb-4",children:[u.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),u.jsxs("select",{value:f.plugin,onChange:y=>{f.setPlugin(y.target.value),f.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:z,children:[f.availablePlugins.map(y=>u.jsx("option",{value:y,children:y},y)),u.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),f.plugin==="__new__"&&u.jsx("input",{type:"text",value:f.newPlugin,onChange:y=>f.setNewPlugin(_e(y.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:z})]})]}),u.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono overflow-x-auto",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)",wordBreak:"break-all",overflowWrap:"anywhere",lineHeight:1.55},children:f.pathPreview})]}),!f.standaloneLocked&&f.authoringMode!=="update"&&f.showPluginRecommendation&&f.pluginLayoutInfo&&f.selectedLayout===3&&u.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",style:{background:"var(--accent-muted)",color:"var(--text-secondary)",border:"1px solid var(--accent-muted)"},children:[u.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),u.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),u.jsxs("span",{children:["Plugins detected (",u.jsx("strong",{children:f.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u.jsx("button",{onClick:f.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"var(--accent)",color:"var(--color-paper)",border:"none",cursor:"pointer"},children:"Use plugin"}),u.jsx("button",{onClick:()=>f.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:u.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),u.jsxs("div",{className:"glass-card p-5",children:[u.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),u.jsxs("div",{className:"mb-4",children:[u.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:["Description ",u.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),u.jsx("textarea",{value:f.description,onChange:y=>f.setDescription(y.target.value),placeholder:"Brief description — used for auto-activation keywords",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...z,minHeight:"72px"}}),u.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"This text is used by Claude to decide when to activate the skill"})]}),u.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[u.jsxs("div",{className:"flex-1",children:[u.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Model"}),u.jsxs("select",{value:f.model,onChange:y=>f.setModel(y.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:z,children:[u.jsx("option",{value:"",children:"Any (default)"}),u.jsx("option",{value:"opus",children:"Opus"}),u.jsx("option",{value:"sonnet",children:"Sonnet"}),u.jsx("option",{value:"haiku",children:"Haiku"})]})]}),u.jsxs("div",{className:"flex-1",children:[u.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),u.jsx("input",{type:"text",value:f.allowedTools,onChange:y=>f.setAllowedTools(y.target.value),placeholder:"Read, Write, Edit, Bash, Glob, Grep",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:z})]})]})]}),u.jsxs("div",{className:"glass-card p-5",children:[u.jsxs("div",{className:"flex items-center justify-between mb-3",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),u.jsx("polyline",{points:"14 2 14 8 20 8"}),u.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),u.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),u.jsxs("div",{children:[u.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),u.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),u.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(y=>u.jsxs("button",{onClick:()=>f.setBodyViewMode(y),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:f.bodyViewMode===y?"var(--surface-4)":"transparent",color:f.bodyViewMode===y?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:f.bodyViewMode===y?600:400,border:"none",cursor:"pointer"},children:[y==="write"?u.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("polyline",{points:"16 18 22 12 16 6"}),u.jsx("polyline",{points:"8 6 2 12 8 18"})]}):u.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),u.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),u.jsx("span",{children:y==="write"?"Write":"Preview"})]},y))})]}),f.bodyViewMode==="write"?u.jsx("textarea",{value:f.body,onChange:y=>f.setBody(y.target.value),placeholder:`# /my-skill
|
|
144
|
+
|
|
145
|
+
You are an expert at...
|
|
146
|
+
|
|
147
|
+
## Workflow
|
|
148
|
+
|
|
149
|
+
1. First, understand the request
|
|
150
|
+
2. Then, implement the solution
|
|
151
|
+
3. Finally, verify the result`,rows:12,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...z,minHeight:"200px"}}):f.body.trim()?u.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"200px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:Ws(f.body)}}):u.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"200px",maxHeight:"400px",overflowY:"auto"},children:u.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),u.jsx(Qs,{skillName:f.name||"{skill}",hasEvals:!1,isDraft:f.draftSaved}),f.error&&u.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:f.error}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("button",{onClick:f.handleCreate,disabled:f.creating||f.updateLoading||!f.name||!f.description||!f.versionValid||f.engineAvailable===!1,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:f.creating||!f.name||!f.description?"var(--surface-3)":"var(--color-action, #2F5B8E)",color:f.creating||!f.name||!f.description?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:f.creating||!f.name||!f.description?"not-allowed":"pointer",opacity:f.creating?.7:1},children:f.creating?"Saving...":f.authoringMode==="update"?"Update Skill":"Create Skill"}),u.jsx(at,{to:"/",className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)"},children:"Cancel"})]})]}),u.jsx("div",{className:"w-full lg:w-[340px] lg:flex-shrink-0 min-w-0",children:u.jsx("div",{className:"lg:sticky lg:top-8",children:u.jsxs("div",{className:"glass-card p-4",children:[u.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"SKILL.md Preview"}),u.jsx("pre",{className:"text-[11px] font-mono leading-relaxed overflow-auto max-h-[500px] p-3 rounded-lg",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:V})]})})})]})}),n&&u.jsx(ji,{engine:n,onStateChange:l,onClose:()=>i(null),onSuccess:()=>{f.setEngine(n),f.refreshEngineDetection()}})]})}export{Pi as CreateSkillPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SearchPaletteCore-
|
|
2
|
-
import{_ as f}from"./useDesktopBridge-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SearchPaletteCore-Bgld3QTz.js","assets/globals-DmzftdEG.js","assets/globals-BWCNQsMa.css","assets/main-DIkxEshL.js","assets/useDesktopBridge-C8dT34x9.js","assets/fonts-BZeyWEAn.css","assets/skill-url-C4ekwoGs.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as f}from"./useDesktopBridge-C8dT34x9.js";import{r as t,j as d}from"./globals-DmzftdEG.js";const l=t.lazy(()=>f(()=>import("./SearchPaletteCore-Bgld3QTz.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function w(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function y({onSelect:i,onNavigate:u}={}){const[n,o]=t.useState(!1),s=t.useRef(null),a=w();t.useEffect(()=>{function e(){s.current=document.activeElement??null,o(!0)}return window.addEventListener("openFindSkills",e),()=>window.removeEventListener("openFindSkills",e)},[]),t.useEffect(()=>{if(!n)return;function e(r){r.key==="Escape"&&o(!1)}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]),t.useEffect(()=>{if(n)return;const e=s.current;if(e&&typeof e.focus=="function")try{e.focus()}catch{}s.current=null},[n]);const c=t.useCallback((e,r)=>{try{typeof window<"u"&&window.sessionStorage&&window.sessionStorage.setItem("find-skills:last-query",r??"")}catch{}if(o(!1),i)try{i(e,r)}catch{}},[i]);return n?d.jsx("div",{"data-testid":"find-skills-palette-shell","data-reduced-motion":a?"true":"false",children:d.jsx(t.Suspense,{fallback:null,children:d.jsx(l,{initialOpen:!0,onSelect:c,onNavigate:u})})}):null}export{y as FindSkillsPalette,y as default};
|