feat(curators): edit and apply definitions live

This commit is contained in:
sam committed 2026-10-09 09:57:56 +11:00
1 parent 82903f27a8
commit 8c00d076f8
13 files changed
+327 -107

No files matched your search

+22 -24
View File
@@ -11,6 +11,8 @@ import (
"github.com/samcharles93/ai-sdk/runtime"
"github.com/samcharles93/archie-core/internal/agentexec/modelloop"
"github.com/samcharles93/archie-core/internal/app/controlplane"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/curator"
"github.com/samcharles93/archie-core/internal/events"
infraMemory "github.com/samcharles93/archie-core/internal/infrastructure/memory"
@@ -44,30 +46,6 @@ func (b *server) setupCurators(ctx context.Context) {
log.Error("session-memory curator registration failed", "err", err)
}
for _, def := range b.cfg.Curators {
if !def.Enabled {
continue
}
engine := curator.NewDefinitionEngine(curator.Definition{
Name: def.Name,
Enabled: def.Enabled,
Instructions: def.Instructions,
Manifest: curator.Manifest{
Interval: def.Interval.Std(),
Cooldown: def.Cooldown.Std(),
OnInput: def.OnInput,
Tools: def.Tools,
Skills: def.Skills,
MemoryEngine: def.MemoryEngine,
Conversations: def.Conversations,
Model: def.Model,
},
})
if err := b.curatorRegistry.Register(engine); err != nil {
log.Error("config curator registration failed", "curator", def.Name, "err", err)
}
}
b.curatorRuntime = curator.NewRuntime(b.curatorRegistry, curator.RuntimeConfig{})
curator.WakeOnPrimaryInput(ctx, b.bus, b.curatorRuntime, events.KindTurnCompleted)
rt := b.curatorRuntime
@@ -168,3 +146,23 @@ func (r curatorLLMRunner) Chat(ctx context.Context, req curator.ChatRequest) (cu
}
return curator.ChatResult{Text: res.Text, ToolCalls: calls}, nil
}
func (b *server) applyCurators(ctx context.Context, defs []config.CuratorDefinition) error {
definitions := make([]curator.Definition, 0, len(defs))
for _, def := range defs {
definitions = append(definitions, controlplane.CuratorDefinition(def))
}
return b.curatorRuntime.ReplaceDefinitions(ctx, definitions)
}
func (b *server) watchCurators(ctx context.Context, version int64) error {
updates, err := b.controlPlane.WatchCurators(ctx, version)
if err != nil {
return err
}
watchStatus(ctx, b.applyStatus.Report, b.log, controlplane.CuratorsKind, "curators", version, updates, b.controlPlane.WatchCurators,
func(update controlplane.AppliedCurators) int64 { return update.Version },
func(update controlplane.AppliedCurators) error { return update.Err },
func(update controlplane.AppliedCurators) error { return b.applyCurators(ctx, update.Definitions) })
return nil
}
+13
View File
@@ -8,6 +8,7 @@ import (
"google.golang.org/grpc"
"github.com/samcharles93/archie-core/internal/app/controlplane"
"github.com/samcharles93/archie-core/internal/domain/messaging"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/gateway"
@@ -66,6 +67,18 @@ func (b *server) startGatewayRuntime(ctx context.Context, actor gateway.ChatTask
if err := b.curatorRuntime.Start(ctx); err != nil {
b.log.Error("curator runtime startup", "err", err)
}
defs, version, err := b.controlPlane.Curators(ctx)
if err == nil {
err = b.applyCurators(ctx, defs)
}
b.applyStatus.Report(ctx, controlplane.CuratorsKind, version, err)
if err != nil {
b.log.Error("curator definitions apply failed", "err", err)
}
if err := b.watchCurators(ctx, version); err != nil {
return nil, fmt.Errorf("watch curators: %w", err)
}
return contract, nil
}
@@ -115,7 +115,7 @@ func watchStatus[T any](
open func(ctx context.Context, after int64) (<-chan T, error),
versionOf func(T) int64,
errOf func(T) error,
deliver func(T),
deliver func(T) error,
) {
var lastApplyErr, streamErr error
watchOpen := func(ctx context.Context, after int64) (<-chan T, error) {
@@ -140,7 +140,8 @@ func watchStatus[T any](
log.Error("control-plane watch failed", "kind", kind, "err", err)
return
}
deliver(update)
lastApplyErr = deliver(update)
report(ctx, kind, versionOf(update), lastApplyErr)
},
func() {
// A refusal already on the record outranks the outage; it is the
@@ -171,9 +172,9 @@ func (b *server) watchPersonas(ctx context.Context, version int64) error {
b.controlPlane.WatchPersonas,
func(update controlplane.AppliedPersonas) int64 { return update.Version },
func(update controlplane.AppliedPersonas) error { return update.Err },
func(update controlplane.AppliedPersonas) {
func(update controlplane.AppliedPersonas) error {
b.applyPersonas(update.Collection, update.Version)
b.applyStatus.Report(ctx, controlplane.PersonasKind, update.Version, nil)
return nil
})
return nil
}
@@ -200,9 +201,9 @@ func (b *server) watchSoul(ctx context.Context, version int64) error {
b.controlPlane.WatchSoul,
func(update controlplane.AppliedSoul) int64 { return update.Version },
func(update controlplane.AppliedSoul) error { return update.Err },
func(update controlplane.AppliedSoul) {
func(update controlplane.AppliedSoul) error {
b.applySoul(update.Soul, update.Version)
b.applyStatus.Report(ctx, controlplane.SoulKind, update.Version, nil)
return nil
})
return nil
}
+70
View File
@@ -0,0 +1,70 @@
package controlplane
import (
"context"
"encoding/json"
"fmt"
"strings"
"github.com/samcharles93/archie-core/internal/config"
pb "github.com/samcharles93/archie-core/internal/contracts/controlplane/v1"
"github.com/samcharles93/archie-core/internal/domain/curator"
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanerpc"
)
const CuratorsKind = "curators"
func curatorDefinition() Definition {
return Definition{
Kind: CuratorsKind, Title: "Curators", Document: []config.CuratorDefinition{}, ApplyMode: "live",
Seed: func(cfg config.Config) any { return cfg.Curators },
Validate: func(input []byte) error {
return validateAs(input, func(defs []config.CuratorDefinition) error {
names := map[string]bool{"skill": true, "session-memory": true}
for _, def := range defs {
if strings.TrimSpace(def.Name) == "" || names[def.Name] {
return fmt.Errorf("curator name %q is empty, reserved or repeated", def.Name)
}
names[def.Name] = true
if def.Interval <= 0 {
return fmt.Errorf("curator %s: interval must be positive", def.Name)
}
if err := CuratorDefinition(def).Manifest.Validate(); err != nil {
return fmt.Errorf("curator %s: %w", def.Name, err)
}
}
return nil
})
},
}
}
func CuratorDefinition(def config.CuratorDefinition) curator.Definition {
return curator.Definition{Name: def.Name, Enabled: def.Enabled, Instructions: def.Instructions, Manifest: curator.Manifest{
Interval: def.Interval.Std(), Cooldown: def.Cooldown.Std(), OnInput: def.OnInput, Tools: def.Tools, Skills: def.Skills, MemoryEngine: def.MemoryEngine, Conversations: def.Conversations, Model: def.Model,
}}
}
func (c *Client) Curators(ctx context.Context) ([]config.CuratorDefinition, int64, error) {
var defs []config.CuratorDefinition
version, _, err := c.Query(ctx, CuratorsKind, func(value []byte) error { return json.Unmarshal(value, &defs) })
return defs, version, err
}
type AppliedCurators struct {
Definitions []config.CuratorDefinition
Version int64
Err error
}
func (c *Client) WatchCurators(ctx context.Context, after int64) (<-chan AppliedCurators, error) {
stream, err := c.rpc.Watch(ctx, &pb.WatchRequest{Kind: CuratorsKind, AfterVersion: after})
if err != nil {
return nil, controlplanerpc.ClientError(err)
}
return watchUpdates(ctx, stream, func(resource *pb.Resource) AppliedCurators {
update := AppliedCurators{Version: resource.Version}
update.Err = json.Unmarshal(resource.ValueJson, &update.Definitions)
return update
}, func(err error) AppliedCurators { return AppliedCurators{Err: err} }), nil
}
+1 -1
View File
@@ -8,7 +8,7 @@ import (
// Schemas are not declared here: each Definition names its document type, and
// Definition.Descriptor derives the JSON Schema from it (internal/app/controlplane/schema.go).
func builtinDefinitions(steps workflow.StepRegistry, settings map[string]any) []Definition {
definitions := []Definition{workflowDefinition(), workflowDefinitionsDefinition(steps, settings), workflowEnablementDefinition(), personaDefinition(), soulDefinition(), scheduleDefinition(), agentProfileDefinition(), playbooksDefinition(), skillsDefinition(), credentialBindingsDefinition(), identityGrantsDefinition(), reviewSettingsDefinition()}
definitions := []Definition{workflowDefinition(), workflowDefinitionsDefinition(steps, settings), workflowEnablementDefinition(), personaDefinition(), curatorDefinition(), soulDefinition(), scheduleDefinition(), agentProfileDefinition(), playbooksDefinition(), skillsDefinition(), credentialBindingsDefinition(), identityGrantsDefinition(), reviewSettingsDefinition()}
definitions = append(definitions, modelDefinitions()...)
definitions = append(definitions, operationalDefinitions()...)
return definitions
+1 -1
View File
@@ -33,7 +33,7 @@ func Applicability() map[string][]string {
for _, kind := range []string{"provider-settings", "model-role-assignments", "repository-policies", "scheduling-policy", "tool-settings", "plugin-settings", "review-settings", "channel-settings", "container-runtime-policies", "credential-bindings", "identity-grants", "agent-profiles", "workflow-execution-settings", "extension-settings", "workflow-definitions", "workflow-enablement", "schedules", "eda-playbooks"} {
kinds[kind] = []string{Daemon}
}
for _, kind := range []string{"provider-settings", "model-role-assignments", "tool-settings", "channel-settings", "plugin-settings", "extension-settings", "personas", "soul", "skills"} {
for _, kind := range []string{"provider-settings", "model-role-assignments", "tool-settings", "channel-settings", "plugin-settings", "extension-settings", "personas", "soul", "skills", "curators"} {
kinds[kind] = append(kinds[kind], Gateway)
}
for _, kind := range []string{"channel-settings", "extension-settings"} {
+18 -1
View File
@@ -199,7 +199,7 @@ func (r *Registry) Names() []string {
// error. This is the family's failure-isolation boundary for lifecycle.
func (r *Registry) Start(ctx context.Context) error {
r.mu.Lock()
if r.state != stateIdle {
if r.state == stateRunning {
r.mu.Unlock()
return ErrStarted
}
@@ -312,3 +312,20 @@ func isNilEngine(c CuratorEngine) bool {
}
return false
}
func (r *Registry) replaceDefinitions(candidate *Registry) {
r.mu.Lock()
defer r.mu.Unlock()
r.order = slices.DeleteFunc(r.order, func(name string) bool {
if _, custom := r.curators[name].(*DefinitionEngine); !custom {
return false
}
delete(r.curators, name)
delete(r.status, name)
return true
})
for _, name := range candidate.order {
r.curators[name] = candidate.curators[name]
r.order = append(r.order, name)
}
}
+27
View File
@@ -77,6 +77,7 @@ func (rt *Runtime) Start(ctx context.Context) error {
rt.started = true
loopCtx, cancel := context.WithCancel(ctx)
rt.cancel = cancel
rt.nudges = make(map[string]chan struct{})
for _, name := range rt.registry.Names() {
c, _ := rt.registry.Get(name)
if c.Manifest().OnInput {
@@ -332,3 +333,29 @@ func (rt *Runtime) emitRun(name string, at time.Time, result PassResult) {
})
}
}
// ReplaceDefinitions drains current passes before replacing data-defined
// curators. Built-in engines and the registry's observation surface survive.
func (rt *Runtime) ReplaceDefinitions(ctx context.Context, definitions []Definition) error {
candidate := NewRegistry(rt.registry.Host())
for _, def := range definitions {
if !def.Enabled {
continue
}
if held, ok := rt.registry.Get(def.Name); ok {
if _, custom := held.(*DefinitionEngine); !custom {
return fmt.Errorf("%w: %s", ErrDuplicate, def.Name)
}
}
if err := candidate.Register(NewDefinitionEngine(def)); err != nil {
return err
}
}
stopCtx, cancel := context.WithTimeout(ctx, defaultPassTimeout)
defer cancel()
if err := rt.Stop(stopCtx); err != nil {
return err
}
rt.registry.replaceDefinitions(candidate)
return rt.Start(ctx)
}
+43
View File
@@ -0,0 +1,43 @@
package curator
import (
"context"
"testing"
"time"
)
func TestReplaceLiveDefinitions(t *testing.T) {
ctx := t.Context()
registry := NewRegistry(Registrar{})
runtime := NewRuntime(registry, RuntimeConfig{})
if err := runtime.Start(ctx); err != nil {
t.Fatal(err)
}
defer func() {
if err := runtime.Stop(context.Background()); err != nil {
t.Error(err)
}
}()
for _, tt := range []struct {
name string
defs []Definition
present bool
wantErr bool
}{
{"add without restart", []Definition{{Name: "custom", Enabled: true, Manifest: Manifest{Interval: time.Hour}}}, true, false},
{"undeclared host refuses replacement", []Definition{{Name: "custom", Enabled: true, Manifest: Manifest{Interval: time.Hour, Tools: []string{"secret"}}}}, true, true},
{"disable removes loop", []Definition{{Name: "custom", Enabled: false, Manifest: Manifest{Interval: time.Hour}}}, false, false},
{"re-enable", []Definition{{Name: "custom", Enabled: true, Manifest: Manifest{Interval: 2 * time.Hour}}}, true, false},
{"delete", nil, false, false},
} {
t.Run(tt.name, func(t *testing.T) {
err := runtime.ReplaceDefinitions(ctx, tt.defs)
if (err != nil) != tt.wantErr {
t.Fatalf("error = %v", err)
}
if _, ok := registry.Get("custom"); ok != tt.present {
t.Fatalf("registered = %v, want %v", ok, tt.present)
}
})
}
}
+1 -1
View File
@@ -1 +1 @@
import{Bn as e,C as t,Cr as n,Ct as r,D as i,E as a,Et as o,Gt as s,J as c,Kn as l,Lt as u,Or as d,Pt as f,Qt as p,Sr as m,Tr as h,Wn as g,_n as _,_t as v,an as y,ar as b,br as x,c as S,d as C,dn as w,g as T,gt as E,hr as D,ht as ee,i as te,jr as O,l as ne,ln as re,lr as ie,m as ae,mt as k,n as oe,nr as se,o as ce,p as A,pr as j,pt as M,rt as le,s as ue,sr as N,tr as de,u as fe,ur as pe,vr as P,w as me,wt as he,xr as ge,yn as _e,zn as F,zt as ve}from"./PageHeader.js";var ye=typeof window<`u`,be,I=e=>be=e,xe=Symbol();function Se(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var Ce=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function we(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function L(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){De(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function Te(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function R(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var z=typeof navigator==`object`?navigator:{userAgent:``},Ee=/Macintosh/.test(z.userAgent)&&/AppleWebKit/.test(z.userAgent)&&!/Safari/.test(z.userAgent),De=ye?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!Ee?Oe:`msSaveOrOpenBlob`in z?ke:Ae:()=>{};function Oe(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?R(r):Te(r.href)?L(e,t,n):(r.target=`_blank`,R(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){R(r)},0))}function ke(e,t=`download`,n){if(typeof e==`string`){if(Te(e))L(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){R(t)})}}else navigator.msSaveOrOpenBlob(we(e,n),t)}function Ae(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return L(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(Ce.HTMLElement))||`safari`in Ce,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||Ee)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:je}=Object;function Me(){let e=de(!0),t=e.run(()=>D({})),n=[],r=[],i=ie({install(e){I(i),i._a=e,e.provide(xe,i),e.config.globalProperties.$pinia=i,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}var B=()=>{};function Ne(e,t,n,r=B){e.add(t);let i=()=>{e.delete(t)&&r()};return!n&&se()&&pe(i),i}function V(e,...t){e.forEach(e=>{e(...t)})}var Pe=e=>e(),Fe=Symbol(),H=Symbol();function U(e,t){e instanceof Map&&t instanceof Map?t.forEach((t,n)=>e.set(n,t)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(let n in t){if(!Object.hasOwn(t,n))continue;let r=t[n],i=e[n];e[n]=Se(i)&&Se(r)&&Object.hasOwn(e,n)&&!N(r)&&!b(r)?U(i,r):r}return e}var Ie=Symbol();function Le(e){return!e||typeof e!=`object`||!Object.hasOwn(e,Ie)}var{assign:W}=Object;function Re(e){return!!(N(e)&&e.effect)}function ze(e,t,n,r){let{state:i,actions:a,getters:o}=t,s=n.state.value[e],c;function l(){return s||(n.state.value[e]=i?i():{}),W(m(n.state.value[e]),a,Object.keys(o||{}).reduce((t,r)=>(t[r]=ie(M(()=>{I(n);let t=n._s.get(e);return o[r].call(t,t)})),t),{}))}return c=Be(e,l,t,n,r,!0),c}function Be(e,t,n={},r,i,a){let o,s=W({actions:{}},n),c={deep:!0},l,u,d=new Set,f=new Set,m,h=r.state.value[e];!a&&!h&&(r.state.value[e]={});let g;function _(t){let n;l=u=!1,typeof t==`function`?(t(r.state.value[e]),n={type:`patch function`,storeId:e,events:m}):(U(r.state.value[e],t),n={type:`patch object`,payload:t,storeId:e,events:m});let i=g=Symbol();p().then(()=>{g===i&&(l=!0)}),u=!0,V(d,n,r.state.value[e])}let v=a?function(){let{state:e}=n,t=e?e():{};this.$patch(e=>{W(e,t)})}:B;function y(){o.stop(),d.clear(),f.clear(),r._s.delete(e)}let S=(t,n=``)=>{if(Fe in t)return t[H]=n,t;let i=function(){I(r);let n=Array.from(arguments),a=new Set,o=new Set;function s(e){a.add(e)}function cLine truncated
import{Bn as e,C as t,Cr as n,Ct as r,D as i,E as a,Et as o,Gt as s,J as c,Kn as l,Lt as u,Or as d,Pt as f,Qt as p,Sr as m,Tr as h,Wn as g,_n as _,_t as v,an as y,ar as b,br as x,c as S,d as C,dn as w,g as T,gt as E,hr as D,ht as ee,i as te,jr as O,l as ne,ln as re,lr as ie,m as ae,mt as k,n as oe,nr as se,o as ce,p as A,pr as j,pt as M,rt as le,s as ue,sr as N,tr as de,u as fe,ur as pe,vr as P,w as me,wt as he,xr as ge,yn as _e,zn as F,zt as ve}from"./PageHeader.js";var ye=typeof window<`u`,be,I=e=>be=e,xe=Symbol();function Se(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var Ce=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function we(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function L(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){De(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function Te(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function R(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var z=typeof navigator==`object`?navigator:{userAgent:``},Ee=/Macintosh/.test(z.userAgent)&&/AppleWebKit/.test(z.userAgent)&&!/Safari/.test(z.userAgent),De=ye?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!Ee?Oe:`msSaveOrOpenBlob`in z?ke:Ae:()=>{};function Oe(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?R(r):Te(r.href)?L(e,t,n):(r.target=`_blank`,R(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){R(r)},0))}function ke(e,t=`download`,n){if(typeof e==`string`){if(Te(e))L(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){R(t)})}}else navigator.msSaveOrOpenBlob(we(e,n),t)}function Ae(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return L(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(Ce.HTMLElement))||`safari`in Ce,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||Ee)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:je}=Object;function Me(){let e=de(!0),t=e.run(()=>D({})),n=[],r=[],i=ie({install(e){I(i),i._a=e,e.provide(xe,i),e.config.globalProperties.$pinia=i,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}var B=()=>{};function Ne(e,t,n,r=B){e.add(t);let i=()=>{e.delete(t)&&r()};return!n&&se()&&pe(i),i}function V(e,...t){e.forEach(e=>{e(...t)})}var Pe=e=>e(),Fe=Symbol(),H=Symbol();function U(e,t){e instanceof Map&&t instanceof Map?t.forEach((t,n)=>e.set(n,t)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(let n in t){if(!Object.hasOwn(t,n))continue;let r=t[n],i=e[n];e[n]=Se(i)&&Se(r)&&Object.hasOwn(e,n)&&!N(r)&&!b(r)?U(i,r):r}return e}var Ie=Symbol();function Le(e){return!e||typeof e!=`object`||!Object.hasOwn(e,Ie)}var{assign:W}=Object;function Re(e){return!!(N(e)&&e.effect)}function ze(e,t,n,r){let{state:i,actions:a,getters:o}=t,s=n.state.value[e],c;function l(){return s||(n.state.value[e]=i?i():{}),W(m(n.state.value[e]),a,Object.keys(o||{}).reduce((t,r)=>(t[r]=ie(M(()=>{I(n);let t=n._s.get(e);return o[r].call(t,t)})),t),{}))}return c=Be(e,l,t,n,r,!0),c}function Be(e,t,n={},r,i,a){let o,s=W({actions:{}},n),c={deep:!0},l,u,d=new Set,f=new Set,m,h=r.state.value[e];!a&&!h&&(r.state.value[e]={});let g;function _(t){let n;l=u=!1,typeof t==`function`?(t(r.state.value[e]),n={type:`patch function`,storeId:e,events:m}):(U(r.state.value[e],t),n={type:`patch object`,payload:t,storeId:e,events:m});let i=g=Symbol();p().then(()=>{g===i&&(l=!0)}),u=!0,V(d,n,r.state.value[e])}let v=a?function(){let{state:e}=n,t=e?e():{};this.$patch(e=>{W(e,t)})}:B;function y(){o.stop(),d.clear(),f.clear(),r._s.delete(e)}let S=(t,n=``)=>{if(Fe in t)return t[H]=n,t;let i=function(){I(r);let n=Array.from(arguments),a=new Set,o=new Set;function s(e){a.add(e)}function cLine truncated
+70 -70
View File
@@ -1,70 +1,70 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentProfilesPage.js","assets/PageHeader.js","assets/HistoryLink.js","assets/CredentialBindingsPage.js","assets/PlaybooksPage.js","assets/HarnessPage.js","assets/HarnessPage.css"])))=>i.map(i=>d[i]);
import{$ as e,$n as t,$t as n,A as r,An as i,Ar as a,At as o,B as s,Bn as c,Bt as l,Cn as u,Cr as d,Ct as f,D as p,Dn as m,Dr as h,Dt as g,En as _,Er as v,Et as y,F as b,Fn as x,Ft as S,G as C,Gn as w,Gt as T,H as ee,Hn as E,Ht as te,I as D,In as ne,It as O,J as re,Jn as ie,Jt as ae,K as oe,Kn as se,Kt as ce,L as le,Ln as ue,Lt as de,M as fe,Mn as pe,Mr as me,Mt as he,N as ge,Nn as _e,Nt as ve,O as ye,On as be,Or as k,Ot as xe,P as Se,Pn as Ce,Pt as we,Q as Te,Qn as Ee,Qt as De,R as Oe,Rn as ke,Rt as Ae,S as je,Sn as Me,Sr as Ne,St as Pe,T as Fe,Tn as Ie,Tr as A,Tt as Le,U as Re,Un as ze,Ut as Be,V as Ve,Vn as He,Vt as Ue,W as We,Wn as j,Wt as Ge,X as Ke,Xn as qe,Xt as Je,Y as Ye,Yn as Xe,Yt as Ze,Z as Qe,Zn as $e,Zt as M,_ as et,_n as N,_r as tt,_t as P,a as nt,an as F,ar as rt,at as it,b as at,bn as ot,br as st,bt as ct,cn as lt,cr as ut,ct as dt,dn as I,dr as ft,dt as pt,en as mt,er as ht,et as gt,f as _t,fn as vt,fr as yt,ft as bt,gn as xt,gr as St,gt as L,h as Ct,hn as wt,hr as R,ht as z,i as B,in as Tt,ir as Et,it as Dt,j as Ot,jn as kt,jr as V,jt as At,k as jt,kn as Mt,kr as Nt,kt as Pt,ln as Ft,lr as It,lt as Lt,mn as Rt,mr as zt,mt as H,n as Bt,nn as Vt,nr as Ht,nt as Ut,on as Wt,or as Gt,ot as Kt,pn as qt,pr as Jt,pt as U,q as Yt,qn as Xt,qt as Zt,r as Qt,rn as $t,rr as en,rt as W,sn as tn,sr as nn,st as rn,t as an,tn as on,tr as sn,tt as cn,un as ln,ur as un,ut as dn,v as fn,vn as G,vr as pn,vt as mn,wn as hn,wr as gn,wt as K,x as q,xn as _n,xr as vn,xt as yn,y as bn,yn as xn,yr as Sn,yt as Cn,z as wn,zn as J,zt as Tn}from"./PageHeader.js";import{C as En,S as Dn,T as On,_ as kn,a as An,b as jn,c as Mn,d as Nn,f as Pn,g as Fn,h as In,i as Ln,l as Rn,m as zn,n as Bn,o as Vn,p as Hn,r as Un,s as Wn,t as Gn,u as Kn,v as Y,w as qn,x as Jn,y as Yn}from"./HistoryLink.js";var Xn=Object.defineProperty,Zn=(e,t)=>{let n={};for(var r in e)Xn(n,r,{get:e[r],enumerable:!0});return t||Xn(n,Symbol.toStringTag,{value:`Module`}),n};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Qn=Zn({BaseTransition:()=>Te,BaseTransitionPropsValidators:()=>e,Comment:()=>gt,DeprecationTypes:()=>null,EffectScope:()=>Xe,ErrorCodes:()=>cn,ErrorTypeStrings:()=>Ut,Fragment:()=>W,KeepAlive:()=>Dt,ReactiveEffect:()=>qe,Static:()=>it,Suspense:()=>Kt,Teleport:()=>rn,Text:()=>dt,TrackOpTypes:()=>$e,Transition:()=>ye,TransitionGroup:()=>jt,TriggerOpTypes:()=>Ee,VueElement:()=>r,assertNumber:()=>Lt,callWithAsyncErrorHandling:()=>dn,callWithErrorHandling:()=>pt,camelize:()=>v,capitalize:()=>h,cloneVNode:()=>bt,compatUtils:()=>null,compile:()=>$n,computed:()=>U,createApp:()=>Ot,createBlock:()=>z,createCommentVNode:()=>L,createElementBlock:()=>P,createElementVNode:()=>H,createHydrationRenderer:()=>mn,createPropsRestProxy:()=>Cn,createRenderer:()=>ct,createSSRApp:()=>fe,createSlots:()=>yn,createStaticVNode:()=>Pe,createTextVNode:()=>f,createVNode:()=>K,customRef:()=>t,defineAsyncComponent:()=>Le,defineComponent:()=>y,defineCustomElement:()=>ge,defineEmits:()=>g,defineExpose:()=>xe,defineModel:()=>Pt,defineOptions:()=>o,defineProps:()=>At,defineSSRCustomElement:()=>Se,defineSlots:()=>he,devtools:()=>ve,effect:()=>ht,effectScope:()=>sn,getCurrentInstance:()=>we,getCurrentScope:()=>Ht,getCurrentWatcher:()=>en,getTransitionRawChildren:()=>S,guardReactiveProps:()=>O,h:()=>de,handleError:()=>Ae,hasInjectionContext:()=>Tn,hydrate:()=>b,hydrateOnIdle:()=>l,hydrateOnInteraction:()=>Ue,hydrateOnMediaQuery:()=>te,hydrateOnVisible:()=>Be,initCustomFormatter:()=>Ge,initDirectivesForSSR:()=>D,inject:()=>T,isMemoSame:()=>ce,isProxy:()=>Et,isReactive:()=>rt,isReadonly:()=>Gt,isRef:()=>nn,isRuntimeOnly:()=>Zt,isShallow:()=>ut,isVNode:()=>ae,markRaw:()=>It,mergeDefaults:()=>Ze,mergeModels:()=>Je,mergeProps:()=>M,nextTick:()=>De,nodeOps:()=>le,normalizeClass:()=>k,normalizeProps:()=>Nt,normalizeStyle:()=>a,onActivated:()=>n,onBeforeMount:()=>mt,onBeforeUnmount:()=>on,onBeforeUpdate:()=>Vt,onDeactivated:()=>$t,onErrorCaptured:()=>Tt,onMounted:()=>F,onRenderTracked:()=>Wt,onRenderTriggered:()=>tn,onScopeDispose:()=>un,onServerPrefetch:()=>lt,onUnmounted:()=>Ft,onUpdated:()=>ln,onWatcherCleanup:()=>ft,openBlock:()=>I,patchProp:()=>Oe,popScopeId:()=>vt,provide:()=>qt,proxyRefs:()=>yt,pushScopeId:()=>Rt,queuePostFlushCb:()=>wt,reactive:()=>Jt,readonly:()=>zt,ref:()=>R,registerRuntimeCompiler:()=>xt,render:()=>wn,renderList:()=>N,renderSlot:()=>G,resolveComLine truncated
import{$ as e,$n as t,$t as n,A as r,An as i,Ar as a,At as o,B as s,Bn as c,Bt as l,Cn as u,Cr as d,Ct as f,D as p,Dn as m,Dr as h,Dt as g,En as _,Er as v,Et as y,F as b,Fn as x,Ft as S,G as C,Gn as w,Gt as T,H as ee,Hn as te,Ht as ne,I as E,In as re,It as D,J as ie,Jn as ae,Jt as oe,K as se,Kn as ce,Kt as le,L as ue,Ln as de,Lt as fe,M as pe,Mn as me,Mr as he,Mt as ge,N as _e,Nn as ve,Nt as ye,O as be,On as xe,Or as O,Ot as Se,P as Ce,Pn as we,Pt as Te,Q as Ee,Qn as De,Qt as Oe,R as ke,Rn as Ae,Rt as je,S as Me,Sn as Ne,Sr as Pe,St as Fe,T as Ie,Tn as Le,Tr as k,Tt as Re,U as ze,Un as Be,Ut as Ve,V as He,Vn as Ue,Vt as We,W as Ge,Wn as A,Wt as Ke,X as qe,Xn as Je,Xt as Ye,Y as Xe,Yn as Ze,Yt as Qe,Z as $e,Zn as et,Zt as j,_ as tt,_n as M,_r as nt,_t as N,a as rt,an as P,ar as it,at,b as ot,bn as st,br as ct,bt as lt,cn as ut,cr as dt,ct as ft,dn as F,dr as pt,dt as mt,en as ht,er as gt,et as _t,f as vt,fn as yt,fr as bt,ft as xt,gn as St,gr as Ct,gt as I,h as wt,hn as Tt,hr as L,ht as R,i as z,in as Et,ir as Dt,it as Ot,j as kt,jn as At,jr as B,jt,k as Mt,kn as Nt,kr as Pt,kt as Ft,ln as It,lr as Lt,lt as Rt,mn as zt,mr as Bt,mt as V,n as Vt,nn as Ht,nr as Ut,nt as Wt,on as Gt,or as Kt,ot as qt,pn as Jt,pr as Yt,pt as H,q as Xt,qn as Zt,qt as Qt,r as $t,rn as en,rr as tn,rt as U,sn as nn,sr as rn,st as an,t as on,tn as sn,tr as cn,tt as ln,un,ur as dn,ut as fn,v as pn,vn as W,vr as mn,vt as hn,wn as gn,wr as _n,wt as G,x as K,xn as vn,xr as yn,xt as bn,y as xn,yn as Sn,yr as Cn,yt as wn,z as Tn,zn as q,zt as En}from"./PageHeader.js";import{C as Dn,S as On,T as kn,_ as An,a as jn,b as Mn,c as Nn,d as Pn,f as Fn,g as In,h as Ln,i as Rn,l as zn,m as Bn,n as Vn,o as Hn,p as Un,r as Wn,s as Gn,t as Kn,u as qn,v as J,w as Jn,x as Yn,y as Xn}from"./HistoryLink.js";var Zn=Object.defineProperty,Qn=(e,t)=>{let n={};for(var r in e)Zn(n,r,{get:e[r],enumerable:!0});return t||Zn(n,Symbol.toStringTag,{value:`Module`}),n};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var $n=Qn({BaseTransition:()=>Ee,BaseTransitionPropsValidators:()=>e,Comment:()=>_t,DeprecationTypes:()=>null,EffectScope:()=>Ze,ErrorCodes:()=>ln,ErrorTypeStrings:()=>Wt,Fragment:()=>U,KeepAlive:()=>Ot,ReactiveEffect:()=>Je,Static:()=>at,Suspense:()=>qt,Teleport:()=>an,Text:()=>ft,TrackOpTypes:()=>et,Transition:()=>be,TransitionGroup:()=>Mt,TriggerOpTypes:()=>De,VueElement:()=>r,assertNumber:()=>Rt,callWithAsyncErrorHandling:()=>fn,callWithErrorHandling:()=>mt,camelize:()=>v,capitalize:()=>h,cloneVNode:()=>xt,compatUtils:()=>null,compile:()=>er,computed:()=>H,createApp:()=>kt,createBlock:()=>R,createCommentVNode:()=>I,createElementBlock:()=>N,createElementVNode:()=>V,createHydrationRenderer:()=>hn,createPropsRestProxy:()=>wn,createRenderer:()=>lt,createSSRApp:()=>pe,createSlots:()=>bn,createStaticVNode:()=>Fe,createTextVNode:()=>f,createVNode:()=>G,customRef:()=>t,defineAsyncComponent:()=>Re,defineComponent:()=>y,defineCustomElement:()=>_e,defineEmits:()=>g,defineExpose:()=>Se,defineModel:()=>Ft,defineOptions:()=>o,defineProps:()=>jt,defineSSRCustomElement:()=>Ce,defineSlots:()=>ge,devtools:()=>ye,effect:()=>gt,effectScope:()=>cn,getCurrentInstance:()=>Te,getCurrentScope:()=>Ut,getCurrentWatcher:()=>tn,getTransitionRawChildren:()=>S,guardReactiveProps:()=>D,h:()=>fe,handleError:()=>je,hasInjectionContext:()=>En,hydrate:()=>b,hydrateOnIdle:()=>l,hydrateOnInteraction:()=>We,hydrateOnMediaQuery:()=>ne,hydrateOnVisible:()=>Ve,initCustomFormatter:()=>Ke,initDirectivesForSSR:()=>E,inject:()=>T,isMemoSame:()=>le,isProxy:()=>Dt,isReactive:()=>it,isReadonly:()=>Kt,isRef:()=>rn,isRuntimeOnly:()=>Qt,isShallow:()=>dt,isVNode:()=>oe,markRaw:()=>Lt,mergeDefaults:()=>Qe,mergeModels:()=>Ye,mergeProps:()=>j,nextTick:()=>Oe,nodeOps:()=>ue,normalizeClass:()=>O,normalizeProps:()=>Pt,normalizeStyle:()=>a,onActivated:()=>n,onBeforeMount:()=>ht,onBeforeUnmount:()=>sn,onBeforeUpdate:()=>Ht,onDeactivated:()=>en,onErrorCaptured:()=>Et,onMounted:()=>P,onRenderTracked:()=>Gt,onRenderTriggered:()=>nn,onScopeDispose:()=>dn,onServerPrefetch:()=>ut,onUnmounted:()=>It,onUpdated:()=>un,onWatcherCleanup:()=>pt,openBlock:()=>F,patchProp:()=>ke,popScopeId:()=>yt,provide:()=>Jt,proxyRefs:()=>bt,pushScopeId:()=>zt,queuePostFlushCb:()=>Tt,reactive:()=>Yt,readonly:()=>Bt,ref:()=>L,registerRuntimeCompiler:()=>St,render:()=>Tn,renderList:()=>M,renderSlot:()=>W,resolveComponent:()=>Sn,resLine truncated
`);d=n.pop()||``;for(let e of n){let t=e.split(`
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Si.value=n.session_id),n.type===`delta`&&(o+=n.text,Di.value=Di.value?{...Di.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Di.value=Di.value?{...Di.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Di.value=Di.value?{...Di.value,ask:n.ask}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);Ci.value=[...Ci.value,{from:`assistant`,text:o,tool_calls:a}],Di.value=null,Ti.value=`Ready`,await Hi()}catch(e){let t=e;t.name===`AbortError`&&!c?(Di.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Ti.value=`Stopped`):(Di.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?hi(r):void 0,isRetry:i},Ti.value=`Error — retry available`)}finally{clearTimeout(l),yi=null,Bi=null,Ei.value=!1}}function ta(){Ti.value=`Stopping…`,Si.value&&q.chatCancel(Si.value).catch(()=>{}),Vi()}function na(){F(()=>{Hi().catch(e=>{Ti.value=e.message||`Chat unavailable`})}),Ft(()=>{Vi()})}async function ra(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));await ea({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var ia=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],aa=y({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return p(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(I(),P(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":A(_i),onClick:i[0]||=e=>n(`toggle`)},[H(`span`,{"aria-hidden":`true`,class:k(r(!e.open))},[K(A(kr),{size:22})],2),H(`span`,{"aria-hidden":`true`,class:k(r(e.open))},[K(A(ai),{size:22})],2)],8,ia))}});function oa(e){return typeof e==`string`?`'${e}'`:new ua().serialize(e)}var sa=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,ca=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[sa.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function la(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&ca[n]?ca[n]:n+128,s=a<128&&ca[a]?ca[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var ua=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?la(e,t):n===`number`&&r===`number`?e-t:la(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(la),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$ArrLine truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Ci.value=n.session_id),n.type===`delta`&&(o+=n.text,Oi.value=Oi.value?{...Oi.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Oi.value=Oi.value?{...Oi.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Oi.value=Oi.value?{...Oi.value,ask:n.ask}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);wi.value=[...wi.value,{from:`assistant`,text:o,tool_calls:a}],Oi.value=null,Ei.value=`Ready`,await Ui()}catch(e){let t=e;t.name===`AbortError`&&!c?(Oi.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Ei.value=`Stopped`):(Oi.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?gi(r):void 0,isRetry:i},Ei.value=`Error — retry available`)}finally{clearTimeout(l),bi=null,Vi=null,Di.value=!1}}function na(){Ei.value=`Stopping…`,Ci.value&&K.chatCancel(Ci.value).catch(()=>{}),Hi()}function ra(){P(()=>{Ui().catch(e=>{Ei.value=e.message||`Chat unavailable`})}),It(()=>{Hi()})}async function ia(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));await ta({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var aa=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],oa=y({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return p(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(F(),N(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":k(vi),onClick:i[0]||=e=>n(`toggle`)},[V(`span`,{"aria-hidden":`true`,class:O(r(!e.open))},[G(k(Ar),{size:22})],2),V(`span`,{"aria-hidden":`true`,class:O(r(e.open))},[G(k(oi),{size:22})],2)],8,aa))}});function sa(e){return typeof e==`string`?`'${e}'`:new da().serialize(e)}var ca=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,la=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[ca.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function ua(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&la[n]?la[n]:n+128,s=a<128&&la[a]?la[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var da=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?ua(e,t):n===`number`&&r===`number`?e-t:ua(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(ua),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$ArrLine truncated
`)].join(`
`))}return()=>i.value||r.value||o.value?de(t.default({present:o.value})[0],{ref:e=>{let t=Ha(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}});function ss(){let e=R();return{primitiveElement:e,currentElement:U(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:Ha(e))}}var[cs,ls]=ha(`CollapsibleRoot`),us=y({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=ro(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=Ne(r);return ls({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),X(),(e,t)=>(I(),z(A(et),{as:e.as,"as-child":r.asChild,"data-state":A(i)?`open`:`closed`,"data-disabled":A(a)?``:void 0},{default:j(()=>[G(e.$slots,`default`,{open:A(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),ds=y({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=cs();i.contentId||=Xo(void 0,`reka-collapsible-content`);let a=R(),{forwardRef:o,currentElement:s}=X(),c=R(0),l=R(0),u=U(()=>i.open.value),d=R(u.value),f=R();J(()=>[u.value,a.value?.present],async()=>{await De();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=U(()=>d.value&&i.open.value);return F(()=>{requestAnimationFrame(()=>{d.value=!1})}),Ua(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(e,t)=>(I(),z(A(os),{ref_key:`presentRef`,ref:a,present:e.forceMount||A(i).open.value,"force-mount":!0},{default:j(({present:t})=>[K(A(et),M(e.$attrs,{id:A(i).contentId,ref:A(o),"as-child":n.asChild,as:e.as,hidden:t?void 0:A(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:A(i).open.value?`open`:`closed`,"data-disabled":A(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:j(()=>[!A(i).unmountOnHide.value||t?G(e.$slots,`default`,{key:0}):L(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),fs=y({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;X();let n=cs();return(e,r)=>(I(),z(A(et),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":A(n).contentId,"aria-expanded":A(n).open.value,"data-state":A(n).open.value?`open`:`closed`,"data-disabled":A(n).disabled?.value?``:void 0,disabled:A(n).disabled?.value,onClick:A(n).onOpenToggle},{default:j(()=>[G(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function ps({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function ms({type:e,defaultValue:t,modelValue:n}){return e||ps({type:e,defaultValue:t,modelValue:n})}function hs({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function gs(e,t){let n=U(()=>ms(e)),r=ro(e,`modelValue`,t,{defaultValue:hs(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=da(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(ya(t,e)){let n=t.findIndex(t=>da(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:U(()=>n.value===`single`)}}var[_s,vs]=ha(`AccordionRoot`),ys=y({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},orientation:{type:String,required:!1,default:`vertical`},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},type:{type:String,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{dir:i,disabled:a,unmountOnHide:o}=Ne(n),s=Co(i),{modelValue:c,changeModelValue:l,isSingle:u}=gs(n,r),{forwardRef:d,currentElement:f}=X();return vs({disabled:a,direction:s,orientation:n.orientation,parentElement:f,isSingle Line truncated
`))}return()=>i.value||r.value||o.value?fe(t.default({present:o.value})[0],{ref:e=>{let t=Ua(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}});function cs(){let e=L();return{primitiveElement:e,currentElement:H(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:Ua(e))}}var[ls,us]=ga(`CollapsibleRoot`),ds=y({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=io(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=Pe(r);return us({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Y(),(e,t)=>(F(),R(k(tt),{as:e.as,"as-child":r.asChild,"data-state":k(i)?`open`:`closed`,"data-disabled":k(a)?``:void 0},{default:A(()=>[W(e.$slots,`default`,{open:k(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),fs=y({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=ls();i.contentId||=Zo(void 0,`reka-collapsible-content`);let a=L(),{forwardRef:o,currentElement:s}=Y(),c=L(0),l=L(0),u=H(()=>i.open.value),d=L(u.value),f=L();q(()=>[u.value,a.value?.present],async()=>{await Oe();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=H(()=>d.value&&i.open.value);return P(()=>{requestAnimationFrame(()=>{d.value=!1})}),Wa(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(e,t)=>(F(),R(k(ss),{ref_key:`presentRef`,ref:a,present:e.forceMount||k(i).open.value,"force-mount":!0},{default:A(({present:t})=>[G(k(tt),j(e.$attrs,{id:k(i).contentId,ref:k(o),"as-child":n.asChild,as:e.as,hidden:t?void 0:k(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:k(i).open.value?`open`:`closed`,"data-disabled":k(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:A(()=>[!k(i).unmountOnHide.value||t?W(e.$slots,`default`,{key:0}):I(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),ps=y({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Y();let n=ls();return(e,r)=>(F(),R(k(tt),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":k(n).contentId,"aria-expanded":k(n).open.value,"data-state":k(n).open.value?`open`:`closed`,"data-disabled":k(n).disabled?.value?``:void 0,disabled:k(n).disabled?.value,onClick:k(n).onOpenToggle},{default:A(()=>[W(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function ms({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function hs({type:e,defaultValue:t,modelValue:n}){return e||ms({type:e,defaultValue:t,modelValue:n})}function gs({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function _s(e,t){let n=H(()=>hs(e)),r=io(e,`modelValue`,t,{defaultValue:gs(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=fa(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(ba(t,e)){let n=t.findIndex(t=>fa(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:H(()=>n.value===`single`)}}var[vs,ys]=ga(`AccordionRoot`),bs=y({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},orientation:{type:String,required:!1,default:`vertical`},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},type:{type:String,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{dir:i,disabled:a,unmountOnHide:o}=Pe(n),s=wo(i),{modelValue:c,changeModelValue:l,isSingle:u}=_s(n,r),{forwardRef:d,currentElement:f}=Y();return ys({disabled:a,direction:s,orientation:n.orientation,parentElement:f,isSingle Line truncated
- a positive number
- less than the value passed to \`max\` (or ${ep} if no \`max\` prop is set)
- less than the value passed to \`max\` (or ${tp} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`),null)}function ap(e){return rp(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${ep}\`.`),ep)}var op=y({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:ep},getValueLabel:{type:Function,required:!1,default:(e,t)=>rp(e)?`${Math.round(e/t*ep)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;X();let i=ro(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=ro(n,`max`,r,{passive:n.max===void 0});J(()=>i.value,async e=>{let t=ip(e,n.max);t!==e&&(await De(),i.value=t)},{immediate:!0}),J(()=>n.max,e=>{let t=ap(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=U(()=>va(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return np({modelValue:i,max:a,progressState:o}),(e,t)=>(I(),z(A(et),{"as-child":e.asChild,as:e.as,"aria-valuemax":A(a),"aria-valuemin":0,"aria-valuenow":rp(A(i))?A(i):void 0,"aria-valuetext":e.getValueText?.(A(i),A(a)),"aria-label":e.getValueLabel(A(i),A(a)),role:`progressbar`,"data-state":o.value,"data-value":A(i)??void 0,"data-max":A(a)},{default:j(()=>[G(e.$slots,`default`,{modelValue:A(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),sp=y({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=tp();return X(),(e,r)=>(I(),z(A(et),M(t,{"data-state":A(n).progressState.value,"data-value":A(n).modelValue?.value??void 0,"data-max":A(n).max.value}),{default:j(()=>[G(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),cp=`radio.select`;function lp(e,t,n){_a(cp,n,{originalEvent:e,value:t})}var up=y({inheritAttrs:!1,__name:`Radio`,props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:checked`,`select`],setup(e,{emit:t}){let n=e,r=t,i=ro(n,`checked`,r,{passive:n.checked===void 0}),{value:a}=Ne(n),{forwardRef:o,currentElement:s}=X(),c=Oo(s),l=jo(),u=U(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);function d(e){n.disabled||lp(e,n.value,e=>{r(`select`,e),!e?.defaultPrevented&&(i.value=!0,c.value&&e.stopPropagation())})}return(e,t)=>(I(),P(W,null,[K(A(et),M({id:e.id,ref:A(o),role:`radio`,type:e.as===`button`?`button`:void 0,as:e.as,"aria-checked":A(i)??!1,"aria-label":u.value,"as-child":e.asChild,disabled:e.disabled?``:void 0,"data-state":A(i)?`checked`:`unchecked`,"data-disabled":e.disabled?``:void 0,value:A(a),required:e.required,name:e.name},{...A(l),...e.$attrs},{onClick:Qe(d,[`stop`])}),{default:j(()=>[G(e.$slots,`default`,{checked:A(i)})]),_:3},16,[`id`,`type`,`as`,`aria-checked`,`aria-label`,`as-child`,`disabled`,`data-state`,`data-disabled`,`value`,`required`,`name`]),A(c)&&e.name?(I(),z(A(Fc),M({key:0,type:`radio`,tabindex:`-1`,value:A(a),checked:!!A(i),name:e.name,disabled:e.disabled,required:e.required},A(l)),null,16,[`value`,`checked`,`name`,`disabled`,`required`])):L(`v-if`,!0)],64))}}),[dp,fp]=ha(`RadioGroupRoot`),pp=y({__name:`RadioGroupRoot`,props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=X(),o=ro(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:c,orientation:l,name:u,required:d,dir:f}=Ne(n),p=Co(f),m=Oo(a);return fp({modelValue:o,changeModelValue:e=>{o.value=e},disabled:s,loop:c,orientation:l,name:u?.value,required:d}),(e,t)=>(I(),z(A(_d),{"as-child":``,orientation:A(l),dir:A(p),loop:A(c)},{default:j(()=>[K(A(et),{ref:A(i),role:`radiogroup`,"data-disabled":A(s)?``:void 0,"as-child":e.asChild,as:e.as,"aria-orientation":A(l),"aria-required":A(d),dir:A(p)},{default:j(()=>[G(e.$slots,`default`,{modelValue:A(o)}),A(m)&&A(u)?(I(),z(A(Fc),{key:0,required:A(d),disabled:A(s),value:A(o),name:A(u)},null,8,[`required`,`disabled`,`value`,`name`])):L(`v-if`,!0)]),_:3},8,[`data-disabled`,`as-child`,`as`,`aria-orientation`,`aria-required`,`dir`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),[mp,hp]=ha(`RadioGroupItem`),gp=y({inheritAttrs:!1,__name:`RadioGroupItem`,props:{id:{type:String,required:!1},value:{type:nulLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:Vg(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>Vg(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=Ug(c),u=e+1<n.length?Ug(n[e+1]):null;if(l&&u&&Wg(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=Ug(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>Vg(e)),rows:r.map(e=>e.map(e=>Vg(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:Vg(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:Vg(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function Ug(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 Wg(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Gg={class:`[overflow-wrap:anywhere]`},Kg={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},qg={class:`font-mono text-[0.85em]`},Jg={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Yg={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Xg={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Zg={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Qg={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},$g={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},e_={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},t_={key:8,class:`mb-2.5 last:mb-0`},n_=y({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=U(()=>Hg(t.text));return(e,t)=>(I(),P(`div`,Gg,[(I(!0),P(W,null,N(n.value,(e,t)=>(I(),P(W,{key:t},[e.kind===`pre`?(I(),P(`pre`,Kg,[H(`code`,qg,V(e.code),1)])):e.kind===`table`?(I(),P(`table`,Jg,[H(`thead`,null,[H(`tr`,null,[(I(!0),P(W,null,N(e.head,(e,t)=>(I(),P(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[K(zg,{inline:e},null,8,[`inline`])]))),128))])]),H(`tbody`,null,[(I(!0),P(W,null,N(e.rows,(e,t)=>(I(),P(`tr`,{key:t},[(I(!0),P(W,null,N(e,(e,t)=>(I(),P(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[K(zg,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(I(),P(`blockquote`,Yg,[K(zg,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(I(),P(`h1`,Xg,[K(zg,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(I(),P(`h2`,Zg,[K(zg,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(I(),P(`h3`,Qg,[K(zg,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(I(),P(`ul`,$g,[(I(!0),P(W,null,N(e.items,(e,t)=>(I(),P(`li`,{key:t},[K(zg,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(I(),P(`ol`,e_,[(I(!0),P(W,null,N(e.items,(e,t)=>(I(),P(`li`,{key:t},[K(zg,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(I(),P(`p`,t_,[K(zg,{inline:e.inline},null,8,[`inline`])])):L(``,!0)],64))),128))]))}}),r_={class:`truncate`},i_=y({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=xn(`RouterLink`);return I(),z(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:j(()=>[K(A(rr),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),H(`span`,r_,V(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),a_={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},o_={class:`font-semibold text-foreground`},s_={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},c_=y({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=U(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=U(()=>t.tool.parameters||t.tool.Parameters||``),i=U(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=U(()=>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?(I(),z(i_,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(I(),P(`div`,a_,[K(A(ii),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),H(`span`,o_,V(n.value),1),r.value?(I(),P(`code`,s_,V(r.value),1)):L(``,!0),H(`span`,{class:k(A(p)(`text-fg-muted`,i.value&&`text-danger`))},V(a.value),3)]))}}),l_={key:0,class:`mb-2 grid gap-0.5 text-xs`},u_={key:1,class:`mb-2 flex flex-wrap gap-1.5`},d_={key:3,class:`whitespace-pre-wrap`},f_=y({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(I(),P(`div`,{class:k([`flex`,e.assistant?`justify-start`:`justify-end`])},[H(`div`,{class:k(A(p)(`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?(I(),P(`div`,l_,[(I(!0),P(W,null,N(e.tools,(t,n)=>(I(),z(c_,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):L(``,!0),e.media.length?(I(),P(`div`,u_,[(I(!0),P(W,null,N(e.media,(e,t)=>(I(),z(Mg,{key:t,attachment:e},null,8,[`attachment`]))),128))])):L(``,!0),e.assistant?(I(),z(n_,{key:2,text:e.text},null,8,[`text`])):(I(),P(`div`,d_,V(e.text),1)),G(t.$slots,`default`)],2)],2))}}),p_={class:`text-sm`},m_={class:`font-medium`},h_={key:0,class:`mt-1 text-fg-muted`},g_={key:1,class:`mt-2 flex flex-wrap gap-2`},__=y({__name:`ChatChLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>_S?`${n.slice(0,_S).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var yS=[`title`],bS=y({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=U(()=>Gx(n.event)),a=U(()=>vS(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=U(()=>n.event.at?$b(n.event.at):`—`);return(e,t)=>(I(),z(A(hS),{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:[Ke(Qe(o,[`prevent`]),[`enter`]),Ke(Qe(o,[`prevent`]),[`space`])]},{default:j(()=>[K(A(Z),{class:`font-medium`},{default:j(()=>[f(V(n.event.kind||n.event.type||`event`),1)]),_:1}),K(A(Z),{class:`font-mono`},{default:j(()=>[f(V(i.value>0?`#${i.value}`:`—`),1)]),_:1}),K(A(Z),{class:`w-[55%] max-w-0`},{default:j(()=>[H(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},V(a.value.text),9,yS)]),_:1}),K(A(Z),null,{default:j(()=>[f(V(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),xS=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function SS(e){return(Number(e?.task_id)||0)>0}function CS(e,t){return t===`tasks`?SS(e):t!==`system`||!SS(e)}function wS(e,t){return e.filter(e=>CS(e,t))}function TS(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function ES(e,t){return`${e}:${t??0}`}function DS(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=ES(vS(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 OS={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},kS={class:`max-h-[28rem] overflow-y-auto`},AS=[`aria-expanded`,`aria-label`,`onClick`],jS=[`title`],MS=y({__name:`LiveActivityCard`,setup(e){let t=nv(),{activity:n,streamKind:r,streamState:i}=On(kn()),a=R(`all`),o=U(()=>wS(n.value,a.value)),s=U(()=>TS(o.value.length,a.value)),c=Jt(new Set),l=U(()=>DS(o.value));function u(e){c.has(e)?c.delete(e):c.add(e)}function d(e){return c.has(e.key)}function p(e){return vS(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)=>(I(),z(A(Kb),null,{default:j(()=>[K(A(Zb),null,{default:j(()=>[K(A(Qb),null,{default:j(()=>[...t[1]||=[f(`Live activity`,-1)]]),_:1}),K(A(qb),{class:`flex items-center gap-2`},{default:j(()=>[K(A(dS),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:A(xS)},null,8,[`modelValue`,`options`]),K(A(Bt),{variant:A(r)},{default:j(()=>[f(V(A(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),K(A(Jb),null,{default:j(()=>[H(`div`,OS,[H(`div`,kS,[K(A(pS),null,{default:j(()=>[K(A(gS),{class:`sticky top-0 z-10 bg-card`},{default:j(()=>[K(A(hS),null,{default:j(()=>[K(A(Q),null,{default:j(()=>[...t[2]||=[f(`Event`,-1)]]),_:1}),K(A(Q),null,{default:j(()=>[...t[3]||=[f(`Task`,-1)]]),_:1}),K(A(Q),null,{default:j(()=>[...t[4]||=[f(`Detail`,-1)]]),_:1}),K(A(Q),null,{default:j(()=>[...t[5]||=[f(`When`,-1)]]),_:1})]),_:1})]),_:1}),K(A(mS),null,{default:j(()=>[o.value.length?L(``,!0):(I(),z(A(hS),{key:0},{default:j(()=>[K(A(Z),{colspan:`4`},{default:j(()=>[K(A(Lb),null,{default:j(()=>[K(A(Bb),null,{default:j(()=>[K(A(Ub),null,{default:j(()=>[f(V(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(I(!0),P(W,{key:1},N(l.value,e=>(I(),P(W,{key:e.key},[e.count===1?(I(),z(bS,{key:0,event:e.representative,onOpen:h},null,8,[`event`])):(I(),P(W,{key:1},[K(A(hS),{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:[Ke(Qe(t=>e.taskID>0&&h(e.taskID),[`prevent`]),[`enter`]),Ke(Qe(t=>e.taskID>0&&h(e.taskID),[`prevent`]),[`space`])]},{default:j(()=>[K(A(Z),{class:`font-medium`},{default:j(()=>[H(`button`,{type:`button`,class:`inline-flex items-center gap-1 rounded hover:opacity-80`,"aria-expanded":d(e),"aria-label":`${d(e)?`Hide`:`Show`} ${e.count} ${e.label} events`,onClick:Qe(t=>u(e.key),[`stop`])},[d(e)?(I(),z(A(ur),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(I(),z(A(dr),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),f(` `+V(e.label)+` `,1),K(A(Bt),{variant:`idle`},{default:j(()=>[f(`×`+V(e.count),1)]),_:2},1024)],8,AS)]),_:2},1024),K(A(Z),{class:`font-mono`},{default:j(()=>[f(V(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),K(A(Z),{class:`w-[55%] max-w-0`},{default:j(()=>[H(`span`,{class:`block truncate`,title:p(e).truncated?p(e).full:void 0},V(p(e).text),9,jS)]),_:2},1024),K(A(Z),null,{default:j(()=>[f(V(m(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(I(!0),P(W,{key:0},N(e.events,(t,n)=>(I(),z(bS,{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 QC(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 $C(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 ew(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 tw(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 nw=R([]),rw=R([]),iw=R(!0),aw=R(null),ow=R(null),sw=R(!1),cw=R(null);async function lw(){try{let e=await q.eventTypes();iw.value=e.enabled!==!1,nw.value=e.event_types||[],rw.value=e.proposals||[],aw.value=null}catch(e){aw.value=e.message||String(e)}}function uw(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function dw(e){cw.value=null,ow.value=e}function fw(e){let t=bw.value.find(t=>String(t.id)===e.sample_id);dw({mode:`proposal`,id:null,source:e.source,name:``,rule:uw(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function pw(e=``){dw({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function mw(e){dw({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:uw(e.rule),headersText:``,body:``,exampleHeaders:{}})}function hw(){ow.value=null}async function gw(){let e=ow.value;if(e){sw.value=!0;try{if(e.mode===`edit`&&e.id)await q.eventTypeUpdate(e.id,{name:e.name,rule:tw(e.rule)});else{let t=e.mode===`paste`?ZC(e.headersText):e.exampleHeaders;await q.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:tw(e.rule),example:{headers:t,body:e.body}})}ow.value=null,await lw()}catch(e){cw.value=e.message||String(e)}finally{sw.value=!1}}}var _w=R(null);async function vw(){let e=_w.value;if(_w.value=null,e)try{await q.eventTypeDelete(e.id),await lw()}catch(e){aw.value=e.message||String(e)}}var yw=100,bw=R([]),xw=R(!0),Sw=R(null),Cw=R(!0),ww=R(null);async function Tw(){try{let e=await q.captures(yw);xw.value=e.enabled!==!1,bw.value=e.captures||[],Sw.value=null}catch(e){Sw.value=e.message||String(e)}finally{Cw.value=!1}}function Ew(e){let t=bw.value.find(t=>t.id===e);return t&&(ww.value=t),!!t}function Dw(){bw.value.length&&(ww.value=bw.value[0])}function Ow(){Fn(`captures`,()=>{Tw(),lw()})}var kw={key:0,class:`text-xs text-fg-muted`},Aw={key:1,class:`flex flex-col gap-1 text-xs`},jw={key:1},Mw={key:2,class:`text-xs text-fg-muted`},Nw=y({__name:`DispatchLinks`,props:{kind:{},id:{}},setup(e){let t=e,n=R([]),r=R(!1);J(()=>[t.kind,t.id],async()=>{r.value=!1;try{n.value=await q.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=xn(`RouterLink`);return r.value?(I(),P(`p`,kw,`Dispatches unavailable.`)):n.value.length?(I(),P(`ul`,Aw,[(I(!0),P(W,null,N(n.value,e=>(I(),P(`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`?L(``,!0):(I(),z(o,{key:0,to:{path:`/events`,query:{tab:`bindings`}},class:`hover:text-foreground`},{default:j(()=>[f(`binding `+V(e.binding_id.slice(0,8))+` v`+V(e.binding_version),1)]),_:2},1024)),t.kind===`captures`?L(``,!0):(I(),z(o,{key:1,to:i(e.capture_id),class:`hover:text-foreground`},{default:j(()=>[f(`capture `+V(e.capture_id.slice(0,8)),1)]),_:2},1032,[`to`])),t.kind===`tasks`?L(``,!0):(I(),P(W,{key:2},[e.task_id?(I(),z(o,{key:0,to:`/tasks/${e.task_id}`,class:`text-foreground hover:underline`},{default:j(()=>[f(`task #`+V(e.task_id),1)]),_:2},1032,[`to`])):(I(),P(`span`,jw,V(e.reason||`claimed, no task recorded`),1))],64)),H(`span`,null,V(A($b)(e.dispatched_at)),1)]))),128))])):t.kind===`tasks`?L(``,!0):(I(),P(`p`,Mw,` No dispatches yet. `))}}}),Pw=y({__name:`Spinner`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(I(),z(A(Tr),{role:`status`,"aria-label":`Loading`,class:k(A(p)(`size-4 animate-spin`,t.class))},null,8,[`class`]))}});function Fw(e,t){return t?e.filter(e=>e.event_type_id===t):[]}function Iw(e){return(e?.repository??`required`)!==`none`}function Lw(e,t){return e.filter(e=>t===`any`||e.type===`any`||e.type===t)}function Rw(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 zw={pending_approval:`pending approval`,armed:`armed`,paused:`paused`},Bw={pending_approval:`warn`,armed:`ok`,paused:`idle`};function Vw(e) Line truncated
`)}};Qz.defaultYaml={explicit:!1,version:`1.2`},Qz.defaultTags={"!!":`tag:yaml.org,2002:`};function $z(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 eB(e){let t=new Set;return Gz(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function tB(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function nB(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=eB(e);let a=tB(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(Lz(t.node)||zz(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 rB(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=rB(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=rB(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=rB(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=rB(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function iB(e,t,n){if(Array.isArray(e))return e.map((e,t)=>iB(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Vz(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 aB=class{constructor(e){Object.defineProperty(this,Mz,{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(!Pz(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=iB(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?rB(i,{"":o},``,o):o}},oB=class extends aB{constructor(e){super(Ez),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=[],Gz(e,{Node:(e,t)=>{(Nz(t)||Vz(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||=(iB(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=sB(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($z(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 sB(e,t,n){if(Nz(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(zz(t)){let r=0;for(let i of t.items){let t=sB(e,i,n);t>r&&(r=t)}return r}if(Iz(t)){let r=sB(e,t.key,n),i=sB(e,t.value,n);return Math.max(r,i)}return 1}var cB=e=>!e||typeof e!=`function`&&typeof e!=`object`,lB=class extends aB{constructor(e){super(Az),this.value=e}toJSON(e,t){return t?.keep?this.value:iB(this.value,e,t)}toString(){return String(this.value)}};lB.BLOCK_FOLDED=`BLOCK_FOLDED`,lB.BLOCK_LITERAL=`BLOCK_LITERAL`,lB.PLAIN=`PLAIN`,lB.QUOTE_DOUBLE=`QUOTE_DOUBLE`,lB.QUOTE_SINGLE=`QUOTE_SINGLE`;var uB=`tag:yaml.org,2002:`;function dB(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 fB(e,t,n){if(Pz(e)&&(e=e.contents),Bz(e))return e;if(Iz(e)){let t=n.schema[Oz].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 oB(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=uB+t.slice(2));let l=dB(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new lB(e);return c&&(c.node=t),t Line truncated
`)?_B(n,t):n.includes(`
Defaulting to \`null\`.`),null)}function op(e){return ip(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${tp}\`.`),tp)}var sp=y({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:tp},getValueLabel:{type:Function,required:!1,default:(e,t)=>ip(e)?`${Math.round(e/t*tp)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;Y();let i=io(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=io(n,`max`,r,{passive:n.max===void 0});q(()=>i.value,async e=>{let t=ap(e,n.max);t!==e&&(await Oe(),i.value=t)},{immediate:!0}),q(()=>n.max,e=>{let t=op(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=H(()=>ya(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return rp({modelValue:i,max:a,progressState:o}),(e,t)=>(F(),R(k(tt),{"as-child":e.asChild,as:e.as,"aria-valuemax":k(a),"aria-valuemin":0,"aria-valuenow":ip(k(i))?k(i):void 0,"aria-valuetext":e.getValueText?.(k(i),k(a)),"aria-label":e.getValueLabel(k(i),k(a)),role:`progressbar`,"data-state":o.value,"data-value":k(i)??void 0,"data-max":k(a)},{default:A(()=>[W(e.$slots,`default`,{modelValue:k(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),cp=y({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=np();return Y(),(e,r)=>(F(),R(k(tt),j(t,{"data-state":k(n).progressState.value,"data-value":k(n).modelValue?.value??void 0,"data-max":k(n).max.value}),{default:A(()=>[W(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),lp=`radio.select`;function up(e,t,n){va(lp,n,{originalEvent:e,value:t})}var dp=y({inheritAttrs:!1,__name:`Radio`,props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:checked`,`select`],setup(e,{emit:t}){let n=e,r=t,i=io(n,`checked`,r,{passive:n.checked===void 0}),{value:a}=Pe(n),{forwardRef:o,currentElement:s}=Y(),c=ko(s),l=Mo(),u=H(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);function d(e){n.disabled||up(e,n.value,e=>{r(`select`,e),!e?.defaultPrevented&&(i.value=!0,c.value&&e.stopPropagation())})}return(e,t)=>(F(),N(U,null,[G(k(tt),j({id:e.id,ref:k(o),role:`radio`,type:e.as===`button`?`button`:void 0,as:e.as,"aria-checked":k(i)??!1,"aria-label":u.value,"as-child":e.asChild,disabled:e.disabled?``:void 0,"data-state":k(i)?`checked`:`unchecked`,"data-disabled":e.disabled?``:void 0,value:k(a),required:e.required,name:e.name},{...k(l),...e.$attrs},{onClick:$e(d,[`stop`])}),{default:A(()=>[W(e.$slots,`default`,{checked:k(i)})]),_:3},16,[`id`,`type`,`as`,`aria-checked`,`aria-label`,`as-child`,`disabled`,`data-state`,`data-disabled`,`value`,`required`,`name`]),k(c)&&e.name?(F(),R(k(Ic),j({key:0,type:`radio`,tabindex:`-1`,value:k(a),checked:!!k(i),name:e.name,disabled:e.disabled,required:e.required},k(l)),null,16,[`value`,`checked`,`name`,`disabled`,`required`])):I(`v-if`,!0)],64))}}),[fp,pp]=ga(`RadioGroupRoot`),mp=y({__name:`RadioGroupRoot`,props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Y(),o=io(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:c,orientation:l,name:u,required:d,dir:f}=Pe(n),p=wo(f),m=ko(a);return pp({modelValue:o,changeModelValue:e=>{o.value=e},disabled:s,loop:c,orientation:l,name:u?.value,required:d}),(e,t)=>(F(),R(k(vd),{"as-child":``,orientation:k(l),dir:k(p),loop:k(c)},{default:A(()=>[G(k(tt),{ref:k(i),role:`radiogroup`,"data-disabled":k(s)?``:void 0,"as-child":e.asChild,as:e.as,"aria-orientation":k(l),"aria-required":k(d),dir:k(p)},{default:A(()=>[W(e.$slots,`default`,{modelValue:k(o)}),k(m)&&k(u)?(F(),R(k(Ic),{key:0,required:k(d),disabled:k(s),value:k(o),name:k(u)},null,8,[`required`,`disabled`,`value`,`name`])):I(`v-if`,!0)]),_:3},8,[`data-disabled`,`as-child`,`as`,`aria-orientation`,`aria-required`,`dir`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),[hp,gp]=ga(`RadioGroupItem`),_p=y({inheritAttrs:!1,__name:`RadioGroupItem`,props:{id:{type:String,required:!1},value:{type:nulLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:Hg(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>Hg(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=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_=y({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=H(()=>Ug(t.text));return(e,t)=>(F(),N(`div`,Kg,[(F(!0),N(U,null,M(n.value,(e,t)=>(F(),N(U,{key:t},[e.kind===`pre`?(F(),N(`pre`,qg,[V(`code`,Jg,B(e.code),1)])):e.kind===`table`?(F(),N(`table`,Yg,[V(`thead`,null,[V(`tr`,null,[(F(!0),N(U,null,M(e.head,(e,t)=>(F(),N(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[G(Bg,{inline:e},null,8,[`inline`])]))),128))])]),V(`tbody`,null,[(F(!0),N(U,null,M(e.rows,(e,t)=>(F(),N(`tr`,{key:t},[(F(!0),N(U,null,M(e,(e,t)=>(F(),N(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[G(Bg,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(F(),N(`blockquote`,Xg,[G(Bg,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(F(),N(`h1`,Zg,[G(Bg,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(F(),N(`h2`,Qg,[G(Bg,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(F(),N(`h3`,$g,[G(Bg,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(F(),N(`ul`,e_,[(F(!0),N(U,null,M(e.items,(e,t)=>(F(),N(`li`,{key:t},[G(Bg,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(F(),N(`ol`,t_,[(F(!0),N(U,null,M(e.items,(e,t)=>(F(),N(`li`,{key:t},[G(Bg,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(F(),N(`p`,n_,[G(Bg,{inline:e.inline},null,8,[`inline`])])):I(``,!0)],64))),128))]))}}),i_={class:`truncate`},a_=y({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Sn(`RouterLink`);return F(),R(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:A(()=>[G(k(ir),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),V(`span`,i_,B(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_=y({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=H(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=H(()=>t.tool.parameters||t.tool.Parameters||``),i=H(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=H(()=>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?(F(),R(a_,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(F(),N(`div`,o_,[G(k(ai),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),V(`span`,s_,B(n.value),1),r.value?(F(),N(`code`,c_,B(r.value),1)):I(``,!0),V(`span`,{class:O(k(p)(`text-fg-muted`,i.value&&`text-danger`))},B(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_=y({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(F(),N(`div`,{class:O([`flex`,e.assistant?`justify-start`:`justify-end`])},[V(`div`,{class:O(k(p)(`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?(F(),N(`div`,u_,[(F(!0),N(U,null,M(e.tools,(t,n)=>(F(),R(l_,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):I(``,!0),e.media.length?(F(),N(`div`,d_,[(F(!0),N(U,null,M(e.media,(e,t)=>(F(),R(Ng,{key:t,attachment:e},null,8,[`attachment`]))),128))])):I(``,!0),e.assistant?(F(),R(r_,{key:2,text:e.text},null,8,[`text`])):(F(),N(`div`,f_,B(e.text),1)),W(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_=y({__name:`ChatChLine 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=y({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=H(()=>Zx(n.event)),a=H(()=>wS(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=H(()=>n.event.at?$b(n.event.at):`—`);return(e,t)=>(F(),R(k(xS),{class:O(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:[qe($e(o,[`prevent`]),[`enter`]),qe($e(o,[`prevent`]),[`space`])]},{default:A(()=>[G(k(Z),{class:`font-medium`},{default:A(()=>[f(B(n.event.kind||n.event.type||`event`),1)]),_:1}),G(k(Z),{class:`font-mono`},{default:A(()=>[f(B(i.value>0?`#${i.value}`:`—`),1)]),_:1}),G(k(Z),{class:`w-[55%] max-w-0`},{default:A(()=>[V(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},B(a.value.text),9,TS)]),_:1}),G(k(Z),null,{default:A(()=>[f(B(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=y({__name:`LiveActivityCard`,setup(e){let t=rv(),{activity:n,streamKind:r,streamState:i}=kn(An()),a=L(`all`),o=H(()=>AS(n.value,a.value)),s=H(()=>jS(o.value.length,a.value)),c=Yt(new Set),l=H(()=>NS(o.value));function u(e){c.has(e)?c.delete(e):c.add(e)}function d(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)=>(F(),R(k(Kb),null,{default:A(()=>[G(k(Zb),null,{default:A(()=>[G(k(Qb),null,{default:A(()=>[...t[1]||=[f(`Live activity`,-1)]]),_:1}),G(k(qb),{class:`flex items-center gap-2`},{default:A(()=>[G(k(_S),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:k(DS)},null,8,[`modelValue`,`options`]),G(k(Vt),{variant:k(r)},{default:A(()=>[f(B(k(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),G(k(Jb),null,{default:A(()=>[V(`div`,PS,[V(`div`,FS,[G(k(yS),null,{default:A(()=>[G(k(SS),{class:`sticky top-0 z-10 bg-card`},{default:A(()=>[G(k(xS),null,{default:A(()=>[G(k(Q),null,{default:A(()=>[...t[2]||=[f(`Event`,-1)]]),_:1}),G(k(Q),null,{default:A(()=>[...t[3]||=[f(`Task`,-1)]]),_:1}),G(k(Q),null,{default:A(()=>[...t[4]||=[f(`Detail`,-1)]]),_:1}),G(k(Q),null,{default:A(()=>[...t[5]||=[f(`When`,-1)]]),_:1})]),_:1})]),_:1}),G(k(bS),null,{default:A(()=>[o.value.length?I(``,!0):(F(),R(k(xS),{key:0},{default:A(()=>[G(k(Z),{colspan:`4`},{default:A(()=>[G(k(Lb),null,{default:A(()=>[G(k(Bb),null,{default:A(()=>[G(k(Ub),null,{default:A(()=>[f(B(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(F(!0),N(U,{key:1},M(l.value,e=>(F(),N(U,{key:e.key},[e.count===1?(F(),R(ES,{key:0,event:e.representative,onOpen:h},null,8,[`event`])):(F(),N(U,{key:1},[G(k(xS),{class:O(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:[qe($e(t=>e.taskID>0&&h(e.taskID),[`prevent`]),[`enter`]),qe($e(t=>e.taskID>0&&h(e.taskID),[`prevent`]),[`space`])]},{default:A(()=>[G(k(Z),{class:`font-medium`},{default:A(()=>[V(`button`,{type:`button`,class:`inline-flex items-center gap-1 rounded hover:opacity-80`,"aria-expanded":d(e),"aria-label":`${d(e)?`Hide`:`Show`} ${e.count} ${e.label} events`,onClick:$e(t=>u(e.key),[`stop`])},[d(e)?(F(),R(k(dr),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(F(),R(k(fr),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),f(` `+B(e.label)+` `,1),G(k(Vt),{variant:`idle`},{default:A(()=>[f(`×`+B(e.count),1)]),_:2},1024)],8,IS)]),_:2},1024),G(k(Z),{class:`font-mono`},{default:A(()=>[f(B(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),G(k(Z),{class:`w-[55%] max-w-0`},{default:A(()=>[V(`span`,{class:`block truncate`,title:p(e).truncated?p(e).full:void 0},B(p(e).text),9,LS)]),_:2},1024),G(k(Z),null,{default:A(()=>[f(B(m(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(F(!0),N(U,{key:0},M(e.events,(t,n)=>(F(),R(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=L([]),lw=L([]),uw=L(!0),dw=L(null),fw=L(null),pw=L(!1),mw=L(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=L(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=L([]),Dw=L(!0),Ow=L(null),kw=L(!0),Aw=L(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=y({__name:`DispatchLinks`,props:{kind:{},id:{}},setup(e){let t=e,n=L([]),r=L(!1);q(()=>[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=Sn(`RouterLink`);return r.value?(F(),N(`p`,Fw,`Dispatches unavailable.`)):n.value.length?(F(),N(`ul`,Iw,[(F(!0),N(U,null,M(n.value,e=>(F(),N(`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`?I(``,!0):(F(),R(o,{key:0,to:{path:`/events`,query:{tab:`bindings`}},class:`hover:text-foreground`},{default:A(()=>[f(`binding `+B(e.binding_id.slice(0,8))+` v`+B(e.binding_version),1)]),_:2},1024)),t.kind===`captures`?I(``,!0):(F(),R(o,{key:1,to:i(e.capture_id),class:`hover:text-foreground`},{default:A(()=>[f(`capture `+B(e.capture_id.slice(0,8)),1)]),_:2},1032,[`to`])),t.kind===`tasks`?I(``,!0):(F(),N(U,{key:2},[e.task_id?(F(),R(o,{key:0,to:`/tasks/${e.task_id}`,class:`text-foreground hover:underline`},{default:A(()=>[f(`task #`+B(e.task_id),1)]),_:2},1032,[`to`])):(F(),N(`span`,Lw,B(e.reason||`claimed, no task recorded`),1))],64)),V(`span`,null,B(k($b)(e.dispatched_at)),1)]))),128))])):t.kind===`tasks`?I(``,!0):(F(),N(`p`,Rw,` No dispatches yet. `))}}}),Bw=y({__name:`Spinner`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(F(),R(k(Er),{role:`status`,"aria-label":`Loading`,class:O(k(p)(`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(`
`)?`
`+_B(n,t):(e.endsWith(` `)?``:` `)+n,yB=`flow`,bB=`block`,xB=`quoted`;function SB(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=CB(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=CB(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`+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!==`
`&&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 CB(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 wB=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),TB=e=>/^(%|---|\.\.\.)/m.test(e);function EB(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 DB(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(TB(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 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)+`
`;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:SB(o,a,xB,wB(t,!1))}function OB(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return DB(e,t);let n=t.indent||(TB(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:SB(r,n,yB,wB(t,!1))}function kB(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=DB;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?OB:i&&!t?DB:n?OB:DB}return r(e,t)}var AB;try{AB=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: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(`(^|(?<!
))
+(?!
|$)`,`g`)}catch{AB=/\n+(?!\n|$)/g}function jB({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 kB(n,r);let l=r.indent||(r.forceBlockIndent||TB(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===lB.BLOCK_FOLDED?!1:t===lB.BLOCK_LITERAL||!EB(n,c,l.length);if(!n)return u?`|
|$)`,`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?`|
`:`>
`;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(AB,`$&${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(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===`
`)_=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=wB(r,!0);o!==`folded`&&t!==lB.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=SB(`${v}${e}${p}`,l,bB,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function MB(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 kB(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?kB(a,t):jB(e,t,n,r);if(!s&&!u&&i!==lB.PLAIN&&a.includes(`
`))return jB(e,t,n,r);if(TB(a)){if(c===``)return t.forceBlockIndent=!0,jB(e,t,n,r);if(s&&c===l)return kB(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 kB(a,t)}return s?d:SB(d,c,yB,wB(t,!1))}function NB(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!==lB.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=lB.QUOTE_DOUBLE);let c=e=>{switch(e){case lB.BLOCK_FOLDED:case lB.BLOCK_LITERAL:return i||a?kB(o.value,t):jB(o,t,n,r);case lB.QUOTE_DOUBLE:return DB(o.value,t);case lB.QUOTE_SINGLE:return OB(o.value,t);case lB.PLAIN:return MB(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 PB(e,t){let n=Object.assign({blockQuote:!0,commentString:gB,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 FB(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(Lz(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 IB(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Lz(e)||zz(e))&&e.anchor;a&&$z(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 LB(e,t,n,r){if(Iz(e))return e.toString(t,n,r);if(Nz(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=Bz(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=FB(t.doc.schema.tags,a);let o=IB(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):Lz(a)?NB(a,t,n,r):a.toString(t,n,r);return o?Lz(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function RB({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=Bz(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(zz(e)||!Bz(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||zz(e)||(Lz(e)?e.type===lB.BLOCK_FOLDED||e.type===lB.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=LB(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+=vB(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=vB(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=vB(g,n.indent,l(f))));let _,v,y;Bz(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&&Lz(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Rz(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=LB(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${_B(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=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===`
`&&y&&(S=`
`):S+=`\n${n.indent}`}else if(!p&&zz(t)){let e=x[0],r=x.indexOf(`
`):S+=`\n${n.indent}`}else if(!p&&Gz(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+=vB(g,n.indent,l(y)):h&&i&&i(),g}function zB(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var BB=`<<`,VB={identify:e=>e===BB||typeof e==`symbol`&&e.description===BB,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new lB(Symbol(BB)),{addToJSMap:UB}),stringify:()=>BB},HB=(e,t)=>(VB.identify(t)||Lz(t)&&(!t.type||t.type===lB.PLAIN)&&VB.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===VB.tag&&e.default);function UB(e,t,n){let r=GB(e,n);if(Rz(r))for(let n of r.items)WB(e,t,n);else if(Array.isArray(r))for(let n of r)WB(e,t,n);else WB(e,t,r)}function WB(e,t,n){let r=GB(e,n);if(!Fz(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 GB(e,t){return e&&Nz(t)?t.resolve(e.doc,e):t}function KB(e,t,{key:n,value:r}){if(Bz(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(HB(e,n))UB(e,t,r);else{let i=iB(n,``,e);if(t instanceof Map)t.set(i,iB(r,i,e));else if(t instanceof Set)t.add(i);else{let a=qB(n,i,e),o=iB(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function qB(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Bz(e)&&n?.doc){let t=PB(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)+`..."`),zB(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 JB(e,t,n){return new YB(fB(e,void 0,n),fB(t,void 0,n))}var YB=class e{constructor(e,t=null){Object.defineProperty(this,Mz,{value:kz}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Bz(n)&&(n=n.clone(t)),Bz(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return KB(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?RB(this,e,t,n):JSON.stringify(this)}};function XB(e,t,n){return(t.inFlow??e.flow?QB:ZB)(e,t,n)}function ZB({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(Bz(i))!d&&i.spaceBefore&&f.push(``),$B(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(Iz(i)){let e=Bz(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),$B(n,f,e.commentBefore,d))}d=!1;let s=LB(i,u,()=>o=null,()=>d=!0);o&&(s+=vB(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+=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}`:`
`}}return e?(p+=`
`+_B(l(e),c),s&&s()):d&&o&&o(),p}function QB({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(Bz(i))i.spaceBefore&&d.push(``),$B(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(Iz(i)){let e=Bz(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),$B(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Bz(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=LB(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+=vB(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 $B({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=_B(t(r),e);n.push(i.trimStart())}}function eV(e,t){let n=Lz(t)?t.value:t;for(let r of e)if(Iz(r)&&(r.key===t||r.key===n||Lz(r.key)&&r.key.value===n))return r}var tV=class extends hB{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Oz,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(JB(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=Iz(e)?e:!e||typeof e!=`object`||!(`key`in e)?new YB(e,e?.value):new YB(e.key,e.value);let r=eV(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Lz(r.value)&&cB(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=eV(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=eV(this.items,e)?.value;return(!t&&Lz(n)?n.value:n)??void 0}has(e){return!!eV(this.items,e)}set(e,t){this.add(new YB(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)KB(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!Iz(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})),XB(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},nV={collection:`map`,default:!0,nodeClass:tV,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Fz(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>tV.from(e,t,n)},rV=class extends hB{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(jz,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=iV(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=iV(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Lz(r)?r.value:r}has(e){let t=iV(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=iV(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Lz(r)&&cB(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(iB(e,String(r++),t));return n}toString(e,t,n){return e?XB(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(fB(a,void 0,n))}}return i}};function iV(e){let t=Lz(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var aV={collection:`seq`,default:!0,nodeClass:rV,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Rz(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>rV.from(e,t,n)},oV={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),NB(e,t,n,r)}},sV={identify:e=>e==null,createNode:()=>new lB(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new lB(null),stringify:({source:e},t)=>typeof e==`string`&&sV.test.test(e)?e:t.options.nullStr},cV={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new lB(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&cV.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function lV({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 uV={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:lV},dV={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 NB({comment:e,type:t,value:s},r,i,a)}};function TV(e,t){if(Rz(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Iz(r)){if(Fz(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new YB(new lB(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]=Iz(r)?r:new YB(r)}}else t(`Expected a sequence for this tag`);return e}function EV(e,t,n){let{replacer:r}=n,i=new rV(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(JB(o,s,n))}return i}var DV={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:TV,createNode:EV},OV=class e extends rV{constructor(){super(),this.add=tV.prototype.add.bind(this),this.delete=tV.prototype.delete.bind(this),this.get=tV.prototype.get.bind(this),this.has=tV.prototype.has.bind(this),this.set=tV.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(Iz(e)?(r=iB(e.key,``,t),i=iB(e.value,r,t)):r=iB(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=EV(e,t,n),i=new this;return i.items=r.items,i}};OV.tag=`tag:yaml.org,2002:omap`;var kV={collection:`seq`,identify:e=>e instanceof Map,nodeClass:OV,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=TV(e,t),r=[];for(let{key:e}of n.items)Lz(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new OV,n)},createNode:(e,t,n)=>OV.from(e,t,n)};function AV({value:e,source:t},n){return t&&(e?jV:MV).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var jV={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 lB(!0),stringify:AV},MV={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 lB(!1),stringify:AV},NV={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:lV},PV={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():lV(e)}},FV={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 lB(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:lV},IV=e=>typeof e==`bigint`||Number.isInteger(e);function LV(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 RV(e,t,n){let{value:r}=e;if(IV(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return lV(e)}var zV={identify:IV,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>LV(e,2,2,n),stringify:e=>RV(e,2,`0b`)},BV={identify:IV,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>LV(e,1,8,n),stringify:e=>RV(e,8,`0`)},VV={identify:IV,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>LV(e,0,10,n),stringify:lV},HV={identify:IV,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>LV(e,2,16,n),stringify:e=>RV(e,16,`0x`)},UV=class e extends tV{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=Iz(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new YB(e.key,null):new YB(e,null),eV(this.items,t.key)||this.items.push(t)}get(e,t){let n=eV(this.items,e);return!t&&Iz(n)?Lz(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=eV(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new YB(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(_B(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(_B(a(t),``)))}return n.join(`
`+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(`
`)+`
`}var iH=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Mz,{value:Dz});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 Qz({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Mz]:{value:Dz}});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=Bz(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){aH(this.contents)&&this.contents.add(e)}addIn(e,t){aH(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=eB(this);e.anchor=!t||n.has(t)?tB(t||`a`,n):t}return new oB(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}=nB(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=fB(e,l,p);return o&&zz(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new YB(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return aH(this.contents)?this.contents.delete(e):!1}deleteIn(e){return mB(e)?this.contents!=null&&(this.contents=null,!0):aH(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return zz(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return mB(e)?!t&&Lz(this.contents)?this.contents.value:this.contents:zz(this.contents)?this.contents.getIn(e,t):void 0}has(e){return zz(this.contents)?this.contents.has(e):!1}hasIn(e){return mB(e)?this.contents!==void 0:zz(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=pB(this.schema,[e],t):aH(this.contents)&&this.contents.set(e,t)}setIn(e,t){mB(e)?this.contents=t:this.contents==null?this.contents=pB(this.schema,Array.from(e),t):aH(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 Qz({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 Qz({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 nH(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=iB(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`?rB(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 rH(this,e)}};function aH(e){if(zz(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var oH=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},sH=class extends oH{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},cH=class extends oH{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},lH=(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 uH(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function dH(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(dH(t.key)||dH(t.value))return!0}return!1;default:return!0}}function fH(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&dH(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function pH(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||Lz(e)&&Lz(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var mH=`All mapping items must start at the same column`;function hH({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??tV)(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=uH(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`,mH)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||dH(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`,mH);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&fH(r.indent,u,i),n.atKey=!1,pH(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=uH(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&&fH(r.indent,f,i),s=c.range[2];let l=new YB(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 YB(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 gH({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??rV)(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=uH(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&&fH(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function _H(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 vH=`Block collections are not allowed within flow collections`,yH=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function bH({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?tV:rV))(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=uH(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&&dH(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];Iz(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],yH(m)&&i(r.range,`BLOCK_IN_FLOW`,vH)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);yH(f)&&i(g.range,`BLOCK_IN_FLOW`,vH),n.atKey=!1;let _=uH(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?yH(m)&&i(v.range,`BLOCK_IN_FLOW`,vH):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new YB(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;pH(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new tV(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=_H(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 xH(e,t,n,r,i,a){let o=n.type===`block-map`?hH(e,t,n,r,a):n.type===`block-seq`?gH(e,t,n,r,a):bH(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function SH(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===tV.tagName&&s===`map`||o===rV.tagName&&s===`seq`)return xH(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),xH(e,t,n,i,o)}let l=xH(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=Bz(u)?u:new lB(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function CH(e,t,n){let r=t.offset,i=wH(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?lB.BLOCK_FOLDED:lB.BLOCK_LITERAL,o=t.source?TH(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 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],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function _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?`
`.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===lB.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===hB.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 wH({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 TH(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 EH(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=lB.PLAIN,c=DH(a,l);break;case`single-quoted-scalar`:s=lB.QUOTE_SINGLE,c=OH(a,l);break;case`double-quoted-scalar`:s=lB.QUOTE_DOUBLE,c=AH(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=_H(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function DH(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}`),kH(e)}function OH(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),kH(e.slice(1,-1)).replace(/''/g,`'`)}function kH(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 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===`
`?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 AH(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 IH(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}=jH(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=MH[i];if(a)n+=a;else 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===`
`)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+=NH(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+=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!==`
`&&(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 jH(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 LH(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 MH={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function NH(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 PH(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?CH(e,t,r):EH(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[Az]:c?FH(e.schema,i,c,n,r):t.type===`scalar`?IH(e,i,t,r):e.schema[Az];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=Lz(a)?a:new lB(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new lB(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 FH(e,t,n,r,i){if(n===`!`)return e[Az];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[Az])}function IH({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[Az];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Az];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 LH(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 RH={composeNode:zH,composeEmptyNode:BH};function zH(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=VH(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=PH(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=SH(RH,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??=BH(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&&(!Lz(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 BH(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=PH(e,{type:`scalar`,offset:LH(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 VH({options:e},{offset:t,source:n,end:r},i){let a=new oB(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=_H(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function HH(e,t,{offset:n,start:r,value:i,end:a},o){let s=new iH(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=uH(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?zH(c,i,l,o):BH(c,l.end,r,null,l,o);let u=s.contents.range[2],d=_H(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function UH(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 WH(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 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?`
`:`
`)+(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 GH=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=UH(e);r?this.warnings.push(new cH(i,t,n)):this.errors.push(new sH(i,t,n))},this.directives=new Qz({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=WH(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(zz(i)&&!i.flow&&i.items.length>0){let e=i.items[0];Iz(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:WH(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=UH(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=HH(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 sH(UH(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 sH(UH(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=_H(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 sH(UH(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 iH(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}}},KH=Symbol(`break visit`),qH=Symbol(`skip children`),JH=Symbol(`remove item`);function YH(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),XH(Object.freeze([]),e,t)}YH.BREAK=KH,YH.SKIP=qH,YH.REMOVE=JH,YH.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},YH.parentCollection=(e,t)=>{let n=YH.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 XH(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=XH(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===KH)return KH;else r===JH&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function ZH(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 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`
`: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 QH(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var $H=new Set(`0123456789ABCDEFabcdef`),eU=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),tU=new Set(`,[]{}`),nU=new Set(` ,[]{}
\r `),rU=e=>!e||nU.has(e),iU=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 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===`
`||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===`...`)&&QH(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===`...`)&&QH(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&&!QH(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===`:`)&&QH(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(rU),`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(`...`))&&QH(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(rU),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||QH(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===`...`)&&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(`
`,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=>QH(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=>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,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(QH(r)||e&&tU.has(r))break;t=n}else if(QH(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(iU(r)||e&&sU.has(r))break;t=n}else if(iU(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&tU.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&tU.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(rU),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(QH(n)||t&&tU.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(;!QH(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(eU.has(t))t=this.buffer[++e];else if(t===`%`&&$H.has(this.buffer[e+1])&&$H.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&&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===`
`?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)}},aU=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 oU(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function sU(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 cU(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 lU(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 uU(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 dU(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 fU(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!oU(t.start,`explicit-key-ind`)&&!oU(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,cU(t.value)?t.value.end?dU(t.value.end,t.sep):t.value.end=t.sep:dU(t.start,t.sep),delete t.sep)}var pU=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 iU,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=ZH(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`&&fU(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&&sU(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)}},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
`)+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)){dU(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(oU(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=uU(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(oU(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(cU(t.key)&&!oU(t.sep,`newline`)){let e=uU(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]}):oU(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&&!oU(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)){dU(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||oU(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)){_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
`)+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=uU(lU(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=uU(lU(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 mU(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new aU||null,prettyErrors:t}}function hU(e,t={}){let{lineCounter:n,prettyErrors:r}=mU(t),i=new pU(n?.addNewLine),a=new GH(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 sH(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(lH(e,n)),o.warnings.forEach(lH(e,n))),o}function gU(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=hU(e,n);if(!i)return null;if(i.warnings.forEach(e=>zB(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 _U(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 Pz(e)&&!r?e.toString(n):new iH(e,r,n).toString(n)}function vU(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 yU(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 bU=140,xU=280,SU={"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 CU(e){return SU[e]??e}var wU=/\{\{\s*steps\.([A-Za-z0-9_-]+)\.[^}]*\}\}/g;function TU(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function EU(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 DU(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 OU(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(wU)].map(e=>e[1]))]}function kU(e){let t=hU(e).toJS(),n=TU(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=TU(e)?e:{},f=typeof u.type==`string`?u.type:``,p=TU(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||CU(f),type:f,detail:EU(f,p),summary:DU(p),when:typeof u.when==`string`?u.when:void 0,retry:TU(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 OU(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(TU(t)&&TU(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)*xU,d=c,m=c;(Array.isArray(o)?o:[]).forEach((i,o)=>{let c=f(i,`${e+1}-${t}-${o+1}`,u,(l+o)*bU,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*bU,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*bU-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 AU={agent:or,command:qr,repo:Sr,gate:Wr,forge:Ar,human:ei,review:br,workflow:ri},jU={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function MU(e){return AU[e.split(`.`)[0]]??ri}function NU(e){return Object.keys(jU).map(t=>({title:jU[t],icon:AU[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}function PU(e,t){let n=hU(e).getIn(t,!0);if(Fz(n))return n.toJSON()}function FU(e,t,n){let r=hU(e);return r.setIn(t,r.createNode(VU(n))),r.toString()}function IU(e,t,n){let r=hU(e),i=r.get(`steps`,!0);if(Rz(i)||(r.set(`steps`,r.createNode([])),i=r.get(`steps`,!0)),!Rz(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 LU(e,t){let n=hU(e),r=n.getIn(t.slice(0,-1),!0),i=t.at(-1);if(!Rz(r)||typeof i!=`number`)return{source:e,path:t};let a=n.createNode(n.getIn(t));return Fz(a)&&a.delete(`id`),r.items.splice(i+1,0,a),{source:n.toString(),path:[...t.slice(0,-1),i+1]}}function RU(e,t){let n=hU(e);n.deleteIn(t);let r=t.slice(0,-1);if(r.length>2){let e=n.getIn(r,!0);Rz(e)&&e.items.length===0&&n.deleteIn(r)}return n.toString()}function zU(e,t,n){let r=hU(e),i=r.getIn(t.slice(0,-1),!0),a=t.at(-1);if(!Rz(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 BU(e,t){let n=hU(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 VU(e){if(Array.isArray(e))return e.map(VU);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=VU(r);(typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length!==0)&&(t[n]=e)}return t}function HU(e,t){let n=hU(e).get(t,!0);return n&&typeof n==`object`&&`toJSON`in n?n.toJSON():hU(e).get(t)}function UU(e,t,n){let r=hU(e),i=VU({[t]:n})[t];return i===void 0?r.delete(t):r.set(t,r.createNode(i)),r.toString()}function WU(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function GU(e,t=[]){let n=hU(e),r=n.errors[0];if(r)return{ok:!1,message:aW(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!oW(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:tW(e)}))}var $U=/^(\s*)(-\s+)?/,eW=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function tW(e){let{code:t,comment:n}=nW(e),r=rW(t);return n&&r.push({text:n,kind:`comment`}),r}function nW(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 rW(e){if(!e)return[];let t=[],n=$U.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=eW.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,...iW(i[4]??``)]):[...t,...iW(r)]}function iW(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 aW(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function oW(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sW(e){return typeof e==`string`&&e.trim()!==``}var cW={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},lW={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},uW={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},dW={class:`min-w-0 flex-1`},fW=[`value`,`placeholder`],pW={class:`truncate font-mono text-[11px] text-fg-subtle`},mW={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},hW={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},gW={key:1,class:`space-y-1.5`},_W=[`title`],vW=[`value`],yW=[`value`],bW={key:3,class:`flex flex-wrap items-center gap-1 pt-0.5`},xW=[`onClick`],SW=[`onClick`],CW={key:2,class:`divide-y divide-border rounded-md border border-border`},wW=[`title`],TW=[`value`,`onChange`],EW=[`value`],DW=[`value`,`onInput`],OW=[`value`,`onFocus`,`onInput`],kW=[`title`],AW={key:0,class:`text-xs text-danger`},jW={class:`space-y-2`},MW={class:`divide-y divide-border rounded-md border border-border`},NW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},PW=[`value`],FW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},IW=[`value`],LW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},RW=[`value`],zW={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},BW={class:`flex items-center border-t border-border px-4 py-2.5`},VW=y({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=U(()=>PU(n.yaml,n.path)??{}),a=U(()=>typeof i.value.type==`string`?i.value.type:``),o=U(()=>n.vocabulary.find(e=>e.name===a.value)),s=U(()=>typeof i.value.settings==`object`&&i.value.settings!==null?i.value.settings:{}),c=U(()=>BU(n.yaml,n.path)),l=U(()=>o.value?.settings&&i.value.settings?XU(i.value.settings,o.value.settings,`settings`):``),u=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],d=/mission|body|detail|plan|rules/;function p(e,t){return t.type===`string`?t.enum?`select`:d.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let m=U(()=>{let e=Object.entries(o.value?.settings?.properties??{}).map(([e,t])=>({key:e,schema:t,kind:p(e,t)})),t=e.filter(e=>u.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>u.indexOf(e.key)-u.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function h(e){let{id:t,type:i,...a}=e;r(`update:yaml`,FU(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=R(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=R({});function S(e,t){try{v(e,t.trim()?gU(t):void 0),x.value={...x.value,[e]:``}}catch(t){x.value={...x.value,[e]:String(t.message).split(`
`)[0]}}}let C=e=>e===void 0?``:_U(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)=>(I(),P(`aside`,cW,[H(`header`,lW,[H(`span`,uW,[(I(),z(_n(A(MU)(a.value)),{class:`size-4`}))]),H(`div`,dW,[H(`input`,{value:i.value.id??``,class:`w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline`,placeholder:A(CU)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>g(`id`,e.target.value)},null,40,fW),H(`div`,pW,V(a.value),1)]),K(A(B),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:j(()=>[K(A(ai))]),_:1})]),H(`div`,mW,[l.value?(I(),P(`p`,hW,V(l.value),1)):L(``,!0),m.value.lead?(I(),P(`section`,gW,[H(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:m.value.lead.schema.description},[f(V(w(m.value.lead.key,m.value.lead.schema))+` `,1),m.value.lead.schema.description?(I(),z(A(gr),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,_W),m.value.lead.kind===`select`?(I(),P(`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]||=H(`option`,{value:``},`Default`,-1),(I(!0),P(W,null,N(m.value.lead.schema.enum,e=>(I(),P(`option`,{key:e,value:e},V(e),9,yW))),128))],40,vW)):m.value.lead.kind===`text`?(I(),z(A(ph),{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`])):(I(),z(A(Y),{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`?(I(),P(`div`,bW,[t[14]||=H(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(I(!0),P(W,null,N(c.value,e=>(I(),P(W,{key:e},[H(`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`)},V(e),9,xW),H(`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`)},V(e)+`.result`,9,SW)],64))),128))])):L(``,!0)])):L(``,!0),m.value.compact.length?(I(),P(`section`,CW,[(I(!0),P(W,null,N(m.value.compact,e=>(I(),P(`div`,{key:e.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[H(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:e.schema.description},[f(V(w(e.key,e.schema))+` `,1),e.schema.description?(I(),z(A(gr),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,wW),e.kind===`boolean`?(I(),z(A(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`?(I(),P(`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]||=H(`option`,{value:``},`Default`,-1),(I(!0),P(W,null,N(e.schema.enum,e=>(I(),P(`option`,{key:e,value:e},V(e),9,EW))),128))],40,TW)):e.kind===`number`?(I(),P(`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,DW)):(I(),P(`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,OW))]))),128))])):L(``,!0),(I(!0),P(W,null,N(m.value.long,e=>(I(),P(`section`,{key:e.key,class:`space-y-1.5`},[H(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[f(V(w(e.key,e.schema))+` `,1),e.schema.description?(I(),z(A(gr),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,kW),e.kind===`text`?(I(),z(A(ph),{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`?(I(),z(A(ph),{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=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=y({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=H(()=>BU(n.yaml,n.path)??{}),a=H(()=>typeof i.value.type==`string`?i.value.type:``),o=H(()=>n.vocabulary.find(e=>e.name===a.value)),s=H(()=>typeof i.value.settings==`object`&&i.value.settings!==null?i.value.settings:{}),c=H(()=>KU(n.yaml,n.path)),l=H(()=>o.value?.settings&&i.value.settings?nW(i.value.settings,o.value.settings,`settings`):``),u=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],d=/mission|body|detail|plan|rules/;function p(e,t){return t.type===`string`?t.enum?`select`:d.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let m=H(()=>{let e=Object.entries(o.value?.settings?.properties??{}).map(([e,t])=>({key:e,schema:t,kind:p(e,t)})),t=e.filter(e=>u.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>u.indexOf(e.key)-u.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function 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=L(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=L({});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 C=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)=>(F(),N(`aside`,mW,[V(`header`,hW,[V(`span`,gW,[(F(),R(vn(k(RU)(a.value)),{class:`size-4`}))]),V(`div`,_W,[V(`input`,{value:i.value.id??``,class:`w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline`,placeholder:k(kU)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>g(`id`,e.target.value)},null,40,vW),V(`div`,yW,B(a.value),1)]),G(k(z),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:A(()=>[G(k(oi))]),_:1})]),V(`div`,bW,[l.value?(F(),N(`p`,xW,B(l.value),1)):I(``,!0),m.value.lead?(F(),N(`section`,SW,[V(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:m.value.lead.schema.description},[f(B(w(m.value.lead.key,m.value.lead.schema))+` `,1),m.value.lead.schema.description?(F(),R(k(_r),{key:0,class:`size-3 text-fg-subtle`})):I(``,!0)],8,CW),m.value.lead.kind===`select`?(F(),N(`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]||=V(`option`,{value:``},`Default`,-1),(F(!0),N(U,null,M(m.value.lead.schema.enum,e=>(F(),N(`option`,{key:e,value:e},B(e),9,TW))),128))],40,wW)):m.value.lead.kind===`text`?(F(),R(k(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`])):(F(),R(k(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`?(F(),N(`div`,EW,[t[14]||=V(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(F(!0),N(U,null,M(c.value,e=>(F(),N(U,{key:e},[V(`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`)},B(e),9,DW),V(`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`)},B(e)+`.result`,9,OW)],64))),128))])):I(``,!0)])):I(``,!0),m.value.compact.length?(F(),N(`section`,kW,[(F(!0),N(U,null,M(m.value.compact,e=>(F(),N(`div`,{key:e.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[V(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:e.schema.description},[f(B(w(e.key,e.schema))+` `,1),e.schema.description?(F(),R(k(_r),{key:0,class:`size-3 text-fg-subtle`})):I(``,!0)],8,AW),e.kind===`boolean`?(F(),R(k(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`?(F(),N(`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]||=V(`option`,{value:``},`Default`,-1),(F(!0),N(U,null,M(e.schema.enum,e=>(F(),N(`option`,{key:e,value:e},B(e),9,MW))),128))],40,jW)):e.kind===`number`?(F(),N(`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)):(F(),N(`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))])):I(``,!0),(F(!0),N(U,null,M(m.value.long,e=>(F(),N(`section`,{key:e.key,class:`space-y-1.5`},[V(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[f(B(w(e.key,e.schema))+` `,1),e.schema.description?(F(),R(k(_r),{key:0,class:`size-3 text-fg-subtle`})):I(``,!0)],8,FW),e.kind===`text`?(F(),R(k(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`?(F(),R(k(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`])):(I(),P(W,{key:2},[K(A(ph),{"model-value":C(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]?(I(),P(`span`,AW,V(x.value[e.key]),1)):L(``,!0)],64))]))),128)),H(`section`,jW,[t[21]||=H(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),H(`div`,MW,[H(`label`,NW,[t[16]||=H(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),H(`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,PW)]),H(`label`,FW,[t[18]||=H(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),H(`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]||=[H(`option`,{value:``},`Park the task`,-1),H(`option`,{value:`continue`},`Continue`,-1)]],40,IW)]),H(`label`,LW,[t[19]||=H(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),H(`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,RW)]),H(`label`,zW,[t[20]||=H(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),K(A(Yy),{"model-value":i.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":t[10]||=e=>_({backoff:e||void 0})},null,8,[`model-value`])])])])]),H(`footer`,BW,[K(A(B),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[11]||=e=>r(`remove`)},{default:j(()=>[K(A(Yr)),t[22]||=f(` Delete step`,-1)]),_:1}),K(A(B),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[12]||=e=>r(`close`)},{default:j(()=>[...t[23]||=[f(`Done`,-1)]]),_:1})])]))}}),HW=`repository_path`;function UW(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:HW,path:n.trim(),type:`string`,required:!0}),r}function WW(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function GW(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=WW(Rw(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 KW(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:Rw(e.value,i.type??`string`)})}return n}function qW(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 JW(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...JW(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...JW(n,r)]}):[]}function YW(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function XW(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 ZW(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var QW={class:`flex h-full flex-col`},$W={class:`flex items-center gap-2 border-b border-border px-4 py-3`},eG={class:`min-w-0 flex-1 truncate text-sm font-medium`},tG={key:0,class:`flex flex-1 items-center justify-center`},nG={class:`space-y-1.5`},rG=[`disabled`],iG=[`value`],aG={key:1,class:`space-y-1.5`},oG=[`value`],sG=[`title`],cG={class:`space-y-1.5`},lG={id:`bind-paths`},uG=[`value`],dG={class:`divide-y divide-border rounded-md border border-border`},fG={class:`flex items-center gap-1.5 text-xs`},pG={class:`font-mono`},mG={class:`text-fg-subtle`},hG={key:0,class:`text-danger`,title:`Required`},gG=[`title`,`aria-label`,`onClick`],_G=[`onUpdate:modelValue`,`aria-label`],vG=[`onUpdate:modelValue`,`aria-label`],yG={key:2,class:`text-xs text-danger`},bG=[`title`],xG={key:0,class:`space-y-1 px-3 py-2`},SG={key:0,class:`text-xs text-danger`},CG={key:1,class:`truncate font-mono text-xs text-success`},wG={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},TG={class:`space-y-2`},EG={key:0,role:`alert`,class:`text-xs text-danger`},DG={key:1,class:`texLine truncated
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(F(),N(U,{key:2},[G(k(mh),{"model-value":C(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]?(F(),N(`span`,IW,B(x.value[e.key]),1)):I(``,!0)],64))]))),128)),V(`section`,LW,[t[21]||=V(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),V(`div`,RW,[V(`label`,zW,[t[16]||=V(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),V(`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)]),V(`label`,VW,[t[18]||=V(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),V(`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]||=[V(`option`,{value:``},`Park the task`,-1),V(`option`,{value:`continue`},`Continue`,-1)]],40,HW)]),V(`label`,UW,[t[19]||=V(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),V(`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)]),V(`label`,GW,[t[20]||=V(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),G(k(Xy),{"model-value":i.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":t[10]||=e=>_({backoff:e||void 0})},null,8,[`model-value`])])])])]),V(`footer`,KW,[G(k(z),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[11]||=e=>r(`remove`)},{default:A(()=>[G(k(Xr)),t[22]||=f(` Delete step`,-1)]),_:1}),G(k(z),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[12]||=e=>r(`close`)},{default:A(()=>[...t[23]||=[f(`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:`texLine 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 b$(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=x$(n.code,e);return Array.isArray(e)?e.some(e=>y$(n[r],e,t,n.type===`keyup`)):y$(n[r],e,t,n.type===`keyup`)}}function x$(e,t){return t.includes(e)?`code`:`key`}function S$(e,t){let n=U(()=>d(t?.target)??g$),r=pn(d(e)===!0),i=!1,a=new Set,o=c(d(e));J(()=>d(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),mq([`blur`,`contextmenu`],s),gq((...e)=>o(...e),e=>{let n=d(t?.actInsideInputWithModifier)??!0,a=d(t?.preventDefault)??!1;if(i=v$(e),(!i||i&&!n)&&_$(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}),gq((...e)=>o(...e),e=>{let n=d(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&_$(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=d(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?b$(e,a):e}return r}var C$=`vue-flow__node-desc`,w$=`vue-flow__edge-desc`,T$=`vue-flow__aria-live`,E$=[`Enter`,` `,`Escape`],D$={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function O$(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function k$(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 A$(e){return{width:e.offsetWidth,height:e.offsetHeight}}function j$(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function M$(e,t){return{x:j$(e.x,t[0][0],t[1][0]),y:j$(e.y,t[0][1],t[1][1])}}function N$(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function P$(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function F$(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!P$(e)}function I$(e){return F$(e)&&`computedPosition`in e}function L$(e){return!Number.isNaN(e)&&Number.isFinite(e)}function R$(e){return L$(e.width)&&L$(e.height)&&L$(e.x)&&L$(e.y)}function z$(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:It({width:0,height:0}),computedPosition:It({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:t0(e.data)?e.data:{},events:It(t0(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function B$(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:t0(e.data)?e.data:{},events:It(t0(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function V$(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 H$(...e){if(e.length===3){let[t,n,r]=e;return V$(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>P$(e)&&e.source===r).map(e=>n.find(t=>F$(t)&&t.id===e.target))}function U$(...e){if(e.length===3){let[t,n,r]=e;return V$(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>P$(e)&&e.target===r).map(e=>n.find(t=>F$(t)&&t.id===e.source))}function W$({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function G$(e,t){return t.some(t=>P$(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 K$({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function q$({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?R1(s,o):s}function J$(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 Y$({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function X$({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function Z$(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=J$(t,Y$({...r.computedPosition,...r.dimensions}))}return X$(t)}function Q$(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...q$(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 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=H(()=>d(t?.target)??S$),r=mn(d(e)===!0),i=!1,a=new Set,o=c(d(e));q(()=>d(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=d(t?.actInsideInputWithModifier)??!0,a=d(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=d(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=d(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:Lt({width:0,height:0}),computedPosition:Lt({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:Lt(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:Lt(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
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`},M1=class extends Error{constructor(e,...t){super(j1[e]?.call(j1,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function N1(e){return`clientX`in e}function P1(e){return`sourceEvent`in e}function F1(e,t){let n=N1(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 I1=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function L1(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function R1(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var z1=()=>!0;function B1(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function V1(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())k$(i,O$(e))>0&&r.push(e);return r}var H1=250;function U1(e,t,n,r){let i=[],a=1/0,o=V1(e,n,t+H1);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}=E1(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 W1(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=z1},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:_}=F1(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=G1(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===d$.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=J1(t,e,a,p,n,!0)}return b}function G1(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function K1(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function q1(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function J1(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===d$.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,...E1(o,c,c.position,!0)}:c}var Y1={[c$.Left]:c$.Right,[c$.Right]:c$.Left,[c$.Top]:c$.Bottom,[c$.Bottom]:c$.Top},X1=[`production`,`prod`];function Z1(e,...t){Q1()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Q1(){return!X1.includes(`production`)}function $1(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,...A$(t)}}):null}function e0(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),De(()=>{o.blur()})):n([e])}function t0(e){return A(e)!==void 0}function n0(e,t,n,r){if(!e||!e.source||!e.target)return n(new M1(A1.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=P$(e)?e:{...e,id:W$(e)},i=B$(i,void 0,r),!G$(i,t)&&i}function r0(e,t,n,r,i){if(!t.source||!t.target)return i(new M1(A1.EDGE_INVALID,e.id)),!1;if(!n)return i(new M1(A1.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?W$(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function i0(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!F$(o)){n(new M1(A1.NODE_INVALID,o?.id));continue}let s=z$(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 M1(A1.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 a0(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 o0(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}`;a0(`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`},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]),Oe(()=>{o.blur()})):n([e])}function s0(e){return k(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
+51 -2
View File
@@ -1,6 +1,15 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { computed, onMounted, ref, watch } from "vue";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { Switch } from "@/components/ui/switch";
import { DurationInput } from "@/components/ui/duration-input";
import { SettingRow } from "@/components/ui/setting-row";
import { useControlPlaneStore } from "@/stores/control-plane";
import ApplyStatusRows from "@/settings/ApplyStatusRows.vue";
import HistoryLink from "@/settings/HistoryLink.vue";
import PageHeader from "@/base/PageHeader.vue";
import {
Empty,
@@ -19,6 +28,27 @@ import CuratorCard, { type Curator } from "./CuratorCard.vue";
* the reason each action happened.
*/
interface Definition {
name: string; enabled: boolean; instructions: string; interval: string; cooldown: string;
on_input: boolean; tools: string[]; skills: boolean; memory_engine: string; conversations: boolean; model: string;
}
const KIND = "curators";
const store = useControlPlaneStore();
onMounted(store.load);
const definitions = computed(() => store.drafts[KIND]?.value as Definition[] | null);
const editing = ref(false);
const newName = ref("");
function add() {
const name = newName.value.trim();
if (!name || definitions.value?.some(def => def.name === name)) return;
const draft = store.drafts[KIND];
if (!draft) return;
if (!draft.value) draft.value = [];
(draft.value as Definition[]).push({name,enabled:false,instructions:"",interval:"1h",cooldown:"0s",on_input:false,tools:[],skills:false,memory_engine:"",conversations:false,model:""});
newName.value = "";
}
function setTools(def: Definition, value: string | number) { def.tools = String(value).split(",").map(tool => tool.trim()).filter(Boolean); }
watch(() => store.applyStatusFor(KIND).map(row => row.version).join(","), () => void load());
const curators = ref<Curator[]>([]);
const loadError = ref<string | null>(null);
@@ -38,7 +68,26 @@ onMounted(load);
<template>
<div>
<PageHeader title="Curators" />
<PageHeader title="Curators"><HistoryLink :kinds="[KIND]" /><Button variant="outline" @click="editing = !editing">{{ editing ? "Hide definitions" : "Edit definitions" }}</Button></PageHeader>
<ApplyStatusRows :kind="KIND" class="mb-4" />
<p v-if="store.catalogError || store.stateFor(KIND).error" class="mb-4 text-sm text-destructive" role="alert">{{ store.catalogError || store.stateFor(KIND).error }}</p>
<div v-if="editing" class="mb-6">
<form class="mb-4 flex gap-2" @submit.prevent="add"><Input v-model="newName" aria-label="Curator name" placeholder="Curator name" class="max-w-xs" /><Button type="submit" :disabled="!newName.trim() || definitions?.some(def => def.name === newName.trim())">Add curator</Button></form>
<p v-if="!definitions?.length" class="text-sm text-fg-muted">No custom curator definitions.</p>
<section v-for="(def, index) in definitions" :key="index" class="mb-6 border-t pt-4">
<div class="flex items-center justify-between"><h2 class="font-mono text-sm">{{ def.name }}</h2><Button variant="ghost" size="sm" @click="definitions!.splice(index, 1)">Remove curator</Button></div>
<SettingRow label="Enabled"><Switch v-model="def.enabled" :aria-label="`${def.name} enabled`" /></SettingRow>
<SettingRow label="Instructions" :for="`curator-${index}-instructions`"><Textarea :id="`curator-${index}-instructions`" v-model="def.instructions" /></SettingRow>
<SettingRow label="Interval"><DurationInput v-model="def.interval" :units="['s', 'm', 'h']" /></SettingRow>
<SettingRow label="Cooldown"><DurationInput v-model="def.cooldown" :units="['s', 'm', 'h']" /></SettingRow>
<SettingRow label="Wake on input"><Switch v-model="def.on_input" :aria-label="`${def.name} wake on input`" /></SettingRow>
<SettingRow label="Tools" :for="`curator-${index}-tools`"><Input :id="`curator-${index}-tools`" :model-value="(def.tools ?? []).join(', ')" @update:model-value="setTools(def, $event)" /></SettingRow>
<SettingRow label="Skills"><Switch v-model="def.skills" :aria-label="`${def.name} skills`" /></SettingRow>
<SettingRow label="Memory engine" :for="`curator-${index}-memory`"><Input :id="`curator-${index}-memory`" v-model="def.memory_engine" /></SettingRow>
<SettingRow label="Conversations"><Switch v-model="def.conversations" :aria-label="`${def.name} conversations`" /></SettingRow>
<SettingRow label="Model" :for="`curator-${index}-model`"><Input :id="`curator-${index}-model`" v-model="def.model" placeholder="Default model" /></SettingRow>
</section>
</div>
<div
class="grid grid-cols-1 gap-4 lg:grid-cols-[repeat(auto-fit,minmax(340px,1fr))]"
+3 -1
View File
@@ -191,9 +191,11 @@ export type ControlPlanePage =
| "workflows"
| "profiles"
| "credentials"
| "playbooks";
| "playbooks"
| "curators";
const PAGE_RESOURCES: Record<ControlPlanePage, string[]> = {
curators: ["curators"],
profiles: ["agent-profiles"],
credentials: ["credential-bindings"],
playbooks: ["eda-playbooks"],