fix(webui): explain personal token availability

This commit is contained in:
sam committed 2026-10-09 09:57:57 +11:00
1 parent 84d1286211
commit b03a610535
4 files changed
+114 -69

No files matched your search

+20 -5
View File
@@ -3,6 +3,7 @@ package webui
import (
"net/http"
"github.com/samcharles93/archie-core/internal/domain/access"
"github.com/samcharles93/archie-core/internal/domain/identity"
)
@@ -10,7 +11,11 @@ import (
// on the principal the request carries, so these handlers name no one.
func (s *Server) handlePersonalTokensList(w http.ResponseWriter, r *http.Request) {
if !s.personalTokensReady(w) {
if !personalTokenOwner(r) {
writeJSON(w, map[string]any{"tokens": []identity.PersonalToken{}, "available": false})
return
}
if !s.personalTokensReady(w, r) {
return
}
tokens, err := s.PersonalTokens.ListPersonalTokens(r.Context())
@@ -21,13 +26,13 @@ func (s *Server) handlePersonalTokensList(w http.ResponseWriter, r *http.Request
if tokens == nil {
tokens = []identity.PersonalToken{}
}
writeJSON(w, map[string]any{"tokens": tokens})
writeJSON(w, map[string]any{"tokens": tokens, "available": true})
}
// handlePersonalTokenCreate makes a token here and sends only its hash to the
// State Store; the response is the one time the token is shown.
func (s *Server) handlePersonalTokenCreate(w http.ResponseWriter, r *http.Request) {
if !s.personalTokensReady(w) {
if !s.personalTokensReady(w, r) {
return
}
raw, subject, err := identity.NewPersonalToken()
@@ -45,7 +50,7 @@ func (s *Server) handlePersonalTokenCreate(w http.ResponseWriter, r *http.Reques
}
func (s *Server) handlePersonalTokenRevoke(w http.ResponseWriter, r *http.Request) {
if !s.personalTokensReady(w) {
if !s.personalTokensReady(w, r) {
return
}
if err := s.PersonalTokens.RevokePersonalToken(r.Context(), r.PathValue("id")); err != nil {
@@ -55,7 +60,17 @@ func (s *Server) handlePersonalTokenRevoke(w http.ResponseWriter, r *http.Reques
w.WriteHeader(http.StatusNoContent)
}
func (s *Server) personalTokensReady(w http.ResponseWriter) bool {
func personalTokenOwner(r *http.Request) bool {
p, ok := access.PrincipalFromContext(r.Context())
return ok && p.IdentityID != "" && p.IdentityID != identity.SystemID
}
func (s *Server) personalTokensReady(w http.ResponseWriter, r *http.Request) bool {
if !personalTokenOwner(r) {
http.Error(w, "Personal tokens need a signed-in person.", http.StatusForbidden)
return false
}
if s.PersonalTokens == nil {
http.Error(w, "personal tokens unavailable", http.StatusServiceUnavailable)
return false
+26
View File
@@ -4,6 +4,7 @@ import (
"context"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/samcharles93/archie-core/internal/domain/access"
@@ -145,3 +146,28 @@ func TestAdministrationRoutes(t *testing.T) {
})
}
}
func TestPersonalTokensWithoutPerson(t *testing.T) {
for _, method := range []string{http.MethodGet, http.MethodPost, http.MethodDelete} {
t.Run(method, func(t *testing.T) {
s := &Server{PersonalTokens: &recordingTokens{}}
req := httptest.NewRequestWithContext(access.WithPrincipal(t.Context(), access.SharedTokenOwner()), method, "/api/tokens", nil)
rec := httptest.NewRecorder()
switch method {
case http.MethodGet:
s.handlePersonalTokensList(rec, req)
case http.MethodPost:
s.handlePersonalTokenCreate(rec, req)
case http.MethodDelete:
s.handlePersonalTokenRevoke(rec, req)
}
if method == http.MethodGet {
if rec.Code != http.StatusOK || !strings.Contains(rec.Body.String(), `"available":false`) {
t.Fatalf("list without person = %d %s", rec.Code, rec.Body.String())
}
} else if rec.Code != http.StatusForbidden || strings.TrimSpace(rec.Body.String()) != "Personal tokens need a signed-in person." {
t.Fatalf("mutation without person = %d %s", rec.Code, rec.Body.String())
}
})
}
}
+61 -61
View File
@@ -14,57 +14,57 @@ Defaulting to \`null\`.`),null)}function op(e){return ip(e)&&!Number.isNaN(e)&&e
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=Wg(c),u=e+1<n.length?Wg(n[e+1]):null;if(l&&u&&Gg(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=Wg(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>Hg(e)),rows:r.map(e=>e.map(e=>Hg(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:Hg(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:Hg(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function Wg(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 Gg(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Kg={class:`[overflow-wrap:anywhere]`},qg={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Jg={class:`font-mono text-[0.85em]`},Yg={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Xg={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Zg={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Qg={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},$g={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},e_={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},t_={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},n_={key:8,class:`mb-2.5 last:mb-0`},r_=n({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=M(()=>Ug(t.text));return(e,t)=>(P(),V(`div`,Kg,[(P(!0),V(R,null,H(n.value,(e,t)=>(P(),V(R,{key:t},[e.kind===`pre`?(P(),V(`pre`,qg,[B(`code`,Jg,L(e.code),1)])):e.kind===`table`?(P(),V(`table`,Yg,[B(`thead`,null,[B(`tr`,null,[(P(!0),V(R,null,H(e.head,(e,t)=>(P(),V(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[O(Bg,{inline:e},null,8,[`inline`])]))),128))])]),B(`tbody`,null,[(P(!0),V(R,null,H(e.rows,(e,t)=>(P(),V(`tr`,{key:t},[(P(!0),V(R,null,H(e,(e,t)=>(P(),V(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[O(Bg,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(P(),V(`blockquote`,Xg,[O(Bg,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(P(),V(`h1`,Zg,[O(Bg,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(P(),V(`h2`,Qg,[O(Bg,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(P(),V(`h3`,$g,[O(Bg,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(P(),V(`ul`,e_,[(P(!0),V(R,null,H(e.items,(e,t)=>(P(),V(`li`,{key:t},[O(Bg,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(P(),V(`ol`,t_,[(P(!0),V(R,null,H(e.items,(e,t)=>(P(),V(`li`,{key:t},[O(Bg,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(P(),V(`p`,n_,[O(Bg,{inline:e.inline},null,8,[`inline`])])):N(``,!0)],64))),128))]))}}),i_={class:`truncate`},a_=n({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=c(`RouterLink`);return P(),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:C(()=>[O(F(ir),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),B(`span`,i_,L(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),o_={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},s_={class:`font-semibold text-foreground`},c_={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},l_=n({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=M(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=M(()=>t.tool.parameters||t.tool.Parameters||``),i=M(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=M(()=>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?(P(),U(a_,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(P(),V(`div`,o_,[O(F(ai),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),B(`span`,s_,L(n.value),1),r.value?(P(),V(`code`,c_,L(r.value),1)):N(``,!0),B(`span`,{class:k(F(G)(`text-fg-muted`,i.value&&`text-danger`))},L(a.value),3)]))}}),u_={key:0,class:`mb-2 grid gap-0.5 text-xs`},d_={key:1,class:`mb-2 flex flex-wrap gap-1.5`},f_={key:3,class:`whitespace-pre-wrap`},p_=n({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(P(),V(`div`,{class:k([`flex`,e.assistant?`justify-start`:`justify-end`])},[B(`div`,{class:k(F(G)(`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?(P(),V(`div`,u_,[(P(!0),V(R,null,H(e.tools,(t,n)=>(P(),U(l_,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):N(``,!0),e.media.length?(P(),V(`div`,d_,[(P(!0),V(R,null,H(e.media,(e,t)=>(P(),U(Ng,{key:t,attachment:e},null,8,[`attachment`]))),128))])):N(``,!0),e.assistant?(P(),U(r_,{key:2,text:e.text},null,8,[`text`])):(P(),V(`div`,f_,L(e.text),1)),A(t.$slots,`default`)],2)],2))}}),m_={class:`text-sm`},h_={class:`font-medium`},g_={key:0,class:`mt-1 text-fg-muted`},__={key:1,class:`mt-2 flex flex-wrap gap-2`},v_=n({__name:`ChatChoLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>CS?`${n.slice(0,CS).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var TS=[`title`],ES=n({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=M(()=>Zx(n.event)),a=M(()=>wS(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=M(()=>n.event.at?$b(n.event.at):`—`);return(e,t)=>(P(),U(F(xS),{class:k(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:[dn(un(o,[`prevent`]),[`enter`]),dn(un(o,[`prevent`]),[`space`])]},{default:C(()=>[O(F(Z),{class:`font-medium`},{default:C(()=>[l(L(n.event.kind||n.event.type||`event`),1)]),_:1}),O(F(Z),{class:`font-mono`},{default:C(()=>[l(L(i.value>0?`#${i.value}`:`—`),1)]),_:1}),O(F(Z),{class:`w-[55%] max-w-0`},{default:C(()=>[B(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},L(a.value.text),9,TS)]),_:1}),O(F(Z),null,{default:C(()=>[l(L(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),DS=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function OS(e){return(Number(e?.task_id)||0)>0}function kS(e,t){return t===`tasks`?OS(e):t!==`system`||!OS(e)}function AS(e,t){return e.filter(e=>kS(e,t))}function jS(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function MS(e,t){return`${e}:${t??0}`}function NS(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=MS(wS(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 PS={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},FS={class:`max-h-[28rem] overflow-y-auto`},IS=[`aria-expanded`,`aria-label`,`onClick`],LS=[`title`],RS=n({__name:`LiveActivityCard`,setup(e){let t=rv(),{activity:n,streamKind:r,streamState:i}=kn(An()),a=W(`all`),o=M(()=>AS(n.value,a.value)),s=M(()=>jS(o.value.length,a.value)),c=je(new Set),u=M(()=>NS(o.value));function d(e){c.has(e)?c.delete(e):c.add(e)}function f(e){return c.has(e.key)}function p(e){return wS(e.representative)}function m(e){return e.representative.at?$b(e.representative.at):`—`}function h(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(P(),U(F(Kb),null,{default:C(()=>[O(F(Zb),null,{default:C(()=>[O(F(Qb),null,{default:C(()=>[...t[1]||=[l(`Live activity`,-1)]]),_:1}),O(F(qb),{class:`flex items-center gap-2`},{default:C(()=>[O(F(_S),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:F(DS)},null,8,[`modelValue`,`options`]),O(F(xn),{variant:F(r)},{default:C(()=>[l(L(F(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),O(F(Jb),null,{default:C(()=>[B(`div`,PS,[B(`div`,FS,[O(F(yS),null,{default:C(()=>[O(F(SS),{class:`sticky top-0 z-10 bg-card`},{default:C(()=>[O(F(xS),null,{default:C(()=>[O(F(Q),null,{default:C(()=>[...t[2]||=[l(`Event`,-1)]]),_:1}),O(F(Q),null,{default:C(()=>[...t[3]||=[l(`Task`,-1)]]),_:1}),O(F(Q),null,{default:C(()=>[...t[4]||=[l(`Detail`,-1)]]),_:1}),O(F(Q),null,{default:C(()=>[...t[5]||=[l(`When`,-1)]]),_:1})]),_:1})]),_:1}),O(F(bS),null,{default:C(()=>[o.value.length?N(``,!0):(P(),U(F(xS),{key:0},{default:C(()=>[O(F(Z),{colspan:`4`},{default:C(()=>[O(F(Lb),null,{default:C(()=>[O(F(Bb),null,{default:C(()=>[O(F(Ub),null,{default:C(()=>[l(L(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(P(!0),V(R,{key:1},H(u.value,e=>(P(),V(R,{key:e.key},[e.count===1?(P(),U(ES,{key:0,event:e.representative,onOpen:h},null,8,[`event`])):(P(),V(R,{key:1},[O(F(xS),{class:k(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&&h(e.taskID),onKeydown:[dn(un(t=>e.taskID>0&&h(e.taskID),[`prevent`]),[`enter`]),dn(un(t=>e.taskID>0&&h(e.taskID),[`prevent`]),[`space`])]},{default:C(()=>[O(F(Z),{class:`font-medium`},{default:C(()=>[B(`button`,{type:`button`,class:`inline-flex items-center gap-1 rounded hover:opacity-80`,"aria-expanded":f(e),"aria-label":`${f(e)?`Hide`:`Show`} ${e.count} ${e.label} events`,onClick:un(t=>d(e.key),[`stop`])},[f(e)?(P(),U(F(dr),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(P(),U(F(fr),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),l(` `+L(e.label)+` `,1),O(F(xn),{variant:`idle`},{default:C(()=>[l(`×`+L(e.count),1)]),_:2},1024)],8,IS)]),_:2},1024),O(F(Z),{class:`font-mono`},{default:C(()=>[l(L(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),O(F(Z),{class:`w-[55%] max-w-0`},{default:C(()=>[B(`span`,{class:`block truncate`,title:p(e).truncated?p(e).full:void 0},L(p(e).text),9,LS)]),_:2},1024),O(F(Z),null,{default:C(()=>[l(L(m(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),f(e)?(P(!0),V(R,{key:0},H(e.events,(t,n)=>(P(),U(ES,{key:`${e.key}:${n}`,event:t,onOpen: 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 iw(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 aw(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 ow(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 sw(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 cw=W([]),lw=W([]),uw=W(!0),dw=W(null),fw=W(null),pw=W(!1),mw=W(null);async function hw(){try{let e=await K.eventTypes();uw.value=e.enabled!==!1,cw.value=e.event_types||[],lw.value=e.proposals||[],dw.value=null}catch(e){dw.value=e.message||String(e)}}function gw(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function _w(e){mw.value=null,fw.value=e}function vw(e){let t=Ew.value.find(t=>String(t.id)===e.sample_id);_w({mode:`proposal`,id:null,source:e.source,name:``,rule:gw(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function yw(e=``){_w({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function bw(e){_w({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:gw(e.rule),headersText:``,body:``,exampleHeaders:{}})}function xw(){fw.value=null}async function Sw(){let e=fw.value;if(e){pw.value=!0;try{if(e.mode===`edit`&&e.id)await K.eventTypeUpdate(e.id,{name:e.name,rule:sw(e.rule)});else{let t=e.mode===`paste`?rw(e.headersText):e.exampleHeaders;await K.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:sw(e.rule),example:{headers:t,body:e.body}})}fw.value=null,await hw()}catch(e){mw.value=e.message||String(e)}finally{pw.value=!1}}}var Cw=W(null);async function ww(){let e=Cw.value;if(Cw.value=null,e)try{await K.eventTypeDelete(e.id),await hw()}catch(e){dw.value=e.message||String(e)}}var Tw=100,Ew=W([]),Dw=W(!0),Ow=W(null),kw=W(!0),Aw=W(null);async function jw(){try{let e=await K.captures(Tw);Dw.value=e.enabled!==!1,Ew.value=e.captures||[],Ow.value=null}catch(e){Ow.value=e.message||String(e)}finally{kw.value=!1}}function Mw(e){let t=Ew.value.find(t=>t.id===e);return t&&(Aw.value=t),!!t}function Nw(){Ew.value.length&&(Aw.value=Ew.value[0])}function Pw(){In(`captures`,()=>{jw(),hw()})}var Fw={key:0,class:`text-xs text-fg-muted`},Iw={key:1,class:`flex flex-col gap-1 text-xs`},Lw={key:1},Rw={key:2,class:`text-xs text-fg-muted`},zw=n({__name:`DispatchLinks`,props:{kind:{},id:{}},setup(e){let t=e,n=W([]),r=W(!1);j(()=>[t.kind,t.id],async()=>{r.value=!1;try{n.value=await K.dispatches(t.kind,t.id)}catch{n.value=[],r.value=!0}},{immediate:!0});let i=e=>({path:`/events`,query:{tab:`inspector`,capture:e}});return(e,a)=>{let o=c(`RouterLink`);return r.value?(P(),V(`p`,Fw,`Dispatches unavailable.`)):n.value.length?(P(),V(`ul`,Iw,[(P(!0),V(R,null,H(n.value,e=>(P(),V(`li`,{key:e.binding_id+e.capture_id,class:`flex flex-wrap items-center gap-x-2 font-mono text-fg-muted`},[t.kind===`bindings`?N(``,!0):(P(),U(o,{key:0,to:{path:`/events`,query:{tab:`bindings`}},class:`hover:text-foreground`},{default:C(()=>[l(`binding `+L(e.binding_id.slice(0,8))+` v`+L(e.binding_version),1)]),_:2},1024)),t.kind===`captures`?N(``,!0):(P(),U(o,{key:1,to:i(e.capture_id),class:`hover:text-foreground`},{default:C(()=>[l(`capture `+L(e.capture_id.slice(0,8)),1)]),_:2},1032,[`to`])),t.kind===`tasks`?N(``,!0):(P(),V(R,{key:2},[e.task_id?(P(),U(o,{key:0,to:`/tasks/${e.task_id}`,class:`text-foreground hover:underline`},{default:C(()=>[l(`task #`+L(e.task_id),1)]),_:2},1032,[`to`])):(P(),V(`span`,Lw,L(e.reason||`claimed, no task recorded`),1))],64)),B(`span`,null,L(F($b)(e.dispatched_at)),1)]))),128))])):t.kind===`tasks`?N(``,!0):(P(),V(`p`,Rw,` No dispatches yet. `))}}}),Bw=n({__name:`Spinner`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(P(),U(F(Er),{role:`status`,"aria-label":`Loading`,class:k(F(G)(`size-4 animate-spin`,t.class))},null,8,[`class`]))}});function Vw(e,t){return t?e.filter(e=>e.event_type_id===t):[]}function Hw(e){return(e?.repository??`required`)!==`none`}function Uw(e,t){return e.filter(e=>t===`any`||e.type===`any`||e.type===t)}function Ww(e,t){switch(t){case`string`:return e;case`number`:return e.trim()!==``&&!Number.isNaN(Number(e))?Number(e):e;case`bool`:return e===`true`||e!==`false`&&e;default:try{return JSON.parse(e)}catch{return e}}}var Gw={pending_approval:`pending approval`,armed:`armed`,paused:`paused`},Kw={pending_approval:`warn`,armed:`ok`,paused:`idle`};function qw(e){ Line truncated
`)}};iB.defaultYaml={explicit:!1,version:`1.2`},iB.defaultTags={"!!":`tag:yaml.org,2002:`};function aB(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 oB(e){let t=new Set;return Zz(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function sB(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function cB(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=oB(e);let a=sB(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(Uz(t.node)||Gz(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 lB(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=lB(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=lB(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=lB(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=lB(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function uB(e,t,n){if(Array.isArray(e))return e.map((e,t)=>uB(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!qz(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 dB=class{constructor(e){Object.defineProperty(this,Rz,{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(!Bz(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=uB(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?lB(i,{"":o},``,o):o}},fB=class extends dB{constructor(e){super(Mz),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=[],Zz(e,{Node:(e,t)=>{(zz(t)||qz(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||=(uB(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=pB(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(aB(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 pB(e,t,n){if(zz(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Gz(t)){let r=0;for(let i of t.items){let t=pB(e,i,n);t>r&&(r=t)}return r}if(Hz(t)){let r=pB(e,t.key,n),i=pB(e,t.value,n);return Math.max(r,i)}return 1}var mB=e=>!e||typeof e!=`function`&&typeof e!=`object`,hB=class extends dB{constructor(e){super(Iz),this.value=e}toJSON(e,t){return t?.keep?this.value:uB(this.value,e,t)}toString(){return String(this.value)}};hB.BLOCK_FOLDED=`BLOCK_FOLDED`,hB.BLOCK_LITERAL=`BLOCK_LITERAL`,hB.PLAIN=`PLAIN`,hB.QUOTE_DOUBLE=`QUOTE_DOUBLE`,hB.QUOTE_SINGLE=`QUOTE_SINGLE`;var gB=`tag:yaml.org,2002:`;function _B(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 vB(e,t,n){if(Bz(e)&&(e=e.contents),Kz(e))return e;if(Hz(e)){let t=n.schema[Pz].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 fB(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=gB+t.slice(2));let l=_B(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new hB(e);return c&&(c.node=t),t Line truncated
`)?CB(n,t):n.includes(`
`)){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 iw(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 aw(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 ow(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 sw(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 cw=W([]),lw=W([]),uw=W(!0),dw=W(null),fw=W(null),pw=W(!1),mw=W(null);async function hw(){try{let e=await K.eventTypes();uw.value=e.enabled!==!1,cw.value=e.event_types||[],lw.value=e.proposals||[],dw.value=null}catch(e){dw.value=e.message||String(e)}}function gw(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function _w(e){mw.value=null,fw.value=e}function vw(e){let t=Ew.value.find(t=>String(t.id)===e.sample_id);_w({mode:`proposal`,id:null,source:e.source,name:``,rule:gw(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function yw(e=``){_w({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function bw(e){_w({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:gw(e.rule),headersText:``,body:``,exampleHeaders:{}})}function xw(){fw.value=null}async function Sw(){let e=fw.value;if(e){pw.value=!0;try{if(e.mode===`edit`&&e.id)await K.eventTypeUpdate(e.id,{name:e.name,rule:sw(e.rule)});else{let t=e.mode===`paste`?rw(e.headersText):e.exampleHeaders;await K.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:sw(e.rule),example:{headers:t,body:e.body}})}fw.value=null,await hw()}catch(e){mw.value=e.message||String(e)}finally{pw.value=!1}}}var Cw=W(null);async function ww(){let e=Cw.value;if(Cw.value=null,e)try{await K.eventTypeDelete(e.id),await hw()}catch(e){dw.value=e.message||String(e)}}var Tw=100,Ew=W([]),Dw=W(!0),Ow=W(null),kw=W(!0),Aw=W(null);async function jw(){try{let e=await K.captures(Tw);Dw.value=e.enabled!==!1,Ew.value=e.captures||[],Ow.value=null}catch(e){Ow.value=e.message||String(e)}finally{kw.value=!1}}function Mw(e){let t=Ew.value.find(t=>t.id===e);return t&&(Aw.value=t),!!t}function Nw(){Ew.value.length&&(Aw.value=Ew.value[0])}function Pw(){In(`captures`,()=>{jw(),hw()})}var Fw={key:0,class:`text-xs text-fg-muted`},Iw={key:1,class:`flex flex-col gap-1 text-xs`},Lw={key:1},Rw={key:2,class:`text-xs text-fg-muted`},zw=n({__name:`DispatchLinks`,props:{kind:{},id:{}},setup(e){let t=e,n=W([]),r=W(!1);j(()=>[t.kind,t.id],async()=>{r.value=!1;try{n.value=await K.dispatches(t.kind,t.id)}catch{n.value=[],r.value=!0}},{immediate:!0});let i=e=>({path:`/events`,query:{tab:`inspector`,capture:e}});return(e,a)=>{let o=c(`RouterLink`);return r.value?(P(),V(`p`,Fw,`Dispatches unavailable.`)):n.value.length?(P(),V(`ul`,Iw,[(P(!0),V(R,null,H(n.value,e=>(P(),V(`li`,{key:e.binding_id+e.capture_id,class:`flex flex-wrap items-center gap-x-2 font-mono text-fg-muted`},[t.kind===`bindings`?N(``,!0):(P(),U(o,{key:0,to:{path:`/events`,query:{tab:`bindings`}},class:`hover:text-foreground`},{default:C(()=>[l(`binding `+L(e.binding_id.slice(0,8))+` v`+L(e.binding_version),1)]),_:2},1024)),t.kind===`captures`?N(``,!0):(P(),U(o,{key:1,to:i(e.capture_id),class:`hover:text-foreground`},{default:C(()=>[l(`capture `+L(e.capture_id.slice(0,8)),1)]),_:2},1032,[`to`])),t.kind===`tasks`?N(``,!0):(P(),V(R,{key:2},[e.task_id?(P(),U(o,{key:0,to:`/tasks/${e.task_id}`,class:`text-foreground hover:underline`},{default:C(()=>[l(`task #`+L(e.task_id),1)]),_:2},1032,[`to`])):(P(),V(`span`,Lw,L(e.reason||`claimed, no task recorded`),1))],64)),B(`span`,null,L(F($b)(e.dispatched_at)),1)]))),128))])):t.kind===`tasks`?N(``,!0):(P(),V(`p`,Rw,` No dispatches yet. `))}}}),Bw=n({__name:`Spinner`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(P(),U(F(Er),{role:`status`,"aria-label":`Loading`,class:k(F(G)(`size-4 animate-spin`,t.class))},null,8,[`class`]))}});function Vw(e,t){return t?e.filter(e=>e.event_type_id===t):[]}function Hw(e){return(e?.repository??`required`)!==`none`}function Uw(e,t){return e.filter(e=>t===`any`||e.type===`any`||e.type===t)}function Ww(e,t){switch(t){case`string`:return e;case`number`:return e.trim()!==``&&!Number.isNaN(Number(e))?Number(e):e;case`bool`:return e===`true`||e!==`false`&&e;default:try{return JSON.parse(e)}catch{return e}}}var Gw={pending_approval:`pending approval`,armed:`armed`,paused:`paused`},Kw={pending_approval:`warn`,armed:`ok`,paused:`idle`};function qw(e){ Line truncated
`)}};oB.defaultYaml={explicit:!1,version:`1.2`},oB.defaultTags={"!!":`tag:yaml.org,2002:`};function sB(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 cB(e){let t=new Set;return $z(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function lB(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function uB(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=cB(e);let a=lB(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(Gz(t.node)||qz(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 dB(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=dB(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=dB(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=dB(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=dB(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function fB(e,t,n){if(Array.isArray(e))return e.map((e,t)=>fB(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Yz(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 pB=class{constructor(e){Object.defineProperty(this,Bz,{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(!Hz(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=fB(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?dB(i,{"":o},``,o):o}},mB=class extends pB{constructor(e){super(Pz),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=[],$z(e,{Node:(e,t)=>{(Vz(t)||Yz(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||=(fB(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=hB(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(sB(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 hB(e,t,n){if(Vz(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(qz(t)){let r=0;for(let i of t.items){let t=hB(e,i,n);t>r&&(r=t)}return r}if(Wz(t)){let r=hB(e,t.key,n),i=hB(e,t.value,n);return Math.max(r,i)}return 1}var gB=e=>!e||typeof e!=`function`&&typeof e!=`object`,_B=class extends pB{constructor(e){super(Rz),this.value=e}toJSON(e,t){return t?.keep?this.value:fB(this.value,e,t)}toString(){return String(this.value)}};_B.BLOCK_FOLDED=`BLOCK_FOLDED`,_B.BLOCK_LITERAL=`BLOCK_LITERAL`,_B.PLAIN=`PLAIN`,_B.QUOTE_DOUBLE=`QUOTE_DOUBLE`,_B.QUOTE_SINGLE=`QUOTE_SINGLE`;var vB=`tag:yaml.org,2002:`;function yB(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 bB(e,t,n){if(Hz(e)&&(e=e.contents),Jz(e))return e;if(Wz(e)){let t=n.schema[Iz].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 mB(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=vB+t.slice(2));let l=yB(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new _B(e);return c&&(c.node=t),t Line truncated
`)?TB(n,t):n.includes(`
`)?`
`+CB(n,t):(e.endsWith(` `)?``:` `)+n,TB=`flow`,EB=`block`,DB=`quoted`;function OB(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=kB(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=kB(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`+TB(n,t):(e.endsWith(` `)?``:` `)+n,DB=`flow`,OB=`block`,kB=`quoted`;function AB(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=jB(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=jB(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 kB(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 AB=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),jB=e=>/^(%|---|\.\.\.)/m.test(e);function MB(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 NB(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(jB(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 jB(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 MB=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),NB=e=>/^(%|---|\.\.\.)/m.test(e);function PB(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 FB(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(NB(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:OB(o,a,DB,AB(t,!1))}function PB(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return NB(e,t);let n=t.indent||(jB(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:OB(r,n,TB,AB(t,!1))}function FB(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=NB;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?PB:i&&!t?NB:n?PB:NB}return r(e,t)}var IB;try{IB=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:AB(o,a,kB,MB(t,!1))}function IB(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return FB(e,t);let n=t.indent||(NB(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:AB(r,n,DB,MB(t,!1))}function LB(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=FB;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?IB:i&&!t?FB:n?IB:FB}return r(e,t)}var RB;try{RB=RegExp(`(^|(?<!
))
+(?!
|$)`,`g`)}catch{IB=/\n+(?!\n|$)/g}function LB({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 FB(n,r);let l=r.indent||(r.forceBlockIndent||jB(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===hB.BLOCK_FOLDED?!1:t===hB.BLOCK_LITERAL||!MB(n,c,l.length);if(!n)return u?`|
|$)`,`g`)}catch{RB=/\n+(?!\n|$)/g}function zB({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 LB(n,r);let l=r.indent||(r.forceBlockIndent||NB(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===_B.BLOCK_FOLDED?!1:t===_B.BLOCK_LITERAL||!PB(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(IB,`$&${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(RB,`$&${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=AB(r,!0);o!==`folded`&&t!==hB.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=OB(`${v}${e}${p}`,l,EB,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function RB(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 FB(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?FB(a,t):LB(e,t,n,r);if(!s&&!u&&i!==hB.PLAIN&&a.includes(`
`))return LB(e,t,n,r);if(jB(a)){if(c===``)return t.forceBlockIndent=!0,LB(e,t,n,r);if(s&&c===l)return FB(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 FB(a,t)}return s?d:OB(d,c,TB,AB(t,!1))}function zB(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!==hB.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=hB.QUOTE_DOUBLE);let c=e=>{switch(e){case hB.BLOCK_FOLDED:case hB.BLOCK_LITERAL:return i||a?FB(o.value,t):LB(o,t,n,r);case hB.QUOTE_DOUBLE:return NB(o.value,t);case hB.QUOTE_SINGLE:return PB(o.value,t);case hB.PLAIN:return RB(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 BB(e,t){let n=Object.assign({blockQuote:!0,commentString:SB,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 VB(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(Uz(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 HB(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Uz(e)||Gz(e))&&e.anchor;a&&aB(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 UB(e,t,n,r){if(Hz(e))return e.toString(t,n,r);if(zz(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=Kz(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=VB(t.doc.schema.tags,a);let o=HB(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):Uz(a)?zB(a,t,n,r):a.toString(t,n,r);return o?Uz(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function WB({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=Kz(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Gz(e)||!Kz(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||Gz(e)||(Uz(e)?e.type===hB.BLOCK_FOLDED||e.type===hB.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=UB(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+=wB(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=wB(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=wB(g,n.indent,l(f))));let _,v,y;Kz(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&&Uz(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Wz(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=UB(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${CB(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=MB(r,!0);o!==`folded`&&t!==_B.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=AB(`${v}${e}${p}`,l,OB,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function BB(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 LB(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?LB(a,t):zB(e,t,n,r);if(!s&&!u&&i!==_B.PLAIN&&a.includes(`
`))return zB(e,t,n,r);if(NB(a)){if(c===``)return t.forceBlockIndent=!0,zB(e,t,n,r);if(s&&c===l)return LB(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 LB(a,t)}return s?d:AB(d,c,DB,MB(t,!1))}function VB(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!==_B.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=_B.QUOTE_DOUBLE);let c=e=>{switch(e){case _B.BLOCK_FOLDED:case _B.BLOCK_LITERAL:return i||a?LB(o.value,t):zB(o,t,n,r);case _B.QUOTE_DOUBLE:return FB(o.value,t);case _B.QUOTE_SINGLE:return IB(o.value,t);case _B.PLAIN:return BB(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 HB(e,t){let n=Object.assign({blockQuote:!0,commentString:wB,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 UB(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(Gz(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 WB(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Gz(e)||qz(e))&&e.anchor;a&&sB(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 GB(e,t,n,r){if(Wz(e))return e.toString(t,n,r);if(Vz(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=Jz(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=UB(t.doc.schema.tags,a);let o=WB(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):Gz(a)?VB(a,t,n,r):a.toString(t,n,r);return o?Gz(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function KB({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=Jz(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(qz(e)||!Jz(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||qz(e)||(Gz(e)?e.type===_B.BLOCK_FOLDED||e.type===_B.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=GB(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+=EB(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=EB(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=EB(g,n.indent,l(f))));let _,v,y;Jz(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&&Gz(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Kz(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=GB(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${TB(e,n.indent)}`}x===``&&!n.inFlow?S===`
`&&y&&(S=`
`):S+=`\n${n.indent}`}else if(!p&&Gz(t)){let e=x[0],r=x.indexOf(`
`):S+=`\n${n.indent}`}else if(!p&&qz(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+=wB(g,n.indent,l(y)):h&&i&&i(),g}function GB(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var KB=`<<`,qB={identify:e=>e===KB||typeof e==`symbol`&&e.description===KB,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new hB(Symbol(KB)),{addToJSMap:YB}),stringify:()=>KB},JB=(e,t)=>(qB.identify(t)||Uz(t)&&(!t.type||t.type===hB.PLAIN)&&qB.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===qB.tag&&e.default);function YB(e,t,n){let r=ZB(e,n);if(Wz(r))for(let n of r.items)XB(e,t,n);else if(Array.isArray(r))for(let n of r)XB(e,t,n);else XB(e,t,r)}function XB(e,t,n){let r=ZB(e,n);if(!Vz(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 ZB(e,t){return e&&zz(t)?t.resolve(e.doc,e):t}function QB(e,t,{key:n,value:r}){if(Kz(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(JB(e,n))YB(e,t,r);else{let i=uB(n,``,e);if(t instanceof Map)t.set(i,uB(r,i,e));else if(t instanceof Set)t.add(i);else{let a=$B(n,i,e),o=uB(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function $B(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Kz(e)&&n?.doc){let t=BB(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)+`..."`),GB(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 eV(e,t,n){return new tV(vB(e,void 0,n),vB(t,void 0,n))}var tV=class e{constructor(e,t=null){Object.defineProperty(this,Rz,{value:Fz}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Kz(n)&&(n=n.clone(t)),Kz(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return QB(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?WB(this,e,t,n):JSON.stringify(this)}};function nV(e,t,n){return(t.inFlow??e.flow?iV:rV)(e,t,n)}function rV({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(Kz(i))!d&&i.spaceBefore&&f.push(``),aV(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(Hz(i)){let e=Kz(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),aV(n,f,e.commentBefore,d))}d=!1;let s=UB(i,u,()=>o=null,()=>d=!0);o&&(s+=wB(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+=EB(g,n.indent,l(y)):h&&i&&i(),g}function qB(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var JB=`<<`,YB={identify:e=>e===JB||typeof e==`symbol`&&e.description===JB,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new _B(Symbol(JB)),{addToJSMap:ZB}),stringify:()=>JB},XB=(e,t)=>(YB.identify(t)||Gz(t)&&(!t.type||t.type===_B.PLAIN)&&YB.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===YB.tag&&e.default);function ZB(e,t,n){let r=$B(e,n);if(Kz(r))for(let n of r.items)QB(e,t,n);else if(Array.isArray(r))for(let n of r)QB(e,t,n);else QB(e,t,r)}function QB(e,t,n){let r=$B(e,n);if(!Uz(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 $B(e,t){return e&&Vz(t)?t.resolve(e.doc,e):t}function eV(e,t,{key:n,value:r}){if(Jz(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(XB(e,n))ZB(e,t,r);else{let i=fB(n,``,e);if(t instanceof Map)t.set(i,fB(r,i,e));else if(t instanceof Set)t.add(i);else{let a=tV(n,i,e),o=fB(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function tV(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Jz(e)&&n?.doc){let t=HB(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)+`..."`),qB(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 nV(e,t,n){return new rV(bB(e,void 0,n),bB(t,void 0,n))}var rV=class e{constructor(e,t=null){Object.defineProperty(this,Bz,{value:Lz}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Jz(n)&&(n=n.clone(t)),Jz(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return eV(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?KB(this,e,t,n):JSON.stringify(this)}};function iV(e,t,n){return(t.inFlow??e.flow?oV:aV)(e,t,n)}function aV({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(Jz(i))!d&&i.spaceBefore&&f.push(``),sV(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(Wz(i)){let e=Jz(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),sV(n,f,e.commentBefore,d))}d=!1;let s=GB(i,u,()=>o=null,()=>d=!0);o&&(s+=EB(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+=`
`+CB(l(e),c),s&&s()):d&&o&&o(),p}function iV({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(Kz(i))i.spaceBefore&&d.push(``),aV(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(Hz(i)){let e=Kz(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),aV(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Kz(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=UB(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+=wB(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 aV({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=CB(t(r),e);n.push(i.trimStart())}}function oV(e,t){let n=Uz(t)?t.value:t;for(let r of e)if(Hz(r)&&(r.key===t||r.key===n||Uz(r.key)&&r.key.value===n))return r}var sV=class extends xB{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Pz,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(eV(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=Hz(e)?e:!e||typeof e!=`object`||!(`key`in e)?new tV(e,e?.value):new tV(e.key,e.value);let r=oV(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Uz(r.value)&&mB(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=oV(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=oV(this.items,e)?.value;return(!t&&Uz(n)?n.value:n)??void 0}has(e){return!!oV(this.items,e)}set(e,t){this.add(new tV(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)QB(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!Hz(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})),nV(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},cV={collection:`map`,default:!0,nodeClass:sV,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Vz(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>sV.from(e,t,n)},lV=class extends xB{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Lz,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=uV(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=uV(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Uz(r)?r.value:r}has(e){let t=uV(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=uV(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Uz(r)&&mB(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(uB(e,String(r++),t));return n}toString(e,t,n){return e?nV(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(vB(a,void 0,n))}}return i}};function uV(e){let t=Uz(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var dV={collection:`seq`,default:!0,nodeClass:lV,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Wz(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>lV.from(e,t,n)},fV={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),zB(e,t,n,r)}},pV={identify:e=>e==null,createNode:()=>new hB(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new hB(null),stringify:({source:e},t)=>typeof e==`string`&&pV.test.test(e)?e:t.options.nullStr},mV={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new hB(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&mV.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function hV({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 gV={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:hV},_V={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 zB({comment:e,type:t,value:s},r,i,a)}};function jV(e,t){if(Wz(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Hz(r)){if(Vz(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new tV(new hB(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]=Hz(r)?r:new tV(r)}}else t(`Expected a sequence for this tag`);return e}function MV(e,t,n){let{replacer:r}=n,i=new lV(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(eV(o,s,n))}return i}var NV={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:jV,createNode:MV},PV=class e extends lV{constructor(){super(),this.add=sV.prototype.add.bind(this),this.delete=sV.prototype.delete.bind(this),this.get=sV.prototype.get.bind(this),this.has=sV.prototype.has.bind(this),this.set=sV.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(Hz(e)?(r=uB(e.key,``,t),i=uB(e.value,r,t)):r=uB(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=MV(e,t,n),i=new this;return i.items=r.items,i}};PV.tag=`tag:yaml.org,2002:omap`;var FV={collection:`seq`,identify:e=>e instanceof Map,nodeClass:PV,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=jV(e,t),r=[];for(let{key:e}of n.items)Uz(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new PV,n)},createNode:(e,t,n)=>PV.from(e,t,n)};function IV({value:e,source:t},n){return t&&(e?LV:RV).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var LV={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 hB(!0),stringify:IV},RV={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 hB(!1),stringify:IV},zV={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:hV},BV={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():hV(e)}},VV={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 hB(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:hV},HV=e=>typeof e==`bigint`||Number.isInteger(e);function UV(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 WV(e,t,n){let{value:r}=e;if(HV(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return hV(e)}var GV={identify:HV,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>UV(e,2,2,n),stringify:e=>WV(e,2,`0b`)},KV={identify:HV,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>UV(e,1,8,n),stringify:e=>WV(e,8,`0`)},qV={identify:HV,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>UV(e,0,10,n),stringify:hV},JV={identify:HV,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>UV(e,2,16,n),stringify:e=>WV(e,16,`0x`)},YV=class e extends sV{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=Hz(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new tV(e.key,null):new tV(e,null),oV(this.items,t.key)||this.items.push(t)}get(e,t){let n=oV(this.items,e);return!t&&Hz(n)?Uz(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=oV(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new tV(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(CB(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(CB(a(t),``)))}return n.join(`
`+TB(l(e),c),s&&s()):d&&o&&o(),p}function oV({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(Jz(i))i.spaceBefore&&d.push(``),sV(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(Wz(i)){let e=Jz(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),sV(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Jz(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=GB(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+=EB(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 sV({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=TB(t(r),e);n.push(i.trimStart())}}function cV(e,t){let n=Gz(t)?t.value:t;for(let r of e)if(Wz(r)&&(r.key===t||r.key===n||Gz(r.key)&&r.key.value===n))return r}var lV=class extends CB{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Iz,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(nV(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=Wz(e)?e:!e||typeof e!=`object`||!(`key`in e)?new rV(e,e?.value):new rV(e.key,e.value);let r=cV(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Gz(r.value)&&gB(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=cV(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=cV(this.items,e)?.value;return(!t&&Gz(n)?n.value:n)??void 0}has(e){return!!cV(this.items,e)}set(e,t){this.add(new rV(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)eV(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!Wz(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})),iV(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},uV={collection:`map`,default:!0,nodeClass:lV,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Uz(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>lV.from(e,t,n)},dV=class extends CB{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(zz,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=fV(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=fV(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Gz(r)?r.value:r}has(e){let t=fV(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=fV(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Gz(r)&&gB(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(fB(e,String(r++),t));return n}toString(e,t,n){return e?iV(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(bB(a,void 0,n))}}return i}};function fV(e){let t=Gz(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var pV={collection:`seq`,default:!0,nodeClass:dV,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Kz(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>dV.from(e,t,n)},mV={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),VB(e,t,n,r)}},hV={identify:e=>e==null,createNode:()=>new _B(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new _B(null),stringify:({source:e},t)=>typeof e==`string`&&hV.test.test(e)?e:t.options.nullStr},gV={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new _B(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&gV.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function _V({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 vV={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:_V},yV={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 VB({comment:e,type:t,value:s},r,i,a)}};function NV(e,t){if(Kz(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Wz(r)){if(Uz(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new rV(new _B(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]=Wz(r)?r:new rV(r)}}else t(`Expected a sequence for this tag`);return e}function PV(e,t,n){let{replacer:r}=n,i=new dV(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(nV(o,s,n))}return i}var FV={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:NV,createNode:PV},IV=class e extends dV{constructor(){super(),this.add=lV.prototype.add.bind(this),this.delete=lV.prototype.delete.bind(this),this.get=lV.prototype.get.bind(this),this.has=lV.prototype.has.bind(this),this.set=lV.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(Wz(e)?(r=fB(e.key,``,t),i=fB(e.value,r,t)):r=fB(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=PV(e,t,n),i=new this;return i.items=r.items,i}};IV.tag=`tag:yaml.org,2002:omap`;var LV={collection:`seq`,identify:e=>e instanceof Map,nodeClass:IV,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=NV(e,t),r=[];for(let{key:e}of n.items)Gz(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new IV,n)},createNode:(e,t,n)=>IV.from(e,t,n)};function RV({value:e,source:t},n){return t&&(e?zV:BV).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var zV={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 _B(!0),stringify:RV},BV={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 _B(!1),stringify:RV},VV={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:_V},HV={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():_V(e)}},UV={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 _B(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:_V},WV=e=>typeof e==`bigint`||Number.isInteger(e);function GV(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 KV(e,t,n){let{value:r}=e;if(WV(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return _V(e)}var qV={identify:WV,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>GV(e,2,2,n),stringify:e=>KV(e,2,`0b`)},JV={identify:WV,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>GV(e,1,8,n),stringify:e=>KV(e,8,`0`)},YV={identify:WV,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>GV(e,0,10,n),stringify:_V},XV={identify:WV,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>GV(e,2,16,n),stringify:e=>KV(e,16,`0x`)},ZV=class e extends lV{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=Wz(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new rV(e.key,null):new rV(e,null),cV(this.items,t.key)||this.items.push(t)}get(e,t){let n=cV(this.items,e);return!t&&Wz(n)?Gz(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=cV(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new rV(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(TB(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(TB(a(t),``)))}return n.join(`
`)+`
`}var uH=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Rz,{value:Nz});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 iB({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Rz]:{value:Nz}});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=Kz(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){dH(this.contents)&&this.contents.add(e)}addIn(e,t){dH(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=oB(this);e.anchor=!t||n.has(t)?sB(t||`a`,n):t}return new fB(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}=cB(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=vB(e,l,p);return o&&Gz(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new tV(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return dH(this.contents)?this.contents.delete(e):!1}deleteIn(e){return bB(e)?this.contents!=null&&(this.contents=null,!0):dH(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Gz(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return bB(e)?!t&&Uz(this.contents)?this.contents.value:this.contents:Gz(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Gz(this.contents)?this.contents.has(e):!1}hasIn(e){return bB(e)?this.contents!==void 0:Gz(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=yB(this.schema,[e],t):dH(this.contents)&&this.contents.set(e,t)}setIn(e,t){bB(e)?this.contents=t:this.contents==null?this.contents=yB(this.schema,Array.from(e),t):dH(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 iB({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 iB({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 cH(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=uB(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`?lB(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 lH(this,e)}};function dH(e){if(Gz(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var fH=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},pH=class extends fH{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},mH=class extends fH{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},hH=(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 gH(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],ee=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:ee,start:x??ee}}function _H(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(_H(t.key)||_H(t.value))return!0}return!1;default:return!0}}function vH(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&_H(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function yH(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||Uz(e)&&Uz(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var bH=`All mapping items must start at the same column`;function xH({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??sV)(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=gH(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`,bH)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||_H(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`,bH);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&vH(r.indent,u,i),n.atKey=!1,yH(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=gH(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&&vH(r.indent,f,i),s=c.range[2];let l=new tV(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 tV(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 SH({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??lV)(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=gH(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&&vH(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function CH(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 wH=`Block collections are not allowed within flow collections`,TH=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function EH({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?sV:lV))(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=gH(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&&_H(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];Hz(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],TH(m)&&i(r.range,`BLOCK_IN_FLOW`,wH)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);TH(f)&&i(g.range,`BLOCK_IN_FLOW`,wH),n.atKey=!1;let _=gH(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?TH(m)&&i(v.range,`BLOCK_IN_FLOW`,wH):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new tV(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;yH(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new sV(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=CH(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 DH(e,t,n,r,i,a){let o=n.type===`block-map`?xH(e,t,n,r,a):n.type===`block-seq`?SH(e,t,n,r,a):EH(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function OH(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===sV.tagName&&s===`map`||o===lV.tagName&&s===`seq`)return DH(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),DH(e,t,n,i,o)}let l=DH(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=Kz(u)?u:new hB(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function kH(e,t,n){let r=t.offset,i=AH(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?hB.BLOCK_FOLDED:hB.BLOCK_LITERAL,o=t.source?jH(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 fH=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Bz,{value:Fz});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 oB({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Bz]:{value:Fz}});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=Jz(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){pH(this.contents)&&this.contents.add(e)}addIn(e,t){pH(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=cB(this);e.anchor=!t||n.has(t)?lB(t||`a`,n):t}return new mB(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}=uB(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=bB(e,l,p);return o&&qz(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new rV(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return pH(this.contents)?this.contents.delete(e):!1}deleteIn(e){return SB(e)?this.contents!=null&&(this.contents=null,!0):pH(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return qz(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return SB(e)?!t&&Gz(this.contents)?this.contents.value:this.contents:qz(this.contents)?this.contents.getIn(e,t):void 0}has(e){return qz(this.contents)?this.contents.has(e):!1}hasIn(e){return SB(e)?this.contents!==void 0:qz(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=xB(this.schema,[e],t):pH(this.contents)&&this.contents.set(e,t)}setIn(e,t){SB(e)?this.contents=t:this.contents==null?this.contents=xB(this.schema,Array.from(e),t):pH(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 oB({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 oB({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 uH(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=fB(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`?dB(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 dH(this,e)}};function pH(e){if(qz(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var mH=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},hH=class extends mH{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},gH=class extends mH{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},_H=(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 vH(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],ee=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:ee,start:x??ee}}function yH(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(yH(t.key)||yH(t.value))return!0}return!1;default:return!0}}function bH(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&yH(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function xH(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||Gz(e)&&Gz(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var SH=`All mapping items must start at the same column`;function CH({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??lV)(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=vH(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`,SH)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||yH(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`,SH);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&bH(r.indent,u,i),n.atKey=!1,xH(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=vH(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&&bH(r.indent,f,i),s=c.range[2];let l=new rV(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 rV(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 wH({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??dV)(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=vH(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&&bH(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function TH(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 EH=`Block collections are not allowed within flow collections`,DH=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function OH({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?lV:dV))(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=vH(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&&yH(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];Wz(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],DH(m)&&i(r.range,`BLOCK_IN_FLOW`,EH)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);DH(f)&&i(g.range,`BLOCK_IN_FLOW`,EH),n.atKey=!1;let _=vH(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?DH(m)&&i(v.range,`BLOCK_IN_FLOW`,EH):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new rV(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;xH(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new lV(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=TH(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 kH(e,t,n,r,i,a){let o=n.type===`block-map`?CH(e,t,n,r,a):n.type===`block-seq`?wH(e,t,n,r,a):OH(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function AH(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===lV.tagName&&s===`map`||o===dV.tagName&&s===`seq`)return kH(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),kH(e,t,n,i,o)}let l=kH(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=Jz(u)?u:new _B(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function jH(e,t,n){let r=t.offset,i=MH(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?_B.BLOCK_FOLDED:_B.BLOCK_LITERAL,o=t.source?NH(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===hB.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===_B.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`):t.length>c||r[0]===` `?(f===` `?f=`
`:!p&&f===`
`&&(f=`
@@ -77,59 +77,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 AH({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 jH(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 MH(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=hB.PLAIN,c=NH(a,l);break;case`single-quoted-scalar`:s=hB.QUOTE_SINGLE,c=PH(a,l);break;case`double-quoted-scalar`:s=hB.QUOTE_DOUBLE,c=IH(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=CH(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function NH(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}`),FH(e)}function PH(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),FH(e.slice(1,-1)).replace(/''/g,`'`)}function FH(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 MH({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 NH(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 PH(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=_B.PLAIN,c=FH(a,l);break;case`single-quoted-scalar`:s=_B.QUOTE_SINGLE,c=IH(a,l);break;case`double-quoted-scalar`:s=_B.QUOTE_DOUBLE,c=RH(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=TH(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function FH(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}`),LH(e)}function IH(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),LH(e.slice(1,-1)).replace(/''/g,`'`)}function LH(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 IH(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 RH(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}=LH(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=RH[i];if(a)n+=a;else if(i===`
`){let{fold:t,offset:i}=zH(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=BH[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+=zH(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+=VH(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 LH(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 zH(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 RH={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function zH(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 BH(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?kH(e,t,r):MH(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[Iz]:c?VH(e.schema,i,c,n,r):t.type===`scalar`?HH(e,i,t,r):e.schema[Iz];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=Uz(a)?a:new hB(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new hB(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 VH(e,t,n,r,i){if(n===`!`)return e[Iz];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[Iz])}function HH({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[Iz];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Iz];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 UH(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 WH={composeNode:GH,composeEmptyNode:KH};function GH(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=qH(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=BH(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=OH(WH,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??=KH(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&&(!Uz(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 KH(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=BH(e,{type:`scalar`,offset:UH(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 qH({options:e},{offset:t,source:n,end:r},i){let a=new fB(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=CH(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function JH(e,t,{offset:n,start:r,value:i,end:a},o){let s=new uH(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=gH(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?GH(c,i,l,o):KH(c,l.end,r,null,l,o);let u=s.contents.range[2],d=CH(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function YH(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 XH(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 BH={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function VH(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 HH(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?jH(e,t,r):PH(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[Rz]:c?UH(e.schema,i,c,n,r):t.type===`scalar`?WH(e,i,t,r):e.schema[Rz];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=Gz(a)?a:new _B(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new _B(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 UH(e,t,n,r,i){if(n===`!`)return e[Rz];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[Rz])}function WH({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[Rz];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Rz];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 GH(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 KH={composeNode:qH,composeEmptyNode:JH};function qH(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=YH(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=HH(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=AH(KH,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??=JH(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&&(!Gz(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 JH(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=HH(e,{type:`scalar`,offset:GH(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 YH({options:e},{offset:t,source:n,end:r},i){let a=new mB(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=TH(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function XH(e,t,{offset:n,start:r,value:i,end:a},o){let s=new fH(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=vH(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?qH(c,i,l,o):JH(c,l.end,r,null,l,o);let u=s.contents.range[2],d=TH(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function ZH(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 QH(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 ZH=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=YH(e);r?this.warnings.push(new mH(i,t,n)):this.errors.push(new pH(i,t,n))},this.directives=new iB({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=XH(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(Gz(i)&&!i.flow&&i.items.length>0){let e=i.items[0];Hz(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:XH(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=YH(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=JH(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 pH(YH(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 pH(YH(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=CH(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 pH(YH(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 uH(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}}},QH=Symbol(`break visit`),$H=Symbol(`skip children`),eU=Symbol(`remove item`);function tU(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),nU(Object.freeze([]),e,t)}tU.BREAK=QH,tU.SKIP=$H,tU.REMOVE=eU,tU.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},tU.parentCollection=(e,t)=>{let n=tU.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 nU(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=nU(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===QH)return QH;else r===eU&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function rU(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 $H=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=ZH(e);r?this.warnings.push(new gH(i,t,n)):this.errors.push(new hH(i,t,n))},this.directives=new oB({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=QH(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(qz(i)&&!i.flow&&i.items.length>0){let e=i.items[0];Wz(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:QH(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=ZH(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=XH(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 hH(ZH(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 hH(ZH(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=TH(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 hH(ZH(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 fH(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}}},eU=Symbol(`break visit`),tU=Symbol(`skip children`),nU=Symbol(`remove item`);function rU(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),iU(Object.freeze([]),e,t)}rU.BREAK=eU,rU.SKIP=tU,rU.REMOVE=nU,rU.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},rU.parentCollection=(e,t)=>{let n=rU.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 iU(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=iU(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===eU)return eU;else r===nU&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function aU(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 iU(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var aU=new Set(`0123456789ABCDEFabcdef`),oU=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),sU=new Set(`,[]{}`),cU=new Set(` ,[]{}
\r `),lU=e=>!e||cU.has(e),uU=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 oU(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var sU=new Set(`0123456789ABCDEFabcdef`),cU=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),lU=new Set(`,[]{}`),uU=new Set(` ,[]{}
\r `),dU=e=>!e||uU.has(e),fU=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===`...`)&&iU(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===`...`)&&iU(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&&!iU(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===`:`)&&iU(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(lU),`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(`...`))&&iU(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(lU),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||iU(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===`...`)&&oU(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===`...`)&&oU(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&&!oU(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===`:`)&&oU(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(dU),`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(`...`))&&oU(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(dU),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||oU(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=>iU(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=>oU(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(iU(r)||e&&sU.has(r))break;t=n}else if(iU(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(oU(r)||e&&lU.has(r))break;t=n}else if(oU(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&sU.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&sU.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(lU),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(iU(n)||t&&sU.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(;!iU(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(oU.has(t))t=this.buffer[++e];else if(t===`%`&&aU.has(this.buffer[e+1])&&aU.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&&lU.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&lU.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(dU),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(oU(n)||t&&lU.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(;!oU(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(cU.has(t))t=this.buffer[++e];else if(t===`%`&&sU.has(this.buffer[e+1])&&sU.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)}},dU=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 fU(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function pU(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 mU(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 hU(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 gU(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 _U(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 vU(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!fU(t.start,`explicit-key-ind`)&&!fU(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,mU(t.value)?t.value.end?_U(t.value.end,t.sep):t.value.end=t.sep:_U(t.start,t.sep),delete t.sep)}var yU=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 uU,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=rU(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`&&vU(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&&pU(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.i 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)}},pU=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 mU(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function hU(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 gU(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 _U(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 vU(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 yU(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 bU(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!mU(t.start,`explicit-key-ind`)&&!mU(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,gU(t.value)?t.value.end?yU(t.value.end,t.sep):t.value.end=t.sep:yU(t.start,t.sep),delete t.sep)}var xU=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 fU,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=aU(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`&&bU(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&&hU(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.i 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)){_U(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(fU(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=gU(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(fU(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(mU(t.key)&&!fU(t.sep,`newline`)){let e=gU(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]}):fU(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&&!fU(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)){_U(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||fU(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)){yU(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(mU(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=vU(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(mU(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(gU(t.key)&&!mU(t.sep,`newline`)){let e=vU(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]}):mU(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&&!mU(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)){yU(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||mU(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=gU(hU(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=gU(hU(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 bU(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new dU||null,prettyErrors:t}}function xU(e,t={}){let{lineCounter:n,prettyErrors:r}=bU(t),i=new yU(n?.addNewLine),a=new ZH(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 pH(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(hH(e,n)),o.warnings.forEach(hH(e,n))),o}function SU(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=xU(e,n);if(!i)return null;if(i.warnings.forEach(e=>GB(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 CU(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 Bz(e)&&!r?e.toString(n):new uH(e,r,n).toString(n)}function wU(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 TU(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,i=r?.resume??r?.stage;if(!r||!i)return null;let a=Math.max(-1,...e.nodes.filter(e=>e.data.run).map(e=>n(e.data))),o=n(r);if(o<0||o>a)return null;let s=e.nodes.filter(e=>e.data.path?.length===2).sort((e,t)=>n(e.data)-n(t.data)).map(e=>e.data.resume??e.data.stage??``),c=e=>!!e&&s.filter(t=>t===e).length>1;return c(i)||o>0&&c(s[o-1])?{label:`Add an id to resume here`,from:i,blocked:!0}:{label:o===a?`Resume from here`:`Re-run from here`,from:i}}var EU=140,DU=280,OU={"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 kU(e){return OU[e]??e}var AU=/\{\{\s*steps\.([A-Za-z0-9_-]+)\.[^}]*\}\}/g;function jU(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function MU(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 NU(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 PU(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(AU)].map(e=>e[1]))]}function FU(e){let t=xU(e).toJS(),n=jU(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=jU(e)?e:{},f=typeof u.type==`string`?u.type:``,p=jU(u.settings)?u.settings:{},m=typeof u.id==`string`?u.id:``,h=`step-${t}`,g=s?`${s}/${m||f}`:m||f;r.push({id:h,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:m||t,title:m||kU(f),type:f,detail:MU(f,p),summary:NU(p),when:typeof u.when==`string`?u.when:void 0,retry:jU(u.retry)&&typeof u.retry.attempts==`number`?u.retry.attempts:void 0,continues:u.on_failure===`continue`,branch:s,path:l,stage:g,occurrence:d(g),...c?{resume:c}:{}}}),m&&a.set(m,h);for(let e of PU(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(jU(t)&&jU(t.parallel)){let n=Object.entries(t.parallel),r=typeof t.id==`string`?t.id:`parallel`,i=[],a=0;n.forEach(([t,o],s)=>{let u=(s-(n.length-1)/2)*DU,d=c,m=c;(Array.isArray(o)?o:[]).forEach((i,o)=>{let c=f(i,`${e+1}-${t}-${o+1}`,u,(l+o)*EU,t,r,[`steps`,e,`parallel`,t,o]);p(d,c,d===m&&s===n.length-1?e-1:void 0),d=[c],a=Math.max(a,o+1)}),i.push(...d)}),c=i,l+=Math.max(a,1);continue}let n=f(t,String(e+1),0,l*EU,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*EU-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 IU={agent:sr,command:Jr,repo:Cr,gate:Gr,forge:jr,human:ti,review:xr,workflow:ii},LU={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function RU(e){return IU[e.split(`.`)[0]]??ii}function zU(e){return Object.keys(LU).map(t=>({title:LU[t],icon:IU[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}function BU(e,t){let n=xU(e).getIn(t,!0);if(Vz(n))return n.toJSON()}function VU(e,t,n){let r=xU(e);return r.setIn(t,r.createNode(qU(n))),r.toString()}function HU(e,t,n){let r=xU(e),i=r.get(`steps`,!0);if(Wz(i)||(r.set(`steps`,r.createNode([])),i=r.get(`steps`,!0)),!Wz(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 UU(e,t){let n=xU(e),r=n.getIn(t.slice(0,-1),!0),i=t.at(-1);if(!Wz(r)||typeof i!=`number`)return{source:e,path:t};let a=n.createNode(n.getIn(t));return Vz(a)&&a.delete(`id`),r.items.splice(i+1,0,a),{source:n.toString(),path:[...t.slice(0,-1),i+1]}}function WU(e,t){let n=xU(e);n.deleteIn(t);let r=t.slice(0,-1);if(r.length>2){let e=n.getIn(r,!0);Wz(e)&&e.items.length===0&&n.deleteIn(r)}return n.toString()}function GU(e,t,n){let r=xU(e),i=r.getIn(t.slice(0,-1),!0),a=t.at(-1);if(!Wz(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 KU(e,t){let n=xU(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 qU(e){if(Array.isArray(e))return e.map(qU);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=qU(r);(typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length!==0)&&(t[n]=e)}return t}function JU(e,t){let n=xU(e).get(t,!0);return n&&typeof n==`object`&&`toJSON`in n?n.toJSON():xU(e).get(t)}function YU(e,t,n){let r=xU(e),i=qU({[t]:n})[t];return i===void 0?r.delete(t):r.set(t,r.createNode(i)),r.toString()}function XU(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function ZU(e,t=[]){let n=xU(e),r=n.errors[0];if(r)return{ok:!1,message:dW(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!fW(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`};le Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:sW(e)}))}var aW=/^(\s*)(-\s+)?/,oW=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function sW(e){let{code:t,comment:n}=cW(e),r=lW(t);return n&&r.push({text:n,kind:`comment`}),r}function cW(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 lW(e){if(!e)return[];let t=[],n=aW.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=oW.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,...uW(i[4]??``)]):[...t,...uW(r)]}function uW(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 dW(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function fW(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pW(e){return typeof e==`string`&&e.trim()!==``}var mW={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},hW={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},gW={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},_W={class:`min-w-0 flex-1`},vW=[`value`,`placeholder`],yW={class:`truncate font-mono text-[11px] text-fg-subtle`},bW={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},xW={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},SW={key:1,class:`space-y-1.5`},CW=[`title`],wW=[`value`],TW=[`value`],EW={key:3,class:`flex flex-wrap items-center gap-1 pt-0.5`},DW=[`onClick`],OW=[`onClick`],kW={key:2,class:`divide-y divide-border rounded-md border border-border`},AW=[`title`],jW=[`value`,`onChange`],MW=[`value`],NW=[`value`,`onInput`],PW=[`value`,`onFocus`,`onInput`],FW=[`title`],IW={key:0,class:`text-xs text-danger`},LW={class:`space-y-2`},RW={class:`divide-y divide-border rounded-md border border-border`},zW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},BW=[`value`],VW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},HW=[`value`],UW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},WW=[`value`],GW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},KW={class:`flex items-center border-t border-border px-4 py-2.5`},qW=n({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=M(()=>BU(n.yaml,n.path)??{}),a=M(()=>typeof i.value.type==`string`?i.value.type:``),o=M(()=>n.vocabulary.find(e=>e.name===a.value)),s=M(()=>typeof i.value.settings==`object`&&i.value.settings!==null?i.value.settings:{}),c=M(()=>KU(n.yaml,n.path)),u=M(()=>o.value?.settings&&i.value.settings?nW(i.value.settings,o.value.settings,`settings`):``),d=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],f=/mission|body|detail|plan|rules/;function p(e,t){return t.type===`string`?t.enum?`select`:f.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 m=M(()=>{let e=Object.entries(o.value?.settings?.properties??{}).map(([e,t])=>({key:e,schema:t,kind:p(e,t)})),t=e.filter(e=>d.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>d.indexOf(e.key)-d.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 h(e){let{id:t,type:i,...a}=e;r(`update:yaml`,VU(n.yaml,n.path,{id:t,type:i,...a}))}function g(e,t){h({...i.value,[e]:t})}function _(e){g(`retry`,{...i.value.retry,...e})}function v(e,t){h({...i.value,settings:{...s.value,[e]:t}})}let y=W(null);function b(e,t){let n=y.value??m.value.lead?.key;if(!n)return;let r=typeof s.value[n]==`string`?s.value[n]:``,i=`{{ steps.${e}.${t} }}`;v(n,r?`${r.trimEnd()} ${i}`:i)}let x=W({});function S(e,t){try{v(e,t.trim()?SU(t):void 0),x.value={...x.value,[e]:``}}catch(t){x.value={...x.value,[e]:String(t.message).split(`
`)[0]}}}let ee=e=>e===void 0?``:CU(e).trimEnd(),w=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),T=e=>typeof s.value[e]==`string`?s.value[e]:``;return(e,t)=>(P(),V(`aside`,mW,[B(`header`,hW,[B(`span`,gW,[(P(),U(ye(F(RU)(a.value)),{class:`size-4`}))]),B(`div`,_W,[B(`input`,{value:i.value.id??``,class:`w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline`,placeholder:F(kU)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>g(`id`,e.target.value)},null,40,vW),B(`div`,yW,L(a.value),1)]),O(F(q),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:C(()=>[O(F(oi))]),_:1})]),B(`div`,bW,[u.value?(P(),V(`p`,xW,L(u.value),1)):N(``,!0),m.value.lead?(P(),V(`section`,SW,[B(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:m.value.lead.schema.description},[l(L(w(m.value.lead.key,m.value.lead.schema))+` `,1),m.value.lead.schema.description?(P(),U(F(_r),{key:0,class:`size-3 text-fg-subtle`})):N(``,!0)],8,CW),m.value.lead.kind===`select`?(P(),V(`select`,{key:0,class:`h-9 w-full rounded-md border border-input bg-background px-2`,value:T(m.value.lead.key),onChange:t[2]||=e=>v(m.value.lead.key,e.target.value||void 0)},[t[13]||=B(`option`,{value:``},`Default`,-1),(P(!0),V(R,null,H(m.value.lead.schema.enum,e=>(P(),V(`option`,{key:e,value:e},L(e),9,TW))),128))],40,wW)):m.value.lead.kind===`text`?(P(),U(F(mh),{key:1,"model-value":T(m.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:t[3]||=e=>y.value=m.value.lead.key,"onUpdate:modelValue":t[4]||=e=>v(m.value.lead.key,String(e))},null,8,[`model-value`])):(P(),U(F(J),{key:2,"model-value":T(m.value.lead.key),onFocus:t[5]||=e=>y.value=m.value.lead.key,"onUpdate:modelValue":t[6]||=e=>v(m.value.lead.key,String(e))},null,8,[`model-value`])),c.value.length&&m.value.lead.kind!==`select`?(P(),V(`div`,EW,[t[14]||=B(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(P(!0),V(R,null,H(c.value,e=>(P(),V(R,{key:e},[B(`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=>b(e,`summary`)},L(e),9,DW),B(`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=>b(e,`result`)},L(e)+`.result`,9,OW)],64))),128))])):N(``,!0)])):N(``,!0),m.value.compact.length?(P(),V(`section`,kW,[(P(!0),V(R,null,H(m.value.compact,e=>(P(),V(`div`,{key:e.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[B(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:e.schema.description},[l(L(w(e.key,e.schema))+` `,1),e.schema.description?(P(),U(F(_r),{key:0,class:`size-3 text-fg-subtle`})):N(``,!0)],8,AW),e.kind===`boolean`?(P(),U(F(sb),{key:0,"model-value":s.value[e.key]===!0,"onUpdate:modelValue":t=>v(e.key,t||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):e.kind===`select`?(P(),V(`select`,{key:1,class:`h-7 max-w-40 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:T(e.key),onChange:t=>v(e.key,t.target.value||void 0)},[t[15]||=B(`option`,{value:``},`Default`,-1),(P(!0),V(R,null,H(e.schema.enum,e=>(P(),V(`option`,{key:e,value:e},L(e),9,MW))),128))],40,jW)):e.kind===`number`?(P(),V(`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=>v(e.key,t.target.value===``?void 0:Number(t.target.value))},null,40,NW)):(P(),V(`input`,{key:3,class:`h-7 w-40 rounded-md border border-input bg-background px-2 text-[13px]`,value:T(e.key),onFocus:t=>y.value=e.key,onInput:t=>v(e.key,t.target.value)},null,40,PW))]))),128))])):N(``,!0),(P(!0),V(R,null,H(m.value.long,e=>(P(),V(`section`,{key:e.key,class:`space-y-1.5`},[B(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[l(L(w(e.key,e.schema))+` `,1),e.schema.description?(P(),U(F(_r),{key:0,class:`size-3 text-fg-subtle`})):N(``,!0)],8,FW),e.kind===`text`?(P(),U(F(mh),{key:0,"model-value":T(e.key),class:`min-h-20 text-[13px]`,onFocus:t=>y.value=e.key,"onUpdate:modelValue":t=>v(e.key,String(t))},null,8,[`model-value`,`onFocus`,`onUpdate:modelValue`])):e.kind===`lines`?(P(),U(F(mh),{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=vU(_U(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=vU(_U(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 SU(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new pU||null,prettyErrors:t}}function CU(e,t={}){let{lineCounter:n,prettyErrors:r}=SU(t),i=new xU(n?.addNewLine),a=new $H(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 hH(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(_H(e,n)),o.warnings.forEach(_H(e,n))),o}function wU(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=CU(e,n);if(!i)return null;if(i.warnings.forEach(e=>qB(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 TU(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 Hz(e)&&!r?e.toString(n):new fH(e,r,n).toString(n)}function EU(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 DU(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,i=r?.resume??r?.stage;if(!r||!i)return null;let a=Math.max(-1,...e.nodes.filter(e=>e.data.run).map(e=>n(e.data))),o=n(r);if(o<0||o>a)return null;let s=e.nodes.filter(e=>e.data.path?.length===2).sort((e,t)=>n(e.data)-n(t.data)).map(e=>e.data.resume??e.data.stage??``),c=e=>!!e&&s.filter(t=>t===e).length>1;return c(i)||o>0&&c(s[o-1])?{label:`Add an id to resume here`,from:i,blocked:!0}:{label:o===a?`Resume from here`:`Re-run from here`,from:i}}var OU=140,kU=280,AU={"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 jU(e){return AU[e]??e}var MU=/\{\{\s*steps\.([A-Za-z0-9_-]+)\.[^}]*\}\}/g;function NU(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function PU(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 FU(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 IU(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(MU)].map(e=>e[1]))]}function LU(e){let t=CU(e).toJS(),n=NU(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=NU(e)?e:{},f=typeof u.type==`string`?u.type:``,p=NU(u.settings)?u.settings:{},m=typeof u.id==`string`?u.id:``,h=`step-${t}`,g=s?`${s}/${m||f}`:m||f;r.push({id:h,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:m||t,title:m||jU(f),type:f,detail:PU(f,p),summary:FU(p),when:typeof u.when==`string`?u.when:void 0,retry:NU(u.retry)&&typeof u.retry.attempts==`number`?u.retry.attempts:void 0,continues:u.on_failure===`continue`,branch:s,path:l,stage:g,occurrence:d(g),...c?{resume:c}:{}}}),m&&a.set(m,h);for(let e of IU(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(NU(t)&&NU(t.parallel)){let n=Object.entries(t.parallel),r=typeof t.id==`string`?t.id:`parallel`,i=[],a=0;n.forEach(([t,o],s)=>{let u=(s-(n.length-1)/2)*kU,d=c,m=c;(Array.isArray(o)?o:[]).forEach((i,o)=>{let c=f(i,`${e+1}-${t}-${o+1}`,u,(l+o)*OU,t,r,[`steps`,e,`parallel`,t,o]);p(d,c,d===m&&s===n.length-1?e-1:void 0),d=[c],a=Math.max(a,o+1)}),i.push(...d)}),c=i,l+=Math.max(a,1);continue}let n=f(t,String(e+1),0,l*OU,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*OU-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 RU={agent:sr,command:Jr,repo:Cr,gate:Gr,forge:jr,human:ti,review:xr,workflow:ii},zU={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function BU(e){return RU[e.split(`.`)[0]]??ii}function VU(e){return Object.keys(zU).map(t=>({title:zU[t],icon:RU[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}function HU(e,t){let n=CU(e).getIn(t,!0);if(Uz(n))return n.toJSON()}function UU(e,t,n){let r=CU(e);return r.setIn(t,r.createNode(YU(n))),r.toString()}function WU(e,t,n){let r=CU(e),i=r.get(`steps`,!0);if(Kz(i)||(r.set(`steps`,r.createNode([])),i=r.get(`steps`,!0)),!Kz(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 GU(e,t){let n=CU(e),r=n.getIn(t.slice(0,-1),!0),i=t.at(-1);if(!Kz(r)||typeof i!=`number`)return{source:e,path:t};let a=n.createNode(n.getIn(t));return Uz(a)&&a.delete(`id`),r.items.splice(i+1,0,a),{source:n.toString(),path:[...t.slice(0,-1),i+1]}}function KU(e,t){let n=CU(e);n.deleteIn(t);let r=t.slice(0,-1);if(r.length>2){let e=n.getIn(r,!0);Kz(e)&&e.items.length===0&&n.deleteIn(r)}return n.toString()}function qU(e,t,n){let r=CU(e),i=r.getIn(t.slice(0,-1),!0),a=t.at(-1);if(!Kz(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 JU(e,t){let n=CU(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 YU(e){if(Array.isArray(e))return e.map(YU);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=YU(r);(typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length!==0)&&(t[n]=e)}return t}function XU(e,t){let n=CU(e).get(t,!0);return n&&typeof n==`object`&&`toJSON`in n?n.toJSON():CU(e).get(t)}function ZU(e,t,n){let r=CU(e),i=YU({[t]:n})[t];return i===void 0?r.delete(t):r.set(t,r.createNode(i)),r.toString()}function QU(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function $U(e,t=[]){let n=CU(e),r=n.errors[0];if(r)return{ok:!1,message:pW(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!mW(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`};le Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:lW(e)}))}var sW=/^(\s*)(-\s+)?/,cW=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function lW(e){let{code:t,comment:n}=uW(e),r=dW(t);return n&&r.push({text:n,kind:`comment`}),r}function uW(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 dW(e){if(!e)return[];let t=[],n=sW.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=cW.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,...fW(i[4]??``)]):[...t,...fW(r)]}function fW(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 pW(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function mW(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function hW(e){return typeof e==`string`&&e.trim()!==``}var gW={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},_W={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},vW={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},yW={class:`min-w-0 flex-1`},bW=[`value`,`placeholder`],xW={class:`truncate font-mono text-[11px] text-fg-subtle`},SW={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},CW={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},wW={key:1,class:`space-y-1.5`},TW=[`title`],EW=[`value`],DW=[`value`],OW={key:3,class:`flex flex-wrap items-center gap-1 pt-0.5`},kW=[`onClick`],AW=[`onClick`],jW={key:2,class:`divide-y divide-border rounded-md border border-border`},MW=[`title`],NW=[`value`,`onChange`],PW=[`value`],FW=[`value`,`onInput`],IW=[`value`,`onFocus`,`onInput`],LW=[`title`],RW={key:0,class:`text-xs text-danger`},zW={class:`space-y-2`},BW={class:`divide-y divide-border rounded-md border border-border`},VW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},HW=[`value`],UW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},WW=[`value`],GW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},KW=[`value`],qW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},JW={class:`flex items-center border-t border-border px-4 py-2.5`},YW=n({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=M(()=>HU(n.yaml,n.path)??{}),a=M(()=>typeof i.value.type==`string`?i.value.type:``),o=M(()=>n.vocabulary.find(e=>e.name===a.value)),s=M(()=>typeof i.value.settings==`object`&&i.value.settings!==null?i.value.settings:{}),c=M(()=>JU(n.yaml,n.path)),u=M(()=>o.value?.settings&&i.value.settings?iW(i.value.settings,o.value.settings,`settings`):``),d=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],f=/mission|body|detail|plan|rules/;function p(e,t){return t.type===`string`?t.enum?`select`:f.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 m=M(()=>{let e=Object.entries(o.value?.settings?.properties??{}).map(([e,t])=>({key:e,schema:t,kind:p(e,t)})),t=e.filter(e=>d.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>d.indexOf(e.key)-d.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 h(e){let{id:t,type:i,...a}=e;r(`update:yaml`,UU(n.yaml,n.path,{id:t,type:i,...a}))}function g(e,t){h({...i.value,[e]:t})}function _(e){g(`retry`,{...i.value.retry,...e})}function v(e,t){h({...i.value,settings:{...s.value,[e]:t}})}let y=W(null);function b(e,t){let n=y.value??m.value.lead?.key;if(!n)return;let r=typeof s.value[n]==`string`?s.value[n]:``,i=`{{ steps.${e}.${t} }}`;v(n,r?`${r.trimEnd()} ${i}`:i)}let x=W({});function S(e,t){try{v(e,t.trim()?wU(t):void 0),x.value={...x.value,[e]:``}}catch(t){x.value={...x.value,[e]:String(t.message).split(`
`)[0]}}}let ee=e=>e===void 0?``:TU(e).trimEnd(),w=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),T=e=>typeof s.value[e]==`string`?s.value[e]:``;return(e,t)=>(P(),V(`aside`,gW,[B(`header`,_W,[B(`span`,vW,[(P(),U(ye(F(BU)(a.value)),{class:`size-4`}))]),B(`div`,yW,[B(`input`,{value:i.value.id??``,class:`w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline`,placeholder:F(jU)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>g(`id`,e.target.value)},null,40,bW),B(`div`,xW,L(a.value),1)]),O(F(q),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:C(()=>[O(F(oi))]),_:1})]),B(`div`,SW,[u.value?(P(),V(`p`,CW,L(u.value),1)):N(``,!0),m.value.lead?(P(),V(`section`,wW,[B(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:m.value.lead.schema.description},[l(L(w(m.value.lead.key,m.value.lead.schema))+` `,1),m.value.lead.schema.description?(P(),U(F(_r),{key:0,class:`size-3 text-fg-subtle`})):N(``,!0)],8,TW),m.value.lead.kind===`select`?(P(),V(`select`,{key:0,class:`h-9 w-full rounded-md border border-input bg-background px-2`,value:T(m.value.lead.key),onChange:t[2]||=e=>v(m.value.lead.key,e.target.value||void 0)},[t[13]||=B(`option`,{value:``},`Default`,-1),(P(!0),V(R,null,H(m.value.lead.schema.enum,e=>(P(),V(`option`,{key:e,value:e},L(e),9,DW))),128))],40,EW)):m.value.lead.kind===`text`?(P(),U(F(mh),{key:1,"model-value":T(m.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:t[3]||=e=>y.value=m.value.lead.key,"onUpdate:modelValue":t[4]||=e=>v(m.value.lead.key,String(e))},null,8,[`model-value`])):(P(),U(F(J),{key:2,"model-value":T(m.value.lead.key),onFocus:t[5]||=e=>y.value=m.value.lead.key,"onUpdate:modelValue":t[6]||=e=>v(m.value.lead.key,String(e))},null,8,[`model-value`])),c.value.length&&m.value.lead.kind!==`select`?(P(),V(`div`,OW,[t[14]||=B(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(P(!0),V(R,null,H(c.value,e=>(P(),V(R,{key:e},[B(`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=>b(e,`summary`)},L(e),9,kW),B(`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=>b(e,`result`)},L(e)+`.result`,9,AW)],64))),128))])):N(``,!0)])):N(``,!0),m.value.compact.length?(P(),V(`section`,jW,[(P(!0),V(R,null,H(m.value.compact,e=>(P(),V(`div`,{key:e.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[B(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:e.schema.description},[l(L(w(e.key,e.schema))+` `,1),e.schema.description?(P(),U(F(_r),{key:0,class:`size-3 text-fg-subtle`})):N(``,!0)],8,MW),e.kind===`boolean`?(P(),U(F(sb),{key:0,"model-value":s.value[e.key]===!0,"onUpdate:modelValue":t=>v(e.key,t||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):e.kind===`select`?(P(),V(`select`,{key:1,class:`h-7 max-w-40 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:T(e.key),onChange:t=>v(e.key,t.target.value||void 0)},[t[15]||=B(`option`,{value:``},`Default`,-1),(P(!0),V(R,null,H(e.schema.enum,e=>(P(),V(`option`,{key:e,value:e},L(e),9,PW))),128))],40,NW)):e.kind===`number`?(P(),V(`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=>v(e.key,t.target.value===``?void 0:Number(t.target.value))},null,40,FW)):(P(),V(`input`,{key:3,class:`h-7 w-40 rounded-md border border-input bg-background px-2 text-[13px]`,value:T(e.key),onFocus:t=>y.value=e.key,onInput:t=>v(e.key,t.target.value)},null,40,IW))]))),128))])):N(``,!0),(P(!0),V(R,null,H(m.value.long,e=>(P(),V(`section`,{key:e.key,class:`space-y-1.5`},[B(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[l(L(w(e.key,e.schema))+` `,1),e.schema.description?(P(),U(F(_r),{key:0,class:`size-3 text-fg-subtle`})):N(``,!0)],8,LW),e.kind===`text`?(P(),U(F(mh),{key:0,"model-value":T(e.key),class:`min-h-20 text-[13px]`,onFocus:t=>y.value=e.key,"onUpdate:modelValue":t=>v(e.key,String(t))},null,8,[`model-value`,`onFocus`,`onUpdate:modelValue`])):e.kind===`lines`?(P(),U(F(mh),{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=>v(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(P(),V(R,{key:2},[O(F(mh),{"model-value":ee(s.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>S(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),x.value[e.key]?(P(),V(`span`,IW,L(x.value[e.key]),1)):N(``,!0)],64))]))),128)),B(`section`,LW,[t[21]||=B(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),B(`div`,RW,[B(`label`,zW,[t[16]||=B(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),B(`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=>g(`when`,e.target.value)},null,40,BW)]),B(`label`,VW,[t[18]||=B(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),B(`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=>g(`on_failure`,e.target.value||void 0)},[...t[17]||=[B(`option`,{value:``},`Park the task`,-1),B(`option`,{value:`continue`},`Continue`,-1)]],40,HW)]),B(`label`,UW,[t[19]||=B(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),B(`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=>_({attempts:e.target.value===``?void 0:Number(e.target.value)})},null,40,WW)]),B(`label`,GW,[t[20]||=B(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),O(F(Xy),{"model-value":i.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":t[10]||=e=>_({backoff:e||void 0})},null,8,[`model-value`])])])])]),B(`footer`,KW,[O(F(q),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[11]||=e=>r(`remove`)},{default:C(()=>[O(F(Xr)),t[22]||=l(` Delete step`,-1)]),_:1}),O(F(q),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[12]||=e=>r(`close`)},{default:C(()=>[...t[23]||=[l(`Done`,-1)]]),_:1})])]))}}),JW=`repository_path`;function YW(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:JW,path:n.trim(),type:`string`,required:!0}),r}function XW(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function ZW(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=XW(Ww(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 QW(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:Ww(e.value,i.type??`string`)})}return n}function $W(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 eG(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...eG(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...eG(n,r)]}):[]}function tG(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function nG(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 rG(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var iG={class:`flex h-full flex-col`},aG={class:`flex items-center gap-2 border-b border-border px-4 py-3`},oG={class:`min-w-0 flex-1 truncate text-sm font-medium`},sG={key:0,class:`flex flex-1 items-center justify-center`},cG={class:`space-y-1.5`},lG=[`disabled`],uG=[`value`],dG={key:1,class:`space-y-1.5`},fG=[`value`],pG=[`title`],mG={class:`space-y-1.5`},hG={id:`bind-paths`},gG=[`value`],_G={class:`divide-y divide-border rounded-md border border-border`},vG={class:`flex items-center gap-1.5 text-xs`},yG={class:`font-mono`},bG={class:`text-fg-subtle`},xG={key:0,class:`text-danger`,title:`Required`},SG=[`title`,`aria-label`,`onClick`],CG=[`onUpdate:modelValue`,`aria-label`],wG=[`onUpdate:modelValue`,`aria-label`],TG={key:2,class:`text-xs text-danger`},EG=[`title`],DG={key:0,class:`space-y-1 px-3 py-2`},OG={key:0,class:`text-xs text-danger`},kG={key:1,class:`truncate font-mono text-xs text-success`},AG={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},jG={class:`space-y-2`},MG={key:0,role:`alert`,class:`text-xs text-danger`},NG={key:1,class:`teLine truncated
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(P(),V(R,{key:2},[O(F(mh),{"model-value":ee(s.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>S(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),x.value[e.key]?(P(),V(`span`,RW,L(x.value[e.key]),1)):N(``,!0)],64))]))),128)),B(`section`,zW,[t[21]||=B(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),B(`div`,BW,[B(`label`,VW,[t[16]||=B(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),B(`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=>g(`when`,e.target.value)},null,40,HW)]),B(`label`,UW,[t[18]||=B(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),B(`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=>g(`on_failure`,e.target.value||void 0)},[...t[17]||=[B(`option`,{value:``},`Park the task`,-1),B(`option`,{value:`continue`},`Continue`,-1)]],40,WW)]),B(`label`,GW,[t[19]||=B(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),B(`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=>_({attempts:e.target.value===``?void 0:Number(e.target.value)})},null,40,KW)]),B(`label`,qW,[t[20]||=B(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),O(F(Xy),{"model-value":i.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":t[10]||=e=>_({backoff:e||void 0})},null,8,[`model-value`])])])])]),B(`footer`,JW,[O(F(q),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[11]||=e=>r(`remove`)},{default:C(()=>[O(F(Xr)),t[22]||=l(` Delete step`,-1)]),_:1}),O(F(q),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[12]||=e=>r(`close`)},{default:C(()=>[...t[23]||=[l(`Done`,-1)]]),_:1})])]))}}),XW=`repository_path`;function ZW(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:XW,path:n.trim(),type:`string`,required:!0}),r}function QW(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function $W(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=QW(Ww(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 eG(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:Ww(e.value,i.type??`string`)})}return n}function tG(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 nG(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...nG(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...nG(n,r)]}):[]}function rG(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function iG(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 aG(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var oG={class:`flex h-full flex-col`},sG={class:`flex items-center gap-2 border-b border-border px-4 py-3`},cG={class:`min-w-0 flex-1 truncate text-sm font-medium`},lG={key:0,class:`flex flex-1 items-center justify-center`},uG={class:`space-y-1.5`},dG=[`disabled`],fG=[`value`],pG={key:1,class:`space-y-1.5`},mG=[`value`],hG=[`title`],gG={class:`space-y-1.5`},_G={id:`bind-paths`},vG=[`value`],yG={class:`divide-y divide-border rounded-md border border-border`},bG={class:`flex items-center gap-1.5 text-xs`},xG={class:`font-mono`},SG={class:`text-fg-subtle`},CG={key:0,class:`text-danger`,title:`Required`},wG=[`title`,`aria-label`,`onClick`],TG=[`onUpdate:modelValue`,`aria-label`],EG=[`onUpdate:modelValue`,`aria-label`],DG={key:2,class:`text-xs text-danger`},OG=[`title`],kG={key:0,class:`space-y-1 px-3 py-2`},AG={key:0,class:`text-xs text-danger`},jG={key:1,class:`truncate font-mono text-xs text-success`},MG={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},NG={class:`space-y-2`},PG={key:0,role:`alert`,class:`text-xs text-danger`},FG={key:1,class:`teLine 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 E$(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=D$(n.code,e);return Array.isArray(e)?e.some(e=>T$(n[r],e,t,n.type===`keyup`)):T$(n[r],e,t,n.type===`keyup`)}}function D$(e,t){return t.includes(e)?`code`:`key`}function O$(e,t){let n=M(()=>u(t?.target)??S$),r=ge(u(e)===!0),i=!1,a=new Set,o=c(u(e));j(()=>u(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),bq([`blur`,`contextmenu`],s),Sq((...e)=>o(...e),e=>{let n=u(t?.actInsideInputWithModifier)??!0,a=u(t?.preventDefault)??!1;if(i=w$(e),(!i||i&&!n)&&C$(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}),Sq((...e)=>o(...e),e=>{let n=u(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&C$(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=u(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?E$(e,a):e}return r}var k$=`vue-flow__node-desc`,A$=`vue-flow__edge-desc`,j$=`vue-flow__aria-live`,M$=[`Enter`,` `,`Escape`],N$={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function P$(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function F$(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 I$(e){return{width:e.offsetWidth,height:e.offsetHeight}}function L$(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function R$(e,t){return{x:L$(e.x,t[0][0],t[1][0]),y:L$(e.y,t[0][1],t[1][1])}}function z$(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function B$(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function V$(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!B$(e)}function H$(e){return V$(e)&&`computedPosition`in e}function U$(e){return!Number.isNaN(e)&&Number.isFinite(e)}function W$(e){return U$(e.width)&&U$(e.height)&&U$(e.x)&&U$(e.y)}function G$(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:bt({width:0,height:0}),computedPosition:bt({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:s0(e.data)?e.data:{},events:bt(s0(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function K$(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:s0(e.data)?e.data:{},events:bt(s0(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function q$(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 J$(...e){if(e.length===3){let[t,n,r]=e;return q$(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>B$(e)&&e.source===r).map(e=>n.find(t=>V$(t)&&t.id===e.target))}function Y$(...e){if(e.length===3){let[t,n,r]=e;return q$(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>B$(e)&&e.target===r).map(e=>n.find(t=>V$(t)&&t.id===e.source))}function X$({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function Z$(e,t){return t.some(t=>B$(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 Q$({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function $$({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?W1(s,o):s}function e1(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 t1({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function n1({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function r1(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=e1(t,t1({...r.computedPosition,...r.dimensions}))}return n1(t)}function i1(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...$$(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=!1}=t,c= 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 O$(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=k$(n.code,e);return Array.isArray(e)?e.some(e=>D$(n[r],e,t,n.type===`keyup`)):D$(n[r],e,t,n.type===`keyup`)}}function k$(e,t){return t.includes(e)?`code`:`key`}function A$(e,t){let n=M(()=>u(t?.target)??w$),r=ge(u(e)===!0),i=!1,a=new Set,o=c(u(e));j(()=>u(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),Sq([`blur`,`contextmenu`],s),wq((...e)=>o(...e),e=>{let n=u(t?.actInsideInputWithModifier)??!0,a=u(t?.preventDefault)??!1;if(i=E$(e),(!i||i&&!n)&&T$(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}),wq((...e)=>o(...e),e=>{let n=u(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&T$(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=u(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?O$(e,a):e}return r}var j$=`vue-flow__node-desc`,M$=`vue-flow__edge-desc`,N$=`vue-flow__aria-live`,P$=[`Enter`,` `,`Escape`],F$={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function I$(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function L$(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 R$(e){return{width:e.offsetWidth,height:e.offsetHeight}}function z$(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function B$(e,t){return{x:z$(e.x,t[0][0],t[1][0]),y:z$(e.y,t[0][1],t[1][1])}}function V$(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function H$(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function U$(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!H$(e)}function W$(e){return U$(e)&&`computedPosition`in e}function G$(e){return!Number.isNaN(e)&&Number.isFinite(e)}function K$(e){return G$(e.width)&&G$(e.height)&&G$(e.x)&&G$(e.y)}function q$(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:bt({width:0,height:0}),computedPosition:bt({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:l0(e.data)?e.data:{},events:bt(l0(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function J$(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:l0(e.data)?e.data:{},events:bt(l0(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Y$(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 X$(...e){if(e.length===3){let[t,n,r]=e;return Y$(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>H$(e)&&e.source===r).map(e=>n.find(t=>U$(t)&&t.id===e.target))}function Z$(...e){if(e.length===3){let[t,n,r]=e;return Y$(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>H$(e)&&e.target===r).map(e=>n.find(t=>U$(t)&&t.id===e.source))}function Q$({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function $$(e,t){return t.some(t=>H$(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 e1({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function t1({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?K1(s,o):s}function n1(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 r1({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function i1({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function a1(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=n1(t,r1({...r.computedPosition,...r.dimensions}))}return i1(t)}function o1(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...t1(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=!1}=t,c= 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}
@@ -149,4 +149,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`},R1=class extends Error{constructor(e,...t){super(L1[e]?.call(L1,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function z1(e){return`clientX`in e}function B1(e){return`sourceEvent`in e}function V1(e,t){let n=z1(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 H1=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function U1(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function W1(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var G1=()=>!0;function K1(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function q1(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())F$(i,P$(e))>0&&r.push(e);return r}var J1=250;function Y1(e,t,n,r){let i=[],a=1/0,o=q1(e,n,t+J1);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}=M1(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 X1(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=G1},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:_}=V1(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=Z1(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===_$.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=e0(t,e,a,p,n,!0)}return b}function Z1(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Q1(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function $1(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function e0(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===_$.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,...M1(o,c,c.position,!0)}:c}var t0={[m$.Left]:m$.Right,[m$.Right]:m$.Left,[m$.Top]:m$.Bottom,[m$.Bottom]:m$.Top},n0=[`production`,`prod`];function r0(e,...t){i0()&&console.warn(`[Vue Flow]: ${e}`,...t)}function i0(){return!n0.includes(`production`)}function a0(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,...I$(t)}}):null}function o0(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),ht(()=>{o.blur()})):n([e])}function s0(e){return F(e)!==void 0}function c0(e,t,n,r){if(!e||!e.source||!e.target)return n(new R1(I1.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=B$(e)?e:{...e,id:X$(e)},i=K$(i,void 0,r),!Z$(i,t)&&i}function l0(e,t,n,r,i){if(!t.source||!t.target)return i(new R1(I1.EDGE_INVALID,e.id)),!1;if(!n)return i(new R1(I1.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?X$(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function u0(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!V$(o)){n(new R1(I1.NODE_INVALID,o?.id));continue}let s=G$(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 R1(I1.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 d0(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 f0(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}`;d0(`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`},B1=class extends Error{constructor(e,...t){super(z1[e]?.call(z1,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function V1(e){return`clientX`in e}function H1(e){return`sourceEvent`in e}function U1(e,t){let n=V1(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 W1=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function G1(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function K1(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var q1=()=>!0;function J1(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function Y1(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())L$(i,I$(e))>0&&r.push(e);return r}var X1=250;function Z1(e,t,n,r){let i=[],a=1/0,o=Y1(e,n,t+X1);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}=P1(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 Q1(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=q1},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:_}=U1(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=$1(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===y$.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=n0(t,e,a,p,n,!0)}return b}function $1(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function e0(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function t0(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function n0(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===y$.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,...P1(o,c,c.position,!0)}:c}var r0={[g$.Left]:g$.Right,[g$.Right]:g$.Left,[g$.Top]:g$.Bottom,[g$.Bottom]:g$.Top},i0=[`production`,`prod`];function a0(e,...t){o0()&&console.warn(`[Vue Flow]: ${e}`,...t)}function o0(){return!i0.includes(`production`)}function s0(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,...R$(t)}}):null}function c0(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),ht(()=>{o.blur()})):n([e])}function l0(e){return F(e)!==void 0}function u0(e,t,n,r){if(!e||!e.source||!e.target)return n(new B1(R1.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=H$(e)?e:{...e,id:Q$(e)},i=J$(i,void 0,r),!$$(i,t)&&i}function d0(e,t,n,r,i){if(!t.source||!t.target)return i(new B1(R1.EDGE_INVALID,e.id)),!1;if(!n)return i(new B1(R1.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?Q$(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function f0(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!U$(o)){n(new B1(R1.NODE_INVALID,o?.id));continue}let s=q$(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 B1(R1.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 p0(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 m0(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}`;p0(`source`,o,`${r}-${a}--Line truncated
+7 -3
View File
@@ -10,6 +10,7 @@ interface PersonalToken {
created_at: string;
}
const available = ref(false);
const tokens = ref<PersonalToken[]>([]);
const created = ref("");
const error = ref("");
@@ -38,7 +39,9 @@ async function run(action: () => Promise<void>): Promise<void> {
const load = () =>
run(async () => {
tokens.value = (await call<{ tokens: PersonalToken[] }>("/api/tokens"))?.tokens ?? [];
const result = await call<{ tokens: PersonalToken[]; available: boolean }>("/api/tokens");
available.value = result?.available ?? false;
tokens.value = result?.tokens ?? [];
});
const create = () =>
@@ -60,9 +63,10 @@ onMounted(load);
<section class="mb-8" aria-labelledby="personal-tokens">
<div class="mb-3 flex items-center justify-between gap-2">
<h2 id="personal-tokens" class="text-sm font-medium">Your API tokens</h2>
<Button size="sm" :disabled="busy" @click="create"><Plus data-icon="inline-start" /> New token</Button>
<Button v-if="available" size="sm" :disabled="busy" @click="create"><Plus data-icon="inline-start" /> New token</Button>
</div>
<p class="mb-3 text-xs text-fg-subtle">
<p v-if="!available && !busy && !error" class="mb-3 text-sm text-fg-subtle">Personal tokens need a signed-in person.</p>
<p v-if="available" class="mb-3 text-xs text-fg-subtle">
Send it as <code>Authorization: Bearer &lt;token&gt;</code>.
</p>
<p v-if="error" role="alert" class="mb-3 text-sm text-danger">{{ error }}</p>