fix(ui): reveal signing secret in canvas source creation

This commit is contained in:
sam committed 2026-10-05 14:33:27 +11:00
1 parent d52a37b57b
commit 16b8c23007
4 files changed
+156 -105

No files matched your search

+73 -73
View File
@@ -1,74 +1,74 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HarnessPage.js","assets/HarnessPage.css"])))=>i.map(i=>d[i]);
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function n(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var r={},i=[],a=()=>{},o=()=>!1,s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),c=e=>e.startsWith(`onUpdate:`),l=Object.assign,u=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Object.prototype.hasOwnProperty,f=(e,t)=>d.call(e,t),p=Array.isArray,m=e=>w(e)===`[object Map]`,h=e=>w(e)===`[object Set]`,g=e=>w(e)===`[object Date]`,_=e=>w(e)===`[object RegExp]`,v=e=>typeof e==`function`,y=e=>typeof e==`string`,b=e=>typeof e==`symbol`,x=e=>typeof e==`object`&&!!e,S=e=>(x(e)||v(e))&&v(e.then)&&v(e.catch),C=Object.prototype.toString,w=e=>C.call(e),T=e=>w(e).slice(8,-1),E=e=>w(e)===`[object Object]`,D=e=>y(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,O=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),ee=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},te=/-\w/g,k=ee(e=>e.replace(te,e=>e.slice(1).toUpperCase())),ne=/\B([A-Z])/g,re=ee(e=>e.replace(ne,`-$1`).toLowerCase()),ie=ee(e=>e.charAt(0).toUpperCase()+e.slice(1)),ae=ee(e=>e?`on${ie(e)}`:``),A=(e,t)=>!Object.is(e,t),oe=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},se=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ce=e=>{let t=parseFloat(e);return isNaN(t)?e:t},le=e=>{let t=y(e)?Number(e):NaN;return isNaN(t)?e:t},ue,de=()=>ue||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{},fe=n(`Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol`);function pe(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=y(r)?_e(r):pe(r);if(i)for(let e in i)t[e]=i[e]}return t}if(y(e)||x(e))return e}var me=/;(?![^(]*\))/g,he=/:([^]+)/,ge=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function _e(e){let t={};return e.replace(ge,e=>e.startsWith(`/*`)?``:e).split(me).forEach(e=>{if(e){let n=e.split(he);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function j(e){let t=``;if(y(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=j(e[n]);r&&(t+=r+` `)}else if(x(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}function ve(e){if(!e)return null;let{class:t,style:n}=e;return t&&!y(t)&&(e.class=j(t)),n&&(e.style=pe(n)),e}var ye=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,be=n(ye);ye+``;function xe(e){return!!e||e===``}function Se(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=Ee(e[i],t[i],n);return r}function Ce(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&Ee(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function we(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?Ce(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!Ee(e[r],t[r],n))return!1}return String(e)===String(t)}function Te(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function Ee(e,t,n){if(e===t)return!0;let r=g(e),i=g(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=b(e),i=b(t),r||i?e===t:(r=p(e),i=p(t),r||i?r&&i?Te(e,t,n,Se):!1:(r=x(e),i=x(t),r||i?!r||!i?!1:Te(e,t,n,we):String(e)===String(t))))}function De(e,t){return e.findIndex(e=>Ee(e,t))}var Oe=e=>!!(e&&e.__v_isRef===!0),M=e=>y(e)?e:e==null?``:p(e)||x(e)&&(e.toString===C||!v(e.toString))?Oe(e)?M(e.value):JSON.stringify(e,ke,2):String(e),ke=(e,t)=>Oe(t)?ke(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Ae(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Ae(e))}:b(t)?Ae(t):x(t)&&!p(t)&&!E(t)?String(t):t,Ae=(e,t=``)=>b(e)?`Symbol(${e.description??t})`:e;function je(e){return e==null?`initial`:typeof eLine truncated
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function n(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var r={},i=[],a=()=>{},o=()=>!1,s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),c=e=>e.startsWith(`onUpdate:`),l=Object.assign,u=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Object.prototype.hasOwnProperty,f=(e,t)=>d.call(e,t),p=Array.isArray,m=e=>w(e)===`[object Map]`,h=e=>w(e)===`[object Set]`,g=e=>w(e)===`[object Date]`,_=e=>w(e)===`[object RegExp]`,v=e=>typeof e==`function`,y=e=>typeof e==`string`,b=e=>typeof e==`symbol`,x=e=>typeof e==`object`&&!!e,S=e=>(x(e)||v(e))&&v(e.then)&&v(e.catch),C=Object.prototype.toString,w=e=>C.call(e),T=e=>w(e).slice(8,-1),E=e=>w(e)===`[object Object]`,D=e=>y(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,O=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),ee=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},te=/-\w/g,k=ee(e=>e.replace(te,e=>e.slice(1).toUpperCase())),ne=/\B([A-Z])/g,re=ee(e=>e.replace(ne,`-$1`).toLowerCase()),ie=ee(e=>e.charAt(0).toUpperCase()+e.slice(1)),ae=ee(e=>e?`on${ie(e)}`:``),A=(e,t)=>!Object.is(e,t),oe=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},se=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ce=e=>{let t=parseFloat(e);return isNaN(t)?e:t},le=e=>{let t=y(e)?Number(e):NaN;return isNaN(t)?e:t},ue,de=()=>ue||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{},fe=n(`Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol`);function pe(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=y(r)?_e(r):pe(r);if(i)for(let e in i)t[e]=i[e]}return t}if(y(e)||x(e))return e}var me=/;(?![^(]*\))/g,he=/:([^]+)/,ge=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function _e(e){let t={};return e.replace(ge,e=>e.startsWith(`/*`)?``:e).split(me).forEach(e=>{if(e){let n=e.split(he);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function j(e){let t=``;if(y(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=j(e[n]);r&&(t+=r+` `)}else if(x(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}function ve(e){if(!e)return null;let{class:t,style:n}=e;return t&&!y(t)&&(e.class=j(t)),n&&(e.style=pe(n)),e}var ye=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,be=n(ye);ye+``;function xe(e){return!!e||e===``}function Se(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=Ee(e[i],t[i],n);return r}function Ce(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&Ee(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function we(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?Ce(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!Ee(e[r],t[r],n))return!1}return String(e)===String(t)}function Te(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function Ee(e,t,n){if(e===t)return!0;let r=g(e),i=g(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=b(e),i=b(t),r||i?e===t:(r=p(e),i=p(t),r||i?r&&i?Te(e,t,n,Se):!1:(r=x(e),i=x(t),r||i?!r||!i?!1:Te(e,t,n,we):String(e)===String(t))))}function De(e,t){return e.findIndex(e=>Ee(e,t))}var Oe=e=>!!(e&&e.__v_isRef===!0),M=e=>y(e)?e:e==null?``:p(e)||x(e)&&(e.toString===C||!v(e.toString))?Oe(e)?M(e.value):JSON.stringify(e,ke,2):String(e),ke=(e,t)=>Oe(t)?ke(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Ae(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Ae(e))}:b(t)?Ae(t):x(t)&&!p(t)&&!E(t)?String(t):t,Ae=(e,t=``)=>b(e)?`Symbol(${e.description??t})`:e;function je(e){return e==null?`initial`:typeof eLine truncated
`&&(e.tagName===`PRE`||e.tagName===`TEXTAREA`)&&(n=n.slice(1));let{textContent:r}=e;r!==n&&r!==n.replace(/\r\n|\r/g,`
`)&&(vi(e,0)||ci(),e.textContent=t.children)}if(d){if(_||b||!o||f&48){let t=e.tagName.includes(`-`),i=e.namespaceURI.includes(`svg`)?`svg`:e.namespaceURI.includes(`MathML`)?`mathml`:void 0;for(let a in d)if(_&&(a.endsWith(`value`)||a===`indeterminate`)||s(a)&&!O(a)||a[0]===`.`||t&&!O(a)||u&&u.includes(a)){if(hi(e,a,d[a]))continue;r(e,a,null,d[a],i,n)}}else if(d.onClick)r(e,`onClick`,null,d.onClick,void 0,n);else if(f&4&&$t(d.style))for(let e in d.style)d.style[e]}let x;(x=d&&d.onVnodeBeforeMount)&&vs(x,n,t),h&&pr(t,null,n,`beforeMount`),((x=d&&d.onVnodeMounted)||h||l)&&Xo(()=>{x&&vs(x,n,t),l&&g.enter(e),h&&pr(t,null,n,`mounted`)},i)}return e.nextSibling},m=(e,t,r,o,s,c,u)=>{u||=!!t.dynamicChildren;let d=t.children,p=d.length,m=!1;for(let t=0;t<p;t++){let h=u?d[t]:d[t]=hs(d[t]),g=h.type===$o;e?(g&&!u&&t+1<p&&hs(d[t+1]).type===$o&&(l(i(e.data.slice(h.children.length)),r,a(e)),e.data=h.children),e=f(e,h,o,s,c,u)):g&&!h.children?l(h.el=i(``),r):(m||(m=!0,vi(r,1)||ci()),n(null,h,r,null,o,s,di(r),c))}return e},h=(e,t,n,r,i,s)=>{let{slotScopeIds:c}=t;c&&(i=i?i.concat(c):c);let d=o(e),f=m(a(e),t,d,n,r,i,s);return f&&fi(f)&&f.data===`]`?a(t.anchor=f):(ci(),l(t.anchor=u(`]`),d,f),f)},g=(e,t,r,i,s,l)=>{if(bi(e,t)||ci(),t.el=null,l){let t=_(e);for(;;){let n=a(e);if(n&&n!==t)c(n);else break}}let u=a(e),d=o(e);return c(e),n(null,t,d,u,r,i,di(d),s),r&&(r.vnode.el=t.el,co(r,t.el)),u},_=(e,t=`[`,n=`]`)=>{let r=0;for(;e;)if(e=a(e),e&&fi(e)&&(e.data===t&&r++,e.data===n)){if(r===0)return a(e);r--}return e},v=(e,t,n)=>{let r=t.parentNode;r&&r.replaceChild(e,t);let i=n;for(;i;)i.vnode.el===t&&(i.vnode.el=i.subTree.el=e),i=i.parent},y=e=>e.nodeType===1&&e.tagName===`TEMPLATE`;return[d,f]}var mi=new Set([`src`,`srcset`,`href`,`poster`]);function hi(e,t,n){return mi.has(t)?e.getAttribute(t)===(n==null?null:`${n}`):!1}var gi=`data-allow-mismatch`,_i={0:`text`,1:`children`,2:`class`,3:`style`,4:`attribute`};function vi(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(gi);)e=e.parentElement;return yi(e&&e.getAttribute(gi),t)}function yi(e,t){if(e==null)return!1;if(e===``)return!0;{let n=e.split(`,`);return t===0&&n.includes(`children`)?!0:n.includes(_i[t])}}function bi(e,t){return vi(e.parentElement,1)||oee(e)||xi(t)}function oee(e){return e.nodeType===1&&yi(e.getAttribute(gi),1)}function xi({props:e}){let t=e&&e[gi];return typeof t==`string`&&yi(t,1)}var Si=de().requestIdleCallback||(e=>setTimeout(e,1)),Ci=de().cancelIdleCallback||(e=>clearTimeout(e)),wi=(e=1e4)=>t=>{let n=Si(t,{timeout:e});return()=>Ci(n)};function Ti(e){let{top:t,left:n,bottom:r,right:i}=e.getBoundingClientRect(),{innerHeight:a,innerWidth:o}=window;return(t>0&&t<a||r>0&&r<a)&&(n>0&&n<o||i>0&&i<o)}var Ei=e=>(t,n)=>{let r=new IntersectionObserver(e=>{for(let n of e)if(n.isIntersecting){r.disconnect(),t();break}},e);return n(e=>{if(e instanceof Element){if(Ti(e))return t(),r.disconnect(),!1;r.observe(e)}}),()=>r.disconnect()},Di=e=>t=>{if(e){let n=matchMedia(e);if(n.matches)t();else return n.addEventListener(`change`,t,{once:!0}),()=>n.removeEventListener(`change`,t)}},Oi=(e=[])=>(t,n)=>{y(e)&&(e=[e]);let r=!1,i=e=>{r||(r=!0,a(),t(),e.target.dispatchEvent(new e.constructor(e.type,e)))},a=()=>{n(t=>{for(let n of e)t.removeEventListener(n,i)})};return n(t=>{for(let n of e)t.addEventListener(n,i,{once:!0})}),a};function ki(e,t){if(fi(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(fi(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var Ai=e=>!!e.type.__asyncLoader;function ji(e){v(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:i=200,hydrate:a,timeout:o,suspensible:s=!0,onError:c}=e,l=null,u,d=0,f=()=>(d++,l=null,p()),p=()=>{let e;return l||(e=l=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),c)return new Promise((t,n)=>{c(e,()=>t(f()),()=>n(e),d+1)});throw e}).then(t=>e!==l&&l?l:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),u=t,t)))};return L({name:`AsyncComponentWrapper`,__asyncLoader:p,__asyncHydrate(e,t,n){let r=e.isConnected,i=!1;(t.bu||=[]).push(()=>i=!0);let o=()=>{i||!e.parentNode||r&&!e.isConnected||n()},s=a?()=>{let n=a(o,t=>ki(e,t));n&&(t.bum||=[]).push(n)}:o;u?s():p().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return u},setup(){let e=xs;if(ti(e),u)return()=>Mi(u,e);let t=t=>{l=null,Bn(t,e,13,!r)};if(s&&e.suspense||Os)return p().then(t=>()=>Mi(t,e)).catch(e=>(t(e),()=>r?G(r,{error:e}):null));let a=N(!1),c=N(),d=N(!!i),f,m;return Ji(()=>{f!=null&&clearTimeout(f),m!=null&&clearTimeout(m)}),i&&(m=setTimeout(()=>{e.isUnmounted||(d.value=!1)},i)),o!=null&&(f=setTimeout(()=>{if(!e.isUnmounted&&!a.value&&!c.value){let e=Error(`Async component timed out after ${o}ms.`);t(e),c.value=e}},o)),p().then(()=>{e.isUnmounted||(a.value=!0,e.parent&&Ni(e.parent.vnode)&&e.parent.update())}).catch(n=>{if(e.isUnmounted){l=null;return}t(n),c.value=n}),()=>{if(a.value&&u)return Mi(u,e);if(c.value&&r)return G(r,{error:c.value});if(n&& Line truncated
`))),e[Dl]=Tl(i);let a=r||i.props&&i.props.type===`number`;qc(e,t?`change`:`input`,t=>{t.target.composing||e[Dl](kl(e.value,n,a))}),(n||a)&&qc(e,`change`,()=>{e.value=kl(e.value,n,a)}),t||(qc(e,`compositionstart`,fee),qc(e,`compositionend`,El),qc(e,`change`,El))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Ol];delete e[Ol],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[Dl](kl(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Dl]=Tl(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?ce(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},jl={deep:!0,created(e,t,n){e[Dl]=Tl(n),qc(e,`change`,()=>{let t=e._modelValue,n=Ll(e),r=e.checked,i=e[Dl];if(p(t)){let e=De(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Rl(e,r))})},mounted:Ml,beforeUpdate(e,t,n){e[Dl]=Tl(n),Ml(e,t,n)}};function Ml(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=De(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=Ee(t,Rl(e,!0))}e.checked!==i&&(e.checked=i)}var Nl={created(e,{value:t},n){e.checked=Ee(t,n.props.value),e[Dl]=Tl(n),qc(e,`change`,()=>{e[Dl](Ll(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Dl]=Tl(r),t!==n&&(e.checked=Ee(t,r.props.value))}},Pl={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,qc(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?ce(Ll(e)):Ll(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[Dl](i)}finally{Jn(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[Dl]=Tl(r)},mounted(e,{value:t}){Il(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Dl]=Tl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!Fl(t,n[1],n[0]))&&Il(e,t)}};function Fl(e,t,n){if(!n||p(e))return Ee(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function Il(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Ll(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):De(t,o)>-1}else a.selected=t.has(o)}else if(Ee(Ll(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Ll(e){return`_value`in e?e._value:e.value}function Rl(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var zl={created(e,t,n){Vl(e,t,n,null,`created`)},mounted(e,t,n){Vl(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){Vl(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){Vl(e,t,n,r,`updated`)}};function Bl(e,t){switch(e){case`SELECT`:return Pl;case`TEXTAREA`:return Al;default:switch(t){case`checkbox`:return jl;case`radio`:return Nl;default:return Al}}}function Vl(e,t,n,r,i){let a=Bl(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function Hl(){Al.getSSRProps=({value:e})=>({value:e}),Nl.getSSRProps=({value:e},t)=>{if(t.props&&Ee(t.props.value,e))return{checked:!0}},jl.getSSRProps=({value:e},t)=>{if(p(e)){if(t.props&&De(e,t.props.value)>-1)return{checked:!0}}else if(h(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},zl.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=Bl(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var Ul=[`ctrl`,`shift`,`alt`,`meta`],Wl={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Ul.some(n=>e[`${n}Key`]&&!t.includes(n))},Gl=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=Wl[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Kl={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},ql=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=re(n.key);if(t.some(e=>e===r||Kl[e]===r))return e(n)}))},Jl=l({patchProp:al},ac),Yl,Xl=!1;function Zl(){return Yl||=ko(Jl)}function Ql(){return Yl=Xl?Yl:Ao(Jl),Xl=!0,Yl}var $l=((...e)=>{Zl().render(...e)}),eu=((...e)=>{Ql().hydrate(...e)}),tu=((...e)=>{let t=Zl().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=iu(e);if(!r)return;let i=t._component;!v(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,ru(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t}),nu=( Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Hp;function Up(e){Hp=e}var Wp=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Gp(e){let t=e instanceof Wp?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function Kp(e,t){let n=await fetch(e,t);if(Hp?.(n.status===401),!n.ok)throw new Wp(await Vp(n),n.status);return n}async function qp(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=zp,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await Kp(e,s);return a?await c.json():void 0}var Z={health:()=>qp(`/health/detailed`),services:()=>qp(`/api/services`),policies:()=>qp(`/api/access/policies`),putPolicy:e=>qp(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>qp(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),summary:()=>qp(`/api/summary`),tasks:()=>qp(`/api/tasks`),taskMeta:()=>qp(`/api/task-meta`),task:e=>qp(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>qp(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>qp(`/api/tasks/${encodeURIComponent(e)}/changes`+Bp(t)),taskDebug:(e,t)=>qp(`/api/tasks/${encodeURIComponent(e)}/debug`+Bp(t)),taskAction:(e,t,n)=>qp(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>qp(`/api/setup`),capabilities:()=>qp(`/api/capabilities`),workflows:()=>qp(`/api/workflows`),workflowEnabled:(e,t)=>qp(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),workRequest:e=>qp(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>qp(`/api/skills`),channels:()=>qp(`/api/channels`),curators:()=>qp(`/api/curators`),channelReload:e=>qp(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>qp(`/api/config`),logs:e=>qp(`/api/logs`+Bp(e)),taskLogs:(e,t)=>qp(`/api/tasks/${encodeURIComponent(e)}/logs`+Bp(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>qp(`/api/version`),updateSnapshot:()=>qp(`/api/chat/update`),updateInstall:e=>qp(`/api/chat/update/install`,{method:`POST`,body:{snapshot:e},timeoutMs:9e5}),captures:e=>qp(`/api/captures`+Bp({limit:e})),eventTypes:()=>qp(`/api/event-types`),eventTypeCreate:e=>qp(`/api/event-types`,{method:`POST`,body:e}),eventTypeUpdate:(e,t)=>qp(`/api/event-types/${encodeURIComponent(e)}`,{method:`PUT`,body:t}),eventTypeDelete:e=>qp(`/api/event-types/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappings:()=>qp(`/api/mappings`),mappingCreate:e=>qp(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>qp(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>qp(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>qp(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>qp(`/api/bindings`),bindingCreate:e=>qp(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>qp(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>qp(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>qp(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),harnessBindings:()=>qp(`/api/harness/bindings`),sources:()=>qp(`/api/sources`),sourceCreate:e=>qp(`/api/sources`,{method:`POST`,body:{path:e}}),sourceSigning:(e,t)=>qp(`/api/sources/${encodeURIComponent(e)}/signing`,{method:`POST`,body:{signed:t}}),sourceApproveUnsigned:e=>qp(`/api/sources/${encodeURIComponent(e)}/approve-unsigned`,{method:`POST`}),sourceSecret:e=>qp(`/api/sources/${encodeURIComponent(e)}/secret`,{method:`POST`}),chatSessions:()=>qp(`/api/chat/sessions`),chatMessages:e=>qp(`/api/chat/sessions/${encodeURIComponent(e)}/messages`),chatTurns:e=>qp(`/api/chat/sessions/${encodeURIComponent(e)}/turns`),chatCancel:e=>qp(`/api/chat/cancel`,{method:`POST`,body:{session_id:e}}),chatMessage:(e,t)=>qp(`/api/chat/message`,{method:`POST`,body:{channel_id:e,source_id:Rp(),text:t,page:location.pathname+location.search||`/`}}),chatPersona:(e,t)=>qp(`/api/chat/persona`,{method:`POST`,body:{session_id:e,name:t}}),chatDangerous:()=>qp(`/api/chat/dangerous`),chatDangerousRequest:(e,t)=>qp(`/api/chat/dangerous/${encodeURIComponent(e)}`,{method:`POST`,body:{spec:t}}),chatDangerousDecision:(e,t)=>qp(`/api/chat/dangerous/${encodeURIComponent(e)}/decision`,{method:`POST`,body:{decision:t}}),chatStream:(e,t={})=>Kp(`/api/chat/stream`,{method:`POST`,headers:{Accept:`text/event-stream`,"Content-Type":`application/json`,"X-Archie-CSRF":`1`},body:JSON.stringify(e),signal:t.signal})};function Jp(e,t,n=``,r=!1){let i=new EventSource(Lp(n,r));return i.onopen=()=>t(`liLine truncated
`)&&(pi(e,0)||ri(),e.textContent=t.children)}if(d){if(_||b||!o||f&48){let t=e.tagName.includes(`-`),i=e.namespaceURI.includes(`svg`)?`svg`:e.namespaceURI.includes(`MathML`)?`mathml`:void 0;for(let a in d)if(_&&(a.endsWith(`value`)||a===`indeterminate`)||s(a)&&!O(a)||a[0]===`.`||t&&!O(a)||u&&u.includes(a)){if(ui(e,a,d[a]))continue;r(e,a,null,d[a],i,n)}}else if(d.onClick)r(e,`onClick`,null,d.onClick,void 0,n);else if(f&4&&Qt(d.style))for(let e in d.style)d.style[e]}let x;(x=d&&d.onVnodeBeforeMount)&&ms(x,n,t),h&&cr(t,null,n,`beforeMount`),((x=d&&d.onVnodeMounted)||h||l)&&Wo(()=>{x&&ms(x,n,t),l&&g.enter(e),h&&cr(t,null,n,`mounted`)},i)}return e.nextSibling},m=(e,t,r,o,s,c,u)=>{u||=!!t.dynamicChildren;let d=t.children,p=d.length,m=!1;for(let t=0;t<p;t++){let h=u?d[t]:d[t]=ds(d[t]),g=h.type===qo;e?(g&&!u&&t+1<p&&ds(d[t+1]).type===qo&&(l(i(e.data.slice(h.children.length)),r,a(e)),e.data=h.children),e=f(e,h,o,s,c,u)):g&&!h.children?l(h.el=i(``),r):(m||(m=!0,pi(r,1)||ri()),n(null,h,r,null,o,s,oi(r),c))}return e},h=(e,t,n,r,i,s)=>{let{slotScopeIds:c}=t;c&&(i=i?i.concat(c):c);let d=o(e),f=m(a(e),t,d,n,r,i,s);return f&&si(f)&&f.data===`]`?a(t.anchor=f):(ri(),l(t.anchor=u(`]`),d,f),f)},g=(e,t,r,i,s,l)=>{if(hi(e,t)||ri(),t.el=null,l){let t=_(e);for(;;){let n=a(e);if(n&&n!==t)c(n);else break}}let u=a(e),d=o(e);return c(e),n(null,t,d,u,r,i,oi(d),s),r&&(r.vnode.el=t.el,no(r,t.el)),u},_=(e,t=`[`,n=`]`)=>{let r=0;for(;e;)if(e=a(e),e&&si(e)&&(e.data===t&&r++,e.data===n)){if(r===0)return a(e);r--}return e},v=(e,t,n)=>{let r=t.parentNode;r&&r.replaceChild(e,t);let i=n;for(;i;)i.vnode.el===t&&(i.vnode.el=i.subTree.el=e),i=i.parent},y=e=>e.nodeType===1&&e.tagName===`TEMPLATE`;return[d,f]}var li=new Set([`src`,`srcset`,`href`,`poster`]);function ui(e,t,n){return li.has(t)?e.getAttribute(t)===(n==null?null:`${n}`):!1}var di=`data-allow-mismatch`,fi={0:`text`,1:`children`,2:`class`,3:`style`,4:`attribute`};function pi(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(di);)e=e.parentElement;return mi(e&&e.getAttribute(di),t)}function mi(e,t){if(e==null)return!1;if(e===``)return!0;{let n=e.split(`,`);return t===0&&n.includes(`children`)?!0:n.includes(fi[t])}}function hi(e,t){return pi(e.parentElement,1)||gi(e)||_i(t)}function gi(e){return e.nodeType===1&&mi(e.getAttribute(di),1)}function _i({props:e}){let t=e&&e[di];return typeof t==`string`&&mi(t,1)}var vi=de().requestIdleCallback||(e=>setTimeout(e,1)),yi=de().cancelIdleCallback||(e=>clearTimeout(e)),bi=(e=1e4)=>t=>{let n=vi(t,{timeout:e});return()=>yi(n)};function xi(e){let{top:t,left:n,bottom:r,right:i}=e.getBoundingClientRect(),{innerHeight:a,innerWidth:o}=window;return(t>0&&t<a||r>0&&r<a)&&(n>0&&n<o||i>0&&i<o)}var Si=e=>(t,n)=>{let r=new IntersectionObserver(e=>{for(let n of e)if(n.isIntersecting){r.disconnect(),t();break}},e);return n(e=>{if(e instanceof Element){if(xi(e))return t(),r.disconnect(),!1;r.observe(e)}}),()=>r.disconnect()},Ci=e=>t=>{if(e){let n=matchMedia(e);if(n.matches)t();else return n.addEventListener(`change`,t,{once:!0}),()=>n.removeEventListener(`change`,t)}},wi=(e=[])=>(t,n)=>{y(e)&&(e=[e]);let r=!1,i=e=>{r||(r=!0,a(),t(),e.target.dispatchEvent(new e.constructor(e.type,e)))},a=()=>{n(t=>{for(let n of e)t.removeEventListener(n,i)})};return n(t=>{for(let n of e)t.addEventListener(n,i,{once:!0})}),a};function Ti(e,t){if(si(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(si(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var Ei=e=>!!e.type.__asyncLoader;function Di(e){v(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:i=200,hydrate:a,timeout:o,suspensible:s=!0,onError:c}=e,l=null,u,d=0,f=()=>(d++,l=null,p()),p=()=>{let e;return l||(e=l=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),c)return new Promise((t,n)=>{c(e,()=>t(f()),()=>n(e),d+1)});throw e}).then(t=>e!==l&&l?l:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),u=t,t)))};return L({name:`AsyncComponentWrapper`,__asyncLoader:p,__asyncHydrate(e,t,n){let r=e.isConnected,i=!1;(t.bu||=[]).push(()=>i=!0);let o=()=>{i||!e.parentNode||r&&!e.isConnected||n()},s=a?()=>{let n=a(o,t=>Ti(e,t));n&&(t.bum||=[]).push(n)}:o;u?s():p().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return u},setup(){let e=vs;if(Xr(e),u)return()=>Oi(u,e);let t=t=>{l=null,Ln(t,e,13,!r)};if(s&&e.suspense||Ts)return p().then(t=>()=>Oi(t,e)).catch(e=>(t(e),()=>r?G(r,{error:e}):null));let a=N(!1),c=N(),d=N(!!i),f,m;return Gi(()=>{f!=null&&clearTimeout(f),m!=null&&clearTimeout(m)}),i&&(m=setTimeout(()=>{e.isUnmounted||(d.value=!1)},i)),o!=null&&(f=setTimeout(()=>{if(!e.isUnmounted&&!a.value&&!c.value){let e=Error(`Async component timed out after ${o}ms.`);t(e),c.value=e}},o)),p().then(()=>{e.isUnmounted||(a.value=!0,e.parent&&ki(e.parent.vnode)&&e.parent.update())}).catch(n=>{if(e.isUnmounted){l=null;return}t(n),c.value=n}),()=>{if(a.value&&u)return Oi(u,e);if(c.value&&r)return G(r,{error:c.value});if(n&&!d Line truncated
`))),e[El]=Cl(i);let a=r||i.props&&i.props.type===`number`;Wc(e,t?`change`:`input`,t=>{t.target.composing||e[El](Ol(e.value,n,a))}),(n||a)&&Wc(e,`change`,()=>{e.value=Ol(e.value,n,a)}),t||(Wc(e,`compositionstart`,wl),Wc(e,`compositionend`,Tl),Wc(e,`change`,Tl))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Dl];delete e[Dl],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[El](Ol(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[El]=Cl(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?ce(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Al={deep:!0,created(e,t,n){e[El]=Cl(n),Wc(e,`change`,()=>{let t=e._modelValue,n=Fl(e),r=e.checked,i=e[El];if(p(t)){let e=De(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Il(e,r))})},mounted:jl,beforeUpdate(e,t,n){e[El]=Cl(n),jl(e,t,n)}};function jl(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=De(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=Ee(t,Il(e,!0))}e.checked!==i&&(e.checked=i)}var Ml={created(e,{value:t},n){e.checked=Ee(t,n.props.value),e[El]=Cl(n),Wc(e,`change`,()=>{e[El](Fl(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[El]=Cl(r),t!==n&&(e.checked=Ee(t,r.props.value))}},Nl={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,Wc(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?ce(Fl(e)):Fl(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[El](i)}finally{Kn(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[El]=Cl(r)},mounted(e,{value:t}){Pl(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[El]=Cl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!mee(t,n[1],n[0]))&&Pl(e,t)}};function mee(e,t,n){if(!n||p(e))return Ee(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function Pl(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Fl(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):De(t,o)>-1}else a.selected=t.has(o)}else if(Ee(Fl(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Fl(e){return`_value`in e?e._value:e.value}function Il(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var Ll={created(e,t,n){zl(e,t,n,null,`created`)},mounted(e,t,n){zl(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){zl(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){zl(e,t,n,r,`updated`)}};function Rl(e,t){switch(e){case`SELECT`:return Nl;case`TEXTAREA`:return kl;default:switch(t){case`checkbox`:return Al;case`radio`:return Ml;default:return kl}}}function zl(e,t,n,r,i){let a=Rl(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function hee(){kl.getSSRProps=({value:e})=>({value:e}),Ml.getSSRProps=({value:e},t)=>{if(t.props&&Ee(t.props.value,e))return{checked:!0}},Al.getSSRProps=({value:e},t)=>{if(p(e)){if(t.props&&De(e,t.props.value)>-1)return{checked:!0}}else if(h(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Ll.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=Rl(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var gee=[`ctrl`,`shift`,`alt`,`meta`],_ee={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>gee.some(n=>e[`${n}Key`]&&!t.includes(n))},Bl=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=_ee[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Vl={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Hl=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=re(n.key);if(t.some(e=>e===r||Vl[e]===r))return e(n)}))},Ul=l({patchProp:nl},nc),Wl,Gl=!1;function Kl(){return Wl||=Co(Ul)}function ql(){return Wl=Gl?Wl:wo(Ul),Gl=!0,Wl}var Jl=((...e)=>{Kl().render(...e)}),Yl=((...e)=>{ql().hydrate(...e)}),Xl=((...e)=>{let t=Kl().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=$l(e);if(!r)return;let i=t._component;!v(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,Ql(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t} Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Lp;function Rp(e){Lp=e}var zp=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Bp(e){let t=e instanceof zp?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function Vp(e,t){let n=await fetch(e,t);if(Lp?.(n.status===401),!n.ok)throw new zp(await Ip(n),n.status);return n}async function Hp(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Pp,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await Vp(e,s);return a?await c.json():void 0}var Z={health:()=>Hp(`/health/detailed`),services:()=>Hp(`/api/services`),policies:()=>Hp(`/api/access/policies`),putPolicy:e=>Hp(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>Hp(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),summary:()=>Hp(`/api/summary`),tasks:()=>Hp(`/api/tasks`),taskMeta:()=>Hp(`/api/task-meta`),task:e=>Hp(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Hp(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Hp(`/api/tasks/${encodeURIComponent(e)}/changes`+Fp(t)),taskDebug:(e,t)=>Hp(`/api/tasks/${encodeURIComponent(e)}/debug`+Fp(t)),taskAction:(e,t,n)=>Hp(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>Hp(`/api/setup`),capabilities:()=>Hp(`/api/capabilities`),workflows:()=>Hp(`/api/workflows`),workflowEnabled:(e,t)=>Hp(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),workRequest:e=>Hp(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Hp(`/api/skills`),channels:()=>Hp(`/api/channels`),curators:()=>Hp(`/api/curators`),channelReload:e=>Hp(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Hp(`/api/config`),logs:e=>Hp(`/api/logs`+Fp(e)),taskLogs:(e,t)=>Hp(`/api/tasks/${encodeURIComponent(e)}/logs`+Fp(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>Hp(`/api/version`),updateSnapshot:()=>Hp(`/api/chat/update`),updateInstall:e=>Hp(`/api/chat/update/install`,{method:`POST`,body:{snapshot:e},timeoutMs:9e5}),captures:e=>Hp(`/api/captures`+Fp({limit:e})),eventTypes:()=>Hp(`/api/event-types`),eventTypeCreate:e=>Hp(`/api/event-types`,{method:`POST`,body:e}),eventTypeUpdate:(e,t)=>Hp(`/api/event-types/${encodeURIComponent(e)}`,{method:`PUT`,body:t}),eventTypeDelete:e=>Hp(`/api/event-types/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappings:()=>Hp(`/api/mappings`),mappingCreate:e=>Hp(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>Hp(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>Hp(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>Hp(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>Hp(`/api/bindings`),bindingCreate:e=>Hp(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>Hp(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>Hp(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>Hp(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),harnessBindings:()=>Hp(`/api/harness/bindings`),sources:()=>Hp(`/api/sources`),sourceCreate:e=>Hp(`/api/sources`,{method:`POST`,body:{path:e}}),sourceSigning:(e,t)=>Hp(`/api/sources/${encodeURIComponent(e)}/signing`,{method:`POST`,body:{signed:t}}),sourceApproveUnsigned:e=>Hp(`/api/sources/${encodeURIComponent(e)}/approve-unsigned`,{method:`POST`}),sourceSecret:e=>Hp(`/api/sources/${encodeURIComponent(e)}/secret`,{method:`POST`}),chatSessions:()=>Hp(`/api/chat/sessions`),chatMessages:e=>Hp(`/api/chat/sessions/${encodeURIComponent(e)}/messages`),chatTurns:e=>Hp(`/api/chat/sessions/${encodeURIComponent(e)}/turns`),chatCancel:e=>Hp(`/api/chat/cancel`,{method:`POST`,body:{session_id:e}}),chatMessage:(e,t)=>Hp(`/api/chat/message`,{method:`POST`,body:{channel_id:e,source_id:Np(),text:t,page:location.pathname+location.search||`/`}}),chatPersona:(e,t)=>Hp(`/api/chat/persona`,{method:`POST`,body:{session_id:e,name:t}}),chatDangerous:()=>Hp(`/api/chat/dangerous`),chatDangerousRequest:(e,t)=>Hp(`/api/chat/dangerous/${encodeURIComponent(e)}`,{method:`POST`,body:{spec:t}}),chatDangerousDecision:(e,t)=>Hp(`/api/chat/dangerous/${encodeURIComponent(e)}/decision`,{method:`POST`,body:{decision:t}}),chatStream:(e,t={})=>Vp(`/api/chat/stream`,{method:`POST`,headers:{Accept:`text/event-stream`,"Content-Type":`application/json`,"X-Archie-CSRF":`1`},body:JSON.stringify(e),signal:t.signal})};function Up(e,t,n=``,r=!1){let i=new EventSource(Mp(n,r));return i.onopen=()=>t(`liLine truncated
`);u=r.pop()||``;for(let e of r){let t=e.split(`
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(lm.value=n.session_id),n.type===`delta`&&(o+=n.text,mm.value=mm.value?{...mm.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],mm.value=mm.value?{...mm.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);um.value=[...um.value,{from:`assistant`,text:o,tool_calls:a}],mm.value=null,fm.value=`Ready`,await km()}catch(e){let t=e;t.name===`AbortError`&&!c?(mm.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},fm.value=`Stopped`):(mm.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?im(r):void 0,isRetry:i},fm.value=`Error — retry available`)}finally{clearTimeout(l),Dm=null,pm.value=!1}}function Hm(){fm.value=`Stopping…`,lm.value&&Z.chatCancel(lm.value).catch(()=>{}),Om()}function Um(){Wi(()=>{km().catch(e=>{fm.value=e.message||`Chat unavailable`})}),Ji(()=>{Om()})}var Wm=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],Gm=L({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return X(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(V(),H(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":P(om),onClick:i[0]||=e=>n(`toggle`)},[W(`span`,{"aria-hidden":`true`,class:j(r(!e.open))},[G(P(Dd),{size:22})],2),W(`span`,{"aria-hidden":`true`,class:j(r(e.open))},[G(P(rf),{size:22})],2)],8,Wm))}});function Km(e){return typeof e==`string`?`'${e}'`:new Xm().serialize(e)}var qm=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Jm=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[qm.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Ym(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Jm[n]?Jm[n]:n+128,s=a<128&&Jm[a]?Jm[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Xm=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Ym(e,t):n===`number`&&r===`number`?e-t:Ym(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Ym),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`] Line truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(im.value=n.session_id),n.type===`delta`&&(o+=n.text,lm.value=lm.value?{...lm.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],lm.value=lm.value?{...lm.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);am.value=[...am.value,{from:`assistant`,text:o,tool_calls:a}],lm.value=null,sm.value=`Ready`,await wm()}catch(e){let t=e;t.name===`AbortError`&&!c?(lm.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},sm.value=`Stopped`):(lm.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?$p(r):void 0,isRetry:i},sm.value=`Error — retry available`)}finally{clearTimeout(l),Sm=null,cm.value=!1}}function Tee(){sm.value=`Stopping…`,im.value&&Z.chatCancel(im.value).catch(()=>{}),Cm()}function Eee(){Vi(()=>{wm().catch(e=>{sm.value=e.message||`Chat unavailable`})}),Gi(()=>{Cm()})}var Dee=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],Oee=L({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return X(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(V(),H(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":P(tm),onClick:i[0]||=e=>n(`toggle`)},[W(`span`,{"aria-hidden":`true`,class:j(r(!e.open))},[G(P(Sd),{size:22})],2),W(`span`,{"aria-hidden":`true`,class:j(r(e.open))},[G(P(Qd),{size:22})],2)],8,Dee))}});function jm(e){return typeof e==`string`?`'${e}'`:new Aee().serialize(e)}var kee=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Mm=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[kee.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Nm(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Mm[n]?Mm[n]:n+128,s=a<128&&Mm[a]?Mm[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Aee=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Nm(e,t):n===`number`&&r===`number`?e-t:Nm(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Nm),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`FloatLine truncated
`)].join(`
`))}return()=>i.value||r.value||o.value?Hs(t.default({present:o.value})[0],{ref:e=>{let t=Oh(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),Kg=L({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=Wh(n.default()),r=e.findIndex(e=>e.type!==es);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?J(t,i.props):t,o=ms({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),qg=[`area`,`img`,`input`],Jg=L({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&qg.includes(r)?()=>Hs(r,t):r===`template`?()=>Hs(Kg,t,{default:n.default}):()=>Hs(e.as,t,{default:n.default})}});function Yg(){let e=N();return{primitiveElement:e,currentElement:Y(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:Oh(e))}}var[Xg,Zg]=th(`CollapsibleRoot`),Qg=L({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=Uh(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=vn(r);return Zg({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Q(),(e,t)=>(V(),U(P(Jg),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:F(()=>[z(e.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),$g=L({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=Xg();i.contentId||=Fg(void 0,`reka-collapsible-content`);let a=N(),{forwardRef:o,currentElement:s}=Q(),c=N(0),l=N(0),u=Y(()=>i.open.value),d=N(u.value),f=N();I(()=>[u.value,a.value?.present],async()=>{await Jn();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=Y(()=>d.value&&i.open.value);return Wi(()=>{requestAnimationFrame(()=>{d.value=!1})}),kh(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(e,t)=>(V(),U(P(Gg),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:F(({present:t})=>[G(P(Jg),J(e.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:t?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:F(()=>[!P(i).unmountOnHide.value||t?z(e.$slots,`default`,{key:0}):q(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),e_=L({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Q();let n=Xg();return(e,r)=>(V(),U(P(Jg),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:F(()=>[z(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function t_({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function n_({type:e,defaultValue:t,modelValue:n}){return e||t_({type:e,defaultValue:t,modelValue:n})}function r_({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function i_(e,t){let n=Y(()=>n_(e)),r=Uh(e,`modelValue`,t,{defaultValue:r_(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Zm(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(ah(t,e)){let n=t.findIndex(t=>Zm(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:Y(()=>n.value===`single`)}}var[a_,o_]=th(`AccordionRoot`),s_=L({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:! Line truncated
`))}return()=>i.value||r.value||o.value?zs(t.default({present:o.value})[0],{ref:e=>{let t=lh(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),Dg=L({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=Th(n.default()),r=e.findIndex(e=>e.type!==Jo);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?J(t,i.props):t,o=ls({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),Og=[`area`,`img`,`input`],kg=L({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&Og.includes(r)?()=>zs(r,t):r===`template`?()=>zs(Dg,t,{default:n.default}):()=>zs(e.as,t,{default:n.default})}});function Ag(){let e=N();return{primitiveElement:e,currentElement:Y(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:lh(e))}}var[jg,Mg]=Rm(`CollapsibleRoot`),Ng=L({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=wh(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=_n(r);return Mg({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Q(),(e,t)=>(V(),U(P(kg),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:F(()=>[z(e.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),Pg=L({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=jg();i.contentId||=gg(void 0,`reka-collapsible-content`);let a=N(),{forwardRef:o,currentElement:s}=Q(),c=N(0),l=N(0),u=Y(()=>i.open.value),d=N(u.value),f=N();I(()=>[u.value,a.value?.present],async()=>{await Kn();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=Y(()=>d.value&&i.open.value);return Vi(()=>{requestAnimationFrame(()=>{d.value=!1})}),uh(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(e,t)=>(V(),U(P(Eg),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:F(({present:t})=>[G(P(kg),J(e.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:t?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:F(()=>[!P(i).unmountOnHide.value||t?z(e.$slots,`default`,{key:0}):q(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),Fg=L({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Q();let n=jg();return(e,r)=>(V(),U(P(kg),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:F(()=>[z(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Ig({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function Lg({type:e,defaultValue:t,modelValue:n}){return e||Ig({type:e,defaultValue:t,modelValue:n})}function Rg({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function zg(e,t){let n=Y(()=>Lg(e)),r=wh(e,`modelValue`,t,{defaultValue:Rg(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Pm(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Hm(t,e)){let n=t.findIndex(t=>Pm(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:Y(()=>n.value===`single`)}}var[Bg,Vg]=Rm(`AccordionRoot`),Hg=L({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:! Line truncated
- a positive number
- less than the value passed to \`max\` (or ${lS} if no \`max\` prop is set)
- less than the value passed to \`max\` (or ${bS} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`),null)}function mS(e){return fS(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${lS}\`.`),lS)}var hS=L({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:lS},getValueLabel:{type:Function,required:!1,default:(e,t)=>fS(e)?`${Math.round(e/t*lS)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;Q();let i=Uh(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=Uh(n,`max`,r,{passive:n.max===void 0});I(()=>i.value,async e=>{let t=pS(e,n.max);t!==e&&(await Jn(),i.value=t)},{immediate:!0}),I(()=>n.max,e=>{let t=mS(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=Y(()=>ih(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return dS({modelValue:i,max:a,progressState:o}),(e,t)=>(V(),U(P(Jg),{"as-child":e.asChild,as:e.as,"aria-valuemax":P(a),"aria-valuemin":0,"aria-valuenow":fS(P(i))?P(i):void 0,"aria-valuetext":e.getValueText?.(P(i),P(a)),"aria-label":e.getValueLabel(P(i),P(a)),role:`progressbar`,"data-state":o.value,"data-value":P(i)??void 0,"data-max":P(a)},{default:F(()=>[z(e.$slots,`default`,{modelValue:P(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),gS=L({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=uS();return Q(),(e,r)=>(V(),U(P(Jg),J(t,{"data-state":P(n).progressState.value,"data-value":P(n).modelValue?.value??void 0,"data-max":P(n).max.value}),{default:F(()=>[z(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),_S=`radio.select`;function vS(e,t,n){rh(_S,n,{originalEvent:e,value:t})}var yS=L({inheritAttrs:!1,__name:`Radio`,props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:checked`,`select`],setup(e,{emit:t}){let n=e,r=t,i=Uh(n,`checked`,r,{passive:n.checked===void 0}),{value:a}=vn(n),{forwardRef:o,currentElement:s}=Q(),c=pg(s),l=gg(),u=Y(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);function d(e){n.disabled||vS(e,n.value,e=>{r(`select`,e),!e?.defaultPrevented&&(i.value=!0,c.value&&e.stopPropagation())})}return(e,t)=>(V(),H(B,null,[G(P(Jg),J({id:e.id,ref:P(o),role:`radio`,type:e.as===`button`?`button`:void 0,as:e.as,"aria-checked":P(i)??!1,"aria-label":u.value,"as-child":e.asChild,disabled:e.disabled?``:void 0,"data-state":P(i)?`checked`:`unchecked`,"data-disabled":e.disabled?``:void 0,value:P(a),required:e.required,name:e.name},{...P(l),...e.$attrs},{onClick:Gl(d,[`stop`])}),{default:F(()=>[z(e.$slots,`default`,{checked:P(i)})]),_:3},16,[`id`,`type`,`as`,`aria-checked`,`aria-label`,`as-child`,`disabled`,`data-state`,`data-disabled`,`value`,`required`,`name`]),P(c)&&e.name?(V(),U(P(ov),J({key:0,type:`radio`,tabindex:`-1`,value:P(a),checked:!!P(i),name:e.name,disabled:e.disabled,required:e.required},P(l)),null,16,[`value`,`checked`,`name`,`disabled`,`required`])):q(`v-if`,!0)],64))}}),[bS,xS]=th(`RadioGroupRoot`),SS=L({__name:`RadioGroupRoot`,props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Q(),o=Uh(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:c,orientation:l,name:u,required:d,dir:f}=vn(n),p=cg(f),m=pg(a);return xS({modelValue:o,changeModelValue:e=>{o.value=e},disabled:s,loop:c,orientation:l,name:u?.value,required:d}),(e,t)=>(V(),U(P(kb),{"as-child":``,orientation:P(l),dir:P(p),loop:P(c)},{default:F(()=>[G(P(Jg),{ref:P(i),role:`radiogroup`,"data-disabled":P(s)?``:void 0,"as-child":e.asChild,as:e.as,"aria-orientation":P(l),"aria-required":P(d),dir:P(p)},{default:F(()=>[z(e.$slots,`default`,{modelValue:P(o)}),P(m)&&P(u)?(V(),U(P(ov),{key:0,required:P(d),disabled:P(s),value:P(o),name:P(u)},null,8,[`required`,`disabled`,`value`,`name`])):q(`v-if`,!0)]),_:3},8,[`data-disabled`,`as-child`,`as`,`aria-orientation`,`aria-required`,`dir`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),[qee,CS]=th(`RadioGroupItem`),wS=L({inheritAttrs:!1,__name:`RadioGroupItem`,props:{id:{type:String,required:!1},value:{type:nuLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:vE(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>vE(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=bE(c),u=e+1<n.length?bE(n[e+1]):null;if(l&&u&&xE(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=bE(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>vE(e)),rows:r.map(e=>e.map(e=>vE(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:vE(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1]);continue}if(c.startsWith(`>`)){o(),s(),t.push({kind:`blockquote`,inline:vE(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function bE(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function xE(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var SE={class:`[overflow-wrap:anywhere]`},CE={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},wE={class:`font-mono text-[0.85em]`},TE={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},EE={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},DE={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},OE={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},kE={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},AE={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},jE={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},ME={key:8,class:`mb-2.5 last:mb-0`},NE=L({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=Y(()=>yE(t.text));return(e,t)=>(V(),H(`div`,SE,[(V(!0),H(B,null,R(n.value,(e,t)=>(V(),H(B,{key:t},[e.kind===`pre`?(V(),H(`pre`,CE,[W(`code`,wE,M(e.code),1)])):e.kind===`table`?(V(),H(`table`,TE,[W(`thead`,null,[W(`tr`,null,[(V(!0),H(B,null,R(e.head,(e,t)=>(V(),H(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[G(gE,{inline:e},null,8,[`inline`])]))),128))])]),W(`tbody`,null,[(V(!0),H(B,null,R(e.rows,(e,t)=>(V(),H(`tr`,{key:t},[(V(!0),H(B,null,R(e,(e,t)=>(V(),H(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[G(gE,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(V(),H(`blockquote`,EE,[G(gE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(V(),H(`h1`,DE,[G(gE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(V(),H(`h2`,OE,[G(gE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(V(),H(`h3`,kE,[G(gE,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(V(),H(`ul`,AE,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(gE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(V(),H(`ol`,jE,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(gE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(V(),H(`p`,ME,[G(gE,{inline:e.inline},null,8,[`inline`])])):q(``,!0)],64))),128))]))}}),PE={class:`truncate`},FE=L({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=ta(`RouterLink`);return V(),U(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:F(()=>[G(P(td),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),W(`span`,PE,M(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),IE={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},LE={class:`font-semibold text-foreground`},RE={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},zE=L({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=Y(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=Y(()=>t.tool.parameters||t.tool.Parameters||``),i=Y(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=Y(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(V(),U(FE,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(V(),H(`div`,IE,[G(P(nf),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),W(`span`,LE,M(n.value),1),r.value?(V(),H(`code`,RE,M(r.value),1)):q(``,!0),W(`span`,{class:j(P(X)(`text-fg-muted`,i.value&&`text-danger`))},M(a.value),3)]))}}),BE={key:0,class:`mb-2 grid gap-0.5 text-xs`},VE={key:1,class:`mb-2 flex flex-wrap gap-1.5`},HE={key:3,class:`whitespace-pre-wrap`},UE=L({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(V(),H(`div`,{class:j([`flex`,e.assistant?`justify-start`:`justify-end`])},[W(`div`,{class:j(P(X)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(V(),H(`div`,BE,[(V(!0),H(B,null,R(e.tools,(t,n)=>(V(),U(zE,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):q(``,!0),e.media.length?(V(),H(`div`,VE,[(V(!0),H(B,null,R(e.media,(e,t)=>(V(),U(lE,{key:t,attachment:e},null,8,[`attachment`]))),128))])):q(``,!0),e.assistant?(V(),U(NE,{key:2,text:e.text},null,8,[`text`])):(V(),H(`div`,HE,M(e.text),1)),z(t.$slots,`default`)],2)],2))}}),WE={class:`w-full self-center justify-self-center py-6 text-center`},GE={class:`grid gap-2`},KE=[`onClick`],qE=L({__name:`ChatEmptyState`,emits:[`proLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>Qj?`${n.slice(0,Qj).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var eM=[`title`],tM=L({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>wj(n.event)),a=Y(()=>$j(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=Y(()=>n.event.at?MA(n.event.at):`—`);return(e,t)=>(V(),U(P(Yj),{class:j(i.value>0?`cursor-pointer`:``),role:i.value>0?`link`:void 0,tabindex:i.value>0?0:void 0,title:i.value>0?`Open task details`:void 0,onClick:o,onKeydown:[ql(Gl(o,[`prevent`]),[`enter`]),ql(Gl(o,[`prevent`]),[`space`])]},{default:F(()=>[G(P(Jj),{class:`font-medium`},{default:F(()=>[K(M(n.event.kind||n.event.type||`event`),1)]),_:1}),G(P(Jj),{class:`font-mono`},{default:F(()=>[K(M(i.value>0?`#${i.value}`:`—`),1)]),_:1}),G(P(Jj),{class:`w-[55%] max-w-0`},{default:F(()=>[W(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},M(a.value.text),9,eM)]),_:1}),G(P(Jj),null,{default:F(()=>[K(M(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),nM=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function rM(e){return(Number(e?.task_id)||0)>0}function iM(e,t){return t===`tasks`?rM(e):t!==`system`||!rM(e)}function aM(e,t){return e.filter(e=>iM(e,t))}function oM(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function sM(e,t){return`${e}:${t??0}`}function cM(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=sM($j(n).text,r),a=t[t.length-1];if(a&&a.key===i){a.count+=1,a.events.push(n);continue}t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var lM={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},uM={class:`max-h-[28rem] overflow-y-auto`},dM=[`aria-expanded`,`aria-label`,`onClick`],fM=[`title`],pM=L({__name:`LiveActivityCard`,setup(e){let t=hD(),{activity:n,streamKind:r,streamState:i}=Bu(Fk()),a=N(`all`),o=Y(()=>aM(n.value,a.value)),s=Y(()=>oM(o.value.length,a.value)),c=Jt(new Set),l=Y(()=>cM(o.value));function u(e){c.has(e)?c.delete(e):c.add(e)}function d(e){return c.has(e.key)}function f(e){return $j(e.representative)}function p(e){return e.representative.at?MA(e.representative.at):`—`}function m(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(V(),U(P(TA),null,{default:F(()=>[G(P(AA),null,{default:F(()=>[G(P(jA),null,{default:F(()=>[...t[1]||=[K(`Live activity`,-1)]]),_:1}),G(P(EA),{class:`flex items-center gap-2`},{default:F(()=>[G(P(Wj),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:P(nM)},null,8,[`modelValue`,`options`]),G(P(SA),{variant:P(r)},{default:F(()=>[K(M(P(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),G(P(DA),null,{default:F(()=>[W(`div`,lM,[W(`div`,uM,[G(P(Kj),null,{default:F(()=>[G(P(Zj),{class:`sticky top-0 z-10 bg-card`},{default:F(()=>[G(P(Yj),null,{default:F(()=>[G(P(Xj),null,{default:F(()=>[...t[2]||=[K(`Event`,-1)]]),_:1}),G(P(Xj),null,{default:F(()=>[...t[3]||=[K(`Task`,-1)]]),_:1}),G(P(Xj),null,{default:F(()=>[...t[4]||=[K(`Detail`,-1)]]),_:1}),G(P(Xj),null,{default:F(()=>[...t[5]||=[K(`When`,-1)]]),_:1})]),_:1})]),_:1}),G(P(qj),null,{default:F(()=>[o.value.length?q(``,!0):(V(),U(P(Yj),{key:0},{default:F(()=>[G(P(Jj),{colspan:`4`},{default:F(()=>[G(P(mA),null,{default:F(()=>[G(P(_A),null,{default:F(()=>[G(P(bA),null,{default:F(()=>[K(M(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(V(!0),H(B,{key:1},R(l.value,e=>(V(),H(B,{key:e.key},[e.count===1?(V(),U(tM,{key:0,event:e.representative,onOpen:m},null,8,[`event`])):(V(),H(B,{key:1},[G(P(Yj),{class:j(e.taskID>0?`cursor-pointer`:``),role:e.taskID>0?`link`:void 0,tabindex:e.taskID>0?0:void 0,title:e.taskID>0?`Open task details`:void 0,onClick:t=>e.taskID>0&&m(e.taskID),onKeydown:[ql(Gl(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),ql(Gl(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`space`])]},{default:F(()=>[G(P(Jj),{class:`font-medium`},{default:F(()=>[W(`button`,{type:`button`,class:`inline-flex items-center gap-1 rounded hover:opacity-80`,"aria-expanded":d(e),"aria-label":`${d(e)?`Hide`:`Show`} ${e.count} ${e.label} events`,onClick:Gl(t=>u(e.key),[`stop`])},[d(e)?(V(),U(P(cd),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(V(),U(P(ld),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),K(` `+M(e.label)+` `,1),G(P(SA),{variant:`idle`},{default:F(()=>[K(`×`+M(e.count),1)]),_:2},1024)],8,dM)]),_:2},1024),G(P(Jj),{class:`font-mono`},{default:F(()=>[K(M(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),G(P(Jj),{class:`w-[55%] max-w-0`},{default:F(()=>[W(`span`,{class:`block truncate`,title:f(e).truncated?f(e).full:void 0},M(f(e).text),9,fM)]),_:2},1024),G(P(Jj),null,{default:F(()=>[K(M(p(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(V(!0),H(B,{key:0},R(e.events,(t,n)=>(V(),U(tM,{key:`${e.key}:${n}`,ev Line truncated
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function NN(e,t){if(!e.event_type)return{label:`Unidentified`,identified:!1};let n=t.find(t=>t.id===e.event_type);return{label:n?n.name:`Deleted type`,identified:!0}}function PN(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function FN(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function IN(e){return{headers:(e.headers||[]).filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:e.value})),payload:(e.payload||[]).filter(e=>e.path.trim()!==``).map(e=>e.op===`present`?{path:e.path.trim(),op:e.op}:{path:e.path.trim(),op:e.op,value:e.value??``})}}var LN=N([]),RN=N([]),zN=N(!0),BN=N(null),VN=N(null),HN=N(!1),UN=N(null);async function WN(){try{let e=await Z.eventTypes();zN.value=e.enabled!==!1,LN.value=e.event_types||[],RN.value=e.proposals||[],BN.value=null}catch(e){BN.value=e.message||String(e)}}function GN(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function KN(e){UN.value=null,VN.value=e}function qN(e){let t=tP.value.find(t=>String(t.id)===e.sample_id);KN({mode:`proposal`,id:null,source:e.source,name:``,rule:GN(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function JN(e=``){KN({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function YN(e){KN({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:GN(e.rule),headersText:``,body:``,exampleHeaders:{}})}function XN(){VN.value=null}async function ZN(){let e=VN.value;if(e){HN.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:IN(e.rule)});else{let t=e.mode===`paste`?MN(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:IN(e.rule),example:{headers:t,body:e.body}})}VN.value=null,await WN()}catch(e){UN.value=e.message||String(e)}finally{HN.value=!1}}}var QN=N(null);async function $N(){let e=QN.value;if(QN.value=null,e)try{await Z.eventTypeDelete(e.id),await WN()}catch(e){BN.value=e.message||String(e)}}var eP=100,tP=N([]),nP=N(!0),rP=N(null),iP=N(!0),aP=N(null);async function oP(){try{let e=await Z.captures(eP);nP.value=e.enabled!==!1,tP.value=e.captures||[],rP.value=null}catch(e){rP.value=e.message||String(e)}finally{iP.value=!1}}function sP(e){let t=tP.value.find(t=>t.id===e);return t&&(aP.value=t),!!t}function cP(){tP.value.length&&(aP.value=tP.value[0])}function lP(){Ik(`captures`,()=>{oP(),WN()})}var uP=`archie.theme`,dP=`archie.density`,fP=`archie.motion`,pP=`archie.tooltips`;function mP(e,t,n){try{let r=localStorage.getItem(e);return t.includes(r)?r:n}catch{return n}}function hP(e,t){try{localStorage.setItem(e,t)}catch{}}function gP(e){if(e!==`system`)return e;try{return matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}catch{return`dark`}}var _P=zu(`appearance`,()=>{let e=N(mP(uP,[`system`,`dark`,`light`],`dark`)),t=N(mP(dP,[`comfortable`,`compact`],`comfortable`)),n=N(mP(fP,[`system`,`reduced`],`system`)),r=N(mP(pP,[`on`,`off`],`on`)===`on`),i=!1;function a(){document.documentElement.dataset.theme=gP(e.value)}function o(t){e.value=t,a(),hP(uP,t)}function s(e){t.value=e,document.documentElement.dataset.density=e,hP(dP,e)}function c(e){n.value=e,document.documentElement.dataset.motion=e,hP(fP,e)}function l(e){r.value=e,hP(pP,e?`on`:`off`)}function u(){if(!i){i=!0,a(),document.documentElement.dataset.density=t.value,document.documentElement.dataset.motion=n.value;try{matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>{e.value===`system`&&a()})}catch{}}}return{theme:e,density:t,motion:n,tooltipsEnabled:r,initialize:u,setTheme:o,setDensity:s,setMotion:c,setTooltips:l}}),vP=L({__name:`Tooltip`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=hg(n,t),{tooltipsEnabled:i}=Bu(_P());return(e,t)=>(V(),U(P(BC),J({"data-slot":`tooltip`},P(r),{disabled:n.disabled||!P(i)}),{default:F(t=>[z(e.$slots,`default`,ve(ps(t)))]),_:3},16,[`disabled`]))}}),yP=L({inheritAttrs:!1,__name:`TooltipContent`,props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:0},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=hg(ow(n,`class`),r);return(e,t)=>(V(),U(P(WC),null,{default:F( Line truncated
`)}};Xq.defaultYaml={explicit:!1,version:`1.2`},Xq.defaultTags={"!!":`tag:yaml.org,2002:`};function Zq(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Qq(e){let t=new Set;return Uq(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function $q(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function eJ(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=Qq(e);let a=$q(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(Fq(t.node)||Lq(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function tJ(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=tJ(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=tJ(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=tJ(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=tJ(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function nJ(e,t,n){if(Array.isArray(e))return e.map((e,t)=>nJ(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!zq(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var rJ=class{constructor(e){Object.defineProperty(this,Aq,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Mq(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=nJ(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?tJ(i,{"":o},``,o):o}},iJ=class extends rJ{constructor(e){super(wq),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Uq(e,{Node:(e,t)=>{(jq(t)||zq(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(nJ(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=aJ(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Zq(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function aJ(e,t,n){if(jq(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Lq(t)){let r=0;for(let i of t.items){let t=aJ(e,i,n);t>r&&(r=t)}return r}if(Pq(t)){let r=aJ(e,t.key,n),i=aJ(e,t.value,n);return Math.max(r,i)}return 1}var oJ=e=>!e||typeof e!=`function`&&typeof e!=`object`,sJ=class extends rJ{constructor(e){super(Oq),this.value=e}toJSON(e,t){return t?.keep?this.value:nJ(this.value,e,t)}toString(){return String(this.value)}};sJ.BLOCK_FOLDED=`BLOCK_FOLDED`,sJ.BLOCK_LITERAL=`BLOCK_LITERAL`,sJ.PLAIN=`PLAIN`,sJ.QUOTE_DOUBLE=`QUOTE_DOUBLE`,sJ.QUOTE_SINGLE=`QUOTE_SINGLE`;var cJ=`tag:yaml.org,2002:`;function lJ(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function uJ(e,t,n){if(Mq(e)&&(e=e.contents),Rq(e))return e;if(Pq(e)){let t=n.schema[Eq].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new iJ(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=cJ+t.slice(2));let l=lJ(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new sJ(e);return c&&(c.node=t),t Line truncated
`)?hJ(n,t):n.includes(`
Defaulting to \`null\`.`),null)}function TS(e){return CS(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${bS}\`.`),bS)}var ES=L({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:bS},getValueLabel:{type:Function,required:!1,default:(e,t)=>CS(e)?`${Math.round(e/t*bS)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;Q();let i=wh(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=wh(n,`max`,r,{passive:n.max===void 0});I(()=>i.value,async e=>{let t=wS(e,n.max);t!==e&&(await Kn(),i.value=t)},{immediate:!0}),I(()=>n.max,e=>{let t=TS(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=Y(()=>Vm(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return SS({modelValue:i,max:a,progressState:o}),(e,t)=>(V(),U(P(kg),{"as-child":e.asChild,as:e.as,"aria-valuemax":P(a),"aria-valuemin":0,"aria-valuenow":CS(P(i))?P(i):void 0,"aria-valuetext":e.getValueText?.(P(i),P(a)),"aria-label":e.getValueLabel(P(i),P(a)),role:`progressbar`,"data-state":o.value,"data-value":P(i)??void 0,"data-max":P(a)},{default:F(()=>[z(e.$slots,`default`,{modelValue:P(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),DS=L({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=xS();return Q(),(e,r)=>(V(),U(P(kg),J(t,{"data-state":P(n).progressState.value,"data-value":P(n).modelValue?.value??void 0,"data-max":P(n).max.value}),{default:F(()=>[z(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),OS=`radio.select`;function kS(e,t,n){Bm(OS,n,{originalEvent:e,value:t})}var AS=L({inheritAttrs:!1,__name:`Radio`,props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:checked`,`select`],setup(e,{emit:t}){let n=e,r=t,i=wh(n,`checked`,r,{passive:n.checked===void 0}),{value:a}=_n(n),{forwardRef:o,currentElement:s}=Q(),c=Jh(s),l=Zh(),u=Y(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);function d(e){n.disabled||kS(e,n.value,e=>{r(`select`,e),!e?.defaultPrevented&&(i.value=!0,c.value&&e.stopPropagation())})}return(e,t)=>(V(),H(B,null,[G(P(kg),J({id:e.id,ref:P(o),role:`radio`,type:e.as===`button`?`button`:void 0,as:e.as,"aria-checked":P(i)??!1,"aria-label":u.value,"as-child":e.asChild,disabled:e.disabled?``:void 0,"data-state":P(i)?`checked`:`unchecked`,"data-disabled":e.disabled?``:void 0,value:P(a),required:e.required,name:e.name},{...P(l),...e.$attrs},{onClick:Bl(d,[`stop`])}),{default:F(()=>[z(e.$slots,`default`,{checked:P(i)})]),_:3},16,[`id`,`type`,`as`,`aria-checked`,`aria-label`,`as-child`,`disabled`,`data-state`,`data-disabled`,`value`,`required`,`name`]),P(c)&&e.name?(V(),U(P(iv),J({key:0,type:`radio`,tabindex:`-1`,value:P(a),checked:!!P(i),name:e.name,disabled:e.disabled,required:e.required},P(l)),null,16,[`value`,`checked`,`name`,`disabled`,`required`])):q(`v-if`,!0)],64))}}),[jS,MS]=Rm(`RadioGroupRoot`),NS=L({__name:`RadioGroupRoot`,props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Q(),o=wh(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:c,orientation:l,name:u,required:d,dir:f}=_n(n),p=Uh(f),m=Jh(a);return MS({modelValue:o,changeModelValue:e=>{o.value=e},disabled:s,loop:c,orientation:l,name:u?.value,required:d}),(e,t)=>(V(),U(P(Bb),{"as-child":``,orientation:P(l),dir:P(p),loop:P(c)},{default:F(()=>[G(P(kg),{ref:P(i),role:`radiogroup`,"data-disabled":P(s)?``:void 0,"as-child":e.asChild,as:e.as,"aria-orientation":P(l),"aria-required":P(d),dir:P(p)},{default:F(()=>[z(e.$slots,`default`,{modelValue:P(o)}),P(m)&&P(u)?(V(),U(P(iv),{key:0,required:P(d),disabled:P(s),value:P(o),name:P(u)},null,8,[`required`,`disabled`,`value`,`name`])):q(`v-if`,!0)]),_:3},8,[`data-disabled`,`as-child`,`as`,`aria-orientation`,`aria-required`,`dir`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),[Iee,PS]=Rm(`RadioGroupItem`),FS=L({inheritAttrs:!1,__name:`RadioGroupItem`,props:{id:{type:String,required:!1},value:{type:nuLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:kE(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>kE(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=jE(c),u=e+1<n.length?jE(n[e+1]):null;if(l&&u&&ME(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=jE(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>kE(e)),rows:r.map(e=>e.map(e=>kE(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:kE(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1]);continue}if(c.startsWith(`>`)){o(),s(),t.push({kind:`blockquote`,inline:kE(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function jE(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function ME(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var NE={class:`[overflow-wrap:anywhere]`},PE={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},FE={class:`font-mono text-[0.85em]`},IE={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},LE={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},RE={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},zE={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},BE={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},VE={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},HE={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},UE={key:8,class:`mb-2.5 last:mb-0`},WE=L({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=Y(()=>AE(t.text));return(e,t)=>(V(),H(`div`,NE,[(V(!0),H(B,null,R(n.value,(e,t)=>(V(),H(B,{key:t},[e.kind===`pre`?(V(),H(`pre`,PE,[W(`code`,FE,M(e.code),1)])):e.kind===`table`?(V(),H(`table`,IE,[W(`thead`,null,[W(`tr`,null,[(V(!0),H(B,null,R(e.head,(e,t)=>(V(),H(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[G(DE,{inline:e},null,8,[`inline`])]))),128))])]),W(`tbody`,null,[(V(!0),H(B,null,R(e.rows,(e,t)=>(V(),H(`tr`,{key:t},[(V(!0),H(B,null,R(e,(e,t)=>(V(),H(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[G(DE,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(V(),H(`blockquote`,LE,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(V(),H(`h1`,RE,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(V(),H(`h2`,zE,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(V(),H(`h3`,BE,[G(DE,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(V(),H(`ul`,VE,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(DE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(V(),H(`ol`,HE,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(DE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(V(),H(`p`,UE,[G(DE,{inline:e.inline},null,8,[`inline`])])):q(``,!0)],64))),128))]))}}),GE={class:`truncate`},KE=L({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Qi(`RouterLink`);return V(),U(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:F(()=>[G(P(Xu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),W(`span`,GE,M(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),qE={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},JE={class:`font-semibold text-foreground`},YE={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},XE=L({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=Y(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=Y(()=>t.tool.parameters||t.tool.Parameters||``),i=Y(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=Y(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(V(),U(KE,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(V(),H(`div`,qE,[G(P(Zd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),W(`span`,JE,M(n.value),1),r.value?(V(),H(`code`,YE,M(r.value),1)):q(``,!0),W(`span`,{class:j(P(X)(`text-fg-muted`,i.value&&`text-danger`))},M(a.value),3)]))}}),Ree={key:0,class:`mb-2 grid gap-0.5 text-xs`},zee={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Bee={key:3,class:`whitespace-pre-wrap`},ZE=L({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(V(),H(`div`,{class:j([`flex`,e.assistant?`justify-start`:`justify-end`])},[W(`div`,{class:j(P(X)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(V(),H(`div`,Ree,[(V(!0),H(B,null,R(e.tools,(t,n)=>(V(),U(XE,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):q(``,!0),e.media.length?(V(),H(`div`,zee,[(V(!0),H(B,null,R(e.media,(e,t)=>(V(),U(bE,{key:t,attachment:e},null,8,[`attachment`]))),128))])):q(``,!0),e.assistant?(V(),U(WE,{key:2,text:e.text},null,8,[`text`])):(V(),H(`div`,Bee,M(e.text),1)),z(t.$slots,`default`)],2)],2))}}),Vee={class:`w-full self-center justify-self-center py-6 text-center`},Hee={class:`grid gap-2`},Uee=[`onClick`],Wee=L({__name:`ChatEmptyState`,e Line truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>Yj?`${n.slice(0,Yj).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var Zj=[`title`],Qj=L({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>xj(n.event)),a=Y(()=>Xj(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=Y(()=>n.event.at?kA(n.event.at):`—`);return(e,t)=>(V(),U(P(Kj),{class:j(i.value>0?`cursor-pointer`:``),role:i.value>0?`link`:void 0,tabindex:i.value>0?0:void 0,title:i.value>0?`Open task details`:void 0,onClick:o,onKeydown:[Hl(Bl(o,[`prevent`]),[`enter`]),Hl(Bl(o,[`prevent`]),[`space`])]},{default:F(()=>[G(P(Gj),{class:`font-medium`},{default:F(()=>[K(M(n.event.kind||n.event.type||`event`),1)]),_:1}),G(P(Gj),{class:`font-mono`},{default:F(()=>[K(M(i.value>0?`#${i.value}`:`—`),1)]),_:1}),G(P(Gj),{class:`w-[55%] max-w-0`},{default:F(()=>[W(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},M(a.value.text),9,Zj)]),_:1}),G(P(Gj),null,{default:F(()=>[K(M(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),$j=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function eM(e){return(Number(e?.task_id)||0)>0}function tM(e,t){return t===`tasks`?eM(e):t!==`system`||!eM(e)}function nM(e,t){return e.filter(e=>tM(e,t))}function rM(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function iM(e,t){return`${e}:${t??0}`}function aM(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=iM(Xj(n).text,r),a=t[t.length-1];if(a&&a.key===i){a.count+=1,a.events.push(n);continue}t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var oM={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},sM={class:`max-h-[28rem] overflow-y-auto`},cM=[`aria-expanded`,`aria-label`,`onClick`],lM=[`title`],uM=L({__name:`LiveActivityCard`,setup(e){let t=fD(),{activity:n,streamKind:r,streamState:i}=Fu(Mk()),a=N(`all`),o=Y(()=>nM(n.value,a.value)),s=Y(()=>rM(o.value.length,a.value)),c=qt(new Set),l=Y(()=>aM(o.value));function u(e){c.has(e)?c.delete(e):c.add(e)}function d(e){return c.has(e.key)}function f(e){return Xj(e.representative)}function p(e){return e.representative.at?kA(e.representative.at):`—`}function m(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(V(),U(P(SA),null,{default:F(()=>[G(P(DA),null,{default:F(()=>[G(P(OA),null,{default:F(()=>[...t[1]||=[K(`Live activity`,-1)]]),_:1}),G(P(CA),{class:`flex items-center gap-2`},{default:F(()=>[G(P(Vj),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:P($j)},null,8,[`modelValue`,`options`]),G(P(yA),{variant:P(r)},{default:F(()=>[K(M(P(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),G(P(wA),null,{default:F(()=>[W(`div`,oM,[W(`div`,sM,[G(P(Uj),null,{default:F(()=>[G(P(Jj),{class:`sticky top-0 z-10 bg-card`},{default:F(()=>[G(P(Kj),null,{default:F(()=>[G(P(qj),null,{default:F(()=>[...t[2]||=[K(`Event`,-1)]]),_:1}),G(P(qj),null,{default:F(()=>[...t[3]||=[K(`Task`,-1)]]),_:1}),G(P(qj),null,{default:F(()=>[...t[4]||=[K(`Detail`,-1)]]),_:1}),G(P(qj),null,{default:F(()=>[...t[5]||=[K(`When`,-1)]]),_:1})]),_:1})]),_:1}),G(P(Wj),null,{default:F(()=>[o.value.length?q(``,!0):(V(),U(P(Kj),{key:0},{default:F(()=>[G(P(Gj),{colspan:`4`},{default:F(()=>[G(P(dA),null,{default:F(()=>[G(P(mA),null,{default:F(()=>[G(P(_A),null,{default:F(()=>[K(M(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(V(!0),H(B,{key:1},R(l.value,e=>(V(),H(B,{key:e.key},[e.count===1?(V(),U(Qj,{key:0,event:e.representative,onOpen:m},null,8,[`event`])):(V(),H(B,{key:1},[G(P(Kj),{class:j(e.taskID>0?`cursor-pointer`:``),role:e.taskID>0?`link`:void 0,tabindex:e.taskID>0?0:void 0,title:e.taskID>0?`Open task details`:void 0,onClick:t=>e.taskID>0&&m(e.taskID),onKeydown:[Hl(Bl(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),Hl(Bl(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`space`])]},{default:F(()=>[G(P(Gj),{class:`font-medium`},{default:F(()=>[W(`button`,{type:`button`,class:`inline-flex items-center gap-1 rounded hover:opacity-80`,"aria-expanded":d(e),"aria-label":`${d(e)?`Hide`:`Show`} ${e.count} ${e.label} events`,onClick:Bl(t=>u(e.key),[`stop`])},[d(e)?(V(),U(P(rd),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(V(),U(P(id),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),K(` `+M(e.label)+` `,1),G(P(yA),{variant:`idle`},{default:F(()=>[K(`×`+M(e.count),1)]),_:2},1024)],8,cM)]),_:2},1024),G(P(Gj),{class:`font-mono`},{default:F(()=>[K(M(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),G(P(Gj),{class:`w-[55%] max-w-0`},{default:F(()=>[W(`span`,{class:`block truncate`,title:f(e).truncated?f(e).full:void 0},M(f(e).text),9,lM)]),_:2},1024),G(P(Gj),null,{default:F(()=>[K(M(p(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(V(!0),H(B,{key:0},R(e.events,(t,n)=>(V(),U(Qj,{key:`${e.key}:${n}`,ev Line truncated
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function AN(e,t){if(!e.event_type)return{label:`Unidentified`,identified:!1};let n=t.find(t=>t.id===e.event_type);return{label:n?n.name:`Deleted type`,identified:!0}}function jN(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function MN(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function NN(e){return{headers:(e.headers||[]).filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:e.value})),payload:(e.payload||[]).filter(e=>e.path.trim()!==``).map(e=>e.op===`present`?{path:e.path.trim(),op:e.op}:{path:e.path.trim(),op:e.op,value:e.value??``})}}var PN=N([]),FN=N([]),IN=N(!0),LN=N(null),RN=N(null),zN=N(!1),BN=N(null);async function VN(){try{let e=await Z.eventTypes();IN.value=e.enabled!==!1,PN.value=e.event_types||[],FN.value=e.proposals||[],LN.value=null}catch(e){LN.value=e.message||String(e)}}function HN(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function UN(e){BN.value=null,RN.value=e}function WN(e){let t=QN.value.find(t=>String(t.id)===e.sample_id);UN({mode:`proposal`,id:null,source:e.source,name:``,rule:HN(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function GN(e=``){UN({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function KN(e){UN({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:HN(e.rule),headersText:``,body:``,exampleHeaders:{}})}function qN(){RN.value=null}async function JN(){let e=RN.value;if(e){zN.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:NN(e.rule)});else{let t=e.mode===`paste`?kN(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:NN(e.rule),example:{headers:t,body:e.body}})}RN.value=null,await VN()}catch(e){BN.value=e.message||String(e)}finally{zN.value=!1}}}var YN=N(null);async function XN(){let e=YN.value;if(YN.value=null,e)try{await Z.eventTypeDelete(e.id),await VN()}catch(e){LN.value=e.message||String(e)}}var ZN=100,QN=N([]),$N=N(!0),eP=N(null),tP=N(!0),nP=N(null);async function rP(){try{let e=await Z.captures(ZN);$N.value=e.enabled!==!1,QN.value=e.captures||[],eP.value=null}catch(e){eP.value=e.message||String(e)}finally{tP.value=!1}}function iP(e){let t=QN.value.find(t=>t.id===e);return t&&(nP.value=t),!!t}function aP(){QN.value.length&&(nP.value=QN.value[0])}function oP(){Nk(`captures`,()=>{rP(),VN()})}var sP=`archie.theme`,cP=`archie.density`,lP=`archie.motion`,uP=`archie.tooltips`;function dP(e,t,n){try{let r=localStorage.getItem(e);return t.includes(r)?r:n}catch{return n}}function fP(e,t){try{localStorage.setItem(e,t)}catch{}}function pP(e){if(e!==`system`)return e;try{return matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}catch{return`dark`}}var mP=Pu(`appearance`,()=>{let e=N(dP(sP,[`system`,`dark`,`light`],`dark`)),t=N(dP(cP,[`comfortable`,`compact`],`comfortable`)),n=N(dP(lP,[`system`,`reduced`],`system`)),r=N(dP(uP,[`on`,`off`],`on`)===`on`),i=!1;function a(){document.documentElement.dataset.theme=pP(e.value)}function o(t){e.value=t,a(),fP(sP,t)}function s(e){t.value=e,document.documentElement.dataset.density=e,fP(cP,e)}function c(e){n.value=e,document.documentElement.dataset.motion=e,fP(lP,e)}function l(e){r.value=e,fP(uP,e?`on`:`off`)}function u(){if(!i){i=!0,a(),document.documentElement.dataset.density=t.value,document.documentElement.dataset.motion=n.value;try{matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>{e.value===`system`&&a()})}catch{}}}return{theme:e,density:t,motion:n,tooltipsEnabled:r,initialize:u,setTheme:o,setDensity:s,setMotion:c,setTooltips:l}}),hP=L({__name:`Tooltip`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=Xh(n,t),{tooltipsEnabled:i}=Fu(mP());return(e,t)=>(V(),U(P(ZC),J({"data-slot":`tooltip`},P(r),{disabled:n.disabled||!P(i)}),{default:F(t=>[z(e.$slots,`default`,ve(cs(t)))]),_:3},16,[`disabled`]))}}),gP=L({inheritAttrs:!1,__name:`TooltipContent`,props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:0},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=Xh(_w(n,`class`),r);return(e,t)=>(V(),U(P(tw),null,{default:F( Line truncated
`)}};Yq.defaultYaml={explicit:!1,version:`1.2`},Yq.defaultTags={"!!":`tag:yaml.org,2002:`};function Xq(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Zq(e){let t=new Set;return Hq(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function Qq(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function $q(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=Zq(e);let a=Qq(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(Pq(t.node)||Iq(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function eJ(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=eJ(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=eJ(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=eJ(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=eJ(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function tJ(e,t,n){if(Array.isArray(e))return e.map((e,t)=>tJ(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Rq(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var nJ=class{constructor(e){Object.defineProperty(this,kq,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!jq(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=tJ(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?eJ(i,{"":o},``,o):o}},rJ=class extends nJ{constructor(e){super(Cq),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Hq(e,{Node:(e,t)=>{(Aq(t)||Rq(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(tJ(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=iJ(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Xq(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function iJ(e,t,n){if(Aq(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Iq(t)){let r=0;for(let i of t.items){let t=iJ(e,i,n);t>r&&(r=t)}return r}if(Nq(t)){let r=iJ(e,t.key,n),i=iJ(e,t.value,n);return Math.max(r,i)}return 1}var aJ=e=>!e||typeof e!=`function`&&typeof e!=`object`,oJ=class extends nJ{constructor(e){super(Dq),this.value=e}toJSON(e,t){return t?.keep?this.value:tJ(this.value,e,t)}toString(){return String(this.value)}};oJ.BLOCK_FOLDED=`BLOCK_FOLDED`,oJ.BLOCK_LITERAL=`BLOCK_LITERAL`,oJ.PLAIN=`PLAIN`,oJ.QUOTE_DOUBLE=`QUOTE_DOUBLE`,oJ.QUOTE_SINGLE=`QUOTE_SINGLE`;var sJ=`tag:yaml.org,2002:`;function cJ(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function lJ(e,t,n){if(jq(e)&&(e=e.contents),Lq(e))return e;if(Nq(e)){let t=n.schema[Tq].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new rJ(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=sJ+t.slice(2));let l=cJ(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new oJ(e);return c&&(c.node=t),t Line truncated
`)?mJ(n,t):n.includes(`
`)?`
`+hJ(n,t):(e.endsWith(` `)?``:` `)+n,_J=`flow`,vJ=`block`,yJ=`quoted`;function bJ(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=xJ(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
`)n===`block`&&(h=xJ(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`+mJ(n,t):(e.endsWith(` `)?``:` `)+n,gJ=`flow`,_J=`block`,vJ=`quoted`;function yJ(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=bJ(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
`)n===`block`&&(h=bJ(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function xJ(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
`);r=t,i=t+1,a=e[i]}return r}var SJ=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),CJ=e=>/^(%|---|\.\.\.)/m.test(e);function wJ(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function TJ(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(CJ(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){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:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function bJ(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
`);r=t,i=t+1,a=e[i]}return r}var xJ=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),SJ=e=>/^(%|---|\.\.\.)/m.test(e);function CJ(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function wJ(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(SJ(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){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:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:bJ(o,a,yJ,SJ(t,!1))}function EJ(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return TJ(e,t);let n=t.indent||(CJ(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:bJ(r,n,_J,SJ(t,!1))}function DJ(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=TJ;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?EJ:i&&!t?TJ:n?EJ:TJ}return r(e,t)}var OJ;try{OJ=RegExp(`(^|(?<!
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:yJ(o,a,vJ,xJ(t,!1))}function TJ(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return wJ(e,t);let n=t.indent||(SJ(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:yJ(r,n,gJ,xJ(t,!1))}function EJ(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=wJ;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?TJ:i&&!t?wJ:n?TJ:wJ}return r(e,t)}var DJ;try{DJ=RegExp(`(^|(?<!
))
+(?!
|$)`,`g`)}catch{OJ=/\n+(?!\n|$)/g}function kJ({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return DJ(n,r);let l=r.indent||(r.forceBlockIndent||CJ(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===sJ.BLOCK_FOLDED?!1:t===sJ.BLOCK_LITERAL||!wJ(n,c,l.length);if(!n)return u?`|
|$)`,`g`)}catch{DJ=/\n+(?!\n|$)/g}function OJ({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return EJ(n,r);let l=r.indent||(r.forceBlockIndent||SJ(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===oJ.BLOCK_FOLDED?!1:t===oJ.BLOCK_LITERAL||!CJ(n,c,l.length);if(!n)return u?`|
`:`>
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
`&&(p=p.slice(0,-1)),p.replace(OJ,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
`&&(p=p.slice(0,-1)),p.replace(DJ,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=SJ(r,!0);o!==`folded`&&t!==sJ.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=bJ(`${v}${e}${p}`,l,vJ,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function AJ(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
`)||u&&/[[\]{},]/.test(a))return DJ(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?DJ(a,t):kJ(e,t,n,r);if(!s&&!u&&i!==sJ.PLAIN&&a.includes(`
`))return kJ(e,t,n,r);if(CJ(a)){if(c===``)return t.forceBlockIndent=!0,kJ(e,t,n,r);if(s&&c===l)return DJ(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return DJ(a,t)}return s?d:bJ(d,c,_J,SJ(t,!1))}function jJ(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==sJ.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=sJ.QUOTE_DOUBLE);let c=e=>{switch(e){case sJ.BLOCK_FOLDED:case sJ.BLOCK_LITERAL:return i||a?DJ(o.value,t):kJ(o,t,n,r);case sJ.QUOTE_DOUBLE:return TJ(o.value,t);case sJ.QUOTE_SINGLE:return EJ(o.value,t);case sJ.PLAIN:return AJ(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function MJ(e,t){let n=Object.assign({blockQuote:!0,commentString:mJ,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},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function NJ(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(Fq(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function PJ(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Fq(e)||Lq(e))&&e.anchor;a&&Zq(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function FJ(e,t,n,r){if(Pq(e))return e.toString(t,n,r);if(jq(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=Rq(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=NJ(t.doc.schema.tags,a);let o=PJ(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):Fq(a)?jJ(a,t,n,r):a.toString(t,n,r);return o?Fq(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function IJ({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=Rq(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Lq(e)||!Rq(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Lq(e)||(Fq(e)?e.type===sJ.BLOCK_FOLDED||e.type===sJ.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=FJ(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=gJ(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=gJ(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=gJ(g,n.indent,l(f))));let _,v,y;Rq(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&Fq(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Iq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=FJ(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${hJ(e,n.indent)}`}x===``&&!n.inFlow?S===`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=xJ(r,!0);o!==`folded`&&t!==oJ.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=yJ(`${v}${e}${p}`,l,_J,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function kJ(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
`)||u&&/[[\]{},]/.test(a))return EJ(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?EJ(a,t):OJ(e,t,n,r);if(!s&&!u&&i!==oJ.PLAIN&&a.includes(`
`))return OJ(e,t,n,r);if(SJ(a)){if(c===``)return t.forceBlockIndent=!0,OJ(e,t,n,r);if(s&&c===l)return EJ(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return EJ(a,t)}return s?d:yJ(d,c,gJ,xJ(t,!1))}function AJ(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==oJ.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=oJ.QUOTE_DOUBLE);let c=e=>{switch(e){case oJ.BLOCK_FOLDED:case oJ.BLOCK_LITERAL:return i||a?EJ(o.value,t):OJ(o,t,n,r);case oJ.QUOTE_DOUBLE:return wJ(o.value,t);case oJ.QUOTE_SINGLE:return TJ(o.value,t);case oJ.PLAIN:return kJ(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function jJ(e,t){let n=Object.assign({blockQuote:!0,commentString:pJ,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},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function MJ(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(Pq(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function NJ(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Pq(e)||Iq(e))&&e.anchor;a&&Xq(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function PJ(e,t,n,r){if(Nq(e))return e.toString(t,n,r);if(Aq(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=Lq(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=MJ(t.doc.schema.tags,a);let o=NJ(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):Pq(a)?AJ(a,t,n,r):a.toString(t,n,r);return o?Pq(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function FJ({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=Lq(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Iq(e)||!Lq(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Iq(e)||(Pq(e)?e.type===oJ.BLOCK_FOLDED||e.type===oJ.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=PJ(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=hJ(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=hJ(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=hJ(g,n.indent,l(f))));let _,v,y;Lq(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&Pq(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Fq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=PJ(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${mJ(e,n.indent)}`}x===``&&!n.inFlow?S===`
`&&y&&(S=`
`):S+=`\n${n.indent}`}else if(!p&&Lq(t)){let e=x[0],r=x.indexOf(`
`):S+=`\n${n.indent}`}else if(!p&&Iq(t)){let e=x[0],r=x.indexOf(`
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=gJ(g,n.indent,l(y)):h&&i&&i(),g}function LJ(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var RJ=`<<`,zJ={identify:e=>e===RJ||typeof e==`symbol`&&e.description===RJ,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new sJ(Symbol(RJ)),{addToJSMap:VJ}),stringify:()=>RJ},BJ=(e,t)=>(zJ.identify(t)||Fq(t)&&(!t.type||t.type===sJ.PLAIN)&&zJ.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===zJ.tag&&e.default);function VJ(e,t,n){let r=UJ(e,n);if(Iq(r))for(let n of r.items)HJ(e,t,n);else if(Array.isArray(r))for(let n of r)HJ(e,t,n);else HJ(e,t,r)}function HJ(e,t,n){let r=UJ(e,n);if(!Nq(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function UJ(e,t){return e&&jq(t)?t.resolve(e.doc,e):t}function WJ(e,t,{key:n,value:r}){if(Rq(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(BJ(e,n))VJ(e,t,r);else{let i=nJ(n,``,e);if(t instanceof Map)t.set(i,nJ(r,i,e));else if(t instanceof Set)t.add(i);else{let a=GJ(n,i,e),o=nJ(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function GJ(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Rq(e)&&n?.doc){let t=MJ(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),LJ(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function KJ(e,t,n){return new qJ(uJ(e,void 0,n),uJ(t,void 0,n))}var qJ=class e{constructor(e,t=null){Object.defineProperty(this,Aq,{value:Dq}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Rq(n)&&(n=n.clone(t)),Rq(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return WJ(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?IJ(this,e,t,n):JSON.stringify(this)}};function JJ(e,t,n){return(t.inFlow??e.flow?XJ:YJ)(e,t,n)}function YJ({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(Rq(i))!d&&i.spaceBefore&&f.push(``),ZJ(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(Pq(i)){let e=Rq(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),ZJ(n,f,e.commentBefore,d))}d=!1;let s=FJ(i,u,()=>o=null,()=>d=!0);o&&(s+=gJ(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=hJ(g,n.indent,l(y)):h&&i&&i(),g}function IJ(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var LJ=`<<`,RJ={identify:e=>e===LJ||typeof e==`symbol`&&e.description===LJ,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new oJ(Symbol(LJ)),{addToJSMap:BJ}),stringify:()=>LJ},zJ=(e,t)=>(RJ.identify(t)||Pq(t)&&(!t.type||t.type===oJ.PLAIN)&&RJ.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===RJ.tag&&e.default);function BJ(e,t,n){let r=HJ(e,n);if(Fq(r))for(let n of r.items)VJ(e,t,n);else if(Array.isArray(r))for(let n of r)VJ(e,t,n);else VJ(e,t,r)}function VJ(e,t,n){let r=HJ(e,n);if(!Mq(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function HJ(e,t){return e&&Aq(t)?t.resolve(e.doc,e):t}function UJ(e,t,{key:n,value:r}){if(Lq(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(zJ(e,n))BJ(e,t,r);else{let i=tJ(n,``,e);if(t instanceof Map)t.set(i,tJ(r,i,e));else if(t instanceof Set)t.add(i);else{let a=WJ(n,i,e),o=tJ(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function WJ(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Lq(e)&&n?.doc){let t=jJ(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),IJ(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function GJ(e,t,n){return new KJ(lJ(e,void 0,n),lJ(t,void 0,n))}var KJ=class e{constructor(e,t=null){Object.defineProperty(this,kq,{value:Eq}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Lq(n)&&(n=n.clone(t)),Lq(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return UJ(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?FJ(this,e,t,n):JSON.stringify(this)}};function qJ(e,t,n){return(t.inFlow??e.flow?YJ:JJ)(e,t,n)}function JJ({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(Lq(i))!d&&i.spaceBefore&&f.push(``),XJ(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(Nq(i)){let e=Lq(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),XJ(n,f,e.commentBefore,d))}d=!1;let s=PJ(i,u,()=>o=null,()=>d=!0);o&&(s+=hJ(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
`}}return e?(p+=`
`+hJ(l(e),c),s&&s()):d&&o&&o(),p}function XJ({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(Rq(i))i.spaceBefore&&d.push(``),ZJ(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(Pq(i)){let e=Rq(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),ZJ(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Rq(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=FJ(i,c,()=>a=null);l||=d.length>u||o.includes(`
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=gJ(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function ZJ({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=hJ(t(r),e);n.push(i.trimStart())}}function QJ(e,t){let n=Fq(t)?t.value:t;for(let r of e)if(Pq(r)&&(r.key===t||r.key===n||Fq(r.key)&&r.key.value===n))return r}var $J=class extends pJ{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Eq,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(KJ(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=Pq(e)?e:!e||typeof e!=`object`||!(`key`in e)?new qJ(e,e?.value):new qJ(e.key,e.value);let r=QJ(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Fq(r.value)&&oJ(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=QJ(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=QJ(this.items,e)?.value;return(!t&&Fq(n)?n.value:n)??void 0}has(e){return!!QJ(this.items,e)}set(e,t){this.add(new qJ(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)WJ(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!Pq(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),JJ(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},eY={collection:`map`,default:!0,nodeClass:$J,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Nq(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>$J.from(e,t,n)},tY=class extends pJ{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(kq,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=nY(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=nY(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Fq(r)?r.value:r}has(e){let t=nY(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=nY(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Fq(r)&&oJ(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(nJ(e,String(r++),t));return n}toString(e,t,n){return e?JJ(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(uJ(a,void 0,n))}}return i}};function nY(e){let t=Fq(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var rY={collection:`seq`,default:!0,nodeClass:tY,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Iq(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>tY.from(e,t,n)},iY={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),jJ(e,t,n,r)}},aY={identify:e=>e==null,createNode:()=>new sJ(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new sJ(null),stringify:({source:e},t)=>typeof e==`string`&&aY.test.test(e)?e:t.options.nullStr},oY={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new sJ(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&oY.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function sY({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var cY={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:sY},lY={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),string Line truncated
`:` `)}return jJ({comment:e,type:t,value:s},r,i,a)}};function CY(e,t){if(Iq(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Pq(r)){if(Nq(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new qJ(new sJ(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=Pq(r)?r:new qJ(r)}}else t(`Expected a sequence for this tag`);return e}function wY(e,t,n){let{replacer:r}=n,i=new tY(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(KJ(o,s,n))}return i}var TY={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:CY,createNode:wY},EY=class e extends tY{constructor(){super(),this.add=$J.prototype.add.bind(this),this.delete=$J.prototype.delete.bind(this),this.get=$J.prototype.get.bind(this),this.has=$J.prototype.has.bind(this),this.set=$J.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(Pq(e)?(r=nJ(e.key,``,t),i=nJ(e.value,r,t)):r=nJ(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=wY(e,t,n),i=new this;return i.items=r.items,i}};EY.tag=`tag:yaml.org,2002:omap`;var DY={collection:`seq`,identify:e=>e instanceof Map,nodeClass:EY,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=CY(e,t),r=[];for(let{key:e}of n.items)Fq(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new EY,n)},createNode:(e,t,n)=>EY.from(e,t,n)};function OY({value:e,source:t},n){return t&&(e?kY:AY).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var kY={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new sJ(!0),stringify:OY},AY={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new sJ(!1),stringify:OY},jY={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:sY},MY={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():sY(e)}},NY={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new sJ(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:sY},PY=e=>typeof e==`bigint`||Number.isInteger(e);function FY(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function IY(e,t,n){let{value:r}=e;if(PY(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return sY(e)}var LY={identify:PY,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>FY(e,2,2,n),stringify:e=>IY(e,2,`0b`)},RY={identify:PY,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>FY(e,1,8,n),stringify:e=>IY(e,8,`0`)},zY={identify:PY,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>FY(e,0,10,n),stringify:sY},BY={identify:PY,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>FY(e,2,16,n),stringify:e=>IY(e,16,`0x`)},VY=class e extends $J{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=Pq(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new qJ(e.key,null):new qJ(e,null),QJ(this.items,t.key)||this.items.push(t)}get(e,t){let n=QJ(this.items,e);return!t&&Pq(n)?Fq(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=QJ(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new qJ(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 s Line truncated
`)?(n.push(`...`),n.push(hJ(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(hJ(a(t),``)))}return n.join(`
`+mJ(l(e),c),s&&s()):d&&o&&o(),p}function YJ({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(Lq(i))i.spaceBefore&&d.push(``),XJ(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(Nq(i)){let e=Lq(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),XJ(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Lq(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=PJ(i,c,()=>a=null);l||=d.length>u||o.includes(`
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=hJ(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function XJ({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=mJ(t(r),e);n.push(i.trimStart())}}function ZJ(e,t){let n=Pq(t)?t.value:t;for(let r of e)if(Nq(r)&&(r.key===t||r.key===n||Pq(r.key)&&r.key.value===n))return r}var QJ=class extends fJ{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Tq,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(GJ(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=Nq(e)?e:!e||typeof e!=`object`||!(`key`in e)?new KJ(e,e?.value):new KJ(e.key,e.value);let r=ZJ(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Pq(r.value)&&aJ(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=ZJ(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=ZJ(this.items,e)?.value;return(!t&&Pq(n)?n.value:n)??void 0}has(e){return!!ZJ(this.items,e)}set(e,t){this.add(new KJ(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)UJ(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!Nq(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),qJ(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},$J={collection:`map`,default:!0,nodeClass:QJ,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Mq(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>QJ.from(e,t,n)},eY=class extends fJ{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Oq,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=tY(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=tY(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Pq(r)?r.value:r}has(e){let t=tY(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=tY(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Pq(r)&&aJ(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(tJ(e,String(r++),t));return n}toString(e,t,n){return e?qJ(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(lJ(a,void 0,n))}}return i}};function tY(e){let t=Pq(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var nY={collection:`seq`,default:!0,nodeClass:eY,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Fq(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>eY.from(e,t,n)},rY={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),AJ(e,t,n,r)}},iY={identify:e=>e==null,createNode:()=>new oJ(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new oJ(null),stringify:({source:e},t)=>typeof e==`string`&&iY.test.test(e)?e:t.options.nullStr},aY={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new oJ(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&aY.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function oY({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var sY={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:oY},cY={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),string Line truncated
`:` `)}return AJ({comment:e,type:t,value:s},r,i,a)}};function SY(e,t){if(Fq(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Nq(r)){if(Mq(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new KJ(new oJ(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=Nq(r)?r:new KJ(r)}}else t(`Expected a sequence for this tag`);return e}function CY(e,t,n){let{replacer:r}=n,i=new eY(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(GJ(o,s,n))}return i}var wY={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:SY,createNode:CY},TY=class e extends eY{constructor(){super(),this.add=QJ.prototype.add.bind(this),this.delete=QJ.prototype.delete.bind(this),this.get=QJ.prototype.get.bind(this),this.has=QJ.prototype.has.bind(this),this.set=QJ.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(Nq(e)?(r=tJ(e.key,``,t),i=tJ(e.value,r,t)):r=tJ(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=CY(e,t,n),i=new this;return i.items=r.items,i}};TY.tag=`tag:yaml.org,2002:omap`;var EY={collection:`seq`,identify:e=>e instanceof Map,nodeClass:TY,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=SY(e,t),r=[];for(let{key:e}of n.items)Pq(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new TY,n)},createNode:(e,t,n)=>TY.from(e,t,n)};function DY({value:e,source:t},n){return t&&(e?OY:kY).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var OY={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new oJ(!0),stringify:DY},kY={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new oJ(!1),stringify:DY},AY={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:oY},jY={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():oY(e)}},MY={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new oJ(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:oY},NY=e=>typeof e==`bigint`||Number.isInteger(e);function PY(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function FY(e,t,n){let{value:r}=e;if(NY(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return oY(e)}var IY={identify:NY,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>PY(e,2,2,n),stringify:e=>FY(e,2,`0b`)},LY={identify:NY,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>PY(e,1,8,n),stringify:e=>FY(e,8,`0`)},RY={identify:NY,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>PY(e,0,10,n),stringify:oY},zY={identify:NY,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>PY(e,2,16,n),stringify:e=>FY(e,16,`0x`)},BY=class e extends QJ{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=Nq(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new KJ(e.key,null):new KJ(e,null),ZJ(this.items,t.key)||this.items.push(t)}get(e,t){let n=ZJ(this.items,e);return!t&&Nq(n)?Pq(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=ZJ(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new KJ(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 s Line truncated
`)?(n.push(`...`),n.push(mJ(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(mJ(a(t),``)))}return n.join(`
`)+`
`}var nX=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Aq,{value:Tq});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Xq({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Aq]:{value:Tq}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Rq(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){rX(this.contents)&&this.contents.add(e)}addIn(e,t){rX(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Qq(this);e.anchor=!t||n.has(t)?$q(t||`a`,n):t}return new iJ(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=eJ(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=uJ(e,l,p);return o&&Lq(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new qJ(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return rX(this.contents)?this.contents.delete(e):!1}deleteIn(e){return fJ(e)?this.contents!=null&&(this.contents=null,!0):rX(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Lq(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return fJ(e)?!t&&Fq(this.contents)?this.contents.value:this.contents:Lq(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Lq(this.contents)?this.contents.has(e):!1}hasIn(e){return fJ(e)?this.contents!==void 0:Lq(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=dJ(this.schema,[e],t):rX(this.contents)&&this.contents.set(e,t)}setIn(e,t){fJ(e)?this.contents=t:this.contents==null?this.contents=dJ(this.schema,Array.from(e),t):rX(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 Xq({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 Xq({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new eX(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=nJ(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?tJ(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return tX(this,e)}};function rX(e){if(Lq(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var iX=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},aX=class extends iX{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},oX=class extends iX{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},sX=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function cX(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function lX(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(lX(t.key)||lX(t.value))return!0}return!1;default:return!0}}function uX(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&lX(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function dX(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||Fq(e)&&Fq(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var fX=`All mapping items must start at the same column`;function pX({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??$J)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=cX(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,fX)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||lX(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,fX);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&uX(r.indent,u,i),n.atKey=!1,dX(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=cX(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&uX(r.indent,f,i),s=c.range[2];let l=new qJ(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let e=new qJ(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function mX({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??tY)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=cX(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found){if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&uX(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function hX(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var gX=`Block collections are not allowed within flow collections`,_X=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function vX({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?$J:tY))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=cX(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&lX(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];Pq(t)&&(t=t.value??t.key),t.comment?t.comment+=`
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],_X(m)&&i(r.range,`BLOCK_IN_FLOW`,gX)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);_X(f)&&i(g.range,`BLOCK_IN_FLOW`,gX),n.atKey=!1;let _=cX(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?_X(m)&&i(v.range,`BLOCK_IN_FLOW`,gX):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new qJ(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;dX(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new $J(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=hX(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function yX(e,t,n,r,i,a){let o=n.type===`block-map`?pX(e,t,n,r,a):n.type===`block-seq`?mX(e,t,n,r,a):vX(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function bX(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===$J.tagName&&s===`map`||o===tY.tagName&&s===`seq`)return yX(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),yX(e,t,n,i,o)}let l=yX(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=Rq(u)?u:new sJ(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function xX(e,t,n){let r=t.offset,i=SX(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?sJ.BLOCK_FOLDED:sJ.BLOCK_LITERAL,o=t.source?CX(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
`}var tX=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,kq,{value:wq});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Yq({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[kq]:{value:wq}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Lq(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){nX(this.contents)&&this.contents.add(e)}addIn(e,t){nX(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Zq(this);e.anchor=!t||n.has(t)?Qq(t||`a`,n):t}return new rJ(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=$q(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=lJ(e,l,p);return o&&Iq(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new KJ(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return nX(this.contents)?this.contents.delete(e):!1}deleteIn(e){return dJ(e)?this.contents!=null&&(this.contents=null,!0):nX(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Iq(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return dJ(e)?!t&&Pq(this.contents)?this.contents.value:this.contents:Iq(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Iq(this.contents)?this.contents.has(e):!1}hasIn(e){return dJ(e)?this.contents!==void 0:Iq(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=uJ(this.schema,[e],t):nX(this.contents)&&this.contents.set(e,t)}setIn(e,t){dJ(e)?this.contents=t:this.contents==null?this.contents=uJ(this.schema,Array.from(e),t):nX(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 Yq({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 Yq({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new $Y(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=tJ(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?eJ(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return eX(this,e)}};function nX(e){if(Iq(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var rX=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},iX=class extends rX{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},aX=class extends rX{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},oX=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function sX(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function cX(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(cX(t.key)||cX(t.value))return!0}return!1;default:return!0}}function lX(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&cX(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function uX(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||Pq(e)&&Pq(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var dX=`All mapping items must start at the same column`;function fX({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??QJ)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=sX(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,dX)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||cX(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,dX);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&lX(r.indent,u,i),n.atKey=!1,uX(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=sX(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&lX(r.indent,f,i),s=c.range[2];let l=new KJ(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let e=new KJ(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function pX({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??eY)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=sX(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found){if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&lX(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function mX(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var hX=`Block collections are not allowed within flow collections`,gX=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function _X({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?QJ:eY))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=sX(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&cX(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];Nq(t)&&(t=t.value??t.key),t.comment?t.comment+=`
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],gX(m)&&i(r.range,`BLOCK_IN_FLOW`,hX)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);gX(f)&&i(g.range,`BLOCK_IN_FLOW`,hX),n.atKey=!1;let _=sX(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?gX(m)&&i(v.range,`BLOCK_IN_FLOW`,hX):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new KJ(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;uX(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new QJ(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=mX(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function vX(e,t,n,r,i,a){let o=n.type===`block-map`?fX(e,t,n,r,a):n.type===`block-seq`?pX(e,t,n,r,a):_X(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function yX(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===QJ.tagName&&s===`map`||o===eY.tagName&&s===`seq`)return vX(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),vX(e,t,n,i,o)}let l=vX(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=Lq(u)?u:new oJ(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function bX(e,t,n){let r=t.offset,i=xX(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?oJ.BLOCK_FOLDED:oJ.BLOCK_LITERAL,o=t.source?SX(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
`.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===sJ.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===oJ.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`):t.length>c||r[0]===` `?(f===` `?f=`
`:!p&&f===`
`&&(f=`
@@ -81,59 +81,59 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`+o[e][0].slice(c);d[d.length-1]!==`
`&&(d+=`
`);break;default:d+=`
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function SX({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function CX(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function wX(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=sJ.PLAIN,c=TX(a,l);break;case`single-quoted-scalar`:s=sJ.QUOTE_SINGLE,c=EX(a,l);break;case`double-quoted-scalar`:s=sJ.QUOTE_DOUBLE,c=OX(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=hX(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function TX(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),DX(e)}function EX(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),DX(e.slice(1,-1)).replace(/''/g,`'`)}function DX(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function xX({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function SX(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function CX(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=oJ.PLAIN,c=wX(a,l);break;case`single-quoted-scalar`:s=oJ.QUOTE_SINGLE,c=TX(a,l);break;case`double-quoted-scalar`:s=oJ.QUOTE_DOUBLE,c=DX(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=mX(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function wX(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),EX(e)}function TX(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),EX(e.slice(1,-1)).replace(/''/g,`'`)}function EX(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
`?a+=o:o=`
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function OX(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function DX(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
`){if(i===`
`){let{fold:t,offset:i}=kX(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=AX[i];if(a)n+=a;else if(i===`
`){let{fold:t,offset:i}=OX(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=kX[i];if(a)n+=a;else if(i===`
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=jX(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=AX(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
`&&(a!==`\r`||e[r+2]!==`
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function kX(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function OX(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
`||r===`\r`)&&(r!==`\r`||e[t+2]===`
`);)r===`
`&&(n+=`
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var AX={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function jX(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function MX(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?xX(e,t,r):wX(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Oq]:c?NX(e.schema,i,c,n,r):t.type===`scalar`?PX(e,i,t,r):e.schema[Oq];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=Fq(a)?a:new sJ(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new sJ(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function NX(e,t,n,r,i){if(n===`!`)return e[Oq];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Oq])}function PX({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Oq];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Oq];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function FX(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var IX={composeNode:LX,composeEmptyNode:RX};function LX(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=zX(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=MX(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=bX(IX,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=RX(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!Fq(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function RX(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=MX(e,{type:`scalar`,offset:FX(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function zX({options:e},{offset:t,source:n,end:r},i){let a=new iJ(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=hX(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function BX(e,t,{offset:n,start:r,value:i,end:a},o){let s=new nX(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=cX(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?LX(c,i,l,o):RX(c,l.end,r,null,l,o);let u=s.contents.range[2],d=hX(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function VX(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function HX(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var kX={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function AX(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function jX(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?bX(e,t,r):CX(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Dq]:c?MX(e.schema,i,c,n,r):t.type===`scalar`?NX(e,i,t,r):e.schema[Dq];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=Pq(a)?a:new oJ(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new oJ(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function MX(e,t,n,r,i){if(n===`!`)return e[Dq];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Dq])}function NX({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Dq];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Dq];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function PX(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var FX={composeNode:IX,composeEmptyNode:LX};function IX(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=RX(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=jX(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=yX(FX,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=LX(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!Pq(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function LX(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=jX(e,{type:`scalar`,offset:PX(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function RX({options:e},{offset:t,source:n,end:r},i){let a=new rJ(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=mX(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function zX(e,t,{offset:n,start:r,value:i,end:a},o){let s=new tX(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=sX(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?IX(c,i,l,o):LX(c,l.end,r,null,l,o);let u=s.contents.range[2],d=mX(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function BX(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function VX(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
`:`
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var UX=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=VX(e);r?this.warnings.push(new oX(i,t,n)):this.errors.push(new aX(i,t,n))},this.directives=new Xq({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=HX(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(Lq(i)&&!i.flow&&i.items.length>0){let e=i.items[0];Pq(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:HX(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=VX(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=BX(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new aX(VX(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new aX(VX(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=hX(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new aX(VX(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new nX(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},WX=Symbol(`break visit`),GX=Symbol(`skip children`),KX=Symbol(`remove item`);function qX(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),JX(Object.freeze([]),e,t)}qX.BREAK=WX,qX.SKIP=GX,qX.REMOVE=KX,qX.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},qX.parentCollection=(e,t)=>{let n=qX.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function JX(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=JX(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===WX)return WX;else r===KX&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function YX(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var HX=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=BX(e);r?this.warnings.push(new aX(i,t,n)):this.errors.push(new iX(i,t,n))},this.directives=new Yq({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=VX(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(Iq(i)&&!i.flow&&i.items.length>0){let e=i.items[0];Nq(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:VX(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=BX(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=zX(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new iX(BX(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new iX(BX(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=mX(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new iX(BX(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new tX(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},UX=Symbol(`break visit`),WX=Symbol(`skip children`),GX=Symbol(`remove item`);function KX(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),qX(Object.freeze([]),e,t)}KX.BREAK=UX,KX.SKIP=WX,KX.REMOVE=GX,KX.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},KX.parentCollection=(e,t)=>{let n=KX.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function qX(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=qX(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===UX)return UX;else r===GX&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function JX(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
`:case`\r
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[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 XX(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var ZX=new Set(`0123456789ABCDEFabcdef`),QX=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),$X=new Set(`,[]{}`),eZ=new Set(` ,[]{}
\r `),tZ=e=>!e||eZ.has(e),nZ=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let 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===`
`: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(e[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 YX(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var XX=new Set(`0123456789ABCDEFabcdef`),ZX=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),QX=new Set(`,[]{}`),$X=new Set(` ,[]{}
\r `),eZ=e=>!e||$X.has(e),vte=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let 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===`
`||t===`\r`&&this.buffer[e+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`){let t=this.buffer[n+e+1];if(t===`
`||!t&&!this.atEnd)return e+n+1}return t===`
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&XX(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,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]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&XX(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!XX(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&XX(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(tZ),`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);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&XX(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`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,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(tZ),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||XX(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&YX(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,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]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&YX(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!YX(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&YX(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(eZ),`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);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&YX(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`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,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(eZ),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||YX(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>XX(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>YX(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
`:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
`)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
`,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(XX(r)||e&&$X.has(r))break;t=n}else if(XX(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(YX(r)||e&&QX.has(r))break;t=n}else if(YX(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&$X.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&$X.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(tZ),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(XX(n)||t&&$X.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!XX(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(QX.has(t))t=this.buffer[++e];else if(t===`%`&&ZX.has(this.buffer[e+1])&&ZX.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&QX.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&QX.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(eZ),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(YX(n)||t&&QX.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!YX(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(ZX.has(t))t=this.buffer[++e];else if(t===`%`&&XX.has(this.buffer[e+1])&&XX.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},hte=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function rZ(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function iZ(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function aZ(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function oZ(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function sZ(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function cZ(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function lZ(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!rZ(t.start,`explicit-key-ind`)&&!rZ(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,aZ(t.value)?t.value.end?cZ(t.value.end,t.sep):t.value.end=t.sep:cZ(t.start,t.sep),delete t.sep)}var uZ=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new nZ,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let 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}let t=YX(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else 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}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&lZ(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&iZ(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e. Line truncated
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},tZ=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function nZ(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function rZ(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function iZ(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function aZ(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function oZ(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function sZ(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function cZ(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!nZ(t.start,`explicit-key-ind`)&&!nZ(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,iZ(t.value)?t.value.end?sZ(t.value.end,t.sep):t.value.end=t.sep:sZ(t.start,t.sep),delete t.sep)}var lZ=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new vte,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let 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}let t=JX(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else 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}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&cZ(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&rZ(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e. Line truncated
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){cZ(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),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?(i.push(this.sourceToken),e.items.push({start:i,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(rZ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=sZ(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(rZ(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(aZ(t.key)&&!rZ(t.sep,`newline`)){let e=sZ(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):rZ(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!rZ(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 n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){cZ(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||rZ(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.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.ite Line truncated
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){sZ(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),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?(i.push(this.sourceToken),e.items.push({start:i,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(nZ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=oZ(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(nZ(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(iZ(t.key)&&!nZ(t.sep,`newline`)){let e=oZ(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):nZ(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!nZ(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 n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){sZ(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||nZ(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.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.ite Line truncated
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=sZ(oZ(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=sZ(oZ(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function dZ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new hte||null,prettyErrors:t}}function fZ(e,t={}){let{lineCounter:n,prettyErrors:r}=dZ(t),i=new uZ(n?.addNewLine),a=new UX(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new aX(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(sX(e,n)),o.warnings.forEach(sX(e,n))),o}function pZ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=fZ(e,n);if(!i)return null;if(i.warnings.forEach(e=>LJ(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function mZ(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return Mq(e)&&!r?e.toString(n):new nX(e,r,n).toString(n)}function hZ(e,t){let n=new Map;for(let e of t)n.set(e.name,[...n.get(e.name)??[],e]);return{edges:e.edges,nodes:e.nodes.map(e=>{let{stage:t,occurrence:r}=e.data,i=t===void 0?void 0:n.get(t)?.[r??0];return i?{...e,data:{...e.data,run:i}}:e})}}function gZ(e,t){let n=e=>e.path&&e.path.length>=2?Number(e.path[1]):-1,r=e.nodes.find(e=>JSON.stringify(e.data.path)===JSON.stringify(t))?.data;if(!r?.stage)return null;let i=Math.max(-1,...e.nodes.filter(e=>e.data.run).map(e=>n(e.data))),a=n(r);return a<0||a>i?null:{label:a===i?`Resume from here`:`Re-run from here`,from:r.stage}}var _Z=140,vZ=280,yZ={"agent.run":`Agent`,"command.run":`Run commands`,"repo.prepare":`Prepare worktree`,"repo.commit":`Commit`,"repo.open-pr":`Open pull request`,"gate.repository":`Repository gate`,"gate.diff-size":`Diff size gate`,"gate.diff-rules":`Diff rules gate`,"forge.comment":`Comment`,"forge.close-issue":`Close issue`,"human.approve":`Human approval`,"workflow.call":`Call workflow`,"workflow.handoff":`Hand off`,"workflow.finish":`Finish`,"review.pr":`Review pull request`,"review.start-round":`Start review round`,"review.reply":`Reply to review`};function bZ(e){return yZ[e]??e}var xZ=/\{\{\s*steps\.([A-Za-z0-9_-]+)\.[^}]*\}\}/g;function SZ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function CZ(e,t){let n=e=>typeof t[e]==`string`?t[e]:``;switch(e){case`agent.run`:return[n(`role`)||`builder`,t.read_only?`read-only`:n(`gate`)?`gated: ${n(`gate`)}`:``].filter(Boolean).join(` · `);case`repo.commit`:return[n(`message`),t.push?`push`:``].filter(Boolean).join(` · `);case`workflow.call`:case`workflow.handoff`:return n(`workflow`);case`workflow.finish`:return n(`status`)||`completed`;case`human.approve`:return n(`then`)?`then ${n(`then`)}`:``;case`gate.repository`:return n(`expect`)===`test-failure`?`tests must fail`:t.repair?`repair if red`:``}return``}function wZ(e){for(let t of[`mission`,`message`,`body`,`plan`,`detail`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.replace(/\{\{\s*([^}]+?)\s*\}\}/g,`‹$1›`).split(`
`).find(e=>e.trim())?.trim()}}function TZ(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(xZ)].map(e=>e[1]))]}function EZ(e){let t=fZ(e).toJS(),n=SZ(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=`start`;r.push({id:s,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let c=[s],l=1,u=new Map,d=e=>{let t=u.get(e)??0;return u.set(e,t+1),t},f=(e,t,n,i,s,c,l)=>{let u=SZ(e)?e:{},f=typeof u.type==`string`?u.type:``,p=SZ(u.settings)?u.settings:{},m=typeof u.id==`string`?u.id:``,h=`step-${t}`;r.push({id:h,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:m||t,title:m||bZ(f),type:f,detail:CZ(f,p),summary:wZ(p),when:typeof u.when==`string`?u.when:void 0,retry:SZ(u.retry)&&typeof u.retry.attempts==`number`?u.retry.attempts:void 0,continues:u.on_failure===`continue`,branch:s,path:l,...c??{stage:m||f,occurrence:d(m||f)}}}),m&&a.set(m,h);for(let e of TZ(u.settings,u.when))o.push({from:e,to:h});return h},p=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){if(SZ(t)&&SZ(t.parallel)){let n=Object.entries(t.parallel),r=typeof t.id==`string`?t.id:`parallel`,i={stage:r,occurrence:d(r)},a=[],o=0;n.forEach(([t,r],s)=>{let u=(s-(n.length-1)/2)*vZ,d=c,m=c;(Array.isArray(r)?r:[]).forEach((r,a)=>{let c=f(r,`${e+1}-${t}-${a+1}`,u,(l+a)*_Z,t,i,[`steps`,e,`parallel`,t,a]);p(d,c,d===m&&s===n.length-1?e-1:void 0),d=[c],o=Math.max(o,a+1)}),a.push(...d)}),c=a,l+=Math.max(o,1);continue}let n=f(t,String(e+1),0,l*_Z,void 0,void 0,[`steps`,e]);p(c,n,e-1),c=[n],l++}r.push({id:`add-end`,type:`add`,position:{x:104,y:l*_Z-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``}}),p(c,`add-end`);for(let{from:e,to:t}of o){let n=a.get(e);n&&(i.some(e=>e.kind===`flow`&&e.source===n&&e.target===t)||i.push({id:`data-${n}-${t}`,source:n,target:t,kind:`data`,label:e,offset:24+14*i.filter(e=>e.kind===`data`).length,sourceHandle:`data-out`,targetHandle:`data-in`}))}return{nodes:r,edges:i}}var DZ={agent:id,command:Gd,repo:bd,gate:Hd,forge:Od,human:Qd,review:vd,workflow:tf},OZ={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function kZ(e){return DZ[e.split(`.`)[0]]??tf}function AZ(e){return Object.keys(OZ).map(t=>({title:OZ[t],icon:DZ[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}function jZ(e,t){let n=fZ(e).getIn(t,!0);if(Nq(n))return n.toJSON()}function MZ(e,t,n){let r=fZ(e);return r.setIn(t,r.createNode(RZ(n))),r.toString()}function NZ(e,t,n){let r=fZ(e),i=r.get(`steps`,!0);if(Iq(i)||(r.set(`steps`,r.createNode([])),i=r.get(`steps`,!0)),!Iq(i))return{source:e,path:[]};let a=Math.min(Math.max(t+1,0),i.items.length);return i.items.splice(a,0,r.createNode({type:n})),{source:r.toString(),path:[`steps`,a]}}function PZ(e,t){let n=fZ(e),r=n.getIn(t.slice(0,-1),!0),i=t.at(-1);if(!Iq(r)||typeof i!=`number`)return{source:e,path:t};let a=n.createNode(n.getIn(t));return Nq(a)&&a.delete(`id`),r.items.splice(i+1,0,a),{source:n.toString(),path:[...t.slice(0,-1),i+1]}}function FZ(e,t){let n=fZ(e);n.deleteIn(t);let r=t.slice(0,-1);if(r.length>2){let e=n.getIn(r,!0);Iq(e)&&e.items.length===0&&n.deleteIn(r)}return n.toString()}function IZ(e,t,n){let r=fZ(e),i=r.getIn(t.slice(0,-1),!0),a=t.at(-1);if(!Iq(i)||typeof a!=`number`)return{source:e,path:t};let o=a+n;if(o<0||o>=i.items.length)return{source:e,path:t};let[s]=i.items.splice(a,1);return i.items.splice(o,0,s),{source:r.toString(),path:[...t.slice(0,-1),o]}}function LZ(e,t){let n=fZ(e).toJS(),r=Array.isArray(n?.steps)?n.steps:[],i=typeof t[1]==`number`?t[1]:r.length,a=[],o=e=>{if(typeof e!=`object`||!e)return;let t=e;if(typeof t.id==`string`&&a.push(t.id),typeof t.parallel==`object`&&t.parallel!==null)for(let e of Object.values(t.parallel))Array.isArray(e)&&e.forEach(o)};if(r.slice(0,i).forEach(o),t.length===5){let e=r[i]?.parallel?.[t[3]];Array.isArray(e)&&e.slice(0,t[4]).forEach(o)}return a}function RZ(e){if(Array.isArray(e))return e.map(RZ);if(typeof e!=`object`||!e)return e;let t={};for(let[n,r]of Object.entries(e)){if(r===void 0||r===``||r===null)continue;let e=RZ(r);(typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length!==0)&&(t[n]=e)}return t}function zZ(e,t){let n=fZ(e).get(t,!0);return n&&typeof n==`object`&&`toJSON`in n?n.toJSON():fZ(e).get(t)}function BZ(e,t,n){let r=fZ(e),i=RZ({[t]:n})[t];return i===void 0?r.delete(t):r.set(t,r.createNode(i)),r.toString()}function VZ(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function HZ(e,t=[]){let n=fZ(e),r=n.errors[0];if(r)return{ok:!1,message:nQ(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!rQ(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:QZ(e)}))}var XZ=/^(\s*)(-\s+)?/,ZZ=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function QZ(e){let{code:t,comment:n}=$Z(e),r=eQ(t);return n&&r.push({text:n,kind:`comment`}),r}function $Z(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t){r===t&&(t=``);continue}if(r===`"`||r===`'`){t=r;continue}if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function eQ(e){if(!e)return[];let t=[],n=XZ.exec(e);n?.[1]&&t.push({text:n[1],kind:`plain`}),n?.[2]&&t.push({text:n[2],kind:`punct`});let r=e.slice(n?.[0].length??0);if(!r)return t;let i=ZZ.exec(r);return i?(t.push({text:i[1]??``,kind:`key`}),t.push({text:i[2]??`:`,kind:`punct`}),i[3]&&t.push({text:i[3],kind:`plain`}),[...t,...tQ(i[4]??``)]):[...t,...tQ(r)]}function tQ(e){if(!e)return[];let t=/^("[^"]*"?|'[^']*'?)([\s\S]*)$/.exec(e);if(!t)return[{text:e,kind:`plain`}];let n=[{text:t[1]??``,kind:`string`}];return t[2]&&n.push({text:t[2],kind:`plain`}),n}function nQ(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function rQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function iQ(e){return typeof e==`string`&&e.trim()!==``}var aQ={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},oQ={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},sQ={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},cQ={class:`min-w-0 flex-1`},lQ=[`value`,`placeholder`],uQ={class:`truncate font-mono text-[11px] text-fg-subtle`},dQ={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},fQ={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},pQ={key:1,class:`space-y-1.5`},mQ=[`title`],hQ=[`value`],gQ=[`value`],_Q={key:3,class:`flex flex-wrap items-center gap-1 pt-0.5`},vQ=[`onClick`],yQ=[`onClick`],bQ={key:2,class:`divide-y divide-border rounded-md border border-border`},xQ=[`title`],SQ=[`value`,`onChange`],CQ=[`value`],wQ=[`value`,`onInput`],TQ=[`value`,`onFocus`,`onInput`],EQ=[`title`],DQ={key:0,class:`text-xs text-danger`},OQ={class:`space-y-2`},kQ={class:`divide-y divide-border rounded-md border border-border`},AQ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},jQ=[`value`],MQ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},NQ=[`value`],PQ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},FQ=[`value`],IQ={class:`flex items-center border-t border-border px-4 py-2.5`},LQ=L({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>jZ(n.yaml,n.path)??{}),a=Y(()=>typeof i.value.type==`string`?i.value.type:``),o=Y(()=>n.vocabulary.find(e=>e.name===a.value)),s=Y(()=>typeof i.value.settings==`object`&&i.value.settings!==null?i.value.settings:{}),c=Y(()=>LZ(n.yaml,n.path)),l=Y(()=>o.value?.settings&&i.value.settings?qZ(i.value.settings,o.value.settings,`settings`):``),u=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],d=/mission|body|detail|plan|rules/;function f(e,t){return t.type===`string`?t.enum?`select`:d.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let p=Y(()=>{let e=Object.entries(o.value?.settings?.properties??{}).map(([e,t])=>({key:e,schema:t,kind:f(e,t)})),t=e.filter(e=>u.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>u.indexOf(e.key)-u.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function m(e){let{id:t,type:i,...a}=e;r(`update:yaml`,MZ(n.yaml,n.path,{id:t,type:i,...a}))}function h(e,t){m({...i.value,[e]:t})}function g(e,t){m({...i.value,settings:{...s.value,[e]:t}})}let _=N(null);function v(e,t){let n=_.value??p.value.lead?.key;if(!n)return;let r=typeof s.value[n]==`string`?s.value[n]:``,i=`{{ steps.${e}.${t} }}`;g(n,r?`${r.trimEnd()} ${i}`:i)}let y=N({});function b(e,t){try{g(e,t.trim()?pZ(t):void 0),y.value={...y.value,[e]:``}}catch(t){y.value={...y.value,[e]:String(t.message).split(`
`)[0]}}}let x=e=>e===void 0?``:mZ(e).trimEnd(),S=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),C=e=>typeof s.value[e]==`string`?s.value[e]:``;return(e,t)=>(V(),H(`aside`,aQ,[W(`header`,oQ,[W(`span`,sQ,[(V(),U(ra(P(kZ)(a.value)),{class:`size-4`}))]),W(`div`,cQ,[W(`input`,{value:i.value.id??``,class:`w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline`,placeholder:P(bZ)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>h(`id`,e.target.value)},null,40,lQ),W(`div`,uQ,M(a.value),1)]),G(P($),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:F(()=>[G(P(rf))]),_:1})]),W(`div`,dQ,[l.value?(V(),H(`p`,fQ,M(l.value),1)):q(``,!0),p.value.lead?(V(),H(`section`,pQ,[W(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:p.value.lead.schema.description},[K(M(S(p.value.lead.key,p.value.lead.schema))+` `,1),p.value.lead.schema.description?(V(),U(P(md),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,mQ),p.value.lead.kind===`select`?(V(),H(`select`,{key:0,class:`h-9 w-full rounded-md border border-input bg-background px-2`,value:C(p.value.lead.key),onChange:t[2]||=e=>g(p.value.lead.key,e.target.value||void 0)},[t[12]||=W(`option`,{value:``},`Default`,-1),(V(!0),H(B,null,R(p.value.lead.schema.enum,e=>(V(),H(`option`,{key:e,value:e},M(e),9,gQ))),128))],40,hQ)):p.value.lead.kind===`text`?(V(),U(P($w),{key:1,"model-value":C(p.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:t[3]||=e=>_.value=p.value.lead.key,"onUpdate:modelValue":t[4]||=e=>g(p.value.lead.key,String(e))},null,8,[`model-value`])):(V(),U(P(UO),{key:2,"model-value":C(p.value.lead.key),onFocus:t[5]||=e=>_.value=p.value.lead.key,"onUpdate:modelValue":t[6]||=e=>g(p.value.lead.key,String(e))},null,8,[`model-value`])),c.value.length&&p.value.lead.kind!==`select`?(V(),H(`div`,_Q,[t[13]||=W(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(V(!0),H(B,null,R(c.value,e=>(V(),H(B,{key:e},[W(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>v(e,`summary`)},M(e),9,vQ),W(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>v(e,`result`)},M(e)+`.result`,9,yQ)],64))),128))])):q(``,!0)])):q(``,!0),p.value.compact.length?(V(),H(`section`,bQ,[(V(!0),H(B,null,R(p.value.compact,e=>(V(),H(`div`,{key:e.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[W(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:e.schema.description},[K(M(S(e.key,e.schema))+` `,1),e.schema.description?(V(),U(P(md),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,xQ),e.kind===`boolean`?(V(),U(P(mk),{key:0,"model-value":s.value[e.key]===!0,"onUpdate:modelValue":t=>g(e.key,t||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):e.kind===`select`?(V(),H(`select`,{key:1,class:`h-7 max-w-40 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:C(e.key),onChange:t=>g(e.key,t.target.value||void 0)},[t[14]||=W(`option`,{value:``},`Default`,-1),(V(!0),H(B,null,R(e.schema.enum,e=>(V(),H(`option`,{key:e,value:e},M(e),9,CQ))),128))],40,SQ)):e.kind===`number`?(V(),H(`input`,{key:2,type:`number`,class:`h-7 w-24 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:s.value[e.key]??``,onInput:t=>g(e.key,t.target.value===``?void 0:Number(t.target.value))},null,40,wQ)):(V(),H(`input`,{key:3,class:`h-7 w-40 rounded-md border border-input bg-background px-2 text-[13px]`,value:C(e.key),onFocus:t=>_.value=e.key,onInput:t=>g(e.key,t.target.value)},null,40,TQ))]))),128))])):q(``,!0),(V(!0),H(B,null,R(p.value.long,e=>(V(),H(`section`,{key:e.key,class:`space-y-1.5`},[W(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[K(M(S(e.key,e.schema))+` `,1),e.schema.description?(V(),U(P(md),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,EQ),e.kind===`text`?(V(),U(P($w),{key:0,"model-value":C(e.key),class:`min-h-20 text-[13px]`,onFocus:t=>_.value=e.key,"onUpdate:modelValue":t=>g(e.key,String(t))},null,8,[`model-value`,`onFocus`,`onUpdate:modelValue`])):e.kind===`lines`?(V(),U(P($w),{key:1,"model-value":Array.isArray(s.value[e.key])?s.value[e.key].join(`
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=oZ(aZ(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=oZ(aZ(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function uZ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new tZ||null,prettyErrors:t}}function dZ(e,t={}){let{lineCounter:n,prettyErrors:r}=uZ(t),i=new lZ(n?.addNewLine),a=new HX(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new iX(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(oX(e,n)),o.warnings.forEach(oX(e,n))),o}function fZ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=dZ(e,n);if(!i)return null;if(i.warnings.forEach(e=>IJ(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function pZ(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return jq(e)&&!r?e.toString(n):new tX(e,r,n).toString(n)}function mZ(e,t){let n=new Map;for(let e of t)n.set(e.name,[...n.get(e.name)??[],e]);return{edges:e.edges,nodes:e.nodes.map(e=>{let{stage:t,occurrence:r}=e.data,i=t===void 0?void 0:n.get(t)?.[r??0];return i?{...e,data:{...e.data,run:i}}:e})}}function hZ(e,t){let n=e=>e.path&&e.path.length>=2?Number(e.path[1]):-1,r=e.nodes.find(e=>JSON.stringify(e.data.path)===JSON.stringify(t))?.data;if(!r?.stage)return null;let i=Math.max(-1,...e.nodes.filter(e=>e.data.run).map(e=>n(e.data))),a=n(r);return a<0||a>i?null:{label:a===i?`Resume from here`:`Re-run from here`,from:r.stage}}var gZ=140,_Z=280,vZ={"agent.run":`Agent`,"command.run":`Run commands`,"repo.prepare":`Prepare worktree`,"repo.commit":`Commit`,"repo.open-pr":`Open pull request`,"gate.repository":`Repository gate`,"gate.diff-size":`Diff size gate`,"gate.diff-rules":`Diff rules gate`,"forge.comment":`Comment`,"forge.close-issue":`Close issue`,"human.approve":`Human approval`,"workflow.call":`Call workflow`,"workflow.handoff":`Hand off`,"workflow.finish":`Finish`,"review.pr":`Review pull request`,"review.start-round":`Start review round`,"review.reply":`Reply to review`};function yZ(e){return vZ[e]??e}var bZ=/\{\{\s*steps\.([A-Za-z0-9_-]+)\.[^}]*\}\}/g;function xZ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function SZ(e,t){let n=e=>typeof t[e]==`string`?t[e]:``;switch(e){case`agent.run`:return[n(`role`)||`builder`,t.read_only?`read-only`:n(`gate`)?`gated: ${n(`gate`)}`:``].filter(Boolean).join(` · `);case`repo.commit`:return[n(`message`),t.push?`push`:``].filter(Boolean).join(` · `);case`workflow.call`:case`workflow.handoff`:return n(`workflow`);case`workflow.finish`:return n(`status`)||`completed`;case`human.approve`:return n(`then`)?`then ${n(`then`)}`:``;case`gate.repository`:return n(`expect`)===`test-failure`?`tests must fail`:t.repair?`repair if red`:``}return``}function CZ(e){for(let t of[`mission`,`message`,`body`,`plan`,`detail`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.replace(/\{\{\s*([^}]+?)\s*\}\}/g,`‹$1›`).split(`
`).find(e=>e.trim())?.trim()}}function wZ(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(bZ)].map(e=>e[1]))]}function TZ(e){let t=dZ(e).toJS(),n=xZ(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=`start`;r.push({id:s,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let c=[s],l=1,u=new Map,d=e=>{let t=u.get(e)??0;return u.set(e,t+1),t},f=(e,t,n,i,s,c,l)=>{let u=xZ(e)?e:{},f=typeof u.type==`string`?u.type:``,p=xZ(u.settings)?u.settings:{},m=typeof u.id==`string`?u.id:``,h=`step-${t}`;r.push({id:h,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:m||t,title:m||yZ(f),type:f,detail:SZ(f,p),summary:CZ(p),when:typeof u.when==`string`?u.when:void 0,retry:xZ(u.retry)&&typeof u.retry.attempts==`number`?u.retry.attempts:void 0,continues:u.on_failure===`continue`,branch:s,path:l,...c??{stage:m||f,occurrence:d(m||f)}}}),m&&a.set(m,h);for(let e of wZ(u.settings,u.when))o.push({from:e,to:h});return h},p=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){if(xZ(t)&&xZ(t.parallel)){let n=Object.entries(t.parallel),r=typeof t.id==`string`?t.id:`parallel`,i={stage:r,occurrence:d(r)},a=[],o=0;n.forEach(([t,r],s)=>{let u=(s-(n.length-1)/2)*_Z,d=c,m=c;(Array.isArray(r)?r:[]).forEach((r,a)=>{let c=f(r,`${e+1}-${t}-${a+1}`,u,(l+a)*gZ,t,i,[`steps`,e,`parallel`,t,a]);p(d,c,d===m&&s===n.length-1?e-1:void 0),d=[c],o=Math.max(o,a+1)}),a.push(...d)}),c=a,l+=Math.max(o,1);continue}let n=f(t,String(e+1),0,l*gZ,void 0,void 0,[`steps`,e]);p(c,n,e-1),c=[n],l++}r.push({id:`add-end`,type:`add`,position:{x:104,y:l*gZ-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``}}),p(c,`add-end`);for(let{from:e,to:t}of o){let n=a.get(e);n&&(i.some(e=>e.kind===`flow`&&e.source===n&&e.target===t)||i.push({id:`data-${n}-${t}`,source:n,target:t,kind:`data`,label:e,offset:24+14*i.filter(e=>e.kind===`data`).length,sourceHandle:`data-out`,targetHandle:`data-in`}))}return{nodes:r,edges:i}}var EZ={agent:$u,command:Bd,repo:hd,gate:Ld,forge:Cd,human:qd,review:pd,workflow:Xd},DZ={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function OZ(e){return EZ[e.split(`.`)[0]]??Xd}function kZ(e){return Object.keys(DZ).map(t=>({title:DZ[t],icon:EZ[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}function AZ(e,t){let n=dZ(e).getIn(t,!0);if(Mq(n))return n.toJSON()}function jZ(e,t,n){let r=dZ(e);return r.setIn(t,r.createNode(LZ(n))),r.toString()}function MZ(e,t,n){let r=dZ(e),i=r.get(`steps`,!0);if(Fq(i)||(r.set(`steps`,r.createNode([])),i=r.get(`steps`,!0)),!Fq(i))return{source:e,path:[]};let a=Math.min(Math.max(t+1,0),i.items.length);return i.items.splice(a,0,r.createNode({type:n})),{source:r.toString(),path:[`steps`,a]}}function NZ(e,t){let n=dZ(e),r=n.getIn(t.slice(0,-1),!0),i=t.at(-1);if(!Fq(r)||typeof i!=`number`)return{source:e,path:t};let a=n.createNode(n.getIn(t));return Mq(a)&&a.delete(`id`),r.items.splice(i+1,0,a),{source:n.toString(),path:[...t.slice(0,-1),i+1]}}function PZ(e,t){let n=dZ(e);n.deleteIn(t);let r=t.slice(0,-1);if(r.length>2){let e=n.getIn(r,!0);Fq(e)&&e.items.length===0&&n.deleteIn(r)}return n.toString()}function FZ(e,t,n){let r=dZ(e),i=r.getIn(t.slice(0,-1),!0),a=t.at(-1);if(!Fq(i)||typeof a!=`number`)return{source:e,path:t};let o=a+n;if(o<0||o>=i.items.length)return{source:e,path:t};let[s]=i.items.splice(a,1);return i.items.splice(o,0,s),{source:r.toString(),path:[...t.slice(0,-1),o]}}function IZ(e,t){let n=dZ(e).toJS(),r=Array.isArray(n?.steps)?n.steps:[],i=typeof t[1]==`number`?t[1]:r.length,a=[],o=e=>{if(typeof e!=`object`||!e)return;let t=e;if(typeof t.id==`string`&&a.push(t.id),typeof t.parallel==`object`&&t.parallel!==null)for(let e of Object.values(t.parallel))Array.isArray(e)&&e.forEach(o)};if(r.slice(0,i).forEach(o),t.length===5){let e=r[i]?.parallel?.[t[3]];Array.isArray(e)&&e.slice(0,t[4]).forEach(o)}return a}function LZ(e){if(Array.isArray(e))return e.map(LZ);if(typeof e!=`object`||!e)return e;let t={};for(let[n,r]of Object.entries(e)){if(r===void 0||r===``||r===null)continue;let e=LZ(r);(typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length!==0)&&(t[n]=e)}return t}function RZ(e,t){let n=dZ(e).get(t,!0);return n&&typeof n==`object`&&`toJSON`in n?n.toJSON():dZ(e).get(t)}function zZ(e,t,n){let r=dZ(e),i=LZ({[t]:n})[t];return i===void 0?r.delete(t):r.set(t,r.createNode(i)),r.toString()}function BZ(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function VZ(e,t=[]){let n=dZ(e),r=n.errors[0];if(r)return{ok:!1,message:tQ(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!nQ(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:ZZ(e)}))}var YZ=/^(\s*)(-\s+)?/,XZ=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function ZZ(e){let{code:t,comment:n}=QZ(e),r=$Z(t);return n&&r.push({text:n,kind:`comment`}),r}function QZ(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t){r===t&&(t=``);continue}if(r===`"`||r===`'`){t=r;continue}if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function $Z(e){if(!e)return[];let t=[],n=YZ.exec(e);n?.[1]&&t.push({text:n[1],kind:`plain`}),n?.[2]&&t.push({text:n[2],kind:`punct`});let r=e.slice(n?.[0].length??0);if(!r)return t;let i=XZ.exec(r);return i?(t.push({text:i[1]??``,kind:`key`}),t.push({text:i[2]??`:`,kind:`punct`}),i[3]&&t.push({text:i[3],kind:`plain`}),[...t,...eQ(i[4]??``)]):[...t,...eQ(r)]}function eQ(e){if(!e)return[];let t=/^("[^"]*"?|'[^']*'?)([\s\S]*)$/.exec(e);if(!t)return[{text:e,kind:`plain`}];let n=[{text:t[1]??``,kind:`string`}];return t[2]&&n.push({text:t[2],kind:`plain`}),n}function tQ(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function nQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rQ(e){return typeof e==`string`&&e.trim()!==``}var iQ={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},aQ={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},oQ={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},sQ={class:`min-w-0 flex-1`},cQ=[`value`,`placeholder`],lQ={class:`truncate font-mono text-[11px] text-fg-subtle`},uQ={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},dQ={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},fQ={key:1,class:`space-y-1.5`},pQ=[`title`],mQ=[`value`],hQ=[`value`],gQ={key:3,class:`flex flex-wrap items-center gap-1 pt-0.5`},_Q=[`onClick`],vQ=[`onClick`],yQ={key:2,class:`divide-y divide-border rounded-md border border-border`},bQ=[`title`],xQ=[`value`,`onChange`],SQ=[`value`],CQ=[`value`,`onInput`],wQ=[`value`,`onFocus`,`onInput`],TQ=[`title`],EQ={key:0,class:`text-xs text-danger`},DQ={class:`space-y-2`},OQ={class:`divide-y divide-border rounded-md border border-border`},kQ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},AQ=[`value`],jQ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},MQ=[`value`],NQ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},PQ=[`value`],FQ={class:`flex items-center border-t border-border px-4 py-2.5`},IQ=L({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>AZ(n.yaml,n.path)??{}),a=Y(()=>typeof i.value.type==`string`?i.value.type:``),o=Y(()=>n.vocabulary.find(e=>e.name===a.value)),s=Y(()=>typeof i.value.settings==`object`&&i.value.settings!==null?i.value.settings:{}),c=Y(()=>IZ(n.yaml,n.path)),l=Y(()=>o.value?.settings&&i.value.settings?KZ(i.value.settings,o.value.settings,`settings`):``),u=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],d=/mission|body|detail|plan|rules/;function f(e,t){return t.type===`string`?t.enum?`select`:d.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let p=Y(()=>{let e=Object.entries(o.value?.settings?.properties??{}).map(([e,t])=>({key:e,schema:t,kind:f(e,t)})),t=e.filter(e=>u.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>u.indexOf(e.key)-u.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function m(e){let{id:t,type:i,...a}=e;r(`update:yaml`,jZ(n.yaml,n.path,{id:t,type:i,...a}))}function h(e,t){m({...i.value,[e]:t})}function g(e,t){m({...i.value,settings:{...s.value,[e]:t}})}let _=N(null);function v(e,t){let n=_.value??p.value.lead?.key;if(!n)return;let r=typeof s.value[n]==`string`?s.value[n]:``,i=`{{ steps.${e}.${t} }}`;g(n,r?`${r.trimEnd()} ${i}`:i)}let y=N({});function b(e,t){try{g(e,t.trim()?fZ(t):void 0),y.value={...y.value,[e]:``}}catch(t){y.value={...y.value,[e]:String(t.message).split(`
`)[0]}}}let x=e=>e===void 0?``:pZ(e).trimEnd(),S=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),C=e=>typeof s.value[e]==`string`?s.value[e]:``;return(e,t)=>(V(),H(`aside`,iQ,[W(`header`,aQ,[W(`span`,oQ,[(V(),U(ea(P(OZ)(a.value)),{class:`size-4`}))]),W(`div`,sQ,[W(`input`,{value:i.value.id??``,class:`w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline`,placeholder:P(yZ)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>h(`id`,e.target.value)},null,40,cQ),W(`div`,lQ,M(a.value),1)]),G(P($),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:F(()=>[G(P(Qd))]),_:1})]),W(`div`,uQ,[l.value?(V(),H(`p`,dQ,M(l.value),1)):q(``,!0),p.value.lead?(V(),H(`section`,fQ,[W(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:p.value.lead.schema.description},[K(M(S(p.value.lead.key,p.value.lead.schema))+` `,1),p.value.lead.schema.description?(V(),U(P(ld),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,pQ),p.value.lead.kind===`select`?(V(),H(`select`,{key:0,class:`h-9 w-full rounded-md border border-input bg-background px-2`,value:C(p.value.lead.key),onChange:t[2]||=e=>g(p.value.lead.key,e.target.value||void 0)},[t[12]||=W(`option`,{value:``},`Default`,-1),(V(!0),H(B,null,R(p.value.lead.schema.enum,e=>(V(),H(`option`,{key:e,value:e},M(e),9,hQ))),128))],40,mQ)):p.value.lead.kind===`text`?(V(),U(P(uT),{key:1,"model-value":C(p.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:t[3]||=e=>_.value=p.value.lead.key,"onUpdate:modelValue":t[4]||=e=>g(p.value.lead.key,String(e))},null,8,[`model-value`])):(V(),U(P(BO),{key:2,"model-value":C(p.value.lead.key),onFocus:t[5]||=e=>_.value=p.value.lead.key,"onUpdate:modelValue":t[6]||=e=>g(p.value.lead.key,String(e))},null,8,[`model-value`])),c.value.length&&p.value.lead.kind!==`select`?(V(),H(`div`,gQ,[t[13]||=W(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(V(!0),H(B,null,R(c.value,e=>(V(),H(B,{key:e},[W(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>v(e,`summary`)},M(e),9,_Q),W(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>v(e,`result`)},M(e)+`.result`,9,vQ)],64))),128))])):q(``,!0)])):q(``,!0),p.value.compact.length?(V(),H(`section`,yQ,[(V(!0),H(B,null,R(p.value.compact,e=>(V(),H(`div`,{key:e.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[W(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:e.schema.description},[K(M(S(e.key,e.schema))+` `,1),e.schema.description?(V(),U(P(ld),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,bQ),e.kind===`boolean`?(V(),U(P(dk),{key:0,"model-value":s.value[e.key]===!0,"onUpdate:modelValue":t=>g(e.key,t||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):e.kind===`select`?(V(),H(`select`,{key:1,class:`h-7 max-w-40 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:C(e.key),onChange:t=>g(e.key,t.target.value||void 0)},[t[14]||=W(`option`,{value:``},`Default`,-1),(V(!0),H(B,null,R(e.schema.enum,e=>(V(),H(`option`,{key:e,value:e},M(e),9,SQ))),128))],40,xQ)):e.kind===`number`?(V(),H(`input`,{key:2,type:`number`,class:`h-7 w-24 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:s.value[e.key]??``,onInput:t=>g(e.key,t.target.value===``?void 0:Number(t.target.value))},null,40,CQ)):(V(),H(`input`,{key:3,class:`h-7 w-40 rounded-md border border-input bg-background px-2 text-[13px]`,value:C(e.key),onFocus:t=>_.value=e.key,onInput:t=>g(e.key,t.target.value)},null,40,wQ))]))),128))])):q(``,!0),(V(!0),H(B,null,R(p.value.long,e=>(V(),H(`section`,{key:e.key,class:`space-y-1.5`},[W(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[K(M(S(e.key,e.schema))+` `,1),e.schema.description?(V(),U(P(ld),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,TQ),e.kind===`text`?(V(),U(P(uT),{key:0,"model-value":C(e.key),class:`min-h-20 text-[13px]`,onFocus:t=>_.value=e.key,"onUpdate:modelValue":t=>g(e.key,String(t))},null,8,[`model-value`,`onFocus`,`onUpdate:modelValue`])):e.kind===`lines`?(V(),U(P(uT),{key:1,"model-value":Array.isArray(s.value[e.key])?s.value[e.key].join(`
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>g(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(V(),H(B,{key:2},[G(P($w),{"model-value":x(s.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>b(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),y.value[e.key]?(V(),H(`span`,DQ,M(y.value[e.key]),1)):q(``,!0)],64))]))),128)),W(`section`,OQ,[t[19]||=W(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),W(`div`,kQ,[W(`label`,AQ,[t[15]||=W(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),W(`input`,{class:`h-7 w-48 rounded-md border border-input bg-background px-2 font-mono text-xs`,placeholder:`always`,value:i.value.when??``,onInput:t[7]||=e=>h(`when`,e.target.value)},null,40,jQ)]),W(`label`,MQ,[t[17]||=W(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),W(`select`,{class:`h-7 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:i.value.on_failure??``,onChange:t[8]||=e=>h(`on_failure`,e.target.value||void 0)},[...t[16]||=[W(`option`,{value:``},`Park the task`,-1),W(`option`,{value:`continue`},`Continue`,-1)]],40,NQ)]),W(`label`,PQ,[t[18]||=W(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),W(`input`,{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:i.value.retry?.attempts??``,onInput:t[9]||=e=>h(`retry`,e.target.value===``?void 0:{...i.value.retry,attempts:Number(e.target.value)})},null,40,FQ)])])])]),W(`footer`,IQ,[G(P($),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[10]||=e=>r(`remove`)},{default:F(()=>[G(P(qd)),t[20]||=K(` Delete step`,-1)]),_:1}),G(P($),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[11]||=e=>r(`close`)},{default:F(()=>[...t[21]||=[K(`Done`,-1)]]),_:1})])]))}}),RQ=`repository_path`;function zQ(e,t,n){let r=[];for(let[n,i]of e){let e=t[n];e?.from===`path`&&e.path.trim()&&r.push({name:n,path:e.path.trim(),type:i.type??`string`,required:i.required===!0})}return n.trim()&&r.push({name:RQ,path:n.trim(),type:`string`,required:!0}),r}function BQ(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function VQ(e,t,n){let r=[];for(let[i,a]of e){let e=t[i],o=a.type??`string`;if(!(e&&(e.from===`path`?e.path.trim():e.value!==``))){a.required&&r.push(`${i} is required`);continue}if(e.from===`path`){let e=n?.failures?.find(e=>e.field_name===i);e&&r.push(`${i}: ${e.reason}`);continue}let s=BQ(RP(e.value,o));o!==`any`&&s!==o&&r.push(`${i} is ${o}, but ${JSON.stringify(e.value)} is not`)}return n?.failures?.some(e=>e.field_name===`repository_path`)&&r.push(`the repository path does not resolve`),r}function HQ(e,t){let n={};for(let[r,i]of e){let e=t[r];e?.from===`path`&&e.path.trim()?n[r]={param:r}:e?.from===`value`&&e.value!==``&&(n[r]={value:RP(e.value,i.type??`string`)})}return n}function UQ(e,t){let n=e=>t.find(t=>t.name===e)?.path??``,r={};for(let[t,i]of Object.entries(e.inputs??{}))r[t]=i.param?{from:`path`,path:n(i.param),value:``}:{from:`value`,path:``,value:typeof i.value==`string`?i.value:JSON.stringify(i.value)};return{rows:r,repositoryPath:n(e.repo_param)}}function WQ(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...WQ(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...WQ(n,r)]}):[]}function GQ(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function KQ(e){try{let t=JSON.parse(e.headers??`{}`);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]))}catch{return{}}}function qQ(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var JQ={class:`flex h-full flex-col`},YQ={class:`flex items-center gap-2 border-b border-border px-4 py-3`},XQ={class:`min-w-0 flex-1 truncate text-sm font-medium`},ZQ={key:0,class:`flex flex-1 items-center justify-center`},QQ={class:`space-y-1.5`},$Q=[`disabled`],e$=[`value`],t$={key:0,class:`space-y-1.5`},n$=[`value`],r$=[`title`],i$={class:`space-y-1.5`},a$={id:`bind-paths`},o$=[`value`],s$={class:`divide-y divide-border rounded-md border border-border`},c$={class:`flex items-center gap-1.5 text-xs`},l$={class:`font-mono`},u$={class:`text-fg-subtle`},d$={key:0,class:`text-danger`,title:`Required`},f$=[`title`,`aria-label`,`onClick`],p$=[`onUpdate:modelValue`,`aria-label`],m$=[`onUpdate:modelValue`,`aria-label`],h$={key:2,class:`text-xs text-danger`},g$=[`title`],_$={key:0,class:`space-y-1 px-3 py-2`},v$={key:0,class:`text-xs text-danger`},y$={key:1,class:`truncate font-mono text-xs text-success`},b$={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},x$={class:`space-y-2`},S$={key:0,role:`alert`,class:`text-xs text-danger`},C$={key:1,class:`text-xs text-fg-subtle`},w$={class:`flex gap-2`},T$=`__new__`,E$=L({__name:`BindEvent`,props:{yaml:{},binding:{}},emits:[`back`,`saved`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>String(zZ(n.yaml,`id`)??``)),a=Y(()= Line truncated
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(V(),H(B,{key:2},[G(P(uT),{"model-value":x(s.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>b(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),y.value[e.key]?(V(),H(`span`,EQ,M(y.value[e.key]),1)):q(``,!0)],64))]))),128)),W(`section`,DQ,[t[19]||=W(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),W(`div`,OQ,[W(`label`,kQ,[t[15]||=W(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),W(`input`,{class:`h-7 w-48 rounded-md border border-input bg-background px-2 font-mono text-xs`,placeholder:`always`,value:i.value.when??``,onInput:t[7]||=e=>h(`when`,e.target.value)},null,40,AQ)]),W(`label`,jQ,[t[17]||=W(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),W(`select`,{class:`h-7 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:i.value.on_failure??``,onChange:t[8]||=e=>h(`on_failure`,e.target.value||void 0)},[...t[16]||=[W(`option`,{value:``},`Park the task`,-1),W(`option`,{value:`continue`},`Continue`,-1)]],40,MQ)]),W(`label`,NQ,[t[18]||=W(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),W(`input`,{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:i.value.retry?.attempts??``,onInput:t[9]||=e=>h(`retry`,e.target.value===``?void 0:{...i.value.retry,attempts:Number(e.target.value)})},null,40,PQ)])])])]),W(`footer`,FQ,[G(P($),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[10]||=e=>r(`remove`)},{default:F(()=>[G(P(Hd)),t[20]||=K(` Delete step`,-1)]),_:1}),G(P($),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[11]||=e=>r(`close`)},{default:F(()=>[...t[21]||=[K(`Done`,-1)]]),_:1})])]))}}),LQ=`repository_path`;function RQ(e,t,n){let r=[];for(let[n,i]of e){let e=t[n];e?.from===`path`&&e.path.trim()&&r.push({name:n,path:e.path.trim(),type:i.type??`string`,required:i.required===!0})}return n.trim()&&r.push({name:LQ,path:n.trim(),type:`string`,required:!0}),r}function zQ(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function BQ(e,t,n){let r=[];for(let[i,a]of e){let e=t[i],o=a.type??`string`;if(!(e&&(e.from===`path`?e.path.trim():e.value!==``))){a.required&&r.push(`${i} is required`);continue}if(e.from===`path`){let e=n?.failures?.find(e=>e.field_name===i);e&&r.push(`${i}: ${e.reason}`);continue}let s=zQ(LP(e.value,o));o!==`any`&&s!==o&&r.push(`${i} is ${o}, but ${JSON.stringify(e.value)} is not`)}return n?.failures?.some(e=>e.field_name===`repository_path`)&&r.push(`the repository path does not resolve`),r}function VQ(e,t){let n={};for(let[r,i]of e){let e=t[r];e?.from===`path`&&e.path.trim()?n[r]={param:r}:e?.from===`value`&&e.value!==``&&(n[r]={value:LP(e.value,i.type??`string`)})}return n}function HQ(e,t){let n=e=>t.find(t=>t.name===e)?.path??``,r={};for(let[t,i]of Object.entries(e.inputs??{}))r[t]=i.param?{from:`path`,path:n(i.param),value:``}:{from:`value`,path:``,value:typeof i.value==`string`?i.value:JSON.stringify(i.value)};return{rows:r,repositoryPath:n(e.repo_param)}}function UQ(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...UQ(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...UQ(n,r)]}):[]}function WQ(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function GQ(e){try{let t=JSON.parse(e.headers??`{}`);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]))}catch{return{}}}function KQ(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var qQ={class:`flex h-full flex-col`},JQ={class:`flex items-center gap-2 border-b border-border px-4 py-3`},YQ={class:`min-w-0 flex-1 truncate text-sm font-medium`},XQ={key:0,class:`flex flex-1 items-center justify-center`},ZQ={class:`space-y-1.5`},QQ=[`disabled`],$Q=[`value`],e$={key:1,class:`space-y-1.5`},t$=[`value`],n$=[`title`],r$={class:`space-y-1.5`},i$={id:`bind-paths`},a$=[`value`],o$={class:`divide-y divide-border rounded-md border border-border`},s$={class:`flex items-center gap-1.5 text-xs`},c$={class:`font-mono`},l$={class:`text-fg-subtle`},u$={key:0,class:`text-danger`,title:`Required`},d$=[`title`,`aria-label`,`onClick`],f$=[`onUpdate:modelValue`,`aria-label`],p$=[`onUpdate:modelValue`,`aria-label`],m$={key:2,class:`text-xs text-danger`},h$=[`title`],g$={key:0,class:`space-y-1 px-3 py-2`},_$={key:0,class:`text-xs text-danger`},v$={key:1,class:`truncate font-mono text-xs text-success`},y$={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},b$={class:`space-y-2`},x$={key:0,role:`alert`,class:`text-xs text-danger`},S$={key:1,class:`text-xs text-fg-subtle`},C$={class:`flex gap-2`},w$=`__new__`,T$=L({__name:`BindEvent`,props:{yaml:{},binding:{}},emits:[`back`,`saved`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>String(RZ(n.yaml,`id`)??``)),a=Y(()= Line truncated
`).replace(`
`,`
+`).split(`
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function u5(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=d5(n.code,e);return Array.isArray(e)?e.some(e=>l5(n[r],e,t,n.type===`keyup`)):l5(n[r],e,t,n.type===`keyup`)}}function d5(e,t){return t.includes(e)?`code`:`key`}function f5(e,t){let n=Y(()=>pn(t?.target)??o5),r=ln(pn(e)===!0),i=!1,a=new Set,o=c(pn(e));I(()=>pn(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),i0([`blur`,`contextmenu`],s),o0((...e)=>o(...e),e=>{let n=pn(t?.actInsideInputWithModifier)??!0,a=pn(t?.preventDefault)??!1;if(i=c5(e),(!i||i&&!n)&&s5(e))return;let o=e.composedPath?.call(e)?.[0]||e.target,s=o?.nodeName===`BUTTON`||o?.nodeName===`A`;!a&&(i||!s)&&e.preventDefault(),r.value=!0},{eventName:`keydown`,target:n}),o0((...e)=>o(...e),e=>{let n=pn(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&s5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=pn(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?u5(e,a):e}return r}var p5=`vue-flow__node-desc`,m5=`vue-flow__edge-desc`,h5=`vue-flow__aria-live`,g5=[`Enter`,` `,`Escape`],_5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function v5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function y5(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)}function b5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function x5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function S5(e,t){return{x:x5(e.x,t[0][0],t[1][0]),y:x5(e.y,t[0][1],t[1][1])}}function C5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function w5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function T5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!w5(e)}function E5(e){return T5(e)&&`computedPosition`in e}function D5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function O5(e){return D5(e.width)&&D5(e.height)&&D5(e.x)&&D5(e.y)}function k5(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:an({width:0,height:0}),computedPosition:an({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:K7(e.data)?e.data:{},events:an(K7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function A5(e,t,n){let r={id:e.id.toString(),type:e.type??t?.type??`default`,source:e.source.toString(),target:e.target.toString(),sourceHandle:e.sourceHandle?.toString(),targetHandle:e.targetHandle?.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:K7(e.data)?e.data:{},events:an(K7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function j5(e,t,n,r){let i=typeof e==`string`?e:e.id,a=new Set,o=r===`source`?`target`:`source`;for(let e of n)e[o]===i&&a.add(e[r]);return t.filter(e=>a.has(e.id))}function M5(...e){if(e.length===3){let[t,n,r]=e;return j5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>w5(e)&&e.source===r).map(e=>n.find(t=>T5(t)&&t.id===e.target))}function N5(...e){if(e.length===3){let[t,n,r]=e;return j5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>w5(e)&&e.target===r).map(e=>n.find(t=>T5(t)&&t.id===e.source))}function P5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function F5(e,t){return t.some(t=>w5(t)&&t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle))}function I5({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function L5({x:e,y:t},{x:n,y:r,zoom:i},a=!1,o=[1,1]){let s={x:(e-n)/i,y:(t-r)/i};return a?k7(s,o):s}function R5(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function z5({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function B5({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function V5(e){let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};for(let n=0;n<e.length;n++){let r=e[n];t=R5(t,z5({...r.computedPosition,...r.dimensions}))}return B5(t)}function H5(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...L5(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= Line truncated
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function l5(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=u5(n.code,e);return Array.isArray(e)?e.some(e=>c5(n[r],e,t,n.type===`keyup`)):c5(n[r],e,t,n.type===`keyup`)}}function u5(e,t){return t.includes(e)?`code`:`key`}function d5(e,t){let n=Y(()=>fn(t?.target)??a5),r=cn(fn(e)===!0),i=!1,a=new Set,o=c(fn(e));I(()=>fn(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),r0([`blur`,`contextmenu`],s),a0((...e)=>o(...e),e=>{let n=fn(t?.actInsideInputWithModifier)??!0,a=fn(t?.preventDefault)??!1;if(i=s5(e),(!i||i&&!n)&&o5(e))return;let o=e.composedPath?.call(e)?.[0]||e.target,s=o?.nodeName===`BUTTON`||o?.nodeName===`A`;!a&&(i||!s)&&e.preventDefault(),r.value=!0},{eventName:`keydown`,target:n}),a0((...e)=>o(...e),e=>{let n=fn(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&o5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=fn(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?l5(e,a):e}return r}var f5=`vue-flow__node-desc`,p5=`vue-flow__edge-desc`,m5=`vue-flow__aria-live`,h5=[`Enter`,` `,`Escape`],g5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function _5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function v5(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)}function y5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function b5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function x5(e,t){return{x:b5(e.x,t[0][0],t[1][0]),y:b5(e.y,t[0][1],t[1][1])}}function S5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function C5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function w5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!C5(e)}function T5(e){return w5(e)&&`computedPosition`in e}function E5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function D5(e){return E5(e.width)&&E5(e.height)&&E5(e.x)&&E5(e.y)}function O5(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:rn({width:0,height:0}),computedPosition:rn({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:G7(e.data)?e.data:{},events:rn(G7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function k5(e,t,n){let r={id:e.id.toString(),type:e.type??t?.type??`default`,source:e.source.toString(),target:e.target.toString(),sourceHandle:e.sourceHandle?.toString(),targetHandle:e.targetHandle?.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:G7(e.data)?e.data:{},events:rn(G7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function A5(e,t,n,r){let i=typeof e==`string`?e:e.id,a=new Set,o=r===`source`?`target`:`source`;for(let e of n)e[o]===i&&a.add(e[r]);return t.filter(e=>a.has(e.id))}function j5(...e){if(e.length===3){let[t,n,r]=e;return A5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>C5(e)&&e.source===r).map(e=>n.find(t=>w5(t)&&t.id===e.target))}function M5(...e){if(e.length===3){let[t,n,r]=e;return A5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>C5(e)&&e.target===r).map(e=>n.find(t=>w5(t)&&t.id===e.source))}function N5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function P5(e,t){return t.some(t=>C5(t)&&t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle))}function F5({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function I5({x:e,y:t},{x:n,y:r,zoom:i},a=!1,o=[1,1]){let s={x:(e-n)/i,y:(t-r)/i};return a?O7(s,o):s}function L5(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function R5({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function z5({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function B5(e){let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};for(let n=0;n<e.length;n++){let r=e[n];t=L5(t,R5({...r.computedPosition,...r.dimensions}))}return z5(t)}function V5(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...I5(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= Line truncated
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
Node: ${e}
@@ -153,4 +153,4 @@ Edge: ${e}
Source: ${t}
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},C7=class extends Error{constructor(e,...t){super(S7[e]?.call(S7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function w7(e){return`clientX`in e}function T7(e){return`sourceEvent`in e}function E7(e,t){let n=w7(e),r,i;return n?(r=e.clientX,i=e.clientY):`touches`in e&&e.touches.length>0?(r=e.touches[0].clientX,i=e.touches[0].clientY):`changedTouches`in e&&e.changedTouches.length>0?(r=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(r=0,i=0),{x:r-(t?.left??0),y:i-(t?.top??0)}}var D7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function O7(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function k7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var A7=()=>!0;function j7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function M7(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())y5(i,v5(e))>0&&r.push(e);return r}var N7=250;function P7(e,t,n,r){let i=[],a=1/0,o=M7(e,n,t+N7);for(let n of o){let o=[...n.handleBounds?.source??[],...n.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=_7(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function F7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=A7},u,d,f,p){let m=a===`target`,h=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:_}=E7(e),v=o.elementFromPoint(g,_),y=v?.classList.contains(`${s}-flow__handle`)?v:h,b={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){let e=I7(void 0,y),t=y.getAttribute(`data-nodeid`),a=y.getAttribute(`data-handleid`),o=y.classList.contains(`connectable`),s=y.classList.contains(`connectableend`);if(!t||!e)return b;let c={source:m?t:r,sourceHandle:m?a:i,target:m?r:t,targetHandle:m?i:a};b.connection=c,b.isValid=o&&s&&(n===t5.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=z7(t,e,a,p,n,!0)}return b}function I7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function L7(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function R7(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function z7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===t5.Strict?o.handleBounds?.[t]:[...o.handleBounds?.source??[],...o.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,..._7(o,c,c.position,!0)}:c}var B7={[Q8.Left]:Q8.Right,[Q8.Right]:Q8.Left,[Q8.Top]:Q8.Bottom,[Q8.Bottom]:Q8.Top},V7=[`production`,`prod`];function H7(e,...t){U7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function U7(){return!V7.includes(`production`)}function W7(e,t,n,r,i){let a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a?.length?Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...b5(t)}}):null}function G7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),Jn(()=>{o.blur()})):n([e])}function K7(e){return P(e)!==void 0}function gte(e,t,n,r){if(!e||!e.source||!e.target)return n(new C7(x7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=w5(e)?e:{...e,id:P5(e)},i=A5(i,void 0,r),!F5(i,t)&&i}function _te(e,t,n,r,i){if(!t.source||!t.target)return i(new C7(x7.EDGE_INVALID,e.id)),!1;if(!n)return i(new C7(x7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?P5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function q7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!T5(o)){n(new C7(x7.NODE_INVALID,o?.id));continue}let s=k5(o,t(o.id),o.parentNode);o.parentNode&&(r[o.parentNode]=!0),i[a]=s}for(let e of i){let a=t(e.parentNode)||i.find(t=>t.id===e.parentNode);e.parentNode&&!a&&n(new C7(x7.NODE_MISSING_PARENT,e.id,e.parentNode)),(e.parentNode||r[e.id])&&(r[e.id]&&(e.isParent=!0),a&&(a.isParent=!0))}return i}function J7(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function Y7(e,t,n){e.clear();for(let t of n){let{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=t,o={edgeId:t.id,source:n,target:r,sourceHandle:i,targetHandle:a},s=`${n}-${i}--${r}-${a}`;J7(`source`,o,`${r}-${a}Line truncated
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},S7=class extends Error{constructor(e,...t){super(x7[e]?.call(x7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function C7(e){return`clientX`in e}function w7(e){return`sourceEvent`in e}function T7(e,t){let n=C7(e),r,i;return n?(r=e.clientX,i=e.clientY):`touches`in e&&e.touches.length>0?(r=e.touches[0].clientX,i=e.touches[0].clientY):`changedTouches`in e&&e.changedTouches.length>0?(r=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(r=0,i=0),{x:r-(t?.left??0),y:i-(t?.top??0)}}var E7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function D7(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function O7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var k7=()=>!0;function A7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function j7(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())v5(i,_5(e))>0&&r.push(e);return r}var M7=250;function N7(e,t,n,r){let i=[],a=1/0,o=j7(e,n,t+M7);for(let n of o){let o=[...n.handleBounds?.source??[],...n.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=g7(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function P7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=k7},u,d,f,p){let m=a===`target`,h=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:_}=T7(e),v=o.elementFromPoint(g,_),y=v?.classList.contains(`${s}-flow__handle`)?v:h,b={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){let e=F7(void 0,y),t=y.getAttribute(`data-nodeid`),a=y.getAttribute(`data-handleid`),o=y.classList.contains(`connectable`),s=y.classList.contains(`connectableend`);if(!t||!e)return b;let c={source:m?t:r,sourceHandle:m?a:i,target:m?r:t,targetHandle:m?i:a};b.connection=c,b.isValid=o&&s&&(n===e5.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=R7(t,e,a,p,n,!0)}return b}function F7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function I7(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function L7(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function R7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===e5.Strict?o.handleBounds?.[t]:[...o.handleBounds?.source??[],...o.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...g7(o,c,c.position,!0)}:c}var z7={[Z8.Left]:Z8.Right,[Z8.Right]:Z8.Left,[Z8.Top]:Z8.Bottom,[Z8.Bottom]:Z8.Top},B7=[`production`,`prod`];function V7(e,...t){H7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function H7(){return!B7.includes(`production`)}function U7(e,t,n,r,i){let a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a?.length?Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...y5(t)}}):null}function W7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),Kn(()=>{o.blur()})):n([e])}function G7(e){return P(e)!==void 0}function yte(e,t,n,r){if(!e||!e.source||!e.target)return n(new S7(b7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=C5(e)?e:{...e,id:N5(e)},i=k5(i,void 0,r),!P5(i,t)&&i}function bte(e,t,n,r,i){if(!t.source||!t.target)return i(new S7(b7.EDGE_INVALID,e.id)),!1;if(!n)return i(new S7(b7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?N5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function K7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!w5(o)){n(new S7(b7.NODE_INVALID,o?.id));continue}let s=O5(o,t(o.id),o.parentNode);o.parentNode&&(r[o.parentNode]=!0),i[a]=s}for(let e of i){let a=t(e.parentNode)||i.find(t=>t.id===e.parentNode);e.parentNode&&!a&&n(new S7(b7.NODE_MISSING_PARENT,e.id,e.parentNode)),(e.parentNode||r[e.id])&&(r[e.id]&&(e.isParent=!0),a&&(a.isParent=!0))}return i}function q7(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function J7(e,t,n){e.clear();for(let t of n){let{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=t,o={edgeId:t.id,source:n,target:r,sourceHandle:i,targetHandle:a},s=`${n}-${i}--${r}-${a}`;q7(`source`,o,`${r}-${a}Line truncated
+55
View File
@@ -0,0 +1,55 @@
<script setup lang="ts">
import { computed, ref } from "vue";
import { Check, Copy, KeyRound, X } from "@lucide/vue";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { sourceURL, type Source } from "./source-signing";
const props = defineProps<{ source: Source }>();
const emit = defineEmits<{ dismiss: [] }>();
const url = computed(() => sourceURL(window.location.origin, props.source.path));
const copied = ref<string | null>(null);
async function copy(value: string): Promise<void> {
await navigator.clipboard.writeText(value);
copied.value = value;
setTimeout(() => (copied.value = null), 1500);
}
</script>
<template>
<Alert>
<KeyRound />
<AlertTitle class="flex items-center justify-between gap-2 text-xs">
<span class="font-mono"
>{{ source.path }} · signing secret, shown once</span
>
<Button
type="button"
variant="ghost"
size="icon-sm"
aria-label="Dismiss"
@click="emit('dismiss')"
><X
/></Button>
</AlertTitle>
<AlertDescription class="col-start-2 flex items-center gap-2">
<code class="min-w-0 flex-1 break-all font-mono text-xs">{{ url }}</code>
<Button type="button" variant="ghost" size="icon-sm" aria-label="Copy URL" @click="copy(url)"><Check v-if="copied === url" /><Copy v-else /></Button>
</AlertDescription>
<AlertDescription class="col-start-2 flex items-center gap-2">
<code class="min-w-0 flex-1 break-all font-mono text-xs">{{
source.secret
}}</code>
<Button
type="button"
variant="ghost"
size="icon-sm"
aria-label="Copy secret"
@click="copy(source.secret || '')"
>
<Check v-if="copied === source.secret" />
<Copy v-else />
</Button>
</AlertDescription>
</Alert>
</template>
+3 -30
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { Check, Copy, KeyRound, Lock, LockOpen, Plus, X } from "@lucide/vue";
import { Check, Copy, KeyRound, Lock, LockOpen, Plus } from "@lucide/vue";
import { onMounted, ref } from "vue";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
@@ -27,6 +27,7 @@ import {
sourceURL,
type Source,
} from "./source-signing";
import SourceSecret from "./SourceSecret.vue";
import { useSources } from "./use-sources";
/**
@@ -93,35 +94,7 @@ function url(source: Source): string {
<AlertDescription>{{ failure }}</AlertDescription>
</Alert>
<Alert v-if="revealed">
<KeyRound />
<AlertTitle class="flex items-center justify-between gap-2">
<span class="font-mono"
>{{ revealed.path }} · signing secret, shown once</span
>
<Button
variant="ghost"
size="icon-sm"
aria-label="Dismiss"
@click="revealed = null"
><X
/></Button>
</AlertTitle>
<AlertDescription class="flex items-center gap-2">
<code class="min-w-0 break-all font-mono text-xs">{{
revealed.secret
}}</code>
<Button
variant="ghost"
size="icon-sm"
aria-label="Copy secret"
@click="copy(revealed.secret || '')"
>
<Check v-if="copied === revealed.secret" />
<Copy v-else />
</Button>
</AlertDescription>
</Alert>
<SourceSecret v-if="revealed" :source="revealed" @dismiss="revealed = null" />
<Card v-if="sources && sources.length">
<CardContent>
+25 -2
View File
@@ -9,7 +9,8 @@ import { api } from "@/lib/api";
import { useLiveResource } from "@/stores/live-updates";
import { statusKind, statusLabel, takesRepository, type Binding } from "@/bindings/binding-draft";
import type { Capture } from "@/captures/state";
import { sourceURL } from "@/sources/source-signing";
import SourceSecret from "@/sources/SourceSecret.vue";
import { sourceURL, type Source } from "@/sources/source-signing";
import type { EventType } from "@/captures/event-types";
import type { Mapping, Preview } from "@/mappings/state";
import {
@@ -51,6 +52,8 @@ const rows = ref<Record<string, InputRow>>({});
const repositoryPath = ref("");
const preview = ref<Preview | null>(null);
const saving = ref(false);
const creatingSource = ref(false);
const revealed = ref<Source | null>(null);
const error = ref("");
const status = ref(props.binding?.status ?? "");
@@ -113,6 +116,7 @@ watch([fields, captureId], () => {
const blockers = computed(() => {
if (!sourcePath.value) return ["pick a source"];
if (source.value === NEW_SOURCE) return ["create the source first"];
if (!capture.value) return [`no event from ${sourcePath.value} yet to preview against`];
if (payload.value === null) return ["the picked event's body is not JSON"];
return problems(inputs.value, rows.value, preview.value);
@@ -148,12 +152,28 @@ async function eventTypeFor(c: Capture): Promise<string> {
return created.id;
}
async function createSource(): Promise<void> {
if (!sourcePath.value || creatingSource.value) return;
creatingSource.value = true;
error.value = "";
try {
const created = await api.sourceCreate<Source>(sourcePath.value);
revealed.value = created;
sources.value.push(created.path);
source.value = created.path;
newSource.value = "";
} catch (err) {
error.value = err instanceof Error ? err.message : String(err);
} finally {
creatingSource.value = false;
}
}
async function save(): Promise<void> {
if (blockers.value.length || !capture.value) return;
saving.value = true;
error.value = "";
try {
if (source.value === NEW_SOURCE && !sources.value.includes(sourcePath.value)) await api.sourceCreate(sourcePath.value);
const mappingBody = {
name: `${workflow.value} ← ${sourcePath.value}`,
event_type_id: await eventTypeFor(capture.value),
@@ -221,8 +241,11 @@ async function approve(): Promise<void> {
placeholder="path, e.g. alertmanager"
class="h-8 w-full rounded-md border border-input bg-background px-2 font-mono text-[13px]"
/>
<Button v-if="source === NEW_SOURCE" type="button" size="sm" :disabled="creatingSource || !sourcePath" @click="createSource"><Spinner v-if="creatingSource" />Create source</Button>
</section>
<SourceSecret v-if="revealed" :source="revealed" @dismiss="revealed = null" />
<section v-if="sourcePath" class="space-y-1.5">
<label for="bind-capture" class="text-xs font-medium text-muted-foreground">Example event</label>
<select v-if="sourceCaptures.length" id="bind-capture" v-model="captureId" class="h-8 w-full rounded-md border border-input bg-background px-2 text-[13px]">