fix(eda): name a source's delivery header in the dashboard instead of a built-in sender list

This commit is contained in:
sam committed 2026-10-06 00:54:20 +11:00
1 parent a355f13a03
commit 0fc8535d87
24 files changed
+942 -667

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -112,6 +112,7 @@ const (
StateStoreService_SetSourceSigning_FullMethodName = "/state.v1.StateStoreService/SetSourceSigning"
StateStoreService_SetSourceSecret_FullMethodName = "/state.v1.StateStoreService/SetSourceSecret"
StateStoreService_SetSourceName_FullMethodName = "/state.v1.StateStoreService/SetSourceName"
StateStoreService_SetSourceDeliveryHeader_FullMethodName = "/state.v1.StateStoreService/SetSourceDeliveryHeader"
StateStoreService_DeleteSource_FullMethodName = "/state.v1.StateStoreService/DeleteSource"
StateStoreService_ArmedBindingsForSource_FullMethodName = "/state.v1.StateStoreService/ArmedBindingsForSource"
StateStoreService_RecordDispatch_FullMethodName = "/state.v1.StateStoreService/RecordDispatch"
@@ -318,6 +319,7 @@ type StateStoreServiceClient interface {
SetSourceSigning(ctx context.Context, in *SetSourceSigningRequest, opts ...grpc.CallOption) (*SetSourceSigningResponse, error)
SetSourceSecret(ctx context.Context, in *SetSourceSecretRequest, opts ...grpc.CallOption) (*SetSourceSecretResponse, error)
SetSourceName(ctx context.Context, in *SetSourceNameRequest, opts ...grpc.CallOption) (*SetSourceNameResponse, error)
SetSourceDeliveryHeader(ctx context.Context, in *SetSourceDeliveryHeaderRequest, opts ...grpc.CallOption) (*SetSourceDeliveryHeaderResponse, error)
DeleteSource(ctx context.Context, in *DeleteSourceRequest, opts ...grpc.CallOption) (*DeleteSourceResponse, error)
// Dispatch
ArmedBindingsForSource(ctx context.Context, in *ArmedBindingsForSourceRequest, opts ...grpc.CallOption) (*ArmedBindingsForSourceResponse, error)
@@ -1324,6 +1326,16 @@ func (c *stateStoreServiceClient) SetSourceName(ctx context.Context, in *SetSour
return out, nil
}
func (c *stateStoreServiceClient) SetSourceDeliveryHeader(ctx context.Context, in *SetSourceDeliveryHeaderRequest, opts ...grpc.CallOption) (*SetSourceDeliveryHeaderResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SetSourceDeliveryHeaderResponse)
err := c.cc.Invoke(ctx, StateStoreService_SetSourceDeliveryHeader_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *stateStoreServiceClient) DeleteSource(ctx context.Context, in *DeleteSourceRequest, opts ...grpc.CallOption) (*DeleteSourceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteSourceResponse)
@@ -1771,6 +1783,7 @@ type StateStoreServiceServer interface {
SetSourceSigning(context.Context, *SetSourceSigningRequest) (*SetSourceSigningResponse, error)
SetSourceSecret(context.Context, *SetSourceSecretRequest) (*SetSourceSecretResponse, error)
SetSourceName(context.Context, *SetSourceNameRequest) (*SetSourceNameResponse, error)
SetSourceDeliveryHeader(context.Context, *SetSourceDeliveryHeaderRequest) (*SetSourceDeliveryHeaderResponse, error)
DeleteSource(context.Context, *DeleteSourceRequest) (*DeleteSourceResponse, error)
// Dispatch
ArmedBindingsForSource(context.Context, *ArmedBindingsForSourceRequest) (*ArmedBindingsForSourceResponse, error)
@@ -2108,6 +2121,9 @@ func (UnimplementedStateStoreServiceServer) SetSourceSecret(context.Context, *Se
func (UnimplementedStateStoreServiceServer) SetSourceName(context.Context, *SetSourceNameRequest) (*SetSourceNameResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SetSourceName not implemented")
}
func (UnimplementedStateStoreServiceServer) SetSourceDeliveryHeader(context.Context, *SetSourceDeliveryHeaderRequest) (*SetSourceDeliveryHeaderResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SetSourceDeliveryHeader not implemented")
}
func (UnimplementedStateStoreServiceServer) DeleteSource(context.Context, *DeleteSourceRequest) (*DeleteSourceResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteSource not implemented")
}
@@ -3867,6 +3883,24 @@ func _StateStoreService_SetSourceName_Handler(srv interface{}, ctx context.Conte
return interceptor(ctx, in, info, handler)
}
func _StateStoreService_SetSourceDeliveryHeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetSourceDeliveryHeaderRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StateStoreServiceServer).SetSourceDeliveryHeader(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: StateStoreService_SetSourceDeliveryHeader_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StateStoreServiceServer).SetSourceDeliveryHeader(ctx, req.(*SetSourceDeliveryHeaderRequest))
}
return interceptor(ctx, in, info, handler)
}
func _StateStoreService_DeleteSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteSourceRequest)
if err := dec(in); err != nil {
@@ -4699,6 +4733,10 @@ var StateStoreService_ServiceDesc = grpc.ServiceDesc{
MethodName: "SetSourceName",
Handler: _StateStoreService_SetSourceName_Handler,
},
{
MethodName: "SetSourceDeliveryHeader",
Handler: _StateStoreService_SetSourceDeliveryHeader_Handler,
},
{
MethodName: "DeleteSource",
Handler: _StateStoreService_DeleteSource_Handler,
+15
View File
@@ -4,8 +4,11 @@ import (
"crypto/rand"
"encoding/hex"
"fmt"
"net/textproto"
"strings"
"github.com/google/uuid"
"golang.org/x/net/http/httpguts"
)
// NewPath returns a fresh UUIDv7 path: time-ordered, unguessable, and never
@@ -48,3 +51,15 @@ func unreserved(c byte) bool {
}
return c == '-' || c == '.' || c == '_' || c == '~'
}
// DeliveryHeader canonicalises a delivery header name; empty clears it.
func DeliveryHeader(name string) (string, error) {
name = strings.TrimSpace(name)
if name == "" {
return "", nil
}
if len(name) > MaxPathLen || !httpguts.ValidHeaderFieldName(name) {
return "", ErrInvalidHeader
}
return textproto.CanonicalMIMEHeaderKey(name), nil
}
+11 -5
View File
@@ -27,6 +27,8 @@ const MinSecretLen = 64
var (
// ErrInvalidPath refuses a custom path that is not URL-safe.
ErrInvalidPath = errors.New("source: path must be 1-128 URL-safe characters (A-Z a-z 0-9 - . _ ~), not a dot segment")
// ErrInvalidHeader refuses a delivery header that is not an HTTP field name.
ErrInvalidHeader = errors.New("source: delivery header must be an HTTP header name")
// ErrSigningTransition refuses an approval with no pending request.
ErrSigningTransition = errors.New("source: signing transition rejected")
)
@@ -37,11 +39,15 @@ var (
type Source struct {
Path string `json:"path"`
// Name is the operator's label; Path stays the source's identity.
Name string `json:"name,omitempty"`
Signing Signing `json:"signing"`
Secret string `json:"secret,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `json:"name,omitempty"`
// DeliveryHeader is the header the sender repeats unchanged on every
// retry of one delivery, so a retry dispatches no second run. Empty
// counts every arrival as its own delivery.
DeliveryHeader string `json:"delivery_header,omitempty"`
Signing Signing `json:"signing"`
Secret string `json:"secret,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// New builds a signed source with a generated secret. An empty customPath
@@ -249,6 +249,7 @@ type SourceStore interface {
SetSourceSigning(ctx context.Context, path string, from, to source.Signing) error
SetSourceSecret(ctx context.Context, path, secret string) error
SetSourceName(ctx context.Context, path, name string) error
SetSourceDeliveryHeader(ctx context.Context, path, header string) error
// DeleteSource refuses with ErrSourceInUse while an armed binding fires
// on the source.
DeleteSource(ctx context.Context, path string) error
@@ -367,8 +368,8 @@ type CapturedEvent struct {
// It dispatches without Authenticated and is flagged wherever it shows.
Unsigned bool `json:"unsigned"`
// Delivery names the sender's delivery; a retry of one delivery shares
// it, so a binding dispatches each delivery once. Intake sets the
// sender's delivery ID; the store fills the capture ID when it is empty.
// it, so a binding dispatches each delivery once. Intake sets it from the
// source's delivery header; the store fills the capture ID when empty.
Delivery string `json:"delivery"`
}
@@ -133,7 +133,7 @@ func (rc *Receiver) ServeHTTP(w http.ResponseWriter, r *http.Request) {
Body: string(redactedBody),
Authenticated: authenticated,
Unsigned: unsigned,
Delivery: deliveryID(r.Header),
Delivery: deliveryID(src, r.Header),
}
id, err := rc.Captures.InsertCapture(r.Context(), c, rc.Retention, rc.MaxEvents)
if err != nil {
@@ -208,29 +208,18 @@ func verify(src *source.Source, h http.Header, body []byte) (authenticated, unsi
return webhookguard.VerifyHMAC(body, sig, src.Secret), false
}
// deliveryHeaders carry a sender's ID for one delivery, repeated unchanged on
// every retry of it: GitHub, Gitea, Gogs, GitLab, Standard Webhooks, and the
// generic idempotency key.
var deliveryHeaders = []string{
"X-GitHub-Delivery", "X-Gitea-Delivery", "X-Gogs-Delivery",
"X-Gitlab-Event-UUID", "Webhook-Id", "Idempotency-Key",
}
// deliveryID is the sender's delivery ID, or empty when it sends none and
// each arrival counts as its own delivery.
func deliveryID(h http.Header) string {
for _, name := range deliveryHeaders {
if id := strings.TrimSpace(h.Get(name)); id != "" {
return name + ":" + id
}
// deliveryID is the value of src's delivery header, or empty when the source
// names none or the sender omitted it, so the arrival is its own delivery.
func deliveryID(src *source.Source, h http.Header) string {
if src == nil || src.DeliveryHeader == "" {
return ""
}
return ""
return strings.TrimSpace(h.Get(src.DeliveryHeader))
}
// formPayload turns a form-encoded delivery into JSON so it types and maps
// like a JSON one. A payload field holding JSON (GitHub's and Slack's form
// shape) is the event itself; any other form becomes an object of its fields,
// first value per name.
// formPayload turns a form-encoded delivery into a JSON object of its fields,
// first value per name, so it types and maps like a JSON one. A field whose
// value is a JSON object or array is nested as that structure.
func formPayload(contentType string, body []byte) ([]byte, bool) {
mt, _, err := mime.ParseMediaType(contentType)
if err != nil || mt != "application/x-www-form-urlencoded" {
@@ -240,17 +229,24 @@ func formPayload(contentType string, body []byte) ([]byte, bool) {
if err != nil {
return nil, false
}
if payload := form.Get("payload"); json.Valid([]byte(payload)) {
return []byte(payload), true
}
fields := make(map[string]string, len(form))
fields := make(map[string]any, len(form))
for name := range form {
fields[name] = form.Get(name)
fields[name] = formValue(form.Get(name))
}
out, err := json.Marshal(fields)
return out, err == nil
}
func formValue(value string) any {
trimmed := strings.TrimSpace(value)
if strings.HasPrefix(trimmed, "{") || strings.HasPrefix(trimmed, "[") {
if json.Valid([]byte(trimmed)) {
return json.RawMessage(trimmed)
}
}
return value
}
func (rc *Receiver) logger() *slog.Logger {
if rc.Log == nil {
return slog.New(slog.DiscardHandler)
@@ -6,16 +6,16 @@ import (
)
func TestFormPayload(t *testing.T) {
json := `{"ref":"refs/heads/main"}`
object := `{"ref":"refs/heads/main"}`
tests := []struct {
name, contentType, body, want string
ok bool
}{
{"github form", "application/x-www-form-urlencoded", "payload=" + url.QueryEscape(json), json, true},
{"json passes through", "application/json", json, "", false},
{"github form with charset", "application/x-www-form-urlencoded; charset=utf-8", "payload=" + url.QueryEscape(json), json, true},
{"plain form", "application/x-www-form-urlencoded", "a=b&a=c&n=1", `{"a":"b","n":"1"}`, true},
{"payload not json", "application/x-www-form-urlencoded", "payload=nope", `{"payload":"nope"}`, true},
{"json field nests", "application/x-www-form-urlencoded", "payload=" + url.QueryEscape(object), `{"payload":{"ref":"refs/heads/main"}}`, true},
{"charset parameter", "application/x-www-form-urlencoded; charset=utf-8", "a=b", `{"a":"b"}`, true},
{"first value per name", "application/x-www-form-urlencoded", "a=b&a=c&n=1", `{"a":"b","n":"1"}`, true},
{"invalid json stays text", "application/x-www-form-urlencoded", "a=%7Bnope", `{"a":"{nope"}`, true},
{"json passes through", "application/json", object, "", false},
{"malformed form", "application/x-www-form-urlencoded", "a=%zz", "", false},
}
for _, tt := range tests {
@@ -116,7 +116,7 @@ func TestRedeliveryDispatchesOnce(t *testing.T) {
return id
}
original, retry := capture("X-GitHub-Delivery:abc"), capture("X-GitHub-Delivery:abc")
original, retry := capture("delivery-1"), capture("delivery-1")
assertUndispatched(t, eda, 2)
if err := eda.RecordDispatch(ctx, bindingID, 1, original, 0, ""); err != nil {
t.Fatal(err)
@@ -126,7 +126,7 @@ func TestRedeliveryDispatchesOnce(t *testing.T) {
}
assertUndispatched(t, eda, 0)
capture("X-GitHub-Delivery:def")
capture("delivery-2")
capture("")
assertUndispatched(t, eda, 2)
captures, err := eda.ListCaptures(ctx, 10)
@@ -1,10 +1,14 @@
-- captures.delivery names the sender's delivery: its delivery ID header when
-- it sends one, else the capture itself. A retry of one delivery shares it, so
-- sources.delivery_header names the header a source's sender repeats on every
-- retry of one delivery. captures.delivery names the delivery: that header's
-- value when the source sets one and the sender sent it, else the capture
-- itself. A retry of one delivery shares it, so
-- binding_dispatches keyed on it dispatches each delivery once however many
-- times it arrives.
-- +goose Up
ALTER TABLE sources ADD COLUMN delivery_header text NOT NULL DEFAULT '';
ALTER TABLE captures ADD COLUMN delivery text NOT NULL DEFAULT '';
UPDATE captures SET delivery = id;
@@ -19,3 +23,4 @@ DROP INDEX idx_binding_dispatch_once;
CREATE UNIQUE INDEX idx_binding_dispatch_once ON binding_dispatches (binding, capture);
ALTER TABLE binding_dispatches DROP COLUMN delivery;
ALTER TABLE captures DROP COLUMN delivery;
ALTER TABLE sources DROP COLUMN delivery_header;
@@ -357,7 +357,7 @@ func (q *Queries) GetMapping(ctx context.Context, id string) (GetMappingRow, err
}
const getSource = `-- name: GetSource :one
SELECT path, signing, secret, created_at, updated_at, org_id, workspace_id, name FROM sources WHERE path = $1
SELECT path, signing, secret, created_at, updated_at, org_id, workspace_id, name, delivery_header FROM sources WHERE path = $1
`
func (q *Queries) GetSource(ctx context.Context, path string) (Source, error) {
@@ -372,6 +372,7 @@ func (q *Queries) GetSource(ctx context.Context, path string) (Source, error) {
&i.OrgID,
&i.WorkspaceID,
&i.Name,
&i.DeliveryHeader,
)
return i, err
}
@@ -860,7 +861,7 @@ func (q *Queries) ListMappings(ctx context.Context) ([]ListMappingsRow, error) {
}
const listSources = `-- name: ListSources :many
SELECT path, signing, secret, created_at, updated_at, org_id, workspace_id, name FROM sources ORDER BY created_at DESC, path
SELECT path, signing, secret, created_at, updated_at, org_id, workspace_id, name, delivery_header FROM sources ORDER BY created_at DESC, path
`
func (q *Queries) ListSources(ctx context.Context) ([]Source, error) {
@@ -881,6 +882,7 @@ func (q *Queries) ListSources(ctx context.Context) ([]Source, error) {
&i.OrgID,
&i.WorkspaceID,
&i.Name,
&i.DeliveryHeader,
); err != nil {
return nil, err
}
@@ -983,6 +985,23 @@ func (q *Queries) SetBindingDispatchTask(ctx context.Context, arg SetBindingDisp
return err
}
const setSourceDeliveryHeader = `-- name: SetSourceDeliveryHeader :execrows
UPDATE sources SET delivery_header = $2, updated_at = now() WHERE path = $1
`
type SetSourceDeliveryHeaderParams struct {
Path string
DeliveryHeader string
}
func (q *Queries) SetSourceDeliveryHeader(ctx context.Context, arg SetSourceDeliveryHeaderParams) (int64, error) {
result, err := q.db.Exec(ctx, setSourceDeliveryHeader, arg.Path, arg.DeliveryHeader)
if err != nil {
return 0, err
}
return result.RowsAffected(), nil
}
const setSourceName = `-- name: SetSourceName :execrows
UPDATE sources SET name = $2, updated_at = now() WHERE path = $1
`
@@ -339,14 +339,15 @@ type Session struct {
}
type Source struct {
Path string
Signing string
Secret string
CreatedAt time.Time
UpdatedAt time.Time
OrgID string
WorkspaceID string
Name string
Path string
Signing string
Secret string
CreatedAt time.Time
UpdatedAt time.Time
OrgID string
WorkspaceID string
Name string
DeliveryHeader string
}
type StepExecution struct {
@@ -153,10 +153,10 @@ SELECT pg_advisory_xact_lock(hashtext('event_types:' || sqlc.arg(source)::text))
INSERT INTO sources (path, signing, secret) VALUES ($1, $2, $3);
-- name: GetSource :one
SELECT path, signing, secret, created_at, updated_at, org_id, workspace_id, name FROM sources WHERE path = $1;
SELECT path, signing, secret, created_at, updated_at, org_id, workspace_id, name, delivery_header FROM sources WHERE path = $1;
-- name: ListSources :many
SELECT path, signing, secret, created_at, updated_at, org_id, workspace_id, name FROM sources ORDER BY created_at DESC, path;
SELECT path, signing, secret, created_at, updated_at, org_id, workspace_id, name, delivery_header FROM sources ORDER BY created_at DESC, path;
-- name: SetSourceSigning :execrows
UPDATE sources SET signing = sqlc.arg(to_signing), updated_at = now()
@@ -168,6 +168,9 @@ UPDATE sources SET secret = $2, updated_at = now() WHERE path = $1;
-- name: SetSourceName :execrows
UPDATE sources SET name = $2, updated_at = now() WHERE path = $1;
-- name: SetSourceDeliveryHeader :execrows
UPDATE sources SET delivery_header = $2, updated_at = now() WHERE path = $1;
-- name: DeleteUnboundSource :execrows
-- A source an armed binding fires on is not deleted: the binding would
-- silently stop receiving events.
+13 -1
View File
@@ -114,6 +114,18 @@ func (s *EDA) SetSourceName(ctx context.Context, path, name string) error {
return nil
}
// SetSourceDeliveryHeader sets the header that names a source's deliveries.
func (s *EDA) SetSourceDeliveryHeader(ctx context.Context, path, header string) error {
n, err := s.q.SetSourceDeliveryHeader(ctx, postgresdb.SetSourceDeliveryHeaderParams{Path: path, DeliveryHeader: header})
if err != nil {
return fmt.Errorf("edastore: set source delivery header: %w", err)
}
if n == 0 {
return storecontract.ErrSourceNotFound
}
return nil
}
// DeleteSource deletes a source no armed binding fires on.
func (s *EDA) DeleteSource(ctx context.Context, path string) error {
n, err := s.q.DeleteUnboundSource(ctx, path)
@@ -155,7 +167,7 @@ func (s *EDA) sourceValue(r postgresdb.Source) (source.Source, error) {
secret = plain
}
return source.Source{
Path: r.Path, Name: r.Name, Signing: source.Signing(r.Signing), Secret: secret,
Path: r.Path, Name: r.Name, DeliveryHeader: r.DeliveryHeader, Signing: source.Signing(r.Signing), Secret: secret,
CreatedAt: r.CreatedAt, UpdatedAt: r.UpdatedAt,
}, nil
}
@@ -664,6 +664,11 @@ func (c *Client) SetSourceName(ctx context.Context, path, name string) error {
return unmapError(err)
}
func (c *Client) SetSourceDeliveryHeader(ctx context.Context, path, header string) error {
_, err := c.client.SetSourceDeliveryHeader(ctx, &pb.SetSourceDeliveryHeaderRequest{Path: path, Header: header})
return unmapError(err)
}
func (c *Client) DeleteSource(ctx context.Context, path string) error {
_, err := c.client.DeleteSource(ctx, &pb.DeleteSourceRequest{Path: path})
return unmapError(err)
@@ -965,6 +965,17 @@ func (s *server) SetSourceName(ctx context.Context, r *pb.SetSourceNameRequest)
return &pb.SetSourceNameResponse{}, nil
}
func (s *server) SetSourceDeliveryHeader(ctx context.Context, r *pb.SetSourceDeliveryHeaderRequest) (*pb.SetSourceDeliveryHeaderResponse, error) {
ss, err := s.sources()
if err != nil {
return nil, err
}
if err := ss.SetSourceDeliveryHeader(ctx, r.Path, r.Header); err != nil {
return nil, s.logErr("SetSourceDeliveryHeader", err)
}
return &pb.SetSourceDeliveryHeaderResponse{}, nil
}
func (s *server) DeleteSource(ctx context.Context, r *pb.DeleteSourceRequest) (*pb.DeleteSourceResponse, error) {
ss, err := s.sources()
if err != nil {
+2 -2
View File
@@ -211,7 +211,7 @@ func capturedEventValue(c *pb.CapturedEvent) storecontract.CapturedEvent {
func sourceProto(s source.Source) *pb.Source {
return &pb.Source{
Path: s.Path, Name: s.Name, Signing: string(s.Signing), Secret: s.Secret,
Path: s.Path, Name: s.Name, DeliveryHeader: s.DeliveryHeader, Signing: string(s.Signing), Secret: s.Secret,
CreatedAt: timestamp(s.CreatedAt), UpdatedAt: timestamp(s.UpdatedAt),
}
}
@@ -221,7 +221,7 @@ func sourceValue(s *pb.Source) source.Source {
return source.Source{}
}
return source.Source{
Path: s.Path, Name: s.Name, Signing: source.Signing(s.Signing), Secret: s.Secret,
Path: s.Path, Name: s.Name, DeliveryHeader: s.DeliveryHeader, Signing: source.Signing(s.Signing), Secret: s.Secret,
CreatedAt: timeValue(s.CreatedAt), UpdatedAt: timeValue(s.UpdatedAt),
}
}
+31
View File
@@ -157,6 +157,37 @@ func (s *Server) handleSourceName(w http.ResponseWriter, r *http.Request) {
writeJSON(w, src)
}
// handleSourceDeliveryHeader sets the header that names a source's
// deliveries, so a sender's retry dispatches no second run.
func (s *Server) handleSourceDeliveryHeader(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) {
return
}
src, ok := s.loadSource(w, r)
if !ok {
return
}
var request struct {
Header string `json:"header"`
}
if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 4<<10)).Decode(&request); err != nil {
http.Error(w, "invalid delivery header", http.StatusBadRequest)
return
}
header, err := source.DeliveryHeader(request.Header)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
src.DeliveryHeader = header
if err := s.Sources.SetSourceDeliveryHeader(r.Context(), src.Path, header); err != nil {
s.sourceError(w, "set source delivery header", err)
return
}
src.Secret = ""
writeJSON(w, src)
}
// handleSourceDelete deletes a source no armed binding fires on.
func (s *Server) handleSourceDelete(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) {
+1
View File
@@ -305,6 +305,7 @@ func (s *Server) registerMappingAndBindingRoutes(mux *http.ServeMux) {
mux.HandleFunc("POST /api/sources/{path}/approve-unsigned", s.handleSourceApproveUnsigned)
mux.HandleFunc("POST /api/sources/{path}/secret", s.handleSourceSecret)
mux.HandleFunc("PUT /api/sources/{path}/name", s.handleSourceName)
mux.HandleFunc("PUT /api/sources/{path}/delivery-header", s.handleSourceDeliveryHeader)
mux.HandleFunc("DELETE /api/sources/{path}", s.handleSourceDelete)
}
+9 -1
View File
@@ -191,6 +191,7 @@ service StateStoreService {
rpc SetSourceSigning(SetSourceSigningRequest) returns (SetSourceSigningResponse);
rpc SetSourceSecret(SetSourceSecretRequest) returns (SetSourceSecretResponse);
rpc SetSourceName(SetSourceNameRequest) returns (SetSourceNameResponse);
rpc SetSourceDeliveryHeader(SetSourceDeliveryHeaderRequest) returns (SetSourceDeliveryHeaderResponse);
rpc DeleteSource(DeleteSourceRequest) returns (DeleteSourceResponse);
// Dispatch
@@ -473,7 +474,8 @@ message CapturedEvent {
// unsigned marks an event taken on an approved unsigned source.
bool unsigned = 10;
// delivery names the sender's delivery; a retry of one delivery shares it.
// Intake sets the sender's delivery ID; empty takes the capture ID.
// Intake sets it from the source's delivery header; empty takes the
// capture ID.
string delivery = 11;
}
@@ -563,6 +565,7 @@ message Source {
google.protobuf.Timestamp created_at = 4;
google.protobuf.Timestamp updated_at = 5;
string name = 6;
string delivery_header = 7;
}
// WorkflowStat mirrors storecontract.WorkflowStat.
@@ -1130,6 +1133,11 @@ message SetSourceNameRequest {
string name = 2;
}
message SetSourceNameResponse {}
message SetSourceDeliveryHeaderRequest {
string path = 1;
string header = 2;
}
message SetSourceDeliveryHeaderResponse {}
message DeleteSourceRequest { string path = 1; }
message DeleteSourceResponse {}
message PauseBindingRequest { string id = 1; }
+21 -21
View File
@@ -1,24 +1,24 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HarnessPage.js","assets/HarnessPage.css"])))=>i.map(i=>d[i]);
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function n(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var r={},i=[],a=()=>{},o=()=>!1,s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),c=e=>e.startsWith(`onUpdate:`),l=Object.assign,u=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Object.prototype.hasOwnProperty,f=(e,t)=>d.call(e,t),p=Array.isArray,m=e=>w(e)===`[object Map]`,h=e=>w(e)===`[object Set]`,g=e=>w(e)===`[object Date]`,_=e=>w(e)===`[object RegExp]`,v=e=>typeof e==`function`,y=e=>typeof e==`string`,b=e=>typeof e==`symbol`,x=e=>typeof e==`object`&&!!e,S=e=>(x(e)||v(e))&&v(e.then)&&v(e.catch),C=Object.prototype.toString,w=e=>C.call(e),T=e=>w(e).slice(8,-1),E=e=>w(e)===`[object Object]`,D=e=>y(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,O=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),ee=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},te=/-\w/g,ne=ee(e=>e.replace(te,e=>e.slice(1).toUpperCase())),re=/\B([A-Z])/g,ie=ee(e=>e.replace(re,`-$1`).toLowerCase()),ae=ee(e=>e.charAt(0).toUpperCase()+e.slice(1)),oe=ee(e=>e?`on${ae(e)}`:``),k=(e,t)=>!Object.is(e,t),se=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ce=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},le=e=>{let t=parseFloat(e);return isNaN(t)?e:t},ue=e=>{let t=y(e)?Number(e):NaN;return isNaN(t)?e:t},de,fe=()=>de||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{},pe=n(`Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol`);function me(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=y(r)?ve(r):me(r);if(i)for(let e in i)t[e]=i[e]}return t}if(y(e)||x(e))return e}var he=/;(?![^(]*\))/g,ge=/:([^]+)/,_e=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function ve(e){let t={};return e.replace(_e,e=>e.startsWith(`/*`)?``:e).split(he).forEach(e=>{if(e){let n=e.split(ge);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function A(e){let t=``;if(y(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=A(e[n]);r&&(t+=r+` `)}else if(x(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}function ye(e){if(!e)return null;let{class:t,style:n}=e;return t&&!y(t)&&(e.class=A(t)),n&&(e.style=me(n)),e}var be=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,xe=n(be);be+``;function Se(e){return!!e||e===``}function Ce(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=De(e[i],t[i],n);return r}function we(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&De(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function Te(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?we(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!De(e[r],t[r],n))return!1}return String(e)===String(t)}function Ee(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function De(e,t,n){if(e===t)return!0;let r=g(e),i=g(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=b(e),i=b(t),r||i?e===t:(r=p(e),i=p(t),r||i?r&&i?Ee(e,t,n,Ce):!1:(r=x(e),i=x(t),r||i?!r||!i?!1:Ee(e,t,n,Te):String(e)===String(t))))}function Oe(e,t){return e.findIndex(e=>De(e,t))}var ke=e=>!!(e&&e.__v_isRef===!0),j=e=>y(e)?e:e==null?``:p(e)||x(e)&&(e.toString===C||!v(e.toString))?ke(e)?j(e.value):JSON.stringify(e,Ae,2):String(e),Ae=(e,t)=>ke(t)?Ae(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[je(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>je(e))}:b(t)?je(t):x(t)&&!p(t)&&!E(t)?String(t):t,je=(e,t=``)=>b(e)?`Symbol(${e.description??t})`:e;function Me(e){return e==null?`initial`:typeof Line truncated
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function n(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var r={},i=[],a=()=>{},o=()=>!1,s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),c=e=>e.startsWith(`onUpdate:`),l=Object.assign,u=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Object.prototype.hasOwnProperty,f=(e,t)=>d.call(e,t),p=Array.isArray,m=e=>w(e)===`[object Map]`,h=e=>w(e)===`[object Set]`,g=e=>w(e)===`[object Date]`,_=e=>w(e)===`[object RegExp]`,v=e=>typeof e==`function`,y=e=>typeof e==`string`,b=e=>typeof e==`symbol`,x=e=>typeof e==`object`&&!!e,S=e=>(x(e)||v(e))&&v(e.then)&&v(e.catch),C=Object.prototype.toString,w=e=>C.call(e),T=e=>w(e).slice(8,-1),E=e=>w(e)===`[object Object]`,D=e=>y(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,O=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),ee=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},te=/-\w/g,ne=ee(e=>e.replace(te,e=>e.slice(1).toUpperCase())),re=/\B([A-Z])/g,ie=ee(e=>e.replace(re,`-$1`).toLowerCase()),ae=ee(e=>e.charAt(0).toUpperCase()+e.slice(1)),oe=ee(e=>e?`on${ae(e)}`:``),k=(e,t)=>!Object.is(e,t),se=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ce=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},le=e=>{let t=parseFloat(e);return isNaN(t)?e:t},ue=e=>{let t=y(e)?Number(e):NaN;return isNaN(t)?e:t},de,fe=()=>de||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{},pe=n(`Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol`);function me(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=y(r)?ve(r):me(r);if(i)for(let e in i)t[e]=i[e]}return t}if(y(e)||x(e))return e}var he=/;(?![^(]*\))/g,ge=/:([^]+)/,_e=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function ve(e){let t={};return e.replace(_e,e=>e.startsWith(`/*`)?``:e).split(he).forEach(e=>{if(e){let n=e.split(ge);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function A(e){let t=``;if(y(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=A(e[n]);r&&(t+=r+` `)}else if(x(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}function ye(e){if(!e)return null;let{class:t,style:n}=e;return t&&!y(t)&&(e.class=A(t)),n&&(e.style=me(n)),e}var be=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,xe=n(be);be+``;function Se(e){return!!e||e===``}function Ce(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=De(e[i],t[i],n);return r}function we(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&De(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function Te(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?we(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!De(e[r],t[r],n))return!1}return String(e)===String(t)}function Ee(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function De(e,t,n){if(e===t)return!0;let r=g(e),i=g(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=b(e),i=b(t),r||i?e===t:(r=p(e),i=p(t),r||i?r&&i?Ee(e,t,n,Ce):!1:(r=x(e),i=x(t),r||i?!r||!i?!1:Ee(e,t,n,Te):String(e)===String(t))))}function Oe(e,t){return e.findIndex(e=>De(e,t))}var ke=e=>!!(e&&e.__v_isRef===!0),j=e=>y(e)?e:e==null?``:p(e)||x(e)&&(e.toString===C||!v(e.toString))?ke(e)?j(e.value):JSON.stringify(e,Ae,2):String(e),Ae=(e,t)=>ke(t)?Ae(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[je(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>je(e))}:b(t)?je(t):x(t)&&!p(t)&&!E(t)?String(t):t,je=(e,t=``)=>b(e)?`Symbol(${e.description??t})`:e;function Me(e){return e==null?`initial`:typeof Line truncated
`&&(e.tagName===`PRE`||e.tagName===`TEXTAREA`)&&(n=n.slice(1));let{textContent:r}=e;r!==n&&r!==n.replace(/\r\n|\r/g,`
`)&&(mi(e,0)||ii(),e.textContent=t.children)}if(d){if(_||b||!o||f&48){let t=e.tagName.includes(`-`),i=e.namespaceURI.includes(`svg`)?`svg`:e.namespaceURI.includes(`MathML`)?`mathml`:void 0;for(let a in d)if(_&&(a.endsWith(`value`)||a===`indeterminate`)||s(a)&&!O(a)||a[0]===`.`||t&&!O(a)||u&&u.includes(a)){if(di(e,a,d[a]))continue;r(e,a,null,d[a],i,n)}}else if(d.onClick)r(e,`onClick`,null,d.onClick,void 0,n);else if(f&4&&$t(d.style))for(let e in d.style)d.style[e]}let x;(x=d&&d.onVnodeBeforeMount)&&ds(x,n,t),h&&lr(t,null,n,`beforeMount`),((x=d&&d.onVnodeMounted)||h||l)&&Uo(()=>{x&&ds(x,n,t),l&&g.enter(e),h&&lr(t,null,n,`mounted`)},i)}return e.nextSibling},m=(e,t,r,o,s,c,u)=>{u||=!!t.dynamicChildren;let d=t.children,p=d.length,m=!1;for(let t=0;t<p;t++){let h=u?d[t]:d[t]=cs(d[t]),g=h.type===Go;e?(g&&!u&&t+1<p&&cs(d[t+1]).type===Go&&(l(i(e.data.slice(h.children.length)),r,a(e)),e.data=h.children),e=f(e,h,o,s,c,u)):g&&!h.children?l(h.el=i(``),r):(m||(m=!0,mi(r,1)||ii()),n(null,h,r,null,o,s,si(r),c))}return e},h=(e,t,n,r,i,s)=>{let{slotScopeIds:c}=t;c&&(i=i?i.concat(c):c);let d=o(e),f=m(a(e),t,d,n,r,i,s);return f&&ci(f)&&f.data===`]`?a(t.anchor=f):(ii(),l(t.anchor=u(`]`),d,f),f)},g=(e,t,r,i,s,l)=>{if(gi(e,t)||ii(),t.el=null,l){let t=_(e);for(;;){let n=a(e);if(n&&n!==t)c(n);else break}}let u=a(e),d=o(e);return c(e),n(null,t,d,u,r,i,si(d),s),r&&(r.vnode.el=t.el,to(r,t.el)),u},_=(e,t=`[`,n=`]`)=>{let r=0;for(;e;)if(e=a(e),e&&ci(e)&&(e.data===t&&r++,e.data===n)){if(r===0)return a(e);r--}return e},v=(e,t,n)=>{let r=t.parentNode;r&&r.replaceChild(e,t);let i=n;for(;i;)i.vnode.el===t&&(i.vnode.el=i.subTree.el=e),i=i.parent},y=e=>e.nodeType===1&&e.tagName===`TEMPLATE`;return[d,f]}var ui=new Set([`src`,`srcset`,`href`,`poster`]);function di(e,t,n){return ui.has(t)?e.getAttribute(t)===(n==null?null:`${n}`):!1}var fi=`data-allow-mismatch`,pi={0:`text`,1:`children`,2:`class`,3:`style`,4:`attribute`};function mi(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(fi);)e=e.parentElement;return hi(e&&e.getAttribute(fi),t)}function hi(e,t){if(e==null)return!1;if(e===``)return!0;{let n=e.split(`,`);return t===0&&n.includes(`children`)?!0:n.includes(pi[t])}}function gi(e,t){return mi(e.parentElement,1)||_i(e)||vi(t)}function _i(e){return e.nodeType===1&&hi(e.getAttribute(fi),1)}function vi({props:e}){let t=e&&e[fi];return typeof t==`string`&&hi(t,1)}var yi=fe().requestIdleCallback||(e=>setTimeout(e,1)),bi=fe().cancelIdleCallback||(e=>clearTimeout(e)),xi=(e=1e4)=>t=>{let n=yi(t,{timeout:e});return()=>bi(n)};function Si(e){let{top:t,left:n,bottom:r,right:i}=e.getBoundingClientRect(),{innerHeight:a,innerWidth:o}=window;return(t>0&&t<a||r>0&&r<a)&&(n>0&&n<o||i>0&&i<o)}var Ci=e=>(t,n)=>{let r=new IntersectionObserver(e=>{for(let n of e)if(n.isIntersecting){r.disconnect(),t();break}},e);return n(e=>{if(e instanceof Element){if(Si(e))return t(),r.disconnect(),!1;r.observe(e)}}),()=>r.disconnect()},wi=e=>t=>{if(e){let n=matchMedia(e);if(n.matches)t();else return n.addEventListener(`change`,t,{once:!0}),()=>n.removeEventListener(`change`,t)}},Ti=(e=[])=>(t,n)=>{y(e)&&(e=[e]);let r=!1,i=e=>{r||(r=!0,a(),t(),e.target.dispatchEvent(new e.constructor(e.type,e)))},a=()=>{n(t=>{for(let n of e)t.removeEventListener(n,i)})};return n(t=>{for(let n of e)t.addEventListener(n,i,{once:!0})}),a};function Ei(e,t){if(ci(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(ci(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var Di=e=>!!e.type.__asyncLoader;function Oi(e){v(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:i=200,hydrate:a,timeout:o,suspensible:s=!0,onError:c}=e,l=null,u,d=0,f=()=>(d++,l=null,p()),p=()=>{let e;return l||(e=l=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),c)return new Promise((t,n)=>{c(e,()=>t(f()),()=>n(e),d+1)});throw e}).then(t=>e!==l&&l?l:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),u=t,t)))};return I({name:`AsyncComponentWrapper`,__asyncLoader:p,__asyncHydrate(e,t,n){let r=e.isConnected,i=!1;(t.bu||=[]).push(()=>i=!0);let o=()=>{i||!e.parentNode||r&&!e.isConnected||n()},s=a?()=>{let n=a(o,t=>Ei(e,t));n&&(t.bum||=[]).push(n)}:o;u?s():p().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return u},setup(){let e=hs;if(Zr(e),u)return()=>ki(u,e);let t=t=>{l=null,Rn(t,e,13,!r)};if(s&&e.suspense||Ss)return p().then(t=>()=>ki(t,e)).catch(e=>(t(e),()=>r?W(r,{error:e}):null));let a=M(!1),c=M(),d=M(!!i),f,m;return Ki(()=>{f!=null&&clearTimeout(f),m!=null&&clearTimeout(m)}),i&&(m=setTimeout(()=>{e.isUnmounted||(d.value=!1)},i)),o!=null&&(f=setTimeout(()=>{if(!e.isUnmounted&&!a.value&&!c.value){let e=Error(`Async component timed out after ${o}ms.`);t(e),c.value=e}},o)),p().then(()=>{e.isUnmounted||(a.value=!0,e.parent&&Ai(e.parent.vnode)&&e.parent.update())}).catch(n=>{if(e.isUnmounted){l=null;return}t(n),c.value=n}),()=>{if(a.value&&u)return ki(u,e);if(c.value&&r)return W(r,{error:c.value});if(n&&!d Line truncated
`))),e[Cl]=bl(i);let a=r||i.props&&i.props.type===`number`;Vc(e,t?`change`:`input`,t=>{t.target.composing||e[Cl](Tl(e.value,n,a))}),(n||a)&&Vc(e,`change`,()=>{e.value=Tl(e.value,n,a)}),t||(Vc(e,`compositionstart`,xl),Vc(e,`compositionend`,Sl),Vc(e,`change`,Sl))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[wl];delete e[wl],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[Cl](Tl(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Cl]=bl(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?le(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Dl={deep:!0,created(e,t,n){e[Cl]=bl(n),Vc(e,`change`,()=>{let t=e._modelValue,n=Ml(e),r=e.checked,i=e[Cl];if(p(t)){let e=Oe(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Nl(e,r))})},mounted:Ol,beforeUpdate(e,t,n){e[Cl]=bl(n),Ol(e,t,n)}};function Ol(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=Oe(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=De(t,Nl(e,!0))}e.checked!==i&&(e.checked=i)}var kl={created(e,{value:t},n){e.checked=De(t,n.props.value),e[Cl]=bl(n),Vc(e,`change`,()=>{e[Cl](Ml(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Cl]=bl(r),t!==n&&(e.checked=De(t,r.props.value))}},Al={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,Vc(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?le(Ml(e)):Ml(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[Cl](i)}finally{qn(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[Cl]=bl(r)},mounted(e,{value:t}){jl(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Cl]=bl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!vee(t,n[1],n[0]))&&jl(e,t)}};function vee(e,t,n){if(!n||p(e))return De(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function jl(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Ml(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):Oe(t,o)>-1}else a.selected=t.has(o)}else if(De(Ml(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Ml(e){return`_value`in e?e._value:e.value}function Nl(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var Pl={created(e,t,n){Il(e,t,n,null,`created`)},mounted(e,t,n){Il(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){Il(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){Il(e,t,n,r,`updated`)}};function Fl(e,t){switch(e){case`SELECT`:return Al;case`TEXTAREA`:return El;default:switch(t){case`checkbox`:return Dl;case`radio`:return kl;default:return El}}}function Il(e,t,n,r,i){let a=Fl(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function yee(){El.getSSRProps=({value:e})=>({value:e}),kl.getSSRProps=({value:e},t)=>{if(t.props&&De(t.props.value,e))return{checked:!0}},Dl.getSSRProps=({value:e},t)=>{if(p(e)){if(t.props&&Oe(e,t.props.value)>-1)return{checked:!0}}else if(h(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Pl.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=Fl(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var bee=[`ctrl`,`shift`,`alt`,`meta`],xee={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>bee.some(n=>e[`${n}Key`]&&!t.includes(n))},Ll=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=xee[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},See={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Rl=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=ie(n.key);if(t.some(e=>e===r||See[e]===r))return e(n)}))},zl=l({patchProp:$c},$s),Bl,Vl=!1;function Hl(){return Bl||=So(zl)}function Ul(){return Bl=Vl?Bl:Co(zl),Vl=!0,Bl}var Wl=((...e)=>{Hl().render(...e)}),Gl=((...e)=>{Ul().hydrate(...e)}),Kl=((...e)=>{let t=Hl().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Yl(e);if(!r)return;let i=t._component;!v(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,Jl(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a}, Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Np;function Pp(e){Np=e}var Fp=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Ip(e){let t=e instanceof Fp?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function Lp(e,t){let n=await fetch(e,t);if(Np?.(n.status===401),!n.ok)throw new Fp(await Mp(n),n.status);return n}async function Rp(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Ap,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await Lp(e,s);return a?await c.json():void 0}var X={health:()=>Rp(`/health/detailed`),services:()=>Rp(`/api/services`),policies:()=>Rp(`/api/access/policies`),putPolicy:e=>Rp(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>Rp(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),orgs:()=>Rp(`/api/orgs`),orgCreate:e=>Rp(`/api/orgs`,{method:`POST`,body:e}),org:e=>Rp(`/api/orgs/${encodeURIComponent(e)}`),orgWorkspaces:e=>Rp(`/api/orgs/${encodeURIComponent(e)}/workspaces`),createOrgWorkspace:(e,t)=>Rp(`/api/orgs/${encodeURIComponent(e)}/workspaces`,{method:`POST`,body:t}),orgMembers:e=>Rp(`/api/orgs/${encodeURIComponent(e)}/members`),setOrgMember:(e,t,n)=>Rp(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PUT`,body:n}),removeOrgMember:(e,t,n)=>Rp(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`+jp({workspace:n}),{method:`DELETE`,parse:!1}),assignOrgAgent:(e,t)=>Rp(`/api/orgs/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}`,{method:`PUT`}),summary:()=>Rp(`/api/summary`),tasks:()=>Rp(`/api/tasks`),taskPage:async e=>{let t=await Lp(`/api/tasks`+jp(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(Ap)});return{tasks:await t.json(),next:t.headers.get(`X-Next-Cursor`)}},taskMeta:()=>Rp(`/api/task-meta`),task:e=>Rp(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Rp(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Rp(`/api/tasks/${encodeURIComponent(e)}/changes`+jp(t)),taskDebug:(e,t)=>Rp(`/api/tasks/${encodeURIComponent(e)}/debug`+jp(t)),taskAction:(e,t,n)=>Rp(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>Rp(`/api/setup`),capabilities:()=>Rp(`/api/capabilities`),workflows:()=>Rp(`/api/workflows`),workflowEnabled:(e,t)=>Rp(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),workRequest:e=>Rp(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Rp(`/api/skills`),channels:()=>Rp(`/api/channels`),curators:()=>Rp(`/api/curators`),channelReload:e=>Rp(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Rp(`/api/config`),logs:e=>Rp(`/api/logs`+jp(e)),taskLogs:(e,t)=>Rp(`/api/tasks/${encodeURIComponent(e)}/logs`+jp(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>Rp(`/api/version`),updateSnapshot:()=>Rp(`/api/chat/update`),updateInstall:e=>Rp(`/api/chat/update/install`,{method:`POST`,body:{snapshot:e},timeoutMs:9e5}),captures:e=>Rp(`/api/captures`+jp({limit:e})),eventTypes:()=>Rp(`/api/event-types`),eventTypeCreate:e=>Rp(`/api/event-types`,{method:`POST`,body:e}),eventTypeUpdate:(e,t)=>Rp(`/api/event-types/${encodeURIComponent(e)}`,{method:`PUT`,body:t}),eventTypeDelete:e=>Rp(`/api/event-types/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappings:()=>Rp(`/api/mappings`),mappingCreate:e=>Rp(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>Rp(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>Rp(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>Rp(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>Rp(`/api/bindings`),dispatches:(e,t)=>Rp(`/api/${e}/${encodeURIComponent(t)}/dispatches`),bindingCreate:e=>Rp(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>Rp(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>Rp(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>Rp(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),bindingPause:e=>Rp(`/api/bindings/${encodeURIComponent(e)}/pause`,{method:`POST`}),bindingResume:e=>Rp(`/api/bindings/${encodeURIComponent(e)}/resume`,{method:`POST`}),harnessBindings:()=>Rp(`/api/harness/bindings`),sources:()=>Rp(`/api/sources`),sourceCreate:e=>Rp(`/api/sources`,{method:`POST`,body:{path:e}}),sourceSigning:(e,t)=>Rp(`/api/sources/${encodeURIComponent(e)}/signing`,{method:`POST`,body:{signed:t}}),sourceApproveUnsigned:e=>Rp(`/api/sources/${encodeURIComponent(e)}/aLine truncated
`)&&(pi(e,0)||ri(),e.textContent=t.children)}if(d){if(_||b||!o||f&48){let t=e.tagName.includes(`-`),i=e.namespaceURI.includes(`svg`)?`svg`:e.namespaceURI.includes(`MathML`)?`mathml`:void 0;for(let a in d)if(_&&(a.endsWith(`value`)||a===`indeterminate`)||s(a)&&!O(a)||a[0]===`.`||t&&!O(a)||u&&u.includes(a)){if(ui(e,a,d[a]))continue;r(e,a,null,d[a],i,n)}}else if(d.onClick)r(e,`onClick`,null,d.onClick,void 0,n);else if(f&4&&$t(d.style))for(let e in d.style)d.style[e]}let x;(x=d&&d.onVnodeBeforeMount)&&us(x,n,t),h&&lr(t,null,n,`beforeMount`),((x=d&&d.onVnodeMounted)||h||l)&&Ho(()=>{x&&us(x,n,t),l&&g.enter(e),h&&lr(t,null,n,`mounted`)},i)}return e.nextSibling},m=(e,t,r,o,s,c,u)=>{u||=!!t.dynamicChildren;let d=t.children,p=d.length,m=!1;for(let t=0;t<p;t++){let h=u?d[t]:d[t]=ss(d[t]),g=h.type===Wo;e?(g&&!u&&t+1<p&&ss(d[t+1]).type===Wo&&(l(i(e.data.slice(h.children.length)),r,a(e)),e.data=h.children),e=f(e,h,o,s,c,u)):g&&!h.children?l(h.el=i(``),r):(m||(m=!0,pi(r,1)||ri()),n(null,h,r,null,o,s,oi(r),c))}return e},h=(e,t,n,r,i,s)=>{let{slotScopeIds:c}=t;c&&(i=i?i.concat(c):c);let d=o(e),f=m(a(e),t,d,n,r,i,s);return f&&si(f)&&f.data===`]`?a(t.anchor=f):(ri(),l(t.anchor=u(`]`),d,f),f)},g=(e,t,r,i,s,l)=>{if(hi(e,t)||ri(),t.el=null,l){let t=_(e);for(;;){let n=a(e);if(n&&n!==t)c(n);else break}}let u=a(e),d=o(e);return c(e),n(null,t,d,u,r,i,oi(d),s),r&&(r.vnode.el=t.el,eo(r,t.el)),u},_=(e,t=`[`,n=`]`)=>{let r=0;for(;e;)if(e=a(e),e&&si(e)&&(e.data===t&&r++,e.data===n)){if(r===0)return a(e);r--}return e},v=(e,t,n)=>{let r=t.parentNode;r&&r.replaceChild(e,t);let i=n;for(;i;)i.vnode.el===t&&(i.vnode.el=i.subTree.el=e),i=i.parent},y=e=>e.nodeType===1&&e.tagName===`TEMPLATE`;return[d,f]}var li=new Set([`src`,`srcset`,`href`,`poster`]);function ui(e,t,n){return li.has(t)?e.getAttribute(t)===(n==null?null:`${n}`):!1}var di=`data-allow-mismatch`,fi={0:`text`,1:`children`,2:`class`,3:`style`,4:`attribute`};function pi(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(di);)e=e.parentElement;return mi(e&&e.getAttribute(di),t)}function mi(e,t){if(e==null)return!1;if(e===``)return!0;{let n=e.split(`,`);return t===0&&n.includes(`children`)?!0:n.includes(fi[t])}}function hi(e,t){return pi(e.parentElement,1)||gi(e)||_i(t)}function gi(e){return e.nodeType===1&&mi(e.getAttribute(di),1)}function _i({props:e}){let t=e&&e[di];return typeof t==`string`&&mi(t,1)}var vi=fe().requestIdleCallback||(e=>setTimeout(e,1)),yi=fe().cancelIdleCallback||(e=>clearTimeout(e)),bi=(e=1e4)=>t=>{let n=vi(t,{timeout:e});return()=>yi(n)};function xi(e){let{top:t,left:n,bottom:r,right:i}=e.getBoundingClientRect(),{innerHeight:a,innerWidth:o}=window;return(t>0&&t<a||r>0&&r<a)&&(n>0&&n<o||i>0&&i<o)}var Si=e=>(t,n)=>{let r=new IntersectionObserver(e=>{for(let n of e)if(n.isIntersecting){r.disconnect(),t();break}},e);return n(e=>{if(e instanceof Element){if(xi(e))return t(),r.disconnect(),!1;r.observe(e)}}),()=>r.disconnect()},Ci=e=>t=>{if(e){let n=matchMedia(e);if(n.matches)t();else return n.addEventListener(`change`,t,{once:!0}),()=>n.removeEventListener(`change`,t)}},wi=(e=[])=>(t,n)=>{y(e)&&(e=[e]);let r=!1,i=e=>{r||(r=!0,a(),t(),e.target.dispatchEvent(new e.constructor(e.type,e)))},a=()=>{n(t=>{for(let n of e)t.removeEventListener(n,i)})};return n(t=>{for(let n of e)t.addEventListener(n,i,{once:!0})}),a};function Ti(e,t){if(si(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(si(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var Ei=e=>!!e.type.__asyncLoader;function Di(e){v(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:i=200,hydrate:a,timeout:o,suspensible:s=!0,onError:c}=e,l=null,u,d=0,f=()=>(d++,l=null,p()),p=()=>{let e;return l||(e=l=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),c)return new Promise((t,n)=>{c(e,()=>t(f()),()=>n(e),d+1)});throw e}).then(t=>e!==l&&l?l:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),u=t,t)))};return I({name:`AsyncComponentWrapper`,__asyncLoader:p,__asyncHydrate(e,t,n){let r=e.isConnected,i=!1;(t.bu||=[]).push(()=>i=!0);let o=()=>{i||!e.parentNode||r&&!e.isConnected||n()},s=a?()=>{let n=a(o,t=>Ti(e,t));n&&(t.bum||=[]).push(n)}:o;u?s():p().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return u},setup(){let e=ms;if(Xr(e),u)return()=>Oi(u,e);let t=t=>{l=null,Rn(t,e,13,!r)};if(s&&e.suspense||xs)return p().then(t=>()=>Oi(t,e)).catch(e=>(t(e),()=>r?W(r,{error:e}):null));let a=M(!1),c=M(),d=M(!!i),f,m;return Gi(()=>{f!=null&&clearTimeout(f),m!=null&&clearTimeout(m)}),i&&(m=setTimeout(()=>{e.isUnmounted||(d.value=!1)},i)),o!=null&&(f=setTimeout(()=>{if(!e.isUnmounted&&!a.value&&!c.value){let e=Error(`Async component timed out after ${o}ms.`);t(e),c.value=e}},o)),p().then(()=>{e.isUnmounted||(a.value=!0,e.parent&&ki(e.parent.vnode)&&e.parent.update())}).catch(n=>{if(e.isUnmounted){l=null;return}t(n),c.value=n}),()=>{if(a.value&&u)return Oi(u,e);if(c.value&&r)return W(r,{error:c.value});if(n&&!d Line truncated
`))),e[Sl]=yl(i);let a=r||i.props&&i.props.type===`number`;Bc(e,t?`change`:`input`,t=>{t.target.composing||e[Sl](wl(e.value,n,a))}),(n||a)&&Bc(e,`change`,()=>{e.value=wl(e.value,n,a)}),t||(Bc(e,`compositionstart`,bl),Bc(e,`compositionend`,xl),Bc(e,`change`,xl))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Cl];delete e[Cl],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[Sl](wl(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Sl]=yl(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?le(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},El={deep:!0,created(e,t,n){e[Sl]=yl(n),Bc(e,`change`,()=>{let t=e._modelValue,n=jl(e),r=e.checked,i=e[Sl];if(p(t)){let e=Oe(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Ml(e,r))})},mounted:Dl,beforeUpdate(e,t,n){e[Sl]=yl(n),Dl(e,t,n)}};function Dl(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=Oe(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=De(t,Ml(e,!0))}e.checked!==i&&(e.checked=i)}var Ol={created(e,{value:t},n){e.checked=De(t,n.props.value),e[Sl]=yl(n),Bc(e,`change`,()=>{e[Sl](jl(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Sl]=yl(r),t!==n&&(e.checked=De(t,r.props.value))}},kl={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,Bc(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?le(jl(e)):jl(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[Sl](i)}finally{qn(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[Sl]=yl(r)},mounted(e,{value:t}){Al(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Sl]=yl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!yee(t,n[1],n[0]))&&Al(e,t)}};function yee(e,t,n){if(!n||p(e))return De(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function Al(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=jl(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):Oe(t,o)>-1}else a.selected=t.has(o)}else if(De(jl(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function jl(e){return`_value`in e?e._value:e.value}function Ml(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var Nl={created(e,t,n){Fl(e,t,n,null,`created`)},mounted(e,t,n){Fl(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){Fl(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){Fl(e,t,n,r,`updated`)}};function Pl(e,t){switch(e){case`SELECT`:return kl;case`TEXTAREA`:return Tl;default:switch(t){case`checkbox`:return El;case`radio`:return Ol;default:return Tl}}}function Fl(e,t,n,r,i){let a=Pl(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function bee(){Tl.getSSRProps=({value:e})=>({value:e}),Ol.getSSRProps=({value:e},t)=>{if(t.props&&De(t.props.value,e))return{checked:!0}},El.getSSRProps=({value:e},t)=>{if(p(e)){if(t.props&&Oe(e,t.props.value)>-1)return{checked:!0}}else if(h(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Nl.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=Pl(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var xee=[`ctrl`,`shift`,`alt`,`meta`],See={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>xee.some(n=>e[`${n}Key`]&&!t.includes(n))},Il=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=See[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Cee={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Ll=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=ie(n.key);if(t.some(e=>e===r||Cee[e]===r))return e(n)}))},Rl=l({patchProp:Qc},Qs),zl,Bl=!1;function Vl(){return zl||=xo(Rl)}function Hl(){return zl=Bl?zl:So(Rl),Bl=!0,zl}var Ul=((...e)=>{Vl().render(...e)}),Wl=((...e)=>{Hl().hydrate(...e)}),Gl=((...e)=>{let t=Vl().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Jl(e);if(!r)return;let i=t._component;!v(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,ql(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a}, Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Mp;function Np(e){Mp=e}var Pp=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Fp(e){let t=e instanceof Pp?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function Ip(e,t){let n=await fetch(e,t);if(Mp?.(n.status===401),!n.ok)throw new Pp(await jp(n),n.status);return n}async function Lp(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=kp,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await Ip(e,s);return a?await c.json():void 0}var X={health:()=>Lp(`/health/detailed`),services:()=>Lp(`/api/services`),policies:()=>Lp(`/api/access/policies`),putPolicy:e=>Lp(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>Lp(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),orgs:()=>Lp(`/api/orgs`),orgCreate:e=>Lp(`/api/orgs`,{method:`POST`,body:e}),org:e=>Lp(`/api/orgs/${encodeURIComponent(e)}`),orgWorkspaces:e=>Lp(`/api/orgs/${encodeURIComponent(e)}/workspaces`),createOrgWorkspace:(e,t)=>Lp(`/api/orgs/${encodeURIComponent(e)}/workspaces`,{method:`POST`,body:t}),orgMembers:e=>Lp(`/api/orgs/${encodeURIComponent(e)}/members`),setOrgMember:(e,t,n)=>Lp(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PUT`,body:n}),removeOrgMember:(e,t,n)=>Lp(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`+Ap({workspace:n}),{method:`DELETE`,parse:!1}),assignOrgAgent:(e,t)=>Lp(`/api/orgs/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}`,{method:`PUT`}),summary:()=>Lp(`/api/summary`),tasks:()=>Lp(`/api/tasks`),taskPage:async e=>{let t=await Ip(`/api/tasks`+Ap(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(kp)});return{tasks:await t.json(),next:t.headers.get(`X-Next-Cursor`)}},taskMeta:()=>Lp(`/api/task-meta`),task:e=>Lp(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Lp(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Lp(`/api/tasks/${encodeURIComponent(e)}/changes`+Ap(t)),taskDebug:(e,t)=>Lp(`/api/tasks/${encodeURIComponent(e)}/debug`+Ap(t)),taskAction:(e,t,n)=>Lp(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>Lp(`/api/setup`),capabilities:()=>Lp(`/api/capabilities`),workflows:()=>Lp(`/api/workflows`),workflowEnabled:(e,t)=>Lp(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),workRequest:e=>Lp(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Lp(`/api/skills`),channels:()=>Lp(`/api/channels`),curators:()=>Lp(`/api/curators`),channelReload:e=>Lp(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Lp(`/api/config`),logs:e=>Lp(`/api/logs`+Ap(e)),taskLogs:(e,t)=>Lp(`/api/tasks/${encodeURIComponent(e)}/logs`+Ap(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>Lp(`/api/version`),updateSnapshot:()=>Lp(`/api/chat/update`),updateInstall:e=>Lp(`/api/chat/update/install`,{method:`POST`,body:{snapshot:e},timeoutMs:9e5}),captures:e=>Lp(`/api/captures`+Ap({limit:e})),eventTypes:()=>Lp(`/api/event-types`),eventTypeCreate:e=>Lp(`/api/event-types`,{method:`POST`,body:e}),eventTypeUpdate:(e,t)=>Lp(`/api/event-types/${encodeURIComponent(e)}`,{method:`PUT`,body:t}),eventTypeDelete:e=>Lp(`/api/event-types/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappings:()=>Lp(`/api/mappings`),mappingCreate:e=>Lp(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>Lp(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>Lp(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>Lp(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>Lp(`/api/bindings`),dispatches:(e,t)=>Lp(`/api/${e}/${encodeURIComponent(t)}/dispatches`),bindingCreate:e=>Lp(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>Lp(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>Lp(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>Lp(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),bindingPause:e=>Lp(`/api/bindings/${encodeURIComponent(e)}/pause`,{method:`POST`}),bindingResume:e=>Lp(`/api/bindings/${encodeURIComponent(e)}/resume`,{method:`POST`}),harnessBindings:()=>Lp(`/api/harness/bindings`),sources:()=>Lp(`/api/sources`),sourceCreate:e=>Lp(`/api/sources`,{method:`POST`,body:{path:e}}),sourceSigning:(e,t)=>Lp(`/api/sources/${encodeURIComponent(e)}/signing`,{method:`POST`,body:{signed:t}}),sourceApproveUnsigned:e=>Lp(`/api/sources/${encodeURIComponent(e)}/aLine truncated
`);u=r.pop()||``;for(let e of r){let t=e.split(`
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(em.value=n.session_id),n.type===`delta`&&(o+=n.text,am.value=am.value?{...am.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],am.value=am.value?{...am.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);tm.value=[...tm.value,{from:`assistant`,text:o,tool_calls:a}],am.value=null,rm.value=`Ready`,await bm()}catch(e){let t=e;t.name===`AbortError`&&!c?(am.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},rm.value=`Stopped`):(am.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Yp(r):void 0,isRetry:i},rm.value=`Error — retry available`)}finally{clearTimeout(l),vm=null,im.value=!1}}function jee(){rm.value=`Stopping…`,em.value&&X.chatCancel(em.value).catch(()=>{}),ym()}function Mee(){Hi(()=>{bm().catch(e=>{rm.value=e.message||`Chat unavailable`})}),Ki(()=>{ym()})}var Nee=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],Pee=I({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return Y(`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)=>(B(),V(`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":N(Zp),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:A(r(!e.open))},[W(N(vd),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:A(r(e.open))},[W(N(Jd),{size:22})],2)],8,Nee))}});function Em(e){return typeof e==`string`?`'${e}'`:new Iee().serialize(e)}var Fee=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Dm=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[Fee.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Om(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Dm[n]?Dm[n]:n+128,s=a<128&&Dm[a]?Dm[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Iee=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Om(e,t):n===`number`&&r===`number`?e-t:Om(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Om),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`FloatLine truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&($p.value=n.session_id),n.type===`delta`&&(o+=n.text,im.value=im.value?{...im.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],im.value=im.value?{...im.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);em.value=[...em.value,{from:`assistant`,text:o,tool_calls:a}],im.value=null,nm.value=`Ready`,await ym()}catch(e){let t=e;t.name===`AbortError`&&!c?(im.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},nm.value=`Stopped`):(im.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Jp(r):void 0,isRetry:i},nm.value=`Error — retry available`)}finally{clearTimeout(l),_m=null,rm.value=!1}}function Mee(){nm.value=`Stopping…`,$p.value&&X.chatCancel($p.value).catch(()=>{}),vm()}function Nee(){Vi(()=>{ym().catch(e=>{nm.value=e.message||`Chat unavailable`})}),Gi(()=>{vm()})}var Pee=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],Fee=I({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return Y(`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)=>(B(),V(`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":N(Xp),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:A(r(!e.open))},[W(N(_d),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:A(r(e.open))},[W(N(qd),{size:22})],2)],8,Pee))}});function Tm(e){return typeof e==`string`?`'${e}'`:new Lee().serialize(e)}var Iee=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Em=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[Iee.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Dm(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Em[n]?Em[n]:n+128,s=a<128&&Em[a]?Em[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Lee=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Dm(e,t):n===`number`&&r===`number`?e-t:Dm(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Dm),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`FloatLine truncated
`)].join(`
`))}return()=>i.value||r.value||o.value?Is(t.default({present:o.value})[0],{ref:e=>{let t=Qm(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),gg=I({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=mh(n.default()),r=e.findIndex(e=>e.type!==Ko);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?q(t,i.props):t,o=os({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),_g=[`area`,`img`,`input`],vg=I({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&_g.includes(r)?()=>Is(r,t):r===`template`?()=>Is(gg,t,{default:n.default}):()=>Is(e.as,t,{default:n.default})}});function yg(){let e=M();return{primitiveElement:e,currentElement:J(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:Qm(e))}}var[bg,xg]=Nm(`CollapsibleRoot`),Sg=I({__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=ph(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=vn(r);return xg({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Z(),(e,t)=>(B(),H(N(vg),{as:e.as,"as-child":r.asChild,"data-state":N(i)?`open`:`closed`,"data-disabled":N(a)?``:void 0},{default:P(()=>[R(e.$slots,`default`,{open:N(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),Cg=I({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=bg();i.contentId||=ag(void 0,`reka-collapsible-content`);let a=M(),{forwardRef:o,currentElement:s}=Z(),c=M(0),l=M(0),u=J(()=>i.open.value),d=M(u.value),f=M();F(()=>[u.value,a.value?.present],async()=>{await qn();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=J(()=>d.value&&i.open.value);return Hi(()=>{requestAnimationFrame(()=>{d.value=!1})}),$m(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(e,t)=>(B(),H(N(hg),{ref_key:`presentRef`,ref:a,present:e.forceMount||N(i).open.value,"force-mount":!0},{default:P(({present:t})=>[W(N(vg),q(e.$attrs,{id:N(i).contentId,ref:N(o),"as-child":n.asChild,as:e.as,hidden:t?void 0:N(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:N(i).open.value?`open`:`closed`,"data-disabled":N(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:P(()=>[!N(i).unmountOnHide.value||t?R(e.$slots,`default`,{key:0}):K(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),wg=I({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Z();let n=bg();return(e,r)=>(B(),H(N(vg),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":N(n).contentId,"aria-expanded":N(n).open.value,"data-state":N(n).open.value?`open`:`closed`,"data-disabled":N(n).disabled?.value?``:void 0,disabled:N(n).disabled?.value,onClick:N(n).onOpenToggle},{default:P(()=>[R(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Tg({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 Eg({type:e,defaultValue:t,modelValue:n}){return e||Tg({type:e,defaultValue:t,modelValue:n})}function Dg({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Og(e,t){let n=J(()=>Eg(e)),r=ph(e,`modelValue`,t,{defaultValue:Dg(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=km(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Lm(t,e)){let n=t.findIndex(t=>km(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:J(()=>n.value===`single`)}}var[kg,Ag]=Nm(`AccordionRoot`),jg=I({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:! Line truncated
`))}return()=>i.value||r.value||o.value?Fs(t.default({present:o.value})[0],{ref:e=>{let t=Zm(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),hg=I({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=ph(n.default()),r=e.findIndex(e=>e.type!==Go);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?q(t,i.props):t,o=as({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),gg=[`area`,`img`,`input`],_g=I({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&gg.includes(r)?()=>Fs(r,t):r===`template`?()=>Fs(hg,t,{default:n.default}):()=>Fs(e.as,t,{default:n.default})}});function vg(){let e=M();return{primitiveElement:e,currentElement:J(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:Zm(e))}}var[yg,bg]=Mm(`CollapsibleRoot`),xg=I({__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=fh(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=vn(r);return bg({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Z(),(e,t)=>(B(),H(N(_g),{as:e.as,"as-child":r.asChild,"data-state":N(i)?`open`:`closed`,"data-disabled":N(a)?``:void 0},{default:P(()=>[R(e.$slots,`default`,{open:N(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),Sg=I({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=yg();i.contentId||=ig(void 0,`reka-collapsible-content`);let a=M(),{forwardRef:o,currentElement:s}=Z(),c=M(0),l=M(0),u=J(()=>i.open.value),d=M(u.value),f=M();F(()=>[u.value,a.value?.present],async()=>{await qn();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=J(()=>d.value&&i.open.value);return Vi(()=>{requestAnimationFrame(()=>{d.value=!1})}),Qm(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(e,t)=>(B(),H(N(mg),{ref_key:`presentRef`,ref:a,present:e.forceMount||N(i).open.value,"force-mount":!0},{default:P(({present:t})=>[W(N(_g),q(e.$attrs,{id:N(i).contentId,ref:N(o),"as-child":n.asChild,as:e.as,hidden:t?void 0:N(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:N(i).open.value?`open`:`closed`,"data-disabled":N(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:P(()=>[!N(i).unmountOnHide.value||t?R(e.$slots,`default`,{key:0}):K(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),Cg=I({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Z();let n=yg();return(e,r)=>(B(),H(N(_g),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":N(n).contentId,"aria-expanded":N(n).open.value,"data-state":N(n).open.value?`open`:`closed`,"data-disabled":N(n).disabled?.value?``:void 0,disabled:N(n).disabled?.value,onClick:N(n).onOpenToggle},{default:P(()=>[R(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function wg({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 Tg({type:e,defaultValue:t,modelValue:n}){return e||wg({type:e,defaultValue:t,modelValue:n})}function Eg({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Dg(e,t){let n=J(()=>Tg(e)),r=fh(e,`modelValue`,t,{defaultValue:Eg(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Om(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Im(t,e)){let n=t.findIndex(t=>Om(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:J(()=>n.value===`single`)}}var[Og,kg]=Mm(`AccordionRoot`),Ag=I({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:! Line truncated
- a positive number
- less than the value passed to \`max\` (or ${lS} if no \`max\` prop is set)
- less than the value passed to \`max\` (or ${cS} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`),null)}function mS(e){return fS(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${lS}\`.`),lS)}var hS=I({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:lS},getValueLabel:{type:Function,required:!1,default:(e,t)=>fS(e)?`${Math.round(e/t*lS)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;Z();let i=ph(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=ph(n,`max`,r,{passive:n.max===void 0});F(()=>i.value,async e=>{let t=pS(e,n.max);t!==e&&(await qn(),i.value=t)},{immediate:!0}),F(()=>n.max,e=>{let t=mS(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=J(()=>Im(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return dS({modelValue:i,max:a,progressState:o}),(e,t)=>(B(),H(N(vg),{"as-child":e.asChild,as:e.as,"aria-valuemax":N(a),"aria-valuemin":0,"aria-valuenow":fS(N(i))?N(i):void 0,"aria-valuetext":e.getValueText?.(N(i),N(a)),"aria-label":e.getValueLabel(N(i),N(a)),role:`progressbar`,"data-state":o.value,"data-value":N(i)??void 0,"data-max":N(a)},{default:P(()=>[R(e.$slots,`default`,{modelValue:N(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),gS=I({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=uS();return Z(),(e,r)=>(B(),H(N(vg),q(t,{"data-state":N(n).progressState.value,"data-value":N(n).modelValue?.value??void 0,"data-max":N(n).max.value}),{default:P(()=>[R(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),_S=`radio.select`;function vS(e,t,n){Fm(_S,n,{originalEvent:e,value:t})}var yS=I({inheritAttrs:!1,__name:`Radio`,props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:checked`,`select`],setup(e,{emit:t}){let n=e,r=t,i=ph(n,`checked`,r,{passive:n.checked===void 0}),{value:a}=vn(n),{forwardRef:o,currentElement:s}=Z(),c=Lh(s),l=Bh(),u=J(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);function d(e){n.disabled||vS(e,n.value,e=>{r(`select`,e),!e?.defaultPrevented&&(i.value=!0,c.value&&e.stopPropagation())})}return(e,t)=>(B(),V(z,null,[W(N(vg),q({id:e.id,ref:N(o),role:`radio`,type:e.as===`button`?`button`:void 0,as:e.as,"aria-checked":N(i)??!1,"aria-label":u.value,"as-child":e.asChild,disabled:e.disabled?``:void 0,"data-state":N(i)?`checked`:`unchecked`,"data-disabled":e.disabled?``:void 0,value:N(a),required:e.required,name:e.name},{...N(l),...e.$attrs},{onClick:Ll(d,[`stop`])}),{default:P(()=>[R(e.$slots,`default`,{checked:N(i)})]),_:3},16,[`id`,`type`,`as`,`aria-checked`,`aria-label`,`as-child`,`disabled`,`data-state`,`data-disabled`,`value`,`required`,`name`]),N(c)&&e.name?(B(),H(N(q_),q({key:0,type:`radio`,tabindex:`-1`,value:N(a),checked:!!N(i),name:e.name,disabled:e.disabled,required:e.required},N(l)),null,16,[`value`,`checked`,`name`,`disabled`,`required`])):K(`v-if`,!0)],64))}}),[bS,xS]=Nm(`RadioGroupRoot`),SS=I({__name:`RadioGroupRoot`,props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Z(),o=ph(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:c,orientation:l,name:u,required:d,dir:f}=vn(n),p=Mh(f),m=Lh(a);return xS({modelValue:o,changeModelValue:e=>{o.value=e},disabled:s,loop:c,orientation:l,name:u?.value,required:d}),(e,t)=>(B(),H(N(kb),{"as-child":``,orientation:N(l),dir:N(p),loop:N(c)},{default:P(()=>[W(N(vg),{ref:N(i),role:`radiogroup`,"data-disabled":N(s)?``:void 0,"as-child":e.asChild,as:e.as,"aria-orientation":N(l),"aria-required":N(d),dir:N(p)},{default:P(()=>[R(e.$slots,`default`,{modelValue:N(o)}),N(m)&&N(u)?(B(),H(N(q_),{key:0,required:N(d),disabled:N(s),value:N(o),name:N(u)},null,8,[`required`,`disabled`,`value`,`name`])):K(`v-if`,!0)]),_:3},8,[`data-disabled`,`as-child`,`as`,`aria-orientation`,`aria-required`,`dir`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),[Jee,CS]=Nm(`RadioGroupItem`),wS=I({inheritAttrs:!1,__name:`RadioGroupItem`,props:{id:{type:String,required:!1},value:{type:nuLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:qT(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>qT(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=JT(c),u=e+1<n.length?JT(n[e+1]):null;if(l&&u&&Ste(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=JT(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>qT(e)),rows:r.map(e=>e.map(e=>qT(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:qT(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1]);continue}if(c.startsWith(`>`)){o(),s(),t.push({kind:`blockquote`,inline:qT(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function JT(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 Ste(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Cte={class:`[overflow-wrap:anywhere]`},wte={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Tte={class:`font-mono text-[0.85em]`},Ete={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Dte={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Ote={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},kte={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Ate={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},jte={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Mte={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Nte={key:8,class:`mb-2.5 last:mb-0`},Pte=I({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=J(()=>xte(t.text));return(e,t)=>(B(),V(`div`,Cte,[(B(!0),V(z,null,L(n.value,(e,t)=>(B(),V(z,{key:t},[e.kind===`pre`?(B(),V(`pre`,wte,[U(`code`,Tte,j(e.code),1)])):e.kind===`table`?(B(),V(`table`,Ete,[U(`thead`,null,[U(`tr`,null,[(B(!0),V(z,null,L(e.head,(e,t)=>(B(),V(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[W(KT,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(B(!0),V(z,null,L(e.rows,(e,t)=>(B(),V(`tr`,{key:t},[(B(!0),V(z,null,L(e,(e,t)=>(B(),V(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[W(KT,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(B(),V(`blockquote`,Dte,[W(KT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(B(),V(`h1`,Ote,[W(KT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(B(),V(`h2`,kte,[W(KT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(B(),V(`h3`,Ate,[W(KT,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(B(),V(`ul`,jte,[(B(!0),V(z,null,L(e.items,(e,t)=>(B(),V(`li`,{key:t},[W(KT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(B(),V(`ol`,Mte,[(B(!0),V(z,null,L(e.items,(e,t)=>(B(),V(`li`,{key:t},[W(KT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(B(),V(`p`,Nte,[W(KT,{inline:e.inline},null,8,[`inline`])])):K(``,!0)],64))),128))]))}}),Fte={class:`truncate`},Ite=I({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=$i(`RouterLink`);return B(),H(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:P(()=>[W(N(Ku),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,Fte,j(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Lte={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Rte={class:`font-semibold text-foreground`},zte={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Bte=I({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=J(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=J(()=>t.tool.parameters||t.tool.Parameters||``),i=J(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=J(()=>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?(B(),H(Ite,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(B(),V(`div`,Lte,[W(N(qd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,Rte,j(n.value),1),r.value?(B(),V(`code`,zte,j(r.value),1)):K(``,!0),U(`span`,{class:A(N(Y)(`text-fg-muted`,i.value&&`text-danger`))},j(a.value),3)]))}}),Vte={key:0,class:`mb-2 grid gap-0.5 text-xs`},Hte={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Ute={key:3,class:`whitespace-pre-wrap`},YT=I({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(B(),V(`div`,{class:A([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:A(N(Y)(`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?(B(),V(`div`,Vte,[(B(!0),V(z,null,L(e.tools,(t,n)=>(B(),H(Bte,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):K(``,!0),e.media.length?(B(),V(`div`,Hte,[(B(!0),V(z,null,L(e.media,(e,t)=>(B(),H(pte,{key:t,attachment:e},null,8,[`attachment`]))),128))])):K(``,!0),e.assistant?(B(),H(Pte,{key:2,text:e.text},null,8,[`text`])):(B(),V(`div`,Ute,j(e.text),1)),R(t.$slots,`default`)],2)],2))}}),Wte={class:`w-full self-center justify-self-center py-6 text-center`},Gte={class:`grid gap-2`},Kte=[`onCLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>LA?`${n.slice(0,LA).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var zA=[`title`],BA=I({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>uA(n.event)),a=J(()=>RA(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=J(()=>n.event.at?vk(n.event.at):`—`);return(e,t)=>(B(),H(N(PA),{class:A(i.value>0?`cursor-pointer`:``),role:i.value>0?`link`:void 0,tabindex:i.value>0?0:void 0,title:i.value>0?`Open task details`:void 0,onClick:o,onKeydown:[Rl(Ll(o,[`prevent`]),[`enter`]),Rl(Ll(o,[`prevent`]),[`space`])]},{default:P(()=>[W(N($),{class:`font-medium`},{default:P(()=>[G(j(n.event.kind||n.event.type||`event`),1)]),_:1}),W(N($),{class:`font-mono`},{default:P(()=>[G(j(i.value>0?`#${i.value}`:`—`),1)]),_:1}),W(N($),{class:`w-[55%] max-w-0`},{default:P(()=>[U(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},j(a.value.text),9,zA)]),_:1}),W(N($),null,{default:P(()=>[G(j(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),VA=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function HA(e){return(Number(e?.task_id)||0)>0}function UA(e,t){return t===`tasks`?HA(e):t!==`system`||!HA(e)}function WA(e,t){return e.filter(e=>UA(e,t))}function GA(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function KA(e,t){return`${e}:${t??0}`}function qA(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=KA(RA(n).text,r),a=t[t.length-1];if(a&&a.key===i){a.count+=1,a.events.push(n);continue}t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var JA={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},YA={class:`max-h-[28rem] overflow-y-auto`},XA=[`aria-expanded`,`aria-label`,`onClick`],ZA=[`title`],QA=I({__name:`LiveActivityCard`,setup(e){let t=uE(),{activity:n,streamKind:r,streamState:i}=ju(bO()),a=M(`all`),o=J(()=>WA(n.value,a.value)),s=J(()=>GA(o.value.length,a.value)),c=Jt(new Set),l=J(()=>qA(o.value));function u(e){c.has(e)?c.delete(e):c.add(e)}function d(e){return c.has(e.key)}function f(e){return RA(e.representative)}function p(e){return e.representative.at?vk(e.representative.at):`—`}function m(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(B(),H(N(dk),null,{default:P(()=>[W(N(gk),null,{default:P(()=>[W(N(_k),null,{default:P(()=>[...t[1]||=[G(`Live activity`,-1)]]),_:1}),W(N(fk),{class:`flex items-center gap-2`},{default:P(()=>[W(N(AA),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:N(VA)},null,8,[`modelValue`,`options`]),W(N(ck),{variant:N(r)},{default:P(()=>[G(j(N(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),W(N(pk),null,{default:P(()=>[U(`div`,JA,[U(`div`,YA,[W(N(MA),null,{default:P(()=>[W(N(IA),{class:`sticky top-0 z-10 bg-card`},{default:P(()=>[W(N(PA),null,{default:P(()=>[W(N(FA),null,{default:P(()=>[...t[2]||=[G(`Event`,-1)]]),_:1}),W(N(FA),null,{default:P(()=>[...t[3]||=[G(`Task`,-1)]]),_:1}),W(N(FA),null,{default:P(()=>[...t[4]||=[G(`Detail`,-1)]]),_:1}),W(N(FA),null,{default:P(()=>[...t[5]||=[G(`When`,-1)]]),_:1})]),_:1})]),_:1}),W(N(NA),null,{default:P(()=>[o.value.length?K(``,!0):(B(),H(N(PA),{key:0},{default:P(()=>[W(N($),{colspan:`4`},{default:P(()=>[W(N(ek),null,{default:P(()=>[W(N(rk),null,{default:P(()=>[W(N(ok),null,{default:P(()=>[G(j(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(B(!0),V(z,{key:1},L(l.value,e=>(B(),V(z,{key:e.key},[e.count===1?(B(),H(BA,{key:0,event:e.representative,onOpen:m},null,8,[`event`])):(B(),V(z,{key:1},[W(N(PA),{class:A(e.taskID>0?`cursor-pointer`:``),role:e.taskID>0?`link`:void 0,tabindex:e.taskID>0?0:void 0,title:e.taskID>0?`Open task details`:void 0,onClick:t=>e.taskID>0&&m(e.taskID),onKeydown:[Rl(Ll(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),Rl(Ll(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`space`])]},{default:P(()=>[W(N($),{class:`font-medium`},{default:P(()=>[U(`button`,{type:`button`,class:`inline-flex items-center gap-1 rounded hover:opacity-80`,"aria-expanded":d(e),"aria-label":`${d(e)?`Hide`:`Show`} ${e.count} ${e.label} events`,onClick:Ll(t=>u(e.key),[`stop`])},[d(e)?(B(),H(N($u),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(B(),H(N(ed),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),G(` `+j(e.label)+` `,1),W(N(ck),{variant:`idle`},{default:P(()=>[G(`×`+j(e.count),1)]),_:2},1024)],8,XA)]),_:2},1024),W(N($),{class:`font-mono`},{default:P(()=>[G(j(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),W(N($),{class:`w-[55%] max-w-0`},{default:P(()=>[U(`span`,{class:`block truncate`,title:f(e).truncated?f(e).full:void 0},j(f(e).text),9,ZA)]),_:2},1024),W(N($),null,{default:P(()=>[G(j(p(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(B(!0),V(z,{key:0},L(e.events,(t,n)=>(B(),H(BA,{key:`${e.key}:${n}`,event:t,onO 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 yM(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 bM(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 xM(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 SM(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 CM=M([]),wM=M([]),TM=M(!0),EM=M(null),DM=M(null),OM=M(!1),kM=M(null);async function AM(){try{let e=await X.eventTypes();TM.value=e.enabled!==!1,CM.value=e.event_types||[],wM.value=e.proposals||[],EM.value=null}catch(e){EM.value=e.message||String(e)}}function jM(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function MM(e){kM.value=null,DM.value=e}function NM(e){let t=VM.value.find(t=>String(t.id)===e.sample_id);MM({mode:`proposal`,id:null,source:e.source,name:``,rule:jM(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function PM(e=``){MM({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function FM(e){MM({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:jM(e.rule),headersText:``,body:``,exampleHeaders:{}})}function IM(){DM.value=null}async function LM(){let e=DM.value;if(e){OM.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:SM(e.rule)});else{let t=e.mode===`paste`?vM(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:SM(e.rule),example:{headers:t,body:e.body}})}DM.value=null,await AM()}catch(e){kM.value=e.message||String(e)}finally{OM.value=!1}}}var RM=M(null);async function zM(){let e=RM.value;if(RM.value=null,e)try{await X.eventTypeDelete(e.id),await AM()}catch(e){EM.value=e.message||String(e)}}var BM=100,VM=M([]),HM=M(!0),UM=M(null),WM=M(!0),GM=M(null);async function KM(){try{let e=await X.captures(BM);HM.value=e.enabled!==!1,VM.value=e.captures||[],UM.value=null}catch(e){UM.value=e.message||String(e)}finally{WM.value=!1}}function qM(e){let t=VM.value.find(t=>t.id===e);return t&&(GM.value=t),!!t}function JM(){VM.value.length&&(GM.value=VM.value[0])}function YM(){xO(`captures`,()=>{KM(),AM()})}var XM=`archie.theme`,ZM=`archie.density`,QM=`archie.motion`,$M=`archie.tooltips`;function eN(e,t,n){try{let r=localStorage.getItem(e);return t.includes(r)?r:n}catch{return n}}function tN(e,t){try{localStorage.setItem(e,t)}catch{}}function nN(e){if(e!==`system`)return e;try{return matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}catch{return`dark`}}var rN=Au(`appearance`,()=>{let e=M(eN(XM,[`system`,`dark`,`light`],`dark`)),t=M(eN(ZM,[`comfortable`,`compact`],`comfortable`)),n=M(eN(QM,[`system`,`reduced`],`system`)),r=M(eN($M,[`on`,`off`],`on`)===`on`),i=!1;function a(){document.documentElement.dataset.theme=nN(e.value)}function o(t){e.value=t,a(),tN(XM,t)}function s(e){t.value=e,document.documentElement.dataset.density=e,tN(ZM,e)}function c(e){n.value=e,document.documentElement.dataset.motion=e,tN(QM,e)}function l(e){r.value=e,tN($M,e?`on`:`off`)}function u(){if(!i){i=!0,a(),document.documentElement.dataset.density=t.value,document.documentElement.dataset.motion=n.value;try{matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>{e.value===`system`&&a()})}catch{}}}return{theme:e,density:t,motion:n,tooltipsEnabled:r,initialize:u,setTheme:o,setDensity:s,setMotion:c,setTooltips:l}}),iN=I({__name:`Tooltip`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=zh(n,t),{tooltipsEnabled:i}=ju(rN());return(e,t)=>(B(),H(N(BC),q({"data-slot":`tooltip`},N(r),{disabled:n.disabled||!N(i)}),{default:P(t=>[R(e.$slots,`default`,ye(as(t)))]),_:3},16,[`disabled`]))}}),aN=I({inheritAttrs:!1,__name:`TooltipContent`,props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:0},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=zh(ow(n,`class`),r);return(e,t)=>(B(),H(N(WC),null,{default:P( Line truncated
Defaulting to \`null\`.`),null)}function pS(e){return dS(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${cS}\`.`),cS)}var mS=I({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:cS},getValueLabel:{type:Function,required:!1,default:(e,t)=>dS(e)?`${Math.round(e/t*cS)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;Z();let i=fh(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=fh(n,`max`,r,{passive:n.max===void 0});F(()=>i.value,async e=>{let t=fS(e,n.max);t!==e&&(await qn(),i.value=t)},{immediate:!0}),F(()=>n.max,e=>{let t=pS(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=J(()=>Fm(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return uS({modelValue:i,max:a,progressState:o}),(e,t)=>(B(),H(N(_g),{"as-child":e.asChild,as:e.as,"aria-valuemax":N(a),"aria-valuemin":0,"aria-valuenow":dS(N(i))?N(i):void 0,"aria-valuetext":e.getValueText?.(N(i),N(a)),"aria-label":e.getValueLabel(N(i),N(a)),role:`progressbar`,"data-state":o.value,"data-value":N(i)??void 0,"data-max":N(a)},{default:P(()=>[R(e.$slots,`default`,{modelValue:N(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),hS=I({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=lS();return Z(),(e,r)=>(B(),H(N(_g),q(t,{"data-state":N(n).progressState.value,"data-value":N(n).modelValue?.value??void 0,"data-max":N(n).max.value}),{default:P(()=>[R(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),gS=`radio.select`;function _S(e,t,n){Pm(gS,n,{originalEvent:e,value:t})}var vS=I({inheritAttrs:!1,__name:`Radio`,props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:checked`,`select`],setup(e,{emit:t}){let n=e,r=t,i=fh(n,`checked`,r,{passive:n.checked===void 0}),{value:a}=vn(n),{forwardRef:o,currentElement:s}=Z(),c=Ih(s),l=zh(),u=J(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);function d(e){n.disabled||_S(e,n.value,e=>{r(`select`,e),!e?.defaultPrevented&&(i.value=!0,c.value&&e.stopPropagation())})}return(e,t)=>(B(),V(z,null,[W(N(_g),q({id:e.id,ref:N(o),role:`radio`,type:e.as===`button`?`button`:void 0,as:e.as,"aria-checked":N(i)??!1,"aria-label":u.value,"as-child":e.asChild,disabled:e.disabled?``:void 0,"data-state":N(i)?`checked`:`unchecked`,"data-disabled":e.disabled?``:void 0,value:N(a),required:e.required,name:e.name},{...N(l),...e.$attrs},{onClick:Il(d,[`stop`])}),{default:P(()=>[R(e.$slots,`default`,{checked:N(i)})]),_:3},16,[`id`,`type`,`as`,`aria-checked`,`aria-label`,`as-child`,`disabled`,`data-state`,`data-disabled`,`value`,`required`,`name`]),N(c)&&e.name?(B(),H(N(K_),q({key:0,type:`radio`,tabindex:`-1`,value:N(a),checked:!!N(i),name:e.name,disabled:e.disabled,required:e.required},N(l)),null,16,[`value`,`checked`,`name`,`disabled`,`required`])):K(`v-if`,!0)],64))}}),[yS,bS]=Mm(`RadioGroupRoot`),xS=I({__name:`RadioGroupRoot`,props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Z(),o=fh(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:c,orientation:l,name:u,required:d,dir:f}=vn(n),p=jh(f),m=Ih(a);return bS({modelValue:o,changeModelValue:e=>{o.value=e},disabled:s,loop:c,orientation:l,name:u?.value,required:d}),(e,t)=>(B(),H(N(Ob),{"as-child":``,orientation:N(l),dir:N(p),loop:N(c)},{default:P(()=>[W(N(_g),{ref:N(i),role:`radiogroup`,"data-disabled":N(s)?``:void 0,"as-child":e.asChild,as:e.as,"aria-orientation":N(l),"aria-required":N(d),dir:N(p)},{default:P(()=>[R(e.$slots,`default`,{modelValue:N(o)}),N(m)&&N(u)?(B(),H(N(K_),{key:0,required:N(d),disabled:N(s),value:N(o),name:N(u)},null,8,[`required`,`disabled`,`value`,`name`])):K(`v-if`,!0)]),_:3},8,[`data-disabled`,`as-child`,`as`,`aria-orientation`,`aria-required`,`dir`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),[Yee,SS]=Mm(`RadioGroupItem`),CS=I({inheritAttrs:!1,__name:`RadioGroupItem`,props:{id:{type:String,required:!1},value:{type:nuLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:KT(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>KT(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=qT(c),u=e+1<n.length?qT(n[e+1]):null;if(l&&u&&Cte(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=qT(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>KT(e)),rows:r.map(e=>e.map(e=>KT(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:KT(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1]);continue}if(c.startsWith(`>`)){o(),s(),t.push({kind:`blockquote`,inline:KT(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function qT(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 Cte(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var wte={class:`[overflow-wrap:anywhere]`},Tte={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Ete={class:`font-mono text-[0.85em]`},Dte={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Ote={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},kte={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Ate={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},jte={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Mte={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Nte={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Pte={key:8,class:`mb-2.5 last:mb-0`},Fte=I({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=J(()=>Ste(t.text));return(e,t)=>(B(),V(`div`,wte,[(B(!0),V(z,null,L(n.value,(e,t)=>(B(),V(z,{key:t},[e.kind===`pre`?(B(),V(`pre`,Tte,[U(`code`,Ete,j(e.code),1)])):e.kind===`table`?(B(),V(`table`,Dte,[U(`thead`,null,[U(`tr`,null,[(B(!0),V(z,null,L(e.head,(e,t)=>(B(),V(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[W(GT,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(B(!0),V(z,null,L(e.rows,(e,t)=>(B(),V(`tr`,{key:t},[(B(!0),V(z,null,L(e,(e,t)=>(B(),V(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[W(GT,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(B(),V(`blockquote`,Ote,[W(GT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(B(),V(`h1`,kte,[W(GT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(B(),V(`h2`,Ate,[W(GT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(B(),V(`h3`,jte,[W(GT,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(B(),V(`ul`,Mte,[(B(!0),V(z,null,L(e.items,(e,t)=>(B(),V(`li`,{key:t},[W(GT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(B(),V(`ol`,Nte,[(B(!0),V(z,null,L(e.items,(e,t)=>(B(),V(`li`,{key:t},[W(GT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(B(),V(`p`,Pte,[W(GT,{inline:e.inline},null,8,[`inline`])])):K(``,!0)],64))),128))]))}}),Ite={class:`truncate`},Lte=I({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Qi(`RouterLink`);return B(),H(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:P(()=>[W(N(Gu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,Ite,j(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Rte={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},zte={class:`font-semibold text-foreground`},Bte={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Vte=I({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=J(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=J(()=>t.tool.parameters||t.tool.Parameters||``),i=J(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=J(()=>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?(B(),H(Lte,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(B(),V(`div`,Rte,[W(N(Kd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,zte,j(n.value),1),r.value?(B(),V(`code`,Bte,j(r.value),1)):K(``,!0),U(`span`,{class:A(N(Y)(`text-fg-muted`,i.value&&`text-danger`))},j(a.value),3)]))}}),Hte={key:0,class:`mb-2 grid gap-0.5 text-xs`},Ute={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Wte={key:3,class:`whitespace-pre-wrap`},JT=I({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(B(),V(`div`,{class:A([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:A(N(Y)(`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?(B(),V(`div`,Hte,[(B(!0),V(z,null,L(e.tools,(t,n)=>(B(),H(Vte,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):K(``,!0),e.media.length?(B(),V(`div`,Ute,[(B(!0),V(z,null,L(e.media,(e,t)=>(B(),H(mte,{key:t,attachment:e},null,8,[`attachment`]))),128))])):K(``,!0),e.assistant?(B(),H(Fte,{key:2,text:e.text},null,8,[`text`])):(B(),V(`div`,Wte,j(e.text),1)),R(t.$slots,`default`)],2)],2))}}),Gte={class:`w-full self-center justify-self-center py-6 text-center`},Kte={class:`grid gap-2`},qte=[`onCLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>IA?`${n.slice(0,IA).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var RA=[`title`],zA=I({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>lA(n.event)),a=J(()=>LA(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=J(()=>n.event.at?_k(n.event.at):`—`);return(e,t)=>(B(),H(N(NA),{class:A(i.value>0?`cursor-pointer`:``),role:i.value>0?`link`:void 0,tabindex:i.value>0?0:void 0,title:i.value>0?`Open task details`:void 0,onClick:o,onKeydown:[Ll(Il(o,[`prevent`]),[`enter`]),Ll(Il(o,[`prevent`]),[`space`])]},{default:P(()=>[W(N($),{class:`font-medium`},{default:P(()=>[G(j(n.event.kind||n.event.type||`event`),1)]),_:1}),W(N($),{class:`font-mono`},{default:P(()=>[G(j(i.value>0?`#${i.value}`:`—`),1)]),_:1}),W(N($),{class:`w-[55%] max-w-0`},{default:P(()=>[U(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},j(a.value.text),9,RA)]),_:1}),W(N($),null,{default:P(()=>[G(j(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),BA=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function VA(e){return(Number(e?.task_id)||0)>0}function HA(e,t){return t===`tasks`?VA(e):t!==`system`||!VA(e)}function UA(e,t){return e.filter(e=>HA(e,t))}function WA(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function GA(e,t){return`${e}:${t??0}`}function KA(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=GA(LA(n).text,r),a=t[t.length-1];if(a&&a.key===i){a.count+=1,a.events.push(n);continue}t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var qA={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},JA={class:`max-h-[28rem] overflow-y-auto`},YA=[`aria-expanded`,`aria-label`,`onClick`],XA=[`title`],ZA=I({__name:`LiveActivityCard`,setup(e){let t=lE(),{activity:n,streamKind:r,streamState:i}=Au(yO()),a=M(`all`),o=J(()=>UA(n.value,a.value)),s=J(()=>WA(o.value.length,a.value)),c=Jt(new Set),l=J(()=>KA(o.value));function u(e){c.has(e)?c.delete(e):c.add(e)}function d(e){return c.has(e.key)}function f(e){return LA(e.representative)}function p(e){return e.representative.at?_k(e.representative.at):`—`}function m(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(B(),H(N(uk),null,{default:P(()=>[W(N(hk),null,{default:P(()=>[W(N(gk),null,{default:P(()=>[...t[1]||=[G(`Live activity`,-1)]]),_:1}),W(N(dk),{class:`flex items-center gap-2`},{default:P(()=>[W(N(kA),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:N(BA)},null,8,[`modelValue`,`options`]),W(N(sk),{variant:N(r)},{default:P(()=>[G(j(N(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),W(N(fk),null,{default:P(()=>[U(`div`,qA,[U(`div`,JA,[W(N(jA),null,{default:P(()=>[W(N(FA),{class:`sticky top-0 z-10 bg-card`},{default:P(()=>[W(N(NA),null,{default:P(()=>[W(N(PA),null,{default:P(()=>[...t[2]||=[G(`Event`,-1)]]),_:1}),W(N(PA),null,{default:P(()=>[...t[3]||=[G(`Task`,-1)]]),_:1}),W(N(PA),null,{default:P(()=>[...t[4]||=[G(`Detail`,-1)]]),_:1}),W(N(PA),null,{default:P(()=>[...t[5]||=[G(`When`,-1)]]),_:1})]),_:1})]),_:1}),W(N(MA),null,{default:P(()=>[o.value.length?K(``,!0):(B(),H(N(NA),{key:0},{default:P(()=>[W(N($),{colspan:`4`},{default:P(()=>[W(N($O),null,{default:P(()=>[W(N(nk),null,{default:P(()=>[W(N(ak),null,{default:P(()=>[G(j(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(B(!0),V(z,{key:1},L(l.value,e=>(B(),V(z,{key:e.key},[e.count===1?(B(),H(zA,{key:0,event:e.representative,onOpen:m},null,8,[`event`])):(B(),V(z,{key:1},[W(N(NA),{class:A(e.taskID>0?`cursor-pointer`:``),role:e.taskID>0?`link`:void 0,tabindex:e.taskID>0?0:void 0,title:e.taskID>0?`Open task details`:void 0,onClick:t=>e.taskID>0&&m(e.taskID),onKeydown:[Ll(Il(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),Ll(Il(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`space`])]},{default:P(()=>[W(N($),{class:`font-medium`},{default:P(()=>[U(`button`,{type:`button`,class:`inline-flex items-center gap-1 rounded hover:opacity-80`,"aria-expanded":d(e),"aria-label":`${d(e)?`Hide`:`Show`} ${e.count} ${e.label} events`,onClick:Il(t=>u(e.key),[`stop`])},[d(e)?(B(),H(N(Qu),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(B(),H(N($u),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),G(` `+j(e.label)+` `,1),W(N(sk),{variant:`idle`},{default:P(()=>[G(`×`+j(e.count),1)]),_:2},1024)],8,YA)]),_:2},1024),W(N($),{class:`font-mono`},{default:P(()=>[G(j(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),W(N($),{class:`w-[55%] max-w-0`},{default:P(()=>[U(`span`,{class:`block truncate`,title:f(e).truncated?f(e).full:void 0},j(f(e).text),9,XA)]),_:2},1024),W(N($),null,{default:P(()=>[G(j(p(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(B(!0),V(z,{key:0},L(e.events,(t,n)=>(B(),H(zA,{key:`${e.key}:${n}`,event:t,onO 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 vM(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 yM(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 bM(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 xM(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 SM=M([]),CM=M([]),wM=M(!0),TM=M(null),EM=M(null),DM=M(!1),OM=M(null);async function kM(){try{let e=await X.eventTypes();wM.value=e.enabled!==!1,SM.value=e.event_types||[],CM.value=e.proposals||[],TM.value=null}catch(e){TM.value=e.message||String(e)}}function AM(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function jM(e){OM.value=null,EM.value=e}function MM(e){let t=BM.value.find(t=>String(t.id)===e.sample_id);jM({mode:`proposal`,id:null,source:e.source,name:``,rule:AM(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function NM(e=``){jM({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function PM(e){jM({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:AM(e.rule),headersText:``,body:``,exampleHeaders:{}})}function FM(){EM.value=null}async function IM(){let e=EM.value;if(e){DM.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:xM(e.rule)});else{let t=e.mode===`paste`?_M(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:xM(e.rule),example:{headers:t,body:e.body}})}EM.value=null,await kM()}catch(e){OM.value=e.message||String(e)}finally{DM.value=!1}}}var LM=M(null);async function RM(){let e=LM.value;if(LM.value=null,e)try{await X.eventTypeDelete(e.id),await kM()}catch(e){TM.value=e.message||String(e)}}var zM=100,BM=M([]),VM=M(!0),HM=M(null),UM=M(!0),WM=M(null);async function GM(){try{let e=await X.captures(zM);VM.value=e.enabled!==!1,BM.value=e.captures||[],HM.value=null}catch(e){HM.value=e.message||String(e)}finally{UM.value=!1}}function KM(e){let t=BM.value.find(t=>t.id===e);return t&&(WM.value=t),!!t}function qM(){BM.value.length&&(WM.value=BM.value[0])}function JM(){bO(`captures`,()=>{GM(),kM()})}var YM=`archie.theme`,XM=`archie.density`,ZM=`archie.motion`,QM=`archie.tooltips`;function $M(e,t,n){try{let r=localStorage.getItem(e);return t.includes(r)?r:n}catch{return n}}function eN(e,t){try{localStorage.setItem(e,t)}catch{}}function tN(e){if(e!==`system`)return e;try{return matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}catch{return`dark`}}var nN=ku(`appearance`,()=>{let e=M($M(YM,[`system`,`dark`,`light`],`dark`)),t=M($M(XM,[`comfortable`,`compact`],`comfortable`)),n=M($M(ZM,[`system`,`reduced`],`system`)),r=M($M(QM,[`on`,`off`],`on`)===`on`),i=!1;function a(){document.documentElement.dataset.theme=tN(e.value)}function o(t){e.value=t,a(),eN(YM,t)}function s(e){t.value=e,document.documentElement.dataset.density=e,eN(XM,e)}function c(e){n.value=e,document.documentElement.dataset.motion=e,eN(ZM,e)}function l(e){r.value=e,eN(QM,e?`on`:`off`)}function u(){if(!i){i=!0,a(),document.documentElement.dataset.density=t.value,document.documentElement.dataset.motion=n.value;try{matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>{e.value===`system`&&a()})}catch{}}}return{theme:e,density:t,motion:n,tooltipsEnabled:r,initialize:u,setTheme:o,setDensity:s,setMotion:c,setTooltips:l}}),rN=I({__name:`Tooltip`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=Rh(n,t),{tooltipsEnabled:i}=Au(nN());return(e,t)=>(B(),H(N(zC),q({"data-slot":`tooltip`},N(r),{disabled:n.disabled||!N(i)}),{default:P(t=>[R(e.$slots,`default`,ye(is(t)))]),_:3},16,[`disabled`]))}}),iN=I({inheritAttrs:!1,__name:`TooltipContent`,props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:0},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=Rh(aw(n,`class`),r);return(e,t)=>(B(),H(N(UC),null,{default:P( Line truncated
`)}};vJ.defaultYaml={explicit:!1,version:`1.2`},vJ.defaultTags={"!!":`tag:yaml.org,2002:`};function yJ(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 bJ(e){let t=new Set;return dJ(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function xJ(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function SJ(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=bJ(e);let a=xJ(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(rJ(t.node)||aJ(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 CJ(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=CJ(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=CJ(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=CJ(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=CJ(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function wJ(e,t,n){if(Array.isArray(e))return e.map((e,t)=>wJ(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!sJ(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 TJ=class{constructor(e){Object.defineProperty(this,Qq,{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(!eJ(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=wJ(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?CJ(i,{"":o},``,o):o}},EJ=class extends TJ{constructor(e){super(Kq),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=[],dJ(e,{Node:(e,t)=>{($q(t)||sJ(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||=(wJ(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=DJ(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(yJ(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 DJ(e,t,n){if($q(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(aJ(t)){let r=0;for(let i of t.items){let t=DJ(e,i,n);t>r&&(r=t)}return r}if(nJ(t)){let r=DJ(e,t.key,n),i=DJ(e,t.value,n);return Math.max(r,i)}return 1}var OJ=e=>!e||typeof e!=`function`&&typeof e!=`object`,kJ=class extends TJ{constructor(e){super(Xq),this.value=e}toJSON(e,t){return t?.keep?this.value:wJ(this.value,e,t)}toString(){return String(this.value)}};kJ.BLOCK_FOLDED=`BLOCK_FOLDED`,kJ.BLOCK_LITERAL=`BLOCK_LITERAL`,kJ.PLAIN=`PLAIN`,kJ.QUOTE_DOUBLE=`QUOTE_DOUBLE`,kJ.QUOTE_SINGLE=`QUOTE_SINGLE`;var AJ=`tag:yaml.org,2002:`;function jJ(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 MJ(e,t,n){if(eJ(e)&&(e=e.contents),oJ(e))return e;if(nJ(e)){let t=n.schema[Jq].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 EJ(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=AJ+t.slice(2));let l=jJ(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new kJ(e);return c&&(c.node=t),t Line truncated
`)?LJ(n,t):n.includes(`
`)?`
@@ -60,13 +60,13 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`)+`
`}var wX=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Qq,{value:qq});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 vJ({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Qq]:{value:qq}});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=oJ(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){TX(this.contents)&&this.contents.add(e)}addIn(e,t){TX(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=bJ(this);e.anchor=!t||n.has(t)?xJ(t||`a`,n):t}return new EJ(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}=SJ(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=MJ(e,l,p);return o&&aJ(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new hY(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return TX(this.contents)?this.contents.delete(e):!1}deleteIn(e){return PJ(e)?this.contents!=null&&(this.contents=null,!0):TX(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return aJ(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return PJ(e)?!t&&rJ(this.contents)?this.contents.value:this.contents:aJ(this.contents)?this.contents.getIn(e,t):void 0}has(e){return aJ(this.contents)?this.contents.has(e):!1}hasIn(e){return PJ(e)?this.contents!==void 0:aJ(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=NJ(this.schema,[e],t):TX(this.contents)&&this.contents.set(e,t)}setIn(e,t){PJ(e)?this.contents=t:this.contents==null?this.contents=NJ(this.schema,Array.from(e),t):TX(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 vJ({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 vJ({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 SX(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=wJ(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`?CJ(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 CX(this,e)}};function TX(e){if(aJ(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var EX=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},DX=class extends EX{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},OX=class extends EX{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},kX=(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 AX(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 jX(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(jX(t.key)||jX(t.value))return!0}return!1;default:return!0}}function MX(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&jX(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function NX(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||rJ(e)&&rJ(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var PX=`All mapping items must start at the same column`;function FX({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??xY)(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=AX(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`,PX)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`))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(jX(t.key)||jX(t.value))return!0}return!1;default:return!0}}function MX(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&jX(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function NX(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||rJ(e)&&rJ(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var PX=`All mapping items must start at the same column`;function Mne({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??xY)(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=AX(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`,PX)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||jX(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`,PX);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&MX(r.indent,u,i),n.atKey=!1,NX(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=AX(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&&MX(r.indent,f,i),s=c.range[2];let l=new hY(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 hY(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 jne({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??CY)(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=AX(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&&MX(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function IX(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 LX=`Block collections are not allowed within flow collections`,RX=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function zX({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?xY:CY))(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=AX(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+=`
`+_.comment:g.comment=_.comment);let e=new hY(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 FX({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??CY)(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=AX(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&&MX(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function IX(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 LX=`Block collections are not allowed within flow collections`,RX=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function zX({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?xY:CY))(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=AX(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&&jX(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];nJ(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],RX(m)&&i(r.range,`BLOCK_IN_FLOW`,LX)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);RX(f)&&i(g.range,`BLOCK_IN_FLOW`,LX),n.atKey=!1;let _=AX(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?RX(m)&&i(v.range,`BLOCK_IN_FLOW`,LX):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new hY(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;NX(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new xY(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=IX(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 BX(e,t,n,r,i,a){let o=n.type===`block-map`?FX(e,t,n,r,a):n.type===`block-seq`?jne(e,t,n,r,a):zX(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function VX(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===xY.tagName&&s===`map`||o===CY.tagName&&s===`seq`)return BX(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),BX(e,t,n,i,o)}let l=BX(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=oJ(u)?u:new kJ(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function HX(e,t,n){let r=t.offset,i=UX(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?kJ.BLOCK_FOLDED:kJ.BLOCK_LITERAL,o=t.source?WX(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?`
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function BX(e,t,n,r,i,a){let o=n.type===`block-map`?Mne(e,t,n,r,a):n.type===`block-seq`?FX(e,t,n,r,a):zX(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function VX(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===xY.tagName&&s===`map`||o===CY.tagName&&s===`seq`)return BX(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),BX(e,t,n,i,o)}let l=BX(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=oJ(u)?u:new kJ(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function HX(e,t,n){let r=t.offset,i=UX(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?kJ.BLOCK_FOLDED:kJ.BLOCK_LITERAL,o=t.source?WX(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===kJ.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`):t.length>c||r[0]===` `?(f===` `?f=`
@@ -123,17 +123,17 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`,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)){AZ(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(TZ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=kZ(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(TZ(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(DZ(t.key)&&!TZ(t.sep,`newline`)){let e=kZ(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]}):TZ(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&&!TZ(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)){AZ(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||TZ(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=kZ(OZ(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=kZ(OZ(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function NZ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new wZ||null,prettyErrors:t}}function PZ(e,t={}){let{lineCounter:n,prettyErrors:r}=NZ(t),i=new MZ(n?.addNewLine),a=new uZ(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 DX(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(kX(e,n)),o.warnings.forEach(kX(e,n))),o}function FZ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=PZ(e,n);if(!i)return null;if(i.warnings.forEach(e=>aY(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 IZ(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 eJ(e)&&!r?e.toString(n):new wX(e,r,n).toString(n)}function LZ(e,t){let n=new Map;for(let e of t)n.set(e.name,[...n.get(e.name)??[],e]);return{edges:e.edges,nodes:e.nodes.map(e=>{let{stage:t,occurrence:r}=e.data,i=t===void 0?void 0:n.get(t)?.[r??0];return i?{...e,data:{...e.data,run:i}}:e})}}function RZ(e,t){let n=e=>e.path&&e.path.length>=2?Number(e.path[1]):-1,r=e.nodes.find(e=>JSON.stringify(e.data.path)===JSON.stringify(t))?.data,i=r?.resume??r?.stage;if(!r||!i)return null;let a=Math.max(-1,...e.nodes.filter(e=>e.data.run).map(e=>n(e.data))),o=n(r);if(o<0||o>a)return null;let s=e.nodes.filter(e=>e.data.path?.length===2).sort((e,t)=>n(e.data)-n(t.data)).map(e=>e.data.resume??e.data.stage??``),c=e=>!!e&&s.filter(t=>t===e).length>1;return c(i)||o>0&&c(s[o-1])?{label:`Add an id to resume here`,from:i,blocked:!0}:{label:o===a?`Resume from here`:`Re-run from here`,from:i}}var zZ=140,BZ=280,VZ={"agent.run":`Agent`,"command.run":`Run commands`,"repo.prepare":`Prepare worktree`,"repo.commit":`Commit`,"repo.open-pr":`Open pull request`,"gate.repository":`Repository gate`,"gate.diff-size":`Diff size gate`,"gate.diff-rules":`Diff rules gate`,"forge.comment":`Comment`,"forge.close-issue":`Close issue`,"human.approve":`Human approval`,"workflow.call":`Call workflow`,"workflow.handoff":`Hand off`,"workflow.finish":`Finish`,"review.pr":`Review pull request`,"review.start-round":`Start review round`,"review.reply":`Reply to review`};function HZ(e){return VZ[e]??e}var UZ=/\{\{\s*steps\.([A-Za-z0-9_-]+)\.[^}]*\}\}/g;function WZ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function GZ(e,t){let n=e=>typeof t[e]==`string`?t[e]:``;switch(e){case`agent.run`:return[n(`role`)||`builder`,t.read_only?`read-only`:n(`gate`)?`gated: ${n(`gate`)}`:``].filter(Boolean).join(` · `);case`repo.commit`:return[n(`message`),t.push?`push`:``].filter(Boolean).join(` · `);case`workflow.call`:case`workflow.handoff`:return n(`workflow`);case`workflow.finish`:return n(`status`)||`completed`;case`human.approve`:return n(`then`)?`then ${n(`then`)}`:``;case`gate.repository`:return n(`expect`)===`test-failure`?`tests must fail`:t.repair?`repair if red`:``}return``}function KZ(e){for(let t of[`mission`,`message`,`body`,`plan`,`detail`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.replace(/\{\{\s*([^}]+?)\s*\}\}/g,`‹$1›`).split(`
`).find(e=>e.trim())?.trim()}}function qZ(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(UZ)].map(e=>e[1]))]}function JZ(e){let t=PZ(e).toJS(),n=WZ(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=`start`;r.push({id:s,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let c=[s],l=1,u=new Map,d=e=>{let t=u.get(e)??0;return u.set(e,t+1),t},f=(e,t,n,i,s,c,l)=>{let u=WZ(e)?e:{},f=typeof u.type==`string`?u.type:``,p=WZ(u.settings)?u.settings:{},m=typeof u.id==`string`?u.id:``,h=`step-${t}`,g=s?`${s}/${m||f}`:m||f;r.push({id:h,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:m||t,title:m||HZ(f),type:f,detail:GZ(f,p),summary:KZ(p),when:typeof u.when==`string`?u.when:void 0,retry:WZ(u.retry)&&typeof u.retry.attempts==`number`?u.retry.attempts:void 0,continues:u.on_failure===`continue`,branch:s,path:l,stage:g,occurrence:d(g),...c?{resume:c}:{}}}),m&&a.set(m,h);for(let e of qZ(u.settings,u.when))o.push({from:e,to:h});return h},p=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){if(WZ(t)&&WZ(t.parallel)){let n=Object.entries(t.parallel),r=typeof t.id==`string`?t.id:`parallel`,i=[],a=0;n.forEach(([t,o],s)=>{let u=(s-(n.length-1)/2)*BZ,d=c,m=c;(Array.isArray(o)?o:[]).forEach((i,o)=>{let c=f(i,`${e+1}-${t}-${o+1}`,u,(l+o)*zZ,t,r,[`steps`,e,`parallel`,t,o]);p(d,c,d===m&&s===n.length-1?e-1:void 0),d=[c],a=Math.max(a,o+1)}),i.push(...d)}),c=i,l+=Math.max(a,1);continue}let n=f(t,String(e+1),0,l*zZ,void 0,void 0,[`steps`,e]);p(c,n,e-1),c=[n],l++}r.push({id:`add-end`,type:`add`,position:{x:104,y:l*zZ-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``}}),p(c,`add-end`);for(let{from:e,to:t}of o){let n=a.get(e);n&&(i.some(e=>e.kind===`flow`&&e.source===n&&e.target===t)||i.push({id:`data-${n}-${t}`,source:n,target:t,kind:`data`,label:e,offset:24+14*i.filter(e=>e.kind===`data`).length,sourceHandle:`data-out`,targetHandle:`data-in`}))}return{nodes:r,edges:i}}var YZ={agent:Yu,command:Id,repo:dd,gate:Nd,forge:yd,human:Ud,review:ld,workflow:Kd},XZ={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function ZZ(e){return YZ[e.split(`.`)[0]]??Kd}function QZ(e){return Object.keys(XZ).map(t=>({title:XZ[t],icon:YZ[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}function $Z(e,t){let n=PZ(e).getIn(t,!0);if(tJ(n))return n.toJSON()}function eQ(e,t,n){let r=PZ(e);return r.setIn(t,r.createNode(oQ(n))),r.toString()}function tQ(e,t,n){let r=PZ(e),i=r.get(`steps`,!0);if(iJ(i)||(r.set(`steps`,r.createNode([])),i=r.get(`steps`,!0)),!iJ(i))return{source:e,path:[]};let a=Math.min(Math.max(t+1,0),i.items.length);return i.items.splice(a,0,r.createNode({type:n})),{source:r.toString(),path:[`steps`,a]}}function nQ(e,t){let n=PZ(e),r=n.getIn(t.slice(0,-1),!0),i=t.at(-1);if(!iJ(r)||typeof i!=`number`)return{source:e,path:t};let a=n.createNode(n.getIn(t));return tJ(a)&&a.delete(`id`),r.items.splice(i+1,0,a),{source:n.toString(),path:[...t.slice(0,-1),i+1]}}function rQ(e,t){let n=PZ(e);n.deleteIn(t);let r=t.slice(0,-1);if(r.length>2){let e=n.getIn(r,!0);iJ(e)&&e.items.length===0&&n.deleteIn(r)}return n.toString()}function iQ(e,t,n){let r=PZ(e),i=r.getIn(t.slice(0,-1),!0),a=t.at(-1);if(!iJ(i)||typeof a!=`number`)return{source:e,path:t};let o=a+n;if(o<0||o>=i.items.length)return{source:e,path:t};let[s]=i.items.splice(a,1);return i.items.splice(o,0,s),{source:r.toString(),path:[...t.slice(0,-1),o]}}function aQ(e,t){let n=PZ(e).toJS(),r=Array.isArray(n?.steps)?n.steps:[],i=typeof t[1]==`number`?t[1]:r.length,a=[],o=e=>{if(typeof e!=`object`||!e)return;let t=e;if(typeof t.id==`string`&&a.push(t.id),typeof t.parallel==`object`&&t.parallel!==null)for(let e of Object.values(t.parallel))Array.isArray(e)&&e.forEach(o)};if(r.slice(0,i).forEach(o),t.length===5){let e=r[i]?.parallel?.[t[3]];Array.isArray(e)&&e.slice(0,t[4]).forEach(o)}return a}function oQ(e){if(Array.isArray(e))return e.map(oQ);if(typeof e!=`object`||!e)return e;let t={};for(let[n,r]of Object.entries(e)){if(r===void 0||r===``||r===null)continue;let e=oQ(r);(typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length!==0)&&(t[n]=e)}return t}function sQ(e,t){let n=PZ(e).get(t,!0);return n&&typeof n==`object`&&`toJSON`in n?n.toJSON():PZ(e).get(t)}function cQ(e,t,n){let r=PZ(e),i=oQ({[t]:n})[t];return i===void 0?r.delete(t):r.set(t,r.createNode(i)),r.toString()}function lQ(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function uQ(e,t=[]){let n=PZ(e),r=n.errors[0];if(r)return{ok:!1,message:wQ(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!TQ(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};le Line truncated
`).find(e=>e.trim())?.trim()}}function qZ(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(UZ)].map(e=>e[1]))]}function JZ(e){let t=PZ(e).toJS(),n=WZ(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=`start`;r.push({id:s,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let c=[s],l=1,u=new Map,d=e=>{let t=u.get(e)??0;return u.set(e,t+1),t},f=(e,t,n,i,s,c,l)=>{let u=WZ(e)?e:{},f=typeof u.type==`string`?u.type:``,p=WZ(u.settings)?u.settings:{},m=typeof u.id==`string`?u.id:``,h=`step-${t}`,g=s?`${s}/${m||f}`:m||f;r.push({id:h,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:m||t,title:m||HZ(f),type:f,detail:GZ(f,p),summary:KZ(p),when:typeof u.when==`string`?u.when:void 0,retry:WZ(u.retry)&&typeof u.retry.attempts==`number`?u.retry.attempts:void 0,continues:u.on_failure===`continue`,branch:s,path:l,stage:g,occurrence:d(g),...c?{resume:c}:{}}}),m&&a.set(m,h);for(let e of qZ(u.settings,u.when))o.push({from:e,to:h});return h},p=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){if(WZ(t)&&WZ(t.parallel)){let n=Object.entries(t.parallel),r=typeof t.id==`string`?t.id:`parallel`,i=[],a=0;n.forEach(([t,o],s)=>{let u=(s-(n.length-1)/2)*BZ,d=c,m=c;(Array.isArray(o)?o:[]).forEach((i,o)=>{let c=f(i,`${e+1}-${t}-${o+1}`,u,(l+o)*zZ,t,r,[`steps`,e,`parallel`,t,o]);p(d,c,d===m&&s===n.length-1?e-1:void 0),d=[c],a=Math.max(a,o+1)}),i.push(...d)}),c=i,l+=Math.max(a,1);continue}let n=f(t,String(e+1),0,l*zZ,void 0,void 0,[`steps`,e]);p(c,n,e-1),c=[n],l++}r.push({id:`add-end`,type:`add`,position:{x:104,y:l*zZ-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``}}),p(c,`add-end`);for(let{from:e,to:t}of o){let n=a.get(e);n&&(i.some(e=>e.kind===`flow`&&e.source===n&&e.target===t)||i.push({id:`data-${n}-${t}`,source:n,target:t,kind:`data`,label:e,offset:24+14*i.filter(e=>e.kind===`data`).length,sourceHandle:`data-out`,targetHandle:`data-in`}))}return{nodes:r,edges:i}}var YZ={agent:Ju,command:Fd,repo:ud,gate:Md,forge:vd,human:Hd,review:cd,workflow:Gd},XZ={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function ZZ(e){return YZ[e.split(`.`)[0]]??Gd}function QZ(e){return Object.keys(XZ).map(t=>({title:XZ[t],icon:YZ[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}function $Z(e,t){let n=PZ(e).getIn(t,!0);if(tJ(n))return n.toJSON()}function eQ(e,t,n){let r=PZ(e);return r.setIn(t,r.createNode(oQ(n))),r.toString()}function tQ(e,t,n){let r=PZ(e),i=r.get(`steps`,!0);if(iJ(i)||(r.set(`steps`,r.createNode([])),i=r.get(`steps`,!0)),!iJ(i))return{source:e,path:[]};let a=Math.min(Math.max(t+1,0),i.items.length);return i.items.splice(a,0,r.createNode({type:n})),{source:r.toString(),path:[`steps`,a]}}function nQ(e,t){let n=PZ(e),r=n.getIn(t.slice(0,-1),!0),i=t.at(-1);if(!iJ(r)||typeof i!=`number`)return{source:e,path:t};let a=n.createNode(n.getIn(t));return tJ(a)&&a.delete(`id`),r.items.splice(i+1,0,a),{source:n.toString(),path:[...t.slice(0,-1),i+1]}}function rQ(e,t){let n=PZ(e);n.deleteIn(t);let r=t.slice(0,-1);if(r.length>2){let e=n.getIn(r,!0);iJ(e)&&e.items.length===0&&n.deleteIn(r)}return n.toString()}function iQ(e,t,n){let r=PZ(e),i=r.getIn(t.slice(0,-1),!0),a=t.at(-1);if(!iJ(i)||typeof a!=`number`)return{source:e,path:t};let o=a+n;if(o<0||o>=i.items.length)return{source:e,path:t};let[s]=i.items.splice(a,1);return i.items.splice(o,0,s),{source:r.toString(),path:[...t.slice(0,-1),o]}}function aQ(e,t){let n=PZ(e).toJS(),r=Array.isArray(n?.steps)?n.steps:[],i=typeof t[1]==`number`?t[1]:r.length,a=[],o=e=>{if(typeof e!=`object`||!e)return;let t=e;if(typeof t.id==`string`&&a.push(t.id),typeof t.parallel==`object`&&t.parallel!==null)for(let e of Object.values(t.parallel))Array.isArray(e)&&e.forEach(o)};if(r.slice(0,i).forEach(o),t.length===5){let e=r[i]?.parallel?.[t[3]];Array.isArray(e)&&e.slice(0,t[4]).forEach(o)}return a}function oQ(e){if(Array.isArray(e))return e.map(oQ);if(typeof e!=`object`||!e)return e;let t={};for(let[n,r]of Object.entries(e)){if(r===void 0||r===``||r===null)continue;let e=oQ(r);(typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length!==0)&&(t[n]=e)}return t}function sQ(e,t){let n=PZ(e).get(t,!0);return n&&typeof n==`object`&&`toJSON`in n?n.toJSON():PZ(e).get(t)}function cQ(e,t,n){let r=PZ(e),i=oQ({[t]:n})[t];return i===void 0?r.delete(t):r.set(t,r.createNode(i)),r.toString()}function lQ(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function uQ(e,t=[]){let n=PZ(e),r=n.errors[0];if(r)return{ok:!1,message:wQ(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!TQ(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};le Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:bQ(e)}))}var vQ=/^(\s*)(-\s+)?/,yQ=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function bQ(e){let{code:t,comment:n}=xQ(e),r=SQ(t);return n&&r.push({text:n,kind:`comment`}),r}function xQ(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t){r===t&&(t=``);continue}if(r===`"`||r===`'`){t=r;continue}if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function SQ(e){if(!e)return[];let t=[],n=vQ.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=yQ.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,...CQ(i[4]??``)]):[...t,...CQ(r)]}function CQ(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 wQ(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function TQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function EQ(e){return typeof e==`string`&&e.trim()!==``}var DQ={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},OQ={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},kQ={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},AQ={class:`min-w-0 flex-1`},jQ=[`value`,`placeholder`],MQ={class:`truncate font-mono text-[11px] text-fg-subtle`},NQ={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},PQ={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},FQ={key:1,class:`space-y-1.5`},IQ=[`title`],LQ=[`value`],RQ=[`value`],zQ={key:3,class:`flex flex-wrap items-center gap-1 pt-0.5`},BQ=[`onClick`],VQ=[`onClick`],HQ={key:2,class:`divide-y divide-border rounded-md border border-border`},UQ=[`title`],WQ=[`value`,`onChange`],GQ=[`value`],KQ=[`value`,`onInput`],qQ=[`value`,`onFocus`,`onInput`],JQ=[`title`],YQ={key:0,class:`text-xs text-danger`},XQ={class:`space-y-2`},ZQ={class:`divide-y divide-border rounded-md border border-border`},QQ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},$Q=[`value`],e$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},t$=[`value`],n$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},r$=[`value`],i$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},a$={class:`flex items-center border-t border-border px-4 py-2.5`},o$=I({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>$Z(n.yaml,n.path)??{}),a=J(()=>typeof i.value.type==`string`?i.value.type:``),o=J(()=>n.vocabulary.find(e=>e.name===a.value)),s=J(()=>typeof i.value.settings==`object`&&i.value.settings!==null?i.value.settings:{}),c=J(()=>aQ(n.yaml,n.path)),l=J(()=>o.value?.settings&&i.value.settings?hQ(i.value.settings,o.value.settings,`settings`):``),u=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],d=/mission|body|detail|plan|rules/;function f(e,t){return t.type===`string`?t.enum?`select`:d.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let p=J(()=>{let e=Object.entries(o.value?.settings?.properties??{}).map(([e,t])=>({key:e,schema:t,kind:f(e,t)})),t=e.filter(e=>u.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>u.indexOf(e.key)-u.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function m(e){let{id:t,type:i,...a}=e;r(`update:yaml`,eQ(n.yaml,n.path,{id:t,type:i,...a}))}function h(e,t){m({...i.value,[e]:t})}function g(e){h(`retry`,{...i.value.retry,...e})}function _(e,t){m({...i.value,settings:{...s.value,[e]:t}})}let v=M(null);function y(e,t){let n=v.value??p.value.lead?.key;if(!n)return;let r=typeof s.value[n]==`string`?s.value[n]:``,i=`{{ steps.${e}.${t} }}`;_(n,r?`${r.trimEnd()} ${i}`:i)}let b=M({});function x(e,t){try{_(e,t.trim()?FZ(t):void 0),b.value={...b.value,[e]:``}}catch(t){b.value={...b.value,[e]:String(t.message).split(`
`)[0]}}}let S=e=>e===void 0?``:IZ(e).trimEnd(),C=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),w=e=>typeof s.value[e]==`string`?s.value[e]:``;return(e,t)=>(B(),V(`aside`,DQ,[U(`header`,OQ,[U(`span`,kQ,[(B(),H(ta(N(ZZ)(a.value)),{class:`size-4`}))]),U(`div`,AQ,[U(`input`,{value:i.value.id??``,class:`w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline`,placeholder:N(HZ)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>h(`id`,e.target.value)},null,40,jQ),U(`div`,MQ,j(a.value),1)]),W(N(Q),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:P(()=>[W(N(Jd))]),_:1})]),U(`div`,NQ,[l.value?(B(),V(`p`,PQ,j(l.value),1)):K(``,!0),p.value.lead?(B(),V(`section`,FQ,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:p.value.lead.schema.description},[G(j(C(p.value.lead.key,p.value.lead.schema))+` `,1),p.value.lead.schema.description?(B(),H(N(ad),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,IQ),p.value.lead.kind===`select`?(B(),V(`select`,{key:0,class:`h-9 w-full rounded-md border border-input bg-background px-2`,value:w(p.value.lead.key),onChange:t[2]||=e=>_(p.value.lead.key,e.target.value||void 0)},[t[13]||=U(`option`,{value:``},`Default`,-1),(B(!0),V(z,null,L(p.value.lead.schema.enum,e=>(B(),V(`option`,{key:e,value:e},j(e),9,RQ))),128))],40,LQ)):p.value.lead.kind===`text`?(B(),H(N($w),{key:1,"model-value":w(p.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:t[3]||=e=>v.value=p.value.lead.key,"onUpdate:modelValue":t[4]||=e=>_(p.value.lead.key,String(e))},null,8,[`model-value`])):(B(),H(N(OD),{key:2,"model-value":w(p.value.lead.key),onFocus:t[5]||=e=>v.value=p.value.lead.key,"onUpdate:modelValue":t[6]||=e=>_(p.value.lead.key,String(e))},null,8,[`model-value`])),c.value.length&&p.value.lead.kind!==`select`?(B(),V(`div`,zQ,[t[14]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(B(!0),V(z,null,L(c.value,e=>(B(),V(z,{key:e},[U(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>y(e,`summary`)},j(e),9,BQ),U(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>y(e,`result`)},j(e)+`.result`,9,VQ)],64))),128))])):K(``,!0)])):K(``,!0),p.value.compact.length?(B(),V(`section`,HQ,[(B(!0),V(z,null,L(p.value.compact,e=>(B(),V(`div`,{key:e.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:e.schema.description},[G(j(C(e.key,e.schema))+` `,1),e.schema.description?(B(),H(N(ad),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,UQ),e.kind===`boolean`?(B(),H(N($D),{key:0,"model-value":s.value[e.key]===!0,"onUpdate:modelValue":t=>_(e.key,t||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):e.kind===`select`?(B(),V(`select`,{key:1,class:`h-7 max-w-40 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:w(e.key),onChange:t=>_(e.key,t.target.value||void 0)},[t[15]||=U(`option`,{value:``},`Default`,-1),(B(!0),V(z,null,L(e.schema.enum,e=>(B(),V(`option`,{key:e,value:e},j(e),9,GQ))),128))],40,WQ)):e.kind===`number`?(B(),V(`input`,{key:2,type:`number`,class:`h-7 w-24 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:s.value[e.key]??``,onInput:t=>_(e.key,t.target.value===``?void 0:Number(t.target.value))},null,40,KQ)):(B(),V(`input`,{key:3,class:`h-7 w-40 rounded-md border border-input bg-background px-2 text-[13px]`,value:w(e.key),onFocus:t=>v.value=e.key,onInput:t=>_(e.key,t.target.value)},null,40,qQ))]))),128))])):K(``,!0),(B(!0),V(z,null,L(p.value.long,e=>(B(),V(`section`,{key:e.key,class:`space-y-1.5`},[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[G(j(C(e.key,e.schema))+` `,1),e.schema.description?(B(),H(N(ad),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,JQ),e.kind===`text`?(B(),H(N($w),{key:0,"model-value":w(e.key),class:`min-h-20 text-[13px]`,onFocus:t=>v.value=e.key,"onUpdate:modelValue":t=>_(e.key,String(t))},null,8,[`model-value`,`onFocus`,`onUpdate:modelValue`])):e.kind===`lines`?(B(),H(N($w),{key:1,"model-value":Array.isArray(s.value[e.key])?s.value[e.key].join(`
`)[0]}}}let S=e=>e===void 0?``:IZ(e).trimEnd(),C=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),w=e=>typeof s.value[e]==`string`?s.value[e]:``;return(e,t)=>(B(),V(`aside`,DQ,[U(`header`,OQ,[U(`span`,kQ,[(B(),H(ea(N(ZZ)(a.value)),{class:`size-4`}))]),U(`div`,AQ,[U(`input`,{value:i.value.id??``,class:`w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline`,placeholder:N(HZ)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>h(`id`,e.target.value)},null,40,jQ),U(`div`,MQ,j(a.value),1)]),W(N(Q),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:P(()=>[W(N(qd))]),_:1})]),U(`div`,NQ,[l.value?(B(),V(`p`,PQ,j(l.value),1)):K(``,!0),p.value.lead?(B(),V(`section`,FQ,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:p.value.lead.schema.description},[G(j(C(p.value.lead.key,p.value.lead.schema))+` `,1),p.value.lead.schema.description?(B(),H(N(id),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,IQ),p.value.lead.kind===`select`?(B(),V(`select`,{key:0,class:`h-9 w-full rounded-md border border-input bg-background px-2`,value:w(p.value.lead.key),onChange:t[2]||=e=>_(p.value.lead.key,e.target.value||void 0)},[t[13]||=U(`option`,{value:``},`Default`,-1),(B(!0),V(z,null,L(p.value.lead.schema.enum,e=>(B(),V(`option`,{key:e,value:e},j(e),9,RQ))),128))],40,LQ)):p.value.lead.kind===`text`?(B(),H(N(Qw),{key:1,"model-value":w(p.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:t[3]||=e=>v.value=p.value.lead.key,"onUpdate:modelValue":t[4]||=e=>_(p.value.lead.key,String(e))},null,8,[`model-value`])):(B(),H(N(DD),{key:2,"model-value":w(p.value.lead.key),onFocus:t[5]||=e=>v.value=p.value.lead.key,"onUpdate:modelValue":t[6]||=e=>_(p.value.lead.key,String(e))},null,8,[`model-value`])),c.value.length&&p.value.lead.kind!==`select`?(B(),V(`div`,zQ,[t[14]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(B(!0),V(z,null,L(c.value,e=>(B(),V(z,{key:e},[U(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>y(e,`summary`)},j(e),9,BQ),U(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>y(e,`result`)},j(e)+`.result`,9,VQ)],64))),128))])):K(``,!0)])):K(``,!0),p.value.compact.length?(B(),V(`section`,HQ,[(B(!0),V(z,null,L(p.value.compact,e=>(B(),V(`div`,{key:e.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:e.schema.description},[G(j(C(e.key,e.schema))+` `,1),e.schema.description?(B(),H(N(id),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,UQ),e.kind===`boolean`?(B(),H(N(QD),{key:0,"model-value":s.value[e.key]===!0,"onUpdate:modelValue":t=>_(e.key,t||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):e.kind===`select`?(B(),V(`select`,{key:1,class:`h-7 max-w-40 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:w(e.key),onChange:t=>_(e.key,t.target.value||void 0)},[t[15]||=U(`option`,{value:``},`Default`,-1),(B(!0),V(z,null,L(e.schema.enum,e=>(B(),V(`option`,{key:e,value:e},j(e),9,GQ))),128))],40,WQ)):e.kind===`number`?(B(),V(`input`,{key:2,type:`number`,class:`h-7 w-24 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:s.value[e.key]??``,onInput:t=>_(e.key,t.target.value===``?void 0:Number(t.target.value))},null,40,KQ)):(B(),V(`input`,{key:3,class:`h-7 w-40 rounded-md border border-input bg-background px-2 text-[13px]`,value:w(e.key),onFocus:t=>v.value=e.key,onInput:t=>_(e.key,t.target.value)},null,40,qQ))]))),128))])):K(``,!0),(B(!0),V(z,null,L(p.value.long,e=>(B(),V(`section`,{key:e.key,class:`space-y-1.5`},[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[G(j(C(e.key,e.schema))+` `,1),e.schema.description?(B(),H(N(id),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,JQ),e.kind===`text`?(B(),H(N(Qw),{key:0,"model-value":w(e.key),class:`min-h-20 text-[13px]`,onFocus:t=>v.value=e.key,"onUpdate:modelValue":t=>_(e.key,String(t))},null,8,[`model-value`,`onFocus`,`onUpdate:modelValue`])):e.kind===`lines`?(B(),H(N(Qw),{key:1,"model-value":Array.isArray(s.value[e.key])?s.value[e.key].join(`
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>_(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(B(),V(z,{key:2},[W(N($w),{"model-value":S(s.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>x(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),b.value[e.key]?(B(),V(`span`,YQ,j(b.value[e.key]),1)):K(``,!0)],64))]))),128)),U(`section`,XQ,[t[21]||=U(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),U(`div`,ZQ,[U(`label`,QQ,[t[16]||=U(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),U(`input`,{class:`h-7 w-48 rounded-md border border-input bg-background px-2 font-mono text-xs`,placeholder:`always`,value:i.value.when??``,onInput:t[7]||=e=>h(`when`,e.target.value)},null,40,$Q)]),U(`label`,e$,[t[18]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),U(`select`,{class:`h-7 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:i.value.on_failure??``,onChange:t[8]||=e=>h(`on_failure`,e.target.value||void 0)},[...t[17]||=[U(`option`,{value:``},`Park the task`,-1),U(`option`,{value:`continue`},`Continue`,-1)]],40,t$)]),U(`label`,n$,[t[19]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),U(`input`,{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:i.value.retry?.attempts??``,onInput:t[9]||=e=>g({attempts:e.target.value===``?void 0:Number(e.target.value)})},null,40,r$)]),U(`label`,i$,[t[20]||=U(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),W(N(VD),{"model-value":i.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":t[10]||=e=>g({backoff:e||void 0})},null,8,[`model-value`])])])])]),U(`footer`,a$,[W(N(Q),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[11]||=e=>r(`remove`)},{default:P(()=>[W(N(Rd)),t[22]||=G(` Delete step`,-1)]),_:1}),W(N(Q),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[12]||=e=>r(`close`)},{default:P(()=>[...t[23]||=[G(`Done`,-1)]]),_:1})])]))}}),s$=`repository_path`;function c$(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:s$,path:n.trim(),type:`string`,required:!0}),r}function l$(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function u$(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=l$(MN(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 d$(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:MN(e.value,i.type??`string`)})}return n}function f$(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 p$(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...p$(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...p$(n,r)]}):[]}function m$(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function h$(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 g$(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var _$={class:`flex h-full flex-col`},v$={class:`flex items-center gap-2 border-b border-border px-4 py-3`},y$={class:`min-w-0 flex-1 truncate text-sm font-medium`},b$={key:0,class:`flex flex-1 items-center justify-center`},x$={class:`space-y-1.5`},S$=[`disabled`],C$=[`value`],w$={key:1,class:`space-y-1.5`},T$=[`value`],E$=[`title`],D$={class:`space-y-1.5`},O$={id:`bind-paths`},k$=[`value`],A$={class:`divide-y divide-border rounded-md border border-border`},j$={class:`flex items-center gap-1.5 text-xs`},M$={class:`font-mono`},N$={class:`text-fg-subtle`},P$={key:0,class:`text-danger`,title:`Required`},F$=[`title`,`aria-label`,`onClick`],I$=[`onUpdate:modelValue`,`aria-label`],L$=[`onUpdate:modelValue`,`aria-label`],R$={key:2,class:`text-xs text-danger`},z$=[`title`],B$={key:0,class:`space-y-1 px-3 py-2`},V$={key:0,class:`text-xs text-danger`},H$={key:1,class:`truncate font-mono text-xs text-success`},U$={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},W$={class:`space-y-2`},G$={key:0,role:`alert`,class:`text-xs text-danger`},K$={key:1,class:`texLine truncated
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(B(),V(z,{key:2},[W(N(Qw),{"model-value":S(s.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>x(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),b.value[e.key]?(B(),V(`span`,YQ,j(b.value[e.key]),1)):K(``,!0)],64))]))),128)),U(`section`,XQ,[t[21]||=U(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),U(`div`,ZQ,[U(`label`,QQ,[t[16]||=U(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),U(`input`,{class:`h-7 w-48 rounded-md border border-input bg-background px-2 font-mono text-xs`,placeholder:`always`,value:i.value.when??``,onInput:t[7]||=e=>h(`when`,e.target.value)},null,40,$Q)]),U(`label`,e$,[t[18]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),U(`select`,{class:`h-7 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:i.value.on_failure??``,onChange:t[8]||=e=>h(`on_failure`,e.target.value||void 0)},[...t[17]||=[U(`option`,{value:``},`Park the task`,-1),U(`option`,{value:`continue`},`Continue`,-1)]],40,t$)]),U(`label`,n$,[t[19]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),U(`input`,{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:i.value.retry?.attempts??``,onInput:t[9]||=e=>g({attempts:e.target.value===``?void 0:Number(e.target.value)})},null,40,r$)]),U(`label`,i$,[t[20]||=U(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),W(N(BD),{"model-value":i.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":t[10]||=e=>g({backoff:e||void 0})},null,8,[`model-value`])])])])]),U(`footer`,a$,[W(N(Q),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[11]||=e=>r(`remove`)},{default:P(()=>[W(N(Ld)),t[22]||=G(` Delete step`,-1)]),_:1}),W(N(Q),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[12]||=e=>r(`close`)},{default:P(()=>[...t[23]||=[G(`Done`,-1)]]),_:1})])]))}}),s$=`repository_path`;function c$(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:s$,path:n.trim(),type:`string`,required:!0}),r}function l$(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function u$(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=l$(MN(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 d$(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:MN(e.value,i.type??`string`)})}return n}function f$(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 p$(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...p$(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...p$(n,r)]}):[]}function m$(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function h$(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 g$(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var _$={class:`flex h-full flex-col`},v$={class:`flex items-center gap-2 border-b border-border px-4 py-3`},y$={class:`min-w-0 flex-1 truncate text-sm font-medium`},b$={key:0,class:`flex flex-1 items-center justify-center`},x$={class:`space-y-1.5`},S$=[`disabled`],C$=[`value`],w$={key:1,class:`space-y-1.5`},T$=[`value`],E$=[`title`],D$={class:`space-y-1.5`},O$={id:`bind-paths`},k$=[`value`],A$={class:`divide-y divide-border rounded-md border border-border`},j$={class:`flex items-center gap-1.5 text-xs`},M$={class:`font-mono`},N$={class:`text-fg-subtle`},P$={key:0,class:`text-danger`,title:`Required`},F$=[`title`,`aria-label`,`onClick`],I$=[`onUpdate:modelValue`,`aria-label`],L$=[`onUpdate:modelValue`,`aria-label`],R$={key:2,class:`text-xs text-danger`},z$=[`title`],B$={key:0,class:`space-y-1 px-3 py-2`},V$={key:0,class:`text-xs text-danger`},H$={key:1,class:`truncate font-mono text-xs text-success`},U$={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},W$={class:`space-y-2`},G$={key:0,role:`alert`,class:`text-xs text-danger`},K$={key:1,class:`texLine truncated
`).replace(`
`,`
+`).split(`
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function Fne(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=Ine(n.code,e);return Array.isArray(e)?e.some(e=>F5(n[r],e,t,n.type===`keyup`)):F5(n[r],e,t,n.type===`keyup`)}}function Ine(e,t){return t.includes(e)?`code`:`key`}function I5(e,t){let n=J(()=>pn(t?.target)??Nne),r=ln(pn(e)===!0),i=!1,a=new Set,o=c(pn(e));F(()=>pn(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),N0([`blur`,`contextmenu`],s),F0((...e)=>o(...e),e=>{let n=pn(t?.actInsideInputWithModifier)??!0,a=pn(t?.preventDefault)??!1;if(i=Pne(e),(!i||i&&!n)&&P5(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}),F0((...e)=>o(...e),e=>{let n=pn(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&P5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=pn(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?Fne(e,a):e}return r}var L5=`vue-flow__node-desc`,R5=`vue-flow__edge-desc`,Lne=`vue-flow__aria-live`,z5=[`Enter`,` `,`Escape`],B5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function V5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function H5(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 U5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function W5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function G5(e,t){return{x:W5(e.x,t[0][0],t[1][0]),y:W5(e.y,t[0][1],t[1][1])}}function K5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function q5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function J5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!q5(e)}function Y5(e){return J5(e)&&`computedPosition`in e}function X5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Rne(e){return X5(e.width)&&X5(e.height)&&X5(e.x)&&X5(e.y)}function zne(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:an({width:0,height:0}),computedPosition:an({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:W7(e.data)?e.data:{},events:an(W7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function Z5(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:W7(e.data)?e.data:{},events:an(W7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Q5(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 Bne(...e){if(e.length===3){let[t,n,r]=e;return Q5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>q5(e)&&e.source===r).map(e=>n.find(t=>J5(t)&&t.id===e.target))}function Vne(...e){if(e.length===3){let[t,n,r]=e;return Q5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>q5(e)&&e.target===r).map(e=>n.find(t=>J5(t)&&t.id===e.source))}function $5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function Hne(e,t){return t.some(t=>q5(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 e7({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function t7({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?P7(s,o):s}function Une(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 n7({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function Wne({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function r7(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=Une(t,n7({...r.computedPosition,...r.dimensions}))}return Wne(t)}function i7(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...t7(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectabl 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 Ine(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=Lne(n.code,e);return Array.isArray(e)?e.some(e=>F5(n[r],e,t,n.type===`keyup`)):F5(n[r],e,t,n.type===`keyup`)}}function Lne(e,t){return t.includes(e)?`code`:`key`}function I5(e,t){let n=J(()=>pn(t?.target)??Pne),r=ln(pn(e)===!0),i=!1,a=new Set,o=c(pn(e));F(()=>pn(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),N0([`blur`,`contextmenu`],s),F0((...e)=>o(...e),e=>{let n=pn(t?.actInsideInputWithModifier)??!0,a=pn(t?.preventDefault)??!1;if(i=Fne(e),(!i||i&&!n)&&P5(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}),F0((...e)=>o(...e),e=>{let n=pn(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&P5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=pn(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?Ine(e,a):e}return r}var L5=`vue-flow__node-desc`,R5=`vue-flow__edge-desc`,Rne=`vue-flow__aria-live`,z5=[`Enter`,` `,`Escape`],B5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function V5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function H5(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 U5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function W5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function G5(e,t){return{x:W5(e.x,t[0][0],t[1][0]),y:W5(e.y,t[0][1],t[1][1])}}function K5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function q5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function J5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!q5(e)}function Y5(e){return J5(e)&&`computedPosition`in e}function X5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function zne(e){return X5(e.width)&&X5(e.height)&&X5(e.x)&&X5(e.y)}function Bne(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:an({width:0,height:0}),computedPosition:an({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:W7(e.data)?e.data:{},events:an(W7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function Z5(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:W7(e.data)?e.data:{},events:an(W7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Q5(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 Vne(...e){if(e.length===3){let[t,n,r]=e;return Q5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>q5(e)&&e.source===r).map(e=>n.find(t=>J5(t)&&t.id===e.target))}function Hne(...e){if(e.length===3){let[t,n,r]=e;return Q5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>q5(e)&&e.target===r).map(e=>n.find(t=>J5(t)&&t.id===e.source))}function $5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function Une(e,t){return t.some(t=>q5(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 e7({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function t7({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?P7(s,o):s}function Wne(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 n7({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function Gne({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function r7(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=Wne(t,n7({...r.computedPosition,...r.dimensions}))}return Gne(t)}function i7(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...t7(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectabl Line truncated
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
Node: ${e}
@@ -153,4 +153,4 @@ Edge: ${e}
Source: ${t}
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},A7=class extends Error{constructor(e,...t){super(k7[e]?.call(k7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function j7(e){return`clientX`in e}function ere(e){return`sourceEvent`in e}function M7(e,t){let n=j7(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 N7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function tre(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function P7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var nre=()=>!0;function F7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function rre(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())H5(i,V5(e))>0&&r.push(e);return r}var ire=250;function are(e,t,n,r){let i=[],a=1/0,o=rre(e,n,t+ire);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}=E7(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 I7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=nre},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:_}=M7(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=L7(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===A5.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=R7(t,e,a,p,n,!0)}return b}function L7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function ore(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function sre(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function R7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===A5.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,...E7(o,c,c.position,!0)}:c}var z7={[D5.Left]:D5.Right,[D5.Right]:D5.Left,[D5.Top]:D5.Bottom,[D5.Bottom]:D5.Top},cre=[`production`,`prod`];function B7(e,...t){V7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function V7(){return!cre.includes(`production`)}function H7(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,...U5(t)}}):null}function U7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),qn(()=>{o.blur()})):n([e])}function W7(e){return N(e)!==void 0}function lre(e,t,n,r){if(!e||!e.source||!e.target)return n(new A7(O7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=q5(e)?e:{...e,id:$5(e)},i=Z5(i,void 0,r),!Hne(i,t)&&i}function ure(e,t,n,r,i){if(!t.source||!t.target)return i(new A7(O7.EDGE_INVALID,e.id)),!1;if(!n)return i(new A7(O7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?$5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function G7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!J5(o)){n(new A7(O7.NODE_INVALID,o?.id));continue}let s=zne(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 A7(O7.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 K7(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 q7(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}`;K7(`sourcLine 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`},A7=class extends Error{constructor(e,...t){super(k7[e]?.call(k7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function j7(e){return`clientX`in e}function tre(e){return`sourceEvent`in e}function M7(e,t){let n=j7(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 N7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function nre(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function P7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var rre=()=>!0;function F7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function ire(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())H5(i,V5(e))>0&&r.push(e);return r}var are=250;function ore(e,t,n,r){let i=[],a=1/0,o=ire(e,n,t+are);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}=E7(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 I7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=rre},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:_}=M7(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=L7(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===A5.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=R7(t,e,a,p,n,!0)}return b}function L7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function sre(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function cre(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function R7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===A5.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,...E7(o,c,c.position,!0)}:c}var z7={[D5.Left]:D5.Right,[D5.Right]:D5.Left,[D5.Top]:D5.Bottom,[D5.Bottom]:D5.Top},lre=[`production`,`prod`];function B7(e,...t){V7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function V7(){return!lre.includes(`production`)}function H7(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,...U5(t)}}):null}function U7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),qn(()=>{o.blur()})):n([e])}function W7(e){return N(e)!==void 0}function ure(e,t,n,r){if(!e||!e.source||!e.target)return n(new A7(O7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=q5(e)?e:{...e,id:$5(e)},i=Z5(i,void 0,r),!Une(i,t)&&i}function dre(e,t,n,r,i){if(!t.source||!t.target)return i(new A7(O7.EDGE_INVALID,e.id)),!1;if(!n)return i(new A7(O7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?$5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function G7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!J5(o)){n(new A7(O7.NODE_INVALID,o?.id));continue}let s=Bne(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 A7(O7.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 K7(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 q7(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}`;K7(`sourcLine truncated
+2
View File
@@ -342,6 +342,8 @@ export const api = {
}),
sourceName: <T = unknown>(path: string, name: string) =>
request<T>(`/api/sources/${encodeURIComponent(path)}/name`, { method: "PUT", body: { name } }),
sourceDeliveryHeader: <T = unknown>(path: string, header: string) =>
request<T>(`/api/sources/${encodeURIComponent(path)}/delivery-header`, { method: "PUT", body: { header } }),
sourceDelete: (path: string) =>
request<void>(`/api/sources/${encodeURIComponent(path)}`, { method: "DELETE", parse: false }),
sourceSecret: <T = unknown>(path: string) =>
+10
View File
@@ -47,6 +47,7 @@ const {
requireSigning,
approveUnsigned,
rename,
setDeliveryHeader,
remove,
refusals,
} = useSources();
@@ -121,6 +122,15 @@ function url(source: Source): string {
:disabled="busy"
@change="rename(source, ($event.target as HTMLInputElement).value)"
/>{{ source.path }}
<input
class="block w-full bg-transparent font-mono text-xs text-fg-muted outline-none placeholder:text-fg-subtle focus:underline"
:value="source.delivery_header ?? ''"
placeholder="Delivery ID header"
title="The header the sender repeats on every retry of one delivery; a retry then starts no second run"
:aria-label="`Delivery ID header of source ${source.path}`"
:disabled="busy"
@change="setDeliveryHeader(source, ($event.target as HTMLInputElement).value)"
/>
<div
v-if="refusals[source.path]"
class="text-xs font-sans text-destructive"
+2
View File
@@ -8,6 +8,8 @@ export interface Source {
path: string;
/** The operator's label; the path stays the source's identity. */
name?: string;
/** The header the sender repeats on every retry of one delivery. */
delivery_header?: string;
signing?: string;
/** Present only on create and on a new secret. */
secret?: string;
+2
View File
@@ -66,6 +66,8 @@ export function useSources() {
run(() => api.sourceApproveUnsigned<Source>(source.path)),
rename: (source: Source, name: string) =>
run(() => api.sourceName<Source>(source.path, name.trim())),
setDeliveryHeader: (source: Source, header: string) =>
run(() => api.sourceDeliveryHeader<Source>(source.path, header.trim())),
// An armed binding on the source refuses the delete; the refusal shows
// as the panel's failure.
remove: (source: Source) => run(() => api.sourceDelete(source.path)),