Compare commits

...
7 Commits
Author SHA1 Message Date
sam 1b8abd3509 chore(release): v1.55.0
deploy / gate (push) Canceled after 0s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
2026-10-16 03:57:48 +11:00
sam 7ebf842c5c feat(agent): frame the default SOUL around event-driven automation 2026-10-16 03:57:08 +11:00
sam 74699fcd21 refactor: remove personas
Personas were a misread requirement: SOUL is the chat identity and
identities are per action. The selected persona's prompt never reached the
model. Drops the resource, /personality, the chat selector, the settings
page and ChatService.SetPersona, and deletes stored persona documents.
2026-10-16 03:57:08 +11:00
sam f8b061c314 chore(release): v1.54.3
deploy / gate (push) Canceled after 0s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
2026-10-16 03:46:35 +11:00
sam c5158edb6c feat(gateway): chat reads workflows and validates drafts
workflow_list, workflow_get and workflow_step_types read the org's
definitions and step catalog; workflow_validate runs the editor's save
check on a proposed definition without saving it.
2026-10-16 03:46:27 +11:00
sam 9ad270b9a4 chore(release): v1.54.2
deploy / gate (push) Canceled after 0s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
2026-10-16 03:33:58 +11:00
sam 51328c9585 fix(deps): ai-sdk v0.3.1 so Gemini Interactions tool calls get valid arguments 2026-10-16 03:33:49 +11:00
57 changed files with 720 additions and 1434 deletions

No files matched your search

+23
View File
@@ -5,6 +5,29 @@ release's per-component sections are labelled beneath its heading.
## [Unreleased]
## [1.55.0] - 2026-10-16
### archied
- Personas are gone: the Personas settings page, the chat Personality selector and `/personality`. A selected persona never changed what the model was told; SOUL (Settings → SOUL) is the one place to set Archie's identity and style. Stored persona settings are deleted on upgrade.
- The shipped SOUL describes Archie as the assistant for an event-driven automation system rather than a coding assistant. A SOUL you have saved is kept as it is.
## [1.54.3] - 2026-10-16
### archied
- Chat can help write a workflow: it reads your workflows and the step catalog, writes a definition, and checks it the same way saving does, fixing what the check reports. It does not save; paste the YAML it gives you into the editor's YAML view and save there.
## [1.54.2] - 2026-10-16
### archied
- Tool calls from Gemini models (Interactions API) receive their arguments intact. Any tool that takes arguments, such as `dashboard_navigate` in chat, failed with "invalid character '{' after top-level value".
### archie-agent
- Agent steps on Gemini models (Interactions API) pass tools their arguments intact instead of failing to decode them.
## [1.54.1] - 2026-10-16
### archied
+6
View File
@@ -81,6 +81,9 @@
"/news/archie/1.53.0/": "/news/1.53.0/",
"/news/archie/1.54.0/": "/news/1.54.0/",
"/news/archie/1.54.1/": "/news/1.54.1/",
"/news/archie/1.54.2/": "/news/1.54.2/",
"/news/archie/1.54.3/": "/news/1.54.3/",
"/news/archie/1.55.0/": "/news/1.55.0/",
"/news/archie/1.6.0/": "/news/1.6.0/",
"/news/archie/1.7.0/": "/news/1.7.0/",
"/news/archie/1.8.0/": "/news/1.8.0/",
@@ -178,6 +181,9 @@
"/news/archied/1.53.0/": "/news/1.53.0/",
"/news/archied/1.54.0/": "/news/1.54.0/",
"/news/archied/1.54.1/": "/news/1.54.1/",
"/news/archied/1.54.2/": "/news/1.54.2/",
"/news/archied/1.54.3/": "/news/1.54.3/",
"/news/archied/1.55.0/": "/news/1.55.0/",
"/news/archied/1.6.0/": "/news/1.6.0/",
"/news/archied/1.7.0/": "/news/1.7.0/",
"/news/archied/1.8.0/": "/news/1.8.0/",
+15
View File
@@ -1,4 +1,19 @@
[
{
"version": "1.55.0",
"date": "2026-10-16",
"body": "### archied\n\n- Personas are gone: the Personas settings page, the chat Personality selector and `/personality`. A selected persona never changed what the model was told; SOUL (Settings → SOUL) is the one place to set Archie's identity and style. Stored persona settings are deleted on upgrade.\n- The shipped SOUL describes Archie as the assistant for an event-driven automation system rather than a coding assistant. A SOUL you have saved is kept as it is."
},
{
"version": "1.54.3",
"date": "2026-10-16",
"body": "### archied\n\n- Chat can help write a workflow: it reads your workflows and the step catalog, writes a definition, and checks it the same way saving does, fixing what the check reports. It does not save; paste the YAML it gives you into the editor's YAML view and save there."
},
{
"version": "1.54.2",
"date": "2026-10-16",
"body": "### archied\n\n- Tool calls from Gemini models (Interactions API) receive their arguments intact. Any tool that takes arguments, such as `dashboard_navigate` in chat, failed with \"invalid character '{' after top-level value\".\n\n### archie-agent\n\n- Agent steps on Gemini models (Interactions API) pass tools their arguments intact instead of failing to decode them."
},
{
"version": "1.54.1",
"date": "2026-10-16",
+1 -1
View File
@@ -96,7 +96,7 @@ require (
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.1
github.com/pressly/goose/v3 v3.29.0
github.com/samcharles93/ai-sdk v0.3.0
github.com/samcharles93/ai-sdk v0.3.1
go.lsp.dev/jsonrpc2 v1.0.1
go.lsp.dev/protocol v1.0.1
go.lsp.dev/uri v1.0.1
+2 -2
View File
@@ -174,8 +174,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/samcharles93/ai-sdk v0.3.0 h1:ZZX38sT00oJkbry/cgjIaFnx5IHGHorfStPrVcGCjVU=
github.com/samcharles93/ai-sdk v0.3.0/go.mod h1:u4zrQ9/Q58L5mNEut4bNQ1ks+RCKq71LN5EDz2N/0Zk=
github.com/samcharles93/ai-sdk v0.3.1 h1:fD/Byx1Vo6NeZZBsSurxTO9e2/tAdAlEUIW+J7Hc/DM=
github.com/samcharles93/ai-sdk v0.3.1/go.mod h1:u4zrQ9/Q58L5mNEut4bNQ1ks+RCKq71LN5EDz2N/0Zk=
github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0=
github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0=
+1 -1
View File
@@ -31,7 +31,7 @@ func stepVocabulary() (*workflow.Manager, error) { return workflowsteps.NewManag
// (main.go's Run) before buildDaemon captures the client.
//
// It is deliberately not part of openStateStoreAdapter, which the gateway root
// shares: the gateway reads catalog, runtime settings and personas, never a
// shares: the gateway reads catalog, runtime settings and SOUL, never a
// workflow definition, so registering a vocabulary there would be the dead
// vocabulary this shape removed from internal/app/archiemessaging -- a root that
// cannot consume it must not be failed by it.
+2
View File
@@ -51,6 +51,7 @@ type chatSetup struct {
ChatTaskLogs gateway.ChatTaskLogReader
ChatTaskActor gateway.ChatTaskActor
DefaultChatIdentity string
Workflows gateway.WorkflowSource
// Bus carries primary-input events: a completed
// chat turn is published here so input-driven curators can wake. Nil
// disables turn events (tests, minimal setups).
@@ -138,6 +139,7 @@ func newChatTurnRunner(
TaskLogs: s.ChatTaskLogs,
TaskActor: s.ChatTaskActor,
TaskIdentity: s.DefaultChatIdentity,
Workflows: s.Workflows,
Bus: s.Bus,
BotUser: cfg.BotUser,
Channel: channel,
+4 -49
View File
@@ -20,7 +20,7 @@ import (
"github.com/samcharles93/archie-core/internal/tools"
)
// setupChatRuntime wires the model runtime, tool registry, persona registry,
// setupChatRuntime wires the model runtime, tool registry, SOUL,
// chat task creator/controller, default chat identity and the release-update
// service. The daemon and the standalone Gateway build through this one
// constructor so the two processes cannot diverge.
@@ -41,20 +41,6 @@ func (b *server) setupChatRuntime(ctx context.Context, cfg config.Config, actor
chatModels.SetModelCatalog(catalog)
b.chatModels = chatModels
// ── Persona registry ─────────────────────────────────────────────
if b.personas == nil {
personas, version, err := b.controlPlane.Personas(ctx)
if err != nil {
return fmt.Errorf("load personas: %w", err)
}
b.personas = gateway.NewPersonaRegistry(nil)
b.applyPersonas(personas, version)
b.applyStatus.Report(ctx, controlplane.PersonasKind, version, nil)
if err := b.watchPersonas(ctx, version); err != nil {
return fmt.Errorf("watch personas: %w", err)
}
}
// ── SOUL ─────────────────────────────────────────────────────────
if b.soul == nil {
soul, version, err := b.controlPlane.Soul(ctx)
@@ -167,40 +153,9 @@ func watchStatus[T any](
})
}
// watchPersonas keeps the persona stream established for the life of the
// process. The first stream is opened synchronously, so a control plane that
// cannot be watched at all fails the boot that asked for it rather than
// leaving the process running personas it can no longer update; after that the
// watch reconnects instead of ending (see servicekit.KeepWatch).
func (b *server) watchPersonas(ctx context.Context, version int64) error {
updates, err := b.controlPlane.WatchPersonas(ctx, version)
if err != nil {
return err
}
watchStatus(ctx, b.applyStatus.Report, b.log,
controlplane.PersonasKind, "personas", version, updates,
b.controlPlane.WatchPersonas,
func(update controlplane.AppliedPersonas) int64 { return update.Version },
func(update controlplane.AppliedPersonas) error { return update.Err },
func(update controlplane.AppliedPersonas) error {
b.applyPersonas(update.Collection, update.Version)
return nil
})
return nil
}
func (b *server) applyPersonas(collection agent.PersonaCollection, version int64) {
personas := make([]gateway.Persona, 0, len(collection.Personas))
for _, persona := range collection.Personas {
personas = append(personas, gateway.Persona{Name: persona.Name, Prompt: persona.Prompt})
}
b.personas.Replace(personas, collection.Default)
b.log.Info("personas applied", "version", version)
}
// watchSoul keeps the soul stream established for the life of the process, so
// a dashboard edit reaches the next turn without a restart. The stream rides
// the same outage bookkeeping as personas (watchStatus).
// the same outage bookkeeping as curators (watchStatus).
func (b *server) watchSoul(ctx context.Context, version int64) error {
updates, err := b.controlPlane.WatchSoul(ctx, version)
if err != nil {
@@ -235,7 +190,6 @@ func (b *server) setupGatewayChat(ctx context.Context, actor gateway.ChatTaskAct
router.Limiter = b.rateLimiter
router.Version = fmt.Sprintf("Archie\nGateway: %s\nRuntime: %s", buildinfo.Version, buildinfo.Runtime)
router.Models = b.chatModels
router.Personas = b.personas
router.Updates = b.updateService
router.InitSessions(b.chatSessionStore)
configureTaskCommands(router, b.chatTasks, b.chatController, chatTaskListerAdapter{tasks: b.stateStore.Tasks}, b.defaultChatIdentity)
@@ -252,6 +206,7 @@ func (b *server) setupGatewayChat(ctx context.Context, actor gateway.ChatTaskAct
ChatTaskLogs: chatTaskLogReaderAdapter{tasks: b.stateStore.TaskByID, taskLogs: b.stateStore},
ChatTaskActor: actor,
DefaultChatIdentity: b.defaultChatIdentity,
Workflows: controlplanerpc.NewWorkflows(b.stateStore.ControlPlane()),
Bus: b.bus, Log: b.log,
MemoryEngine: b.memoryStore(),
MemoryWriter: b.memoryWriter(),
@@ -268,7 +223,7 @@ func (b *server) setupGatewayChat(ctx context.Context, actor gateway.ChatTaskAct
router.Log = b.log
return &gateway.LocalChatAdapter{
Router: router, Sessions: b.chatSessionStore, Turns: gateway.NewTurns(b.log),
Models: b.chatModels, Personas: b.personas, TaskActor: actor, Tasks: b.stateStore,
Models: b.chatModels, TaskActor: actor, Tasks: b.stateStore,
VoiceAvailable: b.transcriber != nil,
}, nil
}
-1
View File
@@ -85,7 +85,6 @@ type server struct {
mcpMu sync.Mutex
mcpApplied map[string]appliedMCPServer
chatModels *chatModelManager
personas *gateway.PersonaRegistry
soul *soulSource
memEngines *domainmemory.Registry
curatorRegistry *curator.Registry
-28
View File
@@ -152,34 +152,6 @@ type AppliedSettings struct {
Err error
}
func (c *Client) Personas(ctx context.Context) (agent.PersonaCollection, int64, error) {
response, err := c.rpc.Query(ctx, &pb.QueryRequest{Kind: PersonasKind})
if err != nil {
return agent.PersonaCollection{}, 0, controlplanerpc.ClientError(err)
}
collection, err := decodePersonas(response.Resource.ValueJson)
return collection, response.Resource.Version, err
}
type AppliedPersonas struct {
Collection agent.PersonaCollection
Version int64
Err error
}
func (c *Client) WatchPersonas(ctx context.Context, afterVersion int64) (<-chan AppliedPersonas, error) {
stream, err := c.rpc.Watch(ctx, &pb.WatchRequest{Kind: PersonasKind, AfterVersion: afterVersion})
if err != nil {
return nil, controlplanerpc.ClientError(err)
}
return watchUpdates(ctx, stream,
func(resource *pb.Resource) AppliedPersonas {
collection, err := decodePersonas(resource.ValueJson)
return AppliedPersonas{Collection: collection, Version: resource.Version, Err: err}
},
func(err error) AppliedPersonas { return AppliedPersonas{Err: err} }), nil
}
func (c *Client) Soul(ctx context.Context) (agent.Soul, int64, error) {
response, err := c.rpc.Query(ctx, &pb.QueryRequest{Kind: SoulKind})
if err != nil {
+1 -1
View File
@@ -8,7 +8,7 @@ import (
// Schemas are not declared here: each Definition names its document type, and
// Definition.Descriptor derives the JSON Schema from it (internal/app/controlplane/schema.go).
func builtinDefinitions(steps workflow.StepRegistry, settings map[string]any) []Definition {
definitions := []Definition{taskPolicyDefinition(), workflowDefinition(), workflowDefinitionsDefinition(steps, settings), workflowEnablementDefinition(), personaDefinition(), curatorDefinition(), soulDefinition(), scheduleDefinition(), agentProfileDefinition(), playbooksDefinition(), skillsDefinition(), credentialBindingsDefinition(), identityGrantsDefinition(), reviewSettingsDefinition(), orgModelPolicyDefinition()}
definitions := []Definition{taskPolicyDefinition(), workflowDefinition(), workflowDefinitionsDefinition(steps, settings), workflowEnablementDefinition(), curatorDefinition(), soulDefinition(), scheduleDefinition(), agentProfileDefinition(), playbooksDefinition(), skillsDefinition(), credentialBindingsDefinition(), identityGrantsDefinition(), reviewSettingsDefinition(), orgModelPolicyDefinition()}
definitions = append(definitions, modelDefinitions()...)
definitions = append(definitions, operationalDefinitions()...)
return definitions
@@ -14,7 +14,7 @@ func TestInstanceOnlyKindsRefuseOtherOrgs(t *testing.T) {
}{
{"another org writes an instance setting", "acme", ToolSettingsKind, true},
{"the system org writes an instance setting", storecontract.DefaultOrgID, ToolSettingsKind, false},
{"another org writes an org-scoped kind", "acme", PersonasKind, false},
{"another org writes an org-scoped kind", "acme", SoulKind, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
-29
View File
@@ -1,29 +0,0 @@
package controlplane
import (
"encoding/json"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/agent"
)
const PersonasKind = "personas"
func personaDefinition() Definition {
return Definition{
Kind: PersonasKind,
Title: "Personas",
Document: agent.PersonaCollection{},
ApplyMode: "live",
Seed: func(config.Config) any { return agent.ShippedPersonas() },
Validate: func(input []byte) error {
return validateAs(input, func(collection agent.PersonaCollection) error { return collection.Validate() })
},
}
}
func decodePersonas(input []byte) (agent.PersonaCollection, error) {
var collection agent.PersonaCollection
err := json.Unmarshal(input, &collection)
return collection, err
}
-1
View File
@@ -24,7 +24,6 @@ var gatewayCommandSpecs = []commandSpec{
{Command: "version", Description: "Show installed Archie versions", Usage: "/version"},
{Command: "update", Description: "Check for Archie updates", Usage: "/update"},
{Command: "model", Description: "Choose a provider and model or switch directly", Usage: "/model [provider/model]"},
{Command: "personality", Description: "Choose a communication style", Usage: "/personality [name]"},
{Command: "spawn", Description: "Create a tracked task", Usage: "/spawn [identity=name] [repo=owner/name] [workflow=name] <title>"},
{Command: "settings", Description: "Inspect or change runtime settings", Usage: "/settings [list|get <kind>|set <kind> <field>=<value> ...]"},
{Command: "approve", Description: "Approve a waiting task", Usage: "/approve [identity=name] <task-id>"},
-145
View File
@@ -1,145 +0,0 @@
package telegram
import (
"context"
"fmt"
"strings"
"github.com/go-telegram/bot"
"github.com/go-telegram/bot/models"
"github.com/samcharles93/archie-core/internal/domain/messaging"
)
const personalityCallbackPrefix = "personality:"
func isPersonalityRequest(text string) bool {
fields := strings.Fields(text)
if len(fields) == 0 {
return false
}
command, _, _ := strings.Cut(fields[0], "@")
return command == "/personality"
}
func (g *Gateway) handlePersonalityCommand(
ctx context.Context,
b *bot.Bot,
msg *models.Message,
client messaging.ChatContract,
) {
snap, err := client.Snapshot(ctx)
if err != nil || !snap.PersonasAvailable {
g.sendMessage(ctx, b, msg.Chat.ID, msg.MessageThreadID,
"Personality switching is not configured.")
return
}
text := strings.TrimSpace(msg.Text)
fields := strings.Fields(text)
if len(fields) == 1 {
// No args: show inline keyboard.
g.sendPersonalitySelector(ctx, b, msg, snap.Personas)
return
}
// Direct switch by name.
name := strings.ToLower(fields[1])
ok, err := client.SetPersona(ctx, "", name)
if err != nil || !ok {
g.sendMessage(ctx, b, msg.Chat.ID, msg.MessageThreadID,
fmt.Sprintf("Unknown personality %q. Use /personality to browse.", name))
return
}
g.sendMessage(ctx, b, msg.Chat.ID, msg.MessageThreadID,
fmt.Sprintf("Personality set to %q.", name))
}
func (g *Gateway) sendPersonalitySelector(
ctx context.Context,
b *bot.Bot,
msg *models.Message,
personas []string,
) {
if len(personas) == 0 {
g.sendMessage(ctx, b, msg.Chat.ID, msg.MessageThreadID,
"No personalities configured.")
return
}
params := &bot.SendMessageParams{
ChatID: msg.Chat.ID,
Text: "Choose a personality:",
ReplyMarkup: g.personalityKeyboard(personas),
}
if msg.MessageThreadID != 0 {
params.MessageThreadID = msg.MessageThreadID
}
if _, err := b.SendMessage(ctx, params); err != nil {
g.log.Error("send personality selector failed", "error", err)
}
}
func (g *Gateway) personalityKeyboard(personas []string) *models.InlineKeyboardMarkup {
rows := make([][]models.InlineKeyboardButton, 0, len(personas))
for _, name := range personas {
rows = append(rows, []models.InlineKeyboardButton{{
Text: name,
CallbackData: personalityCallbackPrefix + name,
}})
}
return &models.InlineKeyboardMarkup{InlineKeyboard: rows}
}
func (g *Gateway) handlePersonalityCallback(
ctx context.Context,
b *bot.Bot,
update *models.Update,
client messaging.ChatContract,
) {
query := update.CallbackQuery
if query == nil {
return
}
if !g.isSenderAllowed(query.From.ID) {
g.log.Warn("personality callback from unauthorized sender",
"user_id", query.From.ID)
g.answerModelCallback(ctx, b, query.ID,
"You are not authorised to use this bot.", true)
return
}
snap, err := client.Snapshot(ctx)
if err != nil || !snap.PersonasAvailable {
g.answerModelCallback(ctx, b, query.ID,
"Personality switching is not configured.", true)
return
}
name := strings.TrimPrefix(query.Data, personalityCallbackPrefix)
ok, err := client.SetPersona(ctx, "", name)
if err != nil || !ok {
g.answerModelCallback(ctx, b, query.ID,
fmt.Sprintf("Unknown personality %q.", name), true)
return
}
g.answerModelCallback(ctx, b, query.ID,
fmt.Sprintf("Personality set to %q.", name), false)
// Update the selector message to acknowledge the selection.
params := &bot.EditMessageTextParams{
Text: fmt.Sprintf("Personality set to %q.", name),
}
switch {
case query.Message.Message != nil:
params.ChatID = query.Message.Message.Chat.ID
params.MessageID = query.Message.Message.ID
case query.InlineMessageID != "":
params.InlineMessageID = query.InlineMessageID
default:
return
}
if _, err := b.EditMessageText(ctx, params); err != nil {
g.log.Warn("update personality selector failed", "error", err)
}
}
-6
View File
@@ -537,10 +537,6 @@ func (g *Gateway) defaultHandler(client messaging.ChatContract) bot.HandlerFunc
g.handleModelCommand(ctx, b, msg, client)
return
}
if isPersonalityRequest(msg.Text) {
g.handlePersonalityCommand(ctx, b, msg, client)
return
}
g.submitTurn(ctx, b, msg, client)
}
}
@@ -564,8 +560,6 @@ func (g *Gateway) handleCallback(ctx context.Context, b *bot.Bot, update *models
g.handleModelCancelCallback(ctx, b, update)
case update.CallbackQuery.Data == modelNoopCallback:
g.handleModelNoopCallback(ctx, b, update)
case strings.HasPrefix(update.CallbackQuery.Data, personalityCallbackPrefix):
g.handlePersonalityCallback(ctx, b, update, client)
case strings.HasPrefix(update.CallbackQuery.Data, updateCallbackPrefix):
g.handleUpdateCallback(ctx, b, update)
}
File diff suppressed because it is too large. Load diff
@@ -29,7 +29,6 @@ const (
ChatService_Answer_FullMethodName = "/gateway.v1.ChatService/Answer"
ChatService_Cancel_FullMethodName = "/gateway.v1.ChatService/Cancel"
ChatService_StopTasks_FullMethodName = "/gateway.v1.ChatService/StopTasks"
ChatService_SetPersona_FullMethodName = "/gateway.v1.ChatService/SetPersona"
ChatService_ApplyTaskAction_FullMethodName = "/gateway.v1.ChatService/ApplyTaskAction"
ChatService_ApplyOperatorTaskAction_FullMethodName = "/gateway.v1.ChatService/ApplyOperatorTaskAction"
ChatService_SaveSession_FullMethodName = "/gateway.v1.ChatService/SaveSession"
@@ -63,7 +62,6 @@ type ChatServiceClient interface {
Answer(ctx context.Context, in *AnswerRequest, opts ...grpc.CallOption) (*AnswerResponse, error)
Cancel(ctx context.Context, in *CancelRequest, opts ...grpc.CallOption) (*CancelResponse, error)
StopTasks(ctx context.Context, in *StopTasksRequest, opts ...grpc.CallOption) (*StopTasksResponse, error)
SetPersona(ctx context.Context, in *SetPersonaRequest, opts ...grpc.CallOption) (*SetPersonaResponse, error)
ApplyTaskAction(ctx context.Context, in *ApplyTaskActionRequest, opts ...grpc.CallOption) (*ApplyTaskActionResponse, error)
ApplyOperatorTaskAction(ctx context.Context, in *ApplyOperatorTaskActionRequest, opts ...grpc.CallOption) (*ApplyOperatorTaskActionResponse, error)
SaveSession(ctx context.Context, in *SaveSessionRequest, opts ...grpc.CallOption) (*SaveSessionResponse, error)
@@ -201,16 +199,6 @@ func (c *chatServiceClient) StopTasks(ctx context.Context, in *StopTasksRequest,
return out, nil
}
func (c *chatServiceClient) SetPersona(ctx context.Context, in *SetPersonaRequest, opts ...grpc.CallOption) (*SetPersonaResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SetPersonaResponse)
err := c.cc.Invoke(ctx, ChatService_SetPersona_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *chatServiceClient) ApplyTaskAction(ctx context.Context, in *ApplyTaskActionRequest, opts ...grpc.CallOption) (*ApplyTaskActionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ApplyTaskActionResponse)
@@ -395,7 +383,6 @@ type ChatServiceServer interface {
Answer(context.Context, *AnswerRequest) (*AnswerResponse, error)
Cancel(context.Context, *CancelRequest) (*CancelResponse, error)
StopTasks(context.Context, *StopTasksRequest) (*StopTasksResponse, error)
SetPersona(context.Context, *SetPersonaRequest) (*SetPersonaResponse, error)
ApplyTaskAction(context.Context, *ApplyTaskActionRequest) (*ApplyTaskActionResponse, error)
ApplyOperatorTaskAction(context.Context, *ApplyOperatorTaskActionRequest) (*ApplyOperatorTaskActionResponse, error)
SaveSession(context.Context, *SaveSessionRequest) (*SaveSessionResponse, error)
@@ -454,9 +441,6 @@ func (UnimplementedChatServiceServer) Cancel(context.Context, *CancelRequest) (*
func (UnimplementedChatServiceServer) StopTasks(context.Context, *StopTasksRequest) (*StopTasksResponse, error) {
return nil, status.Error(codes.Unimplemented, "method StopTasks not implemented")
}
func (UnimplementedChatServiceServer) SetPersona(context.Context, *SetPersonaRequest) (*SetPersonaResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SetPersona not implemented")
}
func (UnimplementedChatServiceServer) ApplyTaskAction(context.Context, *ApplyTaskActionRequest) (*ApplyTaskActionResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ApplyTaskAction not implemented")
}
@@ -702,24 +686,6 @@ func _ChatService_StopTasks_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
func _ChatService_SetPersona_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetPersonaRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ChatServiceServer).SetPersona(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ChatService_SetPersona_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChatServiceServer).SetPersona(ctx, req.(*SetPersonaRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ChatService_ApplyTaskAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ApplyTaskActionRequest)
if err := dec(in); err != nil {
@@ -1069,10 +1035,6 @@ var ChatService_ServiceDesc = grpc.ServiceDesc{
MethodName: "StopTasks",
Handler: _ChatService_StopTasks_Handler,
},
{
MethodName: "SetPersona",
Handler: _ChatService_SetPersona_Handler,
},
{
MethodName: "ApplyTaskAction",
Handler: _ChatService_ApplyTaskAction_Handler,
-53
View File
@@ -1,53 +0,0 @@
package agent
import (
"fmt"
"strings"
)
type Persona struct {
Name string `json:"name"`
Prompt string `json:"prompt"`
}
type PersonaCollection struct {
Default string `json:"default"`
Personas []Persona `json:"personas"`
}
func (c PersonaCollection) Validate() error {
if len(c.Personas) == 0 {
return fmt.Errorf("at least one persona is required")
}
defaultName := normalizePersonaName(c.Default)
seen := make(map[string]struct{}, len(c.Personas))
for _, persona := range c.Personas {
name := normalizePersonaName(persona.Name)
if name == "" || strings.TrimSpace(persona.Prompt) == "" {
return fmt.Errorf("persona name and prompt are required")
}
if _, exists := seen[name]; exists {
return fmt.Errorf("duplicate persona %q", name)
}
seen[name] = struct{}{}
}
if _, exists := seen[defaultName]; !exists {
return fmt.Errorf("default persona %q does not exist", c.Default)
}
return nil
}
func normalizePersonaName(name string) string {
return strings.ToLower(strings.TrimSpace(name))
}
func ShippedPersonas() PersonaCollection {
return PersonaCollection{Default: "archie", Personas: []Persona{
{Name: "archie", Prompt: archieIdentity},
{Name: "helpful", Prompt: "You are a helpful, friendly AI assistant."},
{Name: "concise", Prompt: "You are a concise assistant. Keep responses brief and to the point."},
{Name: "technical", Prompt: "You are a technical expert. Provide detailed, accurate technical information."},
{Name: "creative", Prompt: "You are a creative assistant. Think outside the box and offer innovative solutions."},
{Name: "teacher", Prompt: "You are a patient teacher. Explain concepts clearly with examples."},
}}
}
+10 -10
View File
@@ -24,24 +24,24 @@ func (s Soul) Validate() error {
return nil
}
// archieIdentity is the default agent's identity and reporting style. The
// shipped SOUL and the default persona both carry it.
const archieIdentity = `You are Archie, a coding and project assistant for a team of operators.
// archieIdentity is the default agent's identity and reporting style.
const archieIdentity = `You are Archie, the operator's assistant for an event-driven automation system. Events start workflows, workflows run agents and tools, and results come back for review or action. A repository is one optional input to a workflow, not the point of the product.
Be direct without being brusque, and ground what you say in the system's actual state.
Reporting
- Lead with the outcome. For work, say what you found, what you changed, how you checked it, and what remains. For a question, answer it and stop.
- Name the files, services, tasks and commands involved. Give numbers and exact error text instead of summaries of them.
- Name the workflows, tasks, services and commands involved. Give numbers and exact error text instead of summaries of them.
- Explain a failure as what failed and why. If the cause is not established, say so and name what would establish it.
- Separate what you verified from what you did not. If you skipped a check or could not run one, say which.
- Match length to the question. A one-line answer needs one line.
- Separate what you verified from what you did not.
- Match length to the question.
Decisions
- When a choice is the operator's, ask a specific question and recommend an answer. Ask as many as the work needs, together, not one per turn. Otherwise decide, act, and say what you chose.
- Do work that was not asked for only by listing it as a follow-up. Do not start it.
- When a choice is the operator's, ask a specific question and recommend an answer. Ask every open question together. Otherwise decide, act, and say what you chose.
- Offer work that was not asked for only as a follow-up. Do not start it.
Style
- Plain, specific words. Cut qualifiers such as "actual", "just", "simply" and "really", and vague phrases such as "robust", "seamless" or "single source of truth".
- No comparisons, background or advice that was not asked for. No flattery, apologies or closing offers of more help.
- Plain, specific words. No flattery, apologies or closing offers of more help.
- Do not repeat the request or narrate routine steps.
- Never present a guess as a finding.
`
+1 -1
View File
@@ -33,7 +33,7 @@ func Applicability() map[string][]string {
for _, kind := range []string{"task-policy", "provider-settings", "model-aliases", "repository-policies", "scheduling-policy", "tool-settings", "plugin-settings", "review-settings", "channel-settings", "container-runtime-policies", "credential-bindings", "identity-grants", "agent-profiles", "workflow-execution-settings", "extension-settings", "workflow-definitions", "workflow-enablement", "schedules", "eda-playbooks"} {
kinds[kind] = []string{Daemon}
}
for _, kind := range []string{"provider-settings", "model-aliases", "tool-settings", "extension-settings", "personas", "soul", "skills", "curators"} {
for _, kind := range []string{"provider-settings", "model-aliases", "tool-settings", "extension-settings", "soul", "skills", "curators"} {
kinds[kind] = append(kinds[kind], Gateway)
}
for _, kind := range []string{"channel-settings", "extension-settings"} {
@@ -23,7 +23,6 @@ type ChatContract interface { //nolint:interfacebloat // wire contract intention
// every queued or running task the conversation origin created. It
// returns the tasks it stopped.
StopTasks(ctx context.Context, origin string, taskID int64) ([]int64, error)
SetPersona(context.Context, string, string) (bool, error)
ChatTaskActionContract
}
+1 -4
View File
@@ -9,16 +9,13 @@ type ChatSnapshot struct {
Providers []string
ActiveModel string
ActiveProvider string
Personas []string
ActivePersonas map[string]string
// Version is the Gateway's rendered component-version block. Channel
// frontends display it rather than stamping their own build, so a
// partially upgraded deployment cannot report itself as matched.
Version string
CancellationAvailable bool
// VoiceAvailable reports that a voice clip is transcribed into the turn.
VoiceAvailable bool
PersonasAvailable bool
VoiceAvailable bool
}
// ChatReply is the blocking reply from Route.
+1 -2
View File
@@ -10,7 +10,7 @@ var localCommands = []string{
"/new", "/reset", "/topic", "/retry", "/undo",
"/title", "/branch", "/fork", "/compress", "/compact",
"/whoami", "/profile", "/sessions", "/resume", "/delete", "/agents",
"/personality", "/help", "/version", "/update",
"/help", "/version", "/update",
}
// CommandSpec describes a local command for adapter-provided discovery.
@@ -45,7 +45,6 @@ var localCommandSpecs = []CommandSpec{
{Command: "/resume", Description: "Switch to a conversation", Usage: "/resume <session-id>"},
{Command: "/delete", Description: "Delete a conversation and its history", Usage: "/delete <session-id>"},
{Command: "/agents", Description: "List tasks currently being worked", Usage: "/agents"},
{Command: "/personality", Description: "Choose a communication style", Usage: "/personality [name]"},
{Command: "/help", Description: "See what Archie can do", Usage: "/help"},
{Command: "/version", Description: "Show installed Archie versions", Usage: "/version"},
{Command: "/update", Description: "Check for Archie updates", Usage: "/update"},
+1 -18
View File
@@ -21,7 +21,6 @@ type LocalChatAdapter struct {
Sessions SessionStore
Turns *Turns
Models ModelManager
Personas *PersonaRegistry
TaskActor ChatTaskActor
// Tasks reads the tasks /stop acts on.
Tasks TaskReader
@@ -44,7 +43,7 @@ func (a *LocalChatAdapter) Snapshot(ctx context.Context) (ChatSnapshot, error) {
if err != nil {
return ChatSnapshot{}, err
}
s := ChatSnapshot{Sessions: sessions, Models: []string{}, Providers: []string{}, Personas: []string{}, ModelsByProvider: map[string][]string{}, ActivePersonas: map[string]string{}, CancellationAvailable: a.Turns != nil, PersonasAvailable: a.Personas != nil, VoiceAvailable: a.VoiceAvailable, Version: a.Router.Version}
s := ChatSnapshot{Sessions: sessions, Models: []string{}, Providers: []string{}, ModelsByProvider: map[string][]string{}, CancellationAvailable: a.Turns != nil, VoiceAvailable: a.VoiceAvailable, Version: a.Router.Version}
if a.Models != nil {
s.Models, err = a.Models.ModelsFor(ctx)
if err != nil {
@@ -66,12 +65,6 @@ func (a *LocalChatAdapter) Snapshot(ctx context.Context) (ChatSnapshot, error) {
s.Providers = append(s.Providers, provider)
}
slices.Sort(s.Providers)
if a.Personas != nil {
s.Personas = slices.Clone(a.Personas.List())
for _, session := range sessions {
s.ActivePersonas[session.SessionID] = a.Personas.ActiveName(session.SessionID)
}
}
return s, nil
}
@@ -174,16 +167,6 @@ func haltAction(status string) (taskstate.Action, bool) {
}
}
func (a *LocalChatAdapter) SetPersona(ctx context.Context, id, name string) (bool, error) {
if err := ctx.Err(); err != nil {
return false, err
}
if a.Personas == nil {
return false, ErrChatCapabilityUnavailable
}
return a.Personas.SetActive(id, strings.ToLower(name)), nil
}
func (a *LocalChatAdapter) ApplyTaskAction(ctx context.Context, identity string, taskID int64, action taskstate.Action, res taskactions.ActionPayload) (TaskActionResult, error) {
if a.TaskActor == nil {
return TaskActionResult{}, ErrChatCapabilityUnavailable
-1
View File
@@ -44,7 +44,6 @@ var dashboardPages = []DashboardPage{
{Path: "/settings/models", Label: "Models", Description: "Model aliases and providers."},
{Path: "/settings/repositories", Label: "Repositories", Description: "Watched repositories and gate overrides."},
{Path: "/settings/identities", Label: "Identities", Description: "Actors and their lifecycle."},
{Path: "/settings/personas", Label: "Personas", Description: "Chat system prompts and the default."},
{Path: "/settings/schedules", Label: "Schedules", Description: "Timetabled work."},
{Path: "/settings/scheduling-policy", Label: "Scheduling policy", Description: "Work discovery and forge labels."},
{Path: "/settings/review", Label: "Review", Description: "Pull request review: precision filter and approval."},
+7 -8
View File
@@ -118,11 +118,9 @@ type Router struct {
// ModelPersist persists the active model selection so it survives
// restarts (e.g. writing back to identity config). nil = not configured.
ModelPersist func(ctx context.Context, modelRef string) error
// Personas holds the available personality registry for /personality.
Personas *PersonaRegistry
Tasks TaskCreator // nil = /spawn not configured
Controller TaskController // nil = /approve and /cancel not configured
Settings *messaging.SettingsCommand
Tasks TaskCreator // nil = /spawn not configured
Controller TaskController // nil = /approve and /cancel not configured
Settings *messaging.SettingsCommand
// TaskLister backs /tasks: the live work view (id, title, status,
// workflow/stage, age). nil = /tasks not configured.
TaskLister ChatTaskLister
@@ -360,9 +358,6 @@ func (r *Router) dispatchLocalMisc(ctx context.Context, msg messaging.Message, p
case "/agents":
reply, err := r.handleAgents(ctx)
return reply, true, err
case "/personality":
reply, err := r.handlePersonality(ctx, msg, rest)
return reply, true, err
case "/help":
return r.helpText(), true, nil
case "/version":
@@ -1062,3 +1057,7 @@ func (r *Router) handleAgents(ctx context.Context) (string, error) {
}
return strings.TrimSpace(b.String()), nil
}
func (r *Router) helpText() string {
return "Send a message to chat with Archie. Available commands:\n" + strings.Join(LocalCommands(), " ")
}
-154
View File
@@ -1,154 +0,0 @@
package gateway
import (
"context"
"fmt"
"sort"
"strings"
"sync"
"github.com/samcharles93/archie-core/internal/domain/messaging"
)
// Persona is a named communication style that modifies the system prompt.
type Persona struct {
Name string
Prompt string // prepended to the system prompt
}
// PersonaRegistry holds available personas and tracks the active one
// per session. Safe for concurrent use.
type PersonaRegistry struct {
mu sync.RWMutex
personas map[string]Persona
active map[string]string // sessionKey -> persona name
defaultName string
}
// NewPersonaRegistry creates a registry pre-populated with the given
// personas. The first persona is the default for new sessions.
func NewPersonaRegistry(personas []Persona) *PersonaRegistry {
r := &PersonaRegistry{
personas: make(map[string]Persona, len(personas)),
active: make(map[string]string),
}
for index, p := range personas {
r.personas[p.Name] = p
if index == 0 {
r.defaultName = p.Name
}
}
return r
}
// List returns all available persona names.
func (r *PersonaRegistry) List() []string {
r.mu.RLock()
defer r.mu.RUnlock()
names := make([]string, 0, len(r.personas))
for _, p := range r.personas {
names = append(names, p.Name)
}
sort.Strings(names)
return names
}
// Replace atomically changes the available definitions. Sessions whose
// selection no longer exists use the new default.
func (r *PersonaRegistry) Replace(personas []Persona, defaultName string) {
r.mu.Lock()
defer r.mu.Unlock()
next := make(map[string]Persona, len(personas))
for _, persona := range personas {
next[persona.Name] = persona
}
for session, name := range r.active {
if _, exists := next[name]; !exists {
delete(r.active, session)
}
}
r.personas = next
r.defaultName = defaultName
}
// SetActive sets the active persona for a session.
func (r *PersonaRegistry) SetActive(sessionKey, name string) bool {
r.mu.Lock()
defer r.mu.Unlock()
if _, ok := r.personas[name]; !ok {
return false
}
r.active[sessionKey] = name
return true
}
// GetActive returns the active persona's prompt for a session, or an
// empty string when no persona is selected.
func (r *PersonaRegistry) GetActive(sessionKey string) string {
r.mu.RLock()
defer r.mu.RUnlock()
name, ok := r.active[sessionKey]
if !ok {
name = r.defaultName
}
p, ok := r.personas[name]
if !ok {
return ""
}
if name == r.defaultName {
return p.Prompt
}
if baseline, ok := r.personas[r.defaultName]; ok && baseline.Prompt != "" {
return baseline.Prompt + "\n\n" + p.Prompt
}
return p.Prompt
}
// ActiveName returns the selected persona name for a session, falling back to
// the registry default. It is used by channel adapters that render a compact
// selector summary rather than the full prompt.
func (r *PersonaRegistry) ActiveName(sessionKey string) string {
r.mu.RLock()
defer r.mu.RUnlock()
if name := r.active[sessionKey]; name != "" {
return name
}
return r.defaultName
}
// Get returns a persona by name, or false when not found.
func (r *PersonaRegistry) Get(name string) (Persona, bool) {
r.mu.RLock()
defer r.mu.RUnlock()
p, ok := r.personas[name]
return p, ok
}
func (r *Router) handlePersonality(ctx context.Context, msg messaging.Message, rest string) (string, error) {
if r.Personas == nil {
return "Personality switching is not configured.", nil
}
name := strings.ToLower(strings.TrimSpace(rest))
if name == "" {
return fmt.Sprintf("Active personality: %s\nAvailable: %s", r.Personas.ActiveName(r.sessionKey(ctx, msg)), strings.Join(r.Personas.List(), ", ")), nil
}
if !r.Personas.SetActive(r.sessionKey(ctx, msg), name) {
return fmt.Sprintf("Unknown personality %q. Available: %s", name, strings.Join(r.Personas.List(), ", ")), nil
}
return fmt.Sprintf("Personality set to %q.", name), nil
}
func (r *Router) sessionKey(ctx context.Context, msg messaging.Message) string {
if r.sessionTracker == nil {
return msg.ConversationID.ChannelID
}
key, err := r.ResolveSessionKey(ctx, Inbound{Message: msg})
if err != nil {
return msg.ConversationID.ChannelID
}
return key
}
func (r *Router) helpText() string {
return "Send a message to chat with Archie. Available commands:\n" + strings.Join(LocalCommands(), " ")
}
+3 -4
View File
@@ -45,10 +45,9 @@ type SlashDenialRecorder interface {
// slashAdminOnly names the commands that require an admin.
var slashAdminOnly = map[string]bool{
"/model": true,
"/personality": true,
"/settings": true,
"/update": true,
"/model": true,
"/settings": true,
"/update": true,
}
// SlashAccessPolicy decides which slash commands a sender may run. Deny by
+1 -1
View File
@@ -7,7 +7,7 @@ Accounts and organization:
Creating a workflow:
1. Open /workflows and choose New workflow. The new definition is an unsaved draft with an id and empty steps.
2. Use YAML to edit its id, or the canvas to add and select steps. Select Starts when on the canvas to open Workflow settings. Set Runs as to an existing active agent identity. Works on selects Repository, If given, or None.
3. Read an existing workflow and the served step/settings catalog before constructing YAML. A repository planning workflow normally prepares the repository, then uses agent.run with read_only: true and a mission asking it to inspect the code and return a plan. Keep forge writes, commits, implementation steps and automatic implementation handoffs out of a planning-only workflow. The shipped feasibility workflow also closes issues or hands off after approval: it is not a planning-only template unchanged.
3. Before writing YAML, read a similar workflow (workflow_list, workflow_get) and the step catalog (workflow_step_types). Run workflow_validate on the YAML and fix every problem it reports until it is valid, then give the operator the YAML to paste into the editor's YAML view and save. A repository planning workflow normally prepares the repository, then uses agent.run with read_only: true and a mission asking it to inspect the code and return a plan. Keep forge writes, commits, implementation steps and automatic implementation handoffs out of a planning-only workflow. The shipped feasibility workflow also closes issues or hands off after approval: it is not a planning-only template unchanged.
4. Save the definition. Test runs the draft once with forge writes/pushes skipped; commands and tools still run, so a test is not a side-effect-free simulation. Run starts the saved version. History, Performance and Runs show revisions and execution evidence.
5. Manual workflows need no automatic trigger. Bind an event creates an event binding from a captured example and maps payload fields to declared inputs. Existing bindings can be paused or removed. Playbooks are edited at /settings/playbooks; workflow calls/handoffs are edited in the workflow that invokes them. Built-in issue-label routes are marked Built-in; they cannot be removed in the event-binding editor. Disable the workflow to prevent automatic execution.
+7 -4
View File
@@ -102,10 +102,12 @@ type TurnRunnerConfig struct {
TaskLogs ChatTaskLogReader
TaskActor ChatTaskActor
TaskIdentity string
Bus TurnEventPublisher
BotUser string
Channel string
Operator string
// Workflows backs the workflow read and validate tools. Nil omits them.
Workflows WorkflowSource
Bus TurnEventPublisher
BotUser string
Channel string
Operator string
// Workspace is the directory the chat agent's file and shell tools are
// rooted at (chat.workspace). Passed into the prompt's <env> block.
Workspace string
@@ -306,6 +308,7 @@ func (r *TurnRunner) prepareTurn(ctx context.Context, sessionID string, in Inbou
// UI only: a non-web channel has no dashboard to point at.
extraTools = append(extraTools, PageIndexTools(r.Channel)...)
extraTools = append(extraTools, MemoryTools(r.MemoryWriter, subject)...)
extraTools = append(extraTools, WorkflowTools(r.Workflows)...)
// The question tool is per-turn: it exists only when this turn's channel
// adapter can carry a clarify/picker interaction (see WithInteractive).
extraTools = append(extraTools, InteractiveTools(ctx)...)
+196
View File
@@ -0,0 +1,196 @@
package gateway
import (
"context"
"encoding/json"
"fmt"
"strings"
"gopkg.in/yaml.v3"
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
"github.com/samcharles93/archie-core/internal/tools"
)
// WorkflowSource is the control-plane surface the workflow tools use, acting
// in the caller's org. Validate returns the reason a collection is refused,
// or "" when it would be accepted; err is reserved for an unavailable store.
type WorkflowSource interface {
Workflows(ctx context.Context) (task.WorkflowDefinitionCollection, error)
StepTypes(ctx context.Context) (json.RawMessage, error)
Validate(ctx context.Context, collection task.WorkflowDefinitionCollection) (problem string, err error)
}
// WorkflowSummary is one workflow as workflow_list shows it.
type WorkflowSummary struct {
ID string `json:"id"`
Steps []string `json:"steps"`
}
// WorkflowValidation is what workflow_validate returns.
type WorkflowValidation struct {
ID string `json:"id,omitempty"`
Valid bool `json:"valid"`
Replace bool `json:"replaces_existing,omitempty"`
Problem string `json:"problem,omitempty"`
}
// WorkflowTools returns the read and validate tools over source. Saving is
// left to the operator in the workflow editor. Nil source registers none.
func WorkflowTools(source WorkflowSource) []tools.ToolEntry {
if source == nil {
return nil
}
return []tools.ToolEntry{
workflowListTool(source),
workflowGetTool(source),
workflowStepTypesTool(source),
workflowValidateTool(source),
}
}
func workflowListTool(source WorkflowSource) tools.ToolEntry {
return tools.ToolEntry{
Name: "workflow_list",
Toolset: "workflows",
Description: "List the workflows defined in this org with the step types each runs, in order.",
Classification: tools.ClassIdempotent,
Schema: tools.JSONSchema{"type": "object", "properties": map[string]any{}},
Handler: func(ctx context.Context, _ map[string]any) (any, error) {
collection, err := source.Workflows(ctx)
if err != nil {
return nil, fmt.Errorf("workflow_list: %w", err)
}
out := make([]WorkflowSummary, 0, len(collection.Definitions))
for _, entry := range collection.Definitions {
out = append(out, WorkflowSummary{ID: entry.ID, Steps: stepTypesOf(entry.YAML)})
}
return out, nil
},
}
}
func workflowGetTool(source WorkflowSource) tools.ToolEntry {
return tools.ToolEntry{
Name: "workflow_get",
Toolset: "workflows",
Description: "Return one workflow's YAML definition. Read a similar workflow before writing a new one.",
Classification: tools.ClassIdempotent,
Schema: tools.JSONSchema{
"type": "object",
"properties": map[string]any{"id": map[string]any{"type": "string", "description": "The workflow id from workflow_list."}},
"required": []any{"id"},
},
Handler: func(ctx context.Context, input map[string]any) (any, error) {
id := strings.TrimSpace(asString(input["id"]))
collection, err := source.Workflows(ctx)
if err != nil {
return nil, fmt.Errorf("workflow_get: %w", err)
}
entry, ok := collection.DefinitionByID(id)
if !ok {
return nil, fmt.Errorf("workflow_get: no workflow %q", id)
}
return map[string]string{"id": entry.ID, "yaml": entry.YAML}, nil
},
}
}
func workflowStepTypesTool(source WorkflowSource) tools.ToolEntry {
return tools.ToolEntry{
Name: "workflow_step_types",
Toolset: "workflows",
Description: "Return the step types a workflow may use, with each type's settings schema.",
Classification: tools.ClassIdempotent,
Schema: tools.JSONSchema{"type": "object", "properties": map[string]any{}},
Handler: func(ctx context.Context, _ map[string]any) (any, error) {
types, err := source.StepTypes(ctx)
if err != nil {
return nil, fmt.Errorf("workflow_step_types: %w", err)
}
return types, nil
},
}
}
func workflowValidateTool(source WorkflowSource) tools.ToolEntry {
return tools.ToolEntry{
Name: "workflow_validate",
Toolset: "workflows",
Description: "Check a workflow YAML definition exactly as saving it would, without saving. " +
"Fix every problem it reports and validate again before giving the operator the YAML, " +
"who saves it from the workflow editor.",
Classification: tools.ClassIdempotent,
Schema: tools.JSONSchema{
"type": "object",
"properties": map[string]any{"yaml": map[string]any{"type": "string", "description": "The complete workflow definition."}},
"required": []any{"yaml"},
},
Handler: func(ctx context.Context, input map[string]any) (any, error) {
src := asString(input["yaml"])
id, problem := definitionID(src)
if problem != "" {
return WorkflowValidation{Problem: problem}, nil
}
collection, err := source.Workflows(ctx)
if err != nil {
return nil, fmt.Errorf("workflow_validate: %w", err)
}
proposed, replaced := withDefinition(collection, id, src)
problem, err = source.Validate(ctx, proposed)
if err != nil {
return nil, fmt.Errorf("workflow_validate: %w", err)
}
return WorkflowValidation{ID: id, Valid: problem == "", Replace: replaced, Problem: problem}, nil
},
}
}
// withDefinition returns collection with src as workflow id, replacing an
// existing definition of that id or appending a new one.
func withDefinition(collection task.WorkflowDefinitionCollection, id, src string) (task.WorkflowDefinitionCollection, bool) {
out := task.WorkflowDefinitionCollection{Definitions: make([]task.WorkflowDefinitionEntry, 0, len(collection.Definitions)+1)}
replaced := false
for _, entry := range collection.Definitions {
if entry.ID == id {
entry.YAML, replaced = src, true
}
out.Definitions = append(out.Definitions, entry)
}
if !replaced {
out.Definitions = append(out.Definitions, task.WorkflowDefinitionEntry{ID: id, YAML: src})
}
return out, replaced
}
// definitionID returns the id src declares, or why it declares none.
func definitionID(src string) (id, problem string) {
var declared struct {
ID string `yaml:"id"`
}
if err := yaml.Unmarshal([]byte(src), &declared); err != nil {
return "", "the YAML does not parse: " + err.Error()
}
if strings.TrimSpace(declared.ID) == "" {
return "", "the definition needs an id"
}
return declared.ID, ""
}
// stepTypesOf lists a definition's top-level step types; a definition that
// does not parse lists none.
func stepTypesOf(src string) []string {
var def struct {
Steps []struct {
Type string `yaml:"type"`
} `yaml:"steps"`
}
_ = yaml.Unmarshal([]byte(src), &def)
out := make([]string, 0, len(def.Steps))
for _, step := range def.Steps {
if step.Type != "" {
out = append(out, step.Type)
}
}
return out
}
@@ -0,0 +1,72 @@
package controlplanerpc
import (
"context"
"encoding/json"
"errors"
"fmt"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
pb "github.com/samcharles93/archie-core/internal/contracts/controlplane/v1"
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
)
const workflowDefinitionsKind = "workflow-definitions"
// Workflows reads and validates workflow definitions in the caller's org,
// through the same control-plane calls the workflow editor makes.
type Workflows struct{ rpc pb.ControlPlaneServiceClient }
func NewWorkflows(rpc pb.ControlPlaneServiceClient) Workflows { return Workflows{rpc: rpc} }
func (w Workflows) Workflows(ctx context.Context) (task.WorkflowDefinitionCollection, error) {
var collection task.WorkflowDefinitionCollection
response, err := w.rpc.Query(ctx, &pb.QueryRequest{Kind: workflowDefinitionsKind})
if err != nil {
return collection, fmt.Errorf("%w: %w", ErrUnavailable, err)
}
if response.GetResource() == nil || len(response.GetResource().GetValueJson()) == 0 {
return collection, nil
}
if err := json.Unmarshal(response.GetResource().GetValueJson(), &collection); err != nil {
return collection, fmt.Errorf("decode workflow definitions: %w", err)
}
return collection, nil
}
func (w Workflows) StepTypes(ctx context.Context) (json.RawMessage, error) {
catalog, err := w.rpc.Catalog(ctx, &pb.CatalogRequest{})
if err != nil {
return nil, fmt.Errorf("%w: %w", ErrUnavailable, err)
}
for _, resource := range catalog.GetResources() {
if resource.GetKind() != workflowDefinitionsKind {
continue
}
var schema struct {
StepTypes json.RawMessage `json:"x-step-types"`
}
if err := json.Unmarshal([]byte(resource.GetSchemaJson()), &schema); err != nil {
return nil, fmt.Errorf("decode workflow schema: %w", err)
}
return schema.StepTypes, nil
}
return nil, errors.New("the control plane serves no workflow definitions")
}
func (w Workflows) Validate(ctx context.Context, collection task.WorkflowDefinitionCollection) (string, error) {
value, err := json.Marshal(collection)
if err != nil {
return "", err
}
_, err = w.rpc.Command(ctx, &pb.CommandRequest{Kind: workflowDefinitionsKind, Command: "validate", ValueJson: value})
if status.Code(err) == codes.InvalidArgument {
return status.Convert(err).Message(), nil
}
if err != nil {
return "", fmt.Errorf("%w: %w", ErrUnavailable, err)
}
return "", nil
}
@@ -74,14 +74,6 @@ func (c *Client) Cancel(ctx context.Context, id string) (messaging.ChatCancellat
return messaging.ChatCancellation{Cancelled: v.Cancelled, Dropped: int(v.Dropped)}, nil
}
func (c *Client) SetPersona(ctx context.Context, id, name string) (bool, error) {
v, err := c.client.SetPersona(ctx, &pb.SetPersonaRequest{SessionId: id, Name: name})
if err != nil {
return false, err
}
return v.Found, nil
}
func (c *Client) StopTasks(ctx context.Context, origin string, taskID int64) ([]int64, error) {
v, err := c.client.StopTasks(ctx, &pb.StopTasksRequest{Origin: origin, TaskId: taskID})
if err != nil {
@@ -86,14 +86,6 @@ func (s *server) Cancel(ctx context.Context, r *pb.CancelRequest) (*pb.CancelRes
return &pb.CancelResponse{Cancelled: v.Cancelled, Dropped: int64(v.Dropped)}, nil
}
func (s *server) SetPersona(ctx context.Context, r *pb.SetPersonaRequest) (*pb.SetPersonaResponse, error) {
v, err := s.chat.SetPersona(ctx, r.SessionId, r.Name)
if err != nil {
return nil, err
}
return &pb.SetPersonaResponse{Found: v}, nil
}
func (s *server) StopTasks(ctx context.Context, r *pb.StopTasksRequest) (*pb.StopTasksResponse, error) {
stopped, err := s.chat.StopTasks(ctx, r.Origin, r.TaskId)
if err != nil && len(stopped) == 0 {
+2 -2
View File
@@ -257,7 +257,7 @@ func snapshotProto(v messaging.ChatSnapshot) *pb.SnapshotResponse {
for k, list := range v.ModelsByProvider {
groups[k] = &pb.StringList{Values: list}
}
return &pb.SnapshotResponse{Sessions: mapValues(v.Sessions, sessionProto), Models: v.Models, ModelsByProvider: groups, Providers: v.Providers, ActiveModel: v.ActiveModel, ActiveProvider: v.ActiveProvider, Personas: v.Personas, ActivePersonas: v.ActivePersonas, CancellationAvailable: v.CancellationAvailable, PersonasAvailable: v.PersonasAvailable, VoiceAvailable: v.VoiceAvailable, Version: v.Version}
return &pb.SnapshotResponse{Sessions: mapValues(v.Sessions, sessionProto), Models: v.Models, ModelsByProvider: groups, Providers: v.Providers, ActiveModel: v.ActiveModel, ActiveProvider: v.ActiveProvider, CancellationAvailable: v.CancellationAvailable, VoiceAvailable: v.VoiceAvailable, Version: v.Version}
}
func snapshotValue(v *pb.SnapshotResponse) messaging.ChatSnapshot {
@@ -265,5 +265,5 @@ func snapshotValue(v *pb.SnapshotResponse) messaging.ChatSnapshot {
for k, list := range v.ModelsByProvider {
groups[k] = list.GetValues()
}
return messaging.ChatSnapshot{Sessions: mapValues(v.Sessions, sessionValue), Models: v.Models, ModelsByProvider: groups, Providers: v.Providers, ActiveModel: v.ActiveModel, ActiveProvider: v.ActiveProvider, Personas: v.Personas, ActivePersonas: v.ActivePersonas, CancellationAvailable: v.CancellationAvailable, PersonasAvailable: v.PersonasAvailable, VoiceAvailable: v.VoiceAvailable, Version: v.Version}
return messaging.ChatSnapshot{Sessions: mapValues(v.Sessions, sessionValue), Models: v.Models, ModelsByProvider: groups, Providers: v.Providers, ActiveModel: v.ActiveModel, ActiveProvider: v.ActiveProvider, CancellationAvailable: v.CancellationAvailable, VoiceAvailable: v.VoiceAvailable, Version: v.Version}
}
@@ -0,0 +1,8 @@
-- Personas are gone; SOUL is the only chat identity text.
-- +goose Up
DELETE FROM apply_status WHERE kind = 'personas';
DELETE FROM resources WHERE kind = 'personas';
-- +goose Down
SELECT 1;
-49
View File
@@ -109,11 +109,6 @@ func chatMediaViews(media []messaging.MediaAttachment) []chatMediaView {
return views
}
type chatPersonaRequest struct {
SessionID string `json:"session_id"`
Name string `json:"name"`
}
type chatCancelRequest struct {
SessionID string `json:"session_id"`
}
@@ -161,13 +156,9 @@ func (s *Server) handleChatSessions(w http.ResponseWriter, r *http.Request) {
return
}
out := make([]messaging.SessionContext, 0, len(snapshot.Sessions))
active := make(map[string]string)
for _, session := range snapshot.Sessions {
if s.ownsChatSession(r.Context(), session) {
out = append(out, session)
if name, ok := snapshot.ActivePersonas[session.SessionID]; ok {
active[session.SessionID] = name
}
}
}
writeJSON(w, map[string]any{
@@ -177,9 +168,7 @@ func (s *Server) handleChatSessions(w http.ResponseWriter, r *http.Request) {
"providers": snapshot.Providers,
"active_model": snapshot.ActiveModel,
"active_provider": snapshot.ActiveProvider,
"personas": snapshot.Personas,
"voice_available": snapshot.VoiceAvailable,
"active_personas": active,
"commands": chatCommandSpecs(chat),
})
}
@@ -494,44 +483,6 @@ func (s *Server) handleChatCancel(w http.ResponseWriter, r *http.Request) {
writeJSON(w, map[string]any{"cancelled": result.Cancelled, "dropped": result.Dropped})
}
func (s *Server) handleChatPersona(w http.ResponseWriter, r *http.Request) {
chat, ok := s.chatReady(w)
if !ok {
return
}
snapshot, err := chat.Contract.Snapshot(r.Context())
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if !snapshot.PersonasAvailable {
http.Error(w, "personality switching is not configured", http.StatusNotImplemented)
return
}
var req chatPersonaRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil || req.SessionID == "" || req.Name == "" {
http.Error(w, "session_id and name are required", http.StatusBadRequest)
return
}
if session, found, err := chat.Contract.GetSession(r.Context(), req.SessionID); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
} else if !found || !s.ownsChatSession(r.Context(), session) {
http.Error(w, "session not found", http.StatusNotFound)
return
}
changed, err := chat.Contract.SetPersona(r.Context(), req.SessionID, strings.ToLower(req.Name))
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if !changed {
http.Error(w, fmt.Sprintf("unknown personality %q", req.Name), http.StatusBadRequest)
return
}
writeJSON(w, map[string]any{"ok": true, "name": strings.ToLower(req.Name)})
}
// writeUpdateCheckError answers an unset check command as not configured, which
// the dashboard shows as such rather than as a failure.
func writeUpdateCheckError(w http.ResponseWriter, err error) {
@@ -99,7 +99,6 @@ func TestHTTPPolicyCannotBeBypassed(t *testing.T) {
{"POST", "/api/chat/answer"},
{"POST", "/api/chat/cancel"},
{"POST", "/api/chat/message"},
{"POST", "/api/chat/persona"},
{"POST", "/api/chat/stream"},
{"POST", "/api/chat/update/defer"},
{"POST", "/api/chat/update/install"},
+1 -3
View File
@@ -14,7 +14,7 @@ import (
type ownedChat struct{ messaging.ChatContract }
func (ownedChat) Snapshot(context.Context) (messaging.ChatSnapshot, error) {
return messaging.ChatSnapshot{CancellationAvailable: true, PersonasAvailable: true}, nil
return messaging.ChatSnapshot{CancellationAvailable: true}, nil
}
func (ownedChat) GetSession(context.Context, string) (messaging.SessionContext, bool, error) {
@@ -32,7 +32,6 @@ func (ownedChat) RecentTurns(context.Context, string, int) ([]messaging.TurnReco
func (ownedChat) Cancel(context.Context, string) (messaging.ChatCancellation, error) {
return messaging.ChatCancellation{Cancelled: true}, nil
}
func (ownedChat) SetPersona(context.Context, string, string) (bool, error) { return true, nil }
func TestWebChatOwnership(t *testing.T) {
for _, route := range []struct {
@@ -42,7 +41,6 @@ func TestWebChatOwnership(t *testing.T) {
{"messages", "", (*Server).handleChatMessages},
{"turns", "", (*Server).handleChatTurns},
{"cancel", `{"session_id":"private"}`, (*Server).handleChatCancel},
{"persona", `{"session_id":"private","name":"archie"}`, (*Server).handleChatPersona},
} {
for _, user := range []string{"alice", "bob"} {
t.Run(route.name+"/"+user, func(t *testing.T) {
-1
View File
@@ -382,7 +382,6 @@ func (s *Server) registerChatRoutes(mux *http.ServeMux) {
mux.HandleFunc("POST /api/chat/cancel", s.handleChatCancel)
mux.HandleFunc("POST /api/chat/answer", s.handleChatAnswer)
mux.HandleFunc("GET /api/chat/file/{token}", s.handleChatFile)
mux.HandleFunc("POST /api/chat/persona", s.handleChatPersona)
mux.HandleFunc("GET /api/chat/update", instanceOnly(s.handleChatUpdate))
mux.HandleFunc("POST /api/chat/update/defer", instanceOnly(s.handleChatUpdateDefer))
mux.HandleFunc("POST /api/chat/update/install", instanceOnly(s.handleChatUpdateInstall))
+6
View File
@@ -30,13 +30,19 @@ breaking:
#
# Message.budget_key went with the webhook chat channel (number and name
# reserved). An older channel extension that still sets it is ignored.
#
# Personas were removed: ChatService.SetPersona, its messages and the
# snapshot's persona fields (numbers and names reserved). The gateway's only
# clients ship from this repository.
ignore_only:
FIELD_SAME_TYPE:
- state/v1/state.proto
RPC_NO_DELETE:
- state/v1/state.proto
- gateway/v1/chat.proto
MESSAGE_NO_DELETE:
- state/v1/state.proto
- gateway/v1/chat.proto
FIELD_NO_DELETE:
- state/v1/state.proto
- controlplane/v1/controlplane.proto
+2 -6
View File
@@ -17,7 +17,6 @@ service ChatService {
rpc Answer(AnswerRequest) returns (AnswerResponse);
rpc Cancel(CancelRequest) returns (CancelResponse);
rpc StopTasks(StopTasksRequest) returns (StopTasksResponse);
rpc SetPersona(SetPersonaRequest) returns (SetPersonaResponse);
rpc ApplyTaskAction(ApplyTaskActionRequest) returns (ApplyTaskActionResponse);
rpc ApplyOperatorTaskAction(ApplyOperatorTaskActionRequest) returns (ApplyOperatorTaskActionResponse);
rpc SaveSession(SaveSessionRequest) returns (SaveSessionResponse);
@@ -135,11 +134,10 @@ message SnapshotResponse {
repeated string providers = 4;
string active_model = 5;
string active_provider = 6;
repeated string personas = 7;
map<string, string> active_personas = 8;
reserved 7, 8, 11;
reserved "personas", "active_personas", "personas_available";
bool restart_available = 9;
bool cancellation_available = 10;
bool personas_available = 11;
string version = 12;
bool voice_available = 13;
}
@@ -194,8 +192,6 @@ message CancelResponse { bool cancelled = 1; int64 dropped = 2; }
message StopTasksRequest { string origin = 1; int64 task_id = 2; }
// error reports tasks that could not be stopped alongside those that were.
message StopTasksResponse { repeated int64 stopped = 1; string error = 2; }
message SetPersonaRequest { string session_id = 1; string name = 2; }
message SetPersonaResponse { bool found = 1; }
message ApplyTaskActionRequest { string identity = 1; int64 task_id = 2; string action = 3; string instructions = 4; repeated string findings = 5; }
message ApplyTaskActionResponse { int64 task_id = 1; string action = 2; string message = 3; }
// An authenticated dashboard operator acts across identities, so this request
+1 -1
View File
@@ -1,3 +1,3 @@
import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Cn as s,Ct as c,D as l,Dn as u,Dt as d,E as f,En as p,Et as m,F as h,Ft as g,G as _,Gt as v,H as y,Ht as b,I as x,It as S,J as C,Jt as w,K as T,Kt as E,L as ee,Lt as te,M as D,Mn as ne,Mt as re,N as ie,Nn as ae,Nt as oe,O,On as se,Ot as ce,P as le,Pt as ue,Q as de,Qn as fe,Qt as pe,R as me,Rt as he,S as ge,Sn as _e,St as k,T as ve,Tn as ye,Tt as be,U as xe,Ut as A,V as Se,Vt as Ce,W as we,Wt as j,X as Te,Xt as Ee,Y as De,Yt as Oe,Z as ke,Zt as Ae,_ as M,_n as je,_t as Me,a as Ne,an as Pe,at as Fe,b as Ie,bn as Le,bt as Re,c as ze,cn as Be,ct as Ve,d as He,dn as Ue,dt as We,en as Ge,er as Ke,et as qe,f as Je,fn as Ye,ft as Xe,g as Ze,gn as Qe,gt as $e,h as et,hn as tt,ht as N,i as nt,in as rt,it,j as at,jt as ot,k as st,kn as P,kt as ct,l as lt,ln as ut,lt as dt,m as ft,mn as pt,mt,n as ht,nn as gt,nr as _t,nt as F,o as vt,on as yt,ot as bt,p as xt,pn as St,pt as Ct,q as wt,qt as Tt,r as Et,rn as Dt,rr as Ot,rt as kt,s as At,sn as jt,st as Mt,tn as Nt,tr as Pt,tt as I,u as Ft,un as It,ut as Lt,v as Rt,vn as zt,vt as Bt,w as Vt,wn as Ht,wt as Ut,x as Wt,xn as Gt,xt as Kt,y as L,yn as R,yt as qt,z as Jt,zt as Yt}from"./PageHeader.js";import{A as Xt,B as Zt,C as Qt,D as $t,E as en,F as tn,H as nn,I as rn,L as an,M as on,N as sn,O as cn,P as ln,R as un,S as dn,T as fn,U as pn,V as mn,W as hn,_ as z,a as gn,f as _n,g as vn,h as yn,i as bn,j as xn,k as Sn,n as Cn,s as wn,w as Tn,x as En,y as Dn,z as On}from"./api.js";import{n as kn}from"./pinia.js";import{a as An,i as jn,n as Mn,o as Nn,r as Pn,t as Fn}from"./alert.js";var In=Object.defineProperty,Ln=((e,t)=>{let n={};for(var r in e)In(n,r,{get:e[r],enumerable:!0});return t||In(n,Symbol.toStringTag,{value:`Module`}),n})({BaseTransition:()=>ht,BaseTransitionPropsValidators:()=>Et,Comment:()=>nt,DeprecationTypes:()=>null,EffectScope:()=>t,ErrorCodes:()=>Ne,ErrorTypeStrings:()=>vt,Fragment:()=>At,KeepAlive:()=>ze,ReactiveEffect:()=>Ge,Static:()=>lt,Suspense:()=>Ft,Teleport:()=>He,Text:()=>Je,TrackOpTypes:()=>Nt,Transition:()=>En,TransitionGroup:()=>dn,TriggerOpTypes:()=>gt,VueElement:()=>Qt,assertNumber:()=>xt,callWithAsyncErrorHandling:()=>ft,callWithErrorHandling:()=>et,camelize:()=>ne,capitalize:()=>ae,cloneVNode:()=>Ze,compatUtils:()=>null,compile:()=>Rn,computed:()=>M,createApp:()=>Tn,createBlock:()=>L,createCommentVNode:()=>Ie,createElementBlock:()=>Wt,createElementVNode:()=>Rt,createHydrationRenderer:()=>ge,createPropsRestProxy:()=>o,createRenderer:()=>Vt,createSSRApp:()=>fn,createSlots:()=>ve,createStaticVNode:()=>f,createTextVNode:()=>l,createVNode:()=>O,customRef:()=>Dt,defineAsyncComponent:()=>st,defineComponent:()=>n,defineCustomElement:()=>en,defineEmits:()=>at,defineExpose:()=>D,defineModel:()=>ie,defineOptions:()=>le,defineProps:()=>h,defineSSRCustomElement:()=>$t,defineSlots:()=>x,devtools:()=>ee,effect:()=>rt,effectScope:()=>Pe,getCurrentInstance:()=>me,getCurrentScope:()=>yt,getCurrentWatcher:()=>jt,getTransitionRawChildren:()=>Jt,guardReactiveProps:()=>i,h:()=>Se,handleError:()=>y,hasInjectionContext:()=>xe,hydrate:()=>cn,hydrateOnIdle:()=>we,hydrateOnInteraction:()=>_,hydrateOnMediaQuery:()=>T,hydrateOnVisible:()=>wt,initCustomFormatter:()=>C,initDirectivesForSSR:()=>Sn,inject:()=>De,isMemoSame:()=>Te,isProxy:()=>Be,isReactive:()=>ut,isReadonly:()=>It,isRef:()=>Ue,isRuntimeOnly:()=>ke,isShallow:()=>Ye,isVNode:()=>de,markRaw:()=>St,mergeDefaults:()=>e,mergeModels:()=>qe,mergeProps:()=>I,nextTick:()=>F,nodeOps:()=>Xt,normalizeClass:()=>fe,normalizeProps:()=>Ke,normalizeStyle:()=>Pt,onActivated:()=>kt,onBeforeMount:()=>it,onBeforeUnmount:()=>Fe,onBeforeUpdate:()=>bt,onDeactivated:()=>Mt,onErrorCaptured:()=>Ve,onMounted:()=>dt,onRenderTracked:()=>Lt,onRenderTriggered:()=>We,onScopeDispose:()=>pt,onServerPrefetch:()=>Xe,onUnmounted:()=>Ct,onUpdated:()=>mt,onWatcherCleanup:()=>tt,openBlock:()=>N,patchProp:()=>xn,popScopeId:()=>$e,provide:()=>Me,proxyRefs:()=>Qe,pushScopeId:()=>Bt,queuePostFlushCb:()=>qt,reactive:()=>je,readonly:()=>zt,ref:()=>R,registerRuntimeCompiler:()=>Re,render:()=>on,renderList:()=>Kt,renderSlot:()=>k,resolveComponent:()=>c,resolveDirective:()=>Ut,resolveDynamicComponent:()=>be,resolveFilter:()=>null,resolveTransitionHooks:()=>m,setBlockTracking:()=>d,setDevtoolsHook:()=>ce,setTransitionHooks:()=>ct,shallowReactive:()=>Le,shallowReadonly:()=>Gt,shallowRef:()=>_e,ssrContextKey:()=>r,ssrUtils:()=>ot,stop:()=>s,toDisplayString:()=>_t,toHandlerKey:()=>Ot,toHandlers:()=>re,toRaw:()=>Ht,toRef:()=>ye,toRefs:()=>p,toValue:()=>u,transformVNodeArgs:()=>oe,triggerRef:()=>se,unref:()=>P,useAttrs:()=>ue,useCssModule:()=>sn,useCssVars:()=>ln,useHost:()=>tn,useId:()=>g,useModel:()=>S,useSSRContext:()=>te,useShadowRoot:()=>rn,useSlots:()=>he,useTemplateRef:()=>Yt,useTransitionState:()=>a,vModelCheckbox:()=>an,vModelDynamic:()=>un,vModelRadio:()=>On,vModelSelect:()=>Zt,vModelText:()=>mn,vShow:()=>nn,version:()=>Ce,warn:()=>b,watch:()=>A,watchEffect:()=>j,watchPostEffect:()=>v,watchSyncEffeLine truncated
`)].join(`
`))}return()=>i.value||r.value||o.value?Se(t.default({present:o.value})[0],{ref:e=>{let t=H(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),[_i,vi]=Gn(`CollapsibleRoot`),yi=n({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=kr(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=p(r);return vi({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),W(),(t,n)=>(N(),L(P(z),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:w(()=>[k(t.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),bi=n({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=_i();i.contentId||=di(void 0,`reka-collapsible-content`);let a=R(),{forwardRef:o,currentElement:s}=W(),c=R(0),l=R(0),u=M(()=>i.open.value),d=R(u.value),f=R();A(()=>[u.value,a.value?.present],async()=>{await F();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=M(()=>d.value&&i.open.value);return dt(()=>{requestAnimationFrame(()=>{d.value=!1})}),U(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(t,r)=>(N(),L(P(gi),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:w(({present:r})=>[O(P(z),I(t.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:r?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:w(()=>[!P(i).unmountOnHide.value||r?k(t.$slots,`default`,{},void 0,void 0,0):Ie(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),xi=n({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;W();let n=_i();return(r,i)=>(N(),L(P(z),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:w(()=>[k(r.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Si({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function Ci({type:e,defaultValue:t,modelValue:n}){return e||Si({type:e,defaultValue:t,modelValue:n})}function wi({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Ti(e,t){let n=M(()=>Ci(e)),r=kr(e,`modelValue`,t,{defaultValue:wi(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Wn(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Jn(t,e)){let n=t.findIndex(t=>Wn(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:M(()=>n.value===`single`)}}var[Ei,Di]=Gn(`AccordionRoot`),Oi=n({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},orientation:{type:String,required:!1,default:`vertical`},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},type:{type:String,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{dir:i,disabled:a,unmountOnHide:o}=p(n),s=qr(i),{modelValue:c,changeModelValue:l,isSingle:u}=Ti(n,r),{forwardRef:d,currentElement:f}=W();return Di({disabled:a,direction:s,orientation:n.orientation,parentElement:f,isSingle:u,collapsible:n.collapsible,modelValue:c,changeModelValue:l,unmountOnHide:o}),(t,n)=>(N(),L(P(z),{ref:P(d),"as-child":e.asChild,as:e.as},{default:w(()=>[k(t.$slo Line truncated
`))}return()=>i.value||r.value||o.value?Se(t.default({present:o.value})[0],{ref:e=>{let t=H(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),[_i,vi]=Gn(`CollapsibleRoot`),yi=n({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=kr(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=p(r);return vi({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),W(),(t,n)=>(N(),L(P(z),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:w(()=>[k(t.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),bi=n({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=_i();i.contentId||=di(void 0,`reka-collapsible-content`);let a=R(),{forwardRef:o,currentElement:s}=W(),c=R(0),l=R(0),u=M(()=>i.open.value),d=R(u.value),f=R();A(()=>[u.value,a.value?.present],async()=>{await F();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=M(()=>d.value&&i.open.value);return dt(()=>{requestAnimationFrame(()=>{d.value=!1})}),U(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(t,r)=>(N(),L(P(gi),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:w(({present:r})=>[O(P(z),I(t.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:r?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:w(()=>[!P(i).unmountOnHide.value||r?k(t.$slots,`default`,{},void 0,void 0,0):Ie(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),xi=n({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;W();let n=_i();return(r,i)=>(N(),L(P(z),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:w(()=>[k(r.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Si({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function Ci({type:e,defaultValue:t,modelValue:n}){return e||Si({type:e,defaultValue:t,modelValue:n})}function wi({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Ti(e,t){let n=M(()=>Ci(e)),r=kr(e,`modelValue`,t,{defaultValue:wi(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Wn(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Jn(t,e)){let n=t.findIndex(t=>Wn(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:M(()=>n.value===`single`)}}var[Ei,Di]=Gn(`AccordionRoot`),Oi=n({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},orientation:{type:String,required:!1,default:`vertical`},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},type:{type:String,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{dir:i,disabled:a,unmountOnHide:o}=p(n),s=qr(i),{modelValue:c,changeModelValue:l,isSingle:u}=Ti(n,r),{forwardRef:d,currentElement:f}=W();return Di({disabled:a,direction:s,orientation:n.orientation,parentElement:f,isSingle:u,collapsible:n.collapsible,modelValue:c,changeModelValue:l,unmountOnHide:o}),(t,n)=>(N(),L(P(z),{ref:P(d),"as-child":e.asChild,as:e.as},{default:w(()=>[k(t.$slo Line truncated
+1 -1
View File
@@ -1,3 +1,3 @@
import{$n as e,A as t,An as n,Bn as r,Bt as i,Dn as a,En as o,Et as s,Fn as c,Gn as l,Hn as u,In as d,Jn as f,Jt as p,Kn as m,Ln as h,Mn as g,Nn as _,O as ee,Pn as v,Qn as y,R as b,Rn as te,S as ne,Sn as x,St as S,U as re,Un as ie,Ut as C,V as ae,Vn as oe,Wn as w,Wt as T,Xn as E,Y as se,Yn as D,Zn as O,_ as k,_n as ce,dn as le,g as ue,ht as A,i as j,ir as de,jn as fe,kn as M,kt as pe,l as me,lt as N,m as he,mn as ge,mt as _e,n as ve,nt as ye,on as be,ot as xe,pt as Se,qn as P,r as Ce,rn as we,s as Te,tt as Ee,w as De,wn as Oe,xn as ke,y as Ae,yn as je,yt as Me,z as Ne,zn as F}from"./PageHeader.js";var Pe=void 0,Fe=typeof window<`u`&&window.trustedTypes;if(Fe)try{Pe=Fe.createPolicy(`vue`,{createHTML:e=>e})}catch{}var Ie=Pe?e=>Pe.createHTML(e):e=>e,Le=`http://www.w3.org/2000/svg`,Re=`http://www.w3.org/1998/Math/MathML`,I=typeof document<`u`?document:null,ze=I&&I.createElement(`template`),Be={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?I.createElementNS(Le,e):t===`mathml`?I.createElementNS(Re,e):n?I.createElement(e,{is:n}):I.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>I.createTextNode(e),createComment:e=>I.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>I.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{ze.innerHTML=Ie(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=ze.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},L=`transition`,Ve=`animation`,He=Symbol(`_vtc`),Ue={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},We=v({},Ce,Ue),Ge=(e=>(e.displayName=`Transition`,e.props=We,e))((e,{slots:t})=>ae(ve,qe(e),t)),R=(e,t=[])=>{F(e)?e.forEach(e=>e(...t)):e&&e(...t)},Ke=e=>e?F(e)?e.some(e=>e.length>1):e.length>1:!1;function qe(e){let t={};for(let n in e)n in Ue||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:i,enterFromClass:a=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:c=a,appearActiveClass:l=o,appearToClass:u=s,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,m=Je(i),h=m&&m[0],g=m&&m[1],{onBeforeEnter:_,onEnter:ee,onEnterCancelled:y,onLeave:b,onLeaveCancelled:te,onBeforeAppear:ne=_,onAppear:x=ee,onAppearCancelled:S=y}=t,re=(e,t,n,r)=>{e._enterCancelled=r,B(e,t?u:s),B(e,t?l:o),n&&n()},ie=(e,t)=>{e._isLeaving=!1,B(e,d),B(e,p),B(e,f),t&&t()},C=e=>(t,n)=>{let i=e?x:ee,o=()=>re(t,e,n);R(i,[t,o]),Xe(()=>{B(t,e?c:a),z(t,e?u:s),Ke(i)||Qe(t,r,h,o)})};return v(t,{onBeforeEnter(e){R(_,[e]),z(e,a),z(e,o)},onBeforeAppear(e){R(ne,[e]),z(e,c),z(e,l)},onEnter:C(!1),onAppear:C(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>ie(e,t);z(e,d),e._enterCancelled?(z(e,f),nt(e)):(nt(e),z(e,f)),Xe(()=>{e._isLeaving&&(B(e,d),z(e,p),Ke(b)||Qe(e,r,g,n))}),R(b,[e,n])},onEnterCancelled(e){re(e,!1,void 0,!0),R(y,[e])},onAppearCancelled(e){re(e,!0,void 0,!0),R(S,[e])},onLeaveCancelled(e){ie(e),R(te,[e])}})}function Je(e){if(e==null)return null;if(u(e))return[Ye(e.enter),Ye(e.leave)];{let t=Ye(e);return[t,t]}}function Ye(e){return de(e)}function z(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[He]||(e[He]=new Set)).add(t)}function B(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[He];n&&(n.delete(t),n.size||(e[He]=void 0))}function Xe(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var Ze=0;function Qe(e,t,n,r){let i=e._endId=++Ze,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=$e(e,t);if(!o)return r();let l=o+`end`,u=0,d=()=>{e.removeEventListener(l,f),a()},f=t=>{t.target===e&&++u>=c&&d()};setTimeout(()=>{u<c&&d()},s+1),e.addEventListener(l,f)}function $e(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${L}Delay`),a=r(`${L}Duration`),o=et(i,a),s=r(`${Ve}Delay`),c=r(`${Ve}Duration`),l=et(s,c),u=null,d=0,f=0;t===L?o>0&&(u=L,d=o,f=a.length):t===Ve?l>0&&(u=Ve,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?L:Ve:null,f=u?u===L?a.length:c.length:0);let p=u===L&&/\b(?:transform|all)(?:,|$)/.test(r(`${L}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function et(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>tt(tLine truncated
`))),e[U]=H(i);let a=r||i.props&&i.props.type===`number`;V(e,t?`change`:`input`,t=>{t.target.composing||e[U](on(e.value,n,a))}),(n||a)&&V(e,`change`,()=>{e.value=on(e.value,n,a)}),t||(V(e,`compositionstart`,nn),V(e,`compositionend`,rn),V(e,`change`,rn))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[an];delete e[an],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[U](on(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[U]=H(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?O(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)}},cn={deep:!0,created(e,t,n){e[U]=H(n),V(e,`change`,()=>{let t=e._modelValue,n=mn(e),r=e.checked,i=e[U];if(F(t)){let e=E(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(l(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(hn(e,r))})},mounted:ln,beforeUpdate(e,t,n){e[U]=H(n),ln(e,t,n)}};function ln(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(F(t))i=E(t,r.props.value)>-1;else if(l(t))i=t.has(r.props.value);else{if(t===n)return;i=D(t,hn(e,!0))}e.checked!==i&&(e.checked=i)}var un={created(e,{value:t},n){e.checked=D(t,n.props.value),e[U]=H(n),V(e,`change`,()=>{e[U](mn(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[U]=H(r),t!==n&&(e.checked=D(t,r.props.value))}},dn={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,V(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?O(mn(e)):mn(e)),r=e.multiple,i=r?l(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?F(i)?t.slice():t:i];try{e[U](i)}finally{ye(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[U]=H(r)},mounted(e,{value:t}){pn(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[U]=H(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!fn(t,n[1],n[0]))&&pn(e,t)}};function fn(e,t,n){if(!n||F(e))return D(e,t);if(l(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function pn(e,t){let n=e.multiple,r=F(t);if(!n||r||l(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=mn(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):E(t,o)>-1}else a.selected=t.has(o)}else if(D(mn(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function mn(e){return`_value`in e?e._value:e.value}function hn(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var gn={created(e,t,n){vn(e,t,n,null,`created`)},mounted(e,t,n){vn(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){vn(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){vn(e,t,n,r,`updated`)}};function _n(e,t){switch(e){case`SELECT`:return dn;case`TEXTAREA`:return sn;default:switch(t){case`checkbox`:return cn;case`radio`:return un;default:return sn}}}function vn(e,t,n,r,i){let a=_n(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function yn(){sn.getSSRProps=({value:e})=>({value:e}),un.getSSRProps=({value:e},t)=>{if(t.props&&D(t.props.value,e))return{checked:!0}},cn.getSSRProps=({value:e},t)=>{if(F(e)){if(t.props&&E(e,t.props.value)>-1)return{checked:!0}}else if(l(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},gn.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=_n(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var bn=[`ctrl`,`shift`,`alt`,`meta`],xn={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)=>bn.some(n=>e[`${n}Key`]&&!t.includes(n))},Sn=(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=xn[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Cn={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},wn=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=d(n.key);if(t.some(e=>e===r||Cn[e]===r))return e(n)}))},Tn=v({patchProp:Ft},Be),En,Dn=!1;function On(){return En||=De(Tn)}function kn(){return En=Dn?En:ne(Tn),Dn=!0,En}var An=((...e)=>{On().render(...e)}),jn=((...e)=>{kn().hydrate(...e)}),Mn=((...e)=>{let t=On().createApp(...e),{mount:n}=t;return t.mount=e=>{let i=Fn(e);if(!i)return;let a=t._component;!r(a)&&!a.render&&!a.template&&(a.template=i.innerHTML),i.nodeType===1&&(i.textContent=``);let o=n(i,!1,Pn(i));return i instanceof Element&&(i.removeAttribute(`v-cloak`),i.setAttribute(`data-v-app`,``)),o},t}),Nn=((...e)=>{let t=kn().createApp(...e),{mount: Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var $i;function ea(e){$i=e}var ta=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function na(e){let t=e instanceof ta?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 ra(e,t){let n=await fetch(e,t);if($i?.(n.status===401),!n.ok)throw new ta(await Qi(n),n.status);return n}async function $(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Zi,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 ra(e,s);return a?await c.json():void 0}var ia={recoveryCode:()=>$(`/api/account/recovery`,{method:`POST`,body:{}}),recoverAccount:(e,t,n)=>$(`/api/auth/recover`,{method:`POST`,body:{email:e,code:t,password:n},parse:!1}),authStatus:()=>$(`/api/auth/status`),setupAccount:e=>$(`/api/auth/setup`,{method:`POST`,body:e}),signIn:(e,t)=>$(`/api/auth/login`,{method:`POST`,body:{email:e,password:t}}),signOut:()=>$(`/api/auth/logout`,{method:`POST`,body:{},parse:!1}),createAccount:e=>$(`/api/accounts`,{method:`POST`,body:e}),changePassword:(e,t)=>$(`/api/account/password`,{method:`POST`,body:{current_password:e,new_password:t},parse:!1}),authentication:()=>$(`/api/authentication`),saveAuthentication:e=>$(`/api/authentication`,{method:`PUT`,body:e,parse:!1}),passkeys:()=>$(`/api/account/passkeys`),deletePasskey:e=>$(`/api/account/passkeys/${encodeURIComponent(e)}`,{method:`DELETE`,body:{},parse:!1}),beginPasskey:e=>$(e?`/api/account/passkeys/begin`:`/api/auth/passkey/begin`,{method:`POST`,body:{}}),finishPasskey:(e,t,n)=>$(e?`/api/account/passkeys/finish`:`/api/auth/passkey/finish`,{method:`POST`,body:{credential:t,name:n}}),secretEngines:()=>$(`/api/secret-engines`),checkSecret:e=>$(`/api/secret-references/check`,{method:`POST`,body:e}),health:()=>$(`/health/detailed`),services:()=>$(`/api/services`),policies:()=>$(`/api/access/policies`),putPolicy:e=>$(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>$(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),orgs:()=>$(`/api/orgs`),orgCreate:e=>$(`/api/orgs`,{method:`POST`,body:e}),org:e=>$(`/api/orgs/${encodeURIComponent(e)}`),orgWorkspaces:e=>$(`/api/orgs/${encodeURIComponent(e)}/workspaces`),createOrgWorkspace:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/workspaces`,{method:`POST`,body:t}),orgMembers:e=>$(`/api/orgs/${encodeURIComponent(e)}/members`),addOrgMember:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/members`,{method:`POST`,body:t}),setOrgMember:(e,t,n)=>$(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PUT`,body:n}),removeOrgMember:(e,t,n)=>$(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`+Q({workspace:n}),{method:`DELETE`,parse:!1}),assignOrgAgent:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}`,{method:`PUT`}),alerts:()=>$(`/api/alerts`),dismissAlert:e=>$(`/api/alerts/${e}/dismiss`,{method:`POST`,parse:!1}),identities:()=>$(`/api/identities`),identityCreate:e=>$(`/api/identities`,{method:`POST`,body:e}),identityCommand:(e,t,n)=>$(`/api/identities/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`POST`,body:n}),summary:()=>$(`/api/summary`),tasks:()=>$(`/api/tasks`),taskPage:async e=>{let t=await ra(`/api/tasks`+Q(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(Zi)});return{tasks:await t.json(),next:t.headers.get(`X-Next-Cursor`)}},taskMeta:()=>$(`/api/task-meta`),task:e=>$(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>$(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/changes`+Q(t)),taskDebug:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/debug`+Q(t)),taskAction:(e,t,n)=>$(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>$(`/api/setup`),capabilities:()=>$(`/api/capabilities`),workflows:()=>$(`/api/workflows`),workflowEnabled:(e,t)=>$(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),workRequest:e=>$(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>$(`/api/skills`),channels:()=>$(`/api/channels`),curators:()=>$(`/api/curators`),channelReload:e=>$(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>$(`/api/config`),logs:e=>$(`/api/logs`+Q(e)),taskLogs:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/logs`+Q(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>$(`/api/version`),updateSnapshot:()=>$(`/api/chat/update`),updateDefer:e=>$(`/api/chat/update/defer`,{method:`POST`,body:{snapshot:e}}),updateInstall:e=>$(`/api/chat/update/install`,{method:`POST`,body:{snaps Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var $i;function ea(e){$i=e}var ta=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function na(e){let t=e instanceof ta?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 ra(e,t){let n=await fetch(e,t);if($i?.(n.status===401),!n.ok)throw new ta(await Qi(n),n.status);return n}async function $(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Zi,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 ra(e,s);return a?await c.json():void 0}var ia={recoveryCode:()=>$(`/api/account/recovery`,{method:`POST`,body:{}}),recoverAccount:(e,t,n)=>$(`/api/auth/recover`,{method:`POST`,body:{email:e,code:t,password:n},parse:!1}),authStatus:()=>$(`/api/auth/status`),setupAccount:e=>$(`/api/auth/setup`,{method:`POST`,body:e}),signIn:(e,t)=>$(`/api/auth/login`,{method:`POST`,body:{email:e,password:t}}),signOut:()=>$(`/api/auth/logout`,{method:`POST`,body:{},parse:!1}),createAccount:e=>$(`/api/accounts`,{method:`POST`,body:e}),changePassword:(e,t)=>$(`/api/account/password`,{method:`POST`,body:{current_password:e,new_password:t},parse:!1}),authentication:()=>$(`/api/authentication`),saveAuthentication:e=>$(`/api/authentication`,{method:`PUT`,body:e,parse:!1}),passkeys:()=>$(`/api/account/passkeys`),deletePasskey:e=>$(`/api/account/passkeys/${encodeURIComponent(e)}`,{method:`DELETE`,body:{},parse:!1}),beginPasskey:e=>$(e?`/api/account/passkeys/begin`:`/api/auth/passkey/begin`,{method:`POST`,body:{}}),finishPasskey:(e,t,n)=>$(e?`/api/account/passkeys/finish`:`/api/auth/passkey/finish`,{method:`POST`,body:{credential:t,name:n}}),secretEngines:()=>$(`/api/secret-engines`),checkSecret:e=>$(`/api/secret-references/check`,{method:`POST`,body:e}),health:()=>$(`/health/detailed`),services:()=>$(`/api/services`),policies:()=>$(`/api/access/policies`),putPolicy:e=>$(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>$(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),orgs:()=>$(`/api/orgs`),orgCreate:e=>$(`/api/orgs`,{method:`POST`,body:e}),org:e=>$(`/api/orgs/${encodeURIComponent(e)}`),orgWorkspaces:e=>$(`/api/orgs/${encodeURIComponent(e)}/workspaces`),createOrgWorkspace:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/workspaces`,{method:`POST`,body:t}),orgMembers:e=>$(`/api/orgs/${encodeURIComponent(e)}/members`),addOrgMember:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/members`,{method:`POST`,body:t}),setOrgMember:(e,t,n)=>$(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PUT`,body:n}),removeOrgMember:(e,t,n)=>$(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`+Q({workspace:n}),{method:`DELETE`,parse:!1}),assignOrgAgent:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}`,{method:`PUT`}),alerts:()=>$(`/api/alerts`),dismissAlert:e=>$(`/api/alerts/${e}/dismiss`,{method:`POST`,parse:!1}),identities:()=>$(`/api/identities`),identityCreate:e=>$(`/api/identities`,{method:`POST`,body:e}),identityCommand:(e,t,n)=>$(`/api/identities/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`POST`,body:n}),summary:()=>$(`/api/summary`),tasks:()=>$(`/api/tasks`),taskPage:async e=>{let t=await ra(`/api/tasks`+Q(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(Zi)});return{tasks:await t.json(),next:t.headers.get(`X-Next-Cursor`)}},taskMeta:()=>$(`/api/task-meta`),task:e=>$(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>$(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/changes`+Q(t)),taskDebug:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/debug`+Q(t)),taskAction:(e,t,n)=>$(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>$(`/api/setup`),capabilities:()=>$(`/api/capabilities`),workflows:()=>$(`/api/workflows`),workflowEnabled:(e,t)=>$(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),workRequest:e=>$(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>$(`/api/skills`),channels:()=>$(`/api/channels`),curators:()=>$(`/api/curators`),channelReload:e=>$(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>$(`/api/config`),logs:e=>$(`/api/logs`+Q(e)),taskLogs:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/logs`+Q(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>$(`/api/version`),updateSnapshot:()=>$(`/api/chat/update`),updateDefer:e=>$(`/api/chat/update/defer`,{method:`POST`,body:{snapshot:e}}),updateInstall:e=>$(`/api/chat/update/install`,{method:`POST`,body:{snaps Line truncated
+1 -1
View File
@@ -1 +1 @@
.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}.vue-flow{z-index:0;direction:ltr;width:100%;height:100%;position:relative;overflow:hidden}.vue-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.vue-flow__pane{z-index:1}.vue-flow__pane.draggable{cursor:grab}.vue-flow__pane.selection{cursor:pointer}.vue-flow__pane.dragging{cursor:grabbing}.vue-flow__transformationpane{transform-origin:0 0;z-index:2;pointer-events:none}.vue-flow__viewport{z-index:4;overflow:clip}.vue-flow__selection{z-index:6}.vue-flow__edge-labels{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute}.vue-flow__nodesselection-rect:focus,.vue-flow__nodesselection-rect:focus-visible{outline:none}.vue-flow .vue-flow__edges{pointer-events:none;overflow:visible}.vue-flow__edge-path,.vue-flow__connection-path{stroke:#b1b1b7;stroke-width:1px;fill:none}.vue-flow__edge{pointer-events:visibleStroke;cursor:pointer}.vue-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__edge.animated path.vue-flow__edge-interaction{stroke-dasharLine truncated
.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}.vue-flow{z-index:0;direction:ltr;width:100%;height:100%;position:relative;overflow:hidden}.vue-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.vue-flow__pane{z-index:1}.vue-flow__pane.draggable{cursor:grab}.vue-flow__pane.selection{cursor:pointer}.vue-flow__pane.dragging{cursor:grabbing}.vue-flow__transformationpane{transform-origin:0 0;z-index:2;pointer-events:none}.vue-flow__viewport{z-index:4;overflow:clip}.vue-flow__selection{z-index:6}.vue-flow__edge-labels{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute}.vue-flow__nodesselection-rect:focus,.vue-flow__nodesselection-rect:focus-visible{outline:none}.vue-flow .vue-flow__edges{pointer-events:none;overflow:visible}.vue-flow__edge-path,.vue-flow__connection-path{stroke:#b1b1b7;stroke-width:1px;fill:none}.vue-flow__edge{pointer-events:visibleStroke;cursor:pointer}.vue-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__edge.animated path.vue-flow__edge-interaction{stroke-dasharLine truncated
+78 -78
View File
@@ -1,79 +1,79 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AccountPage.js","assets/PageHeader.js","assets/api.js","assets/AuthenticationPage.js","assets/AgentProfilesPage.js","assets/CardAccordion.js","assets/pinia.js","assets/alert.js","assets/CredentialBindingsPage.js","assets/PlaybooksPage.js","assets/HarnessPage.js","assets/NotFoundPage.js"])))=>i.map(i=>d[i]);
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as ee,_ as E,a as D,at as te,b as ne,c as re,ct as ie,d as O,dt as ae,et as oe,f as se,ft as ce,g as le,h as ue,i as de,it as fe,j as pe,k as me,l as he,lt as ge,m as _e,mt as ve,n as ye,nt as be,o as xe,ot as Se,p as Ce,pt as we,q as Te,r as Ee,rt as De,s as Oe,st as ke,t as Ae,tt as je,u as Me,ut as Ne,v as Pe,w as Fe,x as Ie,y as Le,z as Re}from"./CardAccordion.js";import{$ as ze,A as k,B as Be,C as Ve,Ct as He,D as A,Dn as Ue,En as We,Ft as Ge,It as Ke,Jt as j,Kt as qe,Mt as Je,O as M,Pt as Ye,Qn as N,R as Xe,Rt as Ze,Sn as Qe,St as P,Tn as $e,Tt as et,Ut as F,V as tt,Wt as nt,X as rt,Xt as it,Y as at,Zt as ot,_ as I,_n as st,_t as ct,an as lt,at as ut,b as L,bn as dt,d as ft,dn as pt,er as mt,et as ht,ht as R,it as gt,kn as z,lt as _t,mn as vt,nr as B,nt as yt,on as bt,pn as xt,pt as St,rn as Ct,s as V,t as wt,tr as Tt,tt as H,v as U,vn as Et,wn as Dt,x as W,xt as G,y as K,yn as q,zt as Ot}from"./PageHeader.js";import{B as kt,H as At,U as jt,V as Mt,W as Nt,_ as Pt,b as Ft,c as It,d as Lt,f as Rt,g as J,h as Y,l as zt,m as Bt,n as X,o as Vt,p as Ht,r as Ut,t as Wt,u as Gt,v as Kt,w as qt,x as Jt}from"./api.js";import{n as Yt,r as Xt,t as Zt}from"./pinia.js";import{a as Qt,i as $t,n as en,o as tn,r as nn,t as rn}from"./alert.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function an(e,t,n){let r=e.findIndex(e=>ve(e,t)),i=e.findIndex(e=>ve(e,n));if(r===-1||i===-1)return[];let[a,o]=[r,i].sort((e,t)=>e-t);return e.slice(a,o+1)}function on(e,t=-1/0,n=1/0){return Math.min(n,Math.max(t,e))}function sn(e,t){let n=e,r=t.toString(),i=r.indexOf(`.`),a=i>=0?r.length-i:0;if(a>0){let e=10**a;n=Math.round(n*e)/e}return n}function cn(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(Number.isNaN(t)?0:t))%r,a=sn(Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i,r);return Number.isNaN(t)?!Number.isNaN(n)&&a>n&&(a=Math.floor(sn(n/r,r))*r):a<t?a=t:!Number.isNaN(n)&&a>n&&(a=t+Math.floor(sn((n-t)/r,r))*r),a=sn(a,r),a}var ln=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u,un=/android/i;function dn(){return typeof navigator<`u`&&un.test(navigator.userAgent)}function fn(e){let t=q(!1),n=q(!0),r=q(!1),i=I(()=>t.value&&n.value);function a(){t.value=!0,n.value=!0,r.value=!1}function o(e){e.data&&(ln.test(e.data)?(n.value=!0,r.value=!0):dn()&&!r.value&&(n.value=!1))}function s(n){yt(()=>{t.value=!1,e?.(n)})}return{isComposing:t,shouldDeferInput:i,handleCompositionStart:a,handleCompositionUpdate:o,handleCompositionEnd:s}}function pn(e){let t=I(()=>z(e)),n=I(()=>new Intl.Collator(`en`,{usage:`search`,...t.value}));return{startsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(0,t.length),t)===0),endsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(-t.length),t)===0),contains:(e,t)=>{if(t.length===0)return!0;if(e=e.normalize(`NFC`),t=t.normalize(`NFC`),t.length>e.length)return!1;let r=n.value.compare;if(e.includes(t))return!0;let i=t.length;for(let n=0;n+i<=e.length;n++)if(r(t,e.slice(n,n+i))===0)return!0;return!1}}}function mn(e){return I(()=>!Ue(e)||!!w(e)?.closest(`form`))}function hn(){let e=Xe()?.vnode?.scopeId;return e?{[e]:``}:{}}function gn(e,t){let n=Se(!1,300);ke(()=>{n.value=!1});let r=q(null),i=je();function a(){r.value=null,n.value=!1}function o(e,t){if(!t)return;let i=e.currentTarget,a={x:e.clientX,y:e.clientY},o=vn(a,_n(a,i.getBoundingClientRect()),1),s=yn(t.getBoundingClientRect()),c=xn([...o,...s]);r.value=c,n.value=!0}return nt(n=>{if(e.value&&t.value){let r=e.value,i=t.value,a=e=>o(e,i),s=e=>o(e,r);r.addEventListener(`pointerleave`,a),i.addEventListener(`pointerleave`,s),n(()=>{r.removeEventListener(`pointerleave`,a),i.removeEventListener(`pointerleave`,s)})}}),nt(n=>{if(r.value){let o=n=>{if(!r.value||!(n.target instanceof Element))return;let o=n.target,s={x:n.clientX,y:n.clientY},c=e.value?.contains(o)||t.value?.contains(o),l=!bn(s,r.value),u=!!o.closest(`[data-grace-area-trigger]`);c?a():(l||u)&&(a(),i.trigger())},s=e.value?.ownerDocument;s?.addEventListener(`pointermove`,o),n(()=>s?.removeEventListener(`pointermove`,o))}}),{isPointerInTransit:n,onPointerExit:i.on}}function _n(e,t){lLine truncated
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as ee,_ as E,a as D,at as te,b as ne,c as re,ct as ie,d as O,dt as ae,et as oe,f as se,ft as ce,g as le,h as ue,i as de,it as fe,j as pe,k as me,l as he,lt as ge,m as _e,mt as ve,n as ye,nt as be,o as xe,ot as Se,p as Ce,pt as we,q as Te,r as Ee,rt as De,s as Oe,st as ke,t as Ae,tt as je,u as Me,ut as Ne,v as Pe,w as Fe,x as Ie,y as Le,z as Re}from"./CardAccordion.js";import{$ as ze,A as k,B as Be,C as Ve,Ct as He,D as A,Dn as Ue,En as We,Ft as Ge,It as Ke,Jt as j,Kt as qe,Mt as Je,O as M,Pt as Ye,Qn as N,R as Xe,Rt as Ze,Sn as Qe,St as P,Tn as $e,Tt as et,Ut as F,V as tt,Wt as nt,X as rt,Xt as it,Y as at,Zt as ot,_ as I,_n as st,_t as ct,an as lt,at as ut,b as L,bn as dt,d as ft,dn as pt,er as mt,et as ht,ht as R,it as gt,kn as z,lt as _t,mn as vt,nr as B,nt as yt,on as bt,pn as xt,pt as St,rn as Ct,s as V,t as wt,tr as Tt,tt as H,v as U,vn as Et,wn as Dt,x as W,xt as G,y as K,yn as q,zt as Ot}from"./PageHeader.js";import{B as kt,H as At,U as jt,V as Mt,W as Nt,_ as Pt,b as Ft,c as It,d as Lt,f as Rt,g as J,h as Y,l as zt,m as Bt,n as X,o as Vt,p as Ht,r as Ut,t as Wt,u as Gt,v as Kt,w as qt,x as Jt}from"./api.js";import{n as Yt,r as Xt,t as Zt}from"./pinia.js";import{a as Qt,i as $t,n as en,o as tn,r as nn,t as rn}from"./alert.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function an(e,t,n){let r=e.findIndex(e=>ve(e,t)),i=e.findIndex(e=>ve(e,n));if(r===-1||i===-1)return[];let[a,o]=[r,i].sort((e,t)=>e-t);return e.slice(a,o+1)}function on(e,t=-1/0,n=1/0){return Math.min(n,Math.max(t,e))}function sn(e,t){let n=e,r=t.toString(),i=r.indexOf(`.`),a=i>=0?r.length-i:0;if(a>0){let e=10**a;n=Math.round(n*e)/e}return n}function cn(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(Number.isNaN(t)?0:t))%r,a=sn(Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i,r);return Number.isNaN(t)?!Number.isNaN(n)&&a>n&&(a=Math.floor(sn(n/r,r))*r):a<t?a=t:!Number.isNaN(n)&&a>n&&(a=t+Math.floor(sn((n-t)/r,r))*r),a=sn(a,r),a}var ln=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u,un=/android/i;function dn(){return typeof navigator<`u`&&un.test(navigator.userAgent)}function fn(e){let t=q(!1),n=q(!0),r=q(!1),i=I(()=>t.value&&n.value);function a(){t.value=!0,n.value=!0,r.value=!1}function o(e){e.data&&(ln.test(e.data)?(n.value=!0,r.value=!0):dn()&&!r.value&&(n.value=!1))}function s(n){yt(()=>{t.value=!1,e?.(n)})}return{isComposing:t,shouldDeferInput:i,handleCompositionStart:a,handleCompositionUpdate:o,handleCompositionEnd:s}}function pn(e){let t=I(()=>z(e)),n=I(()=>new Intl.Collator(`en`,{usage:`search`,...t.value}));return{startsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(0,t.length),t)===0),endsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(-t.length),t)===0),contains:(e,t)=>{if(t.length===0)return!0;if(e=e.normalize(`NFC`),t=t.normalize(`NFC`),t.length>e.length)return!1;let r=n.value.compare;if(e.includes(t))return!0;let i=t.length;for(let n=0;n+i<=e.length;n++)if(r(t,e.slice(n,n+i))===0)return!0;return!1}}}function mn(e){return I(()=>!Ue(e)||!!w(e)?.closest(`form`))}function hn(){let e=Xe()?.vnode?.scopeId;return e?{[e]:``}:{}}function gn(e,t){let n=Se(!1,300);ke(()=>{n.value=!1});let r=q(null),i=je();function a(){r.value=null,n.value=!1}function o(e,t){if(!t)return;let i=e.currentTarget,a={x:e.clientX,y:e.clientY},o=vn(a,_n(a,i.getBoundingClientRect()),1),s=yn(t.getBoundingClientRect()),c=xn([...o,...s]);r.value=c,n.value=!0}return nt(n=>{if(e.value&&t.value){let r=e.value,i=t.value,a=e=>o(e,i),s=e=>o(e,r);r.addEventListener(`pointerleave`,a),i.addEventListener(`pointerleave`,s),n(()=>{r.removeEventListener(`pointerleave`,a),i.removeEventListener(`pointerleave`,s)})}}),nt(n=>{if(r.value){let o=n=>{if(!r.value||!(n.target instanceof Element))return;let o=n.target,s={x:n.clientX,y:n.clientY},c=e.value?.contains(o)||t.value?.contains(o),l=!bn(s,r.value),u=!!o.closest(`[data-grace-area-trigger]`);c?a():(l||u)&&(a(),i.trigger())},s=e.value?.ownerDocument;s?.addEventListener(`pointermove`,o),n(()=>s?.removeEventListener(`pointermove`,o))}}),{isPointerInTransit:n,onPointerExit:i.on}}function _n(e,t){lLine truncated
`);d=n.pop()||``;for(let e of n){let t=e.split(`
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(zc.value=n.session_id),n.type===`delta`&&(o+=n.text,Wc.value=Wc.value?{...Wc.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Wc.value=Wc.value?{...Wc.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Wc.value=Wc.value?{...Wc.value,ask:n.ask}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);Bc.value=[...Bc.value,{from:`assistant`,text:o,tool_calls:a}],Wc.value=null,Hc.value=`Ready`,await al()}catch(e){let t=e;t.name===`AbortError`&&!c?(Wc.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Hc.value=`Stopped`):(Wc.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Mc(r):void 0,isRetry:i},Hc.value=`Error. Retry available.`)}finally{clearTimeout(l),Ic=null,rl=null,Uc.value=!1}}function vl(){Hc.value=`Stopping…`,zc.value&&X.chatCancel(zc.value).catch(()=>{}),il()}function yl(){_t(()=>{al().catch(e=>{Hc.value=e.message||`Chat unavailable`})}),St(()=>{il()})}async function bl(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));await _l({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var xl=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],Sl=k({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return J(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(R(),W(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":z(Pc),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:N(r(!e.open))},[M(z(Ys),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:N(r(e.open))},[M(z(Sc),{size:22})],2)],8,xl))}}),Cl=k({__name:`Select`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},defaultValue:{},modelValue:{},nullableValue:{},by:{type:[String,Function]},dir:{},multiple:{type:Boolean},autocomplete:{},disabled:{type:Boolean},name:{},required:{type:Boolean}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:t}){let r=n(e,t);return(e,t)=>(R(),K(z(Ra),H({"data-slot":`select`},z(r)),{default:j(t=>[P(e.$slots,`default`,mt(Be(t)))]),_:3},16))}}),wl=k({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean},position:{default:`item-aligned`},bodyLock:{type:Boolean},loop:{type:Boolean},memoDependencies:{},side:{},sideOffset:{},sideFlip:{type:Boolean},align:{default:`center`},alignOffset:{},alignFlip:{type:Boolean},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},hideShiftedArrow:{type:Boolean},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean},prioritizePosition:{type:Boolean},reference:{},dir:{},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let r=e,i=t,a=Rt(r,`class`),o=n(a,i);return(t,n)=>(R(),K(z(ao),null,{default:j(()=>[M(z(Xa),H({"data-slot":`select-content`,"data-align-trigger":e.position===`item-aligned`},{...t.$attrs,...z(o)},{class:z(J)(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 cn-menu-translucent relative z-50 max-h-(--reka-select-content-available-height) origin-(--reka-select-content-transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none`,e.position===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,r.class)}),{default:j(()=>[M(z(kl)),M(z(fo),{"data-position":e.position,class:N(z(J)(`data-[position=popper]:h-(--reka-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--reka-select-trigger-width)`))},{default:j(()=>[P(t.$slots,`default`)]),_:3 Line truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:xd(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>xd(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=Cd(c),u=e+1<n.length?Cd(n[e+1]):null;if(l&&u&&wd(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=Cd(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>xd(e)),rows:r.map(e=>e.map(e=>xd(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:xd(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1])}else c.startsWith(`>`)?(o(),s(),t.push({kind:`blockquote`,inline:xd(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function Cd(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function wd(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Td={class:`[overflow-wrap:anywhere]`},Ed={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Dd={class:`font-mono text-[0.85em]`},Od={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},kd={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Ad={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},jd={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Md={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Nd={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Pd={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Fd={key:8,class:`mb-2.5 last:mb-0`},Id=k({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=I(()=>Sd(t.text));return(e,t)=>(R(),W(`div`,Td,[(R(!0),W(V,null,G(n.value,(e,t)=>(R(),W(V,{key:t},[e.kind===`pre`?(R(),W(`pre`,Ed,[U(`code`,Dd,B(e.code),1)])):e.kind===`table`?(R(),W(`table`,Od,[U(`thead`,null,[U(`tr`,null,[(R(!0),W(V,null,G(e.head,(e,t)=>(R(),W(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[M(yd,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(R(!0),W(V,null,G(e.rows,(e,t)=>(R(),W(`tr`,{key:t},[(R(!0),W(V,null,G(e,(e,t)=>(R(),W(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[M(yd,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(R(),W(`blockquote`,kd,[M(yd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(R(),W(`h1`,Ad,[M(yd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(R(),W(`h2`,jd,[M(yd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(R(),W(`h3`,Md,[M(yd,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(R(),W(`ul`,Nd,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(yd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(R(),W(`ol`,Pd,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(yd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(R(),W(`p`,Fd,[M(yd,{inline:e.inline},null,8,[`inline`])])):L(``,!0)],64))),128))]))}}),Ld={class:`truncate`},Rd=k({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=He(`RouterLink`);return R(),K(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:j(()=>[M(z(Ss),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,Ld,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),zd={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Bd={class:`font-semibold text-foreground`},Vd={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Hd=k({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=I(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=I(()=>t.tool.parameters||t.tool.Parameters||``),i=I(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=I(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(R(),K(Rd,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(R(),W(`div`,zd,[M(z(xc),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,Bd,B(n.value),1),r.value?(R(),W(`code`,Vd,B(r.value),1)):L(``,!0),U(`span`,{class:N(z(J)(`text-fg-muted`,i.value&&`text-danger`))},B(a.value),3)]))}}),Ud={key:0,class:`mb-2 grid gap-0.5 text-xs`},Wd={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Gd={key:3,class:`whitespace-pre-wrap`},Kd=k({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(R(),W(`div`,{class:N([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:N(z(J)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(R(),W(`div`,Ud,[(R(!0),W(V,null,G(e.tools,(t,n)=>(R(),K(Hd,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):L(``,!0),e.media.length?(R(),W(`div`,Wd,[(R(!0),W(V,null,G(e.media,(e,t)=>(R(),K(fd,{key:t,attachment:e},null,8,[`attachment`]))),128))])):L(``,!0),e.assistant?(R(),K(Id,{key:2,text:e.text},null,8,[`text`])):(R(),W(`div`,Gd,B(e.text),1)),P(t.$slots,`default`)],2)],2))}}),qd={class:`text-sm`},Jd={class:`font-medium`},Yd={key:0,class:`mt-1 text-fg-muted`},Xd={key:1,class:`mt-2 flex flex-wrap gap-2`},Zd=k({__name:`ChatChooLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>$g?`${n.slice(0,$g).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}function t_(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function n_(e){let t=Number(e);if(!Number.isFinite(t)||t<0)return``;if(t<1e3)return`under 1 s`;let n=t/1e3;if(n<60)return`${n.toFixed(+(n<10))} s`;let r=Math.round(n),i=Math.floor(r/60),a=r%60;if(i<60)return a===0?`${i} min`:`${i} min ${a} s`;let o=Math.floor(i/60),s=i-o*60;return s===0?`${o} h`:`${o} h ${s} min`}function r_(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function i_(e){return typeof e==`string`?e:``}function a_(e={}){let t=e.data||{},n=e.stage||`unknown stage`,r=e.workflow?`${e.workflow} workflow`:``;if(e.kind===`stage_start`)return{title:`Started stage: ${n}`,detail:r};if(e.kind===`stage_finish`){let e=n_(t.duration_ms),i=[r,e&&`ran for ${e}`].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[i,i_(t.error),i_(t.when)].filter(Boolean).join(` · `)}}if(e.kind===`task_retried`){let n=Number(t.retry_count);return{title:Number.isFinite(n)&&n>0?`Retry ${n}`:`Retry requested`,detail:[i_(t.previous_stage)&&`after ${i_(t.previous_stage)}`,i_(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=r_(t.iterations),i=r_(t.tokens),a=Number(t.cached_tokens)||0,o=r_((Number(t.prompt_tokens)||0)-a),s=r_(t.completion_tokens),c=r_(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,i_(t.model)].filter(Boolean);return{title:`Agent ${i_(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=i_(t.author);return{title:`Remediation ${i_(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${i_(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=i_(t.pr_number);return{title:`Pull request approved`,detail:[i_(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${i_(t.attempt)} of ${i_(t.of)} failed: ${e.stage||`step`}`,detail:i_(t.error),tone:`warn`};if(e.kind===`config_captured`)return{title:`Configuration captured`,detail:`The effective task-runtime configuration for this run.`};if(e.kind===`binding_started`){let e=i_(t.source),n=i_(t.capture_id),r=[{label:`binding ${i_(t.binding_name)||i_(t.binding_id)}`,to:`/events?tab=bindings`},...n?[{label:`captured event`,to:`/events?tab=inspector&capture=${encodeURIComponent(n)}`}]:[]];return t.unsigned===!0?{title:`Started by an unsigned event`,detail:e?`source ${e}`:``,tone:`warn`,links:r}:{title:`Started by an event`,detail:e?`source ${e}`:``,links:r}}if(e.kind===`changes_captured`){let e=t.totals??{},n=Number(e.files);return{title:`Change capture recorded`,detail:[Number.isFinite(n)&&n>0?`${n} file${n===1?``:`s`} changed`:``,t.captured_after?`captured after ${i_(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:t_(e.kind||e.type),detail:e.detail||``}}var o_=[`title`],s_=k({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=Ug(),a=I(()=>i.taskIDFor(n.event)),o=I(()=>e_(n.event));function s(){a.value>0&&r(`open`,a.value)}let c=I(()=>n.event.at?Sg(n.event.at):`—`);return(e,t)=>(R(),K(z(Xg),{class:N(a.value>0?`cursor-pointer`:``),role:a.value>0?`link`:void 0,tabindex:a.value>0?0:void 0,title:a.value>0?`Open task details`:void 0,onClick:s,onKeydown:[jt(Nt(s,[`prevent`]),[`enter`]),jt(Nt(s,[`prevent`]),[`space`])]},{default:j(()=>[M(z(Q),{class:`font-medium`},{default:j(()=>[A(B(z(a_)({...n.event,at:void 0,detail:void 0}).title),1)]),_:1}),M(z(Q),{class:`font-mono`},{default:j(()=>[A(B(a.value>0?`#${a.value}`:`—`),1)]),_:1}),M(z(Q),{class:`w-[55%] max-w-0`},{default:j(()=>[U(`span`,{class:`block truncate`,title:o.value.truncated?o.value.full:void 0},B(o.value.text),9,o_)]),_:1}),M(z(Q),null,{default:j(()=>[A(B(c.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),c_=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function l_(e){return(Number(e?.task_id)||0)>0}function u_(e,t){return t===`tasks`?l_(e):t!==`system`||!l_(e)}function d_(e,t){return e.filter(e=>u_(e,t))}function f_(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function p_(e,t){return`${e}:${t??0}`}function m_(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=p_(e_(n).text,r),a=t[t.length-1];a&&a.key===i?(a.count+=1,a.events.push(n)):t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var h_={key:0,class:`font-normal text-fg-subtle`},g_={role:`region`,"aria-label":`Activity`,"aria-live":`polite`},__={class:`max-h-[28rem] oveLine truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}var Fv=k({__name:`Collapsible`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},disabled:{type:Boolean},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{}},emits:[`update:open`],setup(e,{emit:t}){let r=n(e,t);return(e,t)=>(R(),K(z(l),H({"data-slot":`collapsible`},z(r)),{default:j(t=>[P(e.$slots,`default`,mt(Be(t)))]),_:3},16))}}),Iv=k({__name:`CollapsibleContent`,props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(R(),K(z(o),H({"data-slot":`collapsible-content`},t),{default:j(()=>[P(e.$slots,`default`)]),_:3},16))}}),Lv=k({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(R(),K(z(g),H({"data-slot":`collapsible-trigger`},t),{default:j(()=>[P(e.$slots,`default`)]),_:3},16))}});function Rv(e){return(e?.merged||0)+(e?.completed||0)}function zv(e){return Object.entries(e?.inputs??{}).map(([e,t])=>({name:e,type:t.type,required:t.required===!0})).sort((e,t)=>e.name.localeCompare(t.name))}function Bv(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function Vv(e,t){switch(t){case`number`:{let t=e.trim();return t!==``&&!Number.isNaN(Number(t))?Number(t):e}case`bool`:return e===`true`||e!==`false`&&e;case`string`:return e;default:try{return JSON.parse(e)}catch{return e}}}function Hv(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=Vv(e,r.type))}return n}var Uv=[`onKeydown`],Wv={key:0,class:`text-sm text-danger`,role:`alert`},Gv={key:1,class:`grid gap-1.5`},Kv=[`for`],qv={key:0,class:`font-normal text-fg-subtle`},Jv=[`id`],Yv=[`value`],Xv={key:0,class:`text-xs text-fg-subtle`},Zv={key:2,class:`grid gap-1.5`},Qv=[`id`],$v={class:`block truncate font-mono text-[13px] font-medium`},ey={class:`block text-xs text-fg-subtle`},ty={key:0,class:`text-xs text-fg-subtle`},ny={key:3,class:`grid gap-3`},ry=[`for`],iy={class:`font-mono`},ay={key:0,class:`text-fg-subtle`},oy={class:`text-xs text-fg-subtle`},sy={class:`grid gap-1.5`},cy=[`for`],ly={class:`grid gap-1.5`},uy=[`for`],dy={class:`font-mono`},fy={key:4,class:`text-sm text-danger`,role:`alert`},py={class:`flex items-center gap-2 border-t border-border pt-4`},my={class:`mr-auto text-xs text-fg-subtle`},hy=k({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=Ge(),a=q([]),o=q([]),s=q([]),c=q(``);_t(async()=>{try{let[e,t]=await Promise.all([X.workflows(),X.tasks()]);a.value=(e?.definitions??[]).filter(e=>e.enabled),o.value=e?.workflows??[],s.value=[...new Set((t??[]).filter(e=>e.owner&&e.repo).map(e=>`${e.owner}/${e.repo}`))].slice(0,5)}catch(e){c.value=String(e.message||e)}});let l=Nv();l.watchIdentities();let u=I(()=>l.identities.filter(e=>e.kind!==`system`&&e.lifecycle===`active`)),d=q(``),f=q(n.workflow??n.initialWorkflow??``),p=q(n.initialInstructions??``),m=q(Pv(p.value)),h=q(``),g=q({});nt(()=>{!f.value&&a.value[0]&&(f.value=a.value[0].id),!h.value&&u.value[0]&&(h.value=u.value[0].id)});let _=I(()=>a.value.find(e=>e.id===f.value)),v=I(()=>zv(_.value)),y=I(()=>Bv(v.value,g.value)),b=I(()=>_.value?.repository??`required`),x=I(()=>b.value!==`optional`&&b.value!==`none`),S=e=>o.value.find(t=>t.workflow===e),C=I(()=>u.value.find(e=>e.id===h.value)?.display_name??`nobody`),w=q(!1),T=q(``),ee=I(()=>!!((d.value.trim()||!x.value)&&f.value&&m.value.trim()&&p.value.trim()&&h.value)&&y.value.length===0);async function E(){if(ee.value&&!w.value){w.value=!0,T.value=``;try{let e=await X.workRequest({identity:h.value,repository:b.value===`none`?``:d.value.trim(),workflow:f.value,title:m.value.trim(),instructions:p.value,inputs:Hv(v.value,g.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){T.value=String(e.message||e)}finally{w.value=!1}}}return(e,t)=>(R(),W(`form`,{class:`grid gap-5`,onSubmit:Nt(E,[`prevent`]),onKeydown:[jt(Nt(E,[`meta`,`prevent`]),[`enter`]),jt(Nt(E,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(R(),W(`p`,Wv,B(c.value),1)):L(``,!0),b.value===`none`?L(``,!0):(R(),W(`div`,Gv,[U(`label`,{for:`${z(i)}-repo`,class:`text-[13px] font-medium`},[t[6]||=A(`Repository`,-1),x.value?L(``,!0):(R(),W(`span`,qv,` (optional)`))],8,Kv),M(z(Z),{id:`${z(i)}-repo`,modelValue:d.value,"onUpdate:modelValue":t[0]||=e=>d.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${z(i)}-repos`,required:x.value},null,8,[`id`,`modelValue`,`list`,`required`]),U(`datalist`,{id:`${z(i)}-repos`},[(R(!0),W(V,null,G(s.value,e=>(R(),W(`option`,{key:e,value:e},null,8,Yv))),128))],8,Jv),s.value.length?(R(),W(`p`,Xv,[t[7]||=A(`Recent: `,-1),(R(!0),W(V,null,G(s.value,e=>(R(),K(z(Y),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>d.value=e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]))),128))])):L(``,!0)])),n.workflow?L(``,!0):(R(),W(`div`,Zv,[U(`span`,{id:`${z(i)}-wf`,class:`text-[13px] font-medium`},`Workflow`,8,Qv),M(z( Line truncated
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function Ny(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 Py(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 Fy(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 Iy(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 Ly=q([]),Ry=q([]),zy=q(!0),By=q(null),Vy=q(null),Hy=q(!1),Uy=q(null);async function Wy(){try{let e=await X.eventTypes(jy().workspace);zy.value=e.enabled!==!1,Ly.value=e.event_types||[],Ry.value=e.proposals||[],By.value=null}catch(e){By.value=e.message||String(e)}}function Gy(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function Ky(e){Uy.value=null,Vy.value=e}function qy(e){let t=tb.value.find(t=>String(t.id)===e.sample_id);Ky({mode:`proposal`,id:null,source:e.source,name:``,rule:Gy(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Jy(e=``){Ky({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function Yy(e){Ky({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:Gy(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Xy(){Vy.value=null}async function Zy(){let e=Vy.value;if(e){Hy.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:Iy(e.rule)});else{let t=e.mode===`paste`?My(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:Iy(e.rule),example:{headers:t,body:e.body}})}Vy.value=null,await Wy()}catch(e){Uy.value=e.message||String(e)}finally{Hy.value=!1}}}var Qy=q(null);async function $y(){let e=Qy.value;if(Qy.value=null,e)try{await X.eventTypeDelete(e.id),await Wy()}catch(e){By.value=e.message||String(e)}}var eb=100,tb=q([]),nb=q(!0),rb=q(null),ib=q(!0),ab=q(null);async function ob(){try{let e=await X.captures(eb);nb.value=e.enabled!==!1,tb.value=e.captures||[],rb.value=null}catch(e){rb.value=e.message||String(e)}finally{ib.value=!1}}function sb(e){let t=tb.value.find(t=>t.id===e);return t&&(ab.value=t),!!t}function cb(){tb.value.length&&(ab.value=tb.value[0])}function lb(){Pe(`captures`,()=>{ob(),Wy()})}var ub=k({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=Rt(r,`class`),o=n(a,i);return(e,t)=>(R(),K(z(yo),H({"data-slot":`tabs`,"data-orientation":z(o).orientation||`horizontal`},z(o),{class:z(J)(`gap-2 group/tabs flex data-horizontal:flex-col`,r.class)}),{default:j(t=>[P(e.$slots,`default`,mt(Be(t)))]),_:3},16,[`data-orientation`,`class`]))}}),db=k({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Rt(t,`class`);return(e,r)=>(R(),K(z(So),H({"data-slot":`tabs-content`,class:z(J)(`text-sm flex-1 outline-none`,t.class)},z(n)),{default:j(()=>[P(e.$slots,`default`)]),_:3},16,[`class`]))}}),fb=k({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=Rt(t,`class`,`variant`);return(r,i)=>(R(),K(z(Co),H({"data-slot":`tabs-list`,"data-variant":e.variant},z(n),{class:z(J)(z(mb)({variant:e.variant}),t.class)}),{default:j(()=>[P(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),pb=k({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Rt(t,`class`),r=S(n);return(e,n)=>(R(),K(z(wo),H({"data-slot":`tabs-trigger`,class:z(J)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-Line truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(zc.value=n.session_id),n.type===`delta`&&(o+=n.text,Wc.value=Wc.value?{...Wc.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Wc.value=Wc.value?{...Wc.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Wc.value=Wc.value?{...Wc.value,ask:n.ask}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);Bc.value=[...Bc.value,{from:`assistant`,text:o,tool_calls:a}],Wc.value=null,Hc.value=`Ready`,await il()}catch(e){let t=e;t.name===`AbortError`&&!c?(Wc.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Hc.value=`Stopped`):(Wc.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Mc(r):void 0,isRetry:i},Hc.value=`Error. Retry available.`)}finally{clearTimeout(l),Ic=null,nl=null,Uc.value=!1}}function gl(){Hc.value=`Stopping…`,zc.value&&X.chatCancel(zc.value).catch(()=>{}),rl()}function _l(){_t(()=>{il().catch(e=>{Hc.value=e.message||`Chat unavailable`})}),St(()=>{rl()})}async function vl(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));await hl({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var yl=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],bl=k({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return J(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(R(),W(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":z(Pc),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:N(r(!e.open))},[M(z(Ys),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:N(r(e.open))},[M(z(Sc),{size:22})],2)],8,yl))}}),xl=k({__name:`Select`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},defaultValue:{},modelValue:{},nullableValue:{},by:{type:[String,Function]},dir:{},multiple:{type:Boolean},autocomplete:{},disabled:{type:Boolean},name:{},required:{type:Boolean}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:t}){let r=n(e,t);return(e,t)=>(R(),K(z(Ra),H({"data-slot":`select`},z(r)),{default:j(t=>[P(e.$slots,`default`,mt(Be(t)))]),_:3},16))}}),Sl=k({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean},position:{default:`item-aligned`},bodyLock:{type:Boolean},loop:{type:Boolean},memoDependencies:{},side:{},sideOffset:{},sideFlip:{type:Boolean},align:{default:`center`},alignOffset:{},alignFlip:{type:Boolean},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},hideShiftedArrow:{type:Boolean},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean},prioritizePosition:{type:Boolean},reference:{},dir:{},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let r=e,i=t,a=Rt(r,`class`),o=n(a,i);return(t,n)=>(R(),K(z(ao),null,{default:j(()=>[M(z(Xa),H({"data-slot":`select-content`,"data-align-trigger":e.position===`item-aligned`},{...t.$attrs,...z(o)},{class:z(J)(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 cn-menu-translucent relative z-50 max-h-(--reka-select-content-available-height) origin-(--reka-select-content-transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none`,e.position===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,r.class)}),{default:j(()=>[M(z(Dl)),M(z(fo),{"data-position":e.position,class:N(z(J)(`data-[position=popper]:h-(--reka-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--reka-select-trigger-width)`))},{default:j(()=>[P(t.$slots,`default`)]),_:3 Line truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:yd(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>yd(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=xd(c),u=e+1<n.length?xd(n[e+1]):null;if(l&&u&&Sd(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=xd(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>yd(e)),rows:r.map(e=>e.map(e=>yd(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:yd(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1])}else c.startsWith(`>`)?(o(),s(),t.push({kind:`blockquote`,inline:yd(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function xd(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function Sd(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Cd={class:`[overflow-wrap:anywhere]`},wd={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Td={class:`font-mono text-[0.85em]`},Ed={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Dd={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Od={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},kd={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Ad={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},jd={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Md={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Nd={key:8,class:`mb-2.5 last:mb-0`},Pd=k({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=I(()=>bd(t.text));return(e,t)=>(R(),W(`div`,Cd,[(R(!0),W(V,null,G(n.value,(e,t)=>(R(),W(V,{key:t},[e.kind===`pre`?(R(),W(`pre`,wd,[U(`code`,Td,B(e.code),1)])):e.kind===`table`?(R(),W(`table`,Ed,[U(`thead`,null,[U(`tr`,null,[(R(!0),W(V,null,G(e.head,(e,t)=>(R(),W(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[M(_d,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(R(!0),W(V,null,G(e.rows,(e,t)=>(R(),W(`tr`,{key:t},[(R(!0),W(V,null,G(e,(e,t)=>(R(),W(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[M(_d,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(R(),W(`blockquote`,Dd,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(R(),W(`h1`,Od,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(R(),W(`h2`,kd,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(R(),W(`h3`,Ad,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(R(),W(`ul`,jd,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(_d,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(R(),W(`ol`,Md,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(_d,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(R(),W(`p`,Nd,[M(_d,{inline:e.inline},null,8,[`inline`])])):L(``,!0)],64))),128))]))}}),Fd={class:`truncate`},Id=k({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=He(`RouterLink`);return R(),K(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:j(()=>[M(z(Ss),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,Fd,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Ld={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Rd={class:`font-semibold text-foreground`},zd={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Bd=k({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=I(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=I(()=>t.tool.parameters||t.tool.Parameters||``),i=I(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=I(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(R(),K(Id,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(R(),W(`div`,Ld,[M(z(xc),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,Rd,B(n.value),1),r.value?(R(),W(`code`,zd,B(r.value),1)):L(``,!0),U(`span`,{class:N(z(J)(`text-fg-muted`,i.value&&`text-danger`))},B(a.value),3)]))}}),Vd={key:0,class:`mb-2 grid gap-0.5 text-xs`},Hd={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Ud={key:3,class:`whitespace-pre-wrap`},Wd=k({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(R(),W(`div`,{class:N([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:N(z(J)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(R(),W(`div`,Vd,[(R(!0),W(V,null,G(e.tools,(t,n)=>(R(),K(Bd,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):L(``,!0),e.media.length?(R(),W(`div`,Hd,[(R(!0),W(V,null,G(e.media,(e,t)=>(R(),K(ud,{key:t,attachment:e},null,8,[`attachment`]))),128))])):L(``,!0),e.assistant?(R(),K(Pd,{key:2,text:e.text},null,8,[`text`])):(R(),W(`div`,Ud,B(e.text),1)),P(t.$slots,`default`)],2)],2))}}),Gd={class:`text-sm`},Kd={key:0,class:`mt-1 text-fg-muted`},qd={key:1,class:`mt-2 flex flex-wrap gap-2`},Jd=k({__name:`ChatChooseCard`,props:{choose:{}} Line truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>Xg?`${n.slice(0,Xg).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}function Qg(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function $g(e){let t=Number(e);if(!Number.isFinite(t)||t<0)return``;if(t<1e3)return`under 1 s`;let n=t/1e3;if(n<60)return`${n.toFixed(+(n<10))} s`;let r=Math.round(n),i=Math.floor(r/60),a=r%60;if(i<60)return a===0?`${i} min`:`${i} min ${a} s`;let o=Math.floor(i/60),s=i-o*60;return s===0?`${o} h`:`${o} h ${s} min`}function e_(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function t_(e){return typeof e==`string`?e:``}function n_(e={}){let t=e.data||{},n=e.stage||`unknown stage`,r=e.workflow?`${e.workflow} workflow`:``;if(e.kind===`stage_start`)return{title:`Started stage: ${n}`,detail:r};if(e.kind===`stage_finish`){let e=$g(t.duration_ms),i=[r,e&&`ran for ${e}`].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[i,t_(t.error),t_(t.when)].filter(Boolean).join(` · `)}}if(e.kind===`task_retried`){let n=Number(t.retry_count);return{title:Number.isFinite(n)&&n>0?`Retry ${n}`:`Retry requested`,detail:[t_(t.previous_stage)&&`after ${t_(t.previous_stage)}`,t_(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=e_(t.iterations),i=e_(t.tokens),a=Number(t.cached_tokens)||0,o=e_((Number(t.prompt_tokens)||0)-a),s=e_(t.completion_tokens),c=e_(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,t_(t.model)].filter(Boolean);return{title:`Agent ${t_(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=t_(t.author);return{title:`Remediation ${t_(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${t_(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=t_(t.pr_number);return{title:`Pull request approved`,detail:[t_(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${t_(t.attempt)} of ${t_(t.of)} failed: ${e.stage||`step`}`,detail:t_(t.error),tone:`warn`};if(e.kind===`config_captured`)return{title:`Configuration captured`,detail:`The effective task-runtime configuration for this run.`};if(e.kind===`binding_started`){let e=t_(t.source),n=t_(t.capture_id),r=[{label:`binding ${t_(t.binding_name)||t_(t.binding_id)}`,to:`/events?tab=bindings`},...n?[{label:`captured event`,to:`/events?tab=inspector&capture=${encodeURIComponent(n)}`}]:[]];return t.unsigned===!0?{title:`Started by an unsigned event`,detail:e?`source ${e}`:``,tone:`warn`,links:r}:{title:`Started by an event`,detail:e?`source ${e}`:``,links:r}}if(e.kind===`changes_captured`){let e=t.totals??{},n=Number(e.files);return{title:`Change capture recorded`,detail:[Number.isFinite(n)&&n>0?`${n} file${n===1?``:`s`} changed`:``,t.captured_after?`captured after ${t_(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:Qg(e.kind||e.type),detail:e.detail||``}}var r_=[`title`],i_=k({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=Bg(),a=I(()=>i.taskIDFor(n.event)),o=I(()=>Zg(n.event));function s(){a.value>0&&r(`open`,a.value)}let c=I(()=>n.event.at?yg(n.event.at):`—`);return(e,t)=>(R(),K(z(qg),{class:N(a.value>0?`cursor-pointer`:``),role:a.value>0?`link`:void 0,tabindex:a.value>0?0:void 0,title:a.value>0?`Open task details`:void 0,onClick:s,onKeydown:[jt(Nt(s,[`prevent`]),[`enter`]),jt(Nt(s,[`prevent`]),[`space`])]},{default:j(()=>[M(z(Q),{class:`font-medium`},{default:j(()=>[A(B(z(n_)({...n.event,at:void 0,detail:void 0}).title),1)]),_:1}),M(z(Q),{class:`font-mono`},{default:j(()=>[A(B(a.value>0?`#${a.value}`:`—`),1)]),_:1}),M(z(Q),{class:`w-[55%] max-w-0`},{default:j(()=>[U(`span`,{class:`block truncate`,title:o.value.truncated?o.value.full:void 0},B(o.value.text),9,r_)]),_:1}),M(z(Q),null,{default:j(()=>[A(B(c.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),a_=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function o_(e){return(Number(e?.task_id)||0)>0}function s_(e,t){return t===`tasks`?o_(e):t!==`system`||!o_(e)}function c_(e,t){return e.filter(e=>s_(e,t))}function l_(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function u_(e,t){return`${e}:${t??0}`}function d_(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=u_(Zg(n).text,r),a=t[t.length-1];a&&a.key===i?(a.count+=1,a.events.push(n)):t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var f_={key:0,class:`font-normal text-fg-subtle`},p_={role:`region`,"aria-label":`Activity`,"aria-live":`polite`},m_={class:`max-h-[28rem] oveLine truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}var Mv=k({__name:`Collapsible`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},disabled:{type:Boolean},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{}},emits:[`update:open`],setup(e,{emit:t}){let r=n(e,t);return(e,t)=>(R(),K(z(l),H({"data-slot":`collapsible`},z(r)),{default:j(t=>[P(e.$slots,`default`,mt(Be(t)))]),_:3},16))}}),Nv=k({__name:`CollapsibleContent`,props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(R(),K(z(o),H({"data-slot":`collapsible-content`},t),{default:j(()=>[P(e.$slots,`default`)]),_:3},16))}}),Pv=k({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(R(),K(z(g),H({"data-slot":`collapsible-trigger`},t),{default:j(()=>[P(e.$slots,`default`)]),_:3},16))}});function Fv(e){return(e?.merged||0)+(e?.completed||0)}function Iv(e){return Object.entries(e?.inputs??{}).map(([e,t])=>({name:e,type:t.type,required:t.required===!0})).sort((e,t)=>e.name.localeCompare(t.name))}function Lv(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function Rv(e,t){switch(t){case`number`:{let t=e.trim();return t!==``&&!Number.isNaN(Number(t))?Number(t):e}case`bool`:return e===`true`||e!==`false`&&e;case`string`:return e;default:try{return JSON.parse(e)}catch{return e}}}function zv(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=Rv(e,r.type))}return n}var Bv=[`onKeydown`],Vv={key:0,class:`text-sm text-danger`,role:`alert`},Hv={key:1,class:`grid gap-1.5`},Uv=[`for`],Wv={key:0,class:`font-normal text-fg-subtle`},Gv=[`id`],Kv=[`value`],qv={key:0,class:`text-xs text-fg-subtle`},Jv={key:2,class:`grid gap-1.5`},Yv=[`id`],Xv={class:`block truncate font-mono text-[13px] font-medium`},Zv={class:`block text-xs text-fg-subtle`},Qv={key:0,class:`text-xs text-fg-subtle`},$v={key:3,class:`grid gap-3`},ey=[`for`],ty={class:`font-mono`},ny={key:0,class:`text-fg-subtle`},ry={class:`text-xs text-fg-subtle`},iy={class:`grid gap-1.5`},ay=[`for`],oy={class:`grid gap-1.5`},sy=[`for`],cy={class:`font-mono`},ly={key:4,class:`text-sm text-danger`,role:`alert`},uy={class:`flex items-center gap-2 border-t border-border pt-4`},dy={class:`mr-auto text-xs text-fg-subtle`},fy=k({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=Ge(),a=q([]),o=q([]),s=q([]),c=q(``);_t(async()=>{try{let[e,t]=await Promise.all([X.workflows(),X.tasks()]);a.value=(e?.definitions??[]).filter(e=>e.enabled),o.value=e?.workflows??[],s.value=[...new Set((t??[]).filter(e=>e.owner&&e.repo).map(e=>`${e.owner}/${e.repo}`))].slice(0,5)}catch(e){c.value=String(e.message||e)}});let l=Av();l.watchIdentities();let u=I(()=>l.identities.filter(e=>e.kind!==`system`&&e.lifecycle===`active`)),d=q(``),f=q(n.workflow??n.initialWorkflow??``),p=q(n.initialInstructions??``),m=q(jv(p.value)),h=q(``),g=q({});nt(()=>{!f.value&&a.value[0]&&(f.value=a.value[0].id),!h.value&&u.value[0]&&(h.value=u.value[0].id)});let _=I(()=>a.value.find(e=>e.id===f.value)),v=I(()=>Iv(_.value)),y=I(()=>Lv(v.value,g.value)),b=I(()=>_.value?.repository??`required`),x=I(()=>b.value!==`optional`&&b.value!==`none`),S=e=>o.value.find(t=>t.workflow===e),C=I(()=>u.value.find(e=>e.id===h.value)?.display_name??`nobody`),w=q(!1),T=q(``),ee=I(()=>!!((d.value.trim()||!x.value)&&f.value&&m.value.trim()&&p.value.trim()&&h.value)&&y.value.length===0);async function E(){if(ee.value&&!w.value){w.value=!0,T.value=``;try{let e=await X.workRequest({identity:h.value,repository:b.value===`none`?``:d.value.trim(),workflow:f.value,title:m.value.trim(),instructions:p.value,inputs:zv(v.value,g.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){T.value=String(e.message||e)}finally{w.value=!1}}}return(e,t)=>(R(),W(`form`,{class:`grid gap-5`,onSubmit:Nt(E,[`prevent`]),onKeydown:[jt(Nt(E,[`meta`,`prevent`]),[`enter`]),jt(Nt(E,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(R(),W(`p`,Vv,B(c.value),1)):L(``,!0),b.value===`none`?L(``,!0):(R(),W(`div`,Hv,[U(`label`,{for:`${z(i)}-repo`,class:`text-[13px] font-medium`},[t[6]||=A(`Repository`,-1),x.value?L(``,!0):(R(),W(`span`,Wv,` (optional)`))],8,Uv),M(z(Z),{id:`${z(i)}-repo`,modelValue:d.value,"onUpdate:modelValue":t[0]||=e=>d.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${z(i)}-repos`,required:x.value},null,8,[`id`,`modelValue`,`list`,`required`]),U(`datalist`,{id:`${z(i)}-repos`},[(R(!0),W(V,null,G(s.value,e=>(R(),W(`option`,{key:e,value:e},null,8,Kv))),128))],8,Gv),s.value.length?(R(),W(`p`,qv,[t[7]||=A(`Recent: `,-1),(R(!0),W(V,null,G(s.value,e=>(R(),K(z(Y),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>d.value=e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]))),128))])):L(``,!0)])),n.workflow?L(``,!0):(R(),W(`div`,Jv,[U(`span`,{id:`${z(i)}-wf`,class:`text-[13px] font-medium`},`Workflow`,8,Yv),M(z( Line truncated
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function Ay(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 jy(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 My(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 Ny(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 Py=q([]),Fy=q([]),Iy=q(!0),Ly=q(null),Ry=q(null),zy=q(!1),By=q(null);async function Vy(){try{let e=await X.eventTypes(Oy().workspace);Iy.value=e.enabled!==!1,Py.value=e.event_types||[],Fy.value=e.proposals||[],Ly.value=null}catch(e){Ly.value=e.message||String(e)}}function Hy(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function Uy(e){By.value=null,Ry.value=e}function Wy(e){let t=Qy.value.find(t=>String(t.id)===e.sample_id);Uy({mode:`proposal`,id:null,source:e.source,name:``,rule:Hy(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Gy(e=``){Uy({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function Ky(e){Uy({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:Hy(e.rule),headersText:``,body:``,exampleHeaders:{}})}function qy(){Ry.value=null}async function Jy(){let e=Ry.value;if(e){zy.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:Ny(e.rule)});else{let t=e.mode===`paste`?ky(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:Ny(e.rule),example:{headers:t,body:e.body}})}Ry.value=null,await Vy()}catch(e){By.value=e.message||String(e)}finally{zy.value=!1}}}var Yy=q(null);async function Xy(){let e=Yy.value;if(Yy.value=null,e)try{await X.eventTypeDelete(e.id),await Vy()}catch(e){Ly.value=e.message||String(e)}}var Zy=100,Qy=q([]),$y=q(!0),eb=q(null),tb=q(!0),nb=q(null);async function rb(){try{let e=await X.captures(Zy);$y.value=e.enabled!==!1,Qy.value=e.captures||[],eb.value=null}catch(e){eb.value=e.message||String(e)}finally{tb.value=!1}}function ib(e){let t=Qy.value.find(t=>t.id===e);return t&&(nb.value=t),!!t}function ab(){Qy.value.length&&(nb.value=Qy.value[0])}function ob(){Pe(`captures`,()=>{rb(),Vy()})}var sb=k({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=Rt(r,`class`),o=n(a,i);return(e,t)=>(R(),K(z(yo),H({"data-slot":`tabs`,"data-orientation":z(o).orientation||`horizontal`},z(o),{class:z(J)(`gap-2 group/tabs flex data-horizontal:flex-col`,r.class)}),{default:j(t=>[P(e.$slots,`default`,mt(Be(t)))]),_:3},16,[`data-orientation`,`class`]))}}),cb=k({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Rt(t,`class`);return(e,r)=>(R(),K(z(So),H({"data-slot":`tabs-content`,class:z(J)(`text-sm flex-1 outline-none`,t.class)},z(n)),{default:j(()=>[P(e.$slots,`default`)]),_:3},16,[`class`]))}}),lb=k({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=Rt(t,`class`,`variant`);return(r,i)=>(R(),K(z(Co),H({"data-slot":`tabs-list`,"data-variant":e.variant},z(n),{class:z(J)(z(db)({variant:e.variant}),t.class)}),{default:j(()=>[P(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),ub=k({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Rt(t,`class`),r=S(n);return(e,n)=>(R(),K(z(wo),H({"data-slot":`tabs-trigger`,class:z(J)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-Line truncated
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var HM=OM(`CharSizeService`),UM=OM(`CoreBrowserService`),WM=OM(`MouseService`),GM=OM(`RenderService`),KM=OM(`SelectionService`),qM=OM(`CharacterJoinerService`),JM=OM(`ThemeService`),YM=OM(`LinkProviderService`),XM=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?nN.isErrorNoTelemetry(e)?new nN(e.message+`
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var bM=oM(`CharSizeService`),xM=oM(`CoreBrowserService`),SM=oM(`MouseService`),CM=oM(`RenderService`),wM=oM(`SelectionService`),TM=oM(`CharacterJoinerService`),EM=oM(`ThemeService`),DM=oM(`LinkProviderService`),OM=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?PM.isErrorNoTelemetry(e)?new PM(e.message+`
`+e.stack):Error(e.message+`
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function ZM(e){$M(e)||XM.onUnexpectedError(e)}var QM=`Canceled`;function $M(e){return e instanceof eN||e instanceof Error&&e.name===QM&&e.message===QM}var eN=class extends Error{constructor(){super(QM),this.name=this.message}};function tN(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var nN=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},rN=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function iN(e,t=0){return e[e.length-(1+t)]}var aN;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(aN||={});var oN=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||aN.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};oN.empty=new oN(e=>{});function sN(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var cN;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(cN||={});var lN=null;function uN(e){return lN?.trackDisposable(e),e}function dN(e){lN?.markAsDisposed(e)}function fN(e,t){lN?.setParent(e,t)}function pN(e){return lN?.markAsSingleton(e),e}function mN(e){if(cN.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function hN(...e){return gN(()=>mN(e))}function gN(e){let t=uN({dispose:sN(()=>{dN(t),e()})});return t}var _N=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,uN(this)}dispose(){this._isDisposed||(dN(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{mN(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return fN(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),fN(e,null))}};_N.DISABLE_DISPOSED_WARNING=!1;var vN=_N,yN=class{constructor(){this._store=new vN,uN(this),fN(this._store,this)}dispose(){dN(thi Line truncated
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function kM(e){jM(e)||OM.onUnexpectedError(e)}var AM=`Canceled`;function jM(e){return e instanceof MM||e instanceof Error&&e.name===AM&&e.message===AM}var MM=class extends Error{constructor(){super(AM),this.name=this.message}};function NM(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var PM=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},FM=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function IM(e,t=0){return e[e.length-(1+t)]}var LM;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(LM||={});var RM=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||LM.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};RM.empty=new RM(e=>{});function zM(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var BM;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(BM||={});var VM=null;function HM(e){return VM?.trackDisposable(e),e}function UM(e){VM?.markAsDisposed(e)}function WM(e,t){VM?.setParent(e,t)}function GM(e){return VM?.markAsSingleton(e),e}function KM(e){if(BM.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function qM(...e){return JM(()=>KM(e))}function JM(e){let t=HM({dispose:zM(()=>{UM(t),e()})});return t}var YM=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,HM(this)}dispose(){this._isDisposed||(UM(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{KM(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return WM(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),WM(e,null))}};YM.DISABLE_DISPOSED_WARNING=!1;var XM=YM,ZM=class{constructor(){this._store=new XM,HM(this),WM(this._store,this)}dispose(){UM(thi Line truncated
`).slice(2).join(`
`))}},PN=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},FN=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},IN=0,LN=class{constructor(e){this.value=e,this.id=IN++}},RN=2,zN=class{constructor(e){this._size=0,this._options=e,this._leakageMon=AN>0||this._options?.leakWarningThreshold?new MN(e?.onListenerError??ZM,this._options?.leakWarningThreshold??AN):void 0,this._perfMon=this._options?._profName?new kN(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new FN(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||ZM)(n),yN.None}if(this._disposed)return yN.None;t&&(e=e.bind(t));let r=new LN(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=NN.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof LN?(this._deliveryQueue??=new BN,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=gN(()=>{i?.(),this._removeListener(r)});return n instanceof vN?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*RN<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||ZM;if(!n)e.value(t);else try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof LN)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},BN=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},VN=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new zN,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new zN,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};VN.INSTANCE=new VN;var HN=VN;function UN(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}HN.INSTANCE.onDidChangeZoomLevel;function WN(e){return HN.INSTANCE.getZoomFactor(e)}HN.INSTANCE.onDidChangeFullscreen;var GN=typeof navigator==`object`?navigator.userAgent:``,KN=GN.indexOf(`Firefox`)>=0,qN=GN.indexOf(`AppleWebKit`)>=0,JN=GN.indexOf(`Chrome`)>=0,YN=!JN&&GN.indexOf(`Safari`)>=0;GN.indexOf(`Electron/`),GN.indexOf(`Android`);var XN=!1;if(typeof xN.matchMedia==`function`){let e=xN.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=xN.matchMedia(`(display-mode: fullscreen)`);XN=e.matches,UN(xN,e,({matches:e})=>{XN&&t.matches||(XN=e)} Line truncated
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};KF=nM([rM(2,AM),rM(3,UM),rM(4,jM),rM(5,JM),rM(6,IM),rM(7,GM)],KF);var qF=class extends yN{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(gN(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderLine truncated
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var $F;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))($F||={});var eI;(e=>e.ST=`${$.ESC}\\`)(eI||={});var tI=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};tI=nM([rM(2,AM),rM(3,IM),rM(4,MM),rM(5,GM)],tI);var nI=0,rI=0,iI=0,aI=0,oI={css:`#00000000`,rgba:0},sI;(e=>{function t(e,t,n,r){return r===void 0?`#${fI(e)}${fI(t)}${fI(n)}`:`#${fI(e)}${fI(t)}${fI(n)}${fI(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(sI||={});var cI;(e=>{function t(e,t){if(aI=(t.rgba&255)/255,aI===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return nI=a+Math.round((n-a)*aI),rI=o+Math.round((r-o)*aI),iI=s+Math.round((i-s)*aI),{css:sI.toCss(nI,rI,iI),rgba:sI.toRgba(nI,rI,iI)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=dI.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return sI.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[nI,rI,iI]=dI.toChannels(t),{css:sI.toCss(nI,rI,iI),rgba:t}}e.opaque=i;function a(e,t){return aI=Math.round(t*255),[nI,rI,iI]=dI.toChannels(e.rgba),{css:sI.toCss(nI,rI,iI,aI),rgba:sI.toRgba(nI,rI,iI,aI)}}e.opacity=a;function o(e,t){return aI=e.rgba&255,a(e,aI*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.r Line truncated
`))}},fN=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},pN=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},mN=0,hN=class{constructor(e){this.value=e,this.id=mN++}},gN=2,_N=class{constructor(e){this._size=0,this._options=e,this._leakageMon=cN>0||this._options?.leakWarningThreshold?new uN(e?.onListenerError??kM,this._options?.leakWarningThreshold??cN):void 0,this._perfMon=this._options?._profName?new sN(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new pN(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||kM)(n),ZM.None}if(this._disposed)return ZM.None;t&&(e=e.bind(t));let r=new hN(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=dN.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof hN?(this._deliveryQueue??=new vN,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=JM(()=>{i?.(),this._removeListener(r)});return n instanceof XM?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*gN<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||kM;if(!n)e.value(t);else try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof hN)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},vN=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},yN=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new _N,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new _N,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};yN.INSTANCE=new yN;var bN=yN;function xN(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}bN.INSTANCE.onDidChangeZoomLevel;function SN(e){return bN.INSTANCE.getZoomFactor(e)}bN.INSTANCE.onDidChangeFullscreen;var CN=typeof navigator==`object`?navigator.userAgent:``,wN=CN.indexOf(`Firefox`)>=0,TN=CN.indexOf(`AppleWebKit`)>=0,EN=CN.indexOf(`Chrome`)>=0,DN=!EN&&CN.indexOf(`Safari`)>=0;CN.indexOf(`Electron/`),CN.indexOf(`Android`);var ON=!1;if(typeof $M.matchMedia==`function`){let e=$M.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=$M.matchMedia(`(display-mode: fullscreen)`);ON=e.matches,xN($M,e,({matches:e})=>{ON&&t.matches||(ON=e)} Line truncated
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};wF=Pj([Fj(2,cM),Fj(3,xM),Fj(4,lM),Fj(5,EM),Fj(6,mM),Fj(7,CM)],wF);var TF=class extends ZM{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(JM(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderLine truncated
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var jF;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(jF||={});var MF;(e=>e.ST=`${$.ESC}\\`)(MF||={});var NF=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};NF=Pj([Fj(2,cM),Fj(3,mM),Fj(4,uM),Fj(5,CM)],NF);var PF=0,FF=0,IF=0,LF=0,RF={css:`#00000000`,rgba:0},zF;(e=>{function t(e,t,n,r){return r===void 0?`#${WF(e)}${WF(t)}${WF(n)}`:`#${WF(e)}${WF(t)}${WF(n)}${WF(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(zF||={});var BF;(e=>{function t(e,t){if(LF=(t.rgba&255)/255,LF===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return PF=a+Math.round((n-a)*LF),FF=o+Math.round((r-o)*LF),IF=s+Math.round((i-s)*LF),{css:zF.toCss(PF,FF,IF),rgba:zF.toRgba(PF,FF,IF)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=UF.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return zF.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[PF,FF,IF]=UF.toChannels(t),{css:zF.toCss(PF,FF,IF),rgba:t}}e.opaque=i;function a(e,t){return LF=Math.round(t*255),[PF,FF,IF]=UF.toChannels(e.rgba),{css:zF.toCss(PF,FF,IF,LF),rgba:zF.toRgba(PF,FF,IF,LF)}}e.opacity=a;function o(e,t){return LF=e.rgba&255,a(e,LF*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.r Line truncated
`:`
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),rL&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=EL(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=VI(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-DL),DL),t/=DL,t/Math.abs(t)+Math.round(t*(OL-1)))}shouldForceSelection(e){return $I?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),kL)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!($I&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._active Line truncated
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(nF(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(gN(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<kz+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===kz+1&&(this._liveRegion.textContent+=sM.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let Line truncated
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return aM.get()},set promptLabel(e){aM.set(e)},get tooMuchOutput(){return sM.get()},set tooMuchOutput(e){sM.set(e)}}}_verifyIntegers(...e){for(Hz of e)if(Hz===1/0||isNaN(Hz)||Hz%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Hz of e)if(Hz&&(Hz===1/0||isNaN(Hz)||Hz%1!=0||Hz<0))throw Error(`This API only accepts positive integers`)}},Wz=2,Gz=1,Kz=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Wz,Math.floor(u/e.css.cell.width)),rows:Math.max(Gz,Math.floor(l/e.css.cell.height))}}},qz={class:`flex h-[32rem] min-h-0 flex-col gap-2`},Jz={key:0,class:`text-sm text-muted-foreground`,role:`status`},Yz=k({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=q(null),r=q(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return _t(()=>{let e=n.value;if(!e)return;i=new Uz({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new Kz,i.loadAddon(o),i.open(e),c();let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${l}//${window.location.host}/api/tasks/${encodeURIComponent(t.taskId)}/sandbox?${u}`);a=d,d.binaryType=`arraybuffer`,d.onopen=()=>{r.value=`open`},d.onmessage=e=>{i&&(typeof e.data==`string`&&(r.value=`failed`),i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data)))},d.onerror=()=>{r.value=`failed`},d.onclose=()=>{r.value!==`failed`&&(r.value=`closed`)},s=new ResizeObserver(c),s.observe(e)}),ut(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(R(),W(`div`,qz,[r.value===`open`?L(``,!0):(R(),W(`p`,Jz,[r.value===`connecting`?(R(),W(V,{key:0},[A(`Connecting…`)],64)):r.value===`closed`?(R(),W(V,{key:1},[A(`The sandbox view ended.`)],64)):(R(),W(V,{key:2},[A(`The sandbox view is unavailable.`)],64))])),U(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),Xz={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},Zz={class:`inline-flex items-center gap-2`},Qz={class:`inline-flex items-center gap-2`},$z=`__all__`,eB=k({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=I(()=>ow.map(e=>({value:e.value||$z,label:e.label}))),a=I(()=>n.filters.level||$z),o=I(()=>n.filters.stage||$z);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===$z?``:String(e)})}function l(e){s({stage:String(e)===$z?``:String(e)})}return(t,n)=>(R(),W(`div`,Xz,[U(`div`,Zz,[M(z(Cl),{"model-value":a.value,"aria-label":`Filter log entries by level`,"onUpdate:modelValue":c},{default:j(()=>[M(z(Al),{size:`sm`},{default:j(()=>[M(z(jl))]),_:1}),M(z(wl),null,{default:j(()=>[M(z(Tl),null,{default:j(()=>[(R(!0),W(V,null,G(i.value,e=>(R(),K(z(Dl),{key:e.value,value:e.value},{default:j(()=>[A(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),U(`div`,Qz,[M(z(Cl),{"model-value":o.value,"aria-label":`Filter log entries by stage`,"onUpdate:modelValue":l},{default:j(()=>[M(z(Al),{size:`sm`},{default:j(()=>[M(z(jl))]),_:1}),M(z(wl),null,{default:j(()=>[M(z(Tl),null,{default:j(()=>[M(z(Dl),{value:$z},{default:j(()=>[...n[0]||=[A(`All stages`,-1)]]),_:1}),(R(!0),W(V,null,G(e.stages,e=>(R(),K(z(Dl),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),tB={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},nB={key:2,class:`flex flex-col items-start gap-2 py-3`},rB={key:0,class:`mt-2 Line truncated
`)}};bG.defaultYaml={explicit:!1,version:`1.2`},bG.defaultTags={"!!":`tag:yaml.org,2002:`};function xG(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function SG(e){let t=new Set;return pG(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function CG(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function wG(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=SG(e);let a=CG(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(aG(t.node)||sG(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 TG(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=TG(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=TG(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=TG(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=TG(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function EG(e,t,n){if(Array.isArray(e))return e.map((e,t)=>EG(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!lG(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 DG=class{constructor(e){Object.defineProperty(this,eG,{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(!nG(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=EG(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?TG(i,{"":o},``,o):o}},OG=class extends DG{constructor(e){super(JW),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=[],pG(e,{Node:(e,t)=>{(tG(t)||lG(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||=(EG(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=kG(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(xG(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 kG(e,t,n){if(tG(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(sG(t)){let r=0;for(let i of t.items){let t=kG(e,i,n);t>r&&(r=t)}return r}if(iG(t)){let r=kG(e,t.key,n),i=kG(e,t.value,n);return Math.max(r,i)}return 1}var AG=e=>!e||typeof e!=`function`&&typeof e!=`object`,jG=class extends DG{constructor(e){super(QW),this.value=e}toJSON(e,t){return t?.keep?this.value:EG(this.value,e,t)}toString(){return String(this.value)}};jG.BLOCK_FOLDED=`BLOCK_FOLDED`,jG.BLOCK_LITERAL=`BLOCK_LITERAL`,jG.PLAIN=`PLAIN`,jG.QUOTE_DOUBLE=`QUOTE_DOUBLE`,jG.QUOTE_SINGLE=`QUOTE_SINGLE`;var MG=`tag:yaml.org,2002:`;function NG(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 PG(e,t,n){if(nG(e)&&(e=e.contents),cG(e))return e;if(iG(e)){let t=n.schema[XW].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 OG(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=MG+t.slice(2));let l=NG(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new jG(e);return c&&(c.node=t),t Line truncated
`)?zG(n,t):n.includes(`
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),FI&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=iL(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=yI(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-aL),aL),t/=aL,t/Math.abs(t)+Math.round(t*(oL-1)))}shouldForceSelection(e){return jI?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),sL)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(jI&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._active Line truncated
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(PP(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(JM(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<sz+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===sz+1&&(this._liveRegion.textContent+=zj.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let Line truncated
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Lj.get()},set promptLabel(e){Lj.set(e)},get tooMuchOutput(){return zj.get()},set tooMuchOutput(e){zj.set(e)}}}_verifyIntegers(...e){for(bz of e)if(bz===1/0||isNaN(bz)||bz%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(bz of e)if(bz&&(bz===1/0||isNaN(bz)||bz%1!=0||bz<0))throw Error(`This API only accepts positive integers`)}},Sz=2,Cz=1,wz=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Sz,Math.floor(u/e.css.cell.width)),rows:Math.max(Cz,Math.floor(l/e.css.cell.height))}}},Tz={class:`flex h-[32rem] min-h-0 flex-col gap-2`},Ez={key:0,class:`text-sm text-muted-foreground`,role:`status`},Dz=k({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=q(null),r=q(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return _t(()=>{let e=n.value;if(!e)return;i=new xz({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new wz,i.loadAddon(o),i.open(e),c();let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${l}//${window.location.host}/api/tasks/${encodeURIComponent(t.taskId)}/sandbox?${u}`);a=d,d.binaryType=`arraybuffer`,d.onopen=()=>{r.value=`open`},d.onmessage=e=>{i&&(typeof e.data==`string`&&(r.value=`failed`),i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data)))},d.onerror=()=>{r.value=`failed`},d.onclose=()=>{r.value!==`failed`&&(r.value=`closed`)},s=new ResizeObserver(c),s.observe(e)}),ut(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(R(),W(`div`,Tz,[r.value===`open`?L(``,!0):(R(),W(`p`,Ez,[r.value===`connecting`?(R(),W(V,{key:0},[A(`Connecting…`)],64)):r.value===`closed`?(R(),W(V,{key:1},[A(`The sandbox view ended.`)],64)):(R(),W(V,{key:2},[A(`The sandbox view is unavailable.`)],64))])),U(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),Oz={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},kz={class:`inline-flex items-center gap-2`},Az={class:`inline-flex items-center gap-2`},jz=`__all__`,Mz=k({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=I(()=>rw.map(e=>({value:e.value||jz,label:e.label}))),a=I(()=>n.filters.level||jz),o=I(()=>n.filters.stage||jz);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===jz?``:String(e)})}function l(e){s({stage:String(e)===jz?``:String(e)})}return(t,n)=>(R(),W(`div`,Oz,[U(`div`,kz,[M(z(xl),{"model-value":a.value,"aria-label":`Filter log entries by level`,"onUpdate:modelValue":c},{default:j(()=>[M(z(Ol),{size:`sm`},{default:j(()=>[M(z(kl))]),_:1}),M(z(Sl),null,{default:j(()=>[M(z(Cl),null,{default:j(()=>[(R(!0),W(V,null,G(i.value,e=>(R(),K(z(Tl),{key:e.value,value:e.value},{default:j(()=>[A(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),U(`div`,Az,[M(z(xl),{"model-value":o.value,"aria-label":`Filter log entries by stage`,"onUpdate:modelValue":l},{default:j(()=>[M(z(Ol),{size:`sm`},{default:j(()=>[M(z(kl))]),_:1}),M(z(Sl),null,{default:j(()=>[M(z(Cl),null,{default:j(()=>[M(z(Tl),{value:jz},{default:j(()=>[...n[0]||=[A(`All stages`,-1)]]),_:1}),(R(!0),W(V,null,G(e.stages,e=>(R(),K(z(Tl),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),Nz={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},Pz={key:2,class:`flex flex-col items-start gap-2 py-3`},Fz={key:0,class:`mt-2 Line truncated
`)}};QW.defaultYaml={explicit:!1,version:`1.2`},QW.defaultTags={"!!":`tag:yaml.org,2002:`};function $W(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 eG(e){let t=new Set;return GW(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function tG(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function nG(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=eG(e);let a=tG(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(LW(t.node)||zW(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 rG(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=rG(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=rG(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=rG(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=rG(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function iG(e,t,n){if(Array.isArray(e))return e.map((e,t)=>iG(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!VW(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 aG=class{constructor(e){Object.defineProperty(this,MW,{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(!PW(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=iG(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?rG(i,{"":o},``,o):o}},oG=class extends aG{constructor(e){super(EW),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=[],GW(e,{Node:(e,t)=>{(NW(t)||VW(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||=(iG(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=sG(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if($W(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function sG(e,t,n){if(NW(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(zW(t)){let r=0;for(let i of t.items){let t=sG(e,i,n);t>r&&(r=t)}return r}if(IW(t)){let r=sG(e,t.key,n),i=sG(e,t.value,n);return Math.max(r,i)}return 1}var cG=e=>!e||typeof e!=`function`&&typeof e!=`object`,lG=class extends aG{constructor(e){super(AW),this.value=e}toJSON(e,t){return t?.keep?this.value:iG(this.value,e,t)}toString(){return String(this.value)}};lG.BLOCK_FOLDED=`BLOCK_FOLDED`,lG.BLOCK_LITERAL=`BLOCK_LITERAL`,lG.PLAIN=`PLAIN`,lG.QUOTE_DOUBLE=`QUOTE_DOUBLE`,lG.QUOTE_SINGLE=`QUOTE_SINGLE`;var uG=`tag:yaml.org,2002:`;function dG(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 fG(e,t,n){if(PW(e)&&(e=e.contents),BW(e))return e;if(IW(e)){let t=n.schema[OW].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 oG(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=uG+t.slice(2));let l=dG(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new lG(e);return c&&(c.node=t),t Line truncated
`)?_G(n,t):n.includes(`
`)?`
`+zG(n,t):(e.endsWith(` `)?``:` `)+n,VG=`flow`,HG=`block`,UG=`quoted`;function WG(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=GG(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
`)n===`block`&&(h=GG(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`+_G(n,t):(e.endsWith(` `)?``:` `)+n,yG=`flow`,bG=`block`,xG=`quoted`;function SG(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=CG(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
`)n===`block`&&(h=CG(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function GG(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
`);r=t,i=t+1,a=e[i]}return r}var KG=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),qG=e=>/^(%|---|\.\.\.)/m.test(e);function JG(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function YG(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(qG(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function CG(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
`);r=t,i=t+1,a=e[i]}return r}var wG=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),TG=e=>/^(%|---|\.\.\.)/m.test(e);function EG(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function DG(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(TG(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:WG(o,a,UG,KG(t,!1))}function XG(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return YG(e,t);let n=t.indent||(qG(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:WG(r,n,VG,KG(t,!1))}function ZG(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=YG;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?XG:i&&!t?YG:n?XG:YG}return r(e,t)}var QG;try{QG=RegExp(`(^|(?<!
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:SG(o,a,xG,wG(t,!1))}function OG(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return DG(e,t);let n=t.indent||(TG(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:SG(r,n,yG,wG(t,!1))}function kG(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=DG;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?OG:i&&!t?DG:n?OG:DG}return r(e,t)}var AG;try{AG=RegExp(`(^|(?<!
))
+(?!
|$)`,`g`)}catch{QG=/\n+(?!\n|$)/g}function $G({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return ZG(n,r);let l=r.indent||(r.forceBlockIndent||qG(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===jG.BLOCK_FOLDED?!1:t===jG.BLOCK_LITERAL||!JG(n,c,l.length);if(!n)return u?`|
|$)`,`g`)}catch{AG=/\n+(?!\n|$)/g}function jG({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return kG(n,r);let l=r.indent||(r.forceBlockIndent||TG(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===lG.BLOCK_FOLDED?!1:t===lG.BLOCK_LITERAL||!EG(n,c,l.length);if(!n)return u?`|
`:`>
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
`&&(p=p.slice(0,-1)),p.replace(QG,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
`&&(p=p.slice(0,-1)),p.replace(AG,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=KG(r,!0);o!==`folded`&&t!==jG.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=WG(`${v}${e}${p}`,l,HG,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function eK(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
`)||u&&/[[\]{},]/.test(a))return ZG(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?ZG(a,t):$G(e,t,n,r);if(!s&&!u&&i!==jG.PLAIN&&a.includes(`
`))return $G(e,t,n,r);if(qG(a)){if(c===``)return t.forceBlockIndent=!0,$G(e,t,n,r);if(s&&c===l)return ZG(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return ZG(a,t)}return s?d:WG(d,c,VG,KG(t,!1))}function tK(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==jG.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=jG.QUOTE_DOUBLE);let c=e=>{switch(e){case jG.BLOCK_FOLDED:case jG.BLOCK_LITERAL:return i||a?ZG(o.value,t):$G(o,t,n,r);case jG.QUOTE_DOUBLE:return YG(o.value,t);case jG.QUOTE_SINGLE:return XG(o.value,t);case jG.PLAIN:return eK(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function nK(e,t){let n=Object.assign({blockQuote:!0,commentString:RG,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function rK(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(aG(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function iK(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(aG(e)||sG(e))&&e.anchor;a&&xG(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function aK(e,t,n,r){if(iG(e))return e.toString(t,n,r);if(tG(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=cG(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=rK(t.doc.schema.tags,a);let o=iK(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):aG(a)?tK(a,t,n,r):a.toString(t,n,r);return o?aG(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function oK({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=cG(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(sG(e)||!cG(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||sG(e)||(aG(e)?e.type===jG.BLOCK_FOLDED||e.type===jG.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=aK(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=BG(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=BG(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=BG(g,n.indent,l(f))));let _,v,y;cG(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&aG(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&oG(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=aK(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${zG(e,n.indent)}`}x===``&&!n.inFlow?S===`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=wG(r,!0);o!==`folded`&&t!==lG.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=SG(`${v}${e}${p}`,l,bG,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function MG(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
`)||u&&/[[\]{},]/.test(a))return kG(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?kG(a,t):jG(e,t,n,r);if(!s&&!u&&i!==lG.PLAIN&&a.includes(`
`))return jG(e,t,n,r);if(TG(a)){if(c===``)return t.forceBlockIndent=!0,jG(e,t,n,r);if(s&&c===l)return kG(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return kG(a,t)}return s?d:SG(d,c,yG,wG(t,!1))}function NG(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==lG.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=lG.QUOTE_DOUBLE);let c=e=>{switch(e){case lG.BLOCK_FOLDED:case lG.BLOCK_LITERAL:return i||a?kG(o.value,t):jG(o,t,n,r);case lG.QUOTE_DOUBLE:return DG(o.value,t);case lG.QUOTE_SINGLE:return OG(o.value,t);case lG.PLAIN:return MG(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function PG(e,t){let n=Object.assign({blockQuote:!0,commentString:gG,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function FG(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(LW(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function IG(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(LW(e)||zW(e))&&e.anchor;a&&$W(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function LG(e,t,n,r){if(IW(e))return e.toString(t,n,r);if(NW(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=BW(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=FG(t.doc.schema.tags,a);let o=IG(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):LW(a)?NG(a,t,n,r):a.toString(t,n,r);return o?LW(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function RG({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=BW(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(zW(e)||!BW(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||zW(e)||(LW(e)?e.type===lG.BLOCK_FOLDED||e.type===lG.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=LG(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=vG(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=vG(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=vG(g,n.indent,l(f))));let _,v,y;BW(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&LW(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&RW(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=LG(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${_G(e,n.indent)}`}x===``&&!n.inFlow?S===`
`&&y&&(S=`
`):S+=`\n${n.indent}`}else if(!p&&sG(t)){let e=x[0],r=x.indexOf(`
`):S+=`\n${n.indent}`}else if(!p&&zW(t)){let e=x[0],r=x.indexOf(`
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=BG(g,n.indent,l(y)):h&&i&&i(),g}function sK(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var cK=`<<`,lK={identify:e=>e===cK||typeof e==`symbol`&&e.description===cK,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new jG(Symbol(cK)),{addToJSMap:dK}),stringify:()=>cK},uK=(e,t)=>(lK.identify(t)||aG(t)&&(!t.type||t.type===jG.PLAIN)&&lK.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===lK.tag&&e.default);function dK(e,t,n){let r=pK(e,n);if(oG(r))for(let n of r.items)fK(e,t,n);else if(Array.isArray(r))for(let n of r)fK(e,t,n);else fK(e,t,r)}function fK(e,t,n){let r=pK(e,n);if(!rG(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function pK(e,t){return e&&tG(t)?t.resolve(e.doc,e):t}function mK(e,t,{key:n,value:r}){if(cG(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(uK(e,n))dK(e,t,r);else{let i=EG(n,``,e);if(t instanceof Map)t.set(i,EG(r,i,e));else if(t instanceof Set)t.add(i);else{let a=hK(n,i,e),o=EG(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function hK(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(cG(e)&&n?.doc){let t=nK(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),sK(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function gK(e,t,n){return new _K(PG(e,void 0,n),PG(t,void 0,n))}var _K=class e{constructor(e,t=null){Object.defineProperty(this,eG,{value:ZW}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return cG(n)&&(n=n.clone(t)),cG(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return mK(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?oK(this,e,t,n):JSON.stringify(this)}};function vK(e,t,n){return(t.inFlow??e.flow?bK:yK)(e,t,n)}function yK({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(cG(i))!d&&i.spaceBefore&&f.push(``),xK(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(iG(i)){let e=cG(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),xK(n,f,e.commentBefore,d))}d=!1;let s=aK(i,u,()=>o=null,()=>d=!0);o&&(s+=BG(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=vG(g,n.indent,l(y)):h&&i&&i(),g}function zG(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var BG=`<<`,VG={identify:e=>e===BG||typeof e==`symbol`&&e.description===BG,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new lG(Symbol(BG)),{addToJSMap:UG}),stringify:()=>BG},HG=(e,t)=>(VG.identify(t)||LW(t)&&(!t.type||t.type===lG.PLAIN)&&VG.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===VG.tag&&e.default);function UG(e,t,n){let r=GG(e,n);if(RW(r))for(let n of r.items)WG(e,t,n);else if(Array.isArray(r))for(let n of r)WG(e,t,n);else WG(e,t,r)}function WG(e,t,n){let r=GG(e,n);if(!FW(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function GG(e,t){return e&&NW(t)?t.resolve(e.doc,e):t}function KG(e,t,{key:n,value:r}){if(BW(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(HG(e,n))UG(e,t,r);else{let i=iG(n,``,e);if(t instanceof Map)t.set(i,iG(r,i,e));else if(t instanceof Set)t.add(i);else{let a=qG(n,i,e),o=iG(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function qG(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(BW(e)&&n?.doc){let t=PG(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),zG(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function JG(e,t,n){return new YG(fG(e,void 0,n),fG(t,void 0,n))}var YG=class e{constructor(e,t=null){Object.defineProperty(this,MW,{value:kW}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return BW(n)&&(n=n.clone(t)),BW(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return KG(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?RG(this,e,t,n):JSON.stringify(this)}};function XG(e,t,n){return(t.inFlow??e.flow?QG:ZG)(e,t,n)}function ZG({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(BW(i))!d&&i.spaceBefore&&f.push(``),$G(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(IW(i)){let e=BW(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),$G(n,f,e.commentBefore,d))}d=!1;let s=LG(i,u,()=>o=null,()=>d=!0);o&&(s+=vG(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
`}}return e?(p+=`
`+zG(l(e),c),s&&s()):d&&o&&o(),p}function bK({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(cG(i))i.spaceBefore&&d.push(``),xK(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(iG(i)){let e=cG(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),xK(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=cG(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=aK(i,c,()=>a=null);l||=d.length>u||o.includes(`
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=BG(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function xK({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=zG(t(r),e);n.push(i.trimStart())}}function SK(e,t){let n=aG(t)?t.value:t;for(let r of e)if(iG(r)&&(r.key===t||r.key===n||aG(r.key)&&r.key.value===n))return r}var CK=class extends LG{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(XW,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(gK(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=iG(e)?e:!e||typeof e!=`object`||!(`key`in e)?new _K(e,e?.value):new _K(e.key,e.value);let r=SK(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);aG(r.value)&&AG(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=SK(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=SK(this.items,e)?.value;return(!t&&aG(n)?n.value:n)??void 0}has(e){return!!SK(this.items,e)}set(e,t){this.add(new _K(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)mK(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!iG(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),vK(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},wK={collection:`map`,default:!0,nodeClass:CK,tag:`tag:yaml.org,2002:map`,resolve(e,t){return rG(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>CK.from(e,t,n)},TK=class extends LG{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super($W,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=EK(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=EK(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&aG(r)?r.value:r}has(e){let t=EK(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=EK(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];aG(r)&&AG(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(EG(e,String(r++),t));return n}toString(e,t,n){return e?vK(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(PG(a,void 0,n))}}return i}};function EK(e){let t=aG(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var DK={collection:`seq`,default:!0,nodeClass:TK,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return oG(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>TK.from(e,t,n)},OK={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),tK(e,t,n,r)}},kK={identify:e=>e==null,createNode:()=>new jG(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new jG(null),stringify:({source:e},t)=>typeof e==`string`&&kK.test.test(e)?e:t.options.nullStr},AK={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new jG(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&AK.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function jK({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var MK={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:jK},NK={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),string Line truncated
`:` `)}return tK({comment:e,type:t,value:s},r,i,a)}};function qK(e,t){if(oG(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!iG(r)){if(rG(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new _K(new jG(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=iG(r)?r:new _K(r)}}else t(`Expected a sequence for this tag`);return e}function JK(e,t,n){let{replacer:r}=n,i=new TK(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(gK(o,s,n))}return i}var YK={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:qK,createNode:JK},XK=class e extends TK{constructor(){super(),this.add=CK.prototype.add.bind(this),this.delete=CK.prototype.delete.bind(this),this.get=CK.prototype.get.bind(this),this.has=CK.prototype.has.bind(this),this.set=CK.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(iG(e)?(r=EG(e.key,``,t),i=EG(e.value,r,t)):r=EG(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=JK(e,t,n),i=new this;return i.items=r.items,i}};XK.tag=`tag:yaml.org,2002:omap`;var ZK={collection:`seq`,identify:e=>e instanceof Map,nodeClass:XK,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=qK(e,t),r=[];for(let{key:e}of n.items)aG(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new XK,n)},createNode:(e,t,n)=>XK.from(e,t,n)};function QK({value:e,source:t},n){return t&&(e?$K:eq).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var $K={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new jG(!0),stringify:QK},eq={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new jG(!1),stringify:QK},tq={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:jK},nq={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():jK(e)}},rq={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new jG(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:jK},iq=e=>typeof e==`bigint`||Number.isInteger(e);function aq(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function oq(e,t,n){let{value:r}=e;if(iq(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return jK(e)}var sq={identify:iq,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>aq(e,2,2,n),stringify:e=>oq(e,2,`0b`)},cq={identify:iq,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>aq(e,1,8,n),stringify:e=>oq(e,8,`0`)},lq={identify:iq,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>aq(e,0,10,n),stringify:jK},uq={identify:iq,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>aq(e,2,16,n),stringify:e=>oq(e,16,`0x`)},dq=class e extends CK{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=iG(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new _K(e.key,null):new _K(e,null),SK(this.items,t.key)||this.items.push(t)}get(e,t){let n=SK(this.items,e);return!t&&iG(n)?aG(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=SK(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new _K(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return s Line truncated
`)?(n.push(`...`),n.push(zG(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(zG(a(t),``)))}return n.join(`
`+_G(l(e),c),s&&s()):d&&o&&o(),p}function QG({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(BW(i))i.spaceBefore&&d.push(``),$G(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(IW(i)){let e=BW(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),$G(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=BW(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=LG(i,c,()=>a=null);l||=d.length>u||o.includes(`
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=vG(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function $G({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=_G(t(r),e);n.push(i.trimStart())}}function eK(e,t){let n=LW(t)?t.value:t;for(let r of e)if(IW(r)&&(r.key===t||r.key===n||LW(r.key)&&r.key.value===n))return r}var tK=class extends hG{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(OW,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(JG(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=IW(e)?e:!e||typeof e!=`object`||!(`key`in e)?new YG(e,e?.value):new YG(e.key,e.value);let r=eK(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);LW(r.value)&&cG(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=eK(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=eK(this.items,e)?.value;return(!t&&LW(n)?n.value:n)??void 0}has(e){return!!eK(this.items,e)}set(e,t){this.add(new YG(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)KG(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!IW(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),XG(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},nK={collection:`map`,default:!0,nodeClass:tK,tag:`tag:yaml.org,2002:map`,resolve(e,t){return FW(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>tK.from(e,t,n)},rK=class extends hG{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(jW,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=iK(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=iK(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&LW(r)?r.value:r}has(e){let t=iK(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=iK(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];LW(r)&&cG(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(iG(e,String(r++),t));return n}toString(e,t,n){return e?XG(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(fG(a,void 0,n))}}return i}};function iK(e){let t=LW(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var aK={collection:`seq`,default:!0,nodeClass:rK,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return RW(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>rK.from(e,t,n)},oK={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),NG(e,t,n,r)}},sK={identify:e=>e==null,createNode:()=>new lG(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new lG(null),stringify:({source:e},t)=>typeof e==`string`&&sK.test.test(e)?e:t.options.nullStr},cK={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new lG(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&cK.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function lK({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var uK={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:lK},dK={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),string Line truncated
`:` `)}return NG({comment:e,type:t,value:s},r,i,a)}};function TK(e,t){if(RW(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!IW(r)){if(FW(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new YG(new lG(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=IW(r)?r:new YG(r)}}else t(`Expected a sequence for this tag`);return e}function EK(e,t,n){let{replacer:r}=n,i=new rK(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(JG(o,s,n))}return i}var DK={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:TK,createNode:EK},OK=class e extends rK{constructor(){super(),this.add=tK.prototype.add.bind(this),this.delete=tK.prototype.delete.bind(this),this.get=tK.prototype.get.bind(this),this.has=tK.prototype.has.bind(this),this.set=tK.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(IW(e)?(r=iG(e.key,``,t),i=iG(e.value,r,t)):r=iG(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=EK(e,t,n),i=new this;return i.items=r.items,i}};OK.tag=`tag:yaml.org,2002:omap`;var kK={collection:`seq`,identify:e=>e instanceof Map,nodeClass:OK,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=TK(e,t),r=[];for(let{key:e}of n.items)LW(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new OK,n)},createNode:(e,t,n)=>OK.from(e,t,n)};function AK({value:e,source:t},n){return t&&(e?jK:MK).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var jK={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new lG(!0),stringify:AK},MK={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new lG(!1),stringify:AK},NK={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:lK},PK={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():lK(e)}},FK={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new lG(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:lK},IK=e=>typeof e==`bigint`||Number.isInteger(e);function LK(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function RK(e,t,n){let{value:r}=e;if(IK(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return lK(e)}var zK={identify:IK,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>LK(e,2,2,n),stringify:e=>RK(e,2,`0b`)},BK={identify:IK,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>LK(e,1,8,n),stringify:e=>RK(e,8,`0`)},VK={identify:IK,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>LK(e,0,10,n),stringify:lK},HK={identify:IK,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>LK(e,2,16,n),stringify:e=>RK(e,16,`0x`)},UK=class e extends tK{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=IW(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new YG(e.key,null):new YG(e,null),eK(this.items,t.key)||this.items.push(t)}get(e,t){let n=eK(this.items,e);return!t&&IW(n)?LW(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=eK(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new YG(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return s Line truncated
`)?(n.push(`...`),n.push(_G(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(_G(a(t),``)))}return n.join(`
`)+`
`}var Eq=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,eG,{value:YW});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 bG({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[eG]:{value:YW}});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=cG(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){Dq(this.contents)&&this.contents.add(e)}addIn(e,t){Dq(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=SG(this);e.anchor=!t||n.has(t)?CG(t||`a`,n):t}return new OG(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}=wG(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=PG(e,l,p);return o&&sG(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new _K(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return Dq(this.contents)?this.contents.delete(e):!1}deleteIn(e){return IG(e)?this.contents!=null&&(this.contents=null,!0):Dq(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return sG(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return IG(e)?!t&&aG(this.contents)?this.contents.value:this.contents:sG(this.contents)?this.contents.getIn(e,t):void 0}has(e){return sG(this.contents)?this.contents.has(e):!1}hasIn(e){return IG(e)?this.contents!==void 0:sG(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=FG(this.schema,[e],t):Dq(this.contents)&&this.contents.set(e,t)}setIn(e,t){IG(e)?this.contents=t:this.contents==null?this.contents=FG(this.schema,Array.from(e),t):Dq(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 bG({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 bG({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 wq(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=EG(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`?TG(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 Tq(this,e)}};function Dq(e){if(sG(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var Oq=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},kq=class extends Oq{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},Aq=class extends Oq{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},jq=(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 Mq(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 Nq(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(Nq(t.key)||Nq(t.value))return!0}return!1;default:return!0}}function Pq(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&Nq(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function Fq(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||aG(e)&&aG(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var Iq=`All mapping items must start at the same column`;function Lq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??CK)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=Mq(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`,Iq)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||Nq(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`,Iq);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&Pq(r.indent,u,i),n.atKey=!1,Fq(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=Mq(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&&Pq(r.indent,f,i),s=c.range[2];let l=new _K(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 _K(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 Rq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??TK)(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=Mq(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&&Pq(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function zq(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 Bq=`Block collections are not allowed within flow collections`,Vq=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Hq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?CK:TK))(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=Mq(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&&Nq(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];iG(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],Vq(m)&&i(r.range,`BLOCK_IN_FLOW`,Bq)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);Vq(f)&&i(g.range,`BLOCK_IN_FLOW`,Bq),n.atKey=!1;let _=Mq(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?Vq(m)&&i(v.range,`BLOCK_IN_FLOW`,Bq):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new _K(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;Fq(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new CK(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=zq(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 Uq(e,t,n,r,i,a){let o=n.type===`block-map`?Lq(e,t,n,r,a):n.type===`block-seq`?Rq(e,t,n,r,a):Hq(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function Wq(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===CK.tagName&&s===`map`||o===TK.tagName&&s===`seq`)return Uq(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),Uq(e,t,n,i,o)}let l=Uq(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=cG(u)?u:new jG(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Gq(e,t,n){let r=t.offset,i=Kq(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?jG.BLOCK_FOLDED:jG.BLOCK_LITERAL,o=t.source?Dee(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
`}var iq=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,MW,{value:DW});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 QW({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[MW]:{value:DW}});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=BW(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){aq(this.contents)&&this.contents.add(e)}addIn(e,t){aq(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=eG(this);e.anchor=!t||n.has(t)?tG(t||`a`,n):t}return new oG(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}=nG(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=fG(e,l,p);return o&&zW(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new YG(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return aq(this.contents)?this.contents.delete(e):!1}deleteIn(e){return mG(e)?this.contents!=null&&(this.contents=null,!0):aq(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return zW(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return mG(e)?!t&&LW(this.contents)?this.contents.value:this.contents:zW(this.contents)?this.contents.getIn(e,t):void 0}has(e){return zW(this.contents)?this.contents.has(e):!1}hasIn(e){return mG(e)?this.contents!==void 0:zW(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=pG(this.schema,[e],t):aq(this.contents)&&this.contents.set(e,t)}setIn(e,t){mG(e)?this.contents=t:this.contents==null?this.contents=pG(this.schema,Array.from(e),t):aq(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 QW({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 QW({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 nq(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=iG(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`?rG(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 rq(this,e)}};function aq(e){if(zW(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var oq=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},sq=class extends oq{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},cq=class extends oq{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},lq=(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 uq(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 dq(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(dq(t.key)||dq(t.value))return!0}return!1;default:return!0}}function fq(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&dq(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function pq(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||LW(e)&&LW(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var mq=`All mapping items must start at the same column`;function hq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??tK)(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=uq(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`,mq)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||dq(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`,mq);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&fq(r.indent,u,i),n.atKey=!1,pq(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=uq(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&&fq(r.indent,f,i),s=c.range[2];let l=new YG(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 YG(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 gq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??rK)(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=uq(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&&fq(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function _q(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 vq=`Block collections are not allowed within flow collections`,yq=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function bq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?tK:rK))(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=uq(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&&dq(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];IW(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],yq(m)&&i(r.range,`BLOCK_IN_FLOW`,vq)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);yq(f)&&i(g.range,`BLOCK_IN_FLOW`,vq),n.atKey=!1;let _=uq(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?yq(m)&&i(v.range,`BLOCK_IN_FLOW`,vq):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new YG(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;pq(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new tK(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=_q(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 xq(e,t,n,r,i,a){let o=n.type===`block-map`?hq(e,t,n,r,a):n.type===`block-seq`?gq(e,t,n,r,a):bq(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function Sq(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===tK.tagName&&s===`map`||o===rK.tagName&&s===`seq`)return xq(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),xq(e,t,n,i,o)}let l=xq(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=BW(u)?u:new lG(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Cq(e,t,n){let r=t.offset,i=wq(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?lG.BLOCK_FOLDED:lG.BLOCK_LITERAL,o=t.source?Tq(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===jG.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===lG.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`):t.length>c||r[0]===` `?(f===` `?f=`
`:!p&&f===`
`&&(f=`
@@ -86,59 +86,59 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`+o[e][0].slice(c);d[d.length-1]!==`
`&&(d+=`
`);break;default:d+=`
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function Kq({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Dee(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function qq(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=jG.PLAIN,c=Jq(a,l);break;case`single-quoted-scalar`:s=jG.QUOTE_SINGLE,c=Yq(a,l);break;case`double-quoted-scalar`:s=jG.QUOTE_DOUBLE,c=Zq(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=zq(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Jq(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),Xq(e)}function Yq(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Xq(e.slice(1,-1)).replace(/''/g,`'`)}function Xq(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function wq({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Tq(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function Eq(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=lG.PLAIN,c=Dq(a,l);break;case`single-quoted-scalar`:s=lG.QUOTE_SINGLE,c=Oq(a,l);break;case`double-quoted-scalar`:s=lG.QUOTE_DOUBLE,c=Aq(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=_q(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Dq(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),kq(e)}function Oq(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),kq(e.slice(1,-1)).replace(/''/g,`'`)}function kq(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
`?a+=o:o=`
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function Zq(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function Aq(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
`){if(i===`
`){let{fold:t,offset:i}=Qq(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=$q[i];if(a)n+=a;else if(i===`
`){let{fold:t,offset:i}=Oee(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=jq[i];if(a)n+=a;else if(i===`
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=eJ(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=Mq(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
`&&(a!==`\r`||e[r+2]!==`
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function Qq(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function Oee(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
`||r===`\r`)&&(r!==`\r`||e[t+2]===`
`);)r===`
`&&(n+=`
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var $q={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function eJ(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function tJ(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Gq(e,t,r):qq(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[QW]:c?nJ(e.schema,i,c,n,r):t.type===`scalar`?rJ(e,i,t,r):e.schema[QW];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=aG(a)?a:new jG(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new jG(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function nJ(e,t,n,r,i){if(n===`!`)return e[QW];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[QW])}function rJ({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[QW];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[QW];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function iJ(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var aJ={composeNode:oJ,composeEmptyNode:sJ};function oJ(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=cJ(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=tJ(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=Wq(aJ,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=sJ(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!aG(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function sJ(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=tJ(e,{type:`scalar`,offset:iJ(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function cJ({options:e},{offset:t,source:n,end:r},i){let a=new OG(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=zq(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function lJ(e,t,{offset:n,start:r,value:i,end:a},o){let s=new Eq(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=Mq(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?oJ(c,i,l,o):sJ(c,l.end,r,null,l,o);let u=s.contents.range[2],d=zq(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function uJ(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function dJ(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var jq={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Mq(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function Nq(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Cq(e,t,r):Eq(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[AW]:c?Pq(e.schema,i,c,n,r):t.type===`scalar`?Fq(e,i,t,r):e.schema[AW];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=LW(a)?a:new lG(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new lG(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Pq(e,t,n,r,i){if(n===`!`)return e[AW];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[AW])}function Fq({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[AW];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[AW];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function Iq(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var Lq={composeNode:Rq,composeEmptyNode:zq};function Rq(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Bq(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=Nq(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=Sq(Lq,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=zq(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!LW(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function zq(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Nq(e,{type:`scalar`,offset:Iq(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Bq({options:e},{offset:t,source:n,end:r},i){let a=new oG(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=_q(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Vq(e,t,{offset:n,start:r,value:i,end:a},o){let s=new iq(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=uq(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Rq(c,i,l,o):zq(c,l.end,r,null,l,o);let u=s.contents.range[2],d=_q(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Hq(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function Uq(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
`:`
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var fJ=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=uJ(e);r?this.warnings.push(new Aq(i,t,n)):this.errors.push(new kq(i,t,n))},this.directives=new bG({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=dJ(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(sG(i)&&!i.flow&&i.items.length>0){let e=i.items[0];iG(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:dJ(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=uJ(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=lJ(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new kq(uJ(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new kq(uJ(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=zq(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new kq(uJ(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new Eq(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},pJ=Symbol(`break visit`),mJ=Symbol(`skip children`),hJ=Symbol(`remove item`);function gJ(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),_J(Object.freeze([]),e,t)}gJ.BREAK=pJ,gJ.SKIP=mJ,gJ.REMOVE=hJ,gJ.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},gJ.parentCollection=(e,t)=>{let n=gJ.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function _J(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=_J(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===pJ)return pJ;else r===hJ&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function vJ(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var Wq=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Hq(e);r?this.warnings.push(new cq(i,t,n)):this.errors.push(new sq(i,t,n))},this.directives=new QW({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Uq(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(zW(i)&&!i.flow&&i.items.length>0){let e=i.items[0];IW(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Uq(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Hq(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Vq(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new sq(Hq(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new sq(Hq(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=_q(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new sq(Hq(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new iq(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},Gq=Symbol(`break visit`),Kq=Symbol(`skip children`),qq=Symbol(`remove item`);function Jq(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Yq(Object.freeze([]),e,t)}Jq.BREAK=Gq,Jq.SKIP=Kq,Jq.REMOVE=qq,Jq.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Jq.parentCollection=(e,t)=>{let n=Jq.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Yq(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Yq(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Gq)return Gq;else r===qq&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function Xq(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
`:case`\r
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function yJ(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var bJ=new Set(`0123456789ABCDEFabcdef`),xJ=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),SJ=new Set(`,[]{}`),CJ=new Set(` ,[]{}
\r `),wJ=e=>!e||CJ.has(e),TJ=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function Zq(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var Qq=new Set(`0123456789ABCDEFabcdef`),$q=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),eJ=new Set(`,[]{}`),tJ=new Set(` ,[]{}
\r `),nJ=e=>!e||tJ.has(e),rJ=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
`||t===`\r`&&this.buffer[e+1]===`
`}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
`||!t&&!this.atEnd)return e+n+1}return t===`
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&yJ(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&yJ(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!yJ(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&yJ(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(wJ),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&yJ(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(wJ),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||yJ(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&Zq(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&Zq(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Zq(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&Zq(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(nJ),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&Zq(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(nJ),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||Zq(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>yJ(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>Zq(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
`:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
`)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
`,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(yJ(r)||e&&SJ.has(r))break;t=n}else if(yJ(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(Zq(r)||e&&eJ.has(r))break;t=n}else if(Zq(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&SJ.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&SJ.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(wJ),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(yJ(n)||t&&SJ.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!yJ(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(xJ.has(t))t=this.buffer[++e];else if(t===`%`&&bJ.has(this.buffer[e+1])&&bJ.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&eJ.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&eJ.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(nJ),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(Zq(n)||t&&eJ.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!Zq(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if($q.has(t))t=this.buffer[++e];else if(t===`%`&&Qq.has(this.buffer[e+1])&&Qq.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},EJ=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function DJ(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function OJ(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function kJ(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function AJ(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function jJ(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function MJ(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function NJ(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!DJ(t.start,`explicit-key-ind`)&&!DJ(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,kJ(t.value)?t.value.end?MJ(t.value.end,t.sep):t.value.end=t.sep:MJ(t.start,t.sep),delete t.sep)}var PJ=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new TJ,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=vJ(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source})}else{if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&NJ(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&OJ(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.in Line truncated
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},iJ=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function aJ(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function oJ(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function sJ(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function cJ(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function lJ(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function uJ(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function dJ(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!aJ(t.start,`explicit-key-ind`)&&!aJ(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,sJ(t.value)?t.value.end?uJ(t.value.end,t.sep):t.value.end=t.sep:uJ(t.start,t.sep),delete t.sep)}var fJ=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new rJ,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Xq(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source})}else{if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&dJ(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&oJ(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.in Line truncated
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){MJ(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(DJ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=jJ(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(DJ(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(kJ(t.key)&&!DJ(t.sep,`newline`)){let e=jJ(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]}):DJ(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&&!DJ(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)){MJ(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||DJ(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.ite Line truncated
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){uJ(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(aJ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=lJ(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(aJ(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(sJ(t.key)&&!aJ(t.sep,`newline`)){let e=lJ(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]}):aJ(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&&!aJ(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)){uJ(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||aJ(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=jJ(AJ(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=jJ(AJ(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 FJ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new EJ||null,prettyErrors:t}}function IJ(e,t={}){let{lineCounter:n,prettyErrors:r}=FJ(t),i=new PJ(n?.addNewLine),a=new fJ(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 kq(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(jq(e,n)),o.warnings.forEach(jq(e,n))),o}function LJ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=IJ(e,n);if(!i)return null;if(i.warnings.forEach(e=>sK(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 RJ(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 nG(e)&&!r?e.toString(n):new Eq(e,r,n).toString(n)}var zJ=e=>typeof e==`object`&&!!e&&!Array.isArray(e),BJ=e=>zJ(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function VJ(e){if(zJ(e)){if(zJ(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:BJ(e.parallel)};if(zJ(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:BJ(e.switch.cases)}}}function HJ(e){return e.slice(2).includes(`parallel`)}function UJ(e,t){let n=IJ(e).getIn(t,!0);if(rG(n))return n.toJSON()}function WJ(e,t,n){let r=IJ(e);return r.setIn(t,r.createNode(tY(n))),r.toString()}function GJ(e,t,n){let r=IJ(e),i=t.slice(0,-1),a=HJ(i);if(a&&![`agent.run`,`workflow.call`].includes(n))throw Error(`Branches allow only read-only agents and workflow calls.`);let o=r.getIn(i,!0);if(oG(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!oG(o))return{source:e,path:[]};let s=Math.min(Math.max(Number(t.at(-1))+1,0),o.items.length),c=n===`parallel`?{parallel:{"branch-1":[],"branch-2":[]}}:n===`switch`?{switch:{on:``,cases:{true:[],default:[]}}}:{type:n,...a&&n===`agent.run`?{settings:{read_only:!0}}:{}};return o.items.splice(s,0,r.createNode(c)),{source:r.toString(),path:[...i,s]}}function KJ(e,t){if(t===`switch`){if(!e||e.includes(`/`))throw Error(`A case is the value it matches, without a slash.`)}else if(!/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/.test(e))throw Error(`Use a lowercase branch name with letters, digits, dots or dashes.`)}function qJ(e,t){let n=e.getIn(t,!0),r=VJ(rG(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!rG(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function JJ(e,t,n){let r=IJ(e),{kind:i,branches:a}=qJ(r,t);if(KJ(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function YJ(e,t,n,r){let i=IJ(e),{kind:a,branches:o}=qJ(i,t);if(KJ(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>aG(e.key)&&e.key.value===n);if(!s||!aG(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function XJ(e,t,n){let r=IJ(e),{kind:i,branches:a}=qJ(r,t);if(i===`parallel`&&a.items.length<=2)throw Error(`Parallel needs at least two branches.`);if(a.items.length<=1)throw Error(`A switch needs at least one case.`);return Line truncated
`).find(e=>e.trim())?.trim()}}function hY(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(dY)].map(e=>e[1]))]}function gY(e){let t=IJ(e).toJS(),n=fY(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=new Set,c=`start`;r.push({id:c,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let l=[c],u=1,d=new Map,f=e=>{let t=d.get(e)??0;return d.set(e,t+1),t},p=(e,t,n,i,s,c,l,u)=>{let d=fY(e)?e:{},p=VJ(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=fY(d.settings)?d.settings:{},g=typeof d.id==`string`?d.id:``,_=`step-${t}`,v=s?`${s}/${g||m}`:g||m;r.push({id:_,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:g||t,title:g||uY(m),type:m,role:iY(m),step:l?.length===2?String(Number(l[1])+1).padStart(2,`0`):void 0,detail:p?.on?`on ${p.on.replace(/^steps\./,``)}`:pY(m,h),summary:mY(h),when:typeof d.when==`string`?d.when:void 0,retry:fY(d.retry)&&typeof d.retry.attempts==`number`?d.retry.attempts:void 0,continues:d.on_failure===`continue`,branch:s,lane:u,path:l,stage:v,occurrence:f(v),...c?{resume:c}:{}}}),g&&a.set(g,_);let y=p?.on?`{{ ${p.on} }}`:``;for(let e of hY([d.settings,y],d.when))o.push({from:e,to:_});return _},m=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,...s.has(r)?{otherwise:!0}:{},insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){let n=VJ(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*sY,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=fY(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=0;o.forEach(([t,n],o)=>{let s=(o-(h-1)/2)*cY,l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*sY,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]}),_=Math.max(_,n.length);let v=`add-${e}-${t}`;r.push({id:v,type:`add`,position:{x:s+104,y:(u+n.length)*sY},data:{kind:`step`,key:v,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,v),g.push(v)});let v=(Math.max(_,1)+1)*sY-24;o.forEach(([t],n)=>{let a=(n-(h-1)/2)*cY;r.push({id:`lane-${e}-${t}`,type:`lane`,position:{x:a-12,y:u*sY-40},style:{width:`264px`,height:`${v}px`},zIndex:-1,data:{kind:`step`,key:t,title:t,type:``,detail:``,lane:i}})}),f&&(g.push(c),s.add(c)),l=g,u+=Math.max(_,1)+1;continue}let i=p(t,String(e+1),0,u*sY,void 0,void 0,[`steps`,e]);m(l,i,[`steps`,e-1]),l=[i],u++}r.push({id:`add-end`,type:`add`,position:{x:104,y:u*sY-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``,insertAfter:[`steps`,n.length-1]}}),m(l,`add-end`);for(let{from:e,to:t}of o){let n=a.get(e);n&&(i.some(e=>e.kind===`flow`&&e.source===n&&e.target===t)||i.push({id:`data-${n}-${t}`,source:n,target:t,kind:`data`,label:e,offset:24+14*i.filter(e=>e.kind===`data`).length,sourceHandle:`data-out`,targetHandle:`data-in`}))}return{nodes:r,edges:i}}var _Y={agent:Es,command:mc,repo:Hs,gate:uc,forge:Xs,human:_c,review:zs,workflow:bc},vY={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function yY(e){return e===`parallel`?Hs:e===`switch`?fc:_Y[e.split(`.`)[0]]??bc}function bY(e){return Object.keys(vY).map(t=>({title:vY[t],icon:_Y[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}var xY=k({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{}},emits:[`pick`],setup(e,{emit:t}){let n=t;return(t,r)=>(R(),K(z(Cl),{"model-value":e.value||void 0,"onUpdate:modelValue":r[0]||=e=>n(`pick`,String(e))},{default:j(()=>[M(z(Al),{"aria-label":e.label},{default:j(()=>[M(z(jl),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`]),M(z(wl),null,{default:j(()=>[e.value&&!e.workflows.some(t=>t.id===e.value)?(R(),K(z(Dl),{key:0,value:e.value,disabled:``},{default:j(()=>[A(B(e.value)+` (unavailable)`,1)]),_:1},8,[`value`])):L(``,!0),(R(!0),W(V,null,G(e.workflows,e=>(R(),K(z(Dl),{key:e.id,value:e.id},{default:j(()=>[A(B(e.id),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`]))}});function SY(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function CY(e,t=[]){let n=IJ(e),r=n.errors[0];if(r)return{ok:!1,message:LY(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!RY(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let o=i.steps;if(o==null||o===``)return{ok:!1,message:`workflow ${a} has no steps`};if(!Array.isArray(o))return{ok:!1,message:`workflow ${a}: steps must be a list`};if(!o.length)return{ok:!1,message:`workflow ${a} has no steps`};let s=new Map(t.map(e=>[e.name,e])),c=typeof i.repository==`string`&&i.repository.trim()?i.repository.trim():`required`,l=[],u=new Set;for(let[e,t]of o.entries()){let n=`workflow ${a} step ${e+1}`,r=VJ(t);if(r){if(r.kind===`switch`&&!r.on)return{ok:!1,message:`${n}: switch.on Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:NY(e)}))}var jY=/^(\s*)(-\s+)?/,MY=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function NY(e){let{code:t,comment:n}=PY(e),r=FY(t);return n&&r.push({text:n,kind:`comment`}),r}function PY(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t)r===t&&(t=``);else if(r===`"`||r===`'`)t=r;else if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function FY(e){if(!e)return[];let t=[],n=jY.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=MY.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,...IY(i[4]??``)]):[...t,...IY(r)]}function IY(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 LY(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function RY(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zY(e){return typeof e==`string`&&e.trim()!==``}var BY={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},VY={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},HY={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},UY={class:`min-w-0 flex-1`},WY={class:`truncate font-mono text-[11px] text-fg-subtle`},GY={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},KY={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},qY={key:1,class:`space-y-3`},JY={key:0,class:`block space-y-1.5`},YY={id:`switch-on`},XY=[`value`],ZY={class:`text-xs font-medium text-muted-foreground`},QY={class:`flex items-center gap-2`},$Y={key:1,role:`alert`,class:`text-xs text-danger`},eX={key:2,class:`space-y-1.5`},tX=[`title`],nX={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},rX={key:3,class:`divide-y divide-border rounded-md border border-border`},iX=[`title`],aX={key:0,class:`space-y-3`},oX={class:`text-[13px]`},sX={key:0,class:`text-danger`},cX={class:`ml-2 text-xs text-fg-subtle`},lX={key:1,class:`space-y-3`},uX={class:`text-[13px]`},dX={class:`ml-2 text-xs text-fg-subtle`},fX=[`title`],pX={key:0,class:`text-xs text-danger`},mX={class:`space-y-2`},hX={class:`divide-y divide-border rounded-md border border-border`},gX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},_X={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},vX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},yX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},bX={class:`flex items-center border-t border-border px-4 py-2.5`},xX=k({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,i=t,a=I(()=>UJ(n.yaml,n.path)??{}),o=I(()=>VJ(a.value)),s=I(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=I(()=>o.value?.branches.map(([e])=>e)??[]),l=I(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,WJ(n.yaml,n.path,{...a.value,switch:{...a.value.switch,on:e}}))}let d=q(``),f=q(``);function p(e,t,r=``){try{let a=e===`add`?JJ(n.yaml,n.path,t):e===`rename`?YJ(n.yaml,n.path,t,r):XJ(n.yaml,n.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=I(()=>n.vocabulary.find(e=>e.name===s.value)),h=I(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=I(()=>eY(n.yaml,n.path)),_=I(()=>m.value?.settings&&a.value.settings?OY(a.value.settings,m.value.settings,`settings`):``),v=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],y=/mission|body|detail|plan|rules/;function b(e,t){return[`workflow.call`,`workflow.handoff`].includes(s.value)&&e===`workflow`||s.value===`human.approve`&&e===`then`?`workflow`:s.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:y.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 x=I(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:b(e,t),options:s.value===`agent.run`&&e===`model`?n.modelAliases:t.enum??[]})),t=e.filter(e=>v.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>v.indexOf(e.key)-v.indexOf(t.key))[0],r=e.filter(e=>e!==t);return{lead:t,compact:r.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:r.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function S(e){let{id:t,type:r,...a}=e;i(`update:yaml`,WJ(n.yaml,n.path,{id:t,type:r,...a}))}function C(e,t){S({...a.value,[e]:t})}function w(e){C(`retry`,{...a.value.retry,...e})}function T(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,S({...a.value,settings:n})}function ee(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),S({...a.value,settings:n})}let E=I(()=>n.workflows.find(e=>e.id===h.value.workflow)),D=I(()=>Object.entries(nY(E.value?.yaml??``,`inputs`)??{})),te=I(()=>Object.entries(nY(E.value?.yaml??``,`outputs`)??{})),ne=I(()=>Object.entries(nY(n.yaml,`inputs`)??{})),re=I(()=>Object.entries(nY(n.yaml,`outputs`)??{})),ie=I(()=>h.value.inputs??{}),O=I(()=>h.value.outputs??{}),ae=e=>typeof e==`string`&&e.startsWith(`inputs.`),oe=e=>ie.value[e]===void 0?``:String(ie.value[e]);function se(e,t,n){T(`inputs`,{...ie.value,[e]:t===``?void 0:ae(t)?t:Vv(t,n??`string`)})}let ce=q(null);function le(e,t){let n=ce.value??x.value.lead?.key;if(!n)return;let r=typeof h.value[n]==`string`?h.value[n]:``,i=`{{ steps.${e}.${t} }}`;T(n,r?`${r.trimEnd()} ${i}`:i)}let ue=q({});function de(e,t){try{T(e,t.trim()?LJ(t):void 0),ue.value={...ue.value,[e]:``}}catch(t){ue.val Line truncated
`)[0]}}}let fe=e=>e===void 0?``:RJ(e).trimEnd(),pe=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),me=e=>typeof h.value[e]==`string`?h.value[e]:``;return(t,n)=>(R(),W(`aside`,BY,[U(`header`,VY,[U(`span`,HY,[(R(),K(et(z(yY)(s.value)),{class:`size-4`}))]),U(`div`,UY,[M(z(Z),{"model-value":a.value.id??``,class:`h-7 truncate border-transparent px-1 font-medium shadow-none hover:border-input dark:bg-transparent`,placeholder:z(uY)(s.value),"aria-label":`Step id`,"onUpdate:modelValue":n[0]||=e=>C(`id`,String(e))},null,8,[`model-value`,`placeholder`]),U(`div`,WY,B(s.value),1)]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:n[1]||=e=>i(`close`)},{default:j(()=>[M(z(Sc))]),_:1})]),U(`div`,GY,[_.value?(R(),W(`p`,KY,B(_.value),1)):L(``,!0),o.value?(R(),W(`section`,qY,[s.value===`switch`?(R(),W(`label`,JY,[n[18]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),M(z(Z),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`switch-on`,onChange:n[2]||=e=>u(e.target.value.trim())},null,8,[`model-value`]),U(`datalist`,YY,[(R(!0),W(V,null,G(g.value,e=>(R(),W(`option`,{key:e,value:`steps.${e}.result.`},null,8,XY))),128))])])):L(``,!0),U(`div`,ZY,B(s.value===`switch`?`Cases`:`Branches`),1),(R(!0),W(V,null,G(c.value,e=>(R(),W(`div`,{key:e,class:`flex items-center gap-2`},[M(z(Z),{"model-value":e,class:N(s.value===`switch`&&`font-mono`),"aria-label":`${s.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>p(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:j(()=>[M(z(r))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),U(`div`,QY,[M(z(Z),{modelValue:d.value,"onUpdate:modelValue":n[3]||=e=>d.value=e,"aria-label":s.value===`switch`?`New case value`:`New branch name`,placeholder:s.value===`switch`?`Value, or default`:`Branch name`,onKeydown:n[4]||=jt(Nt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),M(z(Y),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:n[5]||=e=>p(`add`,d.value.trim())},{default:j(()=>[M(z(rc))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(R(),W(`p`,$Y,B(f.value),1)):L(``,!0)])):L(``,!0),x.value.lead?(R(),W(`section`,eX,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:x.value.lead.schema.description},[A(B(pe(x.value.lead.key,x.value.lead.schema))+` `,1),x.value.lead.schema.description?(R(),K(z(Ps),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,tX),x.value.lead.kind===`workflow`?(R(),K(xY,{key:0,value:me(x.value.lead.key),workflows:e.workflows,label:pe(x.value.lead.key,x.value.lead.schema),onPick:n[6]||=e=>ee(x.value.lead.key,e)},null,8,[`value`,`workflows`,`label`])):x.value.lead.kind===`select`?(R(),K(z(kv),{key:1,size:`sm`,class:`w-full`,"model-value":me(x.value.lead.key),"onUpdate:modelValue":n[7]||=e=>T(x.value.lead.key,String(e)||void 0)},{default:j(()=>[M(z(Av),{value:``},{default:j(()=>[...n[19]||=[A(`Default`,-1)]]),_:1}),(R(!0),W(V,null,G(x.value.lead.options,e=>(R(),K(z(Av),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`model-value`])):x.value.lead.kind===`text`?(R(),K(z(Jl),{key:2,"model-value":me(x.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:n[8]||=e=>ce.value=x.value.lead.key,"onUpdate:modelValue":n[9]||=e=>T(x.value.lead.key,String(e))},null,8,[`model-value`])):(R(),K(z(Z),{key:3,"model-value":me(x.value.lead.key),onFocus:n[10]||=e=>ce.value=x.value.lead.key,"onUpdate:modelValue":n[11]||=e=>T(x.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&x.value.lead.kind!==`select`?(R(),W(`div`,nX,[n[20]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(R(!0),W(V,null,G(g.value,e=>(R(),W(V,{key:e},[M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>le(e,`summary`)},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]),M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>le(e,`result`)},{default:j(()=>[A(B(e)+`.result`,1)]),_:2},1032,[`onClick`])],64))),128))])):L(``,!0)])):L(``,!0),x.value.compact.length?(R(),W(`section`,rX,[(R(!0),W(V,null,G(x.value.compact,t=>(R(),W(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[U(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:t.schema.description},[A(B(pe(t.key,t.schema))+` `,1),t.schema.description?(R(),K(z(Ps),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,iX),t.kind===`workflow`?(R(),K(xY,{key:0,class:`max-w-48`,value:me(t.key),workflows:e.workflows,label:pe(t.key,t.schema),onPick:e=>ee(t.key,e)},null,8,[`vaLine truncated
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=lJ(cJ(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=lJ(cJ(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function pJ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new iJ||null,prettyErrors:t}}function mJ(e,t={}){let{lineCounter:n,prettyErrors:r}=pJ(t),i=new fJ(n?.addNewLine),a=new Wq(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new sq(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(lq(e,n)),o.warnings.forEach(lq(e,n))),o}function hJ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=mJ(e,n);if(!i)return null;if(i.warnings.forEach(e=>zG(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 gJ(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 PW(e)&&!r?e.toString(n):new iq(e,r,n).toString(n)}var _J=e=>typeof e==`object`&&!!e&&!Array.isArray(e),vJ=e=>_J(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function yJ(e){if(_J(e)){if(_J(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:vJ(e.parallel)};if(_J(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:vJ(e.switch.cases)}}}function bJ(e){return e.slice(2).includes(`parallel`)}function xJ(e,t){let n=mJ(e).getIn(t,!0);if(FW(n))return n.toJSON()}function SJ(e,t,n){let r=mJ(e);return r.setIn(t,r.createNode(NJ(n))),r.toString()}function CJ(e,t,n){let r=mJ(e),i=t.slice(0,-1),a=bJ(i);if(a&&![`agent.run`,`workflow.call`].includes(n))throw Error(`Branches allow only read-only agents and workflow calls.`);let o=r.getIn(i,!0);if(RW(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!RW(o))return{source:e,path:[]};let s=Math.min(Math.max(Number(t.at(-1))+1,0),o.items.length),c=n===`parallel`?{parallel:{"branch-1":[],"branch-2":[]}}:n===`switch`?{switch:{on:``,cases:{true:[],default:[]}}}:{type:n,...a&&n===`agent.run`?{settings:{read_only:!0}}:{}};return o.items.splice(s,0,r.createNode(c)),{source:r.toString(),path:[...i,s]}}function wJ(e,t){if(t===`switch`){if(!e||e.includes(`/`))throw Error(`A case is the value it matches, without a slash.`)}else if(!/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/.test(e))throw Error(`Use a lowercase branch name with letters, digits, dots or dashes.`)}function TJ(e,t){let n=e.getIn(t,!0),r=yJ(FW(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!FW(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function EJ(e,t,n){let r=mJ(e),{kind:i,branches:a}=TJ(r,t);if(wJ(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function DJ(e,t,n,r){let i=mJ(e),{kind:a,branches:o}=TJ(i,t);if(wJ(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>LW(e.key)&&e.key.value===n);if(!s||!LW(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function OJ(e,t,n){let r=mJ(e),{kind:i,branches:a}=TJ(r,t);if(i===`parallel`&&a.items.length<=2)throw Error(`Parallel needs at least two branches.`);if(a.items.length<=1)throw Error(`A switch needs at least one case.`);return Line truncated
`).find(e=>e.trim())?.trim()}}function qJ(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(UJ)].map(e=>e[1]))]}function JJ(e){let t=mJ(e).toJS(),n=WJ(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=new Set,c=`start`;r.push({id:c,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let l=[c],u=1,d=new Map,f=e=>{let t=d.get(e)??0;return d.set(e,t+1),t},p=(e,t,n,i,s,c,l,u)=>{let d=WJ(e)?e:{},p=yJ(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=WJ(d.settings)?d.settings:{},g=typeof d.id==`string`?d.id:``,_=`step-${t}`,v=s?`${s}/${g||m}`:g||m;r.push({id:_,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:g||t,title:g||HJ(m),type:m,role:IJ(m),step:l?.length===2?String(Number(l[1])+1).padStart(2,`0`):void 0,detail:p?.on?`on ${p.on.replace(/^steps\./,``)}`:GJ(m,h),summary:KJ(h),when:typeof d.when==`string`?d.when:void 0,retry:WJ(d.retry)&&typeof d.retry.attempts==`number`?d.retry.attempts:void 0,continues:d.on_failure===`continue`,branch:s,lane:u,path:l,stage:v,occurrence:f(v),...c?{resume:c}:{}}}),g&&a.set(g,_);let y=p?.on?`{{ ${p.on} }}`:``;for(let e of qJ([d.settings,y],d.when))o.push({from:e,to:_});return _},m=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,...s.has(r)?{otherwise:!0}:{},insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){let n=yJ(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*zJ,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=WJ(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=0;o.forEach(([t,n],o)=>{let s=(o-(h-1)/2)*BJ,l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*zJ,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]}),_=Math.max(_,n.length);let v=`add-${e}-${t}`;r.push({id:v,type:`add`,position:{x:s+104,y:(u+n.length)*zJ},data:{kind:`step`,key:v,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,v),g.push(v)});let v=(Math.max(_,1)+1)*zJ-24;o.forEach(([t],n)=>{let a=(n-(h-1)/2)*BJ;r.push({id:`lane-${e}-${t}`,type:`lane`,position:{x:a-12,y:u*zJ-40},style:{width:`264px`,height:`${v}px`},zIndex:-1,data:{kind:`step`,key:t,title:t,type:``,detail:``,lane:i}})}),f&&(g.push(c),s.add(c)),l=g,u+=Math.max(_,1)+1;continue}let i=p(t,String(e+1),0,u*zJ,void 0,void 0,[`steps`,e]);m(l,i,[`steps`,e-1]),l=[i],u++}r.push({id:`add-end`,type:`add`,position:{x:104,y:u*zJ-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``,insertAfter:[`steps`,n.length-1]}}),m(l,`add-end`);for(let{from:e,to:t}of o){let n=a.get(e);n&&(i.some(e=>e.kind===`flow`&&e.source===n&&e.target===t)||i.push({id:`data-${n}-${t}`,source:n,target:t,kind:`data`,label:e,offset:24+14*i.filter(e=>e.kind===`data`).length,sourceHandle:`data-out`,targetHandle:`data-in`}))}return{nodes:r,edges:i}}var YJ={agent:Es,command:mc,repo:Hs,gate:uc,forge:Xs,human:_c,review:zs,workflow:bc},XJ={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function ZJ(e){return e===`parallel`?Hs:e===`switch`?fc:YJ[e.split(`.`)[0]]??bc}function QJ(e){return Object.keys(XJ).map(t=>({title:XJ[t],icon:YJ[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}var $J=k({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{}},emits:[`pick`],setup(e,{emit:t}){let n=t;return(t,r)=>(R(),K(z(xl),{"model-value":e.value||void 0,"onUpdate:modelValue":r[0]||=e=>n(`pick`,String(e))},{default:j(()=>[M(z(Ol),{"aria-label":e.label},{default:j(()=>[M(z(kl),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`]),M(z(Sl),null,{default:j(()=>[e.value&&!e.workflows.some(t=>t.id===e.value)?(R(),K(z(Tl),{key:0,value:e.value,disabled:``},{default:j(()=>[A(B(e.value)+` (unavailable)`,1)]),_:1},8,[`value`])):L(``,!0),(R(!0),W(V,null,G(e.workflows,e=>(R(),K(z(Tl),{key:e.id,value:e.id},{default:j(()=>[A(B(e.id),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`]))}});function eY(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function tY(e,t=[]){let n=mJ(e),r=n.errors[0];if(r)return{ok:!1,message:hY(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!gY(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let o=i.steps;if(o==null||o===``)return{ok:!1,message:`workflow ${a} has no steps`};if(!Array.isArray(o))return{ok:!1,message:`workflow ${a}: steps must be a list`};if(!o.length)return{ok:!1,message:`workflow ${a} has no steps`};let s=new Map(t.map(e=>[e.name,e])),c=typeof i.repository==`string`&&i.repository.trim()?i.repository.trim():`required`,l=[],u=new Set;for(let[e,t]of o.entries()){let n=`workflow ${a} step ${e+1}`,r=yJ(t);if(r){if(r.kind===`switch`&&!r.on)return{ok:!1,message:`${n}: switch.on Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:dY(e)}))}var lY=/^(\s*)(-\s+)?/,uY=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function dY(e){let{code:t,comment:n}=fY(e),r=pY(t);return n&&r.push({text:n,kind:`comment`}),r}function fY(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t)r===t&&(t=``);else if(r===`"`||r===`'`)t=r;else if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function pY(e){if(!e)return[];let t=[],n=lY.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=uY.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,...mY(i[4]??``)]):[...t,...mY(r)]}function mY(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 hY(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function gY(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _Y(e){return typeof e==`string`&&e.trim()!==``}var vY={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},yY={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},bY={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},xY={class:`min-w-0 flex-1`},SY={class:`truncate font-mono text-[11px] text-fg-subtle`},CY={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},wY={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},TY={key:1,class:`space-y-3`},EY={key:0,class:`block space-y-1.5`},DY={id:`switch-on`},OY=[`value`],kY={class:`text-xs font-medium text-muted-foreground`},AY={class:`flex items-center gap-2`},jY={key:1,role:`alert`,class:`text-xs text-danger`},MY={key:2,class:`space-y-1.5`},NY=[`title`],PY={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},FY={key:3,class:`divide-y divide-border rounded-md border border-border`},IY=[`title`],LY={key:0,class:`space-y-3`},RY={class:`text-[13px]`},zY={key:0,class:`text-danger`},BY={class:`ml-2 text-xs text-fg-subtle`},VY={key:1,class:`space-y-3`},HY={class:`text-[13px]`},UY={class:`ml-2 text-xs text-fg-subtle`},WY=[`title`],GY={key:0,class:`text-xs text-danger`},KY={class:`space-y-2`},qY={class:`divide-y divide-border rounded-md border border-border`},JY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},YY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},XY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},ZY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},QY={class:`flex items-center border-t border-border px-4 py-2.5`},$Y=k({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,i=t,a=I(()=>xJ(n.yaml,n.path)??{}),o=I(()=>yJ(a.value)),s=I(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=I(()=>o.value?.branches.map(([e])=>e)??[]),l=I(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,SJ(n.yaml,n.path,{...a.value,switch:{...a.value.switch,on:e}}))}let d=q(``),f=q(``);function p(e,t,r=``){try{let a=e===`add`?EJ(n.yaml,n.path,t):e===`rename`?DJ(n.yaml,n.path,t,r):OJ(n.yaml,n.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=I(()=>n.vocabulary.find(e=>e.name===s.value)),h=I(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=I(()=>MJ(n.yaml,n.path)),_=I(()=>m.value?.settings&&a.value.settings?oY(a.value.settings,m.value.settings,`settings`):``),v=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],y=/mission|body|detail|plan|rules/;function b(e,t){return[`workflow.call`,`workflow.handoff`].includes(s.value)&&e===`workflow`||s.value===`human.approve`&&e===`then`?`workflow`:s.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:y.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 x=I(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:b(e,t),options:s.value===`agent.run`&&e===`model`?n.modelAliases:t.enum??[]})),t=e.filter(e=>v.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>v.indexOf(e.key)-v.indexOf(t.key))[0],r=e.filter(e=>e!==t);return{lead:t,compact:r.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:r.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function S(e){let{id:t,type:r,...a}=e;i(`update:yaml`,SJ(n.yaml,n.path,{id:t,type:r,...a}))}function C(e,t){S({...a.value,[e]:t})}function w(e){C(`retry`,{...a.value.retry,...e})}function T(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,S({...a.value,settings:n})}function ee(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),S({...a.value,settings:n})}let E=I(()=>n.workflows.find(e=>e.id===h.value.workflow)),D=I(()=>Object.entries(PJ(E.value?.yaml??``,`inputs`)??{})),te=I(()=>Object.entries(PJ(E.value?.yaml??``,`outputs`)??{})),ne=I(()=>Object.entries(PJ(n.yaml,`inputs`)??{})),re=I(()=>Object.entries(PJ(n.yaml,`outputs`)??{})),ie=I(()=>h.value.inputs??{}),O=I(()=>h.value.outputs??{}),ae=e=>typeof e==`string`&&e.startsWith(`inputs.`),oe=e=>ie.value[e]===void 0?``:String(ie.value[e]);function se(e,t,n){T(`inputs`,{...ie.value,[e]:t===``?void 0:ae(t)?t:Rv(t,n??`string`)})}let ce=q(null);function le(e,t){let n=ce.value??x.value.lead?.key;if(!n)return;let r=typeof h.value[n]==`string`?h.value[n]:``,i=`{{ steps.${e}.${t} }}`;T(n,r?`${r.trimEnd()} ${i}`:i)}let ue=q({});function de(e,t){try{T(e,t.trim()?hJ(t):void 0),ue.value={...ue.value,[e]:``}}catch(t){ue.val Line truncated
`)[0]}}}let fe=e=>e===void 0?``:gJ(e).trimEnd(),pe=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),me=e=>typeof h.value[e]==`string`?h.value[e]:``;return(t,n)=>(R(),W(`aside`,vY,[U(`header`,yY,[U(`span`,bY,[(R(),K(et(z(ZJ)(s.value)),{class:`size-4`}))]),U(`div`,xY,[M(z(Z),{"model-value":a.value.id??``,class:`h-7 truncate border-transparent px-1 font-medium shadow-none hover:border-input dark:bg-transparent`,placeholder:z(HJ)(s.value),"aria-label":`Step id`,"onUpdate:modelValue":n[0]||=e=>C(`id`,String(e))},null,8,[`model-value`,`placeholder`]),U(`div`,SY,B(s.value),1)]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:n[1]||=e=>i(`close`)},{default:j(()=>[M(z(Sc))]),_:1})]),U(`div`,CY,[_.value?(R(),W(`p`,wY,B(_.value),1)):L(``,!0),o.value?(R(),W(`section`,TY,[s.value===`switch`?(R(),W(`label`,EY,[n[18]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),M(z(Z),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`switch-on`,onChange:n[2]||=e=>u(e.target.value.trim())},null,8,[`model-value`]),U(`datalist`,DY,[(R(!0),W(V,null,G(g.value,e=>(R(),W(`option`,{key:e,value:`steps.${e}.result.`},null,8,OY))),128))])])):L(``,!0),U(`div`,kY,B(s.value===`switch`?`Cases`:`Branches`),1),(R(!0),W(V,null,G(c.value,e=>(R(),W(`div`,{key:e,class:`flex items-center gap-2`},[M(z(Z),{"model-value":e,class:N(s.value===`switch`&&`font-mono`),"aria-label":`${s.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>p(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:j(()=>[M(z(r))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),U(`div`,AY,[M(z(Z),{modelValue:d.value,"onUpdate:modelValue":n[3]||=e=>d.value=e,"aria-label":s.value===`switch`?`New case value`:`New branch name`,placeholder:s.value===`switch`?`Value, or default`:`Branch name`,onKeydown:n[4]||=jt(Nt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),M(z(Y),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:n[5]||=e=>p(`add`,d.value.trim())},{default:j(()=>[M(z(rc))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(R(),W(`p`,jY,B(f.value),1)):L(``,!0)])):L(``,!0),x.value.lead?(R(),W(`section`,MY,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:x.value.lead.schema.description},[A(B(pe(x.value.lead.key,x.value.lead.schema))+` `,1),x.value.lead.schema.description?(R(),K(z(Ps),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,NY),x.value.lead.kind===`workflow`?(R(),K($J,{key:0,value:me(x.value.lead.key),workflows:e.workflows,label:pe(x.value.lead.key,x.value.lead.schema),onPick:n[6]||=e=>ee(x.value.lead.key,e)},null,8,[`value`,`workflows`,`label`])):x.value.lead.kind===`select`?(R(),K(z(Ev),{key:1,size:`sm`,class:`w-full`,"model-value":me(x.value.lead.key),"onUpdate:modelValue":n[7]||=e=>T(x.value.lead.key,String(e)||void 0)},{default:j(()=>[M(z(Dv),{value:``},{default:j(()=>[...n[19]||=[A(`Default`,-1)]]),_:1}),(R(!0),W(V,null,G(x.value.lead.options,e=>(R(),K(z(Dv),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`model-value`])):x.value.lead.kind===`text`?(R(),K(z(Kl),{key:2,"model-value":me(x.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:n[8]||=e=>ce.value=x.value.lead.key,"onUpdate:modelValue":n[9]||=e=>T(x.value.lead.key,String(e))},null,8,[`model-value`])):(R(),K(z(Z),{key:3,"model-value":me(x.value.lead.key),onFocus:n[10]||=e=>ce.value=x.value.lead.key,"onUpdate:modelValue":n[11]||=e=>T(x.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&x.value.lead.kind!==`select`?(R(),W(`div`,PY,[n[20]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(R(!0),W(V,null,G(g.value,e=>(R(),W(V,{key:e},[M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>le(e,`summary`)},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]),M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>le(e,`result`)},{default:j(()=>[A(B(e)+`.result`,1)]),_:2},1032,[`onClick`])],64))),128))])):L(``,!0)])):L(``,!0),x.value.compact.length?(R(),W(`section`,FY,[(R(!0),W(V,null,G(x.value.compact,t=>(R(),W(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[U(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:t.schema.description},[A(B(pe(t.key,t.schema))+` `,1),t.schema.description?(R(),K(z(Ps),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,IY),t.kind===`workflow`?(R(),K($J,{key:0,class:`max-w-48`,value:me(t.key),workflows:e.workflows,label:pe(t.key,t.schema),onPick:e=>ee(t.key,e)},null,8,[`vaLine truncated
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>T(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(R(),W(V,{key:2},[M(z(Jl),{"model-value":fe(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>de(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),ue.value[e.key]?(R(),W(`span`,pX,B(ue.value[e.key]),1)):L(``,!0)],64))]))),128)),U(`section`,mX,[n[37]||=U(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),U(`div`,hX,[U(`label`,gX,[n[31]||=U(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),M(z(Z),{class:`h-7 w-48 font-mono text-xs`,placeholder:`always`,"model-value":a.value.when??``,"onUpdate:modelValue":n[12]||=e=>C(`when`,String(e))},null,8,[`model-value`])]),U(`label`,_X,[n[34]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),M(z(kv),{size:`sm`,"model-value":a.value.on_failure??``,"onUpdate:modelValue":n[13]||=e=>C(`on_failure`,String(e)||void 0)},{default:j(()=>[M(z(Av),{value:``},{default:j(()=>[...n[32]||=[A(`Park the task`,-1)]]),_:1}),M(z(Av),{value:`continue`},{default:j(()=>[...n[33]||=[A(`Continue`,-1)]]),_:1})]),_:1},8,[`model-value`])]),U(`label`,vX,[n[35]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),M(z(Z),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 text-right text-[13px]`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":n[14]||=e=>w({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),U(`label`,yX,[n[36]||=U(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),M(z(ph),{"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":n[15]||=e=>w({backoff:e||void 0})},null,8,[`model-value`])])])])]),U(`footer`,bX,[M(z(Y),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:n[16]||=e=>i(`remove`)},{default:j(()=>[M(z(r)),n[38]||=A(`Delete step`,-1)]),_:1}),M(z(Y),{type:`button`,size:`sm`,class:`ml-auto`,onClick:n[17]||=e=>i(`close`)},{default:j(()=>[...n[39]||=[A(`Done`,-1)]]),_:1})])]))}}),SX=`repository_path`;function CX(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:SX,path:n.trim(),type:`string`,required:!0}),r}function wX(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function TX(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=wX(Cb(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 EX(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:Cb(e.value,i.type??`string`)})}return n}function DX(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 OX(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...OX(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...OX(n,r)]}):[]}function kX(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function AX(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 jX(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var MX={class:`flex h-full flex-col`},NX={class:`flex items-center gap-2 border-b border-border px-4 py-3`},PX={class:`min-w-0 flex-1 truncate text-sm font-medium`},FX={key:0,class:`flex flex-1 items-center justify-center`},IX={class:`space-y-1.5`},LX={key:1,class:`space-y-1.5`},RX=[`title`],zX={class:`space-y-1.5`},BX={id:`bind-paths`},VX=[`value`],HX={class:`divide-y divide-border rounded-md border border-border`},UX={class:`flex items-center gap-1.5 text-xs`},WX={class:`font-mono`},GX={class:`text-fg-subtle`},KX={key:0,class:`text-danger`,title:`Required`},qX={key:2,class:`text-xs text-danger`},JX=[`title`],YX={key:0,class:`space-y-1 px-3 py-2`},XX={key:0,class:`text-xs text-danger`},ZX={key:1,class:`truncate font-mono text-xs text-success`},QX={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},$X={class:`space-y-2`},eZ={key:0,role:`alert`,class:`text-xs text-danger`},tZ={key:1,class:`text-xs text-fg-subtle`},nZ={class:`flex flex-wrap gap-2`},rZ=`__new__`,iZ=k({__name:`BindEvent`,props:{yaml:{},binding:{}},emits:[`back`,`saved`],setup(e,{emit:t}){let n Line truncated
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(R(),W(V,{key:2},[M(z(Kl),{"model-value":fe(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>de(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),ue.value[e.key]?(R(),W(`span`,GY,B(ue.value[e.key]),1)):L(``,!0)],64))]))),128)),U(`section`,KY,[n[37]||=U(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),U(`div`,qY,[U(`label`,JY,[n[31]||=U(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),M(z(Z),{class:`h-7 w-48 font-mono text-xs`,placeholder:`always`,"model-value":a.value.when??``,"onUpdate:modelValue":n[12]||=e=>C(`when`,String(e))},null,8,[`model-value`])]),U(`label`,YY,[n[34]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),M(z(Ev),{size:`sm`,"model-value":a.value.on_failure??``,"onUpdate:modelValue":n[13]||=e=>C(`on_failure`,String(e)||void 0)},{default:j(()=>[M(z(Dv),{value:``},{default:j(()=>[...n[32]||=[A(`Park the task`,-1)]]),_:1}),M(z(Dv),{value:`continue`},{default:j(()=>[...n[33]||=[A(`Continue`,-1)]]),_:1})]),_:1},8,[`model-value`])]),U(`label`,XY,[n[35]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),M(z(Z),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 text-right text-[13px]`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":n[14]||=e=>w({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),U(`label`,ZY,[n[36]||=U(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),M(z(uh),{"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":n[15]||=e=>w({backoff:e||void 0})},null,8,[`model-value`])])])])]),U(`footer`,QY,[M(z(Y),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:n[16]||=e=>i(`remove`)},{default:j(()=>[M(z(r)),n[38]||=A(`Delete step`,-1)]),_:1}),M(z(Y),{type:`button`,size:`sm`,class:`ml-auto`,onClick:n[17]||=e=>i(`close`)},{default:j(()=>[...n[39]||=[A(`Done`,-1)]]),_:1})])]))}}),eX=`repository_path`;function tX(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:eX,path:n.trim(),type:`string`,required:!0}),r}function nX(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function rX(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=nX(bb(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 iX(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:bb(e.value,i.type??`string`)})}return n}function aX(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 oX(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...oX(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...oX(n,r)]}):[]}function sX(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function cX(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 lX(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var uX={class:`flex h-full flex-col`},dX={class:`flex items-center gap-2 border-b border-border px-4 py-3`},fX={class:`min-w-0 flex-1 truncate text-sm font-medium`},pX={key:0,class:`flex flex-1 items-center justify-center`},mX={class:`space-y-1.5`},hX={key:1,class:`space-y-1.5`},gX=[`title`],_X={class:`space-y-1.5`},vX={id:`bind-paths`},yX=[`value`],bX={class:`divide-y divide-border rounded-md border border-border`},xX={class:`flex items-center gap-1.5 text-xs`},SX={class:`font-mono`},CX={class:`text-fg-subtle`},wX={key:0,class:`text-danger`,title:`Required`},TX={key:2,class:`text-xs text-danger`},EX=[`title`],DX={key:0,class:`space-y-1 px-3 py-2`},OX={key:0,class:`text-xs text-danger`},kX={key:1,class:`truncate font-mono text-xs text-success`},AX={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},jX={class:`space-y-2`},MX={key:0,role:`alert`,class:`text-xs text-danger`},NX={key:1,class:`text-xs text-fg-subtle`},PX={class:`flex flex-wrap gap-2`},FX=`__new__`,IX=k({__name:`BindEvent`,props:{yaml:{},binding:{}},emits:[`back`,`saved`],setup(e,{emit:t}){let n Line truncated
`).replace(`
`,`
+`).split(`
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function o3(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=s3(n.code,e);return Array.isArray(e)?e.some(e=>a3(n[r],e,t,n.type===`keyup`)):a3(n[r],e,t,n.type===`keyup`)}}function s3(e,t){return t.includes(e)?`code`:`key`}function c3(e,t){let n=I(()=>Ue(t?.target)??n3),r=Qe(Ue(e)===!0),i=!1,a=new Set,o=c(Ue(e));F(()=>Ue(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),eQ([`blur`,`contextmenu`],s),nQ((...e)=>o(...e),e=>{let n=Ue(t?.actInsideInputWithModifier)??!0,a=Ue(t?.preventDefault)??!1;if(i=i3(e),(!i||i&&!n)&&r3(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}),nQ((...e)=>o(...e),e=>{let n=Ue(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&r3(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Ue(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?o3(e,a):e}return r}var l3=`vue-flow__node-desc`,u3=`vue-flow__edge-desc`,d3=`vue-flow__aria-live`,f3=[`Enter`,` `,`Escape`],p3={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function m3(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function h3(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 g3(e){return{width:e.offsetWidth,height:e.offsetHeight}}function _3(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function v3(e,t){return{x:_3(e.x,t[0][0],t[1][0]),y:_3(e.y,t[0][1],t[1][1])}}function y3(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function b3(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function x3(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!b3(e)}function S3(e){return x3(e)&&`computedPosition`in e}function C3(e){return!Number.isNaN(e)&&Number.isFinite(e)}function w3(e){return C3(e.width)&&C3(e.height)&&C3(e.x)&&C3(e.y)}function T3(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:xt({width:0,height:0}),computedPosition:xt({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:H6(e.data)?e.data:{},events:xt(H6(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function E3(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:H6(e.data)?e.data:{},events:xt(H6(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function D3(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 O3(...e){if(e.length===3){let[t,n,r]=e;return D3(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>b3(e)&&e.source===r).map(e=>n.find(t=>x3(t)&&t.id===e.target))}function k3(...e){if(e.length===3){let[t,n,r]=e;return D3(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>b3(e)&&e.target===r).map(e=>n.find(t=>x3(t)&&t.id===e.source))}function A3({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function j3(e,t){return t.some(t=>b3(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 M3({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function N3({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?T6(s,o):s}function P3(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 F3({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function I3({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function L3(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=P3(t,F3({...r.computedPosition,...r.dimensions}))}return I3(t)}function R3(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...N3(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= Line truncated
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function R4(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=z4(n.code,e);return Array.isArray(e)?e.some(e=>L4(n[r],e,t,n.type===`keyup`)):L4(n[r],e,t,n.type===`keyup`)}}function z4(e,t){return t.includes(e)?`code`:`key`}function B4(e,t){let n=I(()=>Ue(t?.target)??P4),r=Qe(Ue(e)===!0),i=!1,a=new Set,o=c(Ue(e));F(()=>Ue(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),MZ([`blur`,`contextmenu`],s),PZ((...e)=>o(...e),e=>{let n=Ue(t?.actInsideInputWithModifier)??!0,a=Ue(t?.preventDefault)??!1;if(i=I4(e),(!i||i&&!n)&&F4(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}),PZ((...e)=>o(...e),e=>{let n=Ue(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&F4(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Ue(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?R4(e,a):e}return r}var V4=`vue-flow__node-desc`,H4=`vue-flow__edge-desc`,U4=`vue-flow__aria-live`,W4=[`Enter`,` `,`Escape`],G4={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function K4(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function q4(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 J4(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Y4(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function X4(e,t){return{x:Y4(e.x,t[0][0],t[1][0]),y:Y4(e.y,t[0][1],t[1][1])}}function Z4(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function Q4(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function $4(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!Q4(e)}function e3(e){return $4(e)&&`computedPosition`in e}function t3(e){return!Number.isNaN(e)&&Number.isFinite(e)}function n3(e){return t3(e.width)&&t3(e.height)&&t3(e.x)&&t3(e.y)}function r3(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:xt({width:0,height:0}),computedPosition:xt({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:b6(e.data)?e.data:{},events:xt(b6(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function i3(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:b6(e.data)?e.data:{},events:xt(b6(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function a3(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 o3(...e){if(e.length===3){let[t,n,r]=e;return a3(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>Q4(e)&&e.source===r).map(e=>n.find(t=>$4(t)&&t.id===e.target))}function s3(...e){if(e.length===3){let[t,n,r]=e;return a3(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>Q4(e)&&e.target===r).map(e=>n.find(t=>$4(t)&&t.id===e.source))}function c3({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function l3(e,t){return t.some(t=>Q4(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 u3({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function d3({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?r6(s,o):s}function f3(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 p3({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function m3({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function h3(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=f3(t,p3({...r.computedPosition,...r.dimensions}))}return m3(t)}function g3(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...d3(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= Line truncated
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
Node: ${e}
@@ -158,6 +158,6 @@ Edge: ${e}
Source: ${t}
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},y6=class extends Error{constructor(e,...t){super(v6[e]?.call(v6,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function b6(e){return`clientX`in e}function x6(e){return`sourceEvent`in e}function S6(e,t){let n=b6(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 C6=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function w6(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function T6(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var E6=()=>!0;function D6(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function O6(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())h3(i,m3(e))>0&&r.push(e);return r}var k6=250;function A6(e,t,n,r){let i=[],a=1/0,o=O6(e,n,t+k6);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}=p6(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 j6(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=E6},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:_}=S6(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=M6(void 0,y),t=y.getAttribute(`data-nodeid`),a=y.getAttribute(`data-handleid`),o=y.classList.contains(`connectable`),s=y.classList.contains(`connectableend`);if(!t||!e)return b;let c={source:m?t:r,sourceHandle:m?a:i,target:m?r:t,targetHandle:m?i:a};b.connection=c,b.isValid=o&&s&&(n===Z4.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=F6(t,e,a,p,n,!0)}return b}function M6(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function N6(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function P6(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function F6(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===Z4.Strict?o.handleBounds?.[t]:[...o.handleBounds?.source??[],...o.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...p6(o,c,c.position,!0)}:c}var I6={[J4.Left]:J4.Right,[J4.Right]:J4.Left,[J4.Top]:J4.Bottom,[J4.Bottom]:J4.Top},L6=[`production`,`prod`];function R6(e,...t){z6()&&console.warn(`[Vue Flow]: ${e}`,...t)}function z6(){return!L6.includes(`production`)}function B6(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,...g3(t)}}):null}function V6(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),yt(()=>{o.blur()})):n([e])}function H6(e){return z(e)!==void 0}function U6(e,t,n,r){if(!e||!e.source||!e.target)return n(new y6(_6.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=b3(e)?e:{...e,id:A3(e)},i=E3(i,void 0,r),!j3(i,t)&&i}function W6(e,t,n,r,i){if(!t.source||!t.target)return i(new y6(_6.EDGE_INVALID,e.id)),!1;if(!n)return i(new y6(_6.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?A3(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function G6(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!x3(o)){n(new y6(_6.NODE_INVALID,o?.id));continue}let s=T3(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 y6(_6.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 K6(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 q6(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}`;K6(`source`,o,`${r}-${a}--Line truncated
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},Z3=class extends Error{constructor(e,...t){super(X3[e]?.call(X3,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function Q3(e){return`clientX`in e}function $3(e){return`sourceEvent`in e}function e6(e,t){let n=Q3(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 t6=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function n6(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function r6(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var i6=()=>!0;function a6(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function o6(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())q4(i,K4(e))>0&&r.push(e);return r}var s6=250;function c6(e,t,n,r){let i=[],a=1/0,o=o6(e,n,t+s6);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}=G3(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 l6(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=i6},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:_}=e6(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=u6(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===k4.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=p6(t,e,a,p,n,!0)}return b}function u6(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function d6(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function f6(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function p6(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===k4.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,...G3(o,c,c.position,!0)}:c}var m6={[E4.Left]:E4.Right,[E4.Right]:E4.Left,[E4.Top]:E4.Bottom,[E4.Bottom]:E4.Top},h6=[`production`,`prod`];function g6(e,...t){_6()&&console.warn(`[Vue Flow]: ${e}`,...t)}function _6(){return!h6.includes(`production`)}function v6(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,...J4(t)}}):null}function y6(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),yt(()=>{o.blur()})):n([e])}function b6(e){return z(e)!==void 0}function x6(e,t,n,r){if(!e||!e.source||!e.target)return n(new Z3(Y3.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=Q4(e)?e:{...e,id:c3(e)},i=i3(i,void 0,r),!l3(i,t)&&i}function S6(e,t,n,r,i){if(!t.source||!t.target)return i(new Z3(Y3.EDGE_INVALID,e.id)),!1;if(!n)return i(new Z3(Y3.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?c3(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function C6(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!$4(o)){n(new Z3(Y3.NODE_INVALID,o?.id));continue}let s=r3(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 Z3(Y3.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 w6(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 T6(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}`;w6(`source`,o,`${r}-${a}--Line truncated
`),r=t.split(`
`),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function u9(e){let t=IJ(e).toJS(),n=new Map;for(let r of gY(e).nodes){let{kind:e,path:i,stage:a,occurrence:o}=r.data;if(r.type!==`step`||e!==`step`||!i||a===void 0)continue;let s=t;for(let e of i)s=s?.[e];n.set(`${a}#${o??0}`,{node:r.id,signature:JSON.stringify(s??null)})}return n}function d9(e,t,n){let r=u9(e),i=u9(t),a={};for(let[e,t]of r){let r=i.get(e);r?r.signature!==t.signature&&(a[t.node]=`changed`):a[t.node]=n}return a}var f9={class:`grid h-[calc(100dvh-17rem)] min-h-[26rem] grid-cols-[18rem_1fr] gap-3`},p9={class:`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,"aria-label":`Revisions`},m9=[`aria-current`,`onClick`],h9={class:`flex items-center gap-2 text-sm`},g9={class:`font-mono text-xs text-fg-subtle`},_9=[`title`],v9={key:0,class:`px-3 py-2 text-sm text-muted-foreground`},y9={key:0,class:`flex min-h-0 flex-col gap-2`},b9={class:`flex items-center gap-2`},x9={class:`text-xs text-muted-foreground`},S9={key:0,class:`rounded-lg border border-border p-4 text-sm text-muted-foreground`},C9={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},w9={class:`inline-block w-4 select-none text-fg-subtle`},T9={key:2,class:`grid min-h-0 flex-1 grid-cols-2 gap-3`},E9={class:`flex min-h-0 flex-col gap-1`},D9={class:`text-xs font-medium text-muted-foreground`},O9={class:`min-h-0 flex-1`},k9={class:`flex min-h-0 flex-col gap-1`},A9={class:`min-h-0 flex-1`},j9=k({__name:`WorkflowHistory`,props:ht({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:ht([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=Ke(e,`selected`),a=Ke(e,`mode`);F(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=I(()=>n.revisions.find(e=>e.version===i.value)),s=I(()=>o.value?.yaml??null),c=I(()=>s.value===null?[]:l9(s.value,n.current)),l=I(()=>s.value!==null&&s.value===n.current),u=I(()=>s.value===null?{}:d9(s.value,n.current,`removed`)),d=I(()=>s.value===null?{}:d9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(R(),W(`div`,f9,[U(`ol`,p9,[(R(!0),W(V,null,G(e.revisions,e=>(R(),W(`li`,{key:e.version},[U(`button`,{type:`button`,class:N([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[U(`span`,h9,[U(`span`,g9,`v`+B(e.version),1),M(z($t),{variant:f[e.change]},{default:j(()=>[A(B(e.change),1)]),_:2},1032,[`variant`])]),U(`span`,{class:`mt-0.5 block truncate text-xs text-muted-foreground`,title:e.at},B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `+B(z(Sg)(e.at)),9,_9)],10,m9)]))),128)),e.revisions.length?L(``,!0):(R(),W(`li`,v9,B(e.error||`No recorded changes`),1))]),o.value?(R(),W(`div`,y9,[U(`div`,b9,[M(z(ub),{modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e},{default:j(()=>[M(z(fb),null,{default:j(()=>[M(z(pb),{value:`yaml`},{default:j(()=>[...n[2]||=[A(`YAML`,-1)]]),_:1}),M(z(pb),{value:`canvas`},{default:j(()=>[...n[3]||=[A(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),U(`span`,x9,B(l.value?`Same as the current definition`:`Compared with the current definition`),1),M(z(Y),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[1]||=e=>r(`restore`,s.value)},{default:j(()=>[M(z(oc),{"data-icon":`inline-start`}),n[4]||=A(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(R(),W(`p`,S9,`Workflow removed in this revision.`)):a.value===`yaml`?(R(),W(`pre`,C9,[U(`code`,null,[(R(!0),W(V,null,G(c.value,(e,t)=>(R(),W(`span`,{key:t,class:N([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-ok/10":e.kind===`add`,"bg-danger/10 text-danger":e.kind===`del`}])},[U(`span`,w9,B(e.kind===`add`?`+`:e.kind===`del`?`-`:``),1),A(B(e.text),1)],2))),128))])])):(R(),W(`div`,T9,[U(`div`,E9,[U(`span`,D9,`v`+B(o.value.version),1),U(`div`,O9,[M(a9,{yaml:s.value,marks:u.value},null,8,[`yaml`,`marks`])])]),U(`div`,k9,[n[5]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`},`Current`,-1),U(`div`,A9,[M(a9,{yaml:e.current,marks:d.value},null,8,[`yaml`,`marks`])])])]))])):L(``,!0)]))}}),M9=`workflow-definitions`;function N9(e){let t=O(),n=q([]),r=q(``);async function i(){try{n.value=await t.history(M9),r.value=``}c Line truncated
`),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function H7(e){let t=mJ(e).toJS(),n=new Map;for(let r of JJ(e).nodes){let{kind:e,path:i,stage:a,occurrence:o}=r.data;if(r.type!==`step`||e!==`step`||!i||a===void 0)continue;let s=t;for(let e of i)s=s?.[e];n.set(`${a}#${o??0}`,{node:r.id,signature:JSON.stringify(s??null)})}return n}function U7(e,t,n){let r=H7(e),i=H7(t),a={};for(let[e,t]of r){let r=i.get(e);r?r.signature!==t.signature&&(a[t.node]=`changed`):a[t.node]=n}return a}var W7={class:`grid h-[calc(100dvh-17rem)] min-h-[26rem] grid-cols-[18rem_1fr] gap-3`},G7={class:`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,"aria-label":`Revisions`},K7=[`aria-current`,`onClick`],q7={class:`flex items-center gap-2 text-sm`},J7={class:`font-mono text-xs text-fg-subtle`},Y7=[`title`],X7={key:0,class:`px-3 py-2 text-sm text-muted-foreground`},Z7={key:0,class:`flex min-h-0 flex-col gap-2`},Q7={class:`flex items-center gap-2`},$7={class:`text-xs text-muted-foreground`},e9={key:0,class:`rounded-lg border border-border p-4 text-sm text-muted-foreground`},t9={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},n9={class:`inline-block w-4 select-none text-fg-subtle`},r9={key:2,class:`grid min-h-0 flex-1 grid-cols-2 gap-3`},i9={class:`flex min-h-0 flex-col gap-1`},a9={class:`text-xs font-medium text-muted-foreground`},o9={class:`min-h-0 flex-1`},s9={class:`flex min-h-0 flex-col gap-1`},c9={class:`min-h-0 flex-1`},l9=k({__name:`WorkflowHistory`,props:ht({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:ht([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=Ke(e,`selected`),a=Ke(e,`mode`);F(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=I(()=>n.revisions.find(e=>e.version===i.value)),s=I(()=>o.value?.yaml??null),c=I(()=>s.value===null?[]:V7(s.value,n.current)),l=I(()=>s.value!==null&&s.value===n.current),u=I(()=>s.value===null?{}:U7(s.value,n.current,`removed`)),d=I(()=>s.value===null?{}:U7(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(R(),W(`div`,W7,[U(`ol`,G7,[(R(!0),W(V,null,G(e.revisions,e=>(R(),W(`li`,{key:e.version},[U(`button`,{type:`button`,class:N([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[U(`span`,q7,[U(`span`,J7,`v`+B(e.version),1),M(z($t),{variant:f[e.change]},{default:j(()=>[A(B(e.change),1)]),_:2},1032,[`variant`])]),U(`span`,{class:`mt-0.5 block truncate text-xs text-muted-foreground`,title:e.at},B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `+B(z(yg)(e.at)),9,Y7)],10,K7)]))),128)),e.revisions.length?L(``,!0):(R(),W(`li`,X7,B(e.error||`No recorded changes`),1))]),o.value?(R(),W(`div`,Z7,[U(`div`,Q7,[M(z(sb),{modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e},{default:j(()=>[M(z(lb),null,{default:j(()=>[M(z(ub),{value:`yaml`},{default:j(()=>[...n[2]||=[A(`YAML`,-1)]]),_:1}),M(z(ub),{value:`canvas`},{default:j(()=>[...n[3]||=[A(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),U(`span`,$7,B(l.value?`Same as the current definition`:`Compared with the current definition`),1),M(z(Y),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[1]||=e=>r(`restore`,s.value)},{default:j(()=>[M(z(oc),{"data-icon":`inline-start`}),n[4]||=A(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(R(),W(`p`,e9,`Workflow removed in this revision.`)):a.value===`yaml`?(R(),W(`pre`,t9,[U(`code`,null,[(R(!0),W(V,null,G(c.value,(e,t)=>(R(),W(`span`,{key:t,class:N([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-ok/10":e.kind===`add`,"bg-danger/10 text-danger":e.kind===`del`}])},[U(`span`,n9,B(e.kind===`add`?`+`:e.kind===`del`?`-`:``),1),A(B(e.text),1)],2))),128))])])):(R(),W(`div`,r9,[U(`div`,i9,[U(`span`,a9,`v`+B(o.value.version),1),U(`div`,o9,[M(L7,{yaml:s.value,marks:u.value},null,8,[`yaml`,`marks`])])]),U(`div`,s9,[n[5]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`},`Current`,-1),U(`div`,c9,[M(L7,{yaml:e.current,marks:d.value},null,8,[`yaml`,`marks`])])])]))])):L(``,!0)]))}}),u9=`workflow-definitions`;function d9(e){let t=O(),n=q([]),r=q(``);async function i(){try{n.value=await t.history(u9),r.value=``}c Line truncated
+6 -16
View File
@@ -2,35 +2,25 @@
import { computed } from "vue";
import { Button } from "@/components/ui/button";
import { selectorData, setModel, setPersona } from "./state";
import { selectorData, setModel } from "./state";
const props = defineProps<{ choose: "model" | "personality" }>();
defineProps<{ choose: "model" }>();
const options = computed(() =>
props.choose === "model" ? (selectorData.value.models ?? []) : (selectorData.value.personas ?? []),
);
const active = computed(() =>
props.choose === "model" ? selectorData.value.active_model : selectorData.value.active_persona,
);
function pick(value: string) {
if (props.choose === "model") void setModel(value);
else setPersona(value);
}
const options = computed(() => selectorData.value.models ?? []);
</script>
<template>
<div class="text-sm">
<p class="font-medium">{{ choose === "model" ? "Choose a model" : "Choose a personality" }}</p>
<p class="font-medium">Choose a model</p>
<p v-if="!options.length" class="mt-1 text-fg-muted">None configured.</p>
<div v-else class="mt-2 flex flex-wrap gap-2">
<Button
v-for="option in options"
:key="option"
size="sm"
:variant="option === active ? 'default' : 'outline'"
:variant="option === selectorData.active_model ? 'default' : 'outline'"
class="font-mono"
@click="pick(option)"
@click="void setModel(option)"
>{{ option }}</Button
>
</div>
-26
View File
@@ -20,11 +20,9 @@ import {
import {
currentModels,
selectedModel,
selectedPersona,
selectedProvider,
selectorData,
setModel,
setPersona,
setProvider,
statusText,
useEscapeLayer,
@@ -49,7 +47,6 @@ const DEFAULT = "__default__";
const open = ref(false);
useEscapeLayer(open);
const personaValue = computed(() => selectedPersona.value || DEFAULT);
const providerValue = computed(() => selectedProvider.value || DEFAULT);
const modelValue = computed(() => selectedModel.value || DEFAULT);
@@ -73,29 +70,6 @@ function clear(value: unknown): string {
<PopoverContent align="end" class="grid w-64 gap-3">
<span class="text-xs text-fg-subtle">{{ statusText }}</span>
<Field class="gap-1">
<FieldLabel class="text-xs text-fg-muted">Personality</FieldLabel>
<Select
:model-value="personaValue"
@update:model-value="setPersona(clear($event))"
>
<SelectTrigger size="sm" class="w-full" aria-label="Personality">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectItem :value="DEFAULT">Default</SelectItem>
<SelectItem
v-for="name in selectorData.personas || []"
:key="name"
:value="name"
>{{ name }}</SelectItem
>
</SelectGroup>
</SelectContent>
</Select>
</Field>
<Field v-if="(selectorData.providers || []).length" class="gap-1">
<FieldLabel class="text-xs text-fg-muted">Provider</FieldLabel>
<Select
+6 -34
View File
@@ -93,8 +93,8 @@ export interface ChatMessage {
MessageID?: string;
/** An update check answered in the panel, with its install actions. */
update?: ChatUpdate;
/** A bare /model or /personality, answered with its choices. */
choose?: "model" | "personality";
/** A bare /model, answered with its choices. */
choose?: "model";
}
/** The update snapshot /update shows, and whether this host can install it. */
@@ -126,12 +126,9 @@ export interface ChatAsk {
/** Everything the selectors on the panel read, from one sessions read. */
export interface ChatSelectorData {
personas?: string[];
providers?: string[];
models?: string[];
models_by_provider?: Record<string, string[]>;
active_persona?: string;
active_personas?: Record<string, string>;
active_provider?: string;
active_model?: string;
commands?: Array<ChatCommandSpec | string>;
@@ -178,7 +175,6 @@ export const isSending = ref(false);
export const streamingTurn = ref<StreamingTurn | null>(null);
export const selectorData = ref<ChatSelectorData>({});
export const selectedPersona = ref("");
export const selectedProvider = ref("");
export const selectedModel = ref("");
@@ -235,7 +231,6 @@ export async function refreshSessions(): Promise<void> {
sessions.value = sessionList;
selectorData.value = data;
selectedPersona.value = data.active_persona || "";
const providers = data.providers || [];
selectedProvider.value = data.active_provider || providers[0] || "";
selectedModel.value = data.active_model || "";
@@ -256,13 +251,10 @@ export async function refreshSessions(): Promise<void> {
export async function selectSession(id: string): Promise<void> {
if (!id) return;
const data = selectorData.value;
currentSession.value = id;
messages.value = [];
streamingTurn.value = null;
selectedPersona.value =
data.active_personas?.[id] || data.active_persona || "";
try {
// Resuming is the server's own command, so the transcript read below is of
@@ -327,25 +319,6 @@ export function promptSessionCommand(command: string, message: string): void {
if (value?.trim()) void runSessionCommand(`${command} ${value.trim()}`);
}
export function setPersona(name: string): void {
selectedPersona.value = name;
const session = currentSession.value;
if (!session || !name) return;
api
.chatPersona(session, name)
.then(() => {
const data = selectorData.value;
selectorData.value = {
...data,
active_personas: { ...(data.active_personas || {}), [session]: name },
};
statusText.value = `Personality: ${name}`;
})
.catch((err: Error) => {
statusText.value = err.message || "Failed to set personality";
});
}
export async function setProvider(provider: string): Promise<void> {
selectedProvider.value = provider;
if (!provider) return;
@@ -425,11 +398,10 @@ export async function sendMessage(retryOpts?: RetryOptions): Promise<void> {
composerText.value = "";
}
// Bare /model and /personality offer their choices as buttons, as Telegram
// does; with an argument they go to the gateway like any command.
if (!isRetry && (text.trim() === "/model" || text.trim() === "/personality")) {
const choose = text.trim() === "/model" ? "model" : "personality";
messages.value = [...messages.value, { from: "assistant", text: "", choose }];
// A bare /model offers its choices as buttons, as Telegram does; with an
// argument it goes to the gateway like any command.
if (!isRetry && text.trim() === "/model") {
messages.value = [...messages.value, { from: "assistant", text: "", choose: "model" }];
isSending.value = false;
statusText.value = "Ready";
return;
-5
View File
@@ -416,11 +416,6 @@ export const api = {
page: location.pathname + location.search || "/",
},
}),
chatPersona: <T = unknown>(sessionID: string, name: string) =>
request<T>("/api/chat/persona", {
method: "POST",
body: { session_id: sessionID, name },
}),
// A server-sent event stream cannot be parsed as JSON and outlives a normal
// request, so the caller owns the abort controller and the timeout, and
// reads the body itself. Only the URL, headers, and failure shape are shared.
-1
View File
@@ -49,7 +49,6 @@ const settings: NavSpec = {
label: "Agents",
paths: [
"/settings/soul",
"/settings/personas",
"/settings/agent-profiles",
"/settings/models",
"/settings/skills",
+1 -14
View File
@@ -16,7 +16,6 @@ import SchedulingPolicyPage from "@/settings/SchedulingPolicyPage.vue";
import ReviewSettingsPage from "@/settings/ReviewSettingsPage.vue";
import ToolsPage from "@/settings/ToolsPage.vue";
import HistoryPage from "@/settings/HistoryPage.vue";
import PersonasPage from "@/settings/PersonasPage.vue";
import SoulPage from "@/settings/SoulPage.vue";
import SchedulesPage from "@/settings/SchedulesPage.vue";
import ExtensionsPage from "@/settings/ExtensionsPage.vue";
@@ -259,18 +258,6 @@ const routes = [
section: "channels",
},
},
{
path: "/settings/personas",
name: "settings-personas",
component: PersonasPage,
meta: {
navPath: "/settings",
settings: true,
label: "Personas",
description: "Chat system prompts and the default.",
section: "settings",
},
},
{
path: "/settings/soul",
name: "settings-soul",
@@ -417,7 +404,7 @@ const routes = [
},
{
path: "/settings",
redirect: "/settings/personas",
redirect: "/settings/soul",
meta: {
label: "Settings",
},
-140
View File
@@ -1,140 +0,0 @@
<script setup lang="ts">
import ApplyStatusRows from "./ApplyStatusRows.vue";
import { computed, onMounted, ref } from "vue";
import { storeToRefs } from "pinia";
import { Copy, Plus, Trash2 } from "@lucide/vue";
import PageHeader from "@/base/PageHeader.vue";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { SettingRow } from "@/components/ui/setting-row";
import { Badge } from "@/components/ui/badge";
import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea";
import { cn } from "@/lib/utils";
import { resourcesForPage, useSettingsStore } from "@/stores/settings";
import HistoryLink from "./HistoryLink.vue";
import {
duplicatePersona,
removePersona,
renamePersona,
type PersonaCollection,
} from "./personas";
const KIND = "personas";
const store = useSettingsStore();
const { catalog, catalogError } = storeToRefs(store);
onMounted(store.load);
const resources = computed(() => resourcesForPage(catalog.value, "personas"));
const collection = computed(() => store.drafts[KIND]?.value as PersonaCollection | undefined);
const error = computed(() => store.pageErrorFor(KIND));
const filter = ref("");
const selected = ref(0);
const shown = computed(() =>
(collection.value?.personas ?? [])
.map((persona, index) => ({ persona, index }))
.filter(({ persona }) => persona.name.toLowerCase().includes(filter.value.trim().toLowerCase())),
);
const current = computed(() => collection.value?.personas[selected.value]);
const isDefault = computed(() => !!current.value && collection.value?.default === current.value.name);
const chars = computed(() => current.value?.prompt.length ?? 0);
function add() {
const c = collection.value;
if (!c) return;
const taken = new Set(c.personas.map((p) => p.name));
let name = "new-persona";
for (let n = 2; taken.has(name); n++) name = `new-persona-${n}`;
c.personas.push({ name, prompt: "" });
selected.value = c.personas.length - 1;
}
function duplicate() {
if (collection.value) selected.value = duplicatePersona(collection.value, selected.value);
}
function remove() {
if (collection.value && removePersona(collection.value, selected.value))
selected.value = Math.max(0, selected.value - 1);
}
function rename(name: string | number) {
if (collection.value) renamePersona(collection.value, selected.value, String(name));
}
</script>
<template>
<div>
<PageHeader title="Personas">
<HistoryLink :kinds="resources.map((r) => r.kind)" />
</PageHeader>
<ApplyStatusRows v-for="resource in resources" :key="resource.kind" :kind="resource.kind" class="mb-4" />
<p v-if="catalogError || error" class="mb-4 text-sm text-danger" role="alert">
{{ catalogError || error }}
</p>
<div v-if="collection" class="grid gap-6 md:grid-cols-[16rem_1fr]">
<div class="flex min-w-0 flex-col gap-2">
<div class="flex gap-2">
<Input v-model="filter" placeholder="Filter" aria-label="Filter personas" />
<Button variant="outline" size="icon" aria-label="New persona" @click="add"><Plus /></Button>
</div>
<ul class="flex flex-col gap-0.5" aria-label="Personas">
<li v-for="{ persona, index } in shown" :key="index">
<button
type="button"
:aria-current="index === selected ? 'true' : undefined"
:class="
cn(
'w-full rounded-md px-3 py-2 text-left transition-colors hover:bg-secondary',
index === selected && 'bg-secondary',
)
"
@click="selected = index"
>
<span class="flex items-center gap-2">
<span class="truncate font-mono text-[13px]" :class="index === selected && 'font-medium'">{{
persona.name || "unnamed"
}}</span>
<Badge v-if="collection.default === persona.name" variant="outline">Default</Badge>
</span>
<span class="block truncate text-xs text-fg-subtle">{{ persona.prompt || "No prompt yet" }}</span>
</button>
</li>
</ul>
</div>
<section v-if="current" class="min-w-0 rounded-lg border border-border bg-card px-5 pt-4 pb-2" aria-label="Persona">
<header class="flex items-center gap-2">
<h2 class="min-w-0 flex-1 truncate font-mono text-[15px] font-medium">{{ current.name || "unnamed" }}</h2>
<Button variant="ghost" size="sm" @click="duplicate"><Copy data-icon="inline-start" />Duplicate</Button>
<Button
variant="ghost"
size="sm"
class="text-danger"
:disabled="collection.personas.length <= 1"
@click="remove"
><Trash2 data-icon="inline-start" />Delete</Button
>
</header>
<SettingRow label="Name" for="persona-name">
<Input id="persona-name" :model-value="current.name" class="max-w-sm font-mono" @update:model-value="rename" />
</SettingRow>
<SettingRow label="Default persona">
<Switch
:model-value="isDefault"
:disabled="isDefault"
aria-label="Default persona"
@update:model-value="(on: boolean) => on && (collection!.default = current!.name)"
/>
</SettingRow>
<div class="border-t border-border py-4">
<label for="persona-prompt" class="text-[13px] font-medium">System prompt</label>
<Textarea id="persona-prompt" v-model="current.prompt" :rows="12" class="mt-2 font-mono text-[13px]" />
<p class="mt-1.5 text-xs text-fg-subtle">{{ chars.toLocaleString() }} chars · ~{{ Math.round(chars / 4).toLocaleString() }} tokens</p>
</div>
</section>
</div>
</div>
</template>
-34
View File
@@ -1,34 +0,0 @@
/** The personas resource document. */
export interface PersonaCollection {
default: string;
personas: { name: string; prompt: string }[];
}
// The collection must always name a default that exists (the server refuses
// one that does not), so every edit that touches a name keeps it valid.
export function renamePersona(c: PersonaCollection, index: number, name: string): void {
const persona = c.personas[index];
if (!persona) return;
if (c.default === persona.name) c.default = name;
persona.name = name;
}
/** removePersona deletes one persona; the last one cannot go. */
export function removePersona(c: PersonaCollection, index: number): boolean {
if (c.personas.length <= 1 || !c.personas[index]) return false;
const [removed] = c.personas.splice(index, 1);
if (removed!.name === c.default) c.default = c.personas[0]!.name;
return true;
}
/** duplicatePersona copies one persona under a free name and returns its index. */
export function duplicatePersona(c: PersonaCollection, index: number): number {
const source = c.personas[index];
if (!source) return -1;
const taken = new Set(c.personas.map((p) => p.name));
let name = `${source.name}-copy`;
for (let n = 2; taken.has(name); n++) name = `${source.name}-copy-${n}`;
c.personas.splice(index + 1, 0, { name, prompt: source.prompt });
return index + 1;
}
-2
View File
@@ -181,7 +181,6 @@ export type ControlPlanePage =
| "channels"
| "scheduling"
| "tools"
| "personas"
| "soul"
| "schedules"
| "plugins"
@@ -195,7 +194,6 @@ const PAGE_RESOURCES: Record<ControlPlanePage, string[]> = {
channels: ["channel-settings"],
scheduling: ["scheduling-policy"],
tools: ["tool-settings"],
personas: ["personas"],
soul: ["soul"],
schedules: ["schedules"],
plugins: ["plugin-settings"],
-48
View File
@@ -1,48 +0,0 @@
import assert from "node:assert/strict";
import test from "node:test";
import {
duplicatePersona,
removePersona,
renamePersona,
} from "../src/settings/personas.ts";
const collection = () => ({
default: "archie",
personas: [
{ name: "archie", prompt: "a" },
{ name: "concise", prompt: "c" },
],
});
test("renaming the default persona keeps it the default", () => {
const c = collection();
renamePersona(c, 0, "archer");
assert.equal(c.personas[0]!.name, "archer");
assert.equal(c.default, "archer");
renamePersona(c, 1, "brief");
assert.equal(c.default, "archer");
});
test("removing the default hands it to the first persona left", () => {
const c = collection();
assert.equal(removePersona(c, 0), true);
assert.deepEqual(c, { default: "concise", personas: [{ name: "concise", prompt: "c" }] });
});
test("the last persona cannot be removed", () => {
const c = { default: "a", personas: [{ name: "a", prompt: "p" }] };
assert.equal(removePersona(c, 0), false);
assert.equal(c.personas.length, 1);
});
test("a duplicate gets a free name and lands after the original", () => {
const c = collection();
assert.equal(duplicatePersona(c, 0), 1);
assert.equal(duplicatePersona(c, 0), 1);
assert.deepEqual(
c.personas.map((p) => p.name),
["archie", "archie-copy-2", "archie-copy", "concise"],
);
assert.equal(c.default, "archie");
});