fix(webui): bind task requester to authenticated principal

This commit is contained in:
sam committed 2026-10-17 08:42:08 +11:00
1 parent 4217a50874
commit cbc4cf309d
7 files changed
+157 -124

No files matched your search

+1 -1
View File
@@ -41,7 +41,7 @@ fi
tasks=$(get /api/tasks)
for t in "Fix flaky login test" "Add retry to webhook sender" "Document the gate" "Speed up the CI cache"; do
grep -qF "\"$t\"" <<<"$tasks" && continue
post /api/work-requests "{\"identity\":\"archie-dev\",\"repository\":\"acme/widgets\",\"workflow\":\"triage\",\"title\":\"$t\",\"instructions\":\"Do it.\"}" >/dev/null
post /api/work-requests "{\"repository\":\"acme/widgets\",\"workflow\":\"triage\",\"title\":\"$t\",\"instructions\":\"Do it.\"}" >/dev/null
done
# An unsigned capture source with one delivery, an event type, a mapping and
+9 -5
View File
@@ -14,6 +14,7 @@ import (
"google.golang.org/grpc/status"
controlpb "github.com/samcharles93/archie-core/internal/contracts/controlplane/v1"
"github.com/samcharles93/archie-core/internal/domain/access"
"github.com/samcharles93/archie-core/internal/domain/org"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
@@ -50,7 +51,6 @@ func (s *Server) handleWorkflows(w http.ResponseWriter, r *http.Request) {
}
type workRequest struct {
Identity string `json:"identity"`
Repository string `json:"repository"`
Workflow string `json:"workflow"`
Title string `json:"title"`
@@ -70,6 +70,11 @@ func (s *Server) handleWorkRequest(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) {
return
}
principal, ok := access.PrincipalFromContext(r.Context())
if !ok || principal.IdentityID == "" {
http.Error(w, "authenticated requester required", http.StatusUnauthorized)
return
}
r.Body = http.MaxBytesReader(w, r.Body, 32<<10)
var request workRequest
decoder := json.NewDecoder(r.Body)
@@ -86,13 +91,12 @@ func (s *Server) handleWorkRequest(w http.ResponseWriter, r *http.Request) {
http.Error(w, "invalid work request", http.StatusBadRequest)
return
}
request.Identity = strings.TrimSpace(request.Identity)
request.Repository = strings.TrimSpace(request.Repository)
request.Workflow = strings.TrimSpace(request.Workflow)
request.Title = strings.TrimSpace(request.Title)
request.Instructions = strings.TrimSpace(request.Instructions)
if request.Identity == "" || request.Workflow == "" || request.Title == "" || request.Instructions == "" {
http.Error(w, "identity, workflow, title, and instructions are required", http.StatusBadRequest)
if request.Workflow == "" || request.Title == "" || request.Instructions == "" {
http.Error(w, "workflow, title, and instructions are required", http.StatusBadRequest)
return
}
if utf8.RuneCountInString(request.Title) > 80 {
@@ -113,7 +117,7 @@ func (s *Server) handleWorkRequest(w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), status)
return
}
created, err := s.Store.EnqueueChatTask(r.Context(), owner, repo, request.Title, request.Instructions, request.Workflow, request.Identity, "", request.Draft, request.Inputs)
created, err := s.Store.EnqueueChatTask(r.Context(), owner, repo, request.Title, request.Instructions, request.Workflow, string(principal.IdentityID), "", request.Draft, request.Inputs)
if err != nil {
s.logf("work request enqueue failed", "err", err)
http.Error(w, "work request rejected", http.StatusBadRequest)
+64 -2
View File
@@ -1,21 +1,30 @@
package webui
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"strings"
"testing"
"google.golang.org/grpc"
controlpb "github.com/samcharles93/archie-core/internal/contracts/controlplane/v1"
"github.com/samcharles93/archie-core/internal/domain/access"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
"github.com/samcharles93/archie-core/internal/events"
)
func TestWorkRequestRejectsLongTitle(t *testing.T) {
for _, title := range []string{strings.Repeat("a", 81), strings.Repeat("界", 81)} {
t.Run(title[:3], func(t *testing.T) {
body, err := json.Marshal(workRequest{Identity: "operator", Workflow: "implement", Title: title, Instructions: "Full task description"})
body, err := json.Marshal(workRequest{Workflow: "implement", Title: title, Instructions: "Full task description"})
if err != nil {
t.Fatal(err)
}
request := httptest.NewRequestWithContext(t.Context(), http.MethodPost, "/api/work-requests", strings.NewReader(string(body)))
request := httptest.NewRequestWithContext(access.WithPrincipal(t.Context(), access.Principal{IdentityID: "operator"}), http.MethodPost, "/api/work-requests", strings.NewReader(string(body)))
request.Header.Set("Content-Type", "application/json")
request.Header.Set("X-Archie-CSRF", "1")
response := httptest.NewRecorder()
@@ -26,3 +35,56 @@ func TestWorkRequestRejectsLongTitle(t *testing.T) {
})
}
}
type workRequestTasks struct {
storecontract.TaskStore
requester string
}
func (s *workRequestTasks) EnqueueChatTask(_ context.Context, _, _, _, _, _, requester, _, _ string, _ map[string]any) (*task.Task, error) {
s.requester = requester
return &task.Task{ID: 1}, nil
}
func (*workRequestTasks) InsertEvent(context.Context, events.Event) (int64, error) { return 1, nil }
type workRequestControl struct {
controlpb.ControlPlaneServiceClient
}
func (workRequestControl) Query(_ context.Context, r *controlpb.QueryRequest, _ ...grpc.CallOption) (*controlpb.QueryResponse, error) {
value := []byte(`{}`)
if r.Kind == workflowDefinitionsKind {
value = []byte(`{"definitions":[{"id":"report","yaml":"id: report\nrepository: none\nidentity: worker\n"}]}`)
}
return &controlpb.QueryResponse{Resource: &controlpb.Resource{ValueJson: value}}, nil
}
func TestWorkRequestRequester(t *testing.T) {
for _, tt := range []struct {
name, claimed string
principal *access.Principal
status int
requester string
}{
{"authenticated requester", "", &access.Principal{IdentityID: "signed-in-human"}, http.StatusCreated, "signed-in-human"},
{"cannot claim another requester", `,"identity":"another-account"`, &access.Principal{IdentityID: "signed-in-human"}, http.StatusBadRequest, ""},
{"missing principal", "", nil, http.StatusUnauthorized, ""},
{"empty principal", "", &access.Principal{}, http.StatusUnauthorized, ""},
} {
t.Run(tt.name, func(t *testing.T) {
ctx := t.Context()
if tt.principal != nil {
ctx = access.WithPrincipal(ctx, *tt.principal)
}
req := httptest.NewRequestWithContext(ctx, http.MethodPost, "/api/work-requests", strings.NewReader(`{"workflow":"report","title":"Report","instructions":"Summarise results"`+tt.claimed+`}`))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Archie-CSRF", "1")
tasks := &workRequestTasks{}
response := httptest.NewRecorder()
(&Server{Store: tasks, ControlPlane: workRequestControl{}}).handleWorkRequest(response, req)
if response.Code != tt.status || tasks.requester != tt.requester {
t.Fatalf("response = %d %s, requester = %q; want %d, %q", response.Code, response.Body.String(), tasks.requester, tt.status, tt.requester)
}
})
}
}
+2 -2
View File
@@ -1,3 +1,3 @@
import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Cn as s,Ct as c,D as l,Dn as u,Dt as d,E as f,En as p,Et as m,F as h,Ft as g,G as _,Gt as v,H as y,Ht as b,I as x,It as S,J as C,Jt as w,K as T,Kt as E,L as ee,Lt as te,M as D,Mn as ne,Mt as re,N as ie,Nn as ae,Nt as oe,O,On as se,Ot as ce,P as le,Pt as ue,Q as de,Qn as fe,Qt as pe,R as me,Rt as he,S as ge,Sn as _e,St as k,T as ve,Tn as ye,Tt as be,U as xe,Ut as A,V as Se,Vt as Ce,W as we,Wt as j,X as Te,Xt as Ee,Y as De,Yt as Oe,Z as ke,Zt as Ae,_ as M,_n as je,_t as Me,a as Ne,an as Pe,at as Fe,b as Ie,bn as Le,bt as Re,c as ze,cn as Be,ct as Ve,d as He,dn as Ue,dt as We,en as Ge,er as Ke,et as qe,f as Je,fn as Ye,ft as Xe,g as Ze,gn as Qe,gt as $e,h as et,hn as tt,ht as N,i as nt,in as rt,it,j as at,jt as ot,k as st,kn as P,kt as ct,l as lt,ln as ut,lt as dt,m as ft,mn as pt,mt,n as ht,nn as gt,nr as _t,nt as F,o as vt,on as yt,ot as bt,p as xt,pn as St,pt as Ct,q as wt,qt as Tt,r as Et,rn as Dt,rr as Ot,rt as kt,s as At,sn as jt,st as Mt,tn as Nt,tr as Pt,tt as I,u as Ft,un as It,ut as Lt,v as Rt,vn as zt,vt as Bt,w as Vt,wn as Ht,wt as Ut,x as Wt,xn as Gt,xt as Kt,y as L,yn as R,yt as qt,z as Jt,zt as Yt}from"./PageHeader.js";import{A as Xt,B as Zt,C as Qt,D as $t,E as en,F as tn,H as nn,I as rn,L as an,M as on,N as sn,O as cn,P as ln,R as un,S as dn,T as fn,U as pn,V as mn,W as hn,_ as z,a as gn,f as _n,g as vn,h as yn,i as bn,j as xn,k as Sn,n as Cn,s as wn,w as Tn,x as En,y as Dn,z as On}from"./api.js";import{n as kn}from"./pinia.js";import{t as An}from"./createLucideIcon.js";import{a as jn,i as Mn,n as Nn,r as Pn,t as Fn}from"./alert.js";var In=Object.defineProperty,Ln=((e,t)=>{let n={};for(var r in e)In(n,r,{get:e[r],enumerable:!0});return t||In(n,Symbol.toStringTag,{value:`Module`}),n})({BaseTransition:()=>ht,BaseTransitionPropsValidators:()=>Et,Comment:()=>nt,DeprecationTypes:()=>null,EffectScope:()=>t,ErrorCodes:()=>Ne,ErrorTypeStrings:()=>vt,Fragment:()=>At,KeepAlive:()=>ze,ReactiveEffect:()=>Ge,Static:()=>lt,Suspense:()=>Ft,Teleport:()=>He,Text:()=>Je,TrackOpTypes:()=>Nt,Transition:()=>En,TransitionGroup:()=>dn,TriggerOpTypes:()=>gt,VueElement:()=>Qt,assertNumber:()=>xt,callWithAsyncErrorHandling:()=>ft,callWithErrorHandling:()=>et,camelize:()=>ne,capitalize:()=>ae,cloneVNode:()=>Ze,compatUtils:()=>null,compile:()=>Rn,computed:()=>M,createApp:()=>Tn,createBlock:()=>L,createCommentVNode:()=>Ie,createElementBlock:()=>Wt,createElementVNode:()=>Rt,createHydrationRenderer:()=>ge,createPropsRestProxy:()=>o,createRenderer:()=>Vt,createSSRApp:()=>fn,createSlots:()=>ve,createStaticVNode:()=>f,createTextVNode:()=>l,createVNode:()=>O,customRef:()=>Dt,defineAsyncComponent:()=>st,defineComponent:()=>n,defineCustomElement:()=>en,defineEmits:()=>at,defineExpose:()=>D,defineModel:()=>ie,defineOptions:()=>le,defineProps:()=>h,defineSSRCustomElement:()=>$t,defineSlots:()=>x,devtools:()=>ee,effect:()=>rt,effectScope:()=>Pe,getCurrentInstance:()=>me,getCurrentScope:()=>yt,getCurrentWatcher:()=>jt,getTransitionRawChildren:()=>Jt,guardReactiveProps:()=>i,h:()=>Se,handleError:()=>y,hasInjectionContext:()=>xe,hydrate:()=>cn,hydrateOnIdle:()=>we,hydrateOnInteraction:()=>_,hydrateOnMediaQuery:()=>T,hydrateOnVisible:()=>wt,initCustomFormatter:()=>C,initDirectivesForSSR:()=>Sn,inject:()=>De,isMemoSame:()=>Te,isProxy:()=>Be,isReactive:()=>ut,isReadonly:()=>It,isRef:()=>Ue,isRuntimeOnly:()=>ke,isShallow:()=>Ye,isVNode:()=>de,markRaw:()=>St,mergeDefaults:()=>e,mergeModels:()=>qe,mergeProps:()=>I,nextTick:()=>F,nodeOps:()=>Xt,normalizeClass:()=>fe,normalizeProps:()=>Ke,normalizeStyle:()=>Pt,onActivated:()=>kt,onBeforeMount:()=>it,onBeforeUnmount:()=>Fe,onBeforeUpdate:()=>bt,onDeactivated:()=>Mt,onErrorCaptured:()=>Ve,onMounted:()=>dt,onRenderTracked:()=>Lt,onRenderTriggered:()=>We,onScopeDispose:()=>pt,onServerPrefetch:()=>Xe,onUnmounted:()=>Ct,onUpdated:()=>mt,onWatcherCleanup:()=>tt,openBlock:()=>N,patchProp:()=>xn,popScopeId:()=>$e,provide:()=>Me,proxyRefs:()=>Qe,pushScopeId:()=>Bt,queuePostFlushCb:()=>qt,reactive:()=>je,readonly:()=>zt,ref:()=>R,registerRuntimeCompiler:()=>Re,render:()=>on,renderList:()=>Kt,renderSlot:()=>k,resolveComponent:()=>c,resolveDirective:()=>Ut,resolveDynamicComponent:()=>be,resolveFilter:()=>null,resolveTransitionHooks:()=>m,setBlockTracking:()=>d,setDevtoolsHook:()=>ce,setTransitionHooks:()=>ct,shallowReactive:()=>Le,shallowReadonly:()=>Gt,shallowRef:()=>_e,ssrContextKey:()=>r,ssrUtils:()=>ot,stop:()=>s,toDisplayString:()=>_t,toHandlerKey:()=>Ot,toHandlers:()=>re,toRaw:()=>Ht,toRef:()=>ye,toRefs:()=>p,toValue:()=>u,transformVNodeArgs:()=>oe,triggerRef:()=>se,unref:()=>P,useAttrs:()=>ue,useCssModule:()=>sn,useCssVars:()=>ln,useHost:()=>tn,useId:()=>g,useModel:()=>S,useSSRContext:()=>te,useShadowRoot:()=>rn,useSlots:()=>he,useTemplateRef:()=>Yt,useTransitionState:()=>a,vModelCheckbox:()=>an,vModelDynamic:()=>un,vModelRadio:()=>On,vModelSelect:()=>Zt,vModelText:()=>mn,vShow:()=>nn,version:()=>Ce,warn:()=>b,watch:()=>A,watchEffect:()=>j,Line truncated
import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Cn as s,Ct as c,D as l,Dn as u,Dt as d,E as f,En as p,Et as m,F as h,Ft as g,G as _,Gt as v,H as y,Ht as b,I as x,It as S,J as C,Jt as w,K as T,Kt as E,L as ee,Lt as te,M as D,Mn as ne,Mt as re,N as ie,Nn as ae,Nt as oe,O,On as se,Ot as ce,P as le,Pt as ue,Q as de,Qn as fe,Qt as pe,R as me,Rt as he,S as ge,Sn as _e,St as k,T as ve,Tn as ye,Tt as be,U as xe,Ut as A,V as Se,Vt as Ce,W as we,Wt as j,X as Te,Xt as Ee,Y as De,Yt as Oe,Z as ke,Zt as Ae,_ as M,_n as je,_t as Me,a as Ne,an as Pe,at as Fe,b as Ie,bn as Le,bt as Re,c as ze,cn as Be,ct as Ve,d as He,dn as Ue,dt as We,en as Ge,er as Ke,et as qe,f as Je,fn as Ye,ft as Xe,g as Ze,gn as Qe,gt as $e,h as et,hn as tt,ht as N,i as nt,in as rt,it,j as at,jt as ot,k as st,kn as P,kt as ct,l as lt,ln as ut,lt as dt,m as ft,mn as pt,mt,n as ht,nn as gt,nr as _t,nt as F,o as vt,on as yt,ot as bt,p as xt,pn as St,pt as Ct,q as wt,qt as Tt,r as Et,rn as Dt,rr as Ot,rt as kt,s as At,sn as jt,st as Mt,tn as Nt,tr as Pt,tt as I,u as Ft,un as It,ut as Lt,v as Rt,vn as zt,vt as Bt,w as Vt,wn as Ht,wt as Ut,x as Wt,xn as L,xt as Gt,y as R,yn as z,yt as Kt,z as qt,zt as Jt}from"./PageHeader.js";import{A as Yt,B as Xt,C as Zt,D as Qt,E as $t,F as en,H as tn,I as nn,L as rn,M as an,N as on,O as sn,P as cn,R as ln,S as un,T as dn,U as fn,V as pn,W as mn,_ as B,a as hn,f as gn,g as _n,h as vn,i as yn,j as bn,k as xn,n as Sn,s as Cn,w as wn,x as Tn,y as En,z as Dn}from"./api.js";import{n as On}from"./pinia.js";import{t as kn}from"./createLucideIcon.js";import{a as An,i as jn,n as Mn,r as Nn,t as Pn}from"./alert.js";var Fn=Object.defineProperty,In=((e,t)=>{let n={};for(var r in e)Fn(n,r,{get:e[r],enumerable:!0});return t||Fn(n,Symbol.toStringTag,{value:`Module`}),n})({BaseTransition:()=>ht,BaseTransitionPropsValidators:()=>Et,Comment:()=>nt,DeprecationTypes:()=>null,EffectScope:()=>t,ErrorCodes:()=>Ne,ErrorTypeStrings:()=>vt,Fragment:()=>At,KeepAlive:()=>ze,ReactiveEffect:()=>Ge,Static:()=>lt,Suspense:()=>Ft,Teleport:()=>He,Text:()=>Je,TrackOpTypes:()=>Nt,Transition:()=>Tn,TransitionGroup:()=>un,TriggerOpTypes:()=>gt,VueElement:()=>Zt,assertNumber:()=>xt,callWithAsyncErrorHandling:()=>ft,callWithErrorHandling:()=>et,camelize:()=>ne,capitalize:()=>ae,cloneVNode:()=>Ze,compatUtils:()=>null,compile:()=>Ln,computed:()=>M,createApp:()=>wn,createBlock:()=>R,createCommentVNode:()=>Ie,createElementBlock:()=>Wt,createElementVNode:()=>Rt,createHydrationRenderer:()=>ge,createPropsRestProxy:()=>o,createRenderer:()=>Vt,createSSRApp:()=>dn,createSlots:()=>ve,createStaticVNode:()=>f,createTextVNode:()=>l,createVNode:()=>O,customRef:()=>Dt,defineAsyncComponent:()=>st,defineComponent:()=>n,defineCustomElement:()=>$t,defineEmits:()=>at,defineExpose:()=>D,defineModel:()=>ie,defineOptions:()=>le,defineProps:()=>h,defineSSRCustomElement:()=>Qt,defineSlots:()=>x,devtools:()=>ee,effect:()=>rt,effectScope:()=>Pe,getCurrentInstance:()=>me,getCurrentScope:()=>yt,getCurrentWatcher:()=>jt,getTransitionRawChildren:()=>qt,guardReactiveProps:()=>i,h:()=>Se,handleError:()=>y,hasInjectionContext:()=>xe,hydrate:()=>sn,hydrateOnIdle:()=>we,hydrateOnInteraction:()=>_,hydrateOnMediaQuery:()=>T,hydrateOnVisible:()=>wt,initCustomFormatter:()=>C,initDirectivesForSSR:()=>xn,inject:()=>De,isMemoSame:()=>Te,isProxy:()=>Be,isReactive:()=>ut,isReadonly:()=>It,isRef:()=>Ue,isRuntimeOnly:()=>ke,isShallow:()=>Ye,isVNode:()=>de,markRaw:()=>St,mergeDefaults:()=>e,mergeModels:()=>qe,mergeProps:()=>I,nextTick:()=>F,nodeOps:()=>Yt,normalizeClass:()=>fe,normalizeProps:()=>Ke,normalizeStyle:()=>Pt,onActivated:()=>kt,onBeforeMount:()=>it,onBeforeUnmount:()=>Fe,onBeforeUpdate:()=>bt,onDeactivated:()=>Mt,onErrorCaptured:()=>Ve,onMounted:()=>dt,onRenderTracked:()=>Lt,onRenderTriggered:()=>We,onScopeDispose:()=>pt,onServerPrefetch:()=>Xe,onUnmounted:()=>Ct,onUpdated:()=>mt,onWatcherCleanup:()=>tt,openBlock:()=>N,patchProp:()=>bn,popScopeId:()=>$e,provide:()=>Me,proxyRefs:()=>Qe,pushScopeId:()=>Bt,queuePostFlushCb:()=>Kt,reactive:()=>je,readonly:()=>zt,ref:()=>z,registerRuntimeCompiler:()=>Re,render:()=>an,renderList:()=>Gt,renderSlot:()=>k,resolveComponent:()=>c,resolveDirective:()=>Ut,resolveDynamicComponent:()=>be,resolveFilter:()=>null,resolveTransitionHooks:()=>m,setBlockTracking:()=>d,setDevtoolsHook:()=>ce,setTransitionHooks:()=>ct,shallowReactive:()=>Le,shallowReadonly:()=>L,shallowRef:()=>_e,ssrContextKey:()=>r,ssrUtils:()=>ot,stop:()=>s,toDisplayString:()=>_t,toHandlerKey:()=>Ot,toHandlers:()=>re,toRaw:()=>Ht,toRef:()=>ye,toRefs:()=>p,toValue:()=>u,transformVNodeArgs:()=>oe,triggerRef:()=>se,unref:()=>P,useAttrs:()=>ue,useCssModule:()=>on,useCssVars:()=>cn,useHost:()=>en,useId:()=>g,useModel:()=>S,useSSRContext:()=>te,useShadowRoot:()=>nn,useSlots:()=>he,useTemplateRef:()=>Jt,useTransitionState:()=>a,vModelCheckbox:()=>rn,vModelDynamic:()=>ln,vModelRadio:()=>Dn,vModelSelect:()=>Xt,vModelText:()=>pn,vShow:()=>tn,version:()=>Ce,warn:()=>b,watch:()=>A,watchEffect:()=>j,waLine truncated
`)].join(`
`))}return()=>i.value||r.value||o.value?Se(t.default({present:o.value})[0],{ref:e=>{let t=H(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),[vi,yi]=Gn(`CollapsibleRoot`),bi=n({__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=Ar(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=p(r);return yi({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),U(),(t,n)=>(N(),L(P(z),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:w(()=>[k(t.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),xi=n({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=vi();i.contentId||=fi(void 0,`reka-collapsible-content`);let a=R(),{forwardRef:o,currentElement:s}=U(),c=R(0),l=R(0),u=M(()=>i.open.value),d=R(u.value),f=R();A(()=>[u.value,a.value?.present],async()=>{await F();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=M(()=>d.value&&i.open.value);return dt(()=>{requestAnimationFrame(()=>{d.value=!1})}),gr(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(t,r)=>(N(),L(P(_i),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:w(({present:r})=>[O(P(z),I(t.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:r?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:w(()=>[!P(i).unmountOnHide.value||r?k(t.$slots,`default`,{},void 0,void 0,0):Ie(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),Si=n({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;U();let n=vi();return(r,i)=>(N(),L(P(z),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:w(()=>[k(r.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Ci({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 wi({type:e,defaultValue:t,modelValue:n}){return e||Ci({type:e,defaultValue:t,modelValue:n})}function Ti({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Ei(e,t){let n=M(()=>wi(e)),r=Ar(e,`modelValue`,t,{defaultValue:Ti(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Wn(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Jn(t,e)){let n=t.findIndex(t=>Wn(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:M(()=>n.value===`single`)}}var[Di,Oi]=Gn(`AccordionRoot`),ki=n({__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}=p(n),s=Jr(i),{modelValue:c,changeModelValue:l,isSingle:u}=Ei(n,r),{forwardRef:d,currentElement:f}=U();return Oi({disabled:a,direction:s,orientation:n.orientation,parentElement:f,isSingle:u,collapsible:n.collapsible,modelValue:c,changeModelValue:l,unmountOnHide:o}),(t,n)=>(N(),L(P(z),{ref:P(d),"as-child":e.asChild,as:e.as},{default:w(()=>[k(t.$sl Line truncated
`))}return()=>i.value||r.value||o.value?Se(t.default({present:o.value})[0],{ref:e=>{let t=U(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),[_i,vi]=Wn(`CollapsibleRoot`),yi=n({__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=kr(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=p(r);return vi({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),W(),(t,n)=>(N(),R(P(B),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:w(()=>[k(t.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),bi=n({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=_i();i.contentId||=di(void 0,`reka-collapsible-content`);let a=z(),{forwardRef:o,currentElement:s}=W(),c=z(0),l=z(0),u=M(()=>i.open.value),d=z(u.value),f=z();A(()=>[u.value,a.value?.present],async()=>{await F();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=M(()=>d.value&&i.open.value);return dt(()=>{requestAnimationFrame(()=>{d.value=!1})}),hr(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(t,r)=>(N(),R(P(gi),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:w(({present:r})=>[O(P(B),I(t.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:r?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:w(()=>[!P(i).unmountOnHide.value||r?k(t.$slots,`default`,{},void 0,void 0,0):Ie(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),xi=n({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;W();let n=_i();return(r,i)=>(N(),R(P(B),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:w(()=>[k(r.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Si({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 Ci({type:e,defaultValue:t,modelValue:n}){return e||Si({type:e,defaultValue:t,modelValue:n})}function wi({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Ti(e,t){let n=M(()=>Ci(e)),r=kr(e,`modelValue`,t,{defaultValue:wi(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Un(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(qn(t,e)){let n=t.findIndex(t=>Un(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:M(()=>n.value===`single`)}}var[Ei,Di]=Wn(`AccordionRoot`),Oi=n({__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}=p(n),s=qr(i),{modelValue:c,changeModelValue:l,isSingle:u}=Ti(n,r),{forwardRef:d,currentElement:f}=W();return Di({disabled:a,direction:s,orientation:n.orientation,parentElement:f,isSingle:u,collapsible:n.collapsible,modelValue:c,changeModelValue:l,unmountOnHide:o}),(t,n)=>(N(),R(P(B),{ref:P(d),"as-child":e.asChild,as:e.as},{default:w(()=>[k(t.$sl Line truncated
+1 -1
View File
@@ -1 +1 @@
.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}.vue-flow{z-index:0;direction:ltr;width:100%;height:100%;position:relative;overflow:hidden}.vue-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.vue-flow__pane{z-index:1}.vue-flow__pane.draggable{cursor:grab}.vue-flow__pane.selection{cursor:pointer}.vue-flow__pane.dragging{cursor:grabbing}.vue-flow__transformationpane{transform-origin:0 0;z-index:2;pointer-events:none}.vue-flow__viewport{z-index:4;overflow:clip}.vue-flow__selection{z-index:6}.vue-flow__edge-labels{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute}.vue-flow__nodesselection-rect:focus,.vue-flow__nodesselection-rect:focus-visible{outline:none}.vue-flow .vue-flow__edges{pointer-events:none;overflow:visible}.vue-flow__edge-path,.vue-flow__connection-path{stroke:#b1b1b7;stroke-width:1px;fill:none}.vue-flow__edge{pointer-events:visibleStroke;cursor:pointer}.vue-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__edge.animated path.vue-flow__edge-interaction{stroke-dasharLine truncated
.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}.vue-flow{z-index:0;direction:ltr;width:100%;height:100%;position:relative;overflow:hidden}.vue-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.vue-flow__pane{z-index:1}.vue-flow__pane.draggable{cursor:grab}.vue-flow__pane.selection{cursor:pointer}.vue-flow__pane.dragging{cursor:grabbing}.vue-flow__transformationpane{transform-origin:0 0;z-index:2;pointer-events:none}.vue-flow__viewport{z-index:4;overflow:clip}.vue-flow__selection{z-index:6}.vue-flow__edge-labels{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute}.vue-flow__nodesselection-rect:focus,.vue-flow__nodesselection-rect:focus-visible{outline:none}.vue-flow .vue-flow__edges{pointer-events:none;overflow:visible}.vue-flow__edge-path,.vue-flow__connection-path{stroke:#b1b1b7;stroke-width:1px;fill:none}.vue-flow__edge{pointer-events:visibleStroke;cursor:pointer}.vue-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__edge.animated path.vue-flow__edge-interaction{stroke-dasharLine truncated
+79 -79
View File
@@ -1,79 +1,79 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AccountPage.js","assets/PageHeader.js","assets/api.js","assets/AuthenticationPage.js","assets/AgentProfilesPage.js","assets/CardAccordion.js","assets/pinia.js","assets/createLucideIcon.js","assets/alert.js","assets/CredentialBindingsPage.js","assets/PlaybooksPage.js","assets/HarnessPage.js","assets/NotFoundPage.js"])))=>i.map(i=>d[i]);
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as ee,_ as E,a as D,at as te,b as ne,c as re,ct as ie,d as O,dt as ae,et as oe,f as se,ft as ce,g as le,h as ue,ht as de,i as fe,it as pe,j as me,k as he,l as ge,lt as _e,m as ve,mt as ye,n as be,nt as xe,o as Se,ot as Ce,p as we,pt as Te,q as Ee,r as De,rt as Oe,s as ke,st as Ae,t as je,tt as Me,u as Ne,ut as Pe,v as Fe,w as Ie,x as Le,y as Re,z as ze}from"./CardAccordion.js";import{$ as Be,A as k,B as Ve,C as He,Ct as Ue,D as A,Dn as We,En as Ge,Ft as Ke,It as qe,Jt as j,Kt as Je,Mt as Ye,O as M,Pt as Xe,Qn as N,R as Ze,Rt as Qe,Sn as $e,St as P,Tn as et,Tt as tt,Ut as F,V as nt,Wt as rt,X as it,Xt as at,Y as ot,Zt as st,_ as I,_n as ct,_t as lt,an as ut,at as dt,b as L,bn as ft,d as pt,dn as mt,er as ht,et as gt,ht as R,it as _t,kn as z,lt as vt,mn as yt,nr as B,nt as bt,on as xt,pn as St,pt as Ct,rn as wt,s as V,t as Tt,tr as Et,tt as H,v as U,vn as Dt,wn as Ot,x as W,xt as G,y as K,yn as q,zt as kt}from"./PageHeader.js";import{B as At,H as jt,U as Mt,V as Nt,W as Pt,_ as Ft,b as It,c as Lt,d as Rt,f as zt,g as J,h as Y,l as Bt,m as Vt,n as X,o as Ht,p as Ut,r as Wt,t as Gt,u as Kt,v as qt,w as Jt,x as Yt}from"./api.js";import{n as Xt,r as Zt,t as Qt}from"./pinia.js";import{t as $t}from"./createLucideIcon.js";import{a as en,i as tn,n as nn,r as rn,t as an}from"./alert.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function on(e,t,n){let r=e.findIndex(e=>de(e,t)),i=e.findIndex(e=>de(e,n));if(r===-1||i===-1)return[];let[a,o]=[r,i].sort((e,t)=>e-t);return e.slice(a,o+1)}function sn(e,t=-1/0,n=1/0){return Math.min(n,Math.max(t,e))}function cn(e,t){let n=e,r=t.toString(),i=r.indexOf(`.`),a=i>=0?r.length-i:0;if(a>0){let e=10**a;n=Math.round(n*e)/e}return n}function ln(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(Number.isNaN(t)?0:t))%r,a=cn(Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i,r);return Number.isNaN(t)?!Number.isNaN(n)&&a>n&&(a=Math.floor(cn(n/r,r))*r):a<t?a=t:!Number.isNaN(n)&&a>n&&(a=t+Math.floor(cn((n-t)/r,r))*r),a=cn(a,r),a}var un=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u,dn=/android/i;function fn(){return typeof navigator<`u`&&dn.test(navigator.userAgent)}function pn(e){let t=q(!1),n=q(!0),r=q(!1),i=I(()=>t.value&&n.value);function a(){t.value=!0,n.value=!0,r.value=!1}function o(e){e.data&&(un.test(e.data)?(n.value=!0,r.value=!0):fn()&&!r.value&&(n.value=!1))}function s(n){bt(()=>{t.value=!1,e?.(n)})}return{isComposing:t,shouldDeferInput:i,handleCompositionStart:a,handleCompositionUpdate:o,handleCompositionEnd:s}}function mn(e){let t=I(()=>z(e)),n=I(()=>new Intl.Collator(`en`,{usage:`search`,...t.value}));return{startsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(0,t.length),t)===0),endsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(-t.length),t)===0),contains:(e,t)=>{if(t.length===0)return!0;if(e=e.normalize(`NFC`),t=t.normalize(`NFC`),t.length>e.length)return!1;let r=n.value.compare;if(e.includes(t))return!0;let i=t.length;for(let n=0;n+i<=e.length;n++)if(r(t,e.slice(n,n+i))===0)return!0;return!1}}}function hn(e){return I(()=>!We(e)||!!ee(e)?.closest(`form`))}function gn(){let e=Ze()?.vnode?.scopeId;return e?{[e]:``}:{}}function _n(e,t){let n=Ae(!1,300);ie(()=>{n.value=!1});let r=q(null),i=xe();function a(){r.value=null,n.value=!1}function o(e,t){if(!t)return;let i=e.currentTarget,a={x:e.clientX,y:e.clientY},o=yn(a,vn(a,i.getBoundingClientRect()),1),s=bn(t.getBoundingClientRect()),c=Sn([...o,...s]);r.value=c,n.value=!0}return rt(n=>{if(e.value&&t.value){let r=e.value,i=t.value,a=e=>o(e,i),s=e=>o(e,r);r.addEventListener(`pointerleave`,a),i.addEventListener(`pointerleave`,s),n(()=>{r.removeEventListener(`pointerleave`,a),i.removeEventListener(`pointerleave`,s)})}}),rt(n=>{if(r.value){let o=n=>{if(!r.value||!(n.target instanceof Element))return;let o=n.target,s={x:n.clientX,y:n.clientY},c=e.value?.contains(o)||t.value?.contains(o),l=!xn(s,r.value),u=!!o.closest(`[data-grace-area-trigger]`);c?a():(l||u)&&(a(),i.trigger())},s=e.value?.ownerDocument;s?.addEventListener(`pointermove`,o),n(()=>s?.removeEventListener(`pointermove`,o))}}),{isPointerInTraLine truncated
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as ee,Z as te,_ as T,a as E,at as ne,b as re,c as ie,ct as ae,d as D,dt as O,et as oe,f as se,ft as ce,g as le,h as ue,i as de,it as fe,j as pe,k as me,l as he,lt as ge,m as _e,n as ve,nt as ye,o as be,ot as xe,p as Se,q as Ce,r as we,rt as Te,s as Ee,st as De,t as Oe,tt as ke,u as Ae,ut as je,v as Me,w as Ne,x as Pe,y as Fe,z as Ie}from"./CardAccordion.js";import{$ as Le,A as k,B as Re,C as ze,Ct as Be,D as A,Dn as Ve,En as He,Ft as Ue,It as We,Jt as j,Kt as Ge,Mt as Ke,O as M,Pt as qe,Qn as N,R as Je,Rt as Ye,Sn as Xe,St as P,Tn as Ze,Tt as Qe,Ut as F,V as $e,Wt as et,X as tt,Xt as nt,Y as rt,Zt as it,_ as I,_n as at,_t as ot,an as st,at as ct,b as L,bn as lt,d as ut,dn as dt,er as ft,et as pt,ht as R,it as mt,kn as z,lt as ht,mn as gt,nr as B,nt as _t,on as vt,pn as yt,pt as bt,rn as xt,s as V,t as St,tr as Ct,tt as H,v as U,vn as wt,wn as Tt,x as W,xt as G,y as K,yn as q,zt as Et}from"./PageHeader.js";import{B as Dt,H as Ot,U as kt,V as At,W as jt,_ as Mt,b as Nt,c as Pt,d as Ft,f as It,g as J,h as Y,l as Lt,m as Rt,n as X,o as zt,p as Bt,r as Vt,t as Ht,u as Ut,v as Wt,w as Gt,x as Kt}from"./api.js";import{n as qt,r as Jt,t as Yt}from"./pinia.js";import{t as Xt}from"./createLucideIcon.js";import{a as Zt,i as Qt,n as $t,r as en,t as tn}from"./alert.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function nn(e,t,n){let r=e.findIndex(e=>ce(e,t)),i=e.findIndex(e=>ce(e,n));if(r===-1||i===-1)return[];let[a,o]=[r,i].sort((e,t)=>e-t);return e.slice(a,o+1)}function rn(e,t=-1/0,n=1/0){return Math.min(n,Math.max(t,e))}function an(e,t){let n=e,r=t.toString(),i=r.indexOf(`.`),a=i>=0?r.length-i:0;if(a>0){let e=10**a;n=Math.round(n*e)/e}return n}function on(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(Number.isNaN(t)?0:t))%r,a=an(Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i,r);return Number.isNaN(t)?!Number.isNaN(n)&&a>n&&(a=Math.floor(an(n/r,r))*r):a<t?a=t:!Number.isNaN(n)&&a>n&&(a=t+Math.floor(an((n-t)/r,r))*r),a=an(a,r),a}var sn=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u,cn=/android/i;function ln(){return typeof navigator<`u`&&cn.test(navigator.userAgent)}function un(e){let t=q(!1),n=q(!0),r=q(!1),i=I(()=>t.value&&n.value);function a(){t.value=!0,n.value=!0,r.value=!1}function o(e){e.data&&(sn.test(e.data)?(n.value=!0,r.value=!0):ln()&&!r.value&&(n.value=!1))}function s(n){_t(()=>{t.value=!1,e?.(n)})}return{isComposing:t,shouldDeferInput:i,handleCompositionStart:a,handleCompositionUpdate:o,handleCompositionEnd:s}}function dn(e){let t=I(()=>z(e)),n=I(()=>new Intl.Collator(`en`,{usage:`search`,...t.value}));return{startsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(0,t.length),t)===0),endsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(-t.length),t)===0),contains:(e,t)=>{if(t.length===0)return!0;if(e=e.normalize(`NFC`),t=t.normalize(`NFC`),t.length>e.length)return!1;let r=n.value.compare;if(e.includes(t))return!0;let i=t.length;for(let n=0;n+i<=e.length;n++)if(r(t,e.slice(n,n+i))===0)return!0;return!1}}}function fn(e){return I(()=>!Ve(e)||!!u(e)?.closest(`form`))}function pn(){let e=Je()?.vnode?.scopeId;return e?{[e]:``}:{}}function mn(t,n){let r=fe(!1,300);ne(()=>{r.value=!1});let i=q(null),a=e();function o(){i.value=null,r.value=!1}function s(e,t){if(!t)return;let n=e.currentTarget,a={x:e.clientX,y:e.clientY},o=gn(a,hn(a,n.getBoundingClientRect()),1),s=_n(t.getBoundingClientRect()),c=yn([...o,...s]);i.value=c,r.value=!0}return et(e=>{if(t.value&&n.value){let r=t.value,i=n.value,a=e=>s(e,i),o=e=>s(e,r);r.addEventListener(`pointerleave`,a),i.addEventListener(`pointerleave`,o),e(()=>{r.removeEventListener(`pointerleave`,a),i.removeEventListener(`pointerleave`,o)})}}),et(e=>{if(i.value){let r=e=>{if(!i.value||!(e.target instanceof Element))return;let r=e.target,s={x:e.clientX,y:e.clientY},c=t.value?.contains(r)||n.value?.contains(r),l=!vn(s,i.value),u=!!r.closest(`[data-grace-area-trigger]`);c?o():(l||u)&&(o(),a.trigger())},s=t.value?.ownerDocument;s?.addEventListener(`pointermove`,r),e(()=>s?.removeEventListener(`pointermove`,r))}}),{isPointerInTransit:r,onPointerExit:a.on}}fuLine 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&&(Vc.value=n.session_id),n.type===`delta`&&(o+=n.text,Kc.value=Kc.value?{...Kc.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Kc.value=Kc.value?{...Kc.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Kc.value=Kc.value?{...Kc.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`);Hc.value=[...Hc.value,{from:`assistant`,text:o,tool_calls:a}],Kc.value=null,Wc.value=`Ready`,await ol()}catch(e){let t=e;t.name===`AbortError`&&!c?(Kc.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Wc.value=`Stopped`):(Kc.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Pc(r):void 0,isRetry:i},Wc.value=`Error. Retry available.`)}finally{clearTimeout(l),Rc=null,il=null,Gc.value=!1}}function vl(){Wc.value=`Stopping…`,Vc.value&&X.chatCancel(Vc.value).catch(()=>{}),al()}function yl(){vt(()=>{ol().catch(e=>{Wc.value=e.message||`Chat unavailable`})}),Ct(()=>{al()})}async function bl(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 _l({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var xl=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],Sl=k({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return J(`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)=>(R(),W(`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":z(Ic),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:N(r(!e.open))},[M(z(Zs),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:N(r(e.open))},[M(z(wc),{size:22})],2)],8,xl))}}),Cl=k({__name:`Select`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},defaultValue:{},modelValue:{},nullableValue:{},by:{type:[String,Function]},dir:{},multiple:{type:Boolean},autocomplete:{},disabled:{type:Boolean},name:{},required:{type:Boolean}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:t}){let n=S(e,t);return(e,t)=>(R(),K(z(Ba),H({"data-slot":`select`},z(n)),{default:j(t=>[P(e.$slots,`default`,ht(Ve(t)))]),_:3},16))}}),wl=k({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean},position:{default:`item-aligned`},bodyLock:{type:Boolean},loop:{type:Boolean},memoDependencies:{},side:{},sideOffset:{},sideFlip:{type:Boolean},align:{default:`center`},alignOffset:{},alignFlip:{type:Boolean},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},hideShiftedArrow:{type:Boolean},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean},prioritizePosition:{type:Boolean},reference:{},dir:{},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=zt(n,`class`),a=S(i,r);return(t,r)=>(R(),K(z(so),null,{default:j(()=>[M(z(Qa),H({"data-slot":`select-content`,"data-align-trigger":e.position===`item-aligned`},{...t.$attrs,...z(a)},{class:z(J)(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 cn-menu-translucent relative z-50 max-h-(--reka-select-content-available-height) origin-(--reka-select-content-transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none`,e.position===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,n.class)}),{default:j(()=>[M(z(kl)),M(z(mo),{"data-position":e.position,class:N(z(J)(`data-[position=popper]:h-(--reka-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--reka-select-trigger-width)`))},{default:j(()=>[P(t.$slots,`default`)]),_:3 Line truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:xd(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>xd(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=Cd(c),u=e+1<n.length?Cd(n[e+1]):null;if(l&&u&&wd(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=Cd(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>xd(e)),rows:r.map(e=>e.map(e=>xd(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:xd(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])}else c.startsWith(`>`)?(o(),s(),t.push({kind:`blockquote`,inline:xd(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function Cd(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 wd(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Td={class:`[overflow-wrap:anywhere]`},Ed={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Dd={class:`font-mono text-[0.85em]`},Od={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},kd={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Ad={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},jd={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Md={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Nd={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Pd={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Fd={key:8,class:`mb-2.5 last:mb-0`},Id=k({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=I(()=>Sd(t.text));return(e,t)=>(R(),W(`div`,Td,[(R(!0),W(V,null,G(n.value,(e,t)=>(R(),W(V,{key:t},[e.kind===`pre`?(R(),W(`pre`,Ed,[U(`code`,Dd,B(e.code),1)])):e.kind===`table`?(R(),W(`table`,Od,[U(`thead`,null,[U(`tr`,null,[(R(!0),W(V,null,G(e.head,(e,t)=>(R(),W(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[M(yd,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(R(!0),W(V,null,G(e.rows,(e,t)=>(R(),W(`tr`,{key:t},[(R(!0),W(V,null,G(e,(e,t)=>(R(),W(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[M(yd,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(R(),W(`blockquote`,kd,[M(yd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(R(),W(`h1`,Ad,[M(yd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(R(),W(`h2`,jd,[M(yd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(R(),W(`h3`,Md,[M(yd,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(R(),W(`ul`,Nd,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(yd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(R(),W(`ol`,Pd,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(yd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(R(),W(`p`,Fd,[M(yd,{inline:e.inline},null,8,[`inline`])])):L(``,!0)],64))),128))]))}}),Ld={class:`truncate`},Rd=k({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Ue(`RouterLink`);return R(),K(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-md 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(()=>[M(z(ws),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,Ld,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),zd={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Bd={class:`font-semibold text-foreground`},Vd={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Hd=k({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=I(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=I(()=>t.tool.parameters||t.tool.Parameters||``),i=I(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=I(()=>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?(R(),K(Rd,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(R(),W(`div`,zd,[M(z(Cc),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,Bd,B(n.value),1),r.value?(R(),W(`code`,Vd,B(r.value),1)):L(``,!0),U(`span`,{class:N(z(J)(`text-fg-muted`,i.value&&`text-danger`))},B(a.value),3)]))}}),Ud={key:0,class:`mb-2 grid gap-0.5 text-xs`},Wd={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Gd={key:3,class:`whitespace-pre-wrap`},Kd=k({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(R(),W(`div`,{class:N([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:N(z(J)(`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?(R(),W(`div`,Ud,[(R(!0),W(V,null,G(e.tools,(t,n)=>(R(),K(Hd,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):L(``,!0),e.media.length?(R(),W(`div`,Wd,[(R(!0),W(V,null,G(e.media,(e,t)=>(R(),K(fd,{key:t,attachment:e},null,8,[`attachment`]))),128))])):L(``,!0),e.assistant?(R(),K(Id,{key:2,text:e.text},null,8,[`text`])):(R(),W(`div`,Gd,B(e.text),1)),P(t.$slots,`default`)],2)],2))}}),qd={class:`text-sm`},Jd={key:0,class:`mt-1 text-fg-muted`},Yd={key:1,class:`mt-2 flex flex-wrap gap-2`},Xd=k({__name:`ChatChooseCard`,props:{choose:{}} Line truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>n_?`${r.slice(0,n_).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function i_(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function a_(e){let t=Number(e);if(!Number.isFinite(t)||t<0)return``;if(t<1e3)return`under 1 s`;let n=t/1e3;if(n<60)return`${n.toFixed(+(n<10))} s`;let r=Math.round(n),i=Math.floor(r/60),a=r%60;if(i<60)return a===0?`${i} min`:`${i} min ${a} s`;let o=Math.floor(i/60),s=i-o*60;return s===0?`${o} h`:`${o} h ${s} min`}function o_(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function s_(e){return typeof e==`string`?e:``}function c_(e={}){let t=e.data||{},n=e.stage||`unknown stage`,r=e.workflow?`${e.workflow} workflow`:``;if(e.kind===`stage_start`)return{title:`Started stage: ${n}`,detail:r};if(e.kind===`stage_finish`){let e=a_(t.duration_ms),i=[r,e&&`ran for ${e}`].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[i,s_(t.error),s_(t.when)].filter(Boolean).join(` · `)}}if(e.kind===`task_retried`){let n=Number(t.retry_count);return{title:Number.isFinite(n)&&n>0?`Retry ${n}`:`Retry requested`,detail:[s_(t.previous_stage)&&`after ${s_(t.previous_stage)}`,s_(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=o_(t.iterations),i=o_(t.tokens),a=Number(t.cached_tokens)||0,o=o_((Number(t.prompt_tokens)||0)-a),s=o_(t.completion_tokens),c=o_(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,s_(t.model)].filter(Boolean);return{title:`Agent ${s_(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=s_(t.author);return{title:`Remediation ${s_(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${s_(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=s_(t.pr_number);return{title:`Pull request approved`,detail:[s_(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${s_(t.attempt)} of ${s_(t.of)} failed: ${e.stage||`step`}`,detail:s_(t.error),tone:`warn`};if(e.kind===`config_captured`)return{title:`Configuration captured`,detail:`The effective task-runtime configuration for this run.`};if(e.kind===`binding_started`){let e=s_(t.source),n=s_(t.capture_id),r=[{label:`binding ${s_(t.binding_name)||s_(t.binding_id)}`,to:`/events?tab=bindings`},...n?[{label:`captured event`,to:`/events?tab=inspector&capture=${encodeURIComponent(n)}`}]:[]];return t.unsigned===!0?{title:`Started by an unsigned event`,detail:e?`source ${e}`:``,tone:`warn`,links:r}:{title:`Started by an event`,detail:e?`source ${e}`:``,links:r}}if(e.kind===`changes_captured`){let e=t.totals??{},n=Number(e.files);return{title:`Change capture recorded`,detail:[Number.isFinite(n)&&n>0?`${n} file${n===1?``:`s`} changed`:``,t.captured_after?`captured after ${s_(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:i_(e.kind||e.type),detail:e.detail||``}}var l_=[`title`],u_=k({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=t_();n.watchIdentities();let r=e,i=t,a=Wg(),o=I(()=>a.taskIDFor(r.event)),s=I(()=>r_(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}let l=I(()=>r.event.at?Cg(r.event.at):`—`);return(e,t)=>(R(),K(z(Zg),{class:N(o.value>0?`cursor-pointer`:``),role:o.value>0?`link`:void 0,tabindex:o.value>0?0:void 0,title:o.value>0?`Open task details`:void 0,onClick:c,onKeydown:[Mt(Pt(c,[`prevent`]),[`enter`]),Mt(Pt(c,[`prevent`]),[`space`])]},{default:j(()=>[M(z(Q),{class:`font-medium`},{default:j(()=>[A(B(z(c_)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),M(z(Q),{class:`font-mono`},{default:j(()=>[A(B(o.value>0?`#${o.value}`:`—`),1)]),_:1}),M(z(Q),{class:`w-[55%] max-w-0`},{default:j(()=>[U(`span`,{class:`block truncate`,title:s.value.truncated?s.value.full:void 0},B(s.value.text),9,l_)]),_:1}),M(z(Q),null,{default:j(()=>[A(B(l.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),d_=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function f_(e){return(Number(e?.task_id)||0)>0}function p_(e,t){return t===`tasks`?f_(e):t!==`system`||!f_(e)}function m_(e,t){return e.filter(e=>p_(e,t))}function h_(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function g_(e,t){return`${e}:${t??0}`}function __(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=g_(r_(n).text,r),a=t[t.length-1];a&&a.key===i?(a.count+=1,a.events.push(n)):t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var v_={key:0,class:`font-normal text-fg-subtle`},y_={role:`region`,"aria-label":`Activity`,"ari Line truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}var Iv=k({__name:`Collapsible`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},disabled:{type:Boolean},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{}},emits:[`update:open`],setup(e,{emit:t}){let n=S(e,t);return(e,t)=>(R(),K(z(f),H({"data-slot":`collapsible`},z(n)),{default:j(t=>[P(e.$slots,`default`,ht(Ve(t)))]),_:3},16))}}),Lv=k({__name:`CollapsibleContent`,props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(R(),K(z(l),H({"data-slot":`collapsible-content`},t),{default:j(()=>[P(e.$slots,`default`)]),_:3},16))}}),Rv=k({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(R(),K(z(o),H({"data-slot":`collapsible-trigger`},t),{default:j(()=>[P(e.$slots,`default`)]),_:3},16))}});function zv(e){return(e?.merged||0)+(e?.completed||0)}function Bv(e){return Object.entries(e?.inputs??{}).map(([e,t])=>({name:e,type:t.type,required:t.required===!0})).sort((e,t)=>e.name.localeCompare(t.name))}function Vv(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function Hv(e,t){switch(t){case`number`:{let t=e.trim();return t!==``&&!Number.isNaN(Number(t))?Number(t):e}case`bool`:return e===`true`||e!==`false`&&e;case`string`:return e;default:try{return JSON.parse(e)}catch{return e}}}function Uv(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=Hv(e,r.type))}return n}var Wv=[`onKeydown`],Gv={key:0,class:`text-sm text-danger`,role:`alert`},Kv={key:1,class:`grid gap-1.5`},qv=[`for`],Jv={key:0,class:`font-normal text-fg-subtle`},Yv=[`id`],Xv=[`value`],Zv={key:0,class:`text-xs text-fg-subtle`},Qv={key:2,class:`grid gap-1.5`},$v=[`id`],ey={class:`block truncate font-mono text-[13px] font-medium`},ty={class:`block text-xs text-fg-subtle`},ny={key:0,class:`text-xs text-fg-subtle`},ry={key:3,class:`grid gap-3`},iy=[`for`],ay={class:`font-mono`},oy={key:0,class:`text-fg-subtle`},sy={class:`text-xs text-fg-subtle`},cy={class:`grid gap-1.5`},ly=[`for`],uy={class:`grid gap-1.5`},dy=[`for`],fy={class:`font-mono`},py={key:4,class:`text-sm text-danger`,role:`alert`},my={class:`flex items-center gap-2 border-t border-border pt-4`},hy={class:`mr-auto text-xs text-fg-subtle`},gy=k({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=Ke(),a=q([]),o=q([]),s=q([]),c=q(``);vt(async()=>{try{let[e,t]=await Promise.all([X.workflows(),X.tasks()]);a.value=(e?.definitions??[]).filter(e=>e.enabled),o.value=e?.workflows??[],s.value=[...new Set((t??[]).filter(e=>e.owner&&e.repo).map(e=>`${e.owner}/${e.repo}`))].slice(0,5)}catch(e){c.value=String(e.message||e)}});let l=t_();l.watchIdentities();let u=I(()=>l.identities.filter(e=>e.kind!==`system`&&e.lifecycle===`active`)),d=q(``),f=q(n.workflow??n.initialWorkflow??``),p=q(n.initialInstructions??``),m=q(Fv(p.value)),h=q(``),g=q({});rt(()=>{!f.value&&a.value[0]&&(f.value=a.value[0].id),!h.value&&u.value[0]&&(h.value=u.value[0].id)});let _=I(()=>a.value.find(e=>e.id===f.value)),v=I(()=>Bv(_.value)),y=I(()=>Vv(v.value,g.value)),b=I(()=>_.value?.repository??`required`),x=I(()=>b.value!==`optional`&&b.value!==`none`),S=e=>o.value.find(t=>t.workflow===e),C=I(()=>u.value.find(e=>e.id===h.value)?.display_name??`nobody`),w=q(!1),T=q(``),ee=I(()=>!!((d.value.trim()||!x.value)&&f.value&&m.value.trim()&&p.value.trim()&&h.value)&&y.value.length===0);async function E(){if(ee.value&&!w.value){w.value=!0,T.value=``;try{let e=await X.workRequest({identity:h.value,repository:b.value===`none`?``:d.value.trim(),workflow:f.value,title:m.value.trim(),instructions:p.value,inputs:Uv(v.value,g.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){T.value=String(e.message||e)}finally{w.value=!1}}}return(e,t)=>(R(),W(`form`,{class:`grid gap-5`,onSubmit:Pt(E,[`prevent`]),onKeydown:[Mt(Pt(E,[`meta`,`prevent`]),[`enter`]),Mt(Pt(E,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(R(),W(`p`,Gv,B(c.value),1)):L(``,!0),b.value===`none`?L(``,!0):(R(),W(`div`,Kv,[U(`label`,{for:`${z(i)}-repo`,class:`text-[13px] font-medium`},[t[6]||=A(`Repository`,-1),x.value?L(``,!0):(R(),W(`span`,Jv,` (optional)`))],8,qv),M(z(Z),{id:`${z(i)}-repo`,modelValue:d.value,"onUpdate:modelValue":t[0]||=e=>d.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${z(i)}-repos`,required:x.value},null,8,[`id`,`modelValue`,`list`,`required`]),U(`datalist`,{id:`${z(i)}-repos`},[(R(!0),W(V,null,G(s.value,e=>(R(),W(`option`,{key:e,value:e},null,8,Xv))),128))],8,Yv),s.value.length?(R(),W(`p`,Zv,[t[7]||=A(`Recent: `,-1),(R(!0),W(V,null,G(s.value,e=>(R(),K(z(Y),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>d.value=e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]))),128))])):L(``,!0)])),n.workflow?L(``,!0):(R(),W(`div`,Qv,[U(`span`,{id:`${z(i)}-wf`,class:`text-[13px] font-medium`},`Workflow`,8,$v),M(z( 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 Py(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 Fy(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 Iy(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 Ly(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 Ry=q([]),zy=q([]),By=q(!0),Vy=q(null),Hy=q(null),Uy=q(!1),Wy=q(null);async function Gy(){try{let e=await X.eventTypes(My().workspace);By.value=e.enabled!==!1,Ry.value=e.event_types||[],zy.value=e.proposals||[],Vy.value=null}catch(e){Vy.value=e.message||String(e)}}function Ky(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function qy(e){Wy.value=null,Hy.value=e}function Jy(e){let t=nb.value.find(t=>String(t.id)===e.sample_id);qy({mode:`proposal`,id:null,source:e.source,name:``,rule:Ky(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Yy(e=``){qy({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function Xy(e){qy({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:Ky(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Zy(){Hy.value=null}async function Qy(){let e=Hy.value;if(e){Uy.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:Ly(e.rule)});else{let t=e.mode===`paste`?Ny(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:Ly(e.rule),example:{headers:t,body:e.body}})}Hy.value=null,await Gy()}catch(e){Wy.value=e.message||String(e)}finally{Uy.value=!1}}}var $y=q(null);async function eb(){let e=$y.value;if($y.value=null,e)try{await X.eventTypeDelete(e.id),await Gy()}catch(e){Vy.value=e.message||String(e)}}var tb=100,nb=q([]),rb=q(!0),ib=q(null),ab=q(!0),ob=q(null);async function sb(){try{let e=await X.captures(tb);rb.value=e.enabled!==!1,nb.value=e.captures||[],ib.value=null}catch(e){ib.value=e.message||String(e)}finally{ab.value=!1}}function cb(e){let t=nb.value.find(t=>t.id===e);return t&&(ob.value=t),!!t}function lb(){nb.value.length&&(ob.value=nb.value[0])}function ub(){Re(`captures`,()=>{sb(),Gy()})}var db=k({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=zt(n,`class`),a=S(i,r);return(e,t)=>(R(),K(z(xo),H({"data-slot":`tabs`,"data-orientation":z(a).orientation||`horizontal`},z(a),{class:z(J)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:j(t=>[P(e.$slots,`default`,ht(Ve(t)))]),_:3},16,[`data-orientation`,`class`]))}}),fb=k({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=zt(t,`class`);return(e,r)=>(R(),K(z(wo),H({"data-slot":`tabs-content`,class:z(J)(`text-sm flex-1 outline-none`,t.class)},z(n)),{default:j(()=>[P(e.$slots,`default`)]),_:3},16,[`class`]))}}),pb=k({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=zt(t,`class`,`variant`);return(r,i)=>(R(),K(z(To),H({"data-slot":`tabs-list`,"data-variant":e.variant},z(n),{class:z(J)(z(hb)({variant:e.variant}),t.class)}),{default:j(()=>[P(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),mb=k({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=zt(t,`class`),r=c(n);return(e,n)=>(R(),K(z(Eo),H({"data-slot":`tabs-trigger`,class:z(J)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-Line truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Rc.value=n.session_id),n.type===`delta`&&(o+=n.text,Uc.value=Uc.value?{...Uc.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Uc.value=Uc.value?{...Uc.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Uc.value=Uc.value?{...Uc.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`);zc.value=[...zc.value,{from:`assistant`,text:o,tool_calls:a}],Uc.value=null,Vc.value=`Ready`,await rl()}catch(e){let t=e;t.name===`AbortError`&&!c?(Uc.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Vc.value=`Stopped`):(Uc.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?jc(r):void 0,isRetry:i},Vc.value=`Error. Retry available.`)}finally{clearTimeout(l),Fc=null,tl=null,Hc.value=!1}}function hl(){Vc.value=`Stopping…`,Rc.value&&X.chatCancel(Rc.value).catch(()=>{}),nl()}function gl(){ht(()=>{rl().catch(e=>{Vc.value=e.message||`Chat unavailable`})}),bt(()=>{nl()})}async function _l(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 ml({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var vl=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],yl=k({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return J(`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)=>(R(),W(`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":z(Nc),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:N(r(!e.open))},[M(z(Js),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:N(r(e.open))},[M(z(xc),{size:22})],2)],8,vl))}}),bl=k({__name:`Select`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},defaultValue:{},modelValue:{},nullableValue:{},by:{type:[String,Function]},dir:{},multiple:{type:Boolean},autocomplete:{},disabled:{type:Boolean},name:{},required:{type:Boolean}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:t}){let n=v(e,t);return(e,t)=>(R(),K(z(La),H({"data-slot":`select`},z(n)),{default:j(t=>[P(e.$slots,`default`,ft(Re(t)))]),_:3},16))}}),xl=k({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean},position:{default:`item-aligned`},bodyLock:{type:Boolean},loop:{type:Boolean},memoDependencies:{},side:{},sideOffset:{},sideFlip:{type:Boolean},align:{default:`center`},alignOffset:{},alignFlip:{type:Boolean},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},hideShiftedArrow:{type:Boolean},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean},prioritizePosition:{type:Boolean},reference:{},dir:{},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=It(n,`class`),a=v(i,r);return(t,r)=>(R(),K(z(io),null,{default:j(()=>[M(z(Ya),H({"data-slot":`select-content`,"data-align-trigger":e.position===`item-aligned`},{...t.$attrs,...z(a)},{class:z(J)(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 cn-menu-translucent relative z-50 max-h-(--reka-select-content-available-height) origin-(--reka-select-content-transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none`,e.position===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,n.class)}),{default:j(()=>[M(z(El)),M(z(uo),{"data-position":e.position,class:N(z(J)(`data-[position=popper]:h-(--reka-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--reka-select-trigger-width)`))},{default:j(()=>[P(t.$slots,`default`)]),_:3 Line truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:yd(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>yd(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=xd(c),u=e+1<n.length?xd(n[e+1]):null;if(l&&u&&Sd(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=xd(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>yd(e)),rows:r.map(e=>e.map(e=>yd(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:yd(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])}else c.startsWith(`>`)?(o(),s(),t.push({kind:`blockquote`,inline:yd(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function xd(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 Sd(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Cd={class:`[overflow-wrap:anywhere]`},wd={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Td={class:`font-mono text-[0.85em]`},Ed={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Dd={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Od={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},kd={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Ad={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},jd={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Md={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Nd={key:8,class:`mb-2.5 last:mb-0`},Pd=k({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=I(()=>bd(t.text));return(e,t)=>(R(),W(`div`,Cd,[(R(!0),W(V,null,G(n.value,(e,t)=>(R(),W(V,{key:t},[e.kind===`pre`?(R(),W(`pre`,wd,[U(`code`,Td,B(e.code),1)])):e.kind===`table`?(R(),W(`table`,Ed,[U(`thead`,null,[U(`tr`,null,[(R(!0),W(V,null,G(e.head,(e,t)=>(R(),W(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[M(_d,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(R(!0),W(V,null,G(e.rows,(e,t)=>(R(),W(`tr`,{key:t},[(R(!0),W(V,null,G(e,(e,t)=>(R(),W(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[M(_d,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(R(),W(`blockquote`,Dd,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(R(),W(`h1`,Od,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(R(),W(`h2`,kd,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(R(),W(`h3`,Ad,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(R(),W(`ul`,jd,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(_d,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(R(),W(`ol`,Md,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(_d,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(R(),W(`p`,Nd,[M(_d,{inline:e.inline},null,8,[`inline`])])):L(``,!0)],64))),128))]))}}),Fd={class:`truncate`},Id=k({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Be(`RouterLink`);return R(),K(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-md 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(()=>[M(z(xs),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,Fd,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Ld={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Rd={class:`font-semibold text-foreground`},zd={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Bd=k({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=I(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=I(()=>t.tool.parameters||t.tool.Parameters||``),i=I(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=I(()=>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?(R(),K(Id,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(R(),W(`div`,Ld,[M(z(bc),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,Rd,B(n.value),1),r.value?(R(),W(`code`,zd,B(r.value),1)):L(``,!0),U(`span`,{class:N(z(J)(`text-fg-muted`,i.value&&`text-danger`))},B(a.value),3)]))}}),Vd={key:0,class:`mb-2 grid gap-0.5 text-xs`},Hd={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Ud={key:3,class:`whitespace-pre-wrap`},Wd=k({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(R(),W(`div`,{class:N([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:N(z(J)(`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?(R(),W(`div`,Vd,[(R(!0),W(V,null,G(e.tools,(t,n)=>(R(),K(Bd,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):L(``,!0),e.media.length?(R(),W(`div`,Hd,[(R(!0),W(V,null,G(e.media,(e,t)=>(R(),K(ud,{key:t,attachment:e},null,8,[`attachment`]))),128))])):L(``,!0),e.assistant?(R(),K(Pd,{key:2,text:e.text},null,8,[`text`])):(R(),W(`div`,Ud,B(e.text),1)),P(t.$slots,`default`)],2)],2))}}),Gd={class:`text-sm`},Kd={key:0,class:`mt-1 text-fg-muted`},qd={key:1,class:`mt-2 flex flex-wrap gap-2`},Jd=k({__name:`ChatChooseCard`,props:{choose:{}} Line truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>e_?`${r.slice(0,e_).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function n_(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function r_(e){let t=Number(e);if(!Number.isFinite(t)||t<0)return``;if(t<1e3)return`under 1 s`;let n=t/1e3;if(n<60)return`${n.toFixed(+(n<10))} s`;let r=Math.round(n),i=Math.floor(r/60),a=r%60;if(i<60)return a===0?`${i} min`:`${i} min ${a} s`;let o=Math.floor(i/60),s=i-o*60;return s===0?`${o} h`:`${o} h ${s} min`}function i_(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function a_(e){return typeof e==`string`?e:``}function o_(e={}){let t=e.data||{},n=e.stage||`unknown stage`,r=e.workflow?`${e.workflow} workflow`:``;if(e.kind===`stage_start`)return{title:`Started stage: ${n}`,detail:r};if(e.kind===`stage_finish`){let e=r_(t.duration_ms),i=[r,e&&`ran for ${e}`].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[i,a_(t.error),a_(t.when)].filter(Boolean).join(` · `)}}if(e.kind===`task_retried`){let n=Number(t.retry_count);return{title:Number.isFinite(n)&&n>0?`Retry ${n}`:`Retry requested`,detail:[a_(t.previous_stage)&&`after ${a_(t.previous_stage)}`,a_(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=i_(t.iterations),i=i_(t.tokens),a=Number(t.cached_tokens)||0,o=i_((Number(t.prompt_tokens)||0)-a),s=i_(t.completion_tokens),c=i_(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,a_(t.model)].filter(Boolean);return{title:`Agent ${a_(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=a_(t.author);return{title:`Remediation ${a_(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${a_(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=a_(t.pr_number);return{title:`Pull request approved`,detail:[a_(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${a_(t.attempt)} of ${a_(t.of)} failed: ${e.stage||`step`}`,detail:a_(t.error),tone:`warn`};if(e.kind===`config_captured`)return{title:`Configuration captured`,detail:`The effective task-runtime configuration for this run.`};if(e.kind===`binding_started`){let e=a_(t.source),n=a_(t.capture_id),r=[{label:`binding ${a_(t.binding_name)||a_(t.binding_id)}`,to:`/events?tab=bindings`},...n?[{label:`captured event`,to:`/events?tab=inspector&capture=${encodeURIComponent(n)}`}]:[]];return t.unsigned===!0?{title:`Started by an unsigned event`,detail:e?`source ${e}`:``,tone:`warn`,links:r}:{title:`Started by an event`,detail:e?`source ${e}`:``,links:r}}if(e.kind===`changes_captured`){let e=t.totals??{},n=Number(e.files);return{title:`Change capture recorded`,detail:[Number.isFinite(n)&&n>0?`${n} file${n===1?``:`s`} changed`:``,t.captured_after?`captured after ${a_(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:n_(e.kind||e.type),detail:e.detail||``}}var s_=[`title`],c_=k({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=$g();n.watchIdentities();let r=e,i=t,a=Hg(),o=I(()=>a.taskIDFor(r.event)),s=I(()=>t_(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}let l=I(()=>r.event.at?xg(r.event.at):`—`);return(e,t)=>(R(),K(z(Yg),{class:N(o.value>0?`cursor-pointer`:``),role:o.value>0?`link`:void 0,tabindex:o.value>0?0:void 0,title:o.value>0?`Open task details`:void 0,onClick:c,onKeydown:[kt(jt(c,[`prevent`]),[`enter`]),kt(jt(c,[`prevent`]),[`space`])]},{default:j(()=>[M(z(Q),{class:`font-medium`},{default:j(()=>[A(B(z(o_)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),M(z(Q),{class:`font-mono`},{default:j(()=>[A(B(o.value>0?`#${o.value}`:`—`),1)]),_:1}),M(z(Q),{class:`w-[55%] max-w-0`},{default:j(()=>[U(`span`,{class:`block truncate`,title:s.value.truncated?s.value.full:void 0},B(s.value.text),9,s_)]),_:1}),M(z(Q),null,{default:j(()=>[A(B(l.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),l_=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function u_(e){return(Number(e?.task_id)||0)>0}function d_(e,t){return t===`tasks`?u_(e):t!==`system`||!u_(e)}function f_(e,t){return e.filter(e=>d_(e,t))}function p_(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function m_(e,t){return`${e}:${t??0}`}function h_(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=m_(t_(n).text,r),a=t[t.length-1];a&&a.key===i?(a.count+=1,a.events.push(n)):t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var g_={key:0,class:`font-normal text-fg-subtle`},__={role:`region`,"aria-label":`Activity`,"ari Line truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}function Pv(e){return(e?.merged||0)+(e?.completed||0)}function Fv(e){return Object.entries(e?.inputs??{}).map(([e,t])=>({name:e,type:t.type,required:t.required===!0})).sort((e,t)=>e.name.localeCompare(t.name))}function Iv(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function Lv(e,t){switch(t){case`number`:{let t=e.trim();return t!==``&&!Number.isNaN(Number(t))?Number(t):e}case`bool`:return e===`true`||e!==`false`&&e;case`string`:return e;default:try{return JSON.parse(e)}catch{return e}}}function Rv(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=Lv(e,r.type))}return n}var zv=[`onKeydown`],Bv={key:0,class:`text-sm text-danger`,role:`alert`},Vv={key:1,class:`grid gap-1.5`},Hv=[`for`],Uv={key:0,class:`font-normal text-fg-subtle`},Wv=[`id`],Gv=[`value`],Kv={key:0,class:`text-xs text-fg-subtle`},qv={key:2,class:`grid gap-1.5`},Jv=[`id`],Yv={class:`block truncate font-mono text-[13px] font-medium`},Xv={class:`block text-xs text-fg-subtle`},Zv={key:0,class:`text-xs text-fg-subtle`},Qv={key:3,class:`grid gap-3`},$v=[`for`],ey={class:`font-mono`},ty={key:0,class:`text-fg-subtle`},ny={class:`text-xs text-fg-subtle`},ry={class:`grid gap-1.5`},iy=[`for`],ay={class:`grid gap-1.5`},oy=[`for`],sy={key:4,class:`text-sm text-danger`,role:`alert`},cy={class:`flex items-center gap-2 border-t border-border pt-4`},ly={class:`mr-auto text-xs text-fg-subtle`},uy=k({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=Ue(),a=q([]),o=q([]),s=q([]),c=q(``);ht(async()=>{try{let[e,t]=await Promise.all([X.workflows(),X.tasks()]);a.value=(e?.definitions??[]).filter(e=>e.enabled),o.value=e?.workflows??[],s.value=[...new Set((t??[]).filter(e=>e.owner&&e.repo).map(e=>`${e.owner}/${e.repo}`))].slice(0,5)}catch(e){c.value=String(e.message||e)}});let l=q(``),u=q(n.workflow??n.initialWorkflow??``),d=q(n.initialInstructions??``),f=q(Nv(d.value)),p=q({});et(()=>{!u.value&&a.value[0]&&(u.value=a.value[0].id)});let m=I(()=>a.value.find(e=>e.id===u.value)),h=I(()=>Fv(m.value)),g=I(()=>Iv(h.value,p.value)),_=I(()=>m.value?.repository??`required`),v=I(()=>_.value!==`optional`&&_.value!==`none`),y=e=>o.value.find(t=>t.workflow===e),b=q(!1),x=q(``),S=I(()=>!!((l.value.trim()||!v.value)&&u.value&&f.value.trim()&&d.value.trim())&&g.value.length===0);async function C(){if(S.value&&!b.value){b.value=!0,x.value=``;try{let e=await X.workRequest({repository:_.value===`none`?``:l.value.trim(),workflow:u.value,title:f.value.trim(),instructions:d.value,inputs:Rv(h.value,p.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){x.value=String(e.message||e)}finally{b.value=!1}}}return(e,t)=>(R(),W(`form`,{class:`grid gap-5`,onSubmit:jt(C,[`prevent`]),onKeydown:[kt(jt(C,[`meta`,`prevent`]),[`enter`]),kt(jt(C,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(R(),W(`p`,Bv,B(c.value),1)):L(``,!0),_.value===`none`?L(``,!0):(R(),W(`div`,Vv,[U(`label`,{for:`${z(i)}-repo`,class:`text-[13px] font-medium`},[t[5]||=A(`Repository`,-1),v.value?L(``,!0):(R(),W(`span`,Uv,` (optional)`))],8,Hv),M(z(Z),{id:`${z(i)}-repo`,modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${z(i)}-repos`,required:v.value},null,8,[`id`,`modelValue`,`list`,`required`]),U(`datalist`,{id:`${z(i)}-repos`},[(R(!0),W(V,null,G(s.value,e=>(R(),W(`option`,{key:e,value:e},null,8,Gv))),128))],8,Wv),s.value.length?(R(),W(`p`,Kv,[t[6]||=A(`Recent: `,-1),(R(!0),W(V,null,G(s.value,e=>(R(),K(z(Y),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>l.value=e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]))),128))])):L(``,!0)])),n.workflow?L(``,!0):(R(),W(`div`,qv,[U(`span`,{id:`${z(i)}-wf`,class:`text-[13px] font-medium`},`Workflow`,8,Jv),M(z(Ea),{modelValue:u.value,"onUpdate:modelValue":t[1]||=e=>u.value=e,"aria-labelledby":`${z(i)}-wf`,class:`grid grid-cols-1 gap-2 sm:grid-cols-3`,loop:``},{default:j(()=>[(R(!0),W(V,null,G(a.value,e=>(R(),K(z(Oa),{key:e.id,value:e.id,class:`rounded-md border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-secondary focus-visible:outline-2 focus-visible:outline-ring data-[state=checked]:border-primary data-[state=checked]:bg-secondary`},{default:j(()=>[U(`span`,Yv,B(e.name||e.id),1),U(`span`,Xv,[A(B(y(e.id)?.runs||0)+` runs`,1),y(e.id)?.runs?(R(),W(V,{key:0},[A(` · `+B(Math.round(z(Pv)(y(e.id))/(y(e.id)?.runs||1)*100))+`% delivered`,1)],64)):L(``,!0)])]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`,`aria-labelledby`]),!a.value.length&&!c.value?(R(),W(`p`,Zv,`No enabled workflows.`)):L(``,!0)])),h.value.length?(R(),W(`div`,Qv,[(R(!0),W(V,null,G(h.value,e=>(R(),W(`div`,{key:e.name,class:`grid gap-1.5`},[U(`label`,{for:`${z(i)}-input-${e.name}`,class:`text-[13px] font-medium`},[U(`span`,ey,B(e.name),1),e.required?(R(),W( 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 Oy(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 ky(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 Ay(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 jy(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 My=q([]),Ny=q([]),Py=q(!0),Fy=q(null),Iy=q(null),Ly=q(!1),Ry=q(null);async function zy(){try{let e=await X.eventTypes(Ey().workspace);Py.value=e.enabled!==!1,My.value=e.event_types||[],Ny.value=e.proposals||[],Fy.value=null}catch(e){Fy.value=e.message||String(e)}}function By(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function Vy(e){Ry.value=null,Iy.value=e}function Hy(e){let t=Xy.value.find(t=>String(t.id)===e.sample_id);Vy({mode:`proposal`,id:null,source:e.source,name:``,rule:By(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Uy(e=``){Vy({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function Wy(e){Vy({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:By(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Gy(){Iy.value=null}async function Ky(){let e=Iy.value;if(e){Ly.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:jy(e.rule)});else{let t=e.mode===`paste`?Dy(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:jy(e.rule),example:{headers:t,body:e.body}})}Iy.value=null,await zy()}catch(e){Ry.value=e.message||String(e)}finally{Ly.value=!1}}}var qy=q(null);async function Jy(){let e=qy.value;if(qy.value=null,e)try{await X.eventTypeDelete(e.id),await zy()}catch(e){Fy.value=e.message||String(e)}}var Yy=100,Xy=q([]),Zy=q(!0),Qy=q(null),$y=q(!0),eb=q(null);async function tb(){try{let e=await X.captures(Yy);Zy.value=e.enabled!==!1,Xy.value=e.captures||[],Qy.value=null}catch(e){Qy.value=e.message||String(e)}finally{$y.value=!1}}function nb(e){let t=Xy.value.find(t=>t.id===e);return t&&(eb.value=t),!!t}function rb(){Xy.value.length&&(eb.value=Xy.value[0])}function ib(){Fe(`captures`,()=>{tb(),zy()})}var ab=k({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=It(n,`class`),a=v(i,r);return(e,t)=>(R(),K(z(vo),H({"data-slot":`tabs`,"data-orientation":z(a).orientation||`horizontal`},z(a),{class:z(J)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:j(t=>[P(e.$slots,`default`,ft(Re(t)))]),_:3},16,[`data-orientation`,`class`]))}}),ob=k({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=It(t,`class`);return(e,r)=>(R(),K(z(xo),H({"data-slot":`tabs-content`,class:z(J)(`text-sm flex-1 outline-none`,t.class)},z(n)),{default:j(()=>[P(e.$slots,`default`)]),_:3},16,[`class`]))}}),sb=k({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=It(t,`class`,`variant`);return(r,i)=>(R(),K(z(So),H({"data-slot":`tabs-list`,"data-variant":e.variant},z(n),{class:z(J)(z(lb)({variant:e.variant}),t.class)}),{default:j(()=>[P(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),cb=k({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=It(t,`class`),r=Ie(n);return(e,n)=>(R(),K(z(Co),H({"data-slot":`tabs-trigger`,class:z(J)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointerLine truncated
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var PM=bM(`CharSizeService`),FM=bM(`CoreBrowserService`),IM=bM(`MouseService`),LM=bM(`RenderService`),RM=bM(`SelectionService`),zM=bM(`CharacterJoinerService`),BM=bM(`ThemeService`),VM=bM(`LinkProviderService`),HM=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?JM.isErrorNoTelemetry(e)?new JM(e.message+`
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var EM=fM(`CharSizeService`),DM=fM(`CoreBrowserService`),OM=fM(`MouseService`),kM=fM(`RenderService`),AM=fM(`SelectionService`),jM=fM(`CharacterJoinerService`),MM=fM(`ThemeService`),NM=fM(`LinkProviderService`),PM=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?BM.isErrorNoTelemetry(e)?new BM(e.message+`
`+e.stack):Error(e.message+`
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function UM(e){GM(e)||HM.onUnexpectedError(e)}var WM=`Canceled`;function GM(e){return e instanceof KM||e instanceof Error&&e.name===WM&&e.message===WM}var KM=class extends Error{constructor(){super(WM),this.name=this.message}};function qM(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var JM=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},YM=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function XM(e,t=0){return e[e.length-(1+t)]}var ZM;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(ZM||={});var QM=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||ZM.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};QM.empty=new QM(e=>{});function $M(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var eN;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(eN||={});var tN=null;function nN(e){return tN?.trackDisposable(e),e}function rN(e){tN?.markAsDisposed(e)}function iN(e,t){tN?.setParent(e,t)}function aN(e){return tN?.markAsSingleton(e),e}function oN(e){if(eN.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function sN(...e){return cN(()=>oN(e))}function cN(e){let t=nN({dispose:$M(()=>{rN(t),e()})});return t}var lN=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,nN(this)}dispose(){this._isDisposed||(rN(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{oN(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return iN(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),iN(e,null))}};lN.DISABLE_DISPOSED_WARNING=!1;var uN=lN,dN=class{constructor(){this._store=new uN,nN(this),iN(this._store,this)}dispose(){rN(thi Line truncated
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function FM(e){LM(e)||PM.onUnexpectedError(e)}var IM=`Canceled`;function LM(e){return e instanceof RM||e instanceof Error&&e.name===IM&&e.message===IM}var RM=class extends Error{constructor(){super(IM),this.name=this.message}};function zM(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var BM=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},VM=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function HM(e,t=0){return e[e.length-(1+t)]}var UM;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(UM||={});var WM=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||UM.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};WM.empty=new WM(e=>{});function GM(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var KM;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(KM||={});var qM=null;function JM(e){return qM?.trackDisposable(e),e}function YM(e){qM?.markAsDisposed(e)}function XM(e,t){qM?.setParent(e,t)}function ZM(e){return qM?.markAsSingleton(e),e}function QM(e){if(KM.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function $M(...e){return eN(()=>QM(e))}function eN(e){let t=JM({dispose:GM(()=>{YM(t),e()})});return t}var tN=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,JM(this)}dispose(){this._isDisposed||(YM(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{QM(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return XM(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),XM(e,null))}};tN.DISABLE_DISPOSED_WARNING=!1;var nN=tN,rN=class{constructor(){this._store=new nN,JM(this),XM(this._store,this)}dispose(){YM(thi Line truncated
`).slice(2).join(`
`))}},EN=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},DN=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},ON=0,kN=class{constructor(e){this.value=e,this.id=ON++}},AN=2,jN=class{constructor(e){this._size=0,this._options=e,this._leakageMon=SN>0||this._options?.leakWarningThreshold?new wN(e?.onListenerError??UM,this._options?.leakWarningThreshold??SN):void 0,this._perfMon=this._options?._profName?new xN(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new DN(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||UM)(n),dN.None}if(this._disposed)return dN.None;t&&(e=e.bind(t));let r=new kN(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=TN.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof kN?(this._deliveryQueue??=new MN,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=cN(()=>{i?.(),this._removeListener(r)});return n instanceof uN?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*AN<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||UM;if(!n)e.value(t);else try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof kN)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},MN=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},NN=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new jN,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new jN,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};NN.INSTANCE=new NN;var PN=NN;function FN(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}PN.INSTANCE.onDidChangeZoomLevel;function IN(e){return PN.INSTANCE.getZoomFactor(e)}PN.INSTANCE.onDidChangeFullscreen;var LN=typeof navigator==`object`?navigator.userAgent:``,RN=LN.indexOf(`Firefox`)>=0,zN=LN.indexOf(`AppleWebKit`)>=0,BN=LN.indexOf(`Chrome`)>=0,VN=!BN&&LN.indexOf(`Safari`)>=0;LN.indexOf(`Electron/`),LN.indexOf(`Android`);var HN=!1;if(typeof pN.matchMedia==`function`){let e=pN.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=pN.matchMedia(`(display-mode: fullscreen)`);HN=e.matches,FN(pN,e,({matches:e})=>{HN&&t.matches||(HN=e)} Line truncated
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};RF=Jj([Yj(2,SM),Yj(3,FM),Yj(4,CM),Yj(5,BM),Yj(6,OM),Yj(7,LM)],RF);var zF=class extends dN{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(cN(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderLine truncated
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var GF;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(GF||={});var KF;(e=>e.ST=`${$.ESC}\\`)(KF||={});var qF=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};qF=Jj([Yj(2,SM),Yj(3,OM),Yj(4,wM),Yj(5,LM)],qF);var JF=0,YF=0,XF=0,ZF=0,QF={css:`#00000000`,rgba:0},$F;(e=>{function t(e,t,n,r){return r===void 0?`#${iI(e)}${iI(t)}${iI(n)}`:`#${iI(e)}${iI(t)}${iI(n)}${iI(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})($F||={});var eI;(e=>{function t(e,t){if(ZF=(t.rgba&255)/255,ZF===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return JF=a+Math.round((n-a)*ZF),YF=o+Math.round((r-o)*ZF),XF=s+Math.round((i-s)*ZF),{css:$F.toCss(JF,YF,XF),rgba:$F.toRgba(JF,YF,XF)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=rI.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return $F.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[JF,YF,XF]=rI.toChannels(t),{css:$F.toCss(JF,YF,XF),rgba:t}}e.opaque=i;function a(e,t){return ZF=Math.round(t*255),[JF,YF,XF]=rI.toChannels(e.rgba),{css:$F.toCss(JF,YF,XF,ZF),rgba:$F.toRgba(JF,YF,XF,ZF)}}e.opacity=a;function o(e,t){return ZF=e.rgba&255,a(e,ZF*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.r Line truncated
`))}},vN=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},yN=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},bN=0,xN=class{constructor(e){this.value=e,this.id=bN++}},SN=2,CN=class{constructor(e){this._size=0,this._options=e,this._leakageMon=mN>0||this._options?.leakWarningThreshold?new gN(e?.onListenerError??FM,this._options?.leakWarningThreshold??mN):void 0,this._perfMon=this._options?._profName?new pN(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new yN(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||FM)(n),rN.None}if(this._disposed)return rN.None;t&&(e=e.bind(t));let r=new xN(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=_N.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof xN?(this._deliveryQueue??=new wN,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=eN(()=>{i?.(),this._removeListener(r)});return n instanceof nN?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*SN<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||FM;if(!n)e.value(t);else try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof xN)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},wN=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},TN=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new CN,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new CN,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};TN.INSTANCE=new TN;var EN=TN;function DN(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}EN.INSTANCE.onDidChangeZoomLevel;function ON(e){return EN.INSTANCE.getZoomFactor(e)}EN.INSTANCE.onDidChangeFullscreen;var kN=typeof navigator==`object`?navigator.userAgent:``,AN=kN.indexOf(`Firefox`)>=0,jN=kN.indexOf(`AppleWebKit`)>=0,MN=kN.indexOf(`Chrome`)>=0,NN=!MN&&kN.indexOf(`Safari`)>=0;kN.indexOf(`Electron/`),kN.indexOf(`Android`);var PN=!1;if(typeof aN.matchMedia==`function`){let e=aN.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=aN.matchMedia(`(display-mode: fullscreen)`);PN=e.matches,DN(aN,e,({matches:e})=>{PN&&t.matches||(PN=e)} Line truncated
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};AF=Bj([Vj(2,mM),Vj(3,DM),Vj(4,hM),Vj(5,MM),Vj(6,bM),Vj(7,kM)],AF);var jF=class extends rN{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(eN(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderLine truncated
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var LF;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(LF||={});var RF;(e=>e.ST=`${$.ESC}\\`)(RF||={});var zF=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};zF=Bj([Vj(2,mM),Vj(3,bM),Vj(4,gM),Vj(5,kM)],zF);var BF=0,VF=0,HF=0,UF=0,WF={css:`#00000000`,rgba:0},GF;(e=>{function t(e,t,n,r){return r===void 0?`#${XF(e)}${XF(t)}${XF(n)}`:`#${XF(e)}${XF(t)}${XF(n)}${XF(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(GF||={});var KF;(e=>{function t(e,t){if(UF=(t.rgba&255)/255,UF===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return BF=a+Math.round((n-a)*UF),VF=o+Math.round((r-o)*UF),HF=s+Math.round((i-s)*UF),{css:GF.toCss(BF,VF,HF),rgba:GF.toRgba(BF,VF,HF)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=YF.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return GF.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[BF,VF,HF]=YF.toChannels(t),{css:GF.toCss(BF,VF,HF),rgba:t}}e.opaque=i;function a(e,t){return UF=Math.round(t*255),[BF,VF,HF]=YF.toChannels(e.rgba),{css:GF.toCss(BF,VF,HF,UF),rgba:GF.toRgba(BF,VF,HF,UF)}}e.opacity=a;function o(e,t){return UF=e.rgba&255,a(e,UF*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.r Line truncated
`:`
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),YI&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=vL(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=NI(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-yL),yL),t/=yL,t/Math.abs(t)+Math.round(t*(bL-1)))}shouldForceSelection(e){return GI?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),xL)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(GI&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._active Line truncated
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(JP(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(cN(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<xz+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===xz+1&&(this._liveRegion.textContent+=$j.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let Line truncated
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Zj.get()},set promptLabel(e){Zj.set(e)},get tooMuchOutput(){return $j.get()},set tooMuchOutput(e){$j.set(e)}}}_verifyIntegers(...e){for(Pz of e)if(Pz===1/0||isNaN(Pz)||Pz%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Pz of e)if(Pz&&(Pz===1/0||isNaN(Pz)||Pz%1!=0||Pz<0))throw Error(`This API only accepts positive integers`)}},Iz=2,Lz=1,Rz=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Iz,Math.floor(u/e.css.cell.width)),rows:Math.max(Lz,Math.floor(l/e.css.cell.height))}}},zz={class:`flex h-[32rem] min-h-0 flex-col gap-2`},Bz={key:0,class:`text-sm text-muted-foreground`,role:`status`},Vz=k({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=q(null),r=q(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return vt(()=>{let e=n.value;if(!e)return;i=new Fz({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new Rz,i.loadAddon(o),i.open(e),c();let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${l}//${window.location.host}/api/tasks/${encodeURIComponent(t.taskId)}/sandbox?${u}`);a=d,d.binaryType=`arraybuffer`,d.onopen=()=>{r.value=`open`},d.onmessage=e=>{i&&(typeof e.data==`string`&&(r.value=`failed`),i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data)))},d.onerror=()=>{r.value=`failed`},d.onclose=()=>{r.value!==`failed`&&(r.value=`closed`)},s=new ResizeObserver(c),s.observe(e)}),dt(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(R(),W(`div`,zz,[r.value===`open`?L(``,!0):(R(),W(`p`,Bz,[r.value===`connecting`?(R(),W(V,{key:0},[A(`Connecting…`)],64)):r.value===`closed`?(R(),W(V,{key:1},[A(`The sandbox view ended.`)],64)):(R(),W(V,{key:2},[A(`The sandbox view is unavailable.`)],64))])),U(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),Hz={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},Uz={class:`inline-flex items-center gap-2`},Wz={class:`inline-flex items-center gap-2`},Gz=`__all__`,Kz=k({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=I(()=>sw.map(e=>({value:e.value||Gz,label:e.label}))),a=I(()=>n.filters.level||Gz),o=I(()=>n.filters.stage||Gz);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===Gz?``:String(e)})}function l(e){s({stage:String(e)===Gz?``:String(e)})}return(t,n)=>(R(),W(`div`,Hz,[U(`div`,Uz,[M(z(Cl),{"model-value":a.value,"aria-label":`Filter log entries by level`,"onUpdate:modelValue":c},{default:j(()=>[M(z(Al),{size:`sm`},{default:j(()=>[M(z(jl))]),_:1}),M(z(wl),null,{default:j(()=>[M(z(Tl),null,{default:j(()=>[(R(!0),W(V,null,G(i.value,e=>(R(),K(z(Dl),{key:e.value,value:e.value},{default:j(()=>[A(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),U(`div`,Wz,[M(z(Cl),{"model-value":o.value,"aria-label":`Filter log entries by stage`,"onUpdate:modelValue":l},{default:j(()=>[M(z(Al),{size:`sm`},{default:j(()=>[M(z(jl))]),_:1}),M(z(wl),null,{default:j(()=>[M(z(Tl),null,{default:j(()=>[M(z(Dl),{value:Gz},{default:j(()=>[...n[0]||=[A(`All stages`,-1)]]),_:1}),(R(!0),W(V,null,G(e.stages,e=>(R(),K(z(Dl),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),qz={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},Jz={key:2,class:`flex flex-col items-start gap-2 py-3`},Yz={key:0,class:`mt-2 Line truncated
`)}};pG.defaultYaml={explicit:!1,version:`1.2`},pG.defaultTags={"!!":`tag:yaml.org,2002:`};function mG(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 hG(e){let t=new Set;return oG(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function gG(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function _G(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=hG(e);let a=gG(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(QW(t.node)||eG(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 vG(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=vG(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=vG(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=vG(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=vG(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function yG(e,t,n){if(Array.isArray(e))return e.map((e,t)=>yG(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!nG(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 bG=class{constructor(e){Object.defineProperty(this,qW,{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(!YW(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=yG(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?vG(i,{"":o},``,o):o}},xG=class extends bG{constructor(e){super(VW),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=[],oG(e,{Node:(e,t)=>{(JW(t)||nG(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||=(yG(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=SG(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(mG(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 SG(e,t,n){if(JW(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(eG(t)){let r=0;for(let i of t.items){let t=SG(e,i,n);t>r&&(r=t)}return r}if(ZW(t)){let r=SG(e,t.key,n),i=SG(e,t.value,n);return Math.max(r,i)}return 1}var CG=e=>!e||typeof e!=`function`&&typeof e!=`object`,wG=class extends bG{constructor(e){super(GW),this.value=e}toJSON(e,t){return t?.keep?this.value:yG(this.value,e,t)}toString(){return String(this.value)}};wG.BLOCK_FOLDED=`BLOCK_FOLDED`,wG.BLOCK_LITERAL=`BLOCK_LITERAL`,wG.PLAIN=`PLAIN`,wG.QUOTE_DOUBLE=`QUOTE_DOUBLE`,wG.QUOTE_SINGLE=`QUOTE_SINGLE`;var TG=`tag:yaml.org,2002:`;function EG(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 DG(e,t,n){if(YW(e)&&(e=e.contents),tG(e))return e;if(ZW(e)){let t=n.schema[UW].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 xG(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=TG+t.slice(2));let l=EG(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new wG(e);return c&&(c.node=t),t Line truncated
`)?MG(n,t):n.includes(`
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),VI&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=uL(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=TI(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-dL),dL),t/=dL,t/Math.abs(t)+Math.round(t*(fL-1)))}shouldForceSelection(e){return LI?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),pL)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(LI&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._active Line truncated
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(BP(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(eN(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<pz+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===pz+1&&(this._liveRegion.textContent+=Gj.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let Line truncated
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Uj.get()},set promptLabel(e){Uj.set(e)},get tooMuchOutput(){return Gj.get()},set tooMuchOutput(e){Gj.set(e)}}}_verifyIntegers(...e){for(Ez of e)if(Ez===1/0||isNaN(Ez)||Ez%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Ez of e)if(Ez&&(Ez===1/0||isNaN(Ez)||Ez%1!=0||Ez<0))throw Error(`This API only accepts positive integers`)}},Oz=2,kz=1,Az=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Oz,Math.floor(u/e.css.cell.width)),rows:Math.max(kz,Math.floor(l/e.css.cell.height))}}},jz={class:`flex h-[32rem] min-h-0 flex-col gap-2`},Mz={key:0,class:`text-sm text-muted-foreground`,role:`status`},Nz=k({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=q(null),r=q(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return ht(()=>{let e=n.value;if(!e)return;i=new Dz({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new Az,i.loadAddon(o),i.open(e),c();let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${l}//${window.location.host}/api/tasks/${encodeURIComponent(t.taskId)}/sandbox?${u}`);a=d,d.binaryType=`arraybuffer`,d.onopen=()=>{r.value=`open`},d.onmessage=e=>{i&&(typeof e.data==`string`&&(r.value=`failed`),i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data)))},d.onerror=()=>{r.value=`failed`},d.onclose=()=>{r.value!==`failed`&&(r.value=`closed`)},s=new ResizeObserver(c),s.observe(e)}),ct(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(R(),W(`div`,jz,[r.value===`open`?L(``,!0):(R(),W(`p`,Mz,[r.value===`connecting`?(R(),W(V,{key:0},[A(`Connecting…`)],64)):r.value===`closed`?(R(),W(V,{key:1},[A(`The sandbox view ended.`)],64)):(R(),W(V,{key:2},[A(`The sandbox view is unavailable.`)],64))])),U(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),Pz={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},Fz={class:`inline-flex items-center gap-2`},Iz={class:`inline-flex items-center gap-2`},Lz=`__all__`,Rz=k({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=I(()=>tw.map(e=>({value:e.value||Lz,label:e.label}))),a=I(()=>n.filters.level||Lz),o=I(()=>n.filters.stage||Lz);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===Lz?``:String(e)})}function l(e){s({stage:String(e)===Lz?``:String(e)})}return(t,n)=>(R(),W(`div`,Pz,[U(`div`,Fz,[M(z(bl),{"model-value":a.value,"aria-label":`Filter log entries by level`,"onUpdate:modelValue":c},{default:j(()=>[M(z(Dl),{size:`sm`},{default:j(()=>[M(z(Ol))]),_:1}),M(z(xl),null,{default:j(()=>[M(z(Sl),null,{default:j(()=>[(R(!0),W(V,null,G(i.value,e=>(R(),K(z(wl),{key:e.value,value:e.value},{default:j(()=>[A(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),U(`div`,Iz,[M(z(bl),{"model-value":o.value,"aria-label":`Filter log entries by stage`,"onUpdate:modelValue":l},{default:j(()=>[M(z(Dl),{size:`sm`},{default:j(()=>[M(z(Ol))]),_:1}),M(z(xl),null,{default:j(()=>[M(z(Sl),null,{default:j(()=>[M(z(wl),{value:Lz},{default:j(()=>[...n[0]||=[A(`All stages`,-1)]]),_:1}),(R(!0),W(V,null,G(e.stages,e=>(R(),K(z(wl),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),zz={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},Bz={key:2,class:`flex flex-col items-start gap-2 py-3`},Vz={key:0,class:`mt-2 Line truncated
`)}};aG.defaultYaml={explicit:!1,version:`1.2`},aG.defaultTags={"!!":`tag:yaml.org,2002:`};function oG(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 sG(e){let t=new Set;return QW(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function cG(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function lG(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=sG(e);let a=cG(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(WW(t.node)||KW(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 uG(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=uG(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=uG(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=uG(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=uG(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function dG(e,t,n){if(Array.isArray(e))return e.map((e,t)=>dG(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!JW(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 fG=class{constructor(e){Object.defineProperty(this,zW,{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(!VW(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=dG(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?uG(i,{"":o},``,o):o}},pG=class extends fG{constructor(e){super(NW),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=[],QW(e,{Node:(e,t)=>{(BW(t)||JW(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||=(dG(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=mG(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(oG(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 mG(e,t,n){if(BW(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(KW(t)){let r=0;for(let i of t.items){let t=mG(e,i,n);t>r&&(r=t)}return r}if(UW(t)){let r=mG(e,t.key,n),i=mG(e,t.value,n);return Math.max(r,i)}return 1}var hG=e=>!e||typeof e!=`function`&&typeof e!=`object`,gG=class extends fG{constructor(e){super(LW),this.value=e}toJSON(e,t){return t?.keep?this.value:dG(this.value,e,t)}toString(){return String(this.value)}};gG.BLOCK_FOLDED=`BLOCK_FOLDED`,gG.BLOCK_LITERAL=`BLOCK_LITERAL`,gG.PLAIN=`PLAIN`,gG.QUOTE_DOUBLE=`QUOTE_DOUBLE`,gG.QUOTE_SINGLE=`QUOTE_SINGLE`;var _G=`tag:yaml.org,2002:`;function vG(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 yG(e,t,n){if(VW(e)&&(e=e.contents),qW(e))return e;if(UW(e)){let t=n.schema[FW].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 pG(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=_G+t.slice(2));let l=vG(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new gG(e);return c&&(c.node=t),t Line truncated
`)?wG(n,t):n.includes(`
`)?`
`+MG(n,t):(e.endsWith(` `)?``:` `)+n,PG=`flow`,FG=`block`,IG=`quoted`;function LG(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=RG(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=RG(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`+wG(n,t):(e.endsWith(` `)?``:` `)+n,EG=`flow`,DG=`block`,OG=`quoted`;function kG(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=AG(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=AG(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 RG(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 zG=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),BG=e=>/^(%|---|\.\.\.)/m.test(e);function VG(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 HG(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(BG(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 AG(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 jG=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),MG=e=>/^(%|---|\.\.\.)/m.test(e);function NG(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 PG(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(MG(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:LG(o,a,IG,zG(t,!1))}function UG(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return HG(e,t);let n=t.indent||(BG(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:LG(r,n,PG,zG(t,!1))}function WG(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=HG;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?UG:i&&!t?HG:n?UG:HG}return r(e,t)}var GG;try{GG=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:kG(o,a,OG,jG(t,!1))}function FG(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return PG(e,t);let n=t.indent||(MG(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:kG(r,n,EG,jG(t,!1))}function IG(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=PG;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?FG:i&&!t?PG:n?FG:PG}return r(e,t)}var LG;try{LG=RegExp(`(^|(?<!
))
+(?!
|$)`,`g`)}catch{GG=/\n+(?!\n|$)/g}function KG({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 WG(n,r);let l=r.indent||(r.forceBlockIndent||BG(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===wG.BLOCK_FOLDED?!1:t===wG.BLOCK_LITERAL||!VG(n,c,l.length);if(!n)return u?`|
|$)`,`g`)}catch{LG=/\n+(?!\n|$)/g}function RG({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 IG(n,r);let l=r.indent||(r.forceBlockIndent||MG(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===gG.BLOCK_FOLDED?!1:t===gG.BLOCK_LITERAL||!NG(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(GG,`$&${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(LG,`$&${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=zG(r,!0);o!==`folded`&&t!==wG.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=LG(`${v}${e}${p}`,l,FG,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function qG(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 WG(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?WG(a,t):KG(e,t,n,r);if(!s&&!u&&i!==wG.PLAIN&&a.includes(`
`))return KG(e,t,n,r);if(BG(a)){if(c===``)return t.forceBlockIndent=!0,KG(e,t,n,r);if(s&&c===l)return WG(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 WG(a,t)}return s?d:LG(d,c,PG,zG(t,!1))}function JG(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!==wG.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=wG.QUOTE_DOUBLE);let c=e=>{switch(e){case wG.BLOCK_FOLDED:case wG.BLOCK_LITERAL:return i||a?WG(o.value,t):KG(o,t,n,r);case wG.QUOTE_DOUBLE:return HG(o.value,t);case wG.QUOTE_SINGLE:return UG(o.value,t);case wG.PLAIN:return qG(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 YG(e,t){let n=Object.assign({blockQuote:!0,commentString:jG,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 XG(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(QW(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 ZG(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(QW(e)||eG(e))&&e.anchor;a&&mG(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 QG(e,t,n,r){if(ZW(e))return e.toString(t,n,r);if(JW(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=tG(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=XG(t.doc.schema.tags,a);let o=ZG(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):QW(a)?JG(a,t,n,r):a.toString(t,n,r);return o?QW(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function $G({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=tG(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(eG(e)||!tG(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||eG(e)||(QW(e)?e.type===wG.BLOCK_FOLDED||e.type===wG.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=QG(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+=NG(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=NG(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=NG(g,n.indent,l(f))));let _,v,y;tG(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&&QW(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&$W(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=QG(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${MG(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=jG(r,!0);o!==`folded`&&t!==gG.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=kG(`${v}${e}${p}`,l,DG,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function zG(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 IG(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?IG(a,t):RG(e,t,n,r);if(!s&&!u&&i!==gG.PLAIN&&a.includes(`
`))return RG(e,t,n,r);if(MG(a)){if(c===``)return t.forceBlockIndent=!0,RG(e,t,n,r);if(s&&c===l)return IG(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 IG(a,t)}return s?d:kG(d,c,EG,jG(t,!1))}function BG(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!==gG.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=gG.QUOTE_DOUBLE);let c=e=>{switch(e){case gG.BLOCK_FOLDED:case gG.BLOCK_LITERAL:return i||a?IG(o.value,t):RG(o,t,n,r);case gG.QUOTE_DOUBLE:return PG(o.value,t);case gG.QUOTE_SINGLE:return FG(o.value,t);case gG.PLAIN:return zG(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 VG(e,t){let n=Object.assign({blockQuote:!0,commentString:CG,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 HG(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(WW(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 UG(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(WW(e)||KW(e))&&e.anchor;a&&oG(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 WG(e,t,n,r){if(UW(e))return e.toString(t,n,r);if(BW(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=qW(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=HG(t.doc.schema.tags,a);let o=UG(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):WW(a)?BG(a,t,n,r):a.toString(t,n,r);return o?WW(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function GG({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=qW(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(KW(e)||!qW(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||KW(e)||(WW(e)?e.type===gG.BLOCK_FOLDED||e.type===gG.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=WG(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+=TG(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=TG(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=TG(g,n.indent,l(f))));let _,v,y;qW(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&&WW(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&GW(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=WG(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${wG(e,n.indent)}`}x===``&&!n.inFlow?S===`
`&&y&&(S=`
`):S+=`\n${n.indent}`}else if(!p&&eG(t)){let e=x[0],r=x.indexOf(`
`):S+=`\n${n.indent}`}else if(!p&&KW(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+=NG(g,n.indent,l(y)):h&&i&&i(),g}function eK(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var tK=`<<`,nK={identify:e=>e===tK||typeof e==`symbol`&&e.description===tK,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new wG(Symbol(tK)),{addToJSMap:iK}),stringify:()=>tK},rK=(e,t)=>(nK.identify(t)||QW(t)&&(!t.type||t.type===wG.PLAIN)&&nK.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===nK.tag&&e.default);function iK(e,t,n){let r=oK(e,n);if($W(r))for(let n of r.items)aK(e,t,n);else if(Array.isArray(r))for(let n of r)aK(e,t,n);else aK(e,t,r)}function aK(e,t,n){let r=oK(e,n);if(!XW(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 oK(e,t){return e&&JW(t)?t.resolve(e.doc,e):t}function sK(e,t,{key:n,value:r}){if(tG(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(rK(e,n))iK(e,t,r);else{let i=yG(n,``,e);if(t instanceof Map)t.set(i,yG(r,i,e));else if(t instanceof Set)t.add(i);else{let a=cK(n,i,e),o=yG(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function cK(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(tG(e)&&n?.doc){let t=YG(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)+`..."`),eK(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 lK(e,t,n){return new uK(DG(e,void 0,n),DG(t,void 0,n))}var uK=class e{constructor(e,t=null){Object.defineProperty(this,qW,{value:WW}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return tG(n)&&(n=n.clone(t)),tG(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return sK(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?$G(this,e,t,n):JSON.stringify(this)}};function dK(e,t,n){return(t.inFlow??e.flow?pK:fK)(e,t,n)}function fK({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(tG(i))!d&&i.spaceBefore&&f.push(``),mK(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(ZW(i)){let e=tG(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),mK(n,f,e.commentBefore,d))}d=!1;let s=QG(i,u,()=>o=null,()=>d=!0);o&&(s+=NG(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+=TG(g,n.indent,l(y)):h&&i&&i(),g}function KG(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var qG=`<<`,JG={identify:e=>e===qG||typeof e==`symbol`&&e.description===qG,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new gG(Symbol(qG)),{addToJSMap:XG}),stringify:()=>qG},YG=(e,t)=>(JG.identify(t)||WW(t)&&(!t.type||t.type===gG.PLAIN)&&JG.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===JG.tag&&e.default);function XG(e,t,n){let r=QG(e,n);if(GW(r))for(let n of r.items)ZG(e,t,n);else if(Array.isArray(r))for(let n of r)ZG(e,t,n);else ZG(e,t,r)}function ZG(e,t,n){let r=QG(e,n);if(!HW(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 QG(e,t){return e&&BW(t)?t.resolve(e.doc,e):t}function $G(e,t,{key:n,value:r}){if(qW(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(YG(e,n))XG(e,t,r);else{let i=dG(n,``,e);if(t instanceof Map)t.set(i,dG(r,i,e));else if(t instanceof Set)t.add(i);else{let a=eK(n,i,e),o=dG(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function eK(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(qW(e)&&n?.doc){let t=VG(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)+`..."`),KG(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 tK(e,t,n){return new nK(yG(e,void 0,n),yG(t,void 0,n))}var nK=class e{constructor(e,t=null){Object.defineProperty(this,zW,{value:IW}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return qW(n)&&(n=n.clone(t)),qW(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return $G(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?GG(this,e,t,n):JSON.stringify(this)}};function rK(e,t,n){return(t.inFlow??e.flow?aK:iK)(e,t,n)}function iK({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(qW(i))!d&&i.spaceBefore&&f.push(``),oK(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(UW(i)){let e=qW(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),oK(n,f,e.commentBefore,d))}d=!1;let s=WG(i,u,()=>o=null,()=>d=!0);o&&(s+=TG(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+=`
`+MG(l(e),c),s&&s()):d&&o&&o(),p}function pK({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(tG(i))i.spaceBefore&&d.push(``),mK(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(ZW(i)){let e=tG(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),mK(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=tG(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=QG(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+=NG(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 mK({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=MG(t(r),e);n.push(i.trimStart())}}function hK(e,t){let n=QW(t)?t.value:t;for(let r of e)if(ZW(r)&&(r.key===t||r.key===n||QW(r.key)&&r.key.value===n))return r}var gK=class extends AG{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(UW,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(lK(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=ZW(e)?e:!e||typeof e!=`object`||!(`key`in e)?new uK(e,e?.value):new uK(e.key,e.value);let r=hK(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);QW(r.value)&&CG(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=hK(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=hK(this.items,e)?.value;return(!t&&QW(n)?n.value:n)??void 0}has(e){return!!hK(this.items,e)}set(e,t){this.add(new uK(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)sK(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!ZW(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})),dK(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},_K={collection:`map`,default:!0,nodeClass:gK,tag:`tag:yaml.org,2002:map`,resolve(e,t){return XW(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>gK.from(e,t,n)},vK=class extends AG{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(KW,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=yK(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=yK(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&QW(r)?r.value:r}has(e){let t=yK(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=yK(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];QW(r)&&CG(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(yG(e,String(r++),t));return n}toString(e,t,n){return e?dK(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(DG(a,void 0,n))}}return i}};function yK(e){let t=QW(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var bK={collection:`seq`,default:!0,nodeClass:vK,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return $W(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>vK.from(e,t,n)},xK={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),JG(e,t,n,r)}},SK={identify:e=>e==null,createNode:()=>new wG(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new wG(null),stringify:({source:e},t)=>typeof e==`string`&&SK.test.test(e)?e:t.options.nullStr},CK={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new wG(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&CK.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function wK({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 TK={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:wK},EK={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 JG({comment:e,type:t,value:s},r,i,a)}};function BK(e,t){if($W(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!ZW(r)){if(XW(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new uK(new wG(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]=ZW(r)?r:new uK(r)}}else t(`Expected a sequence for this tag`);return e}function VK(e,t,n){let{replacer:r}=n,i=new vK(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(lK(o,s,n))}return i}var HK={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:BK,createNode:VK},UK=class e extends vK{constructor(){super(),this.add=gK.prototype.add.bind(this),this.delete=gK.prototype.delete.bind(this),this.get=gK.prototype.get.bind(this),this.has=gK.prototype.has.bind(this),this.set=gK.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(ZW(e)?(r=yG(e.key,``,t),i=yG(e.value,r,t)):r=yG(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=VK(e,t,n),i=new this;return i.items=r.items,i}};UK.tag=`tag:yaml.org,2002:omap`;var WK={collection:`seq`,identify:e=>e instanceof Map,nodeClass:UK,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=BK(e,t),r=[];for(let{key:e}of n.items)QW(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new UK,n)},createNode:(e,t,n)=>UK.from(e,t,n)};function GK({value:e,source:t},n){return t&&(e?KK:qK).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var KK={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 wG(!0),stringify:GK},qK={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 wG(!1),stringify:GK},JK={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:wK},YK={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():wK(e)}},XK={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 wG(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:wK},ZK=e=>typeof e==`bigint`||Number.isInteger(e);function QK(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 $K(e,t,n){let{value:r}=e;if(ZK(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return wK(e)}var eq={identify:ZK,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>QK(e,2,2,n),stringify:e=>$K(e,2,`0b`)},tq={identify:ZK,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>QK(e,1,8,n),stringify:e=>$K(e,8,`0`)},nq={identify:ZK,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>QK(e,0,10,n),stringify:wK},rq={identify:ZK,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>QK(e,2,16,n),stringify:e=>$K(e,16,`0x`)},iq=class e extends gK{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=ZW(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new uK(e.key,null):new uK(e,null),hK(this.items,t.key)||this.items.push(t)}get(e,t){let n=hK(this.items,e);return!t&&ZW(n)?QW(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=hK(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new uK(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(MG(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(MG(a(t),``)))}return n.join(`
`+wG(l(e),c),s&&s()):d&&o&&o(),p}function aK({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(qW(i))i.spaceBefore&&d.push(``),oK(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(UW(i)){let e=qW(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),oK(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=qW(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=WG(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+=TG(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 oK({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=wG(t(r),e);n.push(i.trimStart())}}function sK(e,t){let n=WW(t)?t.value:t;for(let r of e)if(UW(r)&&(r.key===t||r.key===n||WW(r.key)&&r.key.value===n))return r}var cK=class extends SG{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(FW,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(tK(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=UW(e)?e:!e||typeof e!=`object`||!(`key`in e)?new nK(e,e?.value):new nK(e.key,e.value);let r=sK(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);WW(r.value)&&hG(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=sK(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=sK(this.items,e)?.value;return(!t&&WW(n)?n.value:n)??void 0}has(e){return!!sK(this.items,e)}set(e,t){this.add(new nK(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)$G(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!UW(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})),rK(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},lK={collection:`map`,default:!0,nodeClass:cK,tag:`tag:yaml.org,2002:map`,resolve(e,t){return HW(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>cK.from(e,t,n)},uK=class extends SG{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(RW,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=dK(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=dK(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&WW(r)?r.value:r}has(e){let t=dK(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=dK(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];WW(r)&&hG(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(dG(e,String(r++),t));return n}toString(e,t,n){return e?rK(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(yG(a,void 0,n))}}return i}};function dK(e){let t=WW(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var fK={collection:`seq`,default:!0,nodeClass:uK,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return GW(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>uK.from(e,t,n)},pK={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),BG(e,t,n,r)}},mK={identify:e=>e==null,createNode:()=>new gG(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new gG(null),stringify:({source:e},t)=>typeof e==`string`&&mK.test.test(e)?e:t.options.nullStr},hK={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new gG(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&hK.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function gK({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 _K={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:gK},vK={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 BG({comment:e,type:t,value:s},r,i,a)}};function MK(e,t){if(GW(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!UW(r)){if(HW(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new nK(new gG(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]=UW(r)?r:new nK(r)}}else t(`Expected a sequence for this tag`);return e}function NK(e,t,n){let{replacer:r}=n,i=new uK(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(tK(o,s,n))}return i}var PK={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:MK,createNode:NK},FK=class e extends uK{constructor(){super(),this.add=cK.prototype.add.bind(this),this.delete=cK.prototype.delete.bind(this),this.get=cK.prototype.get.bind(this),this.has=cK.prototype.has.bind(this),this.set=cK.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(UW(e)?(r=dG(e.key,``,t),i=dG(e.value,r,t)):r=dG(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=NK(e,t,n),i=new this;return i.items=r.items,i}};FK.tag=`tag:yaml.org,2002:omap`;var IK={collection:`seq`,identify:e=>e instanceof Map,nodeClass:FK,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=MK(e,t),r=[];for(let{key:e}of n.items)WW(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new FK,n)},createNode:(e,t,n)=>FK.from(e,t,n)};function LK({value:e,source:t},n){return t&&(e?RK:zK).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var RK={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 gG(!0),stringify:LK},zK={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 gG(!1),stringify:LK},BK={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:gK},VK={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():gK(e)}},HK={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 gG(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:gK},UK=e=>typeof e==`bigint`||Number.isInteger(e);function WK(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 GK(e,t,n){let{value:r}=e;if(UK(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return gK(e)}var KK={identify:UK,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>WK(e,2,2,n),stringify:e=>GK(e,2,`0b`)},qK={identify:UK,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>WK(e,1,8,n),stringify:e=>GK(e,8,`0`)},JK={identify:UK,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>WK(e,0,10,n),stringify:gK},YK={identify:UK,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>WK(e,2,16,n),stringify:e=>GK(e,16,`0x`)},XK=class e extends cK{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=UW(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new nK(e.key,null):new nK(e,null),sK(this.items,t.key)||this.items.push(t)}get(e,t){let n=sK(this.items,e);return!t&&UW(n)?WW(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=sK(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new nK(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(wG(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(wG(a(t),``)))}return n.join(`
`)+`
`}var yq=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,qW,{value:HW});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 pG({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[qW]:{value:HW}});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=tG(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){bq(this.contents)&&this.contents.add(e)}addIn(e,t){bq(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=hG(this);e.anchor=!t||n.has(t)?gG(t||`a`,n):t}return new xG(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}=_G(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=DG(e,l,p);return o&&eG(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new uK(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return bq(this.contents)?this.contents.delete(e):!1}deleteIn(e){return kG(e)?this.contents!=null&&(this.contents=null,!0):bq(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return eG(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return kG(e)?!t&&QW(this.contents)?this.contents.value:this.contents:eG(this.contents)?this.contents.getIn(e,t):void 0}has(e){return eG(this.contents)?this.contents.has(e):!1}hasIn(e){return kG(e)?this.contents!==void 0:eG(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=OG(this.schema,[e],t):bq(this.contents)&&this.contents.set(e,t)}setIn(e,t){kG(e)?this.contents=t:this.contents==null?this.contents=OG(this.schema,Array.from(e),t):bq(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 pG({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 pG({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 _q(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=yG(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`?vG(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 vq(this,e)}};function bq(e){if(eG(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var xq=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},Sq=class extends xq{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},Cq=class extends xq{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},wq=(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 Tq(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 Eq(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(Eq(t.key)||Eq(t.value))return!0}return!1;default:return!0}}function Dq(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&Eq(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function Oq(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||QW(e)&&QW(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var kq=`All mapping items must start at the same column`;function Aq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??gK)(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=Tq(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`,kq)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||Eq(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`,kq);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&Dq(r.indent,u,i),n.atKey=!1,Oq(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=Tq(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&&Dq(r.indent,f,i),s=c.range[2];let l=new uK(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 uK(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 jq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??vK)(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=Tq(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&&Dq(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function Mq(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 Nq=`Block collections are not allowed within flow collections`,Pq=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Fq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?gK:vK))(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=Tq(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&&Eq(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];ZW(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],Pq(m)&&i(r.range,`BLOCK_IN_FLOW`,Nq)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);Pq(f)&&i(g.range,`BLOCK_IN_FLOW`,Nq),n.atKey=!1;let _=Tq(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?Pq(m)&&i(v.range,`BLOCK_IN_FLOW`,Nq):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new uK(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;Oq(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new gK(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=Mq(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 Iq(e,t,n,r,i,a){let o=n.type===`block-map`?Aq(e,t,n,r,a):n.type===`block-seq`?jq(e,t,n,r,a):Fq(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function Lq(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===gK.tagName&&s===`map`||o===vK.tagName&&s===`seq`)return Iq(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),Iq(e,t,n,i,o)}let l=Iq(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=tG(u)?u:new wG(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Rq(e,t,n){let r=t.offset,i=zq(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?wG.BLOCK_FOLDED:wG.BLOCK_LITERAL,o=t.source?Bq(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 dq=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,zW,{value:PW});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 aG({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[zW]:{value:PW}});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=qW(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){fq(this.contents)&&this.contents.add(e)}addIn(e,t){fq(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=sG(this);e.anchor=!t||n.has(t)?cG(t||`a`,n):t}return new pG(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}=lG(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=yG(e,l,p);return o&&KW(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new nK(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return fq(this.contents)?this.contents.delete(e):!1}deleteIn(e){return xG(e)?this.contents!=null&&(this.contents=null,!0):fq(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return KW(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return xG(e)?!t&&WW(this.contents)?this.contents.value:this.contents:KW(this.contents)?this.contents.getIn(e,t):void 0}has(e){return KW(this.contents)?this.contents.has(e):!1}hasIn(e){return xG(e)?this.contents!==void 0:KW(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=bG(this.schema,[e],t):fq(this.contents)&&this.contents.set(e,t)}setIn(e,t){xG(e)?this.contents=t:this.contents==null?this.contents=bG(this.schema,Array.from(e),t):fq(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 aG({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 aG({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 lq(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=dG(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`?uG(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 uq(this,e)}};function fq(e){if(KW(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var pq=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},mq=class extends pq{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},hq=class extends pq{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},gq=(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 _q(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 vq(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(vq(t.key)||vq(t.value))return!0}return!1;default:return!0}}function yq(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&vq(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function bq(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||WW(e)&&WW(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var xq=`All mapping items must start at the same column`;function Sq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??cK)(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=_q(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`,xq)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||vq(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`,xq);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&yq(r.indent,u,i),n.atKey=!1,bq(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=_q(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&&yq(r.indent,f,i),s=c.range[2];let l=new nK(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 nK(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 Cq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??uK)(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=_q(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&&yq(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function wq(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 Tq=`Block collections are not allowed within flow collections`,Eq=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Dq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?cK:uK))(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=_q(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&&vq(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];UW(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],Eq(m)&&i(r.range,`BLOCK_IN_FLOW`,Tq)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);Eq(f)&&i(g.range,`BLOCK_IN_FLOW`,Tq),n.atKey=!1;let _=_q(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?Eq(m)&&i(v.range,`BLOCK_IN_FLOW`,Tq):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new nK(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;bq(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new cK(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=wq(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 Oq(e,t,n,r,i,a){let o=n.type===`block-map`?Sq(e,t,n,r,a):n.type===`block-seq`?Cq(e,t,n,r,a):Dq(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function kq(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===cK.tagName&&s===`map`||o===uK.tagName&&s===`seq`)return Oq(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),Oq(e,t,n,i,o)}let l=Oq(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=qW(u)?u:new gG(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Aq(e,t,n){let r=t.offset,i=jq(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?gG.BLOCK_FOLDED:gG.BLOCK_LITERAL,o=t.source?Mq(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===wG.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===gG.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`):t.length>c||r[0]===` `?(f===` `?f=`
`:!p&&f===`
`&&(f=`
@@ -86,59 +86,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 zq({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 Bq(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 Vq(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=wG.PLAIN,c=Hq(a,l);break;case`single-quoted-scalar`:s=wG.QUOTE_SINGLE,c=Uq(a,l);break;case`double-quoted-scalar`:s=wG.QUOTE_DOUBLE,c=Gq(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=Mq(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Hq(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}`),Wq(e)}function Uq(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Wq(e.slice(1,-1)).replace(/''/g,`'`)}function Wq(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 jq({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 Mq(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 Nq(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=gG.PLAIN,c=Pq(a,l);break;case`single-quoted-scalar`:s=gG.QUOTE_SINGLE,c=Fq(a,l);break;case`double-quoted-scalar`:s=gG.QUOTE_DOUBLE,c=Lq(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=wq(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Pq(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}`),Iq(e)}function Fq(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Iq(e.slice(1,-1)).replace(/''/g,`'`)}function Iq(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 Gq(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 Lq(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}=Kq(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=qq[i];if(a)n+=a;else if(i===`
`){let{fold:t,offset:i}=Rq(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=zq[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+=Dee(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+=Bq(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 Kq(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 Rq(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 qq={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Dee(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 Jq(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Rq(e,t,r):Vq(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[GW]:c?Yq(e.schema,i,c,n,r):t.type===`scalar`?Xq(e,i,t,r):e.schema[GW];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=QW(a)?a:new wG(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new wG(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 Yq(e,t,n,r,i){if(n===`!`)return e[GW];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[GW])}function Xq({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[GW];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[GW];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 Zq(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 Qq={composeNode:$q,composeEmptyNode:eJ};function $q(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=tJ(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=Jq(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=Lq(Qq,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??=eJ(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&&(!QW(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 eJ(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Jq(e,{type:`scalar`,offset:Zq(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 tJ({options:e},{offset:t,source:n,end:r},i){let a=new xG(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=Mq(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function nJ(e,t,{offset:n,start:r,value:i,end:a},o){let s=new yq(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=Tq(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?$q(c,i,l,o):eJ(c,l.end,r,null,l,o);let u=s.contents.range[2],d=Mq(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function rJ(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 iJ(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 zq={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Bq(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 Vq(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Aq(e,t,r):Nq(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[LW]:c?Hq(e.schema,i,c,n,r):t.type===`scalar`?Uq(e,i,t,r):e.schema[LW];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=WW(a)?a:new gG(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new gG(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 Hq(e,t,n,r,i){if(n===`!`)return e[LW];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[LW])}function Uq({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[LW];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[LW];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 Oee(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 Wq={composeNode:Gq,composeEmptyNode:Kq};function Gq(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=qq(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=Vq(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=kq(Wq,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??=Kq(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&&(!WW(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 Kq(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Vq(e,{type:`scalar`,offset:Oee(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 qq({options:e},{offset:t,source:n,end:r},i){let a=new pG(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=wq(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Jq(e,t,{offset:n,start:r,value:i,end:a},o){let s=new dq(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=_q(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?Gq(c,i,l,o):Kq(c,l.end,r,null,l,o);let u=s.contents.range[2],d=wq(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Yq(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 Xq(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 aJ=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=rJ(e);r?this.warnings.push(new Cq(i,t,n)):this.errors.push(new Sq(i,t,n))},this.directives=new pG({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=iJ(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(eG(i)&&!i.flow&&i.items.length>0){let e=i.items[0];ZW(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:iJ(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=rJ(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=nJ(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 Sq(rJ(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 Sq(rJ(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=Mq(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 Sq(rJ(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 yq(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}}},oJ=Symbol(`break visit`),sJ=Symbol(`skip children`),cJ=Symbol(`remove item`);function lJ(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),uJ(Object.freeze([]),e,t)}lJ.BREAK=oJ,lJ.SKIP=sJ,lJ.REMOVE=cJ,lJ.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},lJ.parentCollection=(e,t)=>{let n=lJ.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 uJ(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=uJ(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===oJ)return oJ;else r===cJ&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function dJ(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 Zq=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Yq(e);r?this.warnings.push(new hq(i,t,n)):this.errors.push(new mq(i,t,n))},this.directives=new aG({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Xq(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(KW(i)&&!i.flow&&i.items.length>0){let e=i.items[0];UW(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:Xq(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=Yq(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Jq(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 mq(Yq(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 mq(Yq(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=wq(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 mq(Yq(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 dq(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}}},Qq=Symbol(`break visit`),$q=Symbol(`skip children`),eJ=Symbol(`remove item`);function tJ(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),nJ(Object.freeze([]),e,t)}tJ.BREAK=Qq,tJ.SKIP=$q,tJ.REMOVE=eJ,tJ.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},tJ.parentCollection=(e,t)=>{let n=tJ.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 nJ(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=nJ(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Qq)return Qq;else r===eJ&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function rJ(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 fJ(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var pJ=new Set(`0123456789ABCDEFabcdef`),mJ=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),hJ=new Set(`,[]{}`),gJ=new Set(` ,[]{}
\r `),_J=e=>!e||gJ.has(e),vJ=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 iJ(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var aJ=new Set(`0123456789ABCDEFabcdef`),oJ=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),sJ=new Set(`,[]{}`),cJ=new Set(` ,[]{}
\r `),lJ=e=>!e||cJ.has(e),uJ=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===`...`)&&fJ(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===`...`)&&fJ(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&&!fJ(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===`:`)&&fJ(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(_J),`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(`...`))&&fJ(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(_J),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||fJ(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===`...`)&&iJ(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===`...`)&&iJ(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&&!iJ(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===`:`)&&iJ(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(lJ),`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(`...`))&&iJ(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(lJ),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||iJ(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=>fJ(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=>iJ(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(fJ(r)||e&&hJ.has(r))break;t=n}else if(fJ(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(iJ(r)||e&&sJ.has(r))break;t=n}else if(iJ(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&hJ.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&hJ.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(_J),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(fJ(n)||t&&hJ.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(;!fJ(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(mJ.has(t))t=this.buffer[++e];else if(t===`%`&&pJ.has(this.buffer[e+1])&&pJ.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&&sJ.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&sJ.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(lJ),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(iJ(n)||t&&sJ.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(;!iJ(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(oJ.has(t))t=this.buffer[++e];else if(t===`%`&&aJ.has(this.buffer[e+1])&&aJ.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)}},yJ=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 bJ(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function xJ(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 SJ(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 CJ(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 wJ(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 TJ(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 EJ(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!bJ(t.start,`explicit-key-ind`)&&!bJ(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,SJ(t.value)?t.value.end?TJ(t.value.end,t.sep):t.value.end=t.sep:TJ(t.start,t.sep),delete t.sep)}var DJ=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 vJ,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=dJ(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})}else{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`&&EJ(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&&xJ(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.in 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)}},dJ=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 fJ(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function pJ(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 mJ(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 hJ(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 gJ(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 _J(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 vJ(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!fJ(t.start,`explicit-key-ind`)&&!fJ(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,mJ(t.value)?t.value.end?_J(t.value.end,t.sep):t.value.end=t.sep:_J(t.start,t.sep),delete t.sep)}var yJ=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 uJ,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=rJ(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})}else{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`&&vJ(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&&pJ(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.in 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)){TJ(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(bJ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=wJ(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(bJ(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(SJ(t.key)&&!bJ(t.sep,`newline`)){let e=wJ(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]}):bJ(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&&!bJ(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)){TJ(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||bJ(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)){_J(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(fJ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=gJ(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(fJ(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(mJ(t.key)&&!fJ(t.sep,`newline`)){let e=gJ(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]}):fJ(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&&!fJ(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)){_J(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||fJ(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=wJ(CJ(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=wJ(CJ(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 OJ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new yJ||null,prettyErrors:t}}function kJ(e,t={}){let{lineCounter:n,prettyErrors:r}=OJ(t),i=new DJ(n?.addNewLine),a=new aJ(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 Sq(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(wq(e,n)),o.warnings.forEach(wq(e,n))),o}function AJ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=kJ(e,n);if(!i)return null;if(i.warnings.forEach(e=>eK(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 jJ(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 YW(e)&&!r?e.toString(n):new yq(e,r,n).toString(n)}var MJ=e=>typeof e==`object`&&!!e&&!Array.isArray(e),NJ=e=>MJ(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function PJ(e){if(MJ(e)){if(MJ(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:NJ(e.parallel)};if(MJ(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:NJ(e.switch.cases)}}}function FJ(e){return e.slice(2).includes(`parallel`)}function IJ(e,t){let n=kJ(e).getIn(t,!0);if(XW(n))return n.toJSON()}function LJ(e,t,n){let r=kJ(e);return r.setIn(t,r.createNode(JJ(n))),r.toString()}function RJ(e,t,n){let r=kJ(e),i=t.slice(0,-1),a=FJ(i);if(a&&![`agent.run`,`workflow.call`].includes(n))throw Error(`Branches allow only read-only agents and workflow calls.`);let o=r.getIn(i,!0);if($W(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!$W(o))return{source:e,path:[]};let s=Math.min(Math.max(Number(t.at(-1))+1,0),o.items.length),c=n===`parallel`?{parallel:{"branch-1":[],"branch-2":[]}}:n===`switch`?{switch:{on:``,cases:{true:[],default:[]}}}:{type:n,...a&&n===`agent.run`?{settings:{read_only:!0}}:{}};return o.items.splice(s,0,r.createNode(c)),{source:r.toString(),path:[...i,s]}}function zJ(e,t){if(t===`switch`){if(!e||e.includes(`/`))throw Error(`A case is the value it matches, without a slash.`)}else if(!/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/.test(e))throw Error(`Use a lowercase branch name with letters, digits, dots or dashes.`)}function BJ(e,t){let n=e.getIn(t,!0),r=PJ(XW(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!XW(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function VJ(e,t,n){let r=kJ(e),{kind:i,branches:a}=BJ(r,t);if(zJ(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function HJ(e,t,n,r){let i=kJ(e),{kind:a,branches:o}=BJ(i,t);if(zJ(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>QW(e.key)&&e.key.value===n);if(!s||!QW(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function UJ(e,t,n){let r=kJ(e),{kind:i,branches:a}=BJ(r,t);if(i===`parallel`&&a.items.length<=2)throw Error(`Parallel needs at least two branches.`);if(a.items.length<=1)throw Error(`A switch needs at least one case.`);return Line truncated
`).find(e=>e.trim())?.trim()}}function cY(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(iY)].map(e=>e[1]))]}function lY(e){let t=kJ(e).toJS(),n=aY(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=new Set,c=`start`;r.push({id:c,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let l=[c],u=1,d=new Map,f=e=>{let t=d.get(e)??0;return d.set(e,t+1),t},p=(e,t,n,i,s,c,l,u)=>{let d=aY(e)?e:{},p=PJ(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=aY(d.settings)?d.settings:{},g=typeof d.id==`string`?d.id:``,_=`step-${t}`,v=s?`${s}/${g||m}`:g||m;r.push({id:_,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:g||t,title:g||rY(m),type:m,role:ZJ(m),step:l?.length===2?String(Number(l[1])+1).padStart(2,`0`):void 0,detail:p?.on?`on ${p.on.replace(/^steps\./,``)}`:oY(m,h),summary:sY(h),when:typeof d.when==`string`?d.when:void 0,retry:aY(d.retry)&&typeof d.retry.attempts==`number`?d.retry.attempts:void 0,continues:d.on_failure===`continue`,branch:s,lane:u,path:l,stage:v,occurrence:f(v),...c?{resume:c}:{}}}),g&&a.set(g,_);let y=p?.on?`{{ ${p.on} }}`:``;for(let e of cY([d.settings,y],d.when))o.push({from:e,to:_});return _},m=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,...s.has(r)?{otherwise:!0}:{},insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){let n=PJ(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*eY,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=aY(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=0;o.forEach(([t,n],o)=>{let s=(o-(h-1)/2)*tY,l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*eY,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]}),_=Math.max(_,n.length);let v=`add-${e}-${t}`;r.push({id:v,type:`add`,position:{x:s+104,y:(u+n.length)*eY},data:{kind:`step`,key:v,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,v),g.push(v)});let v=(Math.max(_,1)+1)*eY-24;o.forEach(([t],n)=>{let a=(n-(h-1)/2)*tY;r.push({id:`lane-${e}-${t}`,type:`lane`,position:{x:a-12,y:u*eY-40},style:{width:`264px`,height:`${v}px`},zIndex:-1,data:{kind:`step`,key:t,title:t,type:``,detail:``,lane:i}})}),f&&(g.push(c),s.add(c)),l=g,u+=Math.max(_,1)+1;continue}let i=p(t,String(e+1),0,u*eY,void 0,void 0,[`steps`,e]);m(l,i,[`steps`,e-1]),l=[i],u++}r.push({id:`add-end`,type:`add`,position:{x:104,y:u*eY-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``,insertAfter:[`steps`,n.length-1]}}),m(l,`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 uY={agent:Os,command:gc,repo:Ws,gate:fc,forge:Qs,human:yc,review:Vs,workflow:Sc},dY={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function fY(e){return e===`parallel`?Ws:e===`switch`?mc:uY[e.split(`.`)[0]]??Sc}function pY(e){return Object.keys(dY).map(t=>({title:dY[t],icon:uY[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}var mY=k({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{}},emits:[`pick`],setup(e,{emit:t}){let n=t;return(t,r)=>(R(),K(z(Cl),{"model-value":e.value||void 0,"onUpdate:modelValue":r[0]||=e=>n(`pick`,String(e))},{default:j(()=>[M(z(Al),{"aria-label":e.label},{default:j(()=>[M(z(jl),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`]),M(z(wl),null,{default:j(()=>[e.value&&!e.workflows.some(t=>t.id===e.value)?(R(),K(z(Dl),{key:0,value:e.value,disabled:``},{default:j(()=>[A(B(e.value)+` (unavailable)`,1)]),_:1},8,[`value`])):L(``,!0),(R(!0),W(V,null,G(e.workflows,e=>(R(),K(z(Dl),{key:e.id,value:e.id},{default:j(()=>[A(B(e.id),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`]))}});function hY(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function gY(e,t=[]){let n=kJ(e),r=n.errors[0];if(r)return{ok:!1,message:jY(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!MY(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let o=i.steps;if(o==null||o===``)return{ok:!1,message:`workflow ${a} has no steps`};if(!Array.isArray(o))return{ok:!1,message:`workflow ${a}: steps must be a list`};if(!o.length)return{ok:!1,message:`workflow ${a} has no steps`};let s=new Map(t.map(e=>[e.name,e])),c=typeof i.repository==`string`&&i.repository.trim()?i.repository.trim():`required`,l=[],u=new Set;for(let[e,t]of o.entries()){let n=`workflow ${a} step ${e+1}`,r=bY(t);if(r)return{ok:!1,message:`${n}: ${r}`};let i=PJ(t);if(i){if(i.kind===`sLine truncated
`).map((e,t)=>({number:t+1,text:e,tokens:DY(e)}))}var TY=/^(\s*)(-\s+)?/,EY=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function DY(e){let{code:t,comment:n}=OY(e),r=kY(t);return n&&r.push({text:n,kind:`comment`}),r}function OY(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t)r===t&&(t=``);else if(r===`"`||r===`'`)t=r;else if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function kY(e){if(!e)return[];let t=[],n=TY.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=EY.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,...AY(i[4]??``)]):[...t,...AY(r)]}function AY(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 jY(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function MY(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function NY(e){return typeof e==`string`&&e.trim()!==``}var PY={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},FY={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},IY={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},LY={class:`min-w-0 flex-1`},RY={class:`truncate font-mono text-[11px] text-fg-subtle`},zY={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},BY={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},VY={key:1,class:`space-y-3`},HY={key:0,class:`block space-y-1.5`},UY={id:`switch-on`},WY=[`value`],GY={class:`text-xs font-medium text-muted-foreground`},KY={class:`flex items-center gap-2`},qY={key:1,role:`alert`,class:`text-xs text-danger`},JY={key:2,class:`space-y-1.5`},YY=[`title`],XY={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},ZY={key:3,class:`divide-y divide-border rounded-md border border-border`},QY=[`title`],$Y={key:0,class:`space-y-3`},eX={class:`text-[13px]`},tX={key:0,class:`text-danger`},nX={class:`ml-2 text-xs text-fg-subtle`},rX={key:1,class:`space-y-3`},iX={class:`text-[13px]`},aX={class:`ml-2 text-xs text-fg-subtle`},oX=[`title`],sX={key:0,class:`text-xs text-danger`},cX={class:`space-y-2`},lX={key:0,role:`alert`,class:`text-xs text-danger`},uX={class:`divide-y divide-border rounded-md border border-border`},dX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},fX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},pX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},mX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},hX=[`for`],gX={class:`flex items-center border-t border-border px-4 py-2.5`},_X=k({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=Ke(),r=e,i=t,a=I(()=>IJ(r.yaml,r.path)??{}),o=I(()=>PJ(a.value)),s=I(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=I(()=>o.value?.branches.map(([e])=>e)??[]),l=I(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,LJ(r.yaml,r.path,{...a.value,switch:{...a.value.switch,on:e}}))}let d=q(``),f=q(``);function p(e,t,n=``){try{let a=e===`add`?VJ(r.yaml,r.path,t):e===`rename`?HJ(r.yaml,r.path,t,n):UJ(r.yaml,r.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=I(()=>r.vocabulary.find(e=>e.name===s.value)),h=I(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=I(()=>qJ(r.yaml,r.path)),_=I(()=>bY(a.value)),v=I(()=>m.value?.settings&&a.value.settings?SY(a.value.settings,m.value.settings,`settings`):``),y=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],b=/mission|body|detail|plan|rules/;function x(e,t){return[`workflow.call`,`workflow.handoff`].includes(s.value)&&e===`workflow`||s.value===`human.approve`&&e===`then`?`workflow`:s.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:b.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 S=I(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:x(e,t),options:s.value===`agent.run`&&e===`model`?r.modelAliases:t.enum??[]})),t=e.filter(e=>y.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>y.indexOf(e.key)-y.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function C(e){let{id:t,type:n,...a}=e;i(`update:yaml`,LJ(r.yaml,r.path,{id:t,type:n,...a}))}function w(e,t){C({...a.value,[e]:t})}function T(e){let t={...a.value.retry,...e};w(`retry`,t.attempts===void 0&&!t.backoff?void 0:{...t,attempts:t.attempts??1})}function ee(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,C({...a.value,settings:n})}function E(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),C({...a.value,settings:n})}let D=I(()=>r.workflows.find(e=>e.id===h.value.workflow)),te=I(()=>Object.entries(YJ(D.value?.yaml??``,`inputs`)??{})),ne=I(()=>Object.entries(YJ(D.value?.yaml??``,`outputs`)??{})),re=I(()=>Object.entries(YJ(r.yaml,`inputs`)??{})),ie=I(()=>Object.entries(YJ(r.yaml,`outputs`)??{})),O=I(()=>h.value.inputs??{}),ae=I(()=>h.value.outputs??{}),oe=e=>typeof e==`string`&&e.startsWith(`inputs.`),se=e=>O.value[e]===void 0?``:String(O.value[e]);function ce(e,t,n){ee(`inputs`,{...O.value,[e]:t===``?void 0:oe(t)?t:Hv(t,n??`string`)})}let le=q(null);function ue(e,t){let n=le.value??S.value.lead?.key;if(!n)return;let r=typeof h.value[n]==`string`?h.value[n]:`Line truncated
`)[0]}}}let pe=e=>e===void 0?``:jJ(e).trimEnd(),me=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),he=e=>typeof h.value[e]==`string`?h.value[e]:``;return(t,r)=>(R(),W(`aside`,PY,[U(`header`,FY,[U(`span`,IY,[(R(),K(tt(z(fY)(s.value)),{class:`size-4`}))]),U(`div`,LY,[M(z(Z),{"model-value":a.value.id??``,class:`h-7 truncate border-transparent px-1 font-medium shadow-none hover:border-input dark:bg-transparent`,placeholder:z(rY)(s.value),"aria-label":`Step id`,"onUpdate:modelValue":r[0]||=e=>w(`id`,String(e))},null,8,[`model-value`,`placeholder`]),U(`div`,RY,B(s.value),1)]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:r[1]||=e=>i(`close`)},{default:j(()=>[M(z(wc))]),_:1})]),U(`div`,zY,[v.value?(R(),W(`p`,BY,B(v.value),1)):L(``,!0),o.value?(R(),W(`section`,VY,[s.value===`switch`?(R(),W(`label`,HY,[r[18]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),M(z(Z),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`switch-on`,onChange:r[2]||=e=>u(e.target.value.trim())},null,8,[`model-value`]),U(`datalist`,UY,[(R(!0),W(V,null,G(g.value,e=>(R(),W(`option`,{key:e,value:`steps.${e}.result.`},null,8,WY))),128))])])):L(``,!0),U(`div`,GY,B(s.value===`switch`?`Cases`:`Branches`),1),(R(!0),W(V,null,G(c.value,e=>(R(),W(`div`,{key:e,class:`flex items-center gap-2`},[M(z(Z),{"model-value":e,class:N(s.value===`switch`&&`font-mono`),"aria-label":`${s.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>p(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:j(()=>[M(z(Ie))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),U(`div`,KY,[M(z(Z),{modelValue:d.value,"onUpdate:modelValue":r[3]||=e=>d.value=e,"aria-label":s.value===`switch`?`New case value`:`New branch name`,placeholder:s.value===`switch`?`Value, or default`:`Branch name`,onKeydown:r[4]||=Mt(Pt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),M(z(Y),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:r[5]||=e=>p(`add`,d.value.trim())},{default:j(()=>[M(z(ac))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(R(),W(`p`,qY,B(f.value),1)):L(``,!0)])):L(``,!0),S.value.lead?(R(),W(`section`,JY,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:S.value.lead.schema.description},[A(B(me(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(R(),K(z(Is),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,YY),S.value.lead.kind===`workflow`?(R(),K(mY,{key:0,value:he(S.value.lead.key),workflows:e.workflows,label:me(S.value.lead.key,S.value.lead.schema),onPick:r[6]||=e=>E(S.value.lead.key,e)},null,8,[`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(R(),K(z(Mv),{key:1,size:`sm`,class:`w-full`,"model-value":he(S.value.lead.key),"onUpdate:modelValue":r[7]||=e=>ee(S.value.lead.key,String(e)||void 0)},{default:j(()=>[M(z(Nv),{value:``},{default:j(()=>[...r[19]||=[A(`Default`,-1)]]),_:1}),(R(!0),W(V,null,G(S.value.lead.options,e=>(R(),K(z(Nv),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`model-value`])):S.value.lead.kind===`text`?(R(),K(z(Jl),{key:2,"model-value":he(S.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:r[8]||=e=>le.value=S.value.lead.key,"onUpdate:modelValue":r[9]||=e=>ee(S.value.lead.key,String(e))},null,8,[`model-value`])):(R(),K(z(Z),{key:3,"model-value":he(S.value.lead.key),onFocus:r[10]||=e=>le.value=S.value.lead.key,"onUpdate:modelValue":r[11]||=e=>ee(S.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&S.value.lead.kind!==`select`?(R(),W(`div`,XY,[r[20]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(R(!0),W(V,null,G(g.value,e=>(R(),W(V,{key:e},[M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>ue(e,`summary`)},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]),M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>ue(e,`result`)},{default:j(()=>[A(B(e)+`.result`,1)]),_:2},1032,[`onClick`])],64))),128))])):L(``,!0)])):L(``,!0),S.value.compact.length?(R(),W(`section`,ZY,[(R(!0),W(V,null,G(S.value.compact,t=>(R(),W(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[U(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:t.schema.description},[A(B(me(t.key,t.schema))+` `,1),t.schema.description?(R(),K(z(Is),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,QY),t.kind===`workflow`?(R(),K(mY,{key:0,class:`max-w-48`,value:he(t.key),workflows:e.workflows,label:me(t.key,t.schema),onPick:e=>E(t.key,e)},null,8,[`Line truncated
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>ee(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(R(),W(V,{key:2},[M(z(Jl),{"model-value":pe(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>fe(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),de.value[e.key]?(R(),W(`span`,sX,B(de.value[e.key]),1)):L(``,!0)],64))]))),128)),U(`section`,cX,[r[36]||=U(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),r[37]||=U(`p`,{class:`text-xs text-fg-muted`},`Leave the condition empty to always run. Use a field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true.`,-1),_.value?(R(),W(`p`,lX,B(_.value),1)):L(``,!0),U(`div`,uX,[U(`label`,dX,[r[31]||=U(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),M(z(Z),{class:`h-7 w-48 font-mono text-xs`,placeholder:`inputs.enabled`,"aria-invalid":_.value&&_.value.startsWith(`when`)?!0:void 0,"model-value":a.value.when??``,"onUpdate:modelValue":r[12]||=e=>w(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),U(`label`,fX,[r[34]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),M(z(Mv),{size:`sm`,"model-value":a.value.on_failure??``,"onUpdate:modelValue":r[13]||=e=>w(`on_failure`,String(e)||void 0)},{default:j(()=>[M(z(Nv),{value:``},{default:j(()=>[...r[32]||=[A(`Park the task`,-1)]]),_:1}),M(z(Nv),{value:`continue`},{default:j(()=>[...r[33]||=[A(`Continue`,-1)]]),_:1})]),_:1},8,[`model-value`])]),U(`label`,pX,[r[35]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),M(z(Z),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 text-right text-[13px]`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[14]||=e=>T({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),U(`div`,mX,[U(`label`,{for:`${z(n)}-backoff`,class:`flex-1 text-[13px]`},`Retry backoff`,8,hX),M(z(mh),{id:`${z(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[15]||=e=>T({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])]),U(`footer`,gX,[M(z(Y),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:r[16]||=e=>i(`remove`)},{default:j(()=>[M(z(Ie)),r[38]||=A(`Delete step`,-1)]),_:1}),M(z(Y),{type:`button`,size:`sm`,class:`ml-auto`,onClick:r[17]||=e=>i(`close`)},{default:j(()=>[...r[39]||=[A(`Done`,-1)]]),_:1})])]))}}),vX=`repository_path`;function yX(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:vX,path:n.trim(),type:`string`,required:!0}),r}function bX(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function xX(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=bX(wb(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 SX(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:wb(e.value,i.type??`string`)})}return n}function CX(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 wX(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...wX(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...wX(n,r)]}):[]}function TX(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function EX(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 DX(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var OX={class:`flex h-full flex-col`},kX={class:`flex items-center gap-2 border-b border-border px-4 py-3`},AX={class:`min-w-0 flex-1 truncate text-sm font-medium`},jX={key:0,class:`flex flex-1 items-center justify-center`},MX={class:`space-y-1.5`},NX={key:1,class:`space-y-1.5`},PX=[`title`],FX={class:`space-y-1.5`},IX={id:`bind-paths`},LX=[`value`],RX={class:`divide-y divide-border rounded-md border border-border`},zX={class:`flex items-center gap-1.5 text-xs`},BX={class:`font-mono`},VX={class:`text-fg-subtle`},HX={key:0,class:`text-danger`,title:`Required`},UX={key:2,class:`text-xs text-danger`},WX=[`title`],GX={key:0,class:`space-y-1 px-3 py-2`},KX={key:0,class:`text-xs text-danger`},qX={key:1,class:`truncLine truncated
`,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=gJ(hJ(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=gJ(hJ(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 bJ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new dJ||null,prettyErrors:t}}function xJ(e,t={}){let{lineCounter:n,prettyErrors:r}=bJ(t),i=new yJ(n?.addNewLine),a=new Zq(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 mq(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(gq(e,n)),o.warnings.forEach(gq(e,n))),o}function SJ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=xJ(e,n);if(!i)return null;if(i.warnings.forEach(e=>KG(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 CJ(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 VW(e)&&!r?e.toString(n):new dq(e,r,n).toString(n)}var wJ=e=>typeof e==`object`&&!!e&&!Array.isArray(e),TJ=e=>wJ(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function EJ(e){if(wJ(e)){if(wJ(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:TJ(e.parallel)};if(wJ(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:TJ(e.switch.cases)}}}function DJ(e){return e.slice(2).includes(`parallel`)}function OJ(e,t){let n=xJ(e).getIn(t,!0);if(HW(n))return n.toJSON()}function kJ(e,t,n){let r=xJ(e);return r.setIn(t,r.createNode(BJ(n))),r.toString()}function AJ(e,t,n){let r=xJ(e),i=t.slice(0,-1),a=DJ(i);if(a&&![`agent.run`,`workflow.call`].includes(n))throw Error(`Branches allow only read-only agents and workflow calls.`);let o=r.getIn(i,!0);if(GW(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!GW(o))return{source:e,path:[]};let s=Math.min(Math.max(Number(t.at(-1))+1,0),o.items.length),c=n===`parallel`?{parallel:{"branch-1":[],"branch-2":[]}}:n===`switch`?{switch:{on:``,cases:{true:[],default:[]}}}:{type:n,...a&&n===`agent.run`?{settings:{read_only:!0}}:{}};return o.items.splice(s,0,r.createNode(c)),{source:r.toString(),path:[...i,s]}}function jJ(e,t){if(t===`switch`){if(!e||e.includes(`/`))throw Error(`A case is the value it matches, without a slash.`)}else if(!/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/.test(e))throw Error(`Use a lowercase branch name with letters, digits, dots or dashes.`)}function MJ(e,t){let n=e.getIn(t,!0),r=EJ(HW(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!HW(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function NJ(e,t,n){let r=xJ(e),{kind:i,branches:a}=MJ(r,t);if(jJ(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function PJ(e,t,n,r){let i=xJ(e),{kind:a,branches:o}=MJ(i,t);if(jJ(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>WW(e.key)&&e.key.value===n);if(!s||!WW(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function FJ(e,t,n){let r=xJ(e),{kind:i,branches:a}=MJ(r,t);if(i===`parallel`&&a.items.length<=2)throw Error(`Parallel needs at least two branches.`);if(a.items.length<=1)throw Error(`A switch needs at least one case.`);return Line truncated
`).find(e=>e.trim())?.trim()}}function eY(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(XJ)].map(e=>e[1]))]}function tY(e){let t=xJ(e).toJS(),n=ZJ(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=new Set,c=`start`;r.push({id:c,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let l=[c],u=1,d=new Map,f=e=>{let t=d.get(e)??0;return d.set(e,t+1),t},p=(e,t,n,i,s,c,l,u)=>{let d=ZJ(e)?e:{},p=EJ(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=ZJ(d.settings)?d.settings:{},g=typeof d.id==`string`?d.id:``,_=`step-${t}`,v=s?`${s}/${g||m}`:g||m;r.push({id:_,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:g||t,title:g||YJ(m),type:m,role:UJ(m),step:l?.length===2?String(Number(l[1])+1).padStart(2,`0`):void 0,detail:p?.on?`on ${p.on.replace(/^steps\./,``)}`:QJ(m,h),summary:$J(h),when:typeof d.when==`string`?d.when:void 0,retry:ZJ(d.retry)&&typeof d.retry.attempts==`number`?d.retry.attempts:void 0,continues:d.on_failure===`continue`,branch:s,lane:u,path:l,stage:v,occurrence:f(v),...c?{resume:c}:{}}}),g&&a.set(g,_);let y=p?.on?`{{ ${p.on} }}`:``;for(let e of eY([d.settings,y],d.when))o.push({from:e,to:_});return _},m=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,...s.has(r)?{otherwise:!0}:{},insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){let n=EJ(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*KJ,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=ZJ(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=0;o.forEach(([t,n],o)=>{let s=(o-(h-1)/2)*qJ,l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*KJ,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]}),_=Math.max(_,n.length);let v=`add-${e}-${t}`;r.push({id:v,type:`add`,position:{x:s+104,y:(u+n.length)*KJ},data:{kind:`step`,key:v,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,v),g.push(v)});let v=(Math.max(_,1)+1)*KJ-24;o.forEach(([t],n)=>{let a=(n-(h-1)/2)*qJ;r.push({id:`lane-${e}-${t}`,type:`lane`,position:{x:a-12,y:u*KJ-40},style:{width:`264px`,height:`${v}px`},zIndex:-1,data:{kind:`step`,key:t,title:t,type:``,detail:``,lane:i}})}),f&&(g.push(c),s.add(c)),l=g,u+=Math.max(_,1)+1;continue}let i=p(t,String(e+1),0,u*KJ,void 0,void 0,[`steps`,e]);m(l,i,[`steps`,e-1]),l=[i],u++}r.push({id:`add-end`,type:`add`,position:{x:104,y:u*KJ-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``,insertAfter:[`steps`,n.length-1]}}),m(l,`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 nY={agent:Ts,command:pc,repo:Vs,gate:lc,forge:Ys,human:gc,review:Rs,workflow:yc},rY={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function iY(e){return e===`parallel`?Vs:e===`switch`?dc:nY[e.split(`.`)[0]]??yc}function aY(e){return Object.keys(rY).map(t=>({title:rY[t],icon:nY[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}var oY=k({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{}},emits:[`pick`],setup(e,{emit:t}){let n=t;return(t,r)=>(R(),K(z(bl),{"model-value":e.value||void 0,"onUpdate:modelValue":r[0]||=e=>n(`pick`,String(e))},{default:j(()=>[M(z(Dl),{"aria-label":e.label},{default:j(()=>[M(z(Ol),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`]),M(z(xl),null,{default:j(()=>[e.value&&!e.workflows.some(t=>t.id===e.value)?(R(),K(z(wl),{key:0,value:e.value,disabled:``},{default:j(()=>[A(B(e.value)+` (unavailable)`,1)]),_:1},8,[`value`])):L(``,!0),(R(!0),W(V,null,G(e.workflows,e=>(R(),K(z(wl),{key:e.id,value:e.id},{default:j(()=>[A(B(e.id),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`]))}});function sY(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function cY(e,t=[]){let n=xJ(e),r=n.errors[0];if(r)return{ok:!1,message:CY(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!wY(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let o=i.steps;if(o==null||o===``)return{ok:!1,message:`workflow ${a} has no steps`};if(!Array.isArray(o))return{ok:!1,message:`workflow ${a}: steps must be a list`};if(!o.length)return{ok:!1,message:`workflow ${a} has no steps`};let s=new Map(t.map(e=>[e.name,e])),c=typeof i.repository==`string`&&i.repository.trim()?i.repository.trim():`required`,l=[],u=new Set;for(let[e,t]of o.entries()){let n=`workflow ${a} step ${e+1}`,r=fY(t);if(r)return{ok:!1,message:`${n}: ${r}`};let i=EJ(t);if(i){if(i.kind===`sLine truncated
`).map((e,t)=>({number:t+1,text:e,tokens:yY(e)}))}var _Y=/^(\s*)(-\s+)?/,vY=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function yY(e){let{code:t,comment:n}=bY(e),r=xY(t);return n&&r.push({text:n,kind:`comment`}),r}function bY(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t)r===t&&(t=``);else if(r===`"`||r===`'`)t=r;else if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function xY(e){if(!e)return[];let t=[],n=_Y.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=vY.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,...SY(i[4]??``)]):[...t,...SY(r)]}function SY(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 CY(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function wY(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function TY(e){return typeof e==`string`&&e.trim()!==``}var EY={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},DY={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},OY={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},kY={class:`min-w-0 flex-1`},AY={class:`truncate font-mono text-[11px] text-fg-subtle`},jY={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},MY={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},NY={key:1,class:`space-y-3`},PY={key:0,class:`block space-y-1.5`},FY={id:`switch-on`},IY=[`value`],LY={class:`text-xs font-medium text-muted-foreground`},RY={class:`flex items-center gap-2`},zY={key:1,role:`alert`,class:`text-xs text-danger`},BY={key:2,class:`space-y-1.5`},VY=[`title`],HY={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},UY={key:3,class:`divide-y divide-border rounded-md border border-border`},WY=[`title`],GY={key:0,class:`space-y-3`},KY={class:`text-[13px]`},qY={key:0,class:`text-danger`},JY={class:`ml-2 text-xs text-fg-subtle`},YY={key:1,class:`space-y-3`},XY={class:`text-[13px]`},ZY={class:`ml-2 text-xs text-fg-subtle`},QY=[`title`],$Y={key:0,class:`text-xs text-danger`},eX={class:`space-y-2`},tX={key:0,role:`alert`,class:`text-xs text-danger`},nX={class:`divide-y divide-border rounded-md border border-border`},rX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},iX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},aX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},oX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},sX=[`for`],cX={class:`flex items-center border-t border-border px-4 py-2.5`},lX=k({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=Ue(),r=e,i=t,a=I(()=>OJ(r.yaml,r.path)??{}),o=I(()=>EJ(a.value)),s=I(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=I(()=>o.value?.branches.map(([e])=>e)??[]),l=I(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,kJ(r.yaml,r.path,{...a.value,switch:{...a.value.switch,on:e}}))}let d=q(``),f=q(``);function p(e,t,n=``){try{let a=e===`add`?NJ(r.yaml,r.path,t):e===`rename`?PJ(r.yaml,r.path,t,n):FJ(r.yaml,r.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=I(()=>r.vocabulary.find(e=>e.name===s.value)),h=I(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=I(()=>zJ(r.yaml,r.path)),_=I(()=>fY(a.value)),v=I(()=>m.value?.settings&&a.value.settings?mY(a.value.settings,m.value.settings,`settings`):``),y=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],b=/mission|body|detail|plan|rules/;function x(e,t){return[`workflow.call`,`workflow.handoff`].includes(s.value)&&e===`workflow`||s.value===`human.approve`&&e===`then`?`workflow`:s.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:b.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 S=I(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:x(e,t),options:s.value===`agent.run`&&e===`model`?r.modelAliases:t.enum??[]})),t=e.filter(e=>y.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>y.indexOf(e.key)-y.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function C(e){let{id:t,type:n,...a}=e;i(`update:yaml`,kJ(r.yaml,r.path,{id:t,type:n,...a}))}function w(e,t){C({...a.value,[e]:t})}function ee(e){let t={...a.value.retry,...e};w(`retry`,t.attempts===void 0&&!t.backoff?void 0:{...t,attempts:t.attempts??1})}function te(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,C({...a.value,settings:n})}function T(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),C({...a.value,settings:n})}let E=I(()=>r.workflows.find(e=>e.id===h.value.workflow)),ne=I(()=>Object.entries(VJ(E.value?.yaml??``,`inputs`)??{})),re=I(()=>Object.entries(VJ(E.value?.yaml??``,`outputs`)??{})),ie=I(()=>Object.entries(VJ(r.yaml,`inputs`)??{})),ae=I(()=>Object.entries(VJ(r.yaml,`outputs`)??{})),D=I(()=>h.value.inputs??{}),O=I(()=>h.value.outputs??{}),oe=e=>typeof e==`string`&&e.startsWith(`inputs.`),se=e=>D.value[e]===void 0?``:String(D.value[e]);function ce(e,t,n){te(`inputs`,{...D.value,[e]:t===``?void 0:oe(t)?t:Lv(t,n??`string`)})}let le=q(null);function ue(e,t){let n=le.value??S.value.lead?.key;if(!n)return;let r=typeof h.value[n]==`string`?h.value[n]:`Line truncated
`)[0]}}}let pe=e=>e===void 0?``:CJ(e).trimEnd(),me=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),he=e=>typeof h.value[e]==`string`?h.value[e]:``;return(t,r)=>(R(),W(`aside`,EY,[U(`header`,DY,[U(`span`,OY,[(R(),K(Qe(z(iY)(s.value)),{class:`size-4`}))]),U(`div`,kY,[M(z(Z),{"model-value":a.value.id??``,class:`h-7 truncate border-transparent px-1 font-medium shadow-none hover:border-input dark:bg-transparent`,placeholder:z(YJ)(s.value),"aria-label":`Step id`,"onUpdate:modelValue":r[0]||=e=>w(`id`,String(e))},null,8,[`model-value`,`placeholder`]),U(`div`,AY,B(s.value),1)]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:r[1]||=e=>i(`close`)},{default:j(()=>[M(z(xc))]),_:1})]),U(`div`,jY,[v.value?(R(),W(`p`,MY,B(v.value),1)):L(``,!0),o.value?(R(),W(`section`,NY,[s.value===`switch`?(R(),W(`label`,PY,[r[18]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),M(z(Z),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`switch-on`,onChange:r[2]||=e=>u(e.target.value.trim())},null,8,[`model-value`]),U(`datalist`,FY,[(R(!0),W(V,null,G(g.value,e=>(R(),W(`option`,{key:e,value:`steps.${e}.result.`},null,8,IY))),128))])])):L(``,!0),U(`div`,LY,B(s.value===`switch`?`Cases`:`Branches`),1),(R(!0),W(V,null,G(c.value,e=>(R(),W(`div`,{key:e,class:`flex items-center gap-2`},[M(z(Z),{"model-value":e,class:N(s.value===`switch`&&`font-mono`),"aria-label":`${s.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>p(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:j(()=>[M(z(Ne))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),U(`div`,RY,[M(z(Z),{modelValue:d.value,"onUpdate:modelValue":r[3]||=e=>d.value=e,"aria-label":s.value===`switch`?`New case value`:`New branch name`,placeholder:s.value===`switch`?`Value, or default`:`Branch name`,onKeydown:r[4]||=kt(jt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),M(z(Y),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:r[5]||=e=>p(`add`,d.value.trim())},{default:j(()=>[M(z(nc))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(R(),W(`p`,zY,B(f.value),1)):L(``,!0)])):L(``,!0),S.value.lead?(R(),W(`section`,BY,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:S.value.lead.schema.description},[A(B(me(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(R(),K(z(Ns),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,VY),S.value.lead.kind===`workflow`?(R(),K(oY,{key:0,value:he(S.value.lead.key),workflows:e.workflows,label:me(S.value.lead.key,S.value.lead.schema),onPick:r[6]||=e=>T(S.value.lead.key,e)},null,8,[`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(R(),K(z(Av),{key:1,size:`sm`,class:`w-full`,"model-value":he(S.value.lead.key),"onUpdate:modelValue":r[7]||=e=>te(S.value.lead.key,String(e)||void 0)},{default:j(()=>[M(z(jv),{value:``},{default:j(()=>[...r[19]||=[A(`Default`,-1)]]),_:1}),(R(!0),W(V,null,G(S.value.lead.options,e=>(R(),K(z(jv),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`model-value`])):S.value.lead.kind===`text`?(R(),K(z(Gl),{key:2,"model-value":he(S.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:r[8]||=e=>le.value=S.value.lead.key,"onUpdate:modelValue":r[9]||=e=>te(S.value.lead.key,String(e))},null,8,[`model-value`])):(R(),K(z(Z),{key:3,"model-value":he(S.value.lead.key),onFocus:r[10]||=e=>le.value=S.value.lead.key,"onUpdate:modelValue":r[11]||=e=>te(S.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&S.value.lead.kind!==`select`?(R(),W(`div`,HY,[r[20]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(R(!0),W(V,null,G(g.value,e=>(R(),W(V,{key:e},[M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>ue(e,`summary`)},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]),M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>ue(e,`result`)},{default:j(()=>[A(B(e)+`.result`,1)]),_:2},1032,[`onClick`])],64))),128))])):L(``,!0)])):L(``,!0),S.value.compact.length?(R(),W(`section`,UY,[(R(!0),W(V,null,G(S.value.compact,t=>(R(),W(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[U(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:t.schema.description},[A(B(me(t.key,t.schema))+` `,1),t.schema.description?(R(),K(z(Ns),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,WY),t.kind===`workflow`?(R(),K(oY,{key:0,class:`max-w-48`,value:he(t.key),workflows:e.workflows,label:me(t.key,t.schema),onPick:e=>T(t.key,e)},null,8,[`Line truncated
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>te(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(R(),W(V,{key:2},[M(z(Gl),{"model-value":pe(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>fe(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),de.value[e.key]?(R(),W(`span`,$Y,B(de.value[e.key]),1)):L(``,!0)],64))]))),128)),U(`section`,eX,[r[36]||=U(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),r[37]||=U(`p`,{class:`text-xs text-fg-muted`},`Leave the condition empty to always run. Use a field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true.`,-1),_.value?(R(),W(`p`,tX,B(_.value),1)):L(``,!0),U(`div`,nX,[U(`label`,rX,[r[31]||=U(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),M(z(Z),{class:`h-7 w-48 font-mono text-xs`,placeholder:`inputs.enabled`,"aria-invalid":_.value&&_.value.startsWith(`when`)?!0:void 0,"model-value":a.value.when??``,"onUpdate:modelValue":r[12]||=e=>w(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),U(`label`,iX,[r[34]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),M(z(Av),{size:`sm`,"model-value":a.value.on_failure??``,"onUpdate:modelValue":r[13]||=e=>w(`on_failure`,String(e)||void 0)},{default:j(()=>[M(z(jv),{value:``},{default:j(()=>[...r[32]||=[A(`Park the task`,-1)]]),_:1}),M(z(jv),{value:`continue`},{default:j(()=>[...r[33]||=[A(`Continue`,-1)]]),_:1})]),_:1},8,[`model-value`])]),U(`label`,aX,[r[35]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),M(z(Z),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 text-right text-[13px]`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[14]||=e=>ee({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),U(`div`,oX,[U(`label`,{for:`${z(n)}-backoff`,class:`flex-1 text-[13px]`},`Retry backoff`,8,sX),M(z(fh),{id:`${z(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[15]||=e=>ee({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])]),U(`footer`,cX,[M(z(Y),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:r[16]||=e=>i(`remove`)},{default:j(()=>[M(z(Ne)),r[38]||=A(`Delete step`,-1)]),_:1}),M(z(Y),{type:`button`,size:`sm`,class:`ml-auto`,onClick:r[17]||=e=>i(`close`)},{default:j(()=>[...r[39]||=[A(`Done`,-1)]]),_:1})])]))}}),uX=`repository_path`;function dX(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:uX,path:n.trim(),type:`string`,required:!0}),r}function fX(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function pX(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=fX(vb(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 mX(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:vb(e.value,i.type??`string`)})}return n}function hX(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 gX(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...gX(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...gX(n,r)]}):[]}function _X(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function vX(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 yX(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var bX={class:`flex h-full flex-col`},xX={class:`flex items-center gap-2 border-b border-border px-4 py-3`},SX={class:`min-w-0 flex-1 truncate text-sm font-medium`},CX={key:0,class:`flex flex-1 items-center justify-center`},wX={class:`space-y-1.5`},TX={key:1,class:`space-y-1.5`},EX=[`title`],DX={class:`space-y-1.5`},OX={id:`bind-paths`},kX=[`value`],AX={class:`divide-y divide-border rounded-md border border-border`},jX={class:`flex items-center gap-1.5 text-xs`},MX={class:`font-mono`},NX={class:`text-fg-subtle`},PX={key:0,class:`text-danger`,title:`Required`},FX={key:2,class:`text-xs text-danger`},IX=[`title`],LX={key:0,class:`space-y-1 px-3 py-2`},RX={key:0,class:`text-xs text-danger`},zX={key:1,class:`truLine 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 n3(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=r3(n.code,e);return Array.isArray(e)?e.some(e=>t3(n[r],e,t,n.type===`keyup`)):t3(n[r],e,t,n.type===`keyup`)}}function r3(e,t){return t.includes(e)?`code`:`key`}function i3(e,t){let n=I(()=>We(t?.target)??Q4),r=$e(We(e)===!0),i=!1,a=new Set,o=c(We(e));F(()=>We(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),XZ([`blur`,`contextmenu`],s),QZ((...e)=>o(...e),e=>{let n=We(t?.actInsideInputWithModifier)??!0,a=We(t?.preventDefault)??!1;if(i=e3(e),(!i||i&&!n)&&$4(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}),QZ((...e)=>o(...e),e=>{let n=We(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&$4(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=We(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?n3(e,a):e}return r}var a3=`vue-flow__node-desc`,o3=`vue-flow__edge-desc`,s3=`vue-flow__aria-live`,c3=[`Enter`,` `,`Escape`],l3={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function u3(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function d3(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 f3(e){return{width:e.offsetWidth,height:e.offsetHeight}}function p3(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function m3(e,t){return{x:p3(e.x,t[0][0],t[1][0]),y:p3(e.y,t[0][1],t[1][1])}}function h3(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function g3(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function _3(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!g3(e)}function v3(e){return _3(e)&&`computedPosition`in e}function y3(e){return!Number.isNaN(e)&&Number.isFinite(e)}function b3(e){return y3(e.width)&&y3(e.height)&&y3(e.x)&&y3(e.y)}function x3(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:St({width:0,height:0}),computedPosition:St({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:R6(e.data)?e.data:{},events:St(R6(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function S3(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:R6(e.data)?e.data:{},events:St(R6(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function C3(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 w3(...e){if(e.length===3){let[t,n,r]=e;return C3(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>g3(e)&&e.source===r).map(e=>n.find(t=>_3(t)&&t.id===e.target))}function T3(...e){if(e.length===3){let[t,n,r]=e;return C3(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>g3(e)&&e.target===r).map(e=>n.find(t=>_3(t)&&t.id===e.source))}function E3({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function D3(e,t){return t.some(t=>g3(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 O3({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function k3({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?x6(s,o):s}function A3(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 j3({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function M3({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function N3(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=A3(t,j3({...r.computedPosition,...r.dimensions}))}return M3(t)}function P3(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...k3(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= Line truncated
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function J4(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=Y4(n.code,e);return Array.isArray(e)?e.some(e=>q4(n[r],e,t,n.type===`keyup`)):q4(n[r],e,t,n.type===`keyup`)}}function Y4(e,t){return t.includes(e)?`code`:`key`}function X4(e,t){let n=I(()=>Ve(t?.target)??W4),r=Xe(Ve(e)===!0),i=!1,a=new Set,o=c(Ve(e));F(()=>Ve(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),HZ([`blur`,`contextmenu`],s),WZ((...e)=>o(...e),e=>{let n=Ve(t?.actInsideInputWithModifier)??!0,a=Ve(t?.preventDefault)??!1;if(i=K4(e),(!i||i&&!n)&&G4(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}),WZ((...e)=>o(...e),e=>{let n=Ve(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&G4(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Ve(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?J4(e,a):e}return r}var Z4=`vue-flow__node-desc`,Q4=`vue-flow__edge-desc`,$4=`vue-flow__aria-live`,e3=[`Enter`,` `,`Escape`],t3={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function n3(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function r3(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 i3(e){return{width:e.offsetWidth,height:e.offsetHeight}}function a3(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function o3(e,t){return{x:a3(e.x,t[0][0],t[1][0]),y:a3(e.y,t[0][1],t[1][1])}}function s3(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function c3(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function l3(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!c3(e)}function u3(e){return l3(e)&&`computedPosition`in e}function d3(e){return!Number.isNaN(e)&&Number.isFinite(e)}function f3(e){return d3(e.width)&&d3(e.height)&&d3(e.x)&&d3(e.y)}function p3(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:yt({width:0,height:0}),computedPosition:yt({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:A6(e.data)?e.data:{},events:yt(A6(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function m3(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:A6(e.data)?e.data:{},events:yt(A6(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function h3(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 g3(...e){if(e.length===3){let[t,n,r]=e;return h3(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>c3(e)&&e.source===r).map(e=>n.find(t=>l3(t)&&t.id===e.target))}function _3(...e){if(e.length===3){let[t,n,r]=e;return h3(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>c3(e)&&e.target===r).map(e=>n.find(t=>l3(t)&&t.id===e.source))}function v3({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function y3(e,t){return t.some(t=>c3(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 b3({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function x3({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?p6(s,o):s}function S3(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 C3({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function w3({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function T3(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=S3(t,C3({...r.computedPosition,...r.dimensions}))}return w3(t)}function E3(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...x3(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= Line truncated
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
Node: ${e}
@@ -158,6 +158,6 @@ 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`},h6=class extends Error{constructor(e,...t){super(m6[e]?.call(m6,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function g6(e){return`clientX`in e}function _6(e){return`sourceEvent`in e}function v6(e,t){let n=g6(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 y6=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function b6(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function x6(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var S6=()=>!0;function C6(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function w6(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())d3(i,u3(e))>0&&r.push(e);return r}var T6=250;function E6(e,t,n,r){let i=[],a=1/0,o=w6(e,n,t+T6);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}=l6(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 D6(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=S6},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:_}=v6(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=O6(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===q4.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=j6(t,e,a,p,n,!0)}return b}function O6(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function k6(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function A6(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function j6(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===q4.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,...l6(o,c,c.position,!0)}:c}var M6={[W4.Left]:W4.Right,[W4.Right]:W4.Left,[W4.Top]:W4.Bottom,[W4.Bottom]:W4.Top},N6=[`production`,`prod`];function P6(e,...t){F6()&&console.warn(`[Vue Flow]: ${e}`,...t)}function F6(){return!N6.includes(`production`)}function I6(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,...f3(t)}}):null}function L6(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),bt(()=>{o.blur()})):n([e])}function R6(e){return z(e)!==void 0}function z6(e,t,n,r){if(!e||!e.source||!e.target)return n(new h6(p6.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=g3(e)?e:{...e,id:E3(e)},i=S3(i,void 0,r),!D3(i,t)&&i}function B6(e,t,n,r,i){if(!t.source||!t.target)return i(new h6(p6.EDGE_INVALID,e.id)),!1;if(!n)return i(new h6(p6.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?E3(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function V6(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!_3(o)){n(new h6(p6.NODE_INVALID,o?.id));continue}let s=x3(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 h6(p6.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 H6(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 U6(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}`;H6(`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`},s6=class extends Error{constructor(e,...t){super(o6[e]?.call(o6,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function c6(e){return`clientX`in e}function l6(e){return`sourceEvent`in e}function u6(e,t){let n=c6(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 d6=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function f6(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function p6(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var m6=()=>!0;function h6(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function g6(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())r3(i,n3(e))>0&&r.push(e);return r}var _6=250;function v6(e,t,n,r){let i=[],a=1/0,o=g6(e,n,t+_6);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}=t6(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 y6(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=m6},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:_}=u6(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=b6(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===z4.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=C6(t,e,a,p,n,!0)}return b}function b6(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function x6(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function S6(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function C6(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===z4.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,...t6(o,c,c.position,!0)}:c}var w6={[I4.Left]:I4.Right,[I4.Right]:I4.Left,[I4.Top]:I4.Bottom,[I4.Bottom]:I4.Top},T6=[`production`,`prod`];function E6(e,...t){D6()&&console.warn(`[Vue Flow]: ${e}`,...t)}function D6(){return!T6.includes(`production`)}function O6(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,...i3(t)}}):null}function k6(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),_t(()=>{o.blur()})):n([e])}function A6(e){return z(e)!==void 0}function j6(e,t,n,r){if(!e||!e.source||!e.target)return n(new s6(a6.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=c3(e)?e:{...e,id:v3(e)},i=m3(i,void 0,r),!y3(i,t)&&i}function M6(e,t,n,r,i){if(!t.source||!t.target)return i(new s6(a6.EDGE_INVALID,e.id)),!1;if(!n)return i(new s6(a6.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?v3(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function N6(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!l3(o)){n(new s6(a6.NODE_INVALID,o?.id));continue}let s=p3(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 s6(a6.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 P6(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 F6(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}`;P6(`source`,o,`${r}-${a}--Line truncated
`),r=t.split(`
`),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function o9(e){let t=kJ(e).toJS(),n=new Map;for(let r of lY(e).nodes){let{kind:e,path:i,stage:a,occurrence:o}=r.data;if(r.type!==`step`||e!==`step`||!i||a===void 0)continue;let s=t;for(let e of i)s=s?.[e];n.set(`${a}#${o??0}`,{node:r.id,signature:JSON.stringify(s??null)})}return n}function s9(e,t,n){let r=o9(e),i=o9(t),a={};for(let[e,t]of r){let r=i.get(e);r?r.signature!==t.signature&&(a[t.node]=`changed`):a[t.node]=n}return a}var c9={class:`grid h-[calc(100dvh-17rem)] min-h-[26rem] grid-cols-[18rem_1fr] gap-3`},l9={class:`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,"aria-label":`Revisions`},u9=[`aria-current`,`onClick`],d9={class:`flex items-center gap-2 text-sm`},f9={class:`font-mono text-xs text-fg-subtle`},p9=[`title`],m9={key:0,class:`px-3 py-2 text-sm text-muted-foreground`},h9={key:0,class:`flex min-h-0 flex-col gap-2`},g9={class:`flex items-center gap-2`},_9={class:`text-xs text-muted-foreground`},v9={key:0,class:`rounded-lg border border-border p-4 text-sm text-muted-foreground`},y9={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},b9={class:`inline-block w-4 select-none text-fg-subtle`},x9={key:2,class:`grid min-h-0 flex-1 grid-cols-2 gap-3`},S9={class:`flex min-h-0 flex-col gap-1`},C9={class:`text-xs font-medium text-muted-foreground`},w9={class:`min-h-0 flex-1`},T9={class:`flex min-h-0 flex-col gap-1`},E9={class:`min-h-0 flex-1`},D9=k({__name:`WorkflowHistory`,props:gt({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:gt([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=qe(e,`selected`),a=qe(e,`mode`);F(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=I(()=>n.revisions.find(e=>e.version===i.value)),s=I(()=>o.value?.yaml??null),c=I(()=>s.value===null?[]:a9(s.value,n.current)),l=I(()=>s.value!==null&&s.value===n.current),u=I(()=>s.value===null?{}:s9(s.value,n.current,`removed`)),d=I(()=>s.value===null?{}:s9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(R(),W(`div`,c9,[U(`ol`,l9,[(R(!0),W(V,null,G(e.revisions,e=>(R(),W(`li`,{key:e.version},[U(`button`,{type:`button`,class:N([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[U(`span`,d9,[U(`span`,f9,`v`+B(e.version),1),M(z(tn),{variant:f[e.change]},{default:j(()=>[A(B(e.change),1)]),_:2},1032,[`variant`])]),U(`span`,{class:`mt-0.5 block truncate text-xs text-muted-foreground`,title:e.at},B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `+B(z(Cg)(e.at)),9,p9)],10,u9)]))),128)),e.revisions.length?L(``,!0):(R(),W(`li`,m9,B(e.error||`No recorded changes`),1))]),o.value?(R(),W(`div`,h9,[U(`div`,g9,[M(z(db),{modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e},{default:j(()=>[M(z(pb),null,{default:j(()=>[M(z(mb),{value:`yaml`},{default:j(()=>[...n[2]||=[A(`YAML`,-1)]]),_:1}),M(z(mb),{value:`canvas`},{default:j(()=>[...n[3]||=[A(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),U(`span`,_9,B(l.value?`Same as the current definition`:`Compared with the current definition`),1),M(z(Y),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[1]||=e=>r(`restore`,s.value)},{default:j(()=>[M(z(cc),{"data-icon":`inline-start`}),n[4]||=A(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(R(),W(`p`,v9,`Workflow removed in this revision.`)):a.value===`yaml`?(R(),W(`pre`,y9,[U(`code`,null,[(R(!0),W(V,null,G(c.value,(e,t)=>(R(),W(`span`,{key:t,class:N([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-ok/10":e.kind===`add`,"bg-danger/10 text-danger":e.kind===`del`}])},[U(`span`,b9,B(e.kind===`add`?`+`:e.kind===`del`?`-`:``),1),A(B(e.text),1)],2))),128))])])):(R(),W(`div`,x9,[U(`div`,S9,[U(`span`,C9,`v`+B(o.value.version),1),U(`div`,w9,[M(t9,{yaml:s.value,marks:u.value},null,8,[`yaml`,`marks`])])]),U(`div`,T9,[n[5]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`},`Current`,-1),U(`div`,E9,[M(t9,{yaml:e.current,marks:d.value},null,8,[`yaml`,`marks`])])])]))])):L(``,!0)]))}}),O9=`workflow-definitions`;function k9(e){let t=O(),n=q([]),r=q(``);async function i(){try{n.value=await t.history(O9),r.value=``}c Line truncated
`),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function Q7(e){let t=xJ(e).toJS(),n=new Map;for(let r of tY(e).nodes){let{kind:e,path:i,stage:a,occurrence:o}=r.data;if(r.type!==`step`||e!==`step`||!i||a===void 0)continue;let s=t;for(let e of i)s=s?.[e];n.set(`${a}#${o??0}`,{node:r.id,signature:JSON.stringify(s??null)})}return n}function $7(e,t,n){let r=Q7(e),i=Q7(t),a={};for(let[e,t]of r){let r=i.get(e);r?r.signature!==t.signature&&(a[t.node]=`changed`):a[t.node]=n}return a}var e9={class:`grid h-[calc(100dvh-17rem)] min-h-[26rem] grid-cols-[18rem_1fr] gap-3`},t9={class:`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,"aria-label":`Revisions`},n9=[`aria-current`,`onClick`],r9={class:`flex items-center gap-2 text-sm`},i9={class:`font-mono text-xs text-fg-subtle`},a9=[`title`],o9={key:0,class:`px-3 py-2 text-sm text-muted-foreground`},s9={key:0,class:`flex min-h-0 flex-col gap-2`},c9={class:`flex items-center gap-2`},l9={class:`text-xs text-muted-foreground`},u9={key:0,class:`rounded-lg border border-border p-4 text-sm text-muted-foreground`},d9={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},f9={class:`inline-block w-4 select-none text-fg-subtle`},p9={key:2,class:`grid min-h-0 flex-1 grid-cols-2 gap-3`},m9={class:`flex min-h-0 flex-col gap-1`},h9={class:`text-xs font-medium text-muted-foreground`},g9={class:`min-h-0 flex-1`},_9={class:`flex min-h-0 flex-col gap-1`},v9={class:`min-h-0 flex-1`},y9=k({__name:`WorkflowHistory`,props:pt({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:pt([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=We(e,`selected`),a=We(e,`mode`);F(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=I(()=>n.revisions.find(e=>e.version===i.value)),s=I(()=>o.value?.yaml??null),c=I(()=>s.value===null?[]:Z7(s.value,n.current)),l=I(()=>s.value!==null&&s.value===n.current),u=I(()=>s.value===null?{}:$7(s.value,n.current,`removed`)),d=I(()=>s.value===null?{}:$7(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(R(),W(`div`,e9,[U(`ol`,t9,[(R(!0),W(V,null,G(e.revisions,e=>(R(),W(`li`,{key:e.version},[U(`button`,{type:`button`,class:N([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[U(`span`,r9,[U(`span`,i9,`v`+B(e.version),1),M(z(Qt),{variant:f[e.change]},{default:j(()=>[A(B(e.change),1)]),_:2},1032,[`variant`])]),U(`span`,{class:`mt-0.5 block truncate text-xs text-muted-foreground`,title:e.at},B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `+B(z(xg)(e.at)),9,a9)],10,n9)]))),128)),e.revisions.length?L(``,!0):(R(),W(`li`,o9,B(e.error||`No recorded changes`),1))]),o.value?(R(),W(`div`,s9,[U(`div`,c9,[M(z(ab),{modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e},{default:j(()=>[M(z(sb),null,{default:j(()=>[M(z(cb),{value:`yaml`},{default:j(()=>[...n[2]||=[A(`YAML`,-1)]]),_:1}),M(z(cb),{value:`canvas`},{default:j(()=>[...n[3]||=[A(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),U(`span`,l9,B(l.value?`Same as the current definition`:`Compared with the current definition`),1),M(z(Y),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[1]||=e=>r(`restore`,s.value)},{default:j(()=>[M(z(ac),{"data-icon":`inline-start`}),n[4]||=A(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(R(),W(`p`,u9,`Workflow removed in this revision.`)):a.value===`yaml`?(R(),W(`pre`,d9,[U(`code`,null,[(R(!0),W(V,null,G(c.value,(e,t)=>(R(),W(`span`,{key:t,class:N([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-ok/10":e.kind===`add`,"bg-danger/10 text-danger":e.kind===`del`}])},[U(`span`,f9,B(e.kind===`add`?`+`:e.kind===`del`?`-`:``),1),A(B(e.text),1)],2))),128))])])):(R(),W(`div`,p9,[U(`div`,m9,[U(`span`,h9,`v`+B(o.value.version),1),U(`div`,g9,[M(q7,{yaml:s.value,marks:u.value},null,8,[`yaml`,`marks`])])]),U(`div`,_9,[n[5]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`},`Current`,-1),U(`div`,v9,[M(q7,{yaml:e.current,marks:d.value},null,8,[`yaml`,`marks`])])])]))])):L(``,!0)]))}}),b9=`workflow-definitions`;function x9(e){let t=D(),n=q([]),r=q(``);async function i(){try{n.value=await t.history(b9),r.value=``}c Line truncated
+1 -34
View File
@@ -1,25 +1,15 @@
<script setup lang="ts">
import { firstLine } from "./first-line";
import { computed, onMounted, ref, useId, watchEffect } from "vue";
import { ChevronRight } from "@lucide/vue";
import { RadioGroupItem, RadioGroupRoot } from "reka-ui";
import { Button } from "@/components/ui/button";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
import { Input } from "@/components/ui/input";
import { Kbd } from "@/components/ui/kbd";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { Spinner } from "@/components/ui/spinner";
import { Textarea } from "@/components/ui/textarea";
import { api } from "@/lib/api";
import { delivered } from "@/lib/delivered";
import { useOrgStore } from "@/stores/org";
import type { WorkflowDefinition, WorkflowStats } from "@/workflows/workflow-rows";
import {
declaredInputs,
@@ -55,21 +45,15 @@ onMounted(async () => {
}
});
const identities = useOrgStore();
identities.watchIdentities();
const actors = computed(() => identities.identities.filter((i) => i.kind !== "system" && i.lifecycle === "active"));
const repository = ref("");
const workflow = ref(props.workflow ?? props.initialWorkflow ?? "");
const instructions = ref(props.initialInstructions ?? "");
const title = ref(firstLine(instructions.value));
const identity = ref("");
// One text field per declared input, by input name: the chosen workflow's
// declaration decides what is rendered and what the request carries.
const inputText = ref<Record<string, string>>({});
watchEffect(() => {
if (!workflow.value && definitions.value[0]) workflow.value = definitions.value[0].id;
if (!identity.value && actors.value[0]) identity.value = actors.value[0].id;
});
const selected = computed(() => definitions.value.find((d) => d.id === workflow.value));
@@ -82,13 +66,12 @@ const repoMode = computed(() => selected.value?.repository ?? "required");
const repoRequired = computed(() => repoMode.value !== "optional" && repoMode.value !== "none");
const statFor = (id: string) => stats.value.find((s) => s.workflow === id);
const identityName = computed(() => actors.value.find((a) => a.id === identity.value)?.display_name ?? "nobody");
const submitting = ref(false);
const error = ref("");
const ready = computed(
() =>
!!((repository.value.trim() || !repoRequired.value) && workflow.value && title.value.trim() && instructions.value.trim() && identity.value) &&
!!((repository.value.trim() || !repoRequired.value) && workflow.value && title.value.trim() && instructions.value.trim()) &&
missing.value.length === 0,
);
async function submit() {
@@ -97,7 +80,6 @@ async function submit() {
error.value = "";
try {
const result = await api.workRequest<{ task_id: number }>({
identity: identity.value,
repository: repoMode.value === "none" ? "" : repository.value.trim(),
workflow: workflow.value,
title: title.value.trim(),
@@ -189,21 +171,6 @@ async function submit() {
<Textarea :id="`${uid}-instr`" v-model="instructions" :rows="4" required />
</div>
<Collapsible>
<CollapsibleTrigger class="group flex items-center gap-1 text-xs text-fg-muted hover:text-foreground">
<ChevronRight class="size-3.5 transition-transform group-data-[state=open]:rotate-90" aria-hidden="true" />
Advanced · run as <span class="font-mono">{{ identityName }}</span>
</CollapsibleTrigger>
<CollapsibleContent class="pt-2">
<Select v-model="identity">
<SelectTrigger class="w-64" aria-label="Run as identity"><SelectValue placeholder="Choose an identity" /></SelectTrigger>
<SelectContent>
<SelectItem v-for="a in actors" :key="a.id" :value="a.id">{{ a.display_name }}</SelectItem>
</SelectContent>
</Select>
</CollapsibleContent>
</Collapsible>
<p v-if="error" class="text-sm text-danger" role="alert">{{ error }}</p>
<div class="flex items-center gap-2 border-t border-border pt-4">
<span class="mr-auto text-xs text-fg-subtle"><Kbd>⌘</Kbd> <Kbd>↵</Kbd> to start</span>