From 40e555eb96aa7aa967b58af58188edb11ee1383e Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Thu, 8 Jan 2026 20:49:59 +0000 Subject: [PATCH 1/7] fix: remove invalid Unlock calls in scaleset worker - Remove Unlock call in handleScaleDown that was called before any lock was acquired - Change defer Unlock to immediate Unlock in consolidateRunnerState loop to avoid holding locks until function exit --- workers/scaleset/scaleset.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/workers/scaleset/scaleset.go b/workers/scaleset/scaleset.go index d8942aa9..32b17ce9 100644 --- a/workers/scaleset/scaleset.go +++ b/workers/scaleset/scaleset.go @@ -566,7 +566,7 @@ func (w *Worker) consolidateRunnerState(runners []params.RunnerReference) error slog.DebugContext(w.ctx, "runner is locked; skipping", "runner_name", runner.Name) continue } - defer locking.Unlock(runner.Name, false) + locking.Unlock(runner.Name, false) if _, ok := providerRunnersByName[runner.Name]; !ok { // The runner is not in the provider anymore. Remove it from the DB. @@ -893,7 +893,6 @@ func (w *Worker) handleScaleDown() { switch runner.RunnerStatus { case params.RunnerTerminated, params.RunnerActive: slog.DebugContext(w.ctx, "runner is not in a valid state; skipping", "runner_name", runner.Name, "runner_status", runner.RunnerStatus) - locking.Unlock(runner.Name, false) continue } locked := locking.TryLock(runner.Name, w.consumerID) From dd874ac82e6d6455d41630dc90b6035f0d9ca0ff Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Tue, 30 Dec 2025 17:01:49 +0000 Subject: [PATCH 2/7] Add OIDC authentication support - Add OIDC configuration to config.go with validation - Add OIDC provider integration with state management and token exchange - Add OIDC login/callback/status API endpoints - Update NewUserParams with IsSSOUser flag for SSO users without passwords - Consolidate CreateOIDCUser into CreateUser with IsSSOUser check - Add OIDC login button to webapp login page - Add OIDC tests and documentation --- apiserver/controllers/controllers.go | 124 ++ apiserver/routers/routers.go | 9 + auth/auth.go | 290 +++- auth/context.go | 16 + auth/jwt.go | 1 + auth/oidc.go | 159 +++ auth/oidc_test.go | 367 +++++ cmd/garm/main.go | 9 + config/config.go | 58 + database/sql/users.go | 10 +- doc/oidc_authentication.md | 154 +++ go.mod | 2 + go.sum | 4 + params/requests.go | 3 + vendor/github.com/coreos/go-oidc/v3/LICENSE | 202 +++ vendor/github.com/coreos/go-oidc/v3/NOTICE | 5 + .../github.com/coreos/go-oidc/v3/oidc/jose.go | 32 + .../github.com/coreos/go-oidc/v3/oidc/jwks.go | 263 ++++ .../github.com/coreos/go-oidc/v3/oidc/oidc.go | 584 ++++++++ .../coreos/go-oidc/v3/oidc/verify.go | 338 +++++ .../github.com/go-jose/go-jose/v4/.gitignore | 2 + .../go-jose/go-jose/v4/.golangci.yml | 53 + .../github.com/go-jose/go-jose/v4/.travis.yml | 33 + .../go-jose/go-jose/v4/CONTRIBUTING.md | 9 + vendor/github.com/go-jose/go-jose/v4/LICENSE | 202 +++ .../github.com/go-jose/go-jose/v4/README.md | 108 ++ .../github.com/go-jose/go-jose/v4/SECURITY.md | 13 + .../go-jose/go-jose/v4/asymmetric.go | 595 ++++++++ .../go-jose/go-jose/v4/cipher/cbc_hmac.go | 196 +++ .../go-jose/go-jose/v4/cipher/concat_kdf.go | 75 + .../go-jose/go-jose/v4/cipher/ecdh_es.go | 86 ++ .../go-jose/go-jose/v4/cipher/key_wrap.go | 109 ++ .../github.com/go-jose/go-jose/v4/crypter.go | 595 ++++++++ vendor/github.com/go-jose/go-jose/v4/doc.go | 25 + .../github.com/go-jose/go-jose/v4/encoding.go | 228 ++++ .../go-jose/go-jose/v4/json/LICENSE | 27 + .../go-jose/go-jose/v4/json/README.md | 13 + .../go-jose/go-jose/v4/json/decode.go | 1216 +++++++++++++++++ .../go-jose/go-jose/v4/json/encode.go | 1197 ++++++++++++++++ .../go-jose/go-jose/v4/json/indent.go | 141 ++ .../go-jose/go-jose/v4/json/scanner.go | 623 +++++++++ .../go-jose/go-jose/v4/json/stream.go | 484 +++++++ .../go-jose/go-jose/v4/json/tags.go | 44 + vendor/github.com/go-jose/go-jose/v4/jwe.go | 391 ++++++ vendor/github.com/go-jose/go-jose/v4/jwk.go | 848 ++++++++++++ vendor/github.com/go-jose/go-jose/v4/jws.go | 470 +++++++ .../github.com/go-jose/go-jose/v4/opaque.go | 147 ++ .../github.com/go-jose/go-jose/v4/shared.go | 560 ++++++++ .../github.com/go-jose/go-jose/v4/signing.go | 523 +++++++ .../go-jose/go-jose/v4/symmetric.go | 522 +++++++ vendor/modules.txt | 8 + webapp/src/lib/api/generated-client.ts | 21 +- webapp/src/routes/login/+page.svelte | 53 +- 53 files changed, 12235 insertions(+), 12 deletions(-) create mode 100644 auth/oidc.go create mode 100644 auth/oidc_test.go create mode 100644 doc/oidc_authentication.md create mode 100644 vendor/github.com/coreos/go-oidc/v3/LICENSE create mode 100644 vendor/github.com/coreos/go-oidc/v3/NOTICE create mode 100644 vendor/github.com/coreos/go-oidc/v3/oidc/jose.go create mode 100644 vendor/github.com/coreos/go-oidc/v3/oidc/jwks.go create mode 100644 vendor/github.com/coreos/go-oidc/v3/oidc/oidc.go create mode 100644 vendor/github.com/coreos/go-oidc/v3/oidc/verify.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/.gitignore create mode 100644 vendor/github.com/go-jose/go-jose/v4/.golangci.yml create mode 100644 vendor/github.com/go-jose/go-jose/v4/.travis.yml create mode 100644 vendor/github.com/go-jose/go-jose/v4/CONTRIBUTING.md create mode 100644 vendor/github.com/go-jose/go-jose/v4/LICENSE create mode 100644 vendor/github.com/go-jose/go-jose/v4/README.md create mode 100644 vendor/github.com/go-jose/go-jose/v4/SECURITY.md create mode 100644 vendor/github.com/go-jose/go-jose/v4/asymmetric.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/cipher/cbc_hmac.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/cipher/concat_kdf.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/cipher/ecdh_es.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/cipher/key_wrap.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/crypter.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/doc.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/encoding.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/json/LICENSE create mode 100644 vendor/github.com/go-jose/go-jose/v4/json/README.md create mode 100644 vendor/github.com/go-jose/go-jose/v4/json/decode.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/json/encode.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/json/indent.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/json/scanner.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/json/stream.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/json/tags.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/jwe.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/jwk.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/jws.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/opaque.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/shared.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/signing.go create mode 100644 vendor/github.com/go-jose/go-jose/v4/symmetric.go diff --git a/apiserver/controllers/controllers.go b/apiserver/controllers/controllers.go index 8ff3bf06..74f91005 100644 --- a/apiserver/controllers/controllers.go +++ b/apiserver/controllers/controllers.go @@ -542,3 +542,127 @@ func (a *APIController) ForceToolsSyncHandler(w http.ResponseWriter, r *http.Req slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response") } } + +// swagger:route GET /auth/oidc/status oidc OIDCStatus +// +// Returns the OIDC configuration status (enabled/disabled). +// This endpoint is public and does not require authentication. +// +// Responses: +// 200: OIDCStatusResponse +func (a *APIController) OIDCStatusHandler(w http.ResponseWriter, r *http.Request) { + response := struct { + Enabled bool `json:"enabled"` + }{ + Enabled: a.auth.IsOIDCEnabled(), + } + + w.Header().Set("Content-Type", "application/json") + if err := json.NewEncoder(w).Encode(response); err != nil { + slog.With(slog.Any("error", err)).ErrorContext(r.Context(), "failed to encode OIDC status response") + } +} + +// swagger:route GET /auth/oidc/login oidc OIDCLogin +// +// Initiates OIDC login flow by redirecting to the identity provider. +// +// Responses: +// 302: description:Redirect to OIDC provider +// 400: APIErrorResponse +// 501: APIErrorResponse +func (a *APIController) OIDCLoginHandler(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + + if !a.auth.IsOIDCEnabled() { + handleError(ctx, w, gErrors.NewBadRequestError("OIDC authentication is not enabled")) + return + } + + authURL, _, err := a.auth.GetOIDCAuthURL() + if err != nil { + handleError(ctx, w, err) + return + } + + http.Redirect(w, r, authURL, http.StatusFound) +} + +// swagger:route GET /auth/oidc/callback oidc OIDCCallback +// +// Handles the OIDC callback from the identity provider. +// +// Responses: +// 200: JWTResponse +// 400: APIErrorResponse +// 401: APIErrorResponse +func (a *APIController) OIDCCallbackHandler(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + + if !a.auth.IsOIDCEnabled() { + handleError(ctx, w, gErrors.NewBadRequestError("OIDC authentication is not enabled")) + return + } + + // Check for error from OIDC provider first (before checking for code/state) + // When the IdP returns an error (e.g., user not assigned), it won't include a code + if errParam := r.URL.Query().Get("error"); errParam != "" { + errDesc := r.URL.Query().Get("error_description") + slog.With(slog.String("error", errParam), slog.String("description", errDesc)).Error("OIDC provider returned error") + handleError(ctx, w, gErrors.NewBadRequestError("OIDC provider error: %s - %s", errParam, errDesc)) + return + } + + code := r.URL.Query().Get("code") + state := r.URL.Query().Get("state") + + if code == "" || state == "" { + handleError(ctx, w, gErrors.NewBadRequestError("missing code or state parameter")) + return + } + + ctx, err := a.auth.HandleOIDCCallback(ctx, code, state) + if err != nil { + handleError(ctx, w, err) + return + } + + tokenString, err := a.auth.GetJWTToken(ctx) + if err != nil { + handleError(ctx, w, err) + return + } + + // Get user info from context for the cookie + userName := auth.Username(ctx) + if userName == "" { + userName = auth.UserID(ctx) + } + + // Set cookies for the webapp + // Token cookie - NOT HttpOnly because the webapp JavaScript needs to read it + // to set it in the API client for authenticated requests + http.SetCookie(w, &http.Cookie{ + Name: "garm_token", + Value: tokenString, + Path: "/", + HttpOnly: false, + Secure: r.TLS != nil || r.Header.Get("X-Forwarded-Proto") == "https", + SameSite: http.SameSiteLaxMode, + MaxAge: 86400 * 7, // 7 days + }) + + // User cookie - accessible to JavaScript for display purposes + http.SetCookie(w, &http.Cookie{ + Name: "garm_user", + Value: userName, + Path: "/", + HttpOnly: false, + Secure: r.TLS != nil || r.Header.Get("X-Forwarded-Proto") == "https", + SameSite: http.SameSiteLaxMode, + MaxAge: 86400 * 7, // 7 days + }) + + // Redirect to the webapp + http.Redirect(w, r, "/ui/", http.StatusFound) +} diff --git a/apiserver/routers/routers.go b/apiserver/routers/routers.go index f92ff7a4..53fd4ebd 100644 --- a/apiserver/routers/routers.go +++ b/apiserver/routers/routers.go @@ -203,6 +203,15 @@ func NewAPIRouter(han *controllers.APIController, authMiddleware, initMiddleware authRouter.Handle("/{login:login\\/?}", http.HandlerFunc(han.LoginHandler)).Methods("POST", "OPTIONS") authRouter.Use(initMiddleware.Middleware) + // OIDC authentication routes (no auth middleware - these initiate/complete auth) + oidcRouter := apiSubRouter.PathPrefix("/auth/oidc").Subrouter() + oidcRouter.Handle("/status/", http.HandlerFunc(han.OIDCStatusHandler)).Methods("GET", "OPTIONS") + oidcRouter.Handle("/status", http.HandlerFunc(han.OIDCStatusHandler)).Methods("GET", "OPTIONS") + oidcRouter.Handle("/login/", http.HandlerFunc(han.OIDCLoginHandler)).Methods("GET", "OPTIONS") + oidcRouter.Handle("/login", http.HandlerFunc(han.OIDCLoginHandler)).Methods("GET", "OPTIONS") + oidcRouter.Handle("/callback/", http.HandlerFunc(han.OIDCCallbackHandler)).Methods("GET", "OPTIONS") + oidcRouter.Handle("/callback", http.HandlerFunc(han.OIDCCallbackHandler)).Methods("GET", "OPTIONS") + ////////////////////////// // Controller endpoints // ////////////////////////// diff --git a/auth/auth.go b/auth/auth.go index c5fa1ebd..986cdfb6 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -16,13 +16,20 @@ package auth import ( "context" + "crypto/rand" + "encoding/base64" "errors" "fmt" + "log/slog" + "strings" + "sync" "time" + "github.com/coreos/go-oidc/v3/oidc" jwt "github.com/golang-jwt/jwt/v5" "github.com/nbutton23/zxcvbn-go" "golang.org/x/crypto/bcrypt" + "golang.org/x/oauth2" runnerErrors "github.com/cloudbase/garm-provider-common/errors" "github.com/cloudbase/garm-provider-common/util" @@ -33,14 +40,28 @@ import ( func NewAuthenticator(cfg config.JWTAuth, store common.Store) *Authenticator { return &Authenticator{ - cfg: cfg, - store: store, + cfg: cfg, + store: store, + oidcStates: make(map[string]oidcStateEntry), } } type Authenticator struct { store common.Store cfg config.JWTAuth + + // OIDC fields + oidcCfg config.OIDC + oidcProvider *oidc.Provider + oidcVerifier *oidc.IDTokenVerifier + oidcOAuth2 oauth2.Config + oidcStateMu sync.RWMutex + oidcStates map[string]oidcStateEntry +} + +type oidcStateEntry struct { + createdAt time.Time + nonce string } func (a *Authenticator) IsInitialized() bool { @@ -66,6 +87,7 @@ func (a *Authenticator) GetJWTToken(ctx context.Context) (string, error) { }, UserID: UserID(ctx), TokenID: tokenID, + Username: Username(ctx), IsAdmin: IsAdmin(ctx), FullName: FullName(ctx), Generation: generation, @@ -187,3 +209,267 @@ func (a *Authenticator) AuthenticateUser(ctx context.Context, info params.Passwo return PopulateContext(ctx, user, nil), nil } + +// InitOIDC initializes OIDC authentication +func (a *Authenticator) InitOIDC(ctx context.Context, cfg config.OIDC) error { + if !cfg.Enable { + return nil + } + + provider, err := oidc.NewProvider(ctx, cfg.IssuerURL) + if err != nil { + return fmt.Errorf("failed to create OIDC provider: %w", err) + } + + a.oidcCfg = cfg + a.oidcProvider = provider + a.oidcVerifier = provider.Verifier(&oidc.Config{ClientID: cfg.ClientID}) + a.oidcOAuth2 = oauth2.Config{ + ClientID: cfg.ClientID, + ClientSecret: cfg.ClientSecret, + RedirectURL: cfg.RedirectURL, + Endpoint: provider.Endpoint(), + Scopes: cfg.GetScopes(), + } + + return nil +} + +// IsOIDCEnabled returns whether OIDC is enabled +func (a *Authenticator) IsOIDCEnabled() bool { + return a.oidcCfg.Enable && a.oidcProvider != nil +} + +// GetOIDCAuthURL returns the OIDC authorization URL +func (a *Authenticator) GetOIDCAuthURL() (string, string, error) { + if !a.IsOIDCEnabled() { + return "", "", runnerErrors.NewBadRequestError("OIDC authentication is not enabled") + } + + state, err := a.generateOIDCState() + if err != nil { + return "", "", err + } + + nonce, err := a.generateOIDCNonce() + if err != nil { + return "", "", err + } + + // Store state with expiration + a.oidcStateMu.Lock() + a.oidcStates[state] = oidcStateEntry{ + createdAt: time.Now(), + nonce: nonce, + } + a.oidcStateMu.Unlock() + + // Clean up old states + go a.cleanupOIDCStates() + + url := a.oidcOAuth2.AuthCodeURL(state, oidc.Nonce(nonce)) + return url, state, nil +} + +// generateOIDCState creates a cryptographically secure random state +func (a *Authenticator) generateOIDCState() (string, error) { + b := make([]byte, 32) + if _, err := rand.Read(b); err != nil { + return "", fmt.Errorf("failed to generate random state: %w", err) + } + return base64.URLEncoding.EncodeToString(b), nil +} + +// generateOIDCNonce creates a cryptographically secure random nonce +func (a *Authenticator) generateOIDCNonce() (string, error) { + b := make([]byte, 32) + if _, err := rand.Read(b); err != nil { + return "", fmt.Errorf("failed to generate random nonce: %w", err) + } + return base64.URLEncoding.EncodeToString(b), nil +} + +// cleanupOIDCStates removes expired states (older than 10 minutes) +func (a *Authenticator) cleanupOIDCStates() { + a.oidcStateMu.Lock() + defer a.oidcStateMu.Unlock() + + cutoff := time.Now().Add(-10 * time.Minute) + for state, entry := range a.oidcStates { + if entry.createdAt.Before(cutoff) { + delete(a.oidcStates, state) + } + } +} + +// validateOIDCState checks if the state is valid and returns the nonce +func (a *Authenticator) validateOIDCState(state string) (string, error) { + a.oidcStateMu.Lock() + defer a.oidcStateMu.Unlock() + + entry, ok := a.oidcStates[state] + if !ok { + return "", runnerErrors.NewBadRequestError("invalid state") + } + + // Check if state is expired (10 minutes) + if time.Since(entry.createdAt) > 10*time.Minute { + delete(a.oidcStates, state) + return "", runnerErrors.NewBadRequestError("state expired") + } + + // Delete state after use (one-time use) + delete(a.oidcStates, state) + return entry.nonce, nil +} + +// OIDCClaims represents the claims from an OIDC ID token +type OIDCClaims struct { + Email string `json:"email"` + EmailVerified bool `json:"email_verified"` + Name string `json:"name"` + Subject string `json:"sub"` +} + +// HandleOIDCCallback processes the OIDC callback and returns an authenticated context +func (a *Authenticator) HandleOIDCCallback(ctx context.Context, code, state string) (context.Context, error) { + if !a.IsOIDCEnabled() { + return ctx, runnerErrors.NewBadRequestError("OIDC authentication is not enabled") + } + + // Validate state and get nonce + nonce, err := a.validateOIDCState(state) + if err != nil { + return ctx, err + } + + // Exchange code for token + oauth2Token, err := a.oidcOAuth2.Exchange(ctx, code) + if err != nil { + slog.With(slog.Any("error", err)).Error("failed to exchange code for token") + return ctx, runnerErrors.NewBadRequestError("failed to exchange code for token") + } + + // Extract ID token + rawIDToken, ok := oauth2Token.Extra("id_token").(string) + if !ok { + return ctx, runnerErrors.NewBadRequestError("no id_token in token response") + } + + // Verify ID token + idToken, err := a.oidcVerifier.Verify(ctx, rawIDToken) + if err != nil { + slog.With(slog.Any("error", err)).Error("failed to verify ID token") + return ctx, runnerErrors.NewBadRequestError("failed to verify ID token") + } + + // Verify nonce + if idToken.Nonce != nonce { + return ctx, runnerErrors.NewBadRequestError("nonce mismatch") + } + + // Extract claims + var claims OIDCClaims + if err := idToken.Claims(&claims); err != nil { + slog.With(slog.Any("error", err)).Error("failed to extract claims") + return ctx, runnerErrors.NewBadRequestError("failed to extract claims") + } + + // Validate email + if claims.Email == "" { + return ctx, runnerErrors.NewBadRequestError("email claim is required") + } + + // Check allowed domains + if len(a.oidcCfg.AllowedDomains) > 0 { + emailDomain := extractEmailDomain(claims.Email) + allowed := false + for _, domain := range a.oidcCfg.AllowedDomains { + if strings.EqualFold(emailDomain, domain) { + allowed = true + break + } + } + if !allowed { + slog.With(slog.String("email", claims.Email)).Warn("email domain not allowed") + return ctx, runnerErrors.ErrUnauthorized + } + } + + // Try to find existing user + user, err := a.store.GetUser(ctx, claims.Email) + if err != nil { + if !errors.Is(err, runnerErrors.ErrNotFound) { + return ctx, fmt.Errorf("failed to get user: %w", err) + } + + // User not found - check if JIT creation is enabled + if !a.oidcCfg.JITUserCreation { + slog.With(slog.String("email", claims.Email)).Warn("user not found and JIT creation disabled") + return ctx, runnerErrors.ErrUnauthorized + } + + // Create user JIT + user, err = a.createOIDCUser(ctx, claims) + if err != nil { + return ctx, fmt.Errorf("failed to create JIT user: %w", err) + } + slog.With(slog.String("email", claims.Email)).Info("created JIT user via OIDC") + } + + // Check if user is enabled + if !user.Enabled { + return ctx, runnerErrors.ErrUnauthorized + } + + return PopulateContext(ctx, user, nil), nil +} + +// createOIDCUser creates a new user from OIDC claims +func (a *Authenticator) createOIDCUser(ctx context.Context, claims OIDCClaims) (params.User, error) { + // Generate username from email (before @) + username := strings.Split(claims.Email, "@")[0] + // Sanitize username - only alphanumeric + username = sanitizeOIDCUsername(username) + if len(username) > 64 { + username = username[:64] + } + + // Use name from claims or fallback to username + fullName := claims.Name + if fullName == "" { + fullName = username + } + + newUser := params.NewUserParams{ + Email: claims.Email, + Username: username, + FullName: fullName, + Password: "", // SSO users don't have passwords + IsAdmin: a.oidcCfg.DefaultUserAdmin, + Enabled: true, + IsSSOUser: true, + } + + return a.store.CreateUser(ctx, newUser) +} + +// extractEmailDomain extracts the domain from an email address +func extractEmailDomain(email string) string { + parts := strings.Split(email, "@") + if len(parts) != 2 { + return "" + } + return parts[1] +} + +// sanitizeOIDCUsername removes non-alphanumeric characters from username +func sanitizeOIDCUsername(s string) string { + var result strings.Builder + for _, r := range s { + if util.IsAlphanumeric(string(r)) { + result.WriteRune(r) + } + } + return result.String() +} diff --git a/auth/context.go b/auth/context.go index d983c62f..87fbd361 100644 --- a/auth/context.go +++ b/auth/context.go @@ -27,6 +27,7 @@ type contextFlags string const ( isAdminKey contextFlags = "is_admin" fullNameKey contextFlags = "full_name" + usernameKey contextFlags = "username" readMetricsKey contextFlags = "read_metrics" // UserIDFlag is the User ID flag we set in the context UserIDFlag contextFlags = "user_id" @@ -218,6 +219,7 @@ func PopulateContext(ctx context.Context, user params.User, authExpires *time.Ti ctx = SetAdmin(ctx, user.IsAdmin) ctx = SetIsEnabled(ctx, user.Enabled) ctx = SetFullName(ctx, user.FullName) + ctx = SetUsername(ctx, user.Username) ctx = SetExpires(ctx, authExpires) ctx = SetPasswordGeneration(ctx, user.Generation) return ctx @@ -264,6 +266,20 @@ func FullName(ctx context.Context) string { return name.(string) } +// SetUsername sets the username in the context +func SetUsername(ctx context.Context, username string) context.Context { + return context.WithValue(ctx, usernameKey, username) +} + +// Username returns the username from context +func Username(ctx context.Context) string { + username := ctx.Value(usernameKey) + if username == nil { + return "" + } + return username.(string) +} + // SetIsEnabled sets a flag indicating if account is enabled func SetIsEnabled(ctx context.Context, enabled bool) context.Context { return context.WithValue(ctx, isEnabledFlag, enabled) diff --git a/auth/jwt.go b/auth/jwt.go index 6468b6d4..2626bcc5 100644 --- a/auth/jwt.go +++ b/auth/jwt.go @@ -35,6 +35,7 @@ import ( type JWTClaims struct { UserID string `json:"user"` TokenID string `json:"token_id"` + Username string `json:"username,omitempty"` FullName string `json:"full_name"` IsAdmin bool `json:"is_admin"` ReadMetrics bool `json:"read_metrics"` diff --git a/auth/oidc.go b/auth/oidc.go new file mode 100644 index 00000000..01ed3666 --- /dev/null +++ b/auth/oidc.go @@ -0,0 +1,159 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package auth + +import ( + "context" + "crypto/rand" + "encoding/base64" + "fmt" + "sync" + "time" + + "github.com/coreos/go-oidc/v3/oidc" + "golang.org/x/oauth2" + + runnerErrors "github.com/cloudbase/garm-provider-common/errors" + "github.com/cloudbase/garm/config" + "github.com/cloudbase/garm/database/common" +) + +// OIDCAuthenticator handles OIDC authentication +type OIDCAuthenticator struct { + cfg config.OIDC + store common.Store + provider *oidc.Provider + verifier *oidc.IDTokenVerifier + oauth2 oauth2.Config + + // State management for OIDC flow + stateMu sync.RWMutex + states map[string]stateEntry +} + +type stateEntry struct { + createdAt time.Time + nonce string +} + +// NewOIDCAuthenticator creates a new OIDC authenticator +func NewOIDCAuthenticator(ctx context.Context, cfg config.OIDC, store common.Store) (*OIDCAuthenticator, error) { + if !cfg.Enable { + return nil, nil + } + + provider, err := oidc.NewProvider(ctx, cfg.IssuerURL) + if err != nil { + return nil, fmt.Errorf("failed to create OIDC provider: %w", err) + } + + oauth2Config := oauth2.Config{ + ClientID: cfg.ClientID, + ClientSecret: cfg.ClientSecret, + RedirectURL: cfg.RedirectURL, + Endpoint: provider.Endpoint(), + Scopes: cfg.GetScopes(), + } + + verifier := provider.Verifier(&oidc.Config{ClientID: cfg.ClientID}) + + return &OIDCAuthenticator{ + cfg: cfg, + store: store, + provider: provider, + verifier: verifier, + oauth2: oauth2Config, + states: make(map[string]stateEntry), + }, nil +} + +// generateState creates a cryptographically secure random state +func (o *OIDCAuthenticator) generateState() (string, error) { + b := make([]byte, 32) + if _, err := rand.Read(b); err != nil { + return "", fmt.Errorf("failed to generate random state: %w", err) + } + return base64.URLEncoding.EncodeToString(b), nil +} + +// generateNonce creates a cryptographically secure random nonce +func (o *OIDCAuthenticator) generateNonce() (string, error) { + b := make([]byte, 32) + if _, err := rand.Read(b); err != nil { + return "", fmt.Errorf("failed to generate random nonce: %w", err) + } + return base64.URLEncoding.EncodeToString(b), nil +} + +// GetAuthURL returns the OIDC authorization URL +func (o *OIDCAuthenticator) GetAuthURL() (string, string, error) { + state, err := o.generateState() + if err != nil { + return "", "", err + } + + nonce, err := o.generateNonce() + if err != nil { + return "", "", err + } + + // Store state with expiration + o.stateMu.Lock() + o.states[state] = stateEntry{ + createdAt: time.Now(), + nonce: nonce, + } + o.stateMu.Unlock() + + // Clean up old states + go o.cleanupStates() + + url := o.oauth2.AuthCodeURL(state, oidc.Nonce(nonce)) + return url, state, nil +} + +// cleanupStates removes expired states (older than 10 minutes) +func (o *OIDCAuthenticator) cleanupStates() { + o.stateMu.Lock() + defer o.stateMu.Unlock() + + cutoff := time.Now().Add(-10 * time.Minute) + for state, entry := range o.states { + if entry.createdAt.Before(cutoff) { + delete(o.states, state) + } + } +} + +// ValidateState checks if the state is valid and returns the nonce +func (o *OIDCAuthenticator) ValidateState(state string) (string, error) { + o.stateMu.Lock() + defer o.stateMu.Unlock() + + entry, ok := o.states[state] + if !ok { + return "", runnerErrors.NewBadRequestError("invalid state") + } + + // Check if state is expired (10 minutes) + if time.Since(entry.createdAt) > 10*time.Minute { + delete(o.states, state) + return "", runnerErrors.NewBadRequestError("state expired") + } + + // Delete state after use (one-time use) + delete(o.states, state) + return entry.nonce, nil +} diff --git a/auth/oidc_test.go b/auth/oidc_test.go new file mode 100644 index 00000000..a935be03 --- /dev/null +++ b/auth/oidc_test.go @@ -0,0 +1,367 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package auth + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/cloudbase/garm/config" +) + +func TestAuthenticator_IsOIDCEnabled(t *testing.T) { + tests := []struct { + name string + setup func() *Authenticator + expected bool + }{ + { + name: "OIDC not initialized", + setup: func() *Authenticator { + return NewAuthenticator(config.JWTAuth{}, nil) + }, + expected: false, + }, + { + name: "OIDC disabled in config", + setup: func() *Authenticator { + auth := NewAuthenticator(config.JWTAuth{}, nil) + auth.oidcCfg = config.OIDC{Enable: false} + return auth + }, + expected: false, + }, + { + name: "OIDC enabled but provider nil", + setup: func() *Authenticator { + auth := NewAuthenticator(config.JWTAuth{}, nil) + auth.oidcCfg = config.OIDC{Enable: true} + // provider is nil + return auth + }, + expected: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + auth := tt.setup() + result := auth.IsOIDCEnabled() + assert.Equal(t, tt.expected, result) + }) + } +} + +func TestExtractEmailDomain(t *testing.T) { + tests := []struct { + name string + email string + expected string + }{ + { + name: "valid email", + email: "user@example.com", + expected: "example.com", + }, + { + name: "subdomain email", + email: "user@mail.example.com", + expected: "mail.example.com", + }, + { + name: "no @ symbol", + email: "invalid-email", + expected: "", + }, + { + name: "empty string", + email: "", + expected: "", + }, + { + name: "multiple @ symbols", + email: "user@domain@example.com", + expected: "", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := extractEmailDomain(tt.email) + assert.Equal(t, tt.expected, result) + }) + } +} + +func TestSanitizeOIDCUsername(t *testing.T) { + tests := []struct { + name string + input string + expected string + }{ + { + name: "alphanumeric only", + input: "testuser123", + expected: "testuser123", + }, + { + name: "with dots", + input: "test.user", + expected: "testuser", + }, + { + name: "with special chars", + input: "test-user_name+extra", + expected: "testusernameextra", + }, + { + name: "with spaces", + input: "test user", + expected: "testuser", + }, + { + name: "empty string", + input: "", + expected: "", + }, + { + name: "only special chars", + input: ".-_+@", + expected: "", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := sanitizeOIDCUsername(tt.input) + assert.Equal(t, tt.expected, result) + }) + } +} + +func TestAuthenticator_GenerateOIDCState(t *testing.T) { + auth := NewAuthenticator(config.JWTAuth{}, nil) + + state1, err := auth.generateOIDCState() + require.NoError(t, err) + assert.NotEmpty(t, state1) + + state2, err := auth.generateOIDCState() + require.NoError(t, err) + assert.NotEmpty(t, state2) + + // States should be different + assert.NotEqual(t, state1, state2) +} + +func TestAuthenticator_GenerateOIDCNonce(t *testing.T) { + auth := NewAuthenticator(config.JWTAuth{}, nil) + + nonce1, err := auth.generateOIDCNonce() + require.NoError(t, err) + assert.NotEmpty(t, nonce1) + + nonce2, err := auth.generateOIDCNonce() + require.NoError(t, err) + assert.NotEmpty(t, nonce2) + + // Nonces should be different + assert.NotEqual(t, nonce1, nonce2) +} + +func TestAuthenticator_ValidateOIDCState(t *testing.T) { + auth := NewAuthenticator(config.JWTAuth{}, nil) + + // Add a valid state manually + testState := "test-state-123" + testNonce := "test-nonce-456" + auth.oidcStates[testState] = oidcStateEntry{ + createdAt: time.Now(), + nonce: testNonce, + } + + nonce, err := auth.validateOIDCState(testState) + require.NoError(t, err) + assert.Equal(t, testNonce, nonce) + + // State should be consumed (one-time use) + _, err = auth.validateOIDCState(testState) + assert.Error(t, err) + assert.Contains(t, err.Error(), "invalid state") +} + +func TestAuthenticator_ValidateOIDCState_Invalid(t *testing.T) { + auth := NewAuthenticator(config.JWTAuth{}, nil) + + // Test invalid state + _, err := auth.validateOIDCState("invalid-state") + assert.Error(t, err) + assert.Contains(t, err.Error(), "invalid state") +} + +func TestAuthenticator_ValidateOIDCState_Expired(t *testing.T) { + auth := NewAuthenticator(config.JWTAuth{}, nil) + + // Add an expired state manually + expiredState := "expired-state-123" + auth.oidcStates[expiredState] = oidcStateEntry{ + createdAt: time.Now().Add(-15 * time.Minute), // 15 minutes ago (expired) + nonce: "test-nonce", + } + + _, err := auth.validateOIDCState(expiredState) + assert.Error(t, err) + assert.Contains(t, err.Error(), "state expired") +} + +func TestAuthenticator_CleanupOIDCStates(t *testing.T) { + auth := NewAuthenticator(config.JWTAuth{}, nil) + + // Add some states + auth.oidcStates["fresh-state"] = oidcStateEntry{ + createdAt: time.Now(), + nonce: "nonce1", + } + auth.oidcStates["old-state"] = oidcStateEntry{ + createdAt: time.Now().Add(-15 * time.Minute), + nonce: "nonce2", + } + + assert.Len(t, auth.oidcStates, 2) + + auth.cleanupOIDCStates() + + // Only fresh state should remain + assert.Len(t, auth.oidcStates, 1) + _, exists := auth.oidcStates["fresh-state"] + assert.True(t, exists) + _, exists = auth.oidcStates["old-state"] + assert.False(t, exists) +} + +func TestOIDCConfigValidation(t *testing.T) { + tests := []struct { + name string + cfg config.OIDC + expectError bool + errContains string + }{ + { + name: "disabled - no validation", + cfg: config.OIDC{ + Enable: false, + }, + expectError: false, + }, + { + name: "enabled - missing issuer_url", + cfg: config.OIDC{ + Enable: true, + ClientID: "client-id", + ClientSecret: "client-secret", + RedirectURL: "https://example.com/callback", + }, + expectError: true, + errContains: "issuer_url", + }, + { + name: "enabled - missing client_id", + cfg: config.OIDC{ + Enable: true, + IssuerURL: "https://issuer.example.com", + ClientSecret: "client-secret", + RedirectURL: "https://example.com/callback", + }, + expectError: true, + errContains: "client_id", + }, + { + name: "enabled - missing client_secret", + cfg: config.OIDC{ + Enable: true, + IssuerURL: "https://issuer.example.com", + ClientID: "client-id", + RedirectURL: "https://example.com/callback", + }, + expectError: true, + errContains: "client_secret", + }, + { + name: "enabled - missing redirect_url", + cfg: config.OIDC{ + Enable: true, + IssuerURL: "https://issuer.example.com", + ClientID: "client-id", + ClientSecret: "client-secret", + }, + expectError: true, + errContains: "redirect_url", + }, + { + name: "enabled - all required fields", + cfg: config.OIDC{ + Enable: true, + IssuerURL: "https://issuer.example.com", + ClientID: "client-id", + ClientSecret: "client-secret", + RedirectURL: "https://example.com/callback", + }, + expectError: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.cfg.Validate() + if tt.expectError { + require.Error(t, err) + assert.Contains(t, err.Error(), tt.errContains) + } else { + assert.NoError(t, err) + } + }) + } +} + +func TestOIDCGetScopes(t *testing.T) { + tests := []struct { + name string + cfg config.OIDC + expected []string + }{ + { + name: "default scopes when empty", + cfg: config.OIDC{}, + expected: []string{"openid", "email", "profile"}, + }, + { + name: "custom scopes", + cfg: config.OIDC{ + Scopes: []string{"openid", "email"}, + }, + expected: []string{"openid", "email"}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := tt.cfg.GetScopes() + assert.Equal(t, tt.expected, result) + }) + } +} diff --git a/cmd/garm/main.go b/cmd/garm/main.go index 81131b7e..f6146a34 100644 --- a/cmd/garm/main.go +++ b/cmd/garm/main.go @@ -287,6 +287,15 @@ func main() { } authenticator := auth.NewAuthenticator(cfg.JWTAuth, db) + + // Initialize OIDC if enabled + if cfg.OIDC.Enable { + if err := authenticator.InitOIDC(ctx, cfg.OIDC); err != nil { + log.Fatalf("failed to initialize OIDC: %+v", err) + } + log.Printf("OIDC authentication enabled with issuer: %s", cfg.OIDC.IssuerURL) + } + controller, err := controllers.NewAPIController(runner, authenticator, hub, agentHub, cfg.APIServer) if err != nil { log.Fatalf("failed to create controller: %+v", err) diff --git a/config/config.go b/config/config.go index 4b104b99..cd1e4221 100644 --- a/config/config.go +++ b/config/config.go @@ -100,6 +100,7 @@ type Config struct { Github []Github `toml:"github,omitempty"` JWTAuth JWTAuth `toml:"jwt_auth" json:"jwt-auth"` Logging Logging `toml:"logging" json:"logging"` + OIDC OIDC `toml:"oidc" json:"oidc"` } // Validate validates the config @@ -129,6 +130,10 @@ func (c *Config) Validate() error { return fmt.Errorf("error validating logging config: %w", err) } + if err := c.OIDC.Validate(); err != nil { + return fmt.Errorf("error validating oidc config: %w", err) + } + providerNames := map[string]int{} for _, provider := range c.Providers { @@ -812,3 +817,56 @@ func (j *JWTAuth) Validate() error { } return nil } + +// OIDC holds settings for OpenID Connect authentication +type OIDC struct { + // Enable enables OIDC authentication + Enable bool `toml:"enable" json:"enable"` + // IssuerURL is the OIDC provider's issuer URL (e.g., https://accounts.google.com) + IssuerURL string `toml:"issuer_url" json:"issuer-url"` + // ClientID is the OAuth2 client ID + ClientID string `toml:"client_id" json:"client-id"` + // ClientSecret is the OAuth2 client secret + ClientSecret string `toml:"client_secret" json:"client-secret"` + // RedirectURL is the callback URL for OIDC (e.g., https://garm.example.com/api/v1/auth/oidc/callback) + RedirectURL string `toml:"redirect_url" json:"redirect-url"` + // Scopes are the OAuth2 scopes to request (defaults to openid, email, profile) + Scopes []string `toml:"scopes" json:"scopes"` + // AllowedDomains restricts login to users with email addresses from these domains + // If empty, all authenticated users are allowed + AllowedDomains []string `toml:"allowed_domains" json:"allowed-domains"` + // JITUserCreation enables Just-In-Time user creation on first OIDC login + JITUserCreation bool `toml:"jit_user_creation" json:"jit-user-creation"` + // DefaultUserAdmin sets whether JIT-created users should be admins + DefaultUserAdmin bool `toml:"default_user_admin" json:"default-user-admin"` +} + +// Validate validates the OIDC config +func (o *OIDC) Validate() error { + if !o.Enable { + return nil + } + + if o.IssuerURL == "" { + return fmt.Errorf("oidc issuer_url is required when OIDC is enabled") + } + if o.ClientID == "" { + return fmt.Errorf("oidc client_id is required when OIDC is enabled") + } + if o.ClientSecret == "" { + return fmt.Errorf("oidc client_secret is required when OIDC is enabled") + } + if o.RedirectURL == "" { + return fmt.Errorf("oidc redirect_url is required when OIDC is enabled") + } + + return nil +} + +// GetScopes returns the OAuth2 scopes, with defaults if not specified +func (o *OIDC) GetScopes() []string { + if len(o.Scopes) == 0 { + return []string{"openid", "email", "profile"} + } + return o.Scopes +} diff --git a/database/sql/users.go b/database/sql/users.go index ca78c5e8..6c12b114 100644 --- a/database/sql/users.go +++ b/database/sql/users.go @@ -57,12 +57,16 @@ func (s *sqlDatabase) getUserByID(tx *gorm.DB, userID string) (User, error) { } func (s *sqlDatabase) CreateUser(_ context.Context, user params.NewUserParams) (params.User, error) { - if user.Username == "" || user.Email == "" || user.Password == "" { - return params.User{}, runnerErrors.NewBadRequestError("missing username, password or email") + if user.Username == "" || user.Email == "" { + return params.User{}, runnerErrors.NewBadRequestError("missing username or email") + } + // SSO users don't have passwords, but regular users must have one + if !user.IsSSOUser && user.Password == "" { + return params.User{}, runnerErrors.NewBadRequestError("missing password for non-SSO user") } newUser := User{ Username: user.Username, - Password: user.Password, + Password: user.Password, // Empty for SSO users FullName: user.FullName, Enabled: user.Enabled, Email: user.Email, diff --git a/doc/oidc_authentication.md b/doc/oidc_authentication.md new file mode 100644 index 00000000..1ba93c8b --- /dev/null +++ b/doc/oidc_authentication.md @@ -0,0 +1,154 @@ +# OIDC Authentication + +GARM supports OpenID Connect (OIDC) authentication, allowing users to authenticate using external identity providers such as Google, Okta, Azure AD, Keycloak, and other OIDC-compliant providers. + +## Configuration + +To enable OIDC authentication, add the `[oidc]` section to your GARM configuration file: + +```toml +[oidc] +# Enable OIDC authentication +enable = true + +# The OIDC provider's issuer URL +# Examples: +# - Google: https://accounts.google.com +# - Okta: https://your-domain.okta.com +# - Azure AD: https://login.microsoftonline.com/{tenant}/v2.0 +# - Keycloak: https://your-keycloak-server/realms/{realm} +issuer_url = "https://accounts.google.com" + +# OAuth2 client ID from your identity provider +client_id = "your-client-id" + +# OAuth2 client secret from your identity provider +client_secret = "your-client-secret" + +# The callback URL where the identity provider will redirect after authentication +# This must match the redirect URI configured in your identity provider +redirect_url = "https://your-garm-server/api/v1/auth/oidc/callback" + +# OAuth2 scopes to request (optional) +# Defaults to ["openid", "email", "profile"] if not specified +scopes = ["openid", "email", "profile"] + +# Restrict login to users with email addresses from specific domains (optional) +# If empty, all authenticated users are allowed +allowed_domains = ["example.com", "yourcompany.com"] + +# Enable Just-In-Time (JIT) user creation on first OIDC login (optional) +# If true, new users will be automatically created when they first authenticate via OIDC +# If false, users must be pre-created in GARM before they can log in +jit_user_creation = true + +# Set whether JIT-created users should be admins (optional) +# Only applies when jit_user_creation is true +default_user_admin = false +``` + +## API Endpoints + +OIDC authentication adds the following API endpoints: + +### Login Endpoint + +``` +GET /api/v1/auth/oidc/login +``` + +Initiates the OIDC login flow by redirecting the user to the identity provider's authorization endpoint. + +**Response:** HTTP 302 redirect to the identity provider + +### Callback Endpoint + +``` +GET /api/v1/auth/oidc/callback +``` + +Handles the callback from the identity provider after successful authentication. + +**Query Parameters:** +- `code` - Authorization code from the identity provider +- `state` - State parameter for CSRF protection + +**Success Response:** +```json +{ + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." +} +``` + +**Error Responses:** +- `400 Bad Request` - Missing parameters, invalid state, or token exchange failure +- `401 Unauthorized` - User not allowed (domain restriction or user disabled) + +## How It Works + +1. **User initiates login**: The user navigates to `/api/v1/auth/oidc/login` +2. **Redirect to IdP**: GARM redirects the user to the identity provider with a state parameter +3. **User authenticates**: The user authenticates with their identity provider +4. **Callback**: The IdP redirects back to `/api/v1/auth/oidc/callback` with an authorization code +5. **Token exchange**: GARM exchanges the code for tokens with the IdP +6. **User lookup/creation**: GARM looks up the user by email, or creates one if JIT is enabled +7. **JWT issued**: GARM issues a JWT token for subsequent API requests + +## Setting Up Identity Providers + +### Google + +1. Go to the [Google Cloud Console](https://console.cloud.google.com/) +2. Create or select a project +3. Navigate to "APIs & Services" > "Credentials" +4. Create an OAuth 2.0 Client ID +5. Add your callback URL: `https://your-garm-server/api/v1/auth/oidc/callback` +6. Copy the Client ID and Client Secret to your GARM config + +### Okta + +1. Log in to your Okta Admin Console +2. Navigate to "Applications" > "Create App Integration" +3. Select "OIDC - OpenID Connect" and "Web Application" +4. Add your callback URL +5. Copy the Client ID and Client Secret + +### Azure AD + +1. Go to the [Azure Portal](https://portal.azure.com/) +2. Navigate to "Azure Active Directory" > "App registrations" +3. Create a new registration +4. Add a redirect URI for "Web" platform +5. Create a client secret under "Certificates & secrets" + +### Keycloak + +1. Log in to your Keycloak Admin Console +2. Select or create a realm +3. Navigate to "Clients" and create a new client +4. Set the Root URL and Valid Redirect URIs +5. Copy the Client ID and Client Secret from the "Credentials" tab + +## Security Considerations + +- **HTTPS Required**: Always use HTTPS for the redirect URL in production +- **Client Secret**: Keep the client secret secure and never expose it +- **Domain Restrictions**: Use `allowed_domains` to restrict access to specific email domains +- **JIT User Creation**: Consider disabling JIT creation (`jit_user_creation = false`) for tighter access control +- **State Validation**: GARM validates the state parameter to prevent CSRF attacks +- **Token Expiration**: OIDC state tokens expire after 10 minutes + +## Troubleshooting + +### "OIDC authentication is not enabled" +Ensure `enable = true` in the `[oidc]` section and restart GARM. + +### "failed to create OIDC provider" +Check that the `issuer_url` is correct and accessible from the GARM server. + +### "email domain not allowed" +The user's email domain is not in the `allowed_domains` list. + +### "user not found and JIT creation disabled" +Enable `jit_user_creation = true` or pre-create the user in GARM. + diff --git a/go.mod b/go.mod index b77d9207..2c7a82d6 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/BurntSushi/toml v1.6.0 github.com/bradleyfalzon/ghinstallation/v2 v2.17.0 github.com/cloudbase/garm-provider-common v0.1.8-0.20251001105909-bbcacae60e7c + github.com/coreos/go-oidc/v3 v3.17.0 github.com/felixge/httpsnoop v1.0.4 github.com/gdamore/tcell/v2 v2.13.8 github.com/go-openapi/errors v0.22.6 @@ -51,6 +52,7 @@ require ( github.com/clipperhouse/uax29/v2 v2.5.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/gdamore/encoding v1.0.1 // indirect + github.com/go-jose/go-jose/v4 v4.1.3 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/analysis v0.24.2 // indirect diff --git a/go.sum b/go.sum index 635e44fc..153f4d59 100644 --- a/go.sum +++ b/go.sum @@ -23,6 +23,8 @@ github.com/clipperhouse/uax29/v2 v2.5.0 h1:x7T0T4eTHDONxFJsL94uKNKPHrclyFI0lm7+w github.com/clipperhouse/uax29/v2 v2.5.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g= github.com/cloudbase/garm-provider-common v0.1.8-0.20251001105909-bbcacae60e7c h1:IaIJoyugbSAYRHkiVJaBpibFftsQAi/mle7k11Ze94g= github.com/cloudbase/garm-provider-common v0.1.8-0.20251001105909-bbcacae60e7c/go.mod h1:2O51WbcfqRx5fDHyyJgIFq7KdTZZnefsM+aoOchyleU= +github.com/coreos/go-oidc/v3 v3.17.0 h1:hWBGaQfbi0iVviX4ibC7bk8OKT5qNr4klBaCHVNvehc= +github.com/coreos/go-oidc/v3 v3.17.0/go.mod h1:wqPbKFrVnE90vty060SB40FCJ8fTHTxSwyXJqZH+sI8= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -35,6 +37,8 @@ github.com/gdamore/encoding v1.0.1 h1:YzKZckdBL6jVt2Gc+5p82qhrGiqMdG/eNs6Wy0u3Uh github.com/gdamore/encoding v1.0.1/go.mod h1:0Z0cMFinngz9kS1QfMjCP8TY7em3bZYeeklsSDPivEo= github.com/gdamore/tcell/v2 v2.13.8 h1:Mys/Kl5wfC/GcC5Cx4C2BIQH9dbnhnkPgS9/wF3RlfU= github.com/gdamore/tcell/v2 v2.13.8/go.mod h1:+Wfe208WDdB7INEtCsNrAN6O2m+wsTPk1RAovjaILlo= +github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs= +github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= diff --git a/params/requests.go b/params/requests.go index ad639147..63fe6885 100644 --- a/params/requests.go +++ b/params/requests.go @@ -156,6 +156,9 @@ type NewUserParams struct { Password string `json:"password,omitempty"` IsAdmin bool `json:"-"` Enabled bool `json:"-"` + // IsSSOUser indicates this user authenticates via SSO (OIDC/SAML) + // and does not have a local password + IsSSOUser bool `json:"-"` } // swagger:model UpdatePoolParams diff --git a/vendor/github.com/coreos/go-oidc/v3/LICENSE b/vendor/github.com/coreos/go-oidc/v3/LICENSE new file mode 100644 index 00000000..e06d2081 --- /dev/null +++ b/vendor/github.com/coreos/go-oidc/v3/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/vendor/github.com/coreos/go-oidc/v3/NOTICE b/vendor/github.com/coreos/go-oidc/v3/NOTICE new file mode 100644 index 00000000..b39ddfa5 --- /dev/null +++ b/vendor/github.com/coreos/go-oidc/v3/NOTICE @@ -0,0 +1,5 @@ +CoreOS Project +Copyright 2014 CoreOS, Inc + +This product includes software developed at CoreOS, Inc. +(http://www.coreos.com/). diff --git a/vendor/github.com/coreos/go-oidc/v3/oidc/jose.go b/vendor/github.com/coreos/go-oidc/v3/oidc/jose.go new file mode 100644 index 00000000..f42d37d4 --- /dev/null +++ b/vendor/github.com/coreos/go-oidc/v3/oidc/jose.go @@ -0,0 +1,32 @@ +package oidc + +import jose "github.com/go-jose/go-jose/v4" + +// JOSE asymmetric signing algorithm values as defined by RFC 7518 +// +// see: https://tools.ietf.org/html/rfc7518#section-3.1 +const ( + RS256 = "RS256" // RSASSA-PKCS-v1.5 using SHA-256 + RS384 = "RS384" // RSASSA-PKCS-v1.5 using SHA-384 + RS512 = "RS512" // RSASSA-PKCS-v1.5 using SHA-512 + ES256 = "ES256" // ECDSA using P-256 and SHA-256 + ES384 = "ES384" // ECDSA using P-384 and SHA-384 + ES512 = "ES512" // ECDSA using P-521 and SHA-512 + PS256 = "PS256" // RSASSA-PSS using SHA256 and MGF1-SHA256 + PS384 = "PS384" // RSASSA-PSS using SHA384 and MGF1-SHA384 + PS512 = "PS512" // RSASSA-PSS using SHA512 and MGF1-SHA512 + EdDSA = "EdDSA" // Ed25519 using SHA-512 +) + +var allAlgs = []jose.SignatureAlgorithm{ + jose.RS256, + jose.RS384, + jose.RS512, + jose.ES256, + jose.ES384, + jose.ES512, + jose.PS256, + jose.PS384, + jose.PS512, + jose.EdDSA, +} diff --git a/vendor/github.com/coreos/go-oidc/v3/oidc/jwks.go b/vendor/github.com/coreos/go-oidc/v3/oidc/jwks.go new file mode 100644 index 00000000..c5e4d787 --- /dev/null +++ b/vendor/github.com/coreos/go-oidc/v3/oidc/jwks.go @@ -0,0 +1,263 @@ +package oidc + +import ( + "context" + "crypto" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/rsa" + "errors" + "fmt" + "io" + "net/http" + "sync" + + jose "github.com/go-jose/go-jose/v4" +) + +// StaticKeySet is a verifier that validates JWT against a static set of public keys. +type StaticKeySet struct { + // PublicKeys used to verify the JWT. Supported types are *rsa.PublicKey and + // *ecdsa.PublicKey. + PublicKeys []crypto.PublicKey +} + +// VerifySignature compares the signature against a static set of public keys. +func (s *StaticKeySet) VerifySignature(ctx context.Context, jwt string) ([]byte, error) { + // Algorithms are already checked by Verifier, so this parse method accepts + // any algorithm. + jws, err := jose.ParseSigned(jwt, allAlgs) + if err != nil { + return nil, fmt.Errorf("parsing jwt: %v", err) + } + for _, pub := range s.PublicKeys { + switch pub.(type) { + case *rsa.PublicKey: + case *ecdsa.PublicKey: + case ed25519.PublicKey: + default: + return nil, fmt.Errorf("invalid public key type provided: %T", pub) + } + payload, err := jws.Verify(pub) + if err != nil { + continue + } + return payload, nil + } + return nil, fmt.Errorf("no public keys able to verify jwt") +} + +// NewRemoteKeySet returns a KeySet that can validate JSON web tokens by using HTTP +// GETs to fetch JSON web token sets hosted at a remote URL. This is automatically +// used by NewProvider using the URLs returned by OpenID Connect discovery, but is +// exposed for providers that don't support discovery or to prevent round trips to the +// discovery URL. +// +// The returned KeySet is a long lived verifier that caches keys based on any +// keys change. Reuse a common remote key set instead of creating new ones as needed. +func NewRemoteKeySet(ctx context.Context, jwksURL string) *RemoteKeySet { + return newRemoteKeySet(ctx, jwksURL) +} + +func newRemoteKeySet(ctx context.Context, jwksURL string) *RemoteKeySet { + return &RemoteKeySet{ + jwksURL: jwksURL, + // For historical reasons, this package uses contexts for configuration, not just + // cancellation. In hindsight, this was a bad idea. + // + // Attemps to reason about how cancels should work with background requests have + // largely lead to confusion. Use the context here as a config bag-of-values and + // ignore the cancel function. + ctx: context.WithoutCancel(ctx), + } +} + +// RemoteKeySet is a KeySet implementation that validates JSON web tokens against +// a jwks_uri endpoint. +type RemoteKeySet struct { + jwksURL string + + // Used for configuration. Cancelation is ignored. + ctx context.Context + + // guard all other fields + mu sync.RWMutex + + // inflight suppresses parallel execution of updateKeys and allows + // multiple goroutines to wait for its result. + inflight *inflight + + // A set of cached keys. + cachedKeys []jose.JSONWebKey +} + +// inflight is used to wait on some in-flight request from multiple goroutines. +type inflight struct { + doneCh chan struct{} + + keys []jose.JSONWebKey + err error +} + +func newInflight() *inflight { + return &inflight{doneCh: make(chan struct{})} +} + +// wait returns a channel that multiple goroutines can receive on. Once it returns +// a value, the inflight request is done and result() can be inspected. +func (i *inflight) wait() <-chan struct{} { + return i.doneCh +} + +// done can only be called by a single goroutine. It records the result of the +// inflight request and signals other goroutines that the result is safe to +// inspect. +func (i *inflight) done(keys []jose.JSONWebKey, err error) { + i.keys = keys + i.err = err + close(i.doneCh) +} + +// result cannot be called until the wait() channel has returned a value. +func (i *inflight) result() ([]jose.JSONWebKey, error) { + return i.keys, i.err +} + +// paresdJWTKey is a context key that allows common setups to avoid parsing the +// JWT twice. It holds a *jose.JSONWebSignature value. +var parsedJWTKey contextKey + +// VerifySignature validates a payload against a signature from the jwks_uri. +// +// Users MUST NOT call this method directly and should use an IDTokenVerifier +// instead. This method skips critical validations such as 'alg' values and is +// only exported to implement the KeySet interface. +func (r *RemoteKeySet) VerifySignature(ctx context.Context, jwt string) ([]byte, error) { + jws, ok := ctx.Value(parsedJWTKey).(*jose.JSONWebSignature) + if !ok { + // The algorithm values are already enforced by the Validator, which also sets + // the context value above to pre-parsed signature. + // + // Practically, this codepath isn't called in normal use of this package, but + // if it is, the algorithms have already been checked. + var err error + jws, err = jose.ParseSigned(jwt, allAlgs) + if err != nil { + return nil, fmt.Errorf("oidc: malformed jwt: %v", err) + } + } + return r.verify(ctx, jws) +} + +func (r *RemoteKeySet) verify(ctx context.Context, jws *jose.JSONWebSignature) ([]byte, error) { + // We don't support JWTs signed with multiple signatures. + keyID := "" + for _, sig := range jws.Signatures { + keyID = sig.Header.KeyID + break + } + + keys := r.keysFromCache() + for _, key := range keys { + if keyID == "" || key.KeyID == keyID { + if payload, err := jws.Verify(&key); err == nil { + return payload, nil + } + } + } + + // If the kid doesn't match, check for new keys from the remote. This is the + // strategy recommended by the spec. + // + // https://openid.net/specs/openid-connect-core-1_0.html#RotateSigKeys + keys, err := r.keysFromRemote(ctx) + if err != nil { + return nil, fmt.Errorf("fetching keys %w", err) + } + + for _, key := range keys { + if keyID == "" || key.KeyID == keyID { + if payload, err := jws.Verify(&key); err == nil { + return payload, nil + } + } + } + return nil, errors.New("failed to verify id token signature") +} + +func (r *RemoteKeySet) keysFromCache() (keys []jose.JSONWebKey) { + r.mu.RLock() + defer r.mu.RUnlock() + return r.cachedKeys +} + +// keysFromRemote syncs the key set from the remote set, records the values in the +// cache, and returns the key set. +func (r *RemoteKeySet) keysFromRemote(ctx context.Context) ([]jose.JSONWebKey, error) { + // Need to lock to inspect the inflight request field. + r.mu.Lock() + // If there's not a current inflight request, create one. + if r.inflight == nil { + r.inflight = newInflight() + + // This goroutine has exclusive ownership over the current inflight + // request. It releases the resource by nil'ing the inflight field + // once the goroutine is done. + go func() { + // Sync keys and finish inflight when that's done. + keys, err := r.updateKeys() + + r.inflight.done(keys, err) + + // Lock to update the keys and indicate that there is no longer an + // inflight request. + r.mu.Lock() + defer r.mu.Unlock() + + if err == nil { + r.cachedKeys = keys + } + + // Free inflight so a different request can run. + r.inflight = nil + }() + } + inflight := r.inflight + r.mu.Unlock() + + select { + case <-ctx.Done(): + return nil, ctx.Err() + case <-inflight.wait(): + return inflight.result() + } +} + +func (r *RemoteKeySet) updateKeys() ([]jose.JSONWebKey, error) { + req, err := http.NewRequest("GET", r.jwksURL, nil) + if err != nil { + return nil, fmt.Errorf("oidc: can't create request: %v", err) + } + + resp, err := doRequest(r.ctx, req) + if err != nil { + return nil, fmt.Errorf("oidc: get keys failed %w", err) + } + defer resp.Body.Close() + + body, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("unable to read response body: %v", err) + } + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("oidc: get keys failed: %s %s", resp.Status, body) + } + + var keySet jose.JSONWebKeySet + err = unmarshalResp(resp, body, &keySet) + if err != nil { + return nil, fmt.Errorf("oidc: failed to decode keys: %v %s", err, body) + } + return keySet.Keys, nil +} diff --git a/vendor/github.com/coreos/go-oidc/v3/oidc/oidc.go b/vendor/github.com/coreos/go-oidc/v3/oidc/oidc.go new file mode 100644 index 00000000..2659518c --- /dev/null +++ b/vendor/github.com/coreos/go-oidc/v3/oidc/oidc.go @@ -0,0 +1,584 @@ +// Package oidc implements OpenID Connect client logic for the golang.org/x/oauth2 package. +package oidc + +import ( + "context" + "crypto/sha256" + "crypto/sha512" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "hash" + "io" + "mime" + "net/http" + "strings" + "sync" + "time" + + "golang.org/x/oauth2" +) + +const ( + // ScopeOpenID is the mandatory scope for all OpenID Connect OAuth2 requests. + ScopeOpenID = "openid" + + // ScopeOfflineAccess is an optional scope defined by OpenID Connect for requesting + // OAuth2 refresh tokens. + // + // Support for this scope differs between OpenID Connect providers. For instance + // Google rejects it, favoring appending "access_type=offline" as part of the + // authorization request instead. + // + // See: https://openid.net/specs/openid-connect-core-1_0.html#OfflineAccess + ScopeOfflineAccess = "offline_access" +) + +var ( + errNoAtHash = errors.New("id token did not have an access token hash") + errInvalidAtHash = errors.New("access token hash does not match value in ID token") +) + +type contextKey int + +var issuerURLKey contextKey + +// ClientContext returns a new Context that carries the provided HTTP client. +// +// This method sets the same context key used by the golang.org/x/oauth2 package, +// so the returned context works for that package too. +// +// myClient := &http.Client{} +// ctx := oidc.ClientContext(parentContext, myClient) +// +// // This will use the custom client +// provider, err := oidc.NewProvider(ctx, "https://accounts.example.com") +func ClientContext(ctx context.Context, client *http.Client) context.Context { + return context.WithValue(ctx, oauth2.HTTPClient, client) +} + +func getClient(ctx context.Context) *http.Client { + if c, ok := ctx.Value(oauth2.HTTPClient).(*http.Client); ok { + return c + } + return nil +} + +// InsecureIssuerURLContext allows discovery to work when the issuer_url reported +// by upstream is mismatched with the discovery URL. This is meant for integration +// with off-spec providers such as Azure. +// +// discoveryBaseURL := "https://login.microsoftonline.com/organizations/v2.0" +// issuerURL := "https://login.microsoftonline.com/my-tenantid/v2.0" +// +// ctx := oidc.InsecureIssuerURLContext(parentContext, issuerURL) +// +// // Provider will be discovered with the discoveryBaseURL, but use issuerURL +// // for future issuer validation. +// provider, err := oidc.NewProvider(ctx, discoveryBaseURL) +// +// This is insecure because validating the correct issuer is critical for multi-tenant +// providers. Any overrides here MUST be carefully reviewed. +func InsecureIssuerURLContext(ctx context.Context, issuerURL string) context.Context { + return context.WithValue(ctx, issuerURLKey, issuerURL) +} + +func doRequest(ctx context.Context, req *http.Request) (*http.Response, error) { + client := http.DefaultClient + if c := getClient(ctx); c != nil { + client = c + } + return client.Do(req.WithContext(ctx)) +} + +// Provider represents an OpenID Connect server's configuration. +type Provider struct { + issuer string + authURL string + tokenURL string + deviceAuthURL string + userInfoURL string + jwksURL string + algorithms []string + + // Raw claims returned by the server. + rawClaims []byte + + // Guards all of the following fields. + mu sync.Mutex + // HTTP client specified from the initial NewProvider request. This is used + // when creating the common key set. + client *http.Client + // A key set that uses context.Background() and is shared between all code paths + // that don't have a convinent way of supplying a unique context. + commonRemoteKeySet KeySet +} + +func (p *Provider) remoteKeySet() KeySet { + p.mu.Lock() + defer p.mu.Unlock() + if p.commonRemoteKeySet == nil { + ctx := context.Background() + if p.client != nil { + ctx = ClientContext(ctx, p.client) + } + p.commonRemoteKeySet = NewRemoteKeySet(ctx, p.jwksURL) + } + return p.commonRemoteKeySet +} + +type providerJSON struct { + Issuer string `json:"issuer"` + AuthURL string `json:"authorization_endpoint"` + TokenURL string `json:"token_endpoint"` + DeviceAuthURL string `json:"device_authorization_endpoint"` + JWKSURL string `json:"jwks_uri"` + UserInfoURL string `json:"userinfo_endpoint"` + Algorithms []string `json:"id_token_signing_alg_values_supported"` +} + +// supportedAlgorithms is a list of algorithms explicitly supported by this +// package. If a provider supports other algorithms, such as HS256 or none, +// those values won't be passed to the IDTokenVerifier. +var supportedAlgorithms = map[string]bool{ + RS256: true, + RS384: true, + RS512: true, + ES256: true, + ES384: true, + ES512: true, + PS256: true, + PS384: true, + PS512: true, + EdDSA: true, +} + +// ProviderConfig allows direct creation of a [Provider] from metadata +// configuration. This is intended for interop with providers that don't support +// discovery, or host the JSON discovery document at an off-spec path. +// +// The ProviderConfig struct specifies JSON struct tags to support document +// parsing. +// +// // Directly fetch the metadata document. +// resp, err := http.Get("https://login.example.com/custom-metadata-path") +// if err != nil { +// // ... +// } +// defer resp.Body.Close() +// +// // Parse config from JSON metadata. +// config := &oidc.ProviderConfig{} +// if err := json.NewDecoder(resp.Body).Decode(config); err != nil { +// // ... +// } +// p := config.NewProvider(context.Background()) +// +// For providers that implement discovery, use [NewProvider] instead. +// +// See: https://openid.net/specs/openid-connect-discovery-1_0.html +type ProviderConfig struct { + // IssuerURL is the identity of the provider, and the string it uses to sign + // ID tokens with. For example "https://accounts.google.com". This value MUST + // match ID tokens exactly. + IssuerURL string `json:"issuer"` + // AuthURL is the endpoint used by the provider to support the OAuth 2.0 + // authorization endpoint. + AuthURL string `json:"authorization_endpoint"` + // TokenURL is the endpoint used by the provider to support the OAuth 2.0 + // token endpoint. + TokenURL string `json:"token_endpoint"` + // DeviceAuthURL is the endpoint used by the provider to support the OAuth 2.0 + // device authorization endpoint. + DeviceAuthURL string `json:"device_authorization_endpoint"` + // UserInfoURL is the endpoint used by the provider to support the OpenID + // Connect UserInfo flow. + // + // https://openid.net/specs/openid-connect-core-1_0.html#UserInfo + UserInfoURL string `json:"userinfo_endpoint"` + // JWKSURL is the endpoint used by the provider to advertise public keys to + // verify issued ID tokens. This endpoint is polled as new keys are made + // available. + JWKSURL string `json:"jwks_uri"` + + // Algorithms, if provided, indicate a list of JWT algorithms allowed to sign + // ID tokens. If not provided, this defaults to the algorithms advertised by + // the JWK endpoint, then the set of algorithms supported by this package. + Algorithms []string `json:"id_token_signing_alg_values_supported"` +} + +// NewProvider initializes a provider from a set of endpoints, rather than +// through discovery. +// +// The provided context is only used for [http.Client] configuration through +// [ClientContext], not cancelation. +func (p *ProviderConfig) NewProvider(ctx context.Context) *Provider { + return &Provider{ + issuer: p.IssuerURL, + authURL: p.AuthURL, + tokenURL: p.TokenURL, + deviceAuthURL: p.DeviceAuthURL, + userInfoURL: p.UserInfoURL, + jwksURL: p.JWKSURL, + algorithms: p.Algorithms, + client: getClient(ctx), + } +} + +// NewProvider uses the OpenID Connect discovery mechanism to construct a Provider. +// The issuer is the URL identifier for the service. For example: "https://accounts.google.com" +// or "https://login.salesforce.com". +// +// OpenID Connect providers that don't implement discovery or host the discovery +// document at a non-spec complaint path (such as requiring a URL parameter), +// should use [ProviderConfig] instead. +// +// See: https://openid.net/specs/openid-connect-discovery-1_0.html +func NewProvider(ctx context.Context, issuer string) (*Provider, error) { + wellKnown := strings.TrimSuffix(issuer, "/") + "/.well-known/openid-configuration" + req, err := http.NewRequest("GET", wellKnown, nil) + if err != nil { + return nil, err + } + resp, err := doRequest(ctx, req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + body, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("unable to read response body: %v", err) + } + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("%s: %s", resp.Status, body) + } + + var p providerJSON + err = unmarshalResp(resp, body, &p) + if err != nil { + return nil, fmt.Errorf("oidc: failed to decode provider discovery object: %v", err) + } + + issuerURL, skipIssuerValidation := ctx.Value(issuerURLKey).(string) + if !skipIssuerValidation { + issuerURL = issuer + } + if p.Issuer != issuerURL && !skipIssuerValidation { + return nil, fmt.Errorf("oidc: issuer URL provided to client (%q) did not match the issuer URL returned by provider (%q)", issuer, p.Issuer) + } + var algs []string + for _, a := range p.Algorithms { + if supportedAlgorithms[a] { + algs = append(algs, a) + } + } + return &Provider{ + issuer: issuerURL, + authURL: p.AuthURL, + tokenURL: p.TokenURL, + deviceAuthURL: p.DeviceAuthURL, + userInfoURL: p.UserInfoURL, + jwksURL: p.JWKSURL, + algorithms: algs, + rawClaims: body, + client: getClient(ctx), + }, nil +} + +// Claims unmarshals raw fields returned by the server during discovery. +// +// var claims struct { +// ScopesSupported []string `json:"scopes_supported"` +// ClaimsSupported []string `json:"claims_supported"` +// } +// +// if err := provider.Claims(&claims); err != nil { +// // handle unmarshaling error +// } +// +// For a list of fields defined by the OpenID Connect spec see: +// https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata +func (p *Provider) Claims(v interface{}) error { + if p.rawClaims == nil { + return errors.New("oidc: claims not set") + } + return json.Unmarshal(p.rawClaims, v) +} + +// Endpoint returns the OAuth2 auth and token endpoints for the given provider. +func (p *Provider) Endpoint() oauth2.Endpoint { + return oauth2.Endpoint{AuthURL: p.authURL, DeviceAuthURL: p.deviceAuthURL, TokenURL: p.tokenURL} +} + +// UserInfoEndpoint returns the OpenID Connect userinfo endpoint for the given +// provider. +func (p *Provider) UserInfoEndpoint() string { + return p.userInfoURL +} + +// UserInfo represents the OpenID Connect userinfo claims. +type UserInfo struct { + Subject string `json:"sub"` + Profile string `json:"profile"` + Email string `json:"email"` + EmailVerified bool `json:"email_verified"` + + claims []byte +} + +type userInfoRaw struct { + Subject string `json:"sub"` + Profile string `json:"profile"` + Email string `json:"email"` + // Handle providers that return email_verified as a string + // https://forums.aws.amazon.com/thread.jspa?messageID=949441󧳁 and + // https://discuss.elastic.co/t/openid-error-after-authenticating-against-aws-cognito/206018/11 + EmailVerified stringAsBool `json:"email_verified"` +} + +// Claims unmarshals the raw JSON object claims into the provided object. +func (u *UserInfo) Claims(v interface{}) error { + if u.claims == nil { + return errors.New("oidc: claims not set") + } + return json.Unmarshal(u.claims, v) +} + +// UserInfo uses the token source to query the provider's user info endpoint. +func (p *Provider) UserInfo(ctx context.Context, tokenSource oauth2.TokenSource) (*UserInfo, error) { + if p.userInfoURL == "" { + return nil, errors.New("oidc: user info endpoint is not supported by this provider") + } + + req, err := http.NewRequest("GET", p.userInfoURL, nil) + if err != nil { + return nil, fmt.Errorf("oidc: create GET request: %v", err) + } + + token, err := tokenSource.Token() + if err != nil { + return nil, fmt.Errorf("oidc: get access token: %v", err) + } + token.SetAuthHeader(req) + + resp, err := doRequest(ctx, req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + body, err := io.ReadAll(resp.Body) + if err != nil { + return nil, err + } + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("%s: %s", resp.Status, body) + } + + ct := resp.Header.Get("Content-Type") + mediaType, _, parseErr := mime.ParseMediaType(ct) + if parseErr == nil && mediaType == "application/jwt" { + payload, err := p.remoteKeySet().VerifySignature(ctx, string(body)) + if err != nil { + return nil, fmt.Errorf("oidc: invalid userinfo jwt signature %v", err) + } + body = payload + } + + var userInfo userInfoRaw + if err := json.Unmarshal(body, &userInfo); err != nil { + return nil, fmt.Errorf("oidc: failed to decode userinfo: %v", err) + } + return &UserInfo{ + Subject: userInfo.Subject, + Profile: userInfo.Profile, + Email: userInfo.Email, + EmailVerified: bool(userInfo.EmailVerified), + claims: body, + }, nil +} + +// IDToken is an OpenID Connect extension that provides a predictable representation +// of an authorization event. +// +// The ID Token only holds fields OpenID Connect requires. To access additional +// claims returned by the server, use the Claims method. +type IDToken struct { + // The URL of the server which issued this token. OpenID Connect + // requires this value always be identical to the URL used for + // initial discovery. + // + // Note: Because of a known issue with Google Accounts' implementation + // this value may differ when using Google. + // + // See: https://developers.google.com/identity/protocols/OpenIDConnect#obtainuserinfo + Issuer string + + // The client ID, or set of client IDs, that this token is issued for. For + // common uses, this is the client that initialized the auth flow. + // + // This package ensures the audience contains an expected value. + Audience []string + + // A unique string which identifies the end user. + Subject string + + // Expiry of the token. Ths package will not process tokens that have + // expired unless that validation is explicitly turned off. + Expiry time.Time + // When the token was issued by the provider. + IssuedAt time.Time + + // Initial nonce provided during the authentication redirect. + // + // This package does NOT provided verification on the value of this field + // and it's the user's responsibility to ensure it contains a valid value. + Nonce string + + // at_hash claim, if set in the ID token. Callers can verify an access token + // that corresponds to the ID token using the VerifyAccessToken method. + AccessTokenHash string + + // signature algorithm used for ID token, needed to compute a verification hash of an + // access token + sigAlgorithm string + + // Raw payload of the id_token. + claims []byte + + // Map of distributed claim names to claim sources + distributedClaims map[string]claimSource +} + +// Claims unmarshals the raw JSON payload of the ID Token into a provided struct. +// +// idToken, err := idTokenVerifier.Verify(rawIDToken) +// if err != nil { +// // handle error +// } +// var claims struct { +// Email string `json:"email"` +// EmailVerified bool `json:"email_verified"` +// } +// if err := idToken.Claims(&claims); err != nil { +// // handle error +// } +func (i *IDToken) Claims(v interface{}) error { + if i.claims == nil { + return errors.New("oidc: claims not set") + } + return json.Unmarshal(i.claims, v) +} + +// VerifyAccessToken verifies that the hash of the access token that corresponds to the iD token +// matches the hash in the id token. It returns an error if the hashes don't match. +// It is the caller's responsibility to ensure that the optional access token hash is present for the ID token +// before calling this method. See https://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken +func (i *IDToken) VerifyAccessToken(accessToken string) error { + if i.AccessTokenHash == "" { + return errNoAtHash + } + var h hash.Hash + switch i.sigAlgorithm { + case RS256, ES256, PS256: + h = sha256.New() + case RS384, ES384, PS384: + h = sha512.New384() + case RS512, ES512, PS512, EdDSA: + h = sha512.New() + default: + return fmt.Errorf("oidc: unsupported signing algorithm %q", i.sigAlgorithm) + } + h.Write([]byte(accessToken)) // hash documents that Write will never return an error + sum := h.Sum(nil)[:h.Size()/2] + actual := base64.RawURLEncoding.EncodeToString(sum) + if actual != i.AccessTokenHash { + return errInvalidAtHash + } + return nil +} + +type idToken struct { + Issuer string `json:"iss"` + Subject string `json:"sub"` + Audience audience `json:"aud"` + Expiry jsonTime `json:"exp"` + IssuedAt jsonTime `json:"iat"` + NotBefore *jsonTime `json:"nbf"` + Nonce string `json:"nonce"` + AtHash string `json:"at_hash"` + ClaimNames map[string]string `json:"_claim_names"` + ClaimSources map[string]claimSource `json:"_claim_sources"` +} + +type claimSource struct { + Endpoint string `json:"endpoint"` + AccessToken string `json:"access_token"` +} + +type stringAsBool bool + +func (sb *stringAsBool) UnmarshalJSON(b []byte) error { + switch string(b) { + case "true", `"true"`: + *sb = true + case "false", `"false"`: + *sb = false + default: + return errors.New("invalid value for boolean") + } + return nil +} + +type audience []string + +func (a *audience) UnmarshalJSON(b []byte) error { + var s string + if json.Unmarshal(b, &s) == nil { + *a = audience{s} + return nil + } + var auds []string + if err := json.Unmarshal(b, &auds); err != nil { + return err + } + *a = auds + return nil +} + +type jsonTime time.Time + +func (j *jsonTime) UnmarshalJSON(b []byte) error { + var n json.Number + if err := json.Unmarshal(b, &n); err != nil { + return err + } + var unix int64 + + if t, err := n.Int64(); err == nil { + unix = t + } else { + f, err := n.Float64() + if err != nil { + return err + } + unix = int64(f) + } + *j = jsonTime(time.Unix(unix, 0)) + return nil +} + +func unmarshalResp(r *http.Response, body []byte, v interface{}) error { + err := json.Unmarshal(body, &v) + if err == nil { + return nil + } + ct := r.Header.Get("Content-Type") + mediaType, _, parseErr := mime.ParseMediaType(ct) + if parseErr == nil && mediaType == "application/json" { + return fmt.Errorf("got Content-Type = application/json, but could not unmarshal as JSON: %v", err) + } + return fmt.Errorf("expected Content-Type = application/json, got %q: %v", ct, err) +} diff --git a/vendor/github.com/coreos/go-oidc/v3/oidc/verify.go b/vendor/github.com/coreos/go-oidc/v3/oidc/verify.go new file mode 100644 index 00000000..a8bf107d --- /dev/null +++ b/vendor/github.com/coreos/go-oidc/v3/oidc/verify.go @@ -0,0 +1,338 @@ +package oidc + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "time" + + jose "github.com/go-jose/go-jose/v4" + "golang.org/x/oauth2" +) + +const ( + issuerGoogleAccounts = "https://accounts.google.com" + issuerGoogleAccountsNoScheme = "accounts.google.com" +) + +// TokenExpiredError indicates that Verify failed because the token was expired. This +// error does NOT indicate that the token is not also invalid for other reasons. Other +// checks might have failed if the expiration check had not failed. +type TokenExpiredError struct { + // Expiry is the time when the token expired. + Expiry time.Time +} + +func (e *TokenExpiredError) Error() string { + return fmt.Sprintf("oidc: token is expired (Token Expiry: %v)", e.Expiry) +} + +// KeySet is a set of publc JSON Web Keys that can be used to validate the signature +// of JSON web tokens. This is expected to be backed by a remote key set through +// provider metadata discovery or an in-memory set of keys delivered out-of-band. +type KeySet interface { + // VerifySignature parses the JSON web token, verifies the signature, and returns + // the raw payload. Header and claim fields are validated by other parts of the + // package. For example, the KeySet does not need to check values such as signature + // algorithm, issuer, and audience since the IDTokenVerifier validates these values + // independently. + // + // If VerifySignature makes HTTP requests to verify the token, it's expected to + // use any HTTP client associated with the context through ClientContext. + VerifySignature(ctx context.Context, jwt string) (payload []byte, err error) +} + +// IDTokenVerifier provides verification for ID Tokens. +type IDTokenVerifier struct { + keySet KeySet + config *Config + issuer string +} + +// NewVerifier returns a verifier manually constructed from a key set and issuer URL. +// +// It's easier to use provider discovery to construct an IDTokenVerifier than creating +// one directly. This method is intended to be used with provider that don't support +// metadata discovery, or avoiding round trips when the key set URL is already known. +// +// This constructor can be used to create a verifier directly using the issuer URL and +// JSON Web Key Set URL without using discovery: +// +// keySet := oidc.NewRemoteKeySet(ctx, "https://www.googleapis.com/oauth2/v3/certs") +// verifier := oidc.NewVerifier("https://accounts.google.com", keySet, config) +// +// Or a static key set (e.g. for testing): +// +// keySet := &oidc.StaticKeySet{PublicKeys: []crypto.PublicKey{pub1, pub2}} +// verifier := oidc.NewVerifier("https://accounts.google.com", keySet, config) +func NewVerifier(issuerURL string, keySet KeySet, config *Config) *IDTokenVerifier { + return &IDTokenVerifier{keySet: keySet, config: config, issuer: issuerURL} +} + +// Config is the configuration for an IDTokenVerifier. +type Config struct { + // Expected audience of the token. For a majority of the cases this is expected to be + // the ID of the client that initialized the login flow. It may occasionally differ if + // the provider supports the authorizing party (azp) claim. + // + // If not provided, users must explicitly set SkipClientIDCheck. + ClientID string + // If specified, only this set of algorithms may be used to sign the JWT. + // + // If the IDTokenVerifier is created from a provider with (*Provider).Verifier, this + // defaults to the set of algorithms the provider supports. Otherwise this values + // defaults to RS256. + SupportedSigningAlgs []string + + // If true, no ClientID check performed. Must be true if ClientID field is empty. + SkipClientIDCheck bool + // If true, token expiry is not checked. + SkipExpiryCheck bool + + // SkipIssuerCheck is intended for specialized cases where the the caller wishes to + // defer issuer validation. When enabled, callers MUST independently verify the Token's + // Issuer is a known good value. + // + // Mismatched issuers often indicate client mis-configuration. If mismatches are + // unexpected, evaluate if the provided issuer URL is incorrect instead of enabling + // this option. + SkipIssuerCheck bool + + // Time function to check Token expiry. Defaults to time.Now + Now func() time.Time + + // InsecureSkipSignatureCheck causes this package to skip JWT signature validation. + // It's intended for special cases where providers (such as Azure), use the "none" + // algorithm. + // + // This option can only be enabled safely when the ID Token is received directly + // from the provider after the token exchange. + // + // This option MUST NOT be used when receiving an ID Token from sources other + // than the token endpoint. + InsecureSkipSignatureCheck bool +} + +// VerifierContext returns an IDTokenVerifier that uses the provider's key set to +// verify JWTs. As opposed to Verifier, the context is used to configure requests +// to the upstream JWKs endpoint. The provided context's cancellation is ignored. +func (p *Provider) VerifierContext(ctx context.Context, config *Config) *IDTokenVerifier { + return p.newVerifier(NewRemoteKeySet(ctx, p.jwksURL), config) +} + +// Verifier returns an IDTokenVerifier that uses the provider's key set to verify JWTs. +// +// The returned verifier uses a background context for all requests to the upstream +// JWKs endpoint. To control that context, use VerifierContext instead. +func (p *Provider) Verifier(config *Config) *IDTokenVerifier { + return p.newVerifier(p.remoteKeySet(), config) +} + +func (p *Provider) newVerifier(keySet KeySet, config *Config) *IDTokenVerifier { + if len(config.SupportedSigningAlgs) == 0 && len(p.algorithms) > 0 { + // Make a copy so we don't modify the config values. + cp := &Config{} + *cp = *config + cp.SupportedSigningAlgs = p.algorithms + config = cp + } + return NewVerifier(p.issuer, keySet, config) +} + +func contains(sli []string, ele string) bool { + for _, s := range sli { + if s == ele { + return true + } + } + return false +} + +// Returns the Claims from the distributed JWT token +func resolveDistributedClaim(ctx context.Context, verifier *IDTokenVerifier, src claimSource) ([]byte, error) { + req, err := http.NewRequest("GET", src.Endpoint, nil) + if err != nil { + return nil, fmt.Errorf("malformed request: %v", err) + } + if src.AccessToken != "" { + req.Header.Set("Authorization", "Bearer "+src.AccessToken) + } + + resp, err := doRequest(ctx, req) + if err != nil { + return nil, fmt.Errorf("oidc: Request to endpoint failed: %v", err) + } + defer resp.Body.Close() + + body, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("unable to read response body: %v", err) + } + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("oidc: request failed: %v", resp.StatusCode) + } + + token, err := verifier.Verify(ctx, string(body)) + if err != nil { + return nil, fmt.Errorf("malformed response body: %v", err) + } + + return token.claims, nil +} + +// Verify parses a raw ID Token, verifies it's been signed by the provider, performs +// any additional checks depending on the Config, and returns the payload. +// +// Verify does NOT do nonce validation, which is the callers responsibility. +// +// See: https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation +// +// oauth2Token, err := oauth2Config.Exchange(ctx, r.URL.Query().Get("code")) +// if err != nil { +// // handle error +// } +// +// // Extract the ID Token from oauth2 token. +// rawIDToken, ok := oauth2Token.Extra("id_token").(string) +// if !ok { +// // handle error +// } +// +// token, err := verifier.Verify(ctx, rawIDToken) +func (v *IDTokenVerifier) Verify(ctx context.Context, rawIDToken string) (*IDToken, error) { + var supportedSigAlgs []jose.SignatureAlgorithm + for _, alg := range v.config.SupportedSigningAlgs { + supportedSigAlgs = append(supportedSigAlgs, jose.SignatureAlgorithm(alg)) + } + if len(supportedSigAlgs) == 0 { + // If no algorithms were specified by both the config and discovery, default + // to the one mandatory algorithm "RS256". + supportedSigAlgs = []jose.SignatureAlgorithm{jose.RS256} + } + if v.config.InsecureSkipSignatureCheck { + // "none" is a required value to even parse a JWT with the "none" algorithm + // using go-jose. + supportedSigAlgs = append(supportedSigAlgs, "none") + } + + // Parse and verify the signature first. This at least forces the user to have + // a valid, signed ID token before we do any other processing. + jws, err := jose.ParseSigned(rawIDToken, supportedSigAlgs) + if err != nil { + return nil, fmt.Errorf("oidc: malformed jwt: %v", err) + } + switch len(jws.Signatures) { + case 0: + return nil, fmt.Errorf("oidc: id token not signed") + case 1: + default: + return nil, fmt.Errorf("oidc: multiple signatures on id token not supported") + } + sig := jws.Signatures[0] + + var payload []byte + if v.config.InsecureSkipSignatureCheck { + // Yolo mode. + payload = jws.UnsafePayloadWithoutVerification() + } else { + // The JWT is attached here for the happy path to avoid the verifier from + // having to parse the JWT twice. + ctx = context.WithValue(ctx, parsedJWTKey, jws) + payload, err = v.keySet.VerifySignature(ctx, rawIDToken) + if err != nil { + return nil, fmt.Errorf("failed to verify signature: %v", err) + } + } + var token idToken + if err := json.Unmarshal(payload, &token); err != nil { + return nil, fmt.Errorf("oidc: failed to unmarshal claims: %v", err) + } + + distributedClaims := make(map[string]claimSource) + + //step through the token to map claim names to claim sources" + for cn, src := range token.ClaimNames { + if src == "" { + return nil, fmt.Errorf("oidc: failed to obtain source from claim name") + } + s, ok := token.ClaimSources[src] + if !ok { + return nil, fmt.Errorf("oidc: source does not exist") + } + distributedClaims[cn] = s + } + + t := &IDToken{ + Issuer: token.Issuer, + Subject: token.Subject, + Audience: []string(token.Audience), + Expiry: time.Time(token.Expiry), + IssuedAt: time.Time(token.IssuedAt), + Nonce: token.Nonce, + AccessTokenHash: token.AtHash, + claims: payload, + distributedClaims: distributedClaims, + sigAlgorithm: sig.Header.Algorithm, + } + + // Check issuer. + if !v.config.SkipIssuerCheck && t.Issuer != v.issuer { + // Google sometimes returns "accounts.google.com" as the issuer claim instead of + // the required "https://accounts.google.com". Detect this case and allow it only + // for Google. + // + // We will not add hooks to let other providers go off spec like this. + if !(v.issuer == issuerGoogleAccounts && t.Issuer == issuerGoogleAccountsNoScheme) { + return nil, fmt.Errorf("oidc: id token issued by a different provider, expected %q got %q", v.issuer, t.Issuer) + } + } + + // If a client ID has been provided, make sure it's part of the audience. SkipClientIDCheck must be true if ClientID is empty. + // + // This check DOES NOT ensure that the ClientID is the party to which the ID Token was issued (i.e. Authorized party). + if !v.config.SkipClientIDCheck { + if v.config.ClientID != "" { + if !contains(t.Audience, v.config.ClientID) { + return nil, fmt.Errorf("oidc: expected audience %q got %q", v.config.ClientID, t.Audience) + } + } else { + return nil, fmt.Errorf("oidc: invalid configuration, clientID must be provided or SkipClientIDCheck must be set") + } + } + + // If a SkipExpiryCheck is false, make sure token is not expired. + if !v.config.SkipExpiryCheck { + now := time.Now + if v.config.Now != nil { + now = v.config.Now + } + nowTime := now() + + if t.Expiry.Before(nowTime) { + return nil, &TokenExpiredError{Expiry: t.Expiry} + } + + // If nbf claim is provided in token, ensure that it is indeed in the past. + if token.NotBefore != nil { + nbfTime := time.Time(*token.NotBefore) + // Set to 5 minutes since this is what other OpenID Connect providers do to deal with clock skew. + // https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/blob/6.12.2/src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs#L149-L153 + leeway := 5 * time.Minute + + if nowTime.Add(leeway).Before(nbfTime) { + return nil, fmt.Errorf("oidc: current time %v before the nbf (not before) time: %v", nowTime, nbfTime) + } + } + } + + return t, nil +} + +// Nonce returns an auth code option which requires the ID Token created by the +// OpenID Connect provider to contain the specified nonce. +func Nonce(nonce string) oauth2.AuthCodeOption { + return oauth2.SetAuthURLParam("nonce", nonce) +} diff --git a/vendor/github.com/go-jose/go-jose/v4/.gitignore b/vendor/github.com/go-jose/go-jose/v4/.gitignore new file mode 100644 index 00000000..eb29ebae --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/.gitignore @@ -0,0 +1,2 @@ +jose-util/jose-util +jose-util.t.err \ No newline at end of file diff --git a/vendor/github.com/go-jose/go-jose/v4/.golangci.yml b/vendor/github.com/go-jose/go-jose/v4/.golangci.yml new file mode 100644 index 00000000..2a577a8f --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/.golangci.yml @@ -0,0 +1,53 @@ +# https://github.com/golangci/golangci-lint + +run: + skip-files: + - doc_test.go + modules-download-mode: readonly + +linters: + enable-all: true + disable: + - gochecknoglobals + - goconst + - lll + - maligned + - nakedret + - scopelint + - unparam + - funlen # added in 1.18 (requires go-jose changes before it can be enabled) + +linters-settings: + gocyclo: + min-complexity: 35 + +issues: + exclude-rules: + - text: "don't use ALL_CAPS in Go names" + linters: + - golint + - text: "hardcoded credentials" + linters: + - gosec + - text: "weak cryptographic primitive" + linters: + - gosec + - path: json/ + linters: + - dupl + - errcheck + - gocritic + - gocyclo + - golint + - govet + - ineffassign + - staticcheck + - structcheck + - stylecheck + - unused + - path: _test\.go + linters: + - scopelint + - path: jwk.go + linters: + - gocyclo diff --git a/vendor/github.com/go-jose/go-jose/v4/.travis.yml b/vendor/github.com/go-jose/go-jose/v4/.travis.yml new file mode 100644 index 00000000..48de631b --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/.travis.yml @@ -0,0 +1,33 @@ +language: go + +matrix: + fast_finish: true + allow_failures: + - go: tip + +go: + - "1.13.x" + - "1.14.x" + - tip + +before_script: + - export PATH=$HOME/.local/bin:$PATH + +before_install: + - go get -u github.com/mattn/goveralls github.com/wadey/gocovmerge + - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.18.0 + - pip install cram --user + +script: + - go test -v -covermode=count -coverprofile=profile.cov . + - go test -v -covermode=count -coverprofile=cryptosigner/profile.cov ./cryptosigner + - go test -v -covermode=count -coverprofile=cipher/profile.cov ./cipher + - go test -v -covermode=count -coverprofile=jwt/profile.cov ./jwt + - go test -v ./json # no coverage for forked encoding/json package + - golangci-lint run + - cd jose-util && go build && PATH=$PWD:$PATH cram -v jose-util.t # cram tests jose-util + - cd .. + +after_success: + - gocovmerge *.cov */*.cov > merged.coverprofile + - goveralls -coverprofile merged.coverprofile -service=travis-ci diff --git a/vendor/github.com/go-jose/go-jose/v4/CONTRIBUTING.md b/vendor/github.com/go-jose/go-jose/v4/CONTRIBUTING.md new file mode 100644 index 00000000..4b4805ad --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/CONTRIBUTING.md @@ -0,0 +1,9 @@ +# Contributing + +If you would like to contribute code to go-jose you can do so through GitHub by +forking the repository and sending a pull request. + +When submitting code, please make every effort to follow existing conventions +and style in order to keep the code as readable as possible. Please also make +sure all tests pass by running `go test`, and format your code with `go fmt`. +We also recommend using `golint` and `errcheck`. diff --git a/vendor/github.com/go-jose/go-jose/v4/LICENSE b/vendor/github.com/go-jose/go-jose/v4/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-jose/go-jose/v4/README.md b/vendor/github.com/go-jose/go-jose/v4/README.md new file mode 100644 index 00000000..55c55091 --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/README.md @@ -0,0 +1,108 @@ +# Go JOSE + +[![godoc](https://pkg.go.dev/badge/github.com/go-jose/go-jose/v4.svg)](https://pkg.go.dev/github.com/go-jose/go-jose/v4) +[![godoc](https://pkg.go.dev/badge/github.com/go-jose/go-jose/v4/jwt.svg)](https://pkg.go.dev/github.com/go-jose/go-jose/v4/jwt) +[![license](https://img.shields.io/badge/license-apache_2.0-blue.svg?style=flat)](https://raw.githubusercontent.com/go-jose/go-jose/master/LICENSE) + +Package jose aims to provide an implementation of the Javascript Object Signing +and Encryption set of standards. This includes support for JSON Web Encryption, +JSON Web Signature, and JSON Web Token standards. + +## Overview + +The implementation follows the +[JSON Web Encryption](https://dx.doi.org/10.17487/RFC7516) (RFC 7516), +[JSON Web Signature](https://dx.doi.org/10.17487/RFC7515) (RFC 7515), and +[JSON Web Token](https://dx.doi.org/10.17487/RFC7519) (RFC 7519) specifications. +Tables of supported algorithms are shown below. The library supports both +the compact and JWS/JWE JSON Serialization formats, and has optional support for +multiple recipients. It also comes with a small command-line utility +([`jose-util`](https://pkg.go.dev/github.com/go-jose/go-jose/jose-util)) +for dealing with JOSE messages in a shell. + +**Note**: We use a forked version of the `encoding/json` package from the Go +standard library which uses case-sensitive matching for member names (instead +of [case-insensitive matching](https://www.ietf.org/mail-archive/web/json/current/msg03763.html)). +This is to avoid differences in interpretation of messages between go-jose and +libraries in other languages. + +### Versions + +The forthcoming Version 5 will be released with several breaking API changes, +and will require Golang's `encoding/json/v2`, which is currently requires +Go 1.25 built with GOEXPERIMENT=jsonv2. + +Version 4 is the current stable version: + + import "github.com/go-jose/go-jose/v4" + +It supports at least the current and previous Golang release. Currently it +requires Golang 1.24. + +Version 3 is only receiving critical security updates. Migration to Version 4 is recommended. + +Versions 1 and 2 are obsolete, but can be found in the old repository, [square/go-jose](https://github.com/square/go-jose). + +### Supported algorithms + +See below for a table of supported algorithms. Algorithm identifiers match +the names in the [JSON Web Algorithms](https://dx.doi.org/10.17487/RFC7518) +standard where possible. The Godoc reference has a list of constants. + +| Key encryption | Algorithm identifier(s) | +|:-----------------------|:-----------------------------------------------| +| RSA-PKCS#1v1.5 | RSA1_5 | +| RSA-OAEP | RSA-OAEP, RSA-OAEP-256 | +| AES key wrap | A128KW, A192KW, A256KW | +| AES-GCM key wrap | A128GCMKW, A192GCMKW, A256GCMKW | +| ECDH-ES + AES key wrap | ECDH-ES+A128KW, ECDH-ES+A192KW, ECDH-ES+A256KW | +| ECDH-ES (direct) | ECDH-ES1 | +| Direct encryption | dir1 | + +1. Not supported in multi-recipient mode + +| Signing / MAC | Algorithm identifier(s) | +|:------------------|:------------------------| +| RSASSA-PKCS#1v1.5 | RS256, RS384, RS512 | +| RSASSA-PSS | PS256, PS384, PS512 | +| HMAC | HS256, HS384, HS512 | +| ECDSA | ES256, ES384, ES512 | +| Ed25519 | EdDSA2 | + +2. Only available in version 2 of the package + +| Content encryption | Algorithm identifier(s) | +|:-------------------|:--------------------------------------------| +| AES-CBC+HMAC | A128CBC-HS256, A192CBC-HS384, A256CBC-HS512 | +| AES-GCM | A128GCM, A192GCM, A256GCM | + +| Compression | Algorithm identifiers(s) | +|:-------------------|--------------------------| +| DEFLATE (RFC 1951) | DEF | + +### Supported key types + +See below for a table of supported key types. These are understood by the +library, and can be passed to corresponding functions such as `NewEncrypter` or +`NewSigner`. Each of these keys can also be wrapped in a JWK if desired, which +allows attaching a key id. + +| Algorithm(s) | Corresponding types | +|:------------------|--------------------------------------------------------------------------------------------------------------------------------------| +| RSA | *[rsa.PublicKey](https://pkg.go.dev/crypto/rsa/#PublicKey), *[rsa.PrivateKey](https://pkg.go.dev/crypto/rsa/#PrivateKey) | +| ECDH, ECDSA | *[ecdsa.PublicKey](https://pkg.go.dev/crypto/ecdsa/#PublicKey), *[ecdsa.PrivateKey](https://pkg.go.dev/crypto/ecdsa/#PrivateKey) | +| EdDSA1 | [ed25519.PublicKey](https://pkg.go.dev/crypto/ed25519#PublicKey), [ed25519.PrivateKey](https://pkg.go.dev/crypto/ed25519#PrivateKey) | +| AES, HMAC | []byte | + +1. Only available in version 2 or later of the package + +## Examples + +[![godoc](https://pkg.go.dev/badge/github.com/go-jose/go-jose/v4.svg)](https://pkg.go.dev/github.com/go-jose/go-jose/v4) +[![godoc](https://pkg.go.dev/badge/github.com/go-jose/go-jose/v4/jwt.svg)](https://pkg.go.dev/github.com/go-jose/go-jose/v4/jwt) + +Examples can be found in the Godoc +reference for this package. The +[`jose-util`](https://github.com/go-jose/go-jose/tree/main/jose-util) +subdirectory also contains a small command-line utility which might be useful +as an example as well. diff --git a/vendor/github.com/go-jose/go-jose/v4/SECURITY.md b/vendor/github.com/go-jose/go-jose/v4/SECURITY.md new file mode 100644 index 00000000..2f18a75a --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy +This document explains how to contact the Let's Encrypt security team to report security vulnerabilities. + +## Supported Versions +| Version | Supported | +| ------- | ----------| +| >= v3 | ✓ | +| v2 | ✗ | +| v1 | ✗ | + +## Reporting a vulnerability + +Please see [https://letsencrypt.org/contact/#security](https://letsencrypt.org/contact/#security) for the email address to report a vulnerability. Ensure that the subject line for your report contains the word `vulnerability` and is descriptive. Your email should be acknowledged within 24 hours. If you do not receive a response within 24 hours, please follow-up again with another email. diff --git a/vendor/github.com/go-jose/go-jose/v4/asymmetric.go b/vendor/github.com/go-jose/go-jose/v4/asymmetric.go new file mode 100644 index 00000000..f8d5774e --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/asymmetric.go @@ -0,0 +1,595 @@ +/*- + * Copyright 2014 Square Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package jose + +import ( + "crypto" + "crypto/aes" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/rand" + "crypto/rsa" + "crypto/sha1" + "crypto/sha256" + "errors" + "fmt" + "math/big" + + josecipher "github.com/go-jose/go-jose/v4/cipher" + "github.com/go-jose/go-jose/v4/json" +) + +// A generic RSA-based encrypter/verifier +type rsaEncrypterVerifier struct { + publicKey *rsa.PublicKey +} + +// A generic RSA-based decrypter/signer +type rsaDecrypterSigner struct { + privateKey *rsa.PrivateKey +} + +// A generic EC-based encrypter/verifier +type ecEncrypterVerifier struct { + publicKey *ecdsa.PublicKey +} + +type edEncrypterVerifier struct { + publicKey ed25519.PublicKey +} + +// A key generator for ECDH-ES +type ecKeyGenerator struct { + size int + algID string + publicKey *ecdsa.PublicKey +} + +// A generic EC-based decrypter/signer +type ecDecrypterSigner struct { + privateKey *ecdsa.PrivateKey +} + +type edDecrypterSigner struct { + privateKey ed25519.PrivateKey +} + +// newRSARecipient creates recipientKeyInfo based on the given key. +func newRSARecipient(keyAlg KeyAlgorithm, publicKey *rsa.PublicKey) (recipientKeyInfo, error) { + // Verify that key management algorithm is supported by this encrypter + switch keyAlg { + case RSA1_5, RSA_OAEP, RSA_OAEP_256: + default: + return recipientKeyInfo{}, ErrUnsupportedAlgorithm + } + + if publicKey == nil { + return recipientKeyInfo{}, errors.New("invalid public key") + } + + return recipientKeyInfo{ + keyAlg: keyAlg, + keyEncrypter: &rsaEncrypterVerifier{ + publicKey: publicKey, + }, + }, nil +} + +// newRSASigner creates a recipientSigInfo based on the given key. +func newRSASigner(sigAlg SignatureAlgorithm, privateKey *rsa.PrivateKey) (recipientSigInfo, error) { + // Verify that key management algorithm is supported by this encrypter + switch sigAlg { + case RS256, RS384, RS512, PS256, PS384, PS512: + default: + return recipientSigInfo{}, ErrUnsupportedAlgorithm + } + + if privateKey == nil { + return recipientSigInfo{}, errors.New("invalid private key") + } + + return recipientSigInfo{ + sigAlg: sigAlg, + publicKey: staticPublicKey(&JSONWebKey{ + Key: privateKey.Public(), + }), + signer: &rsaDecrypterSigner{ + privateKey: privateKey, + }, + }, nil +} + +func newEd25519Signer(sigAlg SignatureAlgorithm, privateKey ed25519.PrivateKey) (recipientSigInfo, error) { + if sigAlg != EdDSA { + return recipientSigInfo{}, ErrUnsupportedAlgorithm + } + + if privateKey == nil { + return recipientSigInfo{}, errors.New("invalid private key") + } + return recipientSigInfo{ + sigAlg: sigAlg, + publicKey: staticPublicKey(&JSONWebKey{ + Key: privateKey.Public(), + }), + signer: &edDecrypterSigner{ + privateKey: privateKey, + }, + }, nil +} + +// newECDHRecipient creates recipientKeyInfo based on the given key. +func newECDHRecipient(keyAlg KeyAlgorithm, publicKey *ecdsa.PublicKey) (recipientKeyInfo, error) { + // Verify that key management algorithm is supported by this encrypter + switch keyAlg { + case ECDH_ES, ECDH_ES_A128KW, ECDH_ES_A192KW, ECDH_ES_A256KW: + default: + return recipientKeyInfo{}, ErrUnsupportedAlgorithm + } + + if publicKey == nil || !publicKey.Curve.IsOnCurve(publicKey.X, publicKey.Y) { + return recipientKeyInfo{}, errors.New("invalid public key") + } + + return recipientKeyInfo{ + keyAlg: keyAlg, + keyEncrypter: &ecEncrypterVerifier{ + publicKey: publicKey, + }, + }, nil +} + +// newECDSASigner creates a recipientSigInfo based on the given key. +func newECDSASigner(sigAlg SignatureAlgorithm, privateKey *ecdsa.PrivateKey) (recipientSigInfo, error) { + // Verify that key management algorithm is supported by this encrypter + switch sigAlg { + case ES256, ES384, ES512: + default: + return recipientSigInfo{}, ErrUnsupportedAlgorithm + } + + if privateKey == nil { + return recipientSigInfo{}, errors.New("invalid private key") + } + + return recipientSigInfo{ + sigAlg: sigAlg, + publicKey: staticPublicKey(&JSONWebKey{ + Key: privateKey.Public(), + }), + signer: &ecDecrypterSigner{ + privateKey: privateKey, + }, + }, nil +} + +// Encrypt the given payload and update the object. +func (ctx rsaEncrypterVerifier) encryptKey(cek []byte, alg KeyAlgorithm) (recipientInfo, error) { + encryptedKey, err := ctx.encrypt(cek, alg) + if err != nil { + return recipientInfo{}, err + } + + return recipientInfo{ + encryptedKey: encryptedKey, + header: &rawHeader{}, + }, nil +} + +// Encrypt the given payload. Based on the key encryption algorithm, +// this will either use RSA-PKCS1v1.5 or RSA-OAEP (with SHA-1 or SHA-256). +func (ctx rsaEncrypterVerifier) encrypt(cek []byte, alg KeyAlgorithm) ([]byte, error) { + switch alg { + case RSA1_5: + return rsa.EncryptPKCS1v15(RandReader, ctx.publicKey, cek) + case RSA_OAEP: + return rsa.EncryptOAEP(sha1.New(), RandReader, ctx.publicKey, cek, []byte{}) + case RSA_OAEP_256: + return rsa.EncryptOAEP(sha256.New(), RandReader, ctx.publicKey, cek, []byte{}) + } + + return nil, ErrUnsupportedAlgorithm +} + +// Decrypt the given payload and return the content encryption key. +func (ctx rsaDecrypterSigner) decryptKey(headers rawHeader, recipient *recipientInfo, generator keyGenerator) ([]byte, error) { + return ctx.decrypt(recipient.encryptedKey, headers.getAlgorithm(), generator) +} + +// Decrypt the given payload. Based on the key encryption algorithm, +// this will either use RSA-PKCS1v1.5 or RSA-OAEP (with SHA-1 or SHA-256). +func (ctx rsaDecrypterSigner) decrypt(jek []byte, alg KeyAlgorithm, generator keyGenerator) ([]byte, error) { + // Note: The random reader on decrypt operations is only used for blinding, + // so stubbing is meanlingless (hence the direct use of rand.Reader). + switch alg { + case RSA1_5: + defer func() { + // DecryptPKCS1v15SessionKey sometimes panics on an invalid payload + // because of an index out of bounds error, which we want to ignore. + // This has been fixed in Go 1.3.1 (released 2014/08/13), the recover() + // only exists for preventing crashes with unpatched versions. + // See: https://groups.google.com/forum/#!topic/golang-dev/7ihX6Y6kx9k + // See: https://code.google.com/p/go/source/detail?r=58ee390ff31602edb66af41ed10901ec95904d33 + _ = recover() + }() + + // Perform some input validation. + keyBytes := ctx.privateKey.PublicKey.N.BitLen() / 8 + if keyBytes != len(jek) { + // Input size is incorrect, the encrypted payload should always match + // the size of the public modulus (e.g. using a 2048 bit key will + // produce 256 bytes of output). Reject this since it's invalid input. + return nil, ErrCryptoFailure + } + + cek, _, err := generator.genKey() + if err != nil { + return nil, ErrCryptoFailure + } + + // When decrypting an RSA-PKCS1v1.5 payload, we must take precautions to + // prevent chosen-ciphertext attacks as described in RFC 3218, "Preventing + // the Million Message Attack on Cryptographic Message Syntax". We are + // therefore deliberately ignoring errors here. + _ = rsa.DecryptPKCS1v15SessionKey(rand.Reader, ctx.privateKey, jek, cek) + + return cek, nil + case RSA_OAEP: + // Use rand.Reader for RSA blinding + return rsa.DecryptOAEP(sha1.New(), rand.Reader, ctx.privateKey, jek, []byte{}) + case RSA_OAEP_256: + // Use rand.Reader for RSA blinding + return rsa.DecryptOAEP(sha256.New(), rand.Reader, ctx.privateKey, jek, []byte{}) + } + + return nil, ErrUnsupportedAlgorithm +} + +// Sign the given payload +func (ctx rsaDecrypterSigner) signPayload(payload []byte, alg SignatureAlgorithm) (Signature, error) { + var hash crypto.Hash + + switch alg { + case RS256, PS256: + hash = crypto.SHA256 + case RS384, PS384: + hash = crypto.SHA384 + case RS512, PS512: + hash = crypto.SHA512 + default: + return Signature{}, ErrUnsupportedAlgorithm + } + + hasher := hash.New() + + // According to documentation, Write() on hash never fails + _, _ = hasher.Write(payload) + hashed := hasher.Sum(nil) + + var out []byte + var err error + + switch alg { + case RS256, RS384, RS512: + // TODO(https://github.com/go-jose/go-jose/issues/40): As of go1.20, the + // random parameter is legacy and ignored, and it can be nil. + // https://cs.opensource.google/go/go/+/refs/tags/go1.20:src/crypto/rsa/pkcs1v15.go;l=263;bpv=0;bpt=1 + out, err = rsa.SignPKCS1v15(RandReader, ctx.privateKey, hash, hashed) + case PS256, PS384, PS512: + out, err = rsa.SignPSS(RandReader, ctx.privateKey, hash, hashed, &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthEqualsHash, + }) + } + + if err != nil { + return Signature{}, err + } + + return Signature{ + Signature: out, + protected: &rawHeader{}, + }, nil +} + +// Verify the given payload +func (ctx rsaEncrypterVerifier) verifyPayload(payload []byte, signature []byte, alg SignatureAlgorithm) error { + var hash crypto.Hash + + switch alg { + case RS256, PS256: + hash = crypto.SHA256 + case RS384, PS384: + hash = crypto.SHA384 + case RS512, PS512: + hash = crypto.SHA512 + default: + return ErrUnsupportedAlgorithm + } + + hasher := hash.New() + + // According to documentation, Write() on hash never fails + _, _ = hasher.Write(payload) + hashed := hasher.Sum(nil) + + switch alg { + case RS256, RS384, RS512: + return rsa.VerifyPKCS1v15(ctx.publicKey, hash, hashed, signature) + case PS256, PS384, PS512: + return rsa.VerifyPSS(ctx.publicKey, hash, hashed, signature, nil) + } + + return ErrUnsupportedAlgorithm +} + +// Encrypt the given payload and update the object. +func (ctx ecEncrypterVerifier) encryptKey(cek []byte, alg KeyAlgorithm) (recipientInfo, error) { + switch alg { + case ECDH_ES: + // ECDH-ES mode doesn't wrap a key, the shared secret is used directly as the key. + return recipientInfo{ + header: &rawHeader{}, + }, nil + case ECDH_ES_A128KW, ECDH_ES_A192KW, ECDH_ES_A256KW: + default: + return recipientInfo{}, ErrUnsupportedAlgorithm + } + + generator := ecKeyGenerator{ + algID: string(alg), + publicKey: ctx.publicKey, + } + + switch alg { + case ECDH_ES_A128KW: + generator.size = 16 + case ECDH_ES_A192KW: + generator.size = 24 + case ECDH_ES_A256KW: + generator.size = 32 + } + + kek, header, err := generator.genKey() + if err != nil { + return recipientInfo{}, err + } + + block, err := aes.NewCipher(kek) + if err != nil { + return recipientInfo{}, err + } + + jek, err := josecipher.KeyWrap(block, cek) + if err != nil { + return recipientInfo{}, err + } + + return recipientInfo{ + encryptedKey: jek, + header: &header, + }, nil +} + +// Get key size for EC key generator +func (ctx ecKeyGenerator) keySize() int { + return ctx.size +} + +// Get a content encryption key for ECDH-ES +func (ctx ecKeyGenerator) genKey() ([]byte, rawHeader, error) { + priv, err := ecdsa.GenerateKey(ctx.publicKey.Curve, RandReader) + if err != nil { + return nil, rawHeader{}, err + } + + out := josecipher.DeriveECDHES(ctx.algID, []byte{}, []byte{}, priv, ctx.publicKey, ctx.size) + + b, err := json.Marshal(&JSONWebKey{ + Key: &priv.PublicKey, + }) + if err != nil { + return nil, nil, err + } + + headers := rawHeader{ + headerEPK: makeRawMessage(b), + } + + return out, headers, nil +} + +// Decrypt the given payload and return the content encryption key. +func (ctx ecDecrypterSigner) decryptKey(headers rawHeader, recipient *recipientInfo, generator keyGenerator) ([]byte, error) { + epk, err := headers.getEPK() + if err != nil { + return nil, errors.New("go-jose/go-jose: invalid epk header") + } + if epk == nil { + return nil, errors.New("go-jose/go-jose: missing epk header") + } + + publicKey, ok := epk.Key.(*ecdsa.PublicKey) + if publicKey == nil || !ok { + return nil, errors.New("go-jose/go-jose: invalid epk header") + } + + if !ctx.privateKey.Curve.IsOnCurve(publicKey.X, publicKey.Y) { + return nil, errors.New("go-jose/go-jose: invalid public key in epk header") + } + + apuData, err := headers.getAPU() + if err != nil { + return nil, errors.New("go-jose/go-jose: invalid apu header") + } + apvData, err := headers.getAPV() + if err != nil { + return nil, errors.New("go-jose/go-jose: invalid apv header") + } + + deriveKey := func(algID string, size int) []byte { + return josecipher.DeriveECDHES(algID, apuData.bytes(), apvData.bytes(), ctx.privateKey, publicKey, size) + } + + var keySize int + + algorithm := headers.getAlgorithm() + switch algorithm { + case ECDH_ES: + // ECDH-ES uses direct key agreement, no key unwrapping necessary. + return deriveKey(string(headers.getEncryption()), generator.keySize()), nil + case ECDH_ES_A128KW: + keySize = 16 + case ECDH_ES_A192KW: + keySize = 24 + case ECDH_ES_A256KW: + keySize = 32 + default: + return nil, ErrUnsupportedAlgorithm + } + + key := deriveKey(string(algorithm), keySize) + block, err := aes.NewCipher(key) + if err != nil { + return nil, err + } + + return josecipher.KeyUnwrap(block, recipient.encryptedKey) +} + +func (ctx edDecrypterSigner) signPayload(payload []byte, alg SignatureAlgorithm) (Signature, error) { + if alg != EdDSA { + return Signature{}, ErrUnsupportedAlgorithm + } + + sig, err := ctx.privateKey.Sign(RandReader, payload, crypto.Hash(0)) + if err != nil { + return Signature{}, err + } + + return Signature{ + Signature: sig, + protected: &rawHeader{}, + }, nil +} + +func (ctx edEncrypterVerifier) verifyPayload(payload []byte, signature []byte, alg SignatureAlgorithm) error { + if alg != EdDSA { + return ErrUnsupportedAlgorithm + } + ok := ed25519.Verify(ctx.publicKey, payload, signature) + if !ok { + return errors.New("go-jose/go-jose: ed25519 signature failed to verify") + } + return nil +} + +// Sign the given payload +func (ctx ecDecrypterSigner) signPayload(payload []byte, alg SignatureAlgorithm) (Signature, error) { + var expectedBitSize int + var hash crypto.Hash + + switch alg { + case ES256: + expectedBitSize = 256 + hash = crypto.SHA256 + case ES384: + expectedBitSize = 384 + hash = crypto.SHA384 + case ES512: + expectedBitSize = 521 + hash = crypto.SHA512 + } + + curveBits := ctx.privateKey.Curve.Params().BitSize + if expectedBitSize != curveBits { + return Signature{}, fmt.Errorf("go-jose/go-jose: expected %d bit key, got %d bits instead", expectedBitSize, curveBits) + } + + hasher := hash.New() + + // According to documentation, Write() on hash never fails + _, _ = hasher.Write(payload) + hashed := hasher.Sum(nil) + + r, s, err := ecdsa.Sign(RandReader, ctx.privateKey, hashed) + if err != nil { + return Signature{}, err + } + + keyBytes := curveBits / 8 + if curveBits%8 > 0 { + keyBytes++ + } + + // We serialize the outputs (r and s) into big-endian byte arrays and pad + // them with zeros on the left to make sure the sizes work out. Both arrays + // must be keyBytes long, and the output must be 2*keyBytes long. + rBytes := r.Bytes() + rBytesPadded := make([]byte, keyBytes) + copy(rBytesPadded[keyBytes-len(rBytes):], rBytes) + + sBytes := s.Bytes() + sBytesPadded := make([]byte, keyBytes) + copy(sBytesPadded[keyBytes-len(sBytes):], sBytes) + + out := append(rBytesPadded, sBytesPadded...) + + return Signature{ + Signature: out, + protected: &rawHeader{}, + }, nil +} + +// Verify the given payload +func (ctx ecEncrypterVerifier) verifyPayload(payload []byte, signature []byte, alg SignatureAlgorithm) error { + var keySize int + var hash crypto.Hash + + switch alg { + case ES256: + keySize = 32 + hash = crypto.SHA256 + case ES384: + keySize = 48 + hash = crypto.SHA384 + case ES512: + keySize = 66 + hash = crypto.SHA512 + default: + return ErrUnsupportedAlgorithm + } + + if len(signature) != 2*keySize { + return fmt.Errorf("go-jose/go-jose: invalid signature size, have %d bytes, wanted %d", len(signature), 2*keySize) + } + + hasher := hash.New() + + // According to documentation, Write() on hash never fails + _, _ = hasher.Write(payload) + hashed := hasher.Sum(nil) + + r := big.NewInt(0).SetBytes(signature[:keySize]) + s := big.NewInt(0).SetBytes(signature[keySize:]) + + match := ecdsa.Verify(ctx.publicKey, hashed, r, s) + if !match { + return errors.New("go-jose/go-jose: ecdsa signature failed to verify") + } + + return nil +} diff --git a/vendor/github.com/go-jose/go-jose/v4/cipher/cbc_hmac.go b/vendor/github.com/go-jose/go-jose/v4/cipher/cbc_hmac.go new file mode 100644 index 00000000..af029cec --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/cipher/cbc_hmac.go @@ -0,0 +1,196 @@ +/*- + * Copyright 2014 Square Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package josecipher + +import ( + "bytes" + "crypto/cipher" + "crypto/hmac" + "crypto/sha256" + "crypto/sha512" + "crypto/subtle" + "encoding/binary" + "errors" + "hash" +) + +const ( + nonceBytes = 16 +) + +// NewCBCHMAC instantiates a new AEAD based on CBC+HMAC. +func NewCBCHMAC(key []byte, newBlockCipher func([]byte) (cipher.Block, error)) (cipher.AEAD, error) { + keySize := len(key) / 2 + integrityKey := key[:keySize] + encryptionKey := key[keySize:] + + blockCipher, err := newBlockCipher(encryptionKey) + if err != nil { + return nil, err + } + + var hash func() hash.Hash + switch keySize { + case 16: + hash = sha256.New + case 24: + hash = sha512.New384 + case 32: + hash = sha512.New + } + + return &cbcAEAD{ + hash: hash, + blockCipher: blockCipher, + authtagBytes: keySize, + integrityKey: integrityKey, + }, nil +} + +// An AEAD based on CBC+HMAC +type cbcAEAD struct { + hash func() hash.Hash + authtagBytes int + integrityKey []byte + blockCipher cipher.Block +} + +func (ctx *cbcAEAD) NonceSize() int { + return nonceBytes +} + +func (ctx *cbcAEAD) Overhead() int { + // Maximum overhead is block size (for padding) plus auth tag length, where + // the length of the auth tag is equivalent to the key size. + return ctx.blockCipher.BlockSize() + ctx.authtagBytes +} + +// Seal encrypts and authenticates the plaintext. +func (ctx *cbcAEAD) Seal(dst, nonce, plaintext, data []byte) []byte { + // Output buffer -- must take care not to mangle plaintext input. + ciphertext := make([]byte, uint64(len(plaintext))+uint64(ctx.Overhead()))[:len(plaintext)] + copy(ciphertext, plaintext) + ciphertext = padBuffer(ciphertext, ctx.blockCipher.BlockSize()) + + cbc := cipher.NewCBCEncrypter(ctx.blockCipher, nonce) + + cbc.CryptBlocks(ciphertext, ciphertext) + authtag := ctx.computeAuthTag(data, nonce, ciphertext) + + ret, out := resize(dst, uint64(len(dst))+uint64(len(ciphertext))+uint64(len(authtag))) + copy(out, ciphertext) + copy(out[len(ciphertext):], authtag) + + return ret +} + +// Open decrypts and authenticates the ciphertext. +func (ctx *cbcAEAD) Open(dst, nonce, ciphertext, data []byte) ([]byte, error) { + if len(ciphertext) < ctx.authtagBytes { + return nil, errors.New("go-jose/go-jose: invalid ciphertext (too short)") + } + + offset := len(ciphertext) - ctx.authtagBytes + expectedTag := ctx.computeAuthTag(data, nonce, ciphertext[:offset]) + match := subtle.ConstantTimeCompare(expectedTag, ciphertext[offset:]) + if match != 1 { + return nil, errors.New("go-jose/go-jose: invalid ciphertext (auth tag mismatch)") + } + + cbc := cipher.NewCBCDecrypter(ctx.blockCipher, nonce) + + // Make copy of ciphertext buffer, don't want to modify in place + buffer := append([]byte{}, ciphertext[:offset]...) + + if len(buffer)%ctx.blockCipher.BlockSize() > 0 { + return nil, errors.New("go-jose/go-jose: invalid ciphertext (invalid length)") + } + + cbc.CryptBlocks(buffer, buffer) + + // Remove padding + plaintext, err := unpadBuffer(buffer, ctx.blockCipher.BlockSize()) + if err != nil { + return nil, err + } + + ret, out := resize(dst, uint64(len(dst))+uint64(len(plaintext))) + copy(out, plaintext) + + return ret, nil +} + +// Compute an authentication tag +func (ctx *cbcAEAD) computeAuthTag(aad, nonce, ciphertext []byte) []byte { + buffer := make([]byte, uint64(len(aad))+uint64(len(nonce))+uint64(len(ciphertext))+8) + n := 0 + n += copy(buffer, aad) + n += copy(buffer[n:], nonce) + n += copy(buffer[n:], ciphertext) + binary.BigEndian.PutUint64(buffer[n:], uint64(len(aad))*8) + + // According to documentation, Write() on hash.Hash never fails. + hmac := hmac.New(ctx.hash, ctx.integrityKey) + _, _ = hmac.Write(buffer) + + return hmac.Sum(nil)[:ctx.authtagBytes] +} + +// resize ensures that the given slice has a capacity of at least n bytes. +// If the capacity of the slice is less than n, a new slice is allocated +// and the existing data will be copied. +func resize(in []byte, n uint64) (head, tail []byte) { + if uint64(cap(in)) >= n { + head = in[:n] + } else { + head = make([]byte, n) + copy(head, in) + } + + tail = head[len(in):] + return +} + +// Apply padding +func padBuffer(buffer []byte, blockSize int) []byte { + missing := blockSize - (len(buffer) % blockSize) + ret, out := resize(buffer, uint64(len(buffer))+uint64(missing)) + padding := bytes.Repeat([]byte{byte(missing)}, missing) + copy(out, padding) + return ret +} + +// Remove padding +func unpadBuffer(buffer []byte, blockSize int) ([]byte, error) { + if len(buffer)%blockSize != 0 { + return nil, errors.New("go-jose/go-jose: invalid padding") + } + + last := buffer[len(buffer)-1] + count := int(last) + + if count == 0 || count > blockSize || count > len(buffer) { + return nil, errors.New("go-jose/go-jose: invalid padding") + } + + padding := bytes.Repeat([]byte{last}, count) + if !bytes.HasSuffix(buffer, padding) { + return nil, errors.New("go-jose/go-jose: invalid padding") + } + + return buffer[:len(buffer)-count], nil +} diff --git a/vendor/github.com/go-jose/go-jose/v4/cipher/concat_kdf.go b/vendor/github.com/go-jose/go-jose/v4/cipher/concat_kdf.go new file mode 100644 index 00000000..f62c3bdb --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/cipher/concat_kdf.go @@ -0,0 +1,75 @@ +/*- + * Copyright 2014 Square Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package josecipher + +import ( + "crypto" + "encoding/binary" + "hash" + "io" +) + +type concatKDF struct { + z, info []byte + i uint32 + cache []byte + hasher hash.Hash +} + +// NewConcatKDF builds a KDF reader based on the given inputs. +func NewConcatKDF(hash crypto.Hash, z, algID, ptyUInfo, ptyVInfo, supPubInfo, supPrivInfo []byte) io.Reader { + buffer := make([]byte, uint64(len(algID))+uint64(len(ptyUInfo))+uint64(len(ptyVInfo))+uint64(len(supPubInfo))+uint64(len(supPrivInfo))) + n := 0 + n += copy(buffer, algID) + n += copy(buffer[n:], ptyUInfo) + n += copy(buffer[n:], ptyVInfo) + n += copy(buffer[n:], supPubInfo) + copy(buffer[n:], supPrivInfo) + + hasher := hash.New() + + return &concatKDF{ + z: z, + info: buffer, + hasher: hasher, + cache: []byte{}, + i: 1, + } +} + +func (ctx *concatKDF) Read(out []byte) (int, error) { + copied := copy(out, ctx.cache) + ctx.cache = ctx.cache[copied:] + + for copied < len(out) { + ctx.hasher.Reset() + + // Write on a hash.Hash never fails + _ = binary.Write(ctx.hasher, binary.BigEndian, ctx.i) + _, _ = ctx.hasher.Write(ctx.z) + _, _ = ctx.hasher.Write(ctx.info) + + hash := ctx.hasher.Sum(nil) + chunkCopied := copy(out[copied:], hash) + copied += chunkCopied + ctx.cache = hash[chunkCopied:] + + ctx.i++ + } + + return copied, nil +} diff --git a/vendor/github.com/go-jose/go-jose/v4/cipher/ecdh_es.go b/vendor/github.com/go-jose/go-jose/v4/cipher/ecdh_es.go new file mode 100644 index 00000000..093c6467 --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/cipher/ecdh_es.go @@ -0,0 +1,86 @@ +/*- + * Copyright 2014 Square Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package josecipher + +import ( + "bytes" + "crypto" + "crypto/ecdsa" + "crypto/elliptic" + "encoding/binary" +) + +// DeriveECDHES derives a shared encryption key using ECDH/ConcatKDF as described in JWE/JWA. +// It is an error to call this function with a private/public key that are not on the same +// curve. Callers must ensure that the keys are valid before calling this function. Output +// size may be at most 1<<16 bytes (64 KiB). +func DeriveECDHES(alg string, apuData, apvData []byte, priv *ecdsa.PrivateKey, pub *ecdsa.PublicKey, size int) []byte { + if size > 1<<16 { + panic("ECDH-ES output size too large, must be less than or equal to 1<<16") + } + + // algId, partyUInfo, partyVInfo inputs must be prefixed with the length + algID := lengthPrefixed([]byte(alg)) + ptyUInfo := lengthPrefixed(apuData) + ptyVInfo := lengthPrefixed(apvData) + + // suppPubInfo is the encoded length of the output size in bits + supPubInfo := make([]byte, 4) + binary.BigEndian.PutUint32(supPubInfo, uint32(size)*8) + + if !priv.PublicKey.Curve.IsOnCurve(pub.X, pub.Y) { + panic("public key not on same curve as private key") + } + + z, _ := priv.Curve.ScalarMult(pub.X, pub.Y, priv.D.Bytes()) + zBytes := z.Bytes() + + // Note that calling z.Bytes() on a big.Int may strip leading zero bytes from + // the returned byte array. This can lead to a problem where zBytes will be + // shorter than expected which breaks the key derivation. Therefore we must pad + // to the full length of the expected coordinate here before calling the KDF. + octSize := dSize(priv.Curve) + if len(zBytes) != octSize { + zBytes = append(bytes.Repeat([]byte{0}, octSize-len(zBytes)), zBytes...) + } + + reader := NewConcatKDF(crypto.SHA256, zBytes, algID, ptyUInfo, ptyVInfo, supPubInfo, []byte{}) + key := make([]byte, size) + + // Read on the KDF will never fail + _, _ = reader.Read(key) + + return key +} + +// dSize returns the size in octets for a coordinate on a elliptic curve. +func dSize(curve elliptic.Curve) int { + order := curve.Params().P + bitLen := order.BitLen() + size := bitLen / 8 + if bitLen%8 != 0 { + size++ + } + return size +} + +func lengthPrefixed(data []byte) []byte { + out := make([]byte, len(data)+4) + binary.BigEndian.PutUint32(out, uint32(len(data))) + copy(out[4:], data) + return out +} diff --git a/vendor/github.com/go-jose/go-jose/v4/cipher/key_wrap.go b/vendor/github.com/go-jose/go-jose/v4/cipher/key_wrap.go new file mode 100644 index 00000000..b9effbca --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/cipher/key_wrap.go @@ -0,0 +1,109 @@ +/*- + * Copyright 2014 Square Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package josecipher + +import ( + "crypto/cipher" + "crypto/subtle" + "encoding/binary" + "errors" +) + +var defaultIV = []byte{0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6} + +// KeyWrap implements NIST key wrapping; it wraps a content encryption key (cek) with the given block cipher. +func KeyWrap(block cipher.Block, cek []byte) ([]byte, error) { + if len(cek)%8 != 0 { + return nil, errors.New("go-jose/go-jose: key wrap input must be 8 byte blocks") + } + + n := len(cek) / 8 + r := make([][]byte, n) + + for i := range r { + r[i] = make([]byte, 8) + copy(r[i], cek[i*8:]) + } + + buffer := make([]byte, 16) + tBytes := make([]byte, 8) + copy(buffer, defaultIV) + + for t := 0; t < 6*n; t++ { + copy(buffer[8:], r[t%n]) + + block.Encrypt(buffer, buffer) + + binary.BigEndian.PutUint64(tBytes, uint64(t+1)) + + for i := 0; i < 8; i++ { + buffer[i] ^= tBytes[i] + } + copy(r[t%n], buffer[8:]) + } + + out := make([]byte, (n+1)*8) + copy(out, buffer[:8]) + for i := range r { + copy(out[(i+1)*8:], r[i]) + } + + return out, nil +} + +// KeyUnwrap implements NIST key unwrapping; it unwraps a content encryption key (cek) with the given block cipher. +func KeyUnwrap(block cipher.Block, ciphertext []byte) ([]byte, error) { + if len(ciphertext)%8 != 0 { + return nil, errors.New("go-jose/go-jose: key wrap input must be 8 byte blocks") + } + + n := (len(ciphertext) / 8) - 1 + r := make([][]byte, n) + + for i := range r { + r[i] = make([]byte, 8) + copy(r[i], ciphertext[(i+1)*8:]) + } + + buffer := make([]byte, 16) + tBytes := make([]byte, 8) + copy(buffer[:8], ciphertext[:8]) + + for t := 6*n - 1; t >= 0; t-- { + binary.BigEndian.PutUint64(tBytes, uint64(t+1)) + + for i := 0; i < 8; i++ { + buffer[i] ^= tBytes[i] + } + copy(buffer[8:], r[t%n]) + + block.Decrypt(buffer, buffer) + + copy(r[t%n], buffer[8:]) + } + + if subtle.ConstantTimeCompare(buffer[:8], defaultIV) == 0 { + return nil, errors.New("go-jose/go-jose: failed to unwrap key") + } + + out := make([]byte, n*8) + for i := range r { + copy(out[i*8:], r[i]) + } + + return out, nil +} diff --git a/vendor/github.com/go-jose/go-jose/v4/crypter.go b/vendor/github.com/go-jose/go-jose/v4/crypter.go new file mode 100644 index 00000000..31290fc8 --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/crypter.go @@ -0,0 +1,595 @@ +/*- + * Copyright 2014 Square Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package jose + +import ( + "crypto/ecdsa" + "crypto/rsa" + "errors" + "fmt" + + "github.com/go-jose/go-jose/v4/json" +) + +// Encrypter represents an encrypter which produces an encrypted JWE object. +type Encrypter interface { + Encrypt(plaintext []byte) (*JSONWebEncryption, error) + EncryptWithAuthData(plaintext []byte, aad []byte) (*JSONWebEncryption, error) + Options() EncrypterOptions +} + +// A generic content cipher +type contentCipher interface { + keySize() int + encrypt(cek []byte, aad, plaintext []byte) (*aeadParts, error) + decrypt(cek []byte, aad []byte, parts *aeadParts) ([]byte, error) +} + +// A key generator (for generating/getting a CEK) +type keyGenerator interface { + keySize() int + genKey() ([]byte, rawHeader, error) +} + +// A generic key encrypter +type keyEncrypter interface { + encryptKey(cek []byte, alg KeyAlgorithm) (recipientInfo, error) // Encrypt a key +} + +// A generic key decrypter +type keyDecrypter interface { + decryptKey(headers rawHeader, recipient *recipientInfo, generator keyGenerator) ([]byte, error) // Decrypt a key +} + +// A generic encrypter based on the given key encrypter and content cipher. +type genericEncrypter struct { + contentAlg ContentEncryption + compressionAlg CompressionAlgorithm + cipher contentCipher + recipients []recipientKeyInfo + keyGenerator keyGenerator + extraHeaders map[HeaderKey]interface{} +} + +type recipientKeyInfo struct { + keyID string + keyAlg KeyAlgorithm + keyEncrypter keyEncrypter +} + +// EncrypterOptions represents options that can be set on new encrypters. +type EncrypterOptions struct { + Compression CompressionAlgorithm + + // Optional map of name/value pairs to be inserted into the protected + // header of a JWS object. Some specifications which make use of + // JWS require additional values here. + // + // Values will be serialized by [json.Marshal] and must be valid inputs to + // that function. + // + // [json.Marshal]: https://pkg.go.dev/encoding/json#Marshal + ExtraHeaders map[HeaderKey]interface{} +} + +// WithHeader adds an arbitrary value to the ExtraHeaders map, initializing it +// if necessary, and returns the updated EncrypterOptions. +// +// The v parameter will be serialized by [json.Marshal] and must be a valid +// input to that function. +// +// [json.Marshal]: https://pkg.go.dev/encoding/json#Marshal +func (eo *EncrypterOptions) WithHeader(k HeaderKey, v interface{}) *EncrypterOptions { + if eo.ExtraHeaders == nil { + eo.ExtraHeaders = map[HeaderKey]interface{}{} + } + eo.ExtraHeaders[k] = v + return eo +} + +// WithContentType adds a content type ("cty") header and returns the updated +// EncrypterOptions. +func (eo *EncrypterOptions) WithContentType(contentType ContentType) *EncrypterOptions { + return eo.WithHeader(HeaderContentType, contentType) +} + +// WithType adds a type ("typ") header and returns the updated EncrypterOptions. +func (eo *EncrypterOptions) WithType(typ ContentType) *EncrypterOptions { + return eo.WithHeader(HeaderType, typ) +} + +// Recipient represents an algorithm/key to encrypt messages to. +// +// PBES2Count and PBES2Salt correspond with the "p2c" and "p2s" headers used +// on the password-based encryption algorithms PBES2-HS256+A128KW, +// PBES2-HS384+A192KW, and PBES2-HS512+A256KW. If they are not provided a safe +// default of 100000 will be used for the count and a 128-bit random salt will +// be generated. +type Recipient struct { + Algorithm KeyAlgorithm + // Key must have one of these types: + // - ed25519.PublicKey + // - *ecdsa.PublicKey + // - *rsa.PublicKey + // - *JSONWebKey + // - JSONWebKey + // - []byte (a symmetric key) + // - Any type that satisfies the OpaqueKeyEncrypter interface + // + // The type of Key must match the value of Algorithm. + Key interface{} + KeyID string + PBES2Count int + PBES2Salt []byte +} + +// NewEncrypter creates an appropriate encrypter based on the key type +func NewEncrypter(enc ContentEncryption, rcpt Recipient, opts *EncrypterOptions) (Encrypter, error) { + encrypter := &genericEncrypter{ + contentAlg: enc, + recipients: []recipientKeyInfo{}, + cipher: getContentCipher(enc), + } + if opts != nil { + encrypter.compressionAlg = opts.Compression + encrypter.extraHeaders = opts.ExtraHeaders + } + + if encrypter.cipher == nil { + return nil, ErrUnsupportedAlgorithm + } + + var keyID string + var rawKey interface{} + switch encryptionKey := rcpt.Key.(type) { + case JSONWebKey: + keyID, rawKey = encryptionKey.KeyID, encryptionKey.Key + case *JSONWebKey: + keyID, rawKey = encryptionKey.KeyID, encryptionKey.Key + case OpaqueKeyEncrypter: + keyID, rawKey = encryptionKey.KeyID(), encryptionKey + default: + rawKey = encryptionKey + } + + switch rcpt.Algorithm { + case DIRECT: + // Direct encryption mode must be treated differently + keyBytes, ok := rawKey.([]byte) + if !ok { + return nil, ErrUnsupportedKeyType + } + if encrypter.cipher.keySize() != len(keyBytes) { + return nil, ErrInvalidKeySize + } + encrypter.keyGenerator = staticKeyGenerator{ + key: keyBytes, + } + recipientInfo, _ := newSymmetricRecipient(rcpt.Algorithm, keyBytes) + recipientInfo.keyID = keyID + if rcpt.KeyID != "" { + recipientInfo.keyID = rcpt.KeyID + } + encrypter.recipients = []recipientKeyInfo{recipientInfo} + return encrypter, nil + case ECDH_ES: + // ECDH-ES (w/o key wrapping) is similar to DIRECT mode + keyDSA, ok := rawKey.(*ecdsa.PublicKey) + if !ok { + return nil, ErrUnsupportedKeyType + } + encrypter.keyGenerator = ecKeyGenerator{ + size: encrypter.cipher.keySize(), + algID: string(enc), + publicKey: keyDSA, + } + recipientInfo, _ := newECDHRecipient(rcpt.Algorithm, keyDSA) + recipientInfo.keyID = keyID + if rcpt.KeyID != "" { + recipientInfo.keyID = rcpt.KeyID + } + encrypter.recipients = []recipientKeyInfo{recipientInfo} + return encrypter, nil + default: + // Can just add a standard recipient + encrypter.keyGenerator = randomKeyGenerator{ + size: encrypter.cipher.keySize(), + } + err := encrypter.addRecipient(rcpt) + return encrypter, err + } +} + +// NewMultiEncrypter creates a multi-encrypter based on the given parameters +func NewMultiEncrypter(enc ContentEncryption, rcpts []Recipient, opts *EncrypterOptions) (Encrypter, error) { + cipher := getContentCipher(enc) + + if cipher == nil { + return nil, ErrUnsupportedAlgorithm + } + if len(rcpts) == 0 { + return nil, fmt.Errorf("go-jose/go-jose: recipients is nil or empty") + } + + encrypter := &genericEncrypter{ + contentAlg: enc, + recipients: []recipientKeyInfo{}, + cipher: cipher, + keyGenerator: randomKeyGenerator{ + size: cipher.keySize(), + }, + } + + if opts != nil { + encrypter.compressionAlg = opts.Compression + encrypter.extraHeaders = opts.ExtraHeaders + } + + for _, recipient := range rcpts { + err := encrypter.addRecipient(recipient) + if err != nil { + return nil, err + } + } + + return encrypter, nil +} + +func (ctx *genericEncrypter) addRecipient(recipient Recipient) (err error) { + var recipientInfo recipientKeyInfo + + switch recipient.Algorithm { + case DIRECT, ECDH_ES: + return fmt.Errorf("go-jose/go-jose: key algorithm '%s' not supported in multi-recipient mode", recipient.Algorithm) + } + + recipientInfo, err = makeJWERecipient(recipient.Algorithm, recipient.Key) + if recipient.KeyID != "" { + recipientInfo.keyID = recipient.KeyID + } + + switch recipient.Algorithm { + case PBES2_HS256_A128KW, PBES2_HS384_A192KW, PBES2_HS512_A256KW: + if sr, ok := recipientInfo.keyEncrypter.(*symmetricKeyCipher); ok { + sr.p2c = recipient.PBES2Count + sr.p2s = recipient.PBES2Salt + } + } + + if err == nil { + ctx.recipients = append(ctx.recipients, recipientInfo) + } + return err +} + +func makeJWERecipient(alg KeyAlgorithm, encryptionKey interface{}) (recipientKeyInfo, error) { + switch encryptionKey := encryptionKey.(type) { + case *rsa.PublicKey: + return newRSARecipient(alg, encryptionKey) + case *ecdsa.PublicKey: + return newECDHRecipient(alg, encryptionKey) + case []byte: + return newSymmetricRecipient(alg, encryptionKey) + case string: + return newSymmetricRecipient(alg, []byte(encryptionKey)) + case JSONWebKey: + recipient, err := makeJWERecipient(alg, encryptionKey.Key) + recipient.keyID = encryptionKey.KeyID + return recipient, err + case *JSONWebKey: + recipient, err := makeJWERecipient(alg, encryptionKey.Key) + recipient.keyID = encryptionKey.KeyID + return recipient, err + case OpaqueKeyEncrypter: + return newOpaqueKeyEncrypter(alg, encryptionKey) + } + return recipientKeyInfo{}, ErrUnsupportedKeyType +} + +// newDecrypter creates an appropriate decrypter based on the key type +func newDecrypter(decryptionKey interface{}) (keyDecrypter, error) { + switch decryptionKey := decryptionKey.(type) { + case *rsa.PrivateKey: + return &rsaDecrypterSigner{ + privateKey: decryptionKey, + }, nil + case *ecdsa.PrivateKey: + return &ecDecrypterSigner{ + privateKey: decryptionKey, + }, nil + case []byte: + return &symmetricKeyCipher{ + key: decryptionKey, + }, nil + case string: + return &symmetricKeyCipher{ + key: []byte(decryptionKey), + }, nil + case JSONWebKey: + return newDecrypter(decryptionKey.Key) + case *JSONWebKey: + return newDecrypter(decryptionKey.Key) + case OpaqueKeyDecrypter: + return &opaqueKeyDecrypter{decrypter: decryptionKey}, nil + default: + return nil, ErrUnsupportedKeyType + } +} + +// Implementation of encrypt method producing a JWE object. +func (ctx *genericEncrypter) Encrypt(plaintext []byte) (*JSONWebEncryption, error) { + return ctx.EncryptWithAuthData(plaintext, nil) +} + +// Implementation of encrypt method producing a JWE object. +func (ctx *genericEncrypter) EncryptWithAuthData(plaintext, aad []byte) (*JSONWebEncryption, error) { + obj := &JSONWebEncryption{} + obj.aad = aad + + obj.protected = &rawHeader{} + err := obj.protected.set(headerEncryption, ctx.contentAlg) + if err != nil { + return nil, err + } + + obj.recipients = make([]recipientInfo, len(ctx.recipients)) + + if len(ctx.recipients) == 0 { + return nil, fmt.Errorf("go-jose/go-jose: no recipients to encrypt to") + } + + cek, headers, err := ctx.keyGenerator.genKey() + if err != nil { + return nil, err + } + + obj.protected.merge(&headers) + + for i, info := range ctx.recipients { + recipient, err := info.keyEncrypter.encryptKey(cek, info.keyAlg) + if err != nil { + return nil, err + } + + err = recipient.header.set(headerAlgorithm, info.keyAlg) + if err != nil { + return nil, err + } + + if info.keyID != "" { + err = recipient.header.set(headerKeyID, info.keyID) + if err != nil { + return nil, err + } + } + obj.recipients[i] = recipient + } + + if len(ctx.recipients) == 1 { + // Move per-recipient headers into main protected header if there's + // only a single recipient. + obj.protected.merge(obj.recipients[0].header) + obj.recipients[0].header = nil + } + + if ctx.compressionAlg != NONE { + plaintext, err = compress(ctx.compressionAlg, plaintext) + if err != nil { + return nil, err + } + + err = obj.protected.set(headerCompression, ctx.compressionAlg) + if err != nil { + return nil, err + } + } + + for k, v := range ctx.extraHeaders { + b, err := json.Marshal(v) + if err != nil { + return nil, err + } + (*obj.protected)[k] = makeRawMessage(b) + } + + authData := obj.computeAuthData() + parts, err := ctx.cipher.encrypt(cek, authData, plaintext) + if err != nil { + return nil, err + } + + obj.iv = parts.iv + obj.ciphertext = parts.ciphertext + obj.tag = parts.tag + + return obj, nil +} + +func (ctx *genericEncrypter) Options() EncrypterOptions { + return EncrypterOptions{ + Compression: ctx.compressionAlg, + ExtraHeaders: ctx.extraHeaders, + } +} + +// Decrypt and validate the object and return the plaintext. This +// function does not support multi-recipient. If you desire multi-recipient +// decryption use DecryptMulti instead. +// +// The decryptionKey argument must contain a private or symmetric key +// and must have one of these types: +// - *ecdsa.PrivateKey +// - *rsa.PrivateKey +// - *JSONWebKey +// - JSONWebKey +// - *JSONWebKeySet +// - JSONWebKeySet +// - []byte (a symmetric key) +// - string (a symmetric key) +// - Any type that satisfies the OpaqueKeyDecrypter interface. +// +// Note that ed25519 is only available for signatures, not encryption, so is +// not an option here. +// +// Automatically decompresses plaintext, but returns an error if the decompressed +// data would be >250kB or >10x the size of the compressed data, whichever is larger. +func (obj JSONWebEncryption) Decrypt(decryptionKey interface{}) ([]byte, error) { + headers := obj.mergedHeaders(nil) + + if len(obj.recipients) > 1 { + return nil, errors.New("go-jose/go-jose: too many recipients in payload; expecting only one") + } + + err := headers.checkNoCritical() + if err != nil { + return nil, err + } + + key, err := tryJWKS(decryptionKey, obj.Header) + if err != nil { + return nil, err + } + decrypter, err := newDecrypter(key) + if err != nil { + return nil, err + } + + cipher := getContentCipher(headers.getEncryption()) + if cipher == nil { + return nil, fmt.Errorf("go-jose/go-jose: unsupported enc value '%s'", string(headers.getEncryption())) + } + + generator := randomKeyGenerator{ + size: cipher.keySize(), + } + + parts := &aeadParts{ + iv: obj.iv, + ciphertext: obj.ciphertext, + tag: obj.tag, + } + + authData := obj.computeAuthData() + + var plaintext []byte + recipient := obj.recipients[0] + recipientHeaders := obj.mergedHeaders(&recipient) + + cek, err := decrypter.decryptKey(recipientHeaders, &recipient, generator) + if err == nil { + // Found a valid CEK -- let's try to decrypt. + plaintext, err = cipher.decrypt(cek, authData, parts) + } + + if plaintext == nil { + return nil, ErrCryptoFailure + } + + // The "zip" header parameter may only be present in the protected header. + if comp := obj.protected.getCompression(); comp != "" { + plaintext, err = decompress(comp, plaintext) + if err != nil { + return nil, fmt.Errorf("go-jose/go-jose: failed to decompress plaintext: %v", err) + } + } + + return plaintext, nil +} + +// DecryptMulti decrypts and validates the object and returns the plaintexts, +// with support for multiple recipients. It returns the index of the recipient +// for which the decryption was successful, the merged headers for that recipient, +// and the plaintext. +// +// The decryptionKey argument must have one of the types allowed for the +// decryptionKey argument of Decrypt(). +// +// Automatically decompresses plaintext, but returns an error if the decompressed +// data would be >250kB or >3x the size of the compressed data, whichever is larger. +func (obj JSONWebEncryption) DecryptMulti(decryptionKey interface{}) (int, Header, []byte, error) { + globalHeaders := obj.mergedHeaders(nil) + + err := globalHeaders.checkNoCritical() + if err != nil { + return -1, Header{}, nil, err + } + + key, err := tryJWKS(decryptionKey, obj.Header) + if err != nil { + return -1, Header{}, nil, err + } + decrypter, err := newDecrypter(key) + if err != nil { + return -1, Header{}, nil, err + } + + encryption := globalHeaders.getEncryption() + cipher := getContentCipher(encryption) + if cipher == nil { + return -1, Header{}, nil, fmt.Errorf("go-jose/go-jose: unsupported enc value '%s'", string(encryption)) + } + + generator := randomKeyGenerator{ + size: cipher.keySize(), + } + + parts := &aeadParts{ + iv: obj.iv, + ciphertext: obj.ciphertext, + tag: obj.tag, + } + + authData := obj.computeAuthData() + + index := -1 + var plaintext []byte + var headers rawHeader + + for i, recipient := range obj.recipients { + recipientHeaders := obj.mergedHeaders(&recipient) + + cek, err := decrypter.decryptKey(recipientHeaders, &recipient, generator) + if err == nil { + // Found a valid CEK -- let's try to decrypt. + plaintext, err = cipher.decrypt(cek, authData, parts) + if err == nil { + index = i + headers = recipientHeaders + break + } + } + } + + if plaintext == nil { + return -1, Header{}, nil, ErrCryptoFailure + } + + // The "zip" header parameter may only be present in the protected header. + if comp := obj.protected.getCompression(); comp != "" { + plaintext, err = decompress(comp, plaintext) + if err != nil { + return -1, Header{}, nil, fmt.Errorf("go-jose/go-jose: failed to decompress plaintext: %v", err) + } + } + + sanitized, err := headers.sanitized() + if err != nil { + return -1, Header{}, nil, fmt.Errorf("go-jose/go-jose: failed to sanitize header: %v", err) + } + + return index, sanitized, plaintext, err +} diff --git a/vendor/github.com/go-jose/go-jose/v4/doc.go b/vendor/github.com/go-jose/go-jose/v4/doc.go new file mode 100644 index 00000000..0ad40ca0 --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/doc.go @@ -0,0 +1,25 @@ +/*- + * Copyright 2014 Square Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* +Package jose aims to provide an implementation of the Javascript Object Signing +and Encryption set of standards. It implements encryption and signing based on +the JSON Web Encryption and JSON Web Signature standards, with optional JSON Web +Token support available in a sub-package. The library supports both the compact +and JWS/JWE JSON Serialization formats, and has optional support for multiple +recipients. +*/ +package jose diff --git a/vendor/github.com/go-jose/go-jose/v4/encoding.go b/vendor/github.com/go-jose/go-jose/v4/encoding.go new file mode 100644 index 00000000..4f6e0d4a --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/encoding.go @@ -0,0 +1,228 @@ +/*- + * Copyright 2014 Square Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package jose + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "encoding/binary" + "fmt" + "io" + "math/big" + "strings" + "unicode" + + "github.com/go-jose/go-jose/v4/json" +) + +// Helper function to serialize known-good objects. +// Precondition: value is not a nil pointer. +func mustSerializeJSON(value interface{}) []byte { + out, err := json.Marshal(value) + if err != nil { + panic(err) + } + // We never want to serialize the top-level value "null," since it's not a + // valid JOSE message. But if a caller passes in a nil pointer to this method, + // MarshalJSON will happily serialize it as the top-level value "null". If + // that value is then embedded in another operation, for instance by being + // base64-encoded and fed as input to a signing algorithm + // (https://github.com/go-jose/go-jose/issues/22), the result will be + // incorrect. Because this method is intended for known-good objects, and a nil + // pointer is not a known-good object, we are free to panic in this case. + // Note: It's not possible to directly check whether the data pointed at by an + // interface is a nil pointer, so we do this hacky workaround. + // https://groups.google.com/forum/#!topic/golang-nuts/wnH302gBa4I + if string(out) == "null" { + panic("Tried to serialize a nil pointer.") + } + return out +} + +// Strip all newlines and whitespace +func stripWhitespace(data string) string { + buf := strings.Builder{} + buf.Grow(len(data)) + for _, r := range data { + if !unicode.IsSpace(r) { + buf.WriteRune(r) + } + } + return buf.String() +} + +// Perform compression based on algorithm +func compress(algorithm CompressionAlgorithm, input []byte) ([]byte, error) { + switch algorithm { + case DEFLATE: + return deflate(input) + default: + return nil, ErrUnsupportedAlgorithm + } +} + +// Perform decompression based on algorithm +func decompress(algorithm CompressionAlgorithm, input []byte) ([]byte, error) { + switch algorithm { + case DEFLATE: + return inflate(input) + default: + return nil, ErrUnsupportedAlgorithm + } +} + +// deflate compresses the input. +func deflate(input []byte) ([]byte, error) { + output := new(bytes.Buffer) + + // Writing to byte buffer, err is always nil + writer, _ := flate.NewWriter(output, 1) + _, _ = io.Copy(writer, bytes.NewBuffer(input)) + + err := writer.Close() + return output.Bytes(), err +} + +// inflate decompresses the input. +// +// Errors if the decompressed data would be >250kB or >10x the size of the +// compressed data, whichever is larger. +func inflate(input []byte) ([]byte, error) { + output := new(bytes.Buffer) + reader := flate.NewReader(bytes.NewBuffer(input)) + + maxCompressedSize := max(250_000, 10*int64(len(input))) + + limit := maxCompressedSize + 1 + n, err := io.CopyN(output, reader, limit) + if err != nil && err != io.EOF { + return nil, err + } + if n == limit { + return nil, fmt.Errorf("uncompressed data would be too large (>%d bytes)", maxCompressedSize) + } + + err = reader.Close() + return output.Bytes(), err +} + +// byteBuffer represents a slice of bytes that can be serialized to url-safe base64. +type byteBuffer struct { + data []byte +} + +func newBuffer(data []byte) *byteBuffer { + if data == nil { + return nil + } + return &byteBuffer{ + data: data, + } +} + +func newFixedSizeBuffer(data []byte, length int) *byteBuffer { + if len(data) > length { + panic("go-jose/go-jose: invalid call to newFixedSizeBuffer (len(data) > length)") + } + pad := make([]byte, length-len(data)) + return newBuffer(append(pad, data...)) +} + +func newBufferFromInt(num uint64) *byteBuffer { + data := make([]byte, 8) + binary.BigEndian.PutUint64(data, num) + return newBuffer(bytes.TrimLeft(data, "\x00")) +} + +func (b *byteBuffer) MarshalJSON() ([]byte, error) { + return json.Marshal(b.base64()) +} + +func (b *byteBuffer) UnmarshalJSON(data []byte) error { + var encoded string + err := json.Unmarshal(data, &encoded) + if err != nil { + return err + } + + if encoded == "" { + return nil + } + + decoded, err := base64.RawURLEncoding.DecodeString(encoded) + if err != nil { + return err + } + + *b = *newBuffer(decoded) + + return nil +} + +func (b *byteBuffer) base64() string { + return base64.RawURLEncoding.EncodeToString(b.data) +} + +func (b *byteBuffer) bytes() []byte { + // Handling nil here allows us to transparently handle nil slices when serializing. + if b == nil { + return nil + } + return b.data +} + +func (b byteBuffer) bigInt() *big.Int { + return new(big.Int).SetBytes(b.data) +} + +func (b byteBuffer) toInt() int { + return int(b.bigInt().Int64()) +} + +func base64EncodeLen(sl []byte) int { + return base64.RawURLEncoding.EncodedLen(len(sl)) +} + +func base64JoinWithDots(inputs ...[]byte) string { + if len(inputs) == 0 { + return "" + } + + // Count of dots. + totalCount := len(inputs) - 1 + + for _, input := range inputs { + totalCount += base64EncodeLen(input) + } + + out := make([]byte, totalCount) + startEncode := 0 + for i, input := range inputs { + base64.RawURLEncoding.Encode(out[startEncode:], input) + + if i == len(inputs)-1 { + continue + } + + startEncode += base64EncodeLen(input) + out[startEncode] = '.' + startEncode++ + } + + return string(out) +} diff --git a/vendor/github.com/go-jose/go-jose/v4/json/LICENSE b/vendor/github.com/go-jose/go-jose/v4/json/LICENSE new file mode 100644 index 00000000..74487567 --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/json/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/go-jose/go-jose/v4/json/README.md b/vendor/github.com/go-jose/go-jose/v4/json/README.md new file mode 100644 index 00000000..86de5e55 --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/json/README.md @@ -0,0 +1,13 @@ +# Safe JSON + +This repository contains a fork of the `encoding/json` package from Go 1.6. + +The following changes were made: + +* Object deserialization uses case-sensitive member name matching instead of + [case-insensitive matching](https://www.ietf.org/mail-archive/web/json/current/msg03763.html). + This is to avoid differences in the interpretation of JOSE messages between + go-jose and libraries written in other languages. +* When deserializing a JSON object, we check for duplicate keys and reject the + input whenever we detect a duplicate. Rather than trying to work with malformed + data, we prefer to reject it right away. diff --git a/vendor/github.com/go-jose/go-jose/v4/json/decode.go b/vendor/github.com/go-jose/go-jose/v4/json/decode.go new file mode 100644 index 00000000..50634dd8 --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/json/decode.go @@ -0,0 +1,1216 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Represents JSON data structure using native Go types: booleans, floats, +// strings, arrays, and maps. + +package json + +import ( + "bytes" + "encoding" + "encoding/base64" + "errors" + "fmt" + "math" + "reflect" + "runtime" + "strconv" + "unicode" + "unicode/utf16" + "unicode/utf8" +) + +// Unmarshal parses the JSON-encoded data and stores the result +// in the value pointed to by v. +// +// Unmarshal uses the inverse of the encodings that +// Marshal uses, allocating maps, slices, and pointers as necessary, +// with the following additional rules: +// +// To unmarshal JSON into a pointer, Unmarshal first handles the case of +// the JSON being the JSON literal null. In that case, Unmarshal sets +// the pointer to nil. Otherwise, Unmarshal unmarshals the JSON into +// the value pointed at by the pointer. If the pointer is nil, Unmarshal +// allocates a new value for it to point to. +// +// To unmarshal JSON into a struct, Unmarshal matches incoming object +// keys to the keys used by Marshal (either the struct field name or its tag), +// preferring an exact match but also accepting a case-insensitive match. +// Unmarshal will only set exported fields of the struct. +// +// To unmarshal JSON into an interface value, +// Unmarshal stores one of these in the interface value: +// +// bool, for JSON booleans +// float64, for JSON numbers +// string, for JSON strings +// []interface{}, for JSON arrays +// map[string]interface{}, for JSON objects +// nil for JSON null +// +// To unmarshal a JSON array into a slice, Unmarshal resets the slice length +// to zero and then appends each element to the slice. +// As a special case, to unmarshal an empty JSON array into a slice, +// Unmarshal replaces the slice with a new empty slice. +// +// To unmarshal a JSON array into a Go array, Unmarshal decodes +// JSON array elements into corresponding Go array elements. +// If the Go array is smaller than the JSON array, +// the additional JSON array elements are discarded. +// If the JSON array is smaller than the Go array, +// the additional Go array elements are set to zero values. +// +// To unmarshal a JSON object into a string-keyed map, Unmarshal first +// establishes a map to use, If the map is nil, Unmarshal allocates a new map. +// Otherwise Unmarshal reuses the existing map, keeping existing entries. +// Unmarshal then stores key-value pairs from the JSON object into the map. +// +// If a JSON value is not appropriate for a given target type, +// or if a JSON number overflows the target type, Unmarshal +// skips that field and completes the unmarshaling as best it can. +// If no more serious errors are encountered, Unmarshal returns +// an UnmarshalTypeError describing the earliest such error. +// +// The JSON null value unmarshals into an interface, map, pointer, or slice +// by setting that Go value to nil. Because null is often used in JSON to mean +// “not present,” unmarshaling a JSON null into any other Go type has no effect +// on the value and produces no error. +// +// When unmarshaling quoted strings, invalid UTF-8 or +// invalid UTF-16 surrogate pairs are not treated as an error. +// Instead, they are replaced by the Unicode replacement +// character U+FFFD. +func Unmarshal(data []byte, v interface{}) error { + // Check for well-formedness. + // Avoids filling out half a data structure + // before discovering a JSON syntax error. + var d decodeState + err := checkValid(data, &d.scan) + if err != nil { + return err + } + + d.init(data) + return d.unmarshal(v) +} + +// Unmarshaler is the interface implemented by objects +// that can unmarshal a JSON description of themselves. +// The input can be assumed to be a valid encoding of +// a JSON value. UnmarshalJSON must copy the JSON data +// if it wishes to retain the data after returning. +type Unmarshaler interface { + UnmarshalJSON([]byte) error +} + +// An UnmarshalTypeError describes a JSON value that was +// not appropriate for a value of a specific Go type. +type UnmarshalTypeError struct { + Value string // description of JSON value - "bool", "array", "number -5" + Type reflect.Type // type of Go value it could not be assigned to + Offset int64 // error occurred after reading Offset bytes +} + +func (e *UnmarshalTypeError) Error() string { + return "json: cannot unmarshal " + e.Value + " into Go value of type " + e.Type.String() +} + +// An UnmarshalFieldError describes a JSON object key that +// led to an unexported (and therefore unwritable) struct field. +// (No longer used; kept for compatibility.) +type UnmarshalFieldError struct { + Key string + Type reflect.Type + Field reflect.StructField +} + +func (e *UnmarshalFieldError) Error() string { + return "json: cannot unmarshal object key " + strconv.Quote(e.Key) + " into unexported field " + e.Field.Name + " of type " + e.Type.String() +} + +// An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. +// (The argument to Unmarshal must be a non-nil pointer.) +type InvalidUnmarshalError struct { + Type reflect.Type +} + +func (e *InvalidUnmarshalError) Error() string { + if e.Type == nil { + return "json: Unmarshal(nil)" + } + + if e.Type.Kind() != reflect.Ptr { + return "json: Unmarshal(non-pointer " + e.Type.String() + ")" + } + return "json: Unmarshal(nil " + e.Type.String() + ")" +} + +func (d *decodeState) unmarshal(v interface{}) (err error) { + defer func() { + if r := recover(); r != nil { + if _, ok := r.(runtime.Error); ok { + panic(r) + } + err = r.(error) + } + }() + + rv := reflect.ValueOf(v) + if rv.Kind() != reflect.Ptr || rv.IsNil() { + return &InvalidUnmarshalError{reflect.TypeOf(v)} + } + + d.scan.reset() + // We decode rv not rv.Elem because the Unmarshaler interface + // test must be applied at the top level of the value. + d.value(rv) + return d.savedError +} + +// A Number represents a JSON number literal. +type Number string + +// String returns the literal text of the number. +func (n Number) String() string { return string(n) } + +// Float64 returns the number as a float64. +func (n Number) Float64() (float64, error) { + return strconv.ParseFloat(string(n), 64) +} + +// Int64 returns the number as an int64. +func (n Number) Int64() (int64, error) { + return strconv.ParseInt(string(n), 10, 64) +} + +// isValidNumber reports whether s is a valid JSON number literal. +func isValidNumber(s string) bool { + // This function implements the JSON numbers grammar. + // See https://tools.ietf.org/html/rfc7159#section-6 + // and http://json.org/number.gif + + if s == "" { + return false + } + + // Optional - + if s[0] == '-' { + s = s[1:] + if s == "" { + return false + } + } + + // Digits + switch { + default: + return false + + case s[0] == '0': + s = s[1:] + + case '1' <= s[0] && s[0] <= '9': + s = s[1:] + for len(s) > 0 && '0' <= s[0] && s[0] <= '9' { + s = s[1:] + } + } + + // . followed by 1 or more digits. + if len(s) >= 2 && s[0] == '.' && '0' <= s[1] && s[1] <= '9' { + s = s[2:] + for len(s) > 0 && '0' <= s[0] && s[0] <= '9' { + s = s[1:] + } + } + + // e or E followed by an optional - or + and + // 1 or more digits. + if len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') { + s = s[1:] + if s[0] == '+' || s[0] == '-' { + s = s[1:] + if s == "" { + return false + } + } + for len(s) > 0 && '0' <= s[0] && s[0] <= '9' { + s = s[1:] + } + } + + // Make sure we are at the end. + return s == "" +} + +type NumberUnmarshalType int + +const ( + // unmarshal a JSON number into an interface{} as a float64 + UnmarshalFloat NumberUnmarshalType = iota + // unmarshal a JSON number into an interface{} as a `json.Number` + UnmarshalJSONNumber + // unmarshal a JSON number into an interface{} as a int64 + // if value is an integer otherwise float64 + UnmarshalIntOrFloat +) + +// decodeState represents the state while decoding a JSON value. +type decodeState struct { + data []byte + off int // read offset in data + scan scanner + nextscan scanner // for calls to nextValue + savedError error + numberType NumberUnmarshalType +} + +// errPhase is used for errors that should not happen unless +// there is a bug in the JSON decoder or something is editing +// the data slice while the decoder executes. +var errPhase = errors.New("JSON decoder out of sync - data changing underfoot?") + +func (d *decodeState) init(data []byte) *decodeState { + d.data = data + d.off = 0 + d.savedError = nil + return d +} + +// error aborts the decoding by panicking with err. +func (d *decodeState) error(err error) { + panic(err) +} + +// saveError saves the first err it is called with, +// for reporting at the end of the unmarshal. +func (d *decodeState) saveError(err error) { + if d.savedError == nil { + d.savedError = err + } +} + +// next cuts off and returns the next full JSON value in d.data[d.off:]. +// The next value is known to be an object or array, not a literal. +func (d *decodeState) next() []byte { + c := d.data[d.off] + item, rest, err := nextValue(d.data[d.off:], &d.nextscan) + if err != nil { + d.error(err) + } + d.off = len(d.data) - len(rest) + + // Our scanner has seen the opening brace/bracket + // and thinks we're still in the middle of the object. + // invent a closing brace/bracket to get it out. + if c == '{' { + d.scan.step(&d.scan, '}') + } else { + d.scan.step(&d.scan, ']') + } + + return item +} + +// scanWhile processes bytes in d.data[d.off:] until it +// receives a scan code not equal to op. +// It updates d.off and returns the new scan code. +func (d *decodeState) scanWhile(op int) int { + var newOp int + for { + if d.off >= len(d.data) { + newOp = d.scan.eof() + d.off = len(d.data) + 1 // mark processed EOF with len+1 + } else { + c := d.data[d.off] + d.off++ + newOp = d.scan.step(&d.scan, c) + } + if newOp != op { + break + } + } + return newOp +} + +// value decodes a JSON value from d.data[d.off:] into the value. +// it updates d.off to point past the decoded value. +func (d *decodeState) value(v reflect.Value) { + if !v.IsValid() { + _, rest, err := nextValue(d.data[d.off:], &d.nextscan) + if err != nil { + d.error(err) + } + d.off = len(d.data) - len(rest) + + // d.scan thinks we're still at the beginning of the item. + // Feed in an empty string - the shortest, simplest value - + // so that it knows we got to the end of the value. + if d.scan.redo { + // rewind. + d.scan.redo = false + d.scan.step = stateBeginValue + } + d.scan.step(&d.scan, '"') + d.scan.step(&d.scan, '"') + + n := len(d.scan.parseState) + if n > 0 && d.scan.parseState[n-1] == parseObjectKey { + // d.scan thinks we just read an object key; finish the object + d.scan.step(&d.scan, ':') + d.scan.step(&d.scan, '"') + d.scan.step(&d.scan, '"') + d.scan.step(&d.scan, '}') + } + + return + } + + switch op := d.scanWhile(scanSkipSpace); op { + default: + d.error(errPhase) + + case scanBeginArray: + d.array(v) + + case scanBeginObject: + d.object(v) + + case scanBeginLiteral: + d.literal(v) + } +} + +type unquotedValue struct{} + +// valueQuoted is like value but decodes a +// quoted string literal or literal null into an interface value. +// If it finds anything other than a quoted string literal or null, +// valueQuoted returns unquotedValue{}. +func (d *decodeState) valueQuoted() interface{} { + switch op := d.scanWhile(scanSkipSpace); op { + default: + d.error(errPhase) + + case scanBeginArray: + d.array(reflect.Value{}) + + case scanBeginObject: + d.object(reflect.Value{}) + + case scanBeginLiteral: + switch v := d.literalInterface().(type) { + case nil, string: + return v + } + } + return unquotedValue{} +} + +// indirect walks down v allocating pointers as needed, +// until it gets to a non-pointer. +// if it encounters an Unmarshaler, indirect stops and returns that. +// if decodingNull is true, indirect stops at the last pointer so it can be set to nil. +func (d *decodeState) indirect(v reflect.Value, decodingNull bool) (Unmarshaler, encoding.TextUnmarshaler, reflect.Value) { + // If v is a named type and is addressable, + // start with its address, so that if the type has pointer methods, + // we find them. + if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { + v = v.Addr() + } + for { + // Load value from interface, but only if the result will be + // usefully addressable. + if v.Kind() == reflect.Interface && !v.IsNil() { + e := v.Elem() + if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { + v = e + continue + } + } + + if v.Kind() != reflect.Ptr { + break + } + + if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { + break + } + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + if v.Type().NumMethod() > 0 { + if u, ok := v.Interface().(Unmarshaler); ok { + return u, nil, reflect.Value{} + } + if u, ok := v.Interface().(encoding.TextUnmarshaler); ok { + return nil, u, reflect.Value{} + } + } + v = v.Elem() + } + return nil, nil, v +} + +// array consumes an array from d.data[d.off-1:], decoding into the value v. +// the first byte of the array ('[') has been read already. +func (d *decodeState) array(v reflect.Value) { + // Check for unmarshaler. + u, ut, pv := d.indirect(v, false) + if u != nil { + d.off-- + err := u.UnmarshalJSON(d.next()) + if err != nil { + d.error(err) + } + return + } + if ut != nil { + d.saveError(&UnmarshalTypeError{"array", v.Type(), int64(d.off)}) + d.off-- + d.next() + return + } + + v = pv + + // Check type of target. + switch v.Kind() { + case reflect.Interface: + if v.NumMethod() == 0 { + // Decoding into nil interface? Switch to non-reflect code. + v.Set(reflect.ValueOf(d.arrayInterface())) + return + } + // Otherwise it's invalid. + fallthrough + default: + d.saveError(&UnmarshalTypeError{"array", v.Type(), int64(d.off)}) + d.off-- + d.next() + return + case reflect.Array: + case reflect.Slice: + break + } + + i := 0 + for { + // Look ahead for ] - can only happen on first iteration. + op := d.scanWhile(scanSkipSpace) + if op == scanEndArray { + break + } + + // Back up so d.value can have the byte we just read. + d.off-- + d.scan.undo(op) + + // Get element of array, growing if necessary. + if v.Kind() == reflect.Slice { + // Grow slice if necessary + if i >= v.Cap() { + newcap := v.Cap() + v.Cap()/2 + if newcap < 4 { + newcap = 4 + } + newv := reflect.MakeSlice(v.Type(), v.Len(), newcap) + reflect.Copy(newv, v) + v.Set(newv) + } + if i >= v.Len() { + v.SetLen(i + 1) + } + } + + if i < v.Len() { + // Decode into element. + d.value(v.Index(i)) + } else { + // Ran out of fixed array: skip. + d.value(reflect.Value{}) + } + i++ + + // Next token must be , or ]. + op = d.scanWhile(scanSkipSpace) + if op == scanEndArray { + break + } + if op != scanArrayValue { + d.error(errPhase) + } + } + + if i < v.Len() { + if v.Kind() == reflect.Array { + // Array. Zero the rest. + z := reflect.Zero(v.Type().Elem()) + for ; i < v.Len(); i++ { + v.Index(i).Set(z) + } + } else { + v.SetLen(i) + } + } + if i == 0 && v.Kind() == reflect.Slice { + v.Set(reflect.MakeSlice(v.Type(), 0, 0)) + } +} + +var nullLiteral = []byte("null") + +// object consumes an object from d.data[d.off-1:], decoding into the value v. +// the first byte ('{') of the object has been read already. +func (d *decodeState) object(v reflect.Value) { + // Check for unmarshaler. + u, ut, pv := d.indirect(v, false) + if u != nil { + d.off-- + err := u.UnmarshalJSON(d.next()) + if err != nil { + d.error(err) + } + return + } + if ut != nil { + d.saveError(&UnmarshalTypeError{"object", v.Type(), int64(d.off)}) + d.off-- + d.next() // skip over { } in input + return + } + v = pv + + // Decoding into nil interface? Switch to non-reflect code. + if v.Kind() == reflect.Interface && v.NumMethod() == 0 { + v.Set(reflect.ValueOf(d.objectInterface())) + return + } + + // Check type of target: struct or map[string]T + switch v.Kind() { + case reflect.Map: + // map must have string kind + t := v.Type() + if t.Key().Kind() != reflect.String { + d.saveError(&UnmarshalTypeError{"object", v.Type(), int64(d.off)}) + d.off-- + d.next() // skip over { } in input + return + } + if v.IsNil() { + v.Set(reflect.MakeMap(t)) + } + case reflect.Struct: + + default: + d.saveError(&UnmarshalTypeError{"object", v.Type(), int64(d.off)}) + d.off-- + d.next() // skip over { } in input + return + } + + var mapElem reflect.Value + keys := map[string]bool{} + + for { + // Read opening " of string key or closing }. + op := d.scanWhile(scanSkipSpace) + if op == scanEndObject { + // closing } - can only happen on first iteration. + break + } + if op != scanBeginLiteral { + d.error(errPhase) + } + + // Read key. + start := d.off - 1 + op = d.scanWhile(scanContinue) + item := d.data[start : d.off-1] + key, ok := unquote(item) + if !ok { + d.error(errPhase) + } + + // Check for duplicate keys. + _, ok = keys[key] + if !ok { + keys[key] = true + } else { + d.error(fmt.Errorf("json: duplicate key '%s' in object", key)) + } + + // Figure out field corresponding to key. + var subv reflect.Value + destring := false // whether the value is wrapped in a string to be decoded first + + if v.Kind() == reflect.Map { + elemType := v.Type().Elem() + if !mapElem.IsValid() { + mapElem = reflect.New(elemType).Elem() + } else { + mapElem.Set(reflect.Zero(elemType)) + } + subv = mapElem + } else { + var f *field + fields := cachedTypeFields(v.Type()) + for i := range fields { + ff := &fields[i] + if bytes.Equal(ff.nameBytes, []byte(key)) { + f = ff + break + } + } + if f != nil { + subv = v + destring = f.quoted + for _, i := range f.index { + if subv.Kind() == reflect.Ptr { + if subv.IsNil() { + subv.Set(reflect.New(subv.Type().Elem())) + } + subv = subv.Elem() + } + subv = subv.Field(i) + } + } + } + + // Read : before value. + if op == scanSkipSpace { + op = d.scanWhile(scanSkipSpace) + } + if op != scanObjectKey { + d.error(errPhase) + } + + // Read value. + if destring { + switch qv := d.valueQuoted().(type) { + case nil: + d.literalStore(nullLiteral, subv, false) + case string: + d.literalStore([]byte(qv), subv, true) + default: + d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal unquoted value into %v", subv.Type())) + } + } else { + d.value(subv) + } + + // Write value back to map; + // if using struct, subv points into struct already. + if v.Kind() == reflect.Map { + kv := reflect.ValueOf(key).Convert(v.Type().Key()) + v.SetMapIndex(kv, subv) + } + + // Next token must be , or }. + op = d.scanWhile(scanSkipSpace) + if op == scanEndObject { + break + } + if op != scanObjectValue { + d.error(errPhase) + } + } +} + +// literal consumes a literal from d.data[d.off-1:], decoding into the value v. +// The first byte of the literal has been read already +// (that's how the caller knows it's a literal). +func (d *decodeState) literal(v reflect.Value) { + // All bytes inside literal return scanContinue op code. + start := d.off - 1 + op := d.scanWhile(scanContinue) + + // Scan read one byte too far; back up. + d.off-- + d.scan.undo(op) + + d.literalStore(d.data[start:d.off], v, false) +} + +// convertNumber converts the number literal s to a float64, int64 or a Number +// depending on d.numberDecodeType. +func (d *decodeState) convertNumber(s string) (interface{}, error) { + switch d.numberType { + + case UnmarshalJSONNumber: + return Number(s), nil + case UnmarshalIntOrFloat: + v, err := strconv.ParseInt(s, 10, 64) + if err == nil { + return v, nil + } + + // tries to parse integer number in scientific notation + f, err := strconv.ParseFloat(s, 64) + if err != nil { + return nil, &UnmarshalTypeError{"number " + s, reflect.TypeOf(0.0), int64(d.off)} + } + + // if it has no decimal value use int64 + if fi, fd := math.Modf(f); fd == 0.0 { + return int64(fi), nil + } + return f, nil + default: + f, err := strconv.ParseFloat(s, 64) + if err != nil { + return nil, &UnmarshalTypeError{"number " + s, reflect.TypeOf(0.0), int64(d.off)} + } + return f, nil + } + +} + +var numberType = reflect.TypeOf(Number("")) + +// literalStore decodes a literal stored in item into v. +// +// fromQuoted indicates whether this literal came from unwrapping a +// string from the ",string" struct tag option. this is used only to +// produce more helpful error messages. +func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool) { + // Check for unmarshaler. + if len(item) == 0 { + //Empty string given + d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) + return + } + wantptr := item[0] == 'n' // null + u, ut, pv := d.indirect(v, wantptr) + if u != nil { + err := u.UnmarshalJSON(item) + if err != nil { + d.error(err) + } + return + } + if ut != nil { + if item[0] != '"' { + if fromQuoted { + d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) + } else { + d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)}) + } + return + } + s, ok := unquoteBytes(item) + if !ok { + if fromQuoted { + d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) + } else { + d.error(errPhase) + } + } + err := ut.UnmarshalText(s) + if err != nil { + d.error(err) + } + return + } + + v = pv + + switch c := item[0]; c { + case 'n': // null + switch v.Kind() { + case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: + v.Set(reflect.Zero(v.Type())) + // otherwise, ignore null for primitives/string + } + case 't', 'f': // true, false + value := c == 't' + switch v.Kind() { + default: + if fromQuoted { + d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) + } else { + d.saveError(&UnmarshalTypeError{"bool", v.Type(), int64(d.off)}) + } + case reflect.Bool: + v.SetBool(value) + case reflect.Interface: + if v.NumMethod() == 0 { + v.Set(reflect.ValueOf(value)) + } else { + d.saveError(&UnmarshalTypeError{"bool", v.Type(), int64(d.off)}) + } + } + + case '"': // string + s, ok := unquoteBytes(item) + if !ok { + if fromQuoted { + d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) + } else { + d.error(errPhase) + } + } + switch v.Kind() { + default: + d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)}) + case reflect.Slice: + if v.Type().Elem().Kind() != reflect.Uint8 { + d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)}) + break + } + b := make([]byte, base64.StdEncoding.DecodedLen(len(s))) + n, err := base64.StdEncoding.Decode(b, s) + if err != nil { + d.saveError(err) + break + } + v.SetBytes(b[:n]) + case reflect.String: + v.SetString(string(s)) + case reflect.Interface: + if v.NumMethod() == 0 { + v.Set(reflect.ValueOf(string(s))) + } else { + d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)}) + } + } + + default: // number + if c != '-' && (c < '0' || c > '9') { + if fromQuoted { + d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) + } else { + d.error(errPhase) + } + } + s := string(item) + switch v.Kind() { + default: + if v.Kind() == reflect.String && v.Type() == numberType { + v.SetString(s) + if !isValidNumber(s) { + d.error(fmt.Errorf("json: invalid number literal, trying to unmarshal %q into Number", item)) + } + break + } + if fromQuoted { + d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) + } else { + d.error(&UnmarshalTypeError{"number", v.Type(), int64(d.off)}) + } + case reflect.Interface: + n, err := d.convertNumber(s) + if err != nil { + d.saveError(err) + break + } + if v.NumMethod() != 0 { + d.saveError(&UnmarshalTypeError{"number", v.Type(), int64(d.off)}) + break + } + v.Set(reflect.ValueOf(n)) + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + n, err := strconv.ParseInt(s, 10, 64) + if err != nil || v.OverflowInt(n) { + d.saveError(&UnmarshalTypeError{"number " + s, v.Type(), int64(d.off)}) + break + } + v.SetInt(n) + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + n, err := strconv.ParseUint(s, 10, 64) + if err != nil || v.OverflowUint(n) { + d.saveError(&UnmarshalTypeError{"number " + s, v.Type(), int64(d.off)}) + break + } + v.SetUint(n) + + case reflect.Float32, reflect.Float64: + n, err := strconv.ParseFloat(s, v.Type().Bits()) + if err != nil || v.OverflowFloat(n) { + d.saveError(&UnmarshalTypeError{"number " + s, v.Type(), int64(d.off)}) + break + } + v.SetFloat(n) + } + } +} + +// The xxxInterface routines build up a value to be stored +// in an empty interface. They are not strictly necessary, +// but they avoid the weight of reflection in this common case. + +// valueInterface is like value but returns interface{} +func (d *decodeState) valueInterface() interface{} { + switch d.scanWhile(scanSkipSpace) { + default: + d.error(errPhase) + panic("unreachable") + case scanBeginArray: + return d.arrayInterface() + case scanBeginObject: + return d.objectInterface() + case scanBeginLiteral: + return d.literalInterface() + } +} + +// arrayInterface is like array but returns []interface{}. +func (d *decodeState) arrayInterface() []interface{} { + var v = make([]interface{}, 0) + for { + // Look ahead for ] - can only happen on first iteration. + op := d.scanWhile(scanSkipSpace) + if op == scanEndArray { + break + } + + // Back up so d.value can have the byte we just read. + d.off-- + d.scan.undo(op) + + v = append(v, d.valueInterface()) + + // Next token must be , or ]. + op = d.scanWhile(scanSkipSpace) + if op == scanEndArray { + break + } + if op != scanArrayValue { + d.error(errPhase) + } + } + return v +} + +// objectInterface is like object but returns map[string]interface{}. +func (d *decodeState) objectInterface() map[string]interface{} { + m := make(map[string]interface{}) + keys := map[string]bool{} + + for { + // Read opening " of string key or closing }. + op := d.scanWhile(scanSkipSpace) + if op == scanEndObject { + // closing } - can only happen on first iteration. + break + } + if op != scanBeginLiteral { + d.error(errPhase) + } + + // Read string key. + start := d.off - 1 + op = d.scanWhile(scanContinue) + item := d.data[start : d.off-1] + key, ok := unquote(item) + if !ok { + d.error(errPhase) + } + + // Check for duplicate keys. + _, ok = keys[key] + if !ok { + keys[key] = true + } else { + d.error(fmt.Errorf("json: duplicate key '%s' in object", key)) + } + + // Read : before value. + if op == scanSkipSpace { + op = d.scanWhile(scanSkipSpace) + } + if op != scanObjectKey { + d.error(errPhase) + } + + // Read value. + m[key] = d.valueInterface() + + // Next token must be , or }. + op = d.scanWhile(scanSkipSpace) + if op == scanEndObject { + break + } + if op != scanObjectValue { + d.error(errPhase) + } + } + return m +} + +// literalInterface is like literal but returns an interface value. +func (d *decodeState) literalInterface() interface{} { + // All bytes inside literal return scanContinue op code. + start := d.off - 1 + op := d.scanWhile(scanContinue) + + // Scan read one byte too far; back up. + d.off-- + d.scan.undo(op) + item := d.data[start:d.off] + + switch c := item[0]; c { + case 'n': // null + return nil + + case 't', 'f': // true, false + return c == 't' + + case '"': // string + s, ok := unquote(item) + if !ok { + d.error(errPhase) + } + return s + + default: // number + if c != '-' && (c < '0' || c > '9') { + d.error(errPhase) + } + n, err := d.convertNumber(string(item)) + if err != nil { + d.saveError(err) + } + return n + } +} + +// getu4 decodes \uXXXX from the beginning of s, returning the hex value, +// or it returns -1. +func getu4(s []byte) rune { + if len(s) < 6 || s[0] != '\\' || s[1] != 'u' { + return -1 + } + r, err := strconv.ParseUint(string(s[2:6]), 16, 64) + if err != nil { + return -1 + } + return rune(r) +} + +// unquote converts a quoted JSON string literal s into an actual string t. +// The rules are different than for Go, so cannot use strconv.Unquote. +func unquote(s []byte) (t string, ok bool) { + s, ok = unquoteBytes(s) + t = string(s) + return +} + +func unquoteBytes(s []byte) (t []byte, ok bool) { + if len(s) < 2 || s[0] != '"' || s[len(s)-1] != '"' { + return + } + s = s[1 : len(s)-1] + + // Check for unusual characters. If there are none, + // then no unquoting is needed, so return a slice of the + // original bytes. + r := 0 + for r < len(s) { + c := s[r] + if c == '\\' || c == '"' || c < ' ' { + break + } + if c < utf8.RuneSelf { + r++ + continue + } + rr, size := utf8.DecodeRune(s[r:]) + if rr == utf8.RuneError && size == 1 { + break + } + r += size + } + if r == len(s) { + return s, true + } + + b := make([]byte, len(s)+2*utf8.UTFMax) + w := copy(b, s[0:r]) + for r < len(s) { + // Out of room? Can only happen if s is full of + // malformed UTF-8 and we're replacing each + // byte with RuneError. + if w >= len(b)-2*utf8.UTFMax { + nb := make([]byte, (len(b)+utf8.UTFMax)*2) + copy(nb, b[0:w]) + b = nb + } + switch c := s[r]; { + case c == '\\': + r++ + if r >= len(s) { + return + } + switch s[r] { + default: + return + case '"', '\\', '/', '\'': + b[w] = s[r] + r++ + w++ + case 'b': + b[w] = '\b' + r++ + w++ + case 'f': + b[w] = '\f' + r++ + w++ + case 'n': + b[w] = '\n' + r++ + w++ + case 'r': + b[w] = '\r' + r++ + w++ + case 't': + b[w] = '\t' + r++ + w++ + case 'u': + r-- + rr := getu4(s[r:]) + if rr < 0 { + return + } + r += 6 + if utf16.IsSurrogate(rr) { + rr1 := getu4(s[r:]) + if dec := utf16.DecodeRune(rr, rr1); dec != unicode.ReplacementChar { + // A valid pair; consume. + r += 6 + w += utf8.EncodeRune(b[w:], dec) + break + } + // Invalid surrogate; fall back to replacement rune. + rr = unicode.ReplacementChar + } + w += utf8.EncodeRune(b[w:], rr) + } + + // Quote, control characters are invalid. + case c == '"', c < ' ': + return + + // ASCII + case c < utf8.RuneSelf: + b[w] = c + r++ + w++ + + // Coerce to well-formed UTF-8. + default: + rr, size := utf8.DecodeRune(s[r:]) + r += size + w += utf8.EncodeRune(b[w:], rr) + } + } + return b[0:w], true +} diff --git a/vendor/github.com/go-jose/go-jose/v4/json/encode.go b/vendor/github.com/go-jose/go-jose/v4/json/encode.go new file mode 100644 index 00000000..98de68ce --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/json/encode.go @@ -0,0 +1,1197 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package json implements encoding and decoding of JSON objects as defined in +// RFC 4627. The mapping between JSON objects and Go values is described +// in the documentation for the Marshal and Unmarshal functions. +// +// See "JSON and Go" for an introduction to this package: +// https://golang.org/doc/articles/json_and_go.html +package json + +import ( + "bytes" + "encoding" + "encoding/base64" + "fmt" + "math" + "reflect" + "runtime" + "sort" + "strconv" + "strings" + "sync" + "unicode" + "unicode/utf8" +) + +// Marshal returns the JSON encoding of v. +// +// Marshal traverses the value v recursively. +// If an encountered value implements the Marshaler interface +// and is not a nil pointer, Marshal calls its MarshalJSON method +// to produce JSON. If no MarshalJSON method is present but the +// value implements encoding.TextMarshaler instead, Marshal calls +// its MarshalText method. +// The nil pointer exception is not strictly necessary +// but mimics a similar, necessary exception in the behavior of +// UnmarshalJSON. +// +// Otherwise, Marshal uses the following type-dependent default encodings: +// +// Boolean values encode as JSON booleans. +// +// Floating point, integer, and Number values encode as JSON numbers. +// +// String values encode as JSON strings coerced to valid UTF-8, +// replacing invalid bytes with the Unicode replacement rune. +// The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e" +// to keep some browsers from misinterpreting JSON output as HTML. +// Ampersand "&" is also escaped to "\u0026" for the same reason. +// +// Array and slice values encode as JSON arrays, except that +// []byte encodes as a base64-encoded string, and a nil slice +// encodes as the null JSON object. +// +// Struct values encode as JSON objects. Each exported struct field +// becomes a member of the object unless +// - the field's tag is "-", or +// - the field is empty and its tag specifies the "omitempty" option. +// +// The empty values are false, 0, any +// nil pointer or interface value, and any array, slice, map, or string of +// length zero. The object's default key string is the struct field name +// but can be specified in the struct field's tag value. The "json" key in +// the struct field's tag value is the key name, followed by an optional comma +// and options. Examples: +// +// // Field is ignored by this package. +// Field int `json:"-"` +// +// // Field appears in JSON as key "myName". +// Field int `json:"myName"` +// +// // Field appears in JSON as key "myName" and +// // the field is omitted from the object if its value is empty, +// // as defined above. +// Field int `json:"myName,omitempty"` +// +// // Field appears in JSON as key "Field" (the default), but +// // the field is skipped if empty. +// // Note the leading comma. +// Field int `json:",omitempty"` +// +// The "string" option signals that a field is stored as JSON inside a +// JSON-encoded string. It applies only to fields of string, floating point, +// integer, or boolean types. This extra level of encoding is sometimes used +// when communicating with JavaScript programs: +// +// Int64String int64 `json:",string"` +// +// The key name will be used if it's a non-empty string consisting of +// only Unicode letters, digits, dollar signs, percent signs, hyphens, +// underscores and slashes. +// +// Anonymous struct fields are usually marshaled as if their inner exported fields +// were fields in the outer struct, subject to the usual Go visibility rules amended +// as described in the next paragraph. +// An anonymous struct field with a name given in its JSON tag is treated as +// having that name, rather than being anonymous. +// An anonymous struct field of interface type is treated the same as having +// that type as its name, rather than being anonymous. +// +// The Go visibility rules for struct fields are amended for JSON when +// deciding which field to marshal or unmarshal. If there are +// multiple fields at the same level, and that level is the least +// nested (and would therefore be the nesting level selected by the +// usual Go rules), the following extra rules apply: +// +// 1) Of those fields, if any are JSON-tagged, only tagged fields are considered, +// even if there are multiple untagged fields that would otherwise conflict. +// 2) If there is exactly one field (tagged or not according to the first rule), that is selected. +// 3) Otherwise there are multiple fields, and all are ignored; no error occurs. +// +// Handling of anonymous struct fields is new in Go 1.1. +// Prior to Go 1.1, anonymous struct fields were ignored. To force ignoring of +// an anonymous struct field in both current and earlier versions, give the field +// a JSON tag of "-". +// +// Map values encode as JSON objects. +// The map's key type must be string; the map keys are used as JSON object +// keys, subject to the UTF-8 coercion described for string values above. +// +// Pointer values encode as the value pointed to. +// A nil pointer encodes as the null JSON object. +// +// Interface values encode as the value contained in the interface. +// A nil interface value encodes as the null JSON object. +// +// Channel, complex, and function values cannot be encoded in JSON. +// Attempting to encode such a value causes Marshal to return +// an UnsupportedTypeError. +// +// JSON cannot represent cyclic data structures and Marshal does not +// handle them. Passing cyclic structures to Marshal will result in +// an infinite recursion. +func Marshal(v interface{}) ([]byte, error) { + e := &encodeState{} + err := e.marshal(v) + if err != nil { + return nil, err + } + return e.Bytes(), nil +} + +// MarshalIndent is like Marshal but applies Indent to format the output. +func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { + b, err := Marshal(v) + if err != nil { + return nil, err + } + var buf bytes.Buffer + err = Indent(&buf, b, prefix, indent) + if err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +// HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029 +// characters inside string literals changed to \u003c, \u003e, \u0026, \u2028, \u2029 +// so that the JSON will be safe to embed inside HTML - - + + - - - + + + @@ -86,7 +86,7 @@
- - - - - - - - - - + + + + + + + + + +
+ + + Users - GARM + + +
+ + + + + + + {#if column.key === 'is_admin'} + + {:else if column.key === 'enabled'} + + {/if} + + + + +
+
+

+ {user.username} +

+

+ {user.email} +

+ {#if user.full_name} +

+ {user.full_name} +

+ {/if} +
+
+ + +
+
+
+
+
+ From bbc920c7d5cc3607fd89d6b9a25a8f45d1303a8a Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Sat, 3 Jan 2026 00:24:24 +0000 Subject: [PATCH 7/7] Add version display to navigation sidebar --- .../chunks/{io-Ugua7.js => 6aKjRj0k.js} | 2 +- .../chunks/{CD4S0w_x.js => B-QyJt36.js} | 2 +- .../chunks/{vYI-AT_7.js => B9RC0dq5.js} | 2 +- .../chunks/{Cfdue6T6.js => BKeluGSY.js} | 2 +- .../chunks/{BTeTCgJA.js => BStwtkX8.js} | 2 +- .../chunks/{CUtPzwFi.js => Bmm5UxxZ.js} | 2 +- .../chunks/{DH5setay.js => Bql5nQdO.js} | 2 +- .../chunks/{CRSOHHg7.js => BrlhCerN.js} | 2 +- .../chunks/{C6Z10Ipi.js => C6-Yv_jr.js} | 2 +- .../chunks/{BaTN8n88.js => C681KorI.js} | 2 +- .../chunks/{BU_V7FOQ.js => C8dZhfFx.js} | 2 +- .../chunks/{C6jYEeWP.js => CVBpH3Sf.js} | 2 +- .../chunks/{Cvcp5xHB.js => CYK-UalN.js} | 2 +- .../chunks/{DuwadzDF.js => CiCSB29J.js} | 2 +- .../chunks/{CCoxuXg5.js => CovvT05J.js} | 2 +- .../chunks/{BS0eXXA4.js => DAg7Eq1U.js} | 2 +- .../chunks/{-FPg0SOX.js => DC7O3Apj.js} | 2 +- .../chunks/{DOA3alhD.js => DQfnVUrv.js} | 2 +- .../chunks/{8ZO9Ka4R.js => DR0xnkWv.js} | 2 +- .../chunks/{uzzFhb3G.js => DUWZCTMr.js} | 2 +- .../chunks/{CkTG2UXI.js => DWgB-t1g.js} | 2 +- .../chunks/{D3FdGlax.js => DXEzcvud.js} | 2 +- .../chunks/{JRrg5LRu.js => DZ2a7TNP.js} | 2 +- .../chunks/{CLZesvzF.js => DacI6VAP.js} | 2 +- .../chunks/{DovBLKjH.js => DbE0zTOa.js} | 2 +- .../chunks/{CEJvqnOn.js => Dd4NFVf9.js} | 2 +- .../chunks/{lQWw1Z23.js => Dxx83T0m.js} | 2 +- .../chunks/{Ckgw6FMz.js => ONKDshdz.js} | 2 +- .../chunks/{CkcEJ1BA.js => OrLoP7JZ.js} | 2 +- .../chunks/{C2c_wqo6.js => Vo3Mv3dp.js} | 2 +- .../chunks/{DNHT2U_W.js => ZelbukuJ.js} | 2 +- .../chunks/{C-3AL0iB.js => oWoYyEl8.js} | 2 +- .../chunks/{Cs0pYghy.js => rb89c4PS.js} | 2 +- .../chunks/{B87zT258.js => xMqsWuAL.js} | 2 +- .../_app/immutable/entry/app.CRkYa7Qr.js | 2 -- .../_app/immutable/entry/app.CxzbqMLz.js | 2 ++ .../_app/immutable/entry/start.0dEn5882.js | 1 - .../_app/immutable/entry/start.C0YH1vK2.js | 1 + .../assets/_app/immutable/nodes/0.B_YQfsM9.js | 13 ++++++++++++ .../assets/_app/immutable/nodes/0.JalwDZMc.js | 13 ------------ .../nodes/{1.DfUf2A_9.js => 1.BkJ9sG2d.js} | 2 +- .../nodes/{10.4V8r82tY.js => 10.Dy2Me2Kb.js} | 2 +- .../nodes/{11.hAL_Iuyo.js => 11.CrioD3y5.js} | 2 +- .../nodes/{12.Csus4sgy.js => 12.B-iY07X5.js} | 2 +- .../nodes/{13.hS6EkA-z.js => 13.R0etGrgT.js} | 2 +- .../nodes/{14.BjI1asMm.js => 14.5u0NL8hV.js} | 2 +- .../nodes/{15.D2oFYgN3.js => 15.BA3p6CkM.js} | 2 +- .../nodes/{16.CnTD7yhj.js => 16.NNUit-Zw.js} | 2 +- .../nodes/{17.LPpjfVrH.js => 17.D-lQvPgz.js} | 2 +- .../nodes/{18.DZSsQ4kC.js => 18.DvnMNUxr.js} | 2 +- .../nodes/{19.DCbbcuA3.js => 19.B50u3Qn5.js} | 2 +- .../nodes/{2.DwM7F70n.js => 2.CyNGYHEu.js} | 2 +- .../nodes/{20.D8JTfsn9.js => 20.DITIOxJB.js} | 2 +- .../nodes/{21.D25eFoe0.js => 21.v2GZiIwr.js} | 2 +- .../nodes/{22.laAA6k8S.js => 22.SjbkZ9mL.js} | 2 +- .../nodes/{23.D4QqDH8N.js => 23.CJXOkL1d.js} | 2 +- .../nodes/{24.BLkBUd5n.js => 24.DG4EX-2D.js} | 2 +- .../nodes/{3.BzLzrOWy.js => 3.Ylobjoa9.js} | 2 +- .../nodes/{4.4T8ji-4a.js => 4.BEiTKBiZ.js} | 2 +- .../nodes/{5.D-IgI9y1.js => 5.g7cRDIWD.js} | 2 +- .../nodes/{6.DzEKB4QD.js => 6.C_k9lHXG.js} | 2 +- .../nodes/{7.DLPvTRtH.js => 7.C88HESSe.js} | 2 +- .../nodes/{8.CQSV4FuF.js => 8.DnJntumo.js} | 2 +- .../nodes/{9.DOPDjgGY.js => 9.DS05dI_2.js} | 2 +- webapp/assets/_app/version.json | 2 +- webapp/assets/index.html | 16 +++++++-------- webapp/src/lib/components/Navigation.svelte | 20 +++++++++++++++++++ 67 files changed, 103 insertions(+), 83 deletions(-) rename webapp/assets/_app/immutable/chunks/{io-Ugua7.js => 6aKjRj0k.js} (98%) rename webapp/assets/_app/immutable/chunks/{CD4S0w_x.js => B-QyJt36.js} (99%) rename webapp/assets/_app/immutable/chunks/{vYI-AT_7.js => B9RC0dq5.js} (91%) rename webapp/assets/_app/immutable/chunks/{Cfdue6T6.js => BKeluGSY.js} (99%) rename webapp/assets/_app/immutable/chunks/{BTeTCgJA.js => BStwtkX8.js} (94%) rename webapp/assets/_app/immutable/chunks/{CUtPzwFi.js => Bmm5UxxZ.js} (98%) rename webapp/assets/_app/immutable/chunks/{DH5setay.js => Bql5nQdO.js} (81%) rename webapp/assets/_app/immutable/chunks/{CRSOHHg7.js => BrlhCerN.js} (97%) rename webapp/assets/_app/immutable/chunks/{C6Z10Ipi.js => C6-Yv_jr.js} (99%) rename webapp/assets/_app/immutable/chunks/{BaTN8n88.js => C681KorI.js} (98%) rename webapp/assets/_app/immutable/chunks/{BU_V7FOQ.js => C8dZhfFx.js} (99%) rename webapp/assets/_app/immutable/chunks/{C6jYEeWP.js => CVBpH3Sf.js} (91%) rename webapp/assets/_app/immutable/chunks/{Cvcp5xHB.js => CYK-UalN.js} (99%) rename webapp/assets/_app/immutable/chunks/{DuwadzDF.js => CiCSB29J.js} (76%) rename webapp/assets/_app/immutable/chunks/{CCoxuXg5.js => CovvT05J.js} (92%) rename webapp/assets/_app/immutable/chunks/{BS0eXXA4.js => DAg7Eq1U.js} (98%) rename webapp/assets/_app/immutable/chunks/{-FPg0SOX.js => DC7O3Apj.js} (99%) rename webapp/assets/_app/immutable/chunks/{DOA3alhD.js => DQfnVUrv.js} (96%) rename webapp/assets/_app/immutable/chunks/{8ZO9Ka4R.js => DR0xnkWv.js} (97%) rename webapp/assets/_app/immutable/chunks/{uzzFhb3G.js => DUWZCTMr.js} (98%) rename webapp/assets/_app/immutable/chunks/{CkTG2UXI.js => DWgB-t1g.js} (94%) rename webapp/assets/_app/immutable/chunks/{D3FdGlax.js => DXEzcvud.js} (71%) rename webapp/assets/_app/immutable/chunks/{JRrg5LRu.js => DZ2a7TNP.js} (94%) rename webapp/assets/_app/immutable/chunks/{CLZesvzF.js => DacI6VAP.js} (96%) rename webapp/assets/_app/immutable/chunks/{DovBLKjH.js => DbE0zTOa.js} (96%) rename webapp/assets/_app/immutable/chunks/{CEJvqnOn.js => Dd4NFVf9.js} (96%) rename webapp/assets/_app/immutable/chunks/{lQWw1Z23.js => Dxx83T0m.js} (97%) rename webapp/assets/_app/immutable/chunks/{Ckgw6FMz.js => ONKDshdz.js} (96%) rename webapp/assets/_app/immutable/chunks/{CkcEJ1BA.js => OrLoP7JZ.js} (97%) rename webapp/assets/_app/immutable/chunks/{C2c_wqo6.js => Vo3Mv3dp.js} (98%) rename webapp/assets/_app/immutable/chunks/{DNHT2U_W.js => ZelbukuJ.js} (99%) rename webapp/assets/_app/immutable/chunks/{C-3AL0iB.js => oWoYyEl8.js} (75%) rename webapp/assets/_app/immutable/chunks/{Cs0pYghy.js => rb89c4PS.js} (92%) rename webapp/assets/_app/immutable/chunks/{B87zT258.js => xMqsWuAL.js} (98%) delete mode 100644 webapp/assets/_app/immutable/entry/app.CRkYa7Qr.js create mode 100644 webapp/assets/_app/immutable/entry/app.CxzbqMLz.js delete mode 100644 webapp/assets/_app/immutable/entry/start.0dEn5882.js create mode 100644 webapp/assets/_app/immutable/entry/start.C0YH1vK2.js create mode 100644 webapp/assets/_app/immutable/nodes/0.B_YQfsM9.js delete mode 100644 webapp/assets/_app/immutable/nodes/0.JalwDZMc.js rename webapp/assets/_app/immutable/nodes/{1.DfUf2A_9.js => 1.BkJ9sG2d.js} (84%) rename webapp/assets/_app/immutable/nodes/{10.4V8r82tY.js => 10.Dy2Me2Kb.js} (96%) rename webapp/assets/_app/immutable/nodes/{11.hAL_Iuyo.js => 11.CrioD3y5.js} (98%) rename webapp/assets/_app/immutable/nodes/{12.Csus4sgy.js => 12.B-iY07X5.js} (97%) rename webapp/assets/_app/immutable/nodes/{13.hS6EkA-z.js => 13.R0etGrgT.js} (95%) rename webapp/assets/_app/immutable/nodes/{14.BjI1asMm.js => 14.5u0NL8hV.js} (93%) rename webapp/assets/_app/immutable/nodes/{15.D2oFYgN3.js => 15.BA3p6CkM.js} (87%) rename webapp/assets/_app/immutable/nodes/{16.CnTD7yhj.js => 16.NNUit-Zw.js} (96%) rename webapp/assets/_app/immutable/nodes/{17.LPpjfVrH.js => 17.D-lQvPgz.js} (95%) rename webapp/assets/_app/immutable/nodes/{18.DZSsQ4kC.js => 18.DvnMNUxr.js} (93%) rename webapp/assets/_app/immutable/nodes/{19.DCbbcuA3.js => 19.B50u3Qn5.js} (97%) rename webapp/assets/_app/immutable/nodes/{2.DwM7F70n.js => 2.CyNGYHEu.js} (99%) rename webapp/assets/_app/immutable/nodes/{20.D8JTfsn9.js => 20.DITIOxJB.js} (96%) rename webapp/assets/_app/immutable/nodes/{21.D25eFoe0.js => 21.v2GZiIwr.js} (92%) rename webapp/assets/_app/immutable/nodes/{22.laAA6k8S.js => 22.SjbkZ9mL.js} (97%) rename webapp/assets/_app/immutable/nodes/{23.D4QqDH8N.js => 23.CJXOkL1d.js} (97%) rename webapp/assets/_app/immutable/nodes/{24.BLkBUd5n.js => 24.DG4EX-2D.js} (93%) rename webapp/assets/_app/immutable/nodes/{3.BzLzrOWy.js => 3.Ylobjoa9.js} (97%) rename webapp/assets/_app/immutable/nodes/{4.4T8ji-4a.js => 4.BEiTKBiZ.js} (98%) rename webapp/assets/_app/immutable/nodes/{5.D-IgI9y1.js => 5.g7cRDIWD.js} (94%) rename webapp/assets/_app/immutable/nodes/{6.DzEKB4QD.js => 6.C_k9lHXG.js} (94%) rename webapp/assets/_app/immutable/nodes/{7.DLPvTRtH.js => 7.C88HESSe.js} (98%) rename webapp/assets/_app/immutable/nodes/{8.CQSV4FuF.js => 8.DnJntumo.js} (93%) rename webapp/assets/_app/immutable/nodes/{9.DOPDjgGY.js => 9.DS05dI_2.js} (97%) diff --git a/webapp/assets/_app/immutable/chunks/io-Ugua7.js b/webapp/assets/_app/immutable/chunks/6aKjRj0k.js similarity index 98% rename from webapp/assets/_app/immutable/chunks/io-Ugua7.js rename to webapp/assets/_app/immutable/chunks/6aKjRj0k.js index afd59849..5e742c42 100644 --- a/webapp/assets/_app/immutable/chunks/io-Ugua7.js +++ b/webapp/assets/_app/immutable/chunks/6aKjRj0k.js @@ -1 +1 @@ -import{f as x,s as v,e as ye,a as u,t as He}from"./ZGz3X54u.js";import{i as Je}from"./CY7Wcm-1.js";import{p as Qe,v as Ve,o as Xe,c as a,r,s,g as e,m as b,n as U,t as y,k as xe,u as c,h as $,d as n,a as Ye}from"./kDtaAWAK.js";import{p as fe,i as B}from"./Cun6jNAp.js";import{e as Ze,i as et}from"./DdT9Vz5Q.js";import{r as ee,b as _e,g as tt}from"./Cvcp5xHB.js";import{a as he,b as at}from"./CYnNqrHp.js";import{p as rt}from"./CdEA5IGF.js";import{e as ke}from"./BZiHL9L3.js";import{M as ot}from"./C6jYEeWP.js";var st=x('

'),nt=x('
Owner:
'),it=x('
'),dt=x(""),lt=x(''),ct=x('

Leave empty to auto-generate a new secret

'),vt=x('
Updating...
'),pt=x('

Name:
Endpoint:
Current Credentials:
Current Pool Balancer:

Leave unchanged to keep current credentials

Round Robin distributes jobs evenly across pools, Pack fills pools in order

');function wt(we,A){Qe(A,!1);let i=fe(A,"entity",8),C=fe(A,"entityType",8);const T=Ve();let M=b(!1),k=b(""),R=b([]),W=b(!1),f=b(""),_=b(""),h=b(""),g=b(!1),S=b(!1);function Ce(){if(C()==="repository"){const l=i();return`${l.owner}/${l.name}`}return i().name||""}function j(){return C().charAt(0).toUpperCase()+C().slice(1)}function Me(){return C()==="repository"&&i().owner||""}async function Se(){try{n(W,!0),n(R,await tt.listCredentials())}catch(l){n(k,ke(l))}finally{n(W,!1)}}function Ee(){n(f,i().credentials_name||""),n(_,i().pool_balancing_type||"roundrobin"),n(h,""),n(g,!1),n(S,i().agent_mode??!1)}async function Pe(){try{n(M,!0),n(k,"");const l={};let w=!1;if(e(f)&&e(f)!==i().credentials_name&&(l.credentials_name=e(f),w=!0),e(_)&&e(_)!==i().pool_balancing_type&&(l.pool_balancer_type=e(_),w=!0),e(S)!==i().agent_mode&&(l.agent_mode=e(S),w=!0),e(g)){if(!e(h).trim()){n(k,"Please enter a webhook secret or uncheck the option to change it");return}l.webhook_secret=e(h),w=!0}if(!w){T("close");return}T("submit",l)}catch(l){n(k,ke(l))}finally{n(M,!1)}}Xe(()=>{Se(),Ee()}),Je(),ot(we,{$$events:{close:()=>T("close")},children:(l,w)=>{var z=pt(),D=a(z),N=a(D),Ue=a(N);r(N);var te=s(N,2),Be=a(te,!0);r(te),r(D);var I=s(D,2),ae=a(I);{var Te=t=>{var o=st(),d=a(o),p=a(d,!0);r(d),r(o),y(()=>v(p,e(k))),u(t,o)};B(ae,t=>{e(k)&&t(Te)})}var L=s(ae,2),O=a(L),$e=a(O);r(O);var re=s(O,2),oe=a(re);{var Ae=t=>{var o=nt(),d=s(a(o),2),p=a(d,!0);r(d),r(o),y(E=>v(p,E),[()=>c(Me)]),u(t,o)};B(oe,t=>{C()==="repository"&&t(Ae)})}var q=s(oe,2),se=s(a(q),2),Re=a(se,!0);r(se),r(q);var F=s(q,2),ne=s(a(F),2),We=a(ne,!0);r(ne),r(F);var G=s(F,2),ie=s(a(G),2),je=a(ie,!0);r(ie),r(G);var de=s(G,2),le=s(a(de),2),ze=a(le,!0);r(le),r(de),r(re),r(L);var K=s(L,2),H=a(K),De=s(a(H),2);{var Ne=t=>{var o=it();u(t,o)},Ie=t=>{var o=lt();y(()=>{e(f),xe(()=>{e(R)})});var d=a(o);d.value=d.__value="";var p=s(d);Ze(p,1,()=>e(R),et,(E,m)=>{var P=dt(),Ke=a(P);r(P);var me={};y(()=>{v(Ke,`${e(m),c(()=>e(m).name)??""} (${e(m),c(()=>e(m).endpoint?.name||"Unknown")??""})`),me!==(me=(e(m),c(()=>e(m).name)))&&(P.value=(P.__value=(e(m),c(()=>e(m).name)))??"")}),u(E,P)}),r(o),_e(o,()=>e(f),E=>n(f,E)),u(t,o)};B(De,t=>{e(W)?t(Ne):t(Ie,!1)})}U(2),r(H);var J=s(H,2),Q=s(a(J),2);y(()=>{e(_),xe(()=>{})});var V=a(Q);V.value=V.__value="roundrobin";var ce=s(V);ce.value=ce.__value="pack",r(Q),U(2),r(J);var X=s(J,2),ve=a(X);ee(ve),U(4),r(X);var pe=s(X,2),Y=a(pe),ue=a(Y);ee(ue),U(2),r(Y);var Le=s(Y,2);{var Oe=t=>{var o=ct(),d=s(a(o),2);ee(d),U(2),r(o),y(()=>d.required=e(g)),at(d,()=>e(h),p=>n(h,p)),u(t,o)};B(Le,t=>{e(g)&&t(Oe)})}r(pe),r(K);var be=s(K,2),ge=a(be),Z=s(ge,2),qe=a(Z);{var Fe=t=>{var o=vt();u(t,o)},Ge=t=>{var o=He();y(d=>v(o,`Update ${d??""}`),[()=>c(j)]),u(t,o)};B(qe,t=>{e(M)?t(Fe):t(Ge,!1)})}r(Z),r(be),r(I),r(z),y((t,o,d,p)=>{v(Ue,`Update ${t??""}`),v(Be,o),v($e,`${d??""} Information`),v(Re,($(i()),c(()=>i().name))),v(We,($(i()),c(()=>i().endpoint?.name))),v(je,($(i()),c(()=>i().credentials_name))),v(ze,($(i()),c(()=>i().pool_balancing_type||"roundrobin"))),Z.disabled=p},[()=>c(j),()=>c(Ce),()=>c(j),()=>(e(M),e(g),e(h),c(()=>e(M)||e(g)&&!e(h).trim()))]),_e(Q,()=>e(_),t=>n(_,t)),he(ve,()=>e(S),t=>n(S,t)),he(ue,()=>e(g),t=>n(g,t)),ye("click",ge,()=>T("close")),ye("submit",I,rt(Pe)),u(l,z)},$$slots:{default:!0}}),Ye()}export{wt as U}; +import{f as x,s as v,e as ye,a as u,t as He}from"./ZGz3X54u.js";import{i as Je}from"./CY7Wcm-1.js";import{p as Qe,v as Ve,o as Xe,c as a,r,s,g as e,m as b,n as U,t as y,k as xe,u as c,h as $,d as n,a as Ye}from"./kDtaAWAK.js";import{p as fe,i as B}from"./Cun6jNAp.js";import{e as Ze,i as et}from"./DdT9Vz5Q.js";import{r as ee,b as _e,g as tt}from"./CYK-UalN.js";import{a as he,b as at}from"./CYnNqrHp.js";import{p as rt}from"./CdEA5IGF.js";import{e as ke}from"./BZiHL9L3.js";import{M as ot}from"./CVBpH3Sf.js";var st=x('

'),nt=x('
Owner:
'),it=x('
'),dt=x(""),lt=x(''),ct=x('

Leave empty to auto-generate a new secret

'),vt=x('
Updating...
'),pt=x('

Name:
Endpoint:
Current Credentials:
Current Pool Balancer:

Leave unchanged to keep current credentials

Round Robin distributes jobs evenly across pools, Pack fills pools in order

');function wt(we,A){Qe(A,!1);let i=fe(A,"entity",8),C=fe(A,"entityType",8);const T=Ve();let M=b(!1),k=b(""),R=b([]),W=b(!1),f=b(""),_=b(""),h=b(""),g=b(!1),S=b(!1);function Ce(){if(C()==="repository"){const l=i();return`${l.owner}/${l.name}`}return i().name||""}function j(){return C().charAt(0).toUpperCase()+C().slice(1)}function Me(){return C()==="repository"&&i().owner||""}async function Se(){try{n(W,!0),n(R,await tt.listCredentials())}catch(l){n(k,ke(l))}finally{n(W,!1)}}function Ee(){n(f,i().credentials_name||""),n(_,i().pool_balancing_type||"roundrobin"),n(h,""),n(g,!1),n(S,i().agent_mode??!1)}async function Pe(){try{n(M,!0),n(k,"");const l={};let w=!1;if(e(f)&&e(f)!==i().credentials_name&&(l.credentials_name=e(f),w=!0),e(_)&&e(_)!==i().pool_balancing_type&&(l.pool_balancer_type=e(_),w=!0),e(S)!==i().agent_mode&&(l.agent_mode=e(S),w=!0),e(g)){if(!e(h).trim()){n(k,"Please enter a webhook secret or uncheck the option to change it");return}l.webhook_secret=e(h),w=!0}if(!w){T("close");return}T("submit",l)}catch(l){n(k,ke(l))}finally{n(M,!1)}}Xe(()=>{Se(),Ee()}),Je(),ot(we,{$$events:{close:()=>T("close")},children:(l,w)=>{var z=pt(),D=a(z),N=a(D),Ue=a(N);r(N);var te=s(N,2),Be=a(te,!0);r(te),r(D);var I=s(D,2),ae=a(I);{var Te=t=>{var o=st(),d=a(o),p=a(d,!0);r(d),r(o),y(()=>v(p,e(k))),u(t,o)};B(ae,t=>{e(k)&&t(Te)})}var L=s(ae,2),O=a(L),$e=a(O);r(O);var re=s(O,2),oe=a(re);{var Ae=t=>{var o=nt(),d=s(a(o),2),p=a(d,!0);r(d),r(o),y(E=>v(p,E),[()=>c(Me)]),u(t,o)};B(oe,t=>{C()==="repository"&&t(Ae)})}var q=s(oe,2),se=s(a(q),2),Re=a(se,!0);r(se),r(q);var F=s(q,2),ne=s(a(F),2),We=a(ne,!0);r(ne),r(F);var G=s(F,2),ie=s(a(G),2),je=a(ie,!0);r(ie),r(G);var de=s(G,2),le=s(a(de),2),ze=a(le,!0);r(le),r(de),r(re),r(L);var K=s(L,2),H=a(K),De=s(a(H),2);{var Ne=t=>{var o=it();u(t,o)},Ie=t=>{var o=lt();y(()=>{e(f),xe(()=>{e(R)})});var d=a(o);d.value=d.__value="";var p=s(d);Ze(p,1,()=>e(R),et,(E,m)=>{var P=dt(),Ke=a(P);r(P);var me={};y(()=>{v(Ke,`${e(m),c(()=>e(m).name)??""} (${e(m),c(()=>e(m).endpoint?.name||"Unknown")??""})`),me!==(me=(e(m),c(()=>e(m).name)))&&(P.value=(P.__value=(e(m),c(()=>e(m).name)))??"")}),u(E,P)}),r(o),_e(o,()=>e(f),E=>n(f,E)),u(t,o)};B(De,t=>{e(W)?t(Ne):t(Ie,!1)})}U(2),r(H);var J=s(H,2),Q=s(a(J),2);y(()=>{e(_),xe(()=>{})});var V=a(Q);V.value=V.__value="roundrobin";var ce=s(V);ce.value=ce.__value="pack",r(Q),U(2),r(J);var X=s(J,2),ve=a(X);ee(ve),U(4),r(X);var pe=s(X,2),Y=a(pe),ue=a(Y);ee(ue),U(2),r(Y);var Le=s(Y,2);{var Oe=t=>{var o=ct(),d=s(a(o),2);ee(d),U(2),r(o),y(()=>d.required=e(g)),at(d,()=>e(h),p=>n(h,p)),u(t,o)};B(Le,t=>{e(g)&&t(Oe)})}r(pe),r(K);var be=s(K,2),ge=a(be),Z=s(ge,2),qe=a(Z);{var Fe=t=>{var o=vt();u(t,o)},Ge=t=>{var o=He();y(d=>v(o,`Update ${d??""}`),[()=>c(j)]),u(t,o)};B(qe,t=>{e(M)?t(Fe):t(Ge,!1)})}r(Z),r(be),r(I),r(z),y((t,o,d,p)=>{v(Ue,`Update ${t??""}`),v(Be,o),v($e,`${d??""} Information`),v(Re,($(i()),c(()=>i().name))),v(We,($(i()),c(()=>i().endpoint?.name))),v(je,($(i()),c(()=>i().credentials_name))),v(ze,($(i()),c(()=>i().pool_balancing_type||"roundrobin"))),Z.disabled=p},[()=>c(j),()=>c(Ce),()=>c(j),()=>(e(M),e(g),e(h),c(()=>e(M)||e(g)&&!e(h).trim()))]),_e(Q,()=>e(_),t=>n(_,t)),he(ve,()=>e(S),t=>n(S,t)),he(ue,()=>e(g),t=>n(g,t)),ye("click",ge,()=>T("close")),ye("submit",I,rt(Pe)),u(l,z)},$$slots:{default:!0}}),Ye()}export{wt as U}; diff --git a/webapp/assets/_app/immutable/chunks/CD4S0w_x.js b/webapp/assets/_app/immutable/chunks/B-QyJt36.js similarity index 99% rename from webapp/assets/_app/immutable/chunks/CD4S0w_x.js rename to webapp/assets/_app/immutable/chunks/B-QyJt36.js index bb40a4ea..37c8ca60 100644 --- a/webapp/assets/_app/immutable/chunks/CD4S0w_x.js +++ b/webapp/assets/_app/immutable/chunks/B-QyJt36.js @@ -1,4 +1,4 @@ -import{f as Vh,a as St,t as Cl,s as kn,b as $o,c as ud}from"./ZGz3X54u.js";import{i as Nh}from"./CY7Wcm-1.js";import{ao as dd,am as pd,p as Fh,v as Xh,o as md,q as gd,g as j,m as zi,l as Wt,d as Ii,h as zt,b as _h,a as Uh,c as $t,r as Bt,s as wn,n as Pl,t as ti,i as Od,f as yd}from"./kDtaAWAK.js";import{b as bd}from"./DochbgGJ.js";import{p as Be,a as xd,s as Sd,i as Ql}from"./Cun6jNAp.js";import{t as kd}from"./C8nIl9By.js";import{B as Al,s as vn}from"./Cvcp5xHB.js";import{M as wd}from"./C6jYEeWP.js";function vd(n,e,t){var i=dd(n,e);i&&i.set&&(n[e]=t,pd(()=>{n[e]=null}))}let qr=[],Hh=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=Hh[i])e=i+1;else return!0;if(e==t)return!1}}function Ml(n){return n>=127462&&n<=127487}const Rl=8205;function Cd(n,e,t=!0,i=!0){return(t?jh:Pd)(n,e,i)}function jh(n,e,t){if(e==n.length)return e;e&&Gh(n.charCodeAt(e))&&Zh(n.charCodeAt(e-1))&&e--;let i=Js(n,e);for(e+=Dl(i);e=0&&Ml(Js(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Pd(n,e,t){for(;e>0;){let i=jh(n,e-2,t);if(i=56320&&n<57344}function Zh(n){return n>=55296&&n<56320}function Dl(n){return n<65536?1:2}class V{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=pi(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ye.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=pi(this,e,t);let i=[];return this.decompose(e,t,i,0),Ye.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Vi(this),r=new Vi(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Vi(this,e)}iterRange(e,t=this.length){return new Yh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Kh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?V.empty:e.length<=32?new J(e):Ye.from(J.split(e,[]))}}class J extends V{constructor(e,t=Qd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Ad(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new J(El(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Zn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new J(l,o.length+r.length));else{let a=l.length>>1;i.push(new J(l.slice(0,a)),new J(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof J))return super.replace(e,t,i);[e,t]=pi(this,e,t);let s=Zn(this.text,Zn(i.text,El(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new J(s,r):Ye.from(J.split(s,[]),r)}sliceString(e,t=this.length,i=` +import{f as Vh,a as St,t as Cl,s as kn,b as $o,c as ud}from"./ZGz3X54u.js";import{i as Nh}from"./CY7Wcm-1.js";import{ao as dd,am as pd,p as Fh,v as Xh,o as md,q as gd,g as j,m as zi,l as Wt,d as Ii,h as zt,b as _h,a as Uh,c as $t,r as Bt,s as wn,n as Pl,t as ti,i as Od,f as yd}from"./kDtaAWAK.js";import{b as bd}from"./DochbgGJ.js";import{p as Be,a as xd,s as Sd,i as Ql}from"./Cun6jNAp.js";import{t as kd}from"./C8nIl9By.js";import{B as Al,s as vn}from"./CYK-UalN.js";import{M as wd}from"./CVBpH3Sf.js";function vd(n,e,t){var i=dd(n,e);i&&i.set&&(n[e]=t,pd(()=>{n[e]=null}))}let qr=[],Hh=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=Hh[i])e=i+1;else return!0;if(e==t)return!1}}function Ml(n){return n>=127462&&n<=127487}const Rl=8205;function Cd(n,e,t=!0,i=!0){return(t?jh:Pd)(n,e,i)}function jh(n,e,t){if(e==n.length)return e;e&&Gh(n.charCodeAt(e))&&Zh(n.charCodeAt(e-1))&&e--;let i=Js(n,e);for(e+=Dl(i);e=0&&Ml(Js(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Pd(n,e,t){for(;e>0;){let i=jh(n,e-2,t);if(i=56320&&n<57344}function Zh(n){return n>=55296&&n<56320}function Dl(n){return n<65536?1:2}class V{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=pi(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ye.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=pi(this,e,t);let i=[];return this.decompose(e,t,i,0),Ye.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Vi(this),r=new Vi(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Vi(this,e)}iterRange(e,t=this.length){return new Yh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Kh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?V.empty:e.length<=32?new J(e):Ye.from(J.split(e,[]))}}class J extends V{constructor(e,t=Qd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Ad(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new J(El(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Zn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new J(l,o.length+r.length));else{let a=l.length>>1;i.push(new J(l.slice(0,a)),new J(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof J))return super.replace(e,t,i);[e,t]=pi(this,e,t);let s=Zn(this.text,Zn(i.text,El(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new J(s,r):Ye.from(J.split(s,[]),r)}sliceString(e,t=this.length,i=` `){[e,t]=pi(this,e,t);let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new J(i,s)),i=[],s=-1);return s>-1&&t.push(new J(i,s)),t}}class Ye extends V{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=pi(this,e,t),i.lines=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new Ye(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` `){[e,t]=pi(this,e,t);let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ye))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new J(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Ye)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof J&&a&&(p=c[c.length-1])instanceof J&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new J(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Ye.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ye(l,t)}}V.empty=new J([""],0);function Qd(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Zn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof J?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof J?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(s instanceof J){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof J?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Yh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Vi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Kh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},Vi.prototype[Symbol.iterator]=Yh.prototype[Symbol.iterator]=Kh.prototype[Symbol.iterator]=function(){return this});class Ad{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function pi(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Oe(n,e,t=!0,i=!0){return Cd(n,e,t,i)}function Md(n){return n>=56320&&n<57344}function Rd(n){return n>=55296&&n<56320}function Ce(n,e){let t=n.charCodeAt(e);if(!Rd(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Md(i)?(t-55296<<10)+(i-56320)+65536:t}function Bo(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Ke(n){return n<65536?1:2}const $r=/\r\n?|\n/;var ge=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(ge||(ge={}));class st{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=ge.Simple&&h>=e&&(i==ge.TrackDel&&se||i==ge.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new st(e)}static create(e){return new st(e)}}class ae extends st{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Br(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return Lr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length0&&Tt(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?V.of(d.split(i||$r)):d:V.empty,m=p.length;if(f==u&&m==0)return;fo&&ye(s,f-o,-1),ye(s,u-f,m),Tt(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new ae(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:s>=0&&e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function Tt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function Lr(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Hi(n),l=new Hi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ye(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Hi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?V.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?V.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Nt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Nt(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new Nt(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>Nt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function ec(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Lo=0;class M{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=Lo++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new M(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Wo),!!e.static,e.enables)}of(e){return new Yn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Wo(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Yn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=Lo++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Wr(f,c)){let d=i(f);if(l?!ql(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let m=fs(u,p);if(this.dependencies.every(g=>g instanceof M?u.facet(g)===f.facet(g):g instanceof ue?u.field(g,!1)==f.field(g,!1):!0)||(l?ql(d=i(f),m,s):s(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}}function ql(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Tn).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let r=i.facet(Tn),o=s.facet(Tn),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,Tn.of({field:this,create:e})]}get extension(){return this}}const It={lowest:4,low:3,default:2,high:1,highest:0};function Ai(n){return e=>new tc(e,n)}const Et={highest:Ai(It.highest),high:Ai(It.high),default:Ai(It.default),low:Ai(It.low),lowest:Ai(It.lowest)};class tc{constructor(e,t){this.inner=e,this.prec=t}}class Bs{of(e){return new zr(this,e)}reconfigure(e){return Bs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class zr{constructor(e,t){this.compartment=e,this.inner=t}}class cs{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Ed(e,t,o))u instanceof ue?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,Wo(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(y=>g.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(g=>Dd(g,p,d))}}let f=h.map(u=>u(l));return new cs(e,o,f,l,a,r)}}function Ed(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof zr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof zr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof tc)r(o.inner,o.prec);else if(o instanceof ue)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Yn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,It.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,It.default),i.reduce((o,l)=>o.concat(l))}function Ni(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function fs(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const ic=M.define(),Ir=M.define({combine:n=>n.some(e=>e),static:!0}),nc=M.define({combine:n=>n.length?n[0]:void 0,static:!0}),sc=M.define(),rc=M.define(),oc=M.define(),lc=M.define({combine:n=>n.length?n[0]:!1});class bt{constructor(e,t){this.type=e,this.value=t}static define(){return new qd}}class qd{of(e){return new bt(this,e)}}class $d{constructor(e){this.map=e}of(e){return new L(this,e)}}class L{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new L(this.type,t)}is(e){return this.type==e}static define(e={}){return new $d(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}L.reconfigure=L.define();L.appendConfig=L.define();class oe{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&ec(i,t.newLength),r.some(l=>l.type==oe.time)||(this.annotations=r.concat(oe.time.of(Date.now())))}static create(e,t,i,s,r,o){return new oe(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(oe.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}oe.time=bt.define();oe.userEvent=bt.define();oe.addToHistory=bt.define();oe.remote=bt.define();function Bd(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof oe?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof oe?n=r[0]:n=hc(e,ai(r),!1)}return n}function Wd(n){let e=n.startState,t=e.facet(oc),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=ac(i,Vr(e,r,n.changes.newLength),!0))}return i==n?n:oe.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const zd=[];function ai(n){return n==null?zd:Array.isArray(n)?n:[n]}var Y=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(Y||(Y={}));const Id=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Nr;try{Nr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Vd(n){if(Nr)return Nr.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||Id.test(t)))return!0}return!1}function Nd(n){return e=>{if(!/\S/.test(e))return Y.Space;if(Vd(e))return Y.Word;for(let t=0;t-1)return Y.Word;return Y.Other}}class I{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(L.reconfigure)?(t=null,i=l.value):l.is(L.appendConfig)&&(t=null,i=ai(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=cs.resolve(i,s,this),r=new I(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Ir)?e.newSelection:e.newSelection.asSingle();new I(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=ai(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return I.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=cs.resolve(e.extensions||[],new Map),i=e.doc instanceof V?e.doc:V.of((e.doc||"").split(t.staticFacet(I.lineSeparator)||$r)),s=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return ec(s,i.length),t.staticFacet(Ir)||(s=s.asSingle()),new I(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(I.tabSize)}get lineBreak(){return this.facet(I.lineSeparator)||` diff --git a/webapp/assets/_app/immutable/chunks/vYI-AT_7.js b/webapp/assets/_app/immutable/chunks/B9RC0dq5.js similarity index 91% rename from webapp/assets/_app/immutable/chunks/vYI-AT_7.js rename to webapp/assets/_app/immutable/chunks/B9RC0dq5.js index 105d2739..9e51184b 100644 --- a/webapp/assets/_app/immutable/chunks/vYI-AT_7.js +++ b/webapp/assets/_app/immutable/chunks/B9RC0dq5.js @@ -1 +1 @@ -import{f as D,s as P,a as I}from"./ZGz3X54u.js";import{i as w}from"./CY7Wcm-1.js";import{p as S,c as s,r as n,s as u,u as l,h as i,t as N,a as A}from"./kDtaAWAK.js";import{d as f,c as F}from"./Cvcp5xHB.js";import{p as m}from"./Cun6jNAp.js";import{D as E,G}from"./Cfdue6T6.js";import{E as j}from"./CEJvqnOn.js";import{S as g}from"./BTeTCgJA.js";import{A as L}from"./Cs0pYghy.js";var M=D('');function Q(y,a){S(a,!1);let e=m(a,"instances",8),h=m(a,"entityType",8),v=m(a,"onDeleteInstance",8);const b=[{key:"name",title:"Name",cellComponent:j,cellProps:{entityType:"instance",nameField:"name"}},{key:"status",title:"Status",cellComponent:g,cellProps:{statusType:"instance",statusField:"status"}},{key:"runner_status",title:"Runner Status",cellComponent:g,cellProps:{statusType:"instance",statusField:"runner_status"}},{key:"created",title:"Created",cellComponent:G,cellProps:{field:"created_at",type:"date"}},{key:"actions",title:"Actions",align:"right",cellComponent:L,cellProps:{actions:[{type:"delete",label:"Delete",title:"Delete instance",ariaLabel:"Delete instance",action:"delete"}]}}],x={entityType:"instance",primaryText:{field:"name",isClickable:!0,href:"/instances/{name}"},secondaryText:{field:"provider_id"},badges:[{type:"status",field:"status"}],actions:[{type:"delete",handler:t=>d(t)}]};function d(t){v()(t)}function C(t){d(t.detail.item)}w();var r=M(),p=s(r),o=s(p),c=s(o),T=s(c);n(c);var _=u(c,2);n(o);var k=u(o,2);E(k,{get columns(){return b},get data(){return e()},loading:!1,error:"",searchTerm:"",showSearch:!1,showPagination:!1,currentPage:1,get perPage(){return i(e()),l(()=>e().length)},totalPages:1,get totalItems(){return i(e()),l(()=>e().length)},itemName:"instances",emptyTitle:"No instances running",get emptyMessage(){return`No instances running for this ${h()??""}.`},emptyIconType:"cog",get mobileCardConfig(){return x},$$events:{delete:C}}),n(p),n(r),N(t=>{P(T,`Instances (${i(e()),l(()=>e().length)??""})`),F(_,"href",t)},[()=>(i(f),l(()=>f("/instances")))]),I(y,r),A()}export{Q as I}; +import{f as D,s as P,a as I}from"./ZGz3X54u.js";import{i as w}from"./CY7Wcm-1.js";import{p as S,c as s,r as n,s as u,u as l,h as i,t as N,a as A}from"./kDtaAWAK.js";import{d as f,c as F}from"./CYK-UalN.js";import{p as m}from"./Cun6jNAp.js";import{D as E,G}from"./BKeluGSY.js";import{E as j}from"./Dd4NFVf9.js";import{S as g}from"./BStwtkX8.js";import{A as L}from"./rb89c4PS.js";var M=D('');function Q(y,a){S(a,!1);let e=m(a,"instances",8),h=m(a,"entityType",8),v=m(a,"onDeleteInstance",8);const b=[{key:"name",title:"Name",cellComponent:j,cellProps:{entityType:"instance",nameField:"name"}},{key:"status",title:"Status",cellComponent:g,cellProps:{statusType:"instance",statusField:"status"}},{key:"runner_status",title:"Runner Status",cellComponent:g,cellProps:{statusType:"instance",statusField:"runner_status"}},{key:"created",title:"Created",cellComponent:G,cellProps:{field:"created_at",type:"date"}},{key:"actions",title:"Actions",align:"right",cellComponent:L,cellProps:{actions:[{type:"delete",label:"Delete",title:"Delete instance",ariaLabel:"Delete instance",action:"delete"}]}}],x={entityType:"instance",primaryText:{field:"name",isClickable:!0,href:"/instances/{name}"},secondaryText:{field:"provider_id"},badges:[{type:"status",field:"status"}],actions:[{type:"delete",handler:t=>d(t)}]};function d(t){v()(t)}function C(t){d(t.detail.item)}w();var r=M(),p=s(r),o=s(p),c=s(o),T=s(c);n(c);var _=u(c,2);n(o);var k=u(o,2);E(k,{get columns(){return b},get data(){return e()},loading:!1,error:"",searchTerm:"",showSearch:!1,showPagination:!1,currentPage:1,get perPage(){return i(e()),l(()=>e().length)},totalPages:1,get totalItems(){return i(e()),l(()=>e().length)},itemName:"instances",emptyTitle:"No instances running",get emptyMessage(){return`No instances running for this ${h()??""}.`},emptyIconType:"cog",get mobileCardConfig(){return x},$$events:{delete:C}}),n(p),n(r),N(t=>{P(T,`Instances (${i(e()),l(()=>e().length)??""})`),F(_,"href",t)},[()=>(i(f),l(()=>f("/instances")))]),I(y,r),A()}export{Q as I}; diff --git a/webapp/assets/_app/immutable/chunks/Cfdue6T6.js b/webapp/assets/_app/immutable/chunks/BKeluGSY.js similarity index 99% rename from webapp/assets/_app/immutable/chunks/Cfdue6T6.js rename to webapp/assets/_app/immutable/chunks/BKeluGSY.js index 060e62e5..a08434cb 100644 --- a/webapp/assets/_app/immutable/chunks/Cfdue6T6.js +++ b/webapp/assets/_app/immutable/chunks/BKeluGSY.js @@ -1 +1 @@ -import{b as Me,a as n,f as I,s as F,t as ze,c as U,e as Je}from"./ZGz3X54u.js";import{i as Ce}from"./CY7Wcm-1.js";import{aa as _t,aV as yt,aU as bt,D as wt,F as Pt,G as Mt,H as Ct,I as jt,aj as Tt,B as rt,C as zt,K as St,J as It,X as Ht,p as he,l as Se,d as Ie,m as He,h as p,b as Ee,c as i,g as e,r as o,t as G,a as me,s as M,n as Ne,f as E,v as Be,k as Bt,i as $,u}from"./kDtaAWAK.js";import{p as s,i as P,b as at}from"./Cun6jNAp.js";import{e as ve,i as fe}from"./DdT9Vz5Q.js";import{h as Xe,s as Pe,B as we,r as Lt,c as Ae,b as Vt,d as Nt,f as nt,e as At}from"./Cvcp5xHB.js";import{c as ot}from"./Imj5EgK1.js";import{b as Et}from"./CYnNqrHp.js";import{A as Rt}from"./uzzFhb3G.js";import{B as Dt}from"./DovBLKjH.js";import{g as st,b as Ut}from"./DNHT2U_W.js";function it(N,r,v){rt&&zt();var a=N,t=Tt,x,k,h=null,H=_t()?yt:bt;function w(){x&&St(x),h!==null&&(h.lastChild.remove(),a.before(h),h=null),x=k}wt(()=>{if(H(t,t=r())){var _=a,L=jt();L&&(h=document.createDocumentFragment(),h.append(_=Pt())),k=Mt(()=>v(_)),L?Ct.add_callback(w):w()}}),rt&&(a=It)}function Te(N,r){var v=N.$$events?.[r.type],a=Ht(v)?v.slice():v==null?[]:[v];for(var t of a)t.call(this,r)}var Ft=Me('');function Gt(N,r){he(r,!1);const v=He();let a=s(r,"name",8),t=s(r,"class",8,"h-5 w-5");const x={plus:'',edit:'',delete:'',view:'',close:'',check:'',x:'',"chevron-left":'',"chevron-right":'',"chevron-down":'',"chevron-up":'',search:'',refresh:'',menu:'',settings:'',"check-circle":'',"x-circle":'',"exclamation-circle":'',"information-circle":'',loading:'',sun:'',moon:'',document:'',folder:'',"git-branch":''};Se(()=>p(a()),()=>{Ie(v,x[a()]||"")}),Ee();var k=Ft(),h=i(k);Xe(h,()=>e(v),!0),o(k),G(()=>Pe(k,0,`${t()}`)),n(N,k),me()}var qt=I('

');function Ot(N,r){let v=s(r,"message",8,"Loading...");var a=qt(),t=M(i(a),2),x=i(t,!0);o(t),o(a),G(()=>F(x,v())),n(N,a)}var Kt=I('
'),Jt=I('

');function Xt(N,r){let v=s(r,"title",8,"Error"),a=s(r,"message",8),t=s(r,"showRetry",8,!1),x=s(r,"onRetry",8,void 0);var k=Jt(),h=i(k),H=i(h),w=M(i(H),2),_=i(w),L=i(_,!0);o(_);var q=M(_,2),R=i(q,!0);o(q);var B=M(q,2);{var K=J=>{var j=Kt(),b=i(j);we(b,{variant:"secondary",size:"sm",icon:"",class:"text-red-700 dark:text-red-200 bg-red-100 dark:bg-red-800 hover:bg-red-200 dark:hover:bg-red-700 focus:outline-none focus:bg-red-200 dark:focus:bg-red-700",$$events:{click(...A){x()?.apply(this,A)}},children:(A,T)=>{Ne();var Q=ze("Retry");n(A,Q)},$$slots:{default:!0}}),o(j),n(J,j)};P(B,J=>{t()&&x()&&J(K)})}o(w),o(H),o(h),o(k),G(()=>{F(L,v()),F(R,a())}),n(N,k)}var Zt=Me(''),Qt=Me(''),Wt=Me(''),Yt=Me(''),$t=Me(''),er=Me(''),tr=I('

');function rr(N,r){let v=s(r,"title",8),a=s(r,"message",8),t=s(r,"iconType",8,"document");var x=tr(),k=i(x);{var h=R=>{var B=Zt();n(R,B)},H=R=>{var B=U(),K=E(B);{var J=b=>{var A=Qt();n(b,A)},j=b=>{var A=U(),T=E(A);{var Q=d=>{var c=Wt();n(d,c)},l=d=>{var c=U(),g=E(c);{var D=f=>{var V=Yt();n(f,V)},W=f=>{var V=U(),z=E(V);{var C=S=>{var Z=$t();n(S,Z)},y=S=>{var Z=U(),ee=E(Z);{var te=oe=>{var ce=er();n(oe,ce)};P(ee,oe=>{t()==="settings"&&oe(te)},!0)}n(S,Z)};P(z,S=>{t()==="key"?S(C):S(y,!1)},!0)}n(f,V)};P(g,f=>{t()==="cog"?f(D):f(W,!1)},!0)}n(d,c)};P(T,d=>{t()==="users"?d(Q):d(l,!1)},!0)}n(b,A)};P(K,b=>{t()==="building"?b(J):b(j,!1)},!0)}n(R,B)};P(k,R=>{t()==="document"?R(h):R(H,!1)})}var w=M(k,2),_=i(w,!0);o(w);var L=M(w,2),q=i(L,!0);o(L),o(x),G(()=>{F(_,v()),F(q,a())}),n(N,x)}var ar=I('
');function lt(N,r){he(r,!1);let v=s(r,"value",12,""),a=s(r,"placeholder",8,"Search..."),t=s(r,"disabled",8,!1);const x=Be();function k(){x("input",v())}Ce();var h=ar(),H=i(h),w=i(H);Gt(w,{name:"search",class:"h-5 w-5 text-gray-400"}),o(H);var _=M(H,2);Lt(_),o(h),G(()=>{Ae(_,"placeholder",a()),_.disabled=t()}),Et(_,v),Je("input",_,k),Je("keydown",_,function(L){Te.call(this,r,L)}),n(N,h),me()}var nr=I(""),or=I('
'),sr=I('
');function ir(N,r){he(r,!1);let v=s(r,"searchTerm",12,""),a=s(r,"perPage",12,25),t=s(r,"placeholder",8,"Search..."),x=s(r,"showPerPageSelector",8,!0),k=s(r,"perPageOptions",24,()=>[25,50,100]);const h=Be();function H(){h("search",{term:v()})}function w(){h("perPageChange",{perPage:a()})}Ce();var _=sr(),L=i(_),q=i(L),R=i(q),B=M(i(R),2);lt(B,{get placeholder(){return t()},get value(){return v()},set value(j){v(j)},$$events:{input:H},$$legacy:!0}),o(R),o(q);var K=M(q,2);{var J=j=>{var b=or(),A=i(b),T=M(i(A),2);G(()=>{a(),Bt(()=>{k()})}),ve(T,5,k,fe,(Q,l)=>{var d=nr(),c=i(d,!0);o(d);var g={};G(()=>{F(c,e(l)),g!==(g=e(l))&&(d.value=(d.__value=e(l))??"")}),n(Q,d)}),o(T),o(A),o(b),Vt(T,a),Je("change",T,w),n(j,b)};P(K,j=>{x()&&j(J)})}o(L),o(_),n(N,_),me()}var lr=I('

'),dr=I('
');function vr(N,r){he(r,!1);let v=s(r,"value",12,""),a=s(r,"placeholder",8,"Search..."),t=s(r,"disabled",8,!1),x=s(r,"helpText",8,""),k=s(r,"showButton",8,!0);const h=Be();function H(){h("search",v())}function w(){h("search",v())}function _(T){T.key==="Enter"&&H()}Ce();var L=dr(),q=i(L),R=i(q),B=i(R),K=i(B);lt(K,{get placeholder(){return a()},get disabled(){return t()},get value(){return v()},set value(T){v(T)},$$events:{input:w,keydown:_},$$legacy:!0}),o(B);var J=M(B,2);{var j=T=>{we(T,{variant:"secondary",get disabled(){return t()},$$events:{click:H},children:(Q,l)=>{Ne();var d=ze("Search");n(Q,d)},$$slots:{default:!0}})};P(J,T=>{k()&&T(j)})}o(R);var b=M(R,2);{var A=T=>{var Q=lr(),l=i(Q,!0);o(Q),G(()=>F(l,x())),n(T,Q)};P(b,T=>{x()&&T(A)})}o(q),o(L),n(N,L),me()}var cr=I('Showing to of ',1),ur=I('
');function gr(N,r){he(r,!1);const v=He(),a=He();let t=s(r,"currentPage",8,1),x=s(r,"totalPages",8,1),k=s(r,"perPage",8,25),h=s(r,"totalItems",8,0),H=s(r,"itemName",8,"results");const w=Be();function _(B){B>=1&&B<=x()&&B!==t()&&w("pageChange",{page:B})}Se(()=>(p(h()),p(t()),p(k())),()=>{Ie(v,h()===0?0:(t()-1)*k()+1)}),Se(()=>(p(t()),p(k()),p(h())),()=>{Ie(a,Math.min(t()*k(),h()))}),Ee(),Ce();var L=U(),q=E(L);{var R=B=>{var K=ur(),J=i(K),j=i(J);{let z=$(()=>t()===1);we(j,{variant:"secondary",get disabled(){return e(z)},$$events:{click:()=>_(t()-1)},children:(C,y)=>{Ne();var S=ze("Previous");n(C,S)},$$slots:{default:!0}})}var b=M(j,2);{let z=$(()=>t()===x());we(b,{variant:"secondary",get disabled(){return e(z)},class:"ml-3",$$events:{click:()=>_(t()+1)},children:(C,y)=>{Ne();var S=ze("Next");n(C,S)},$$slots:{default:!0}})}o(J);var A=M(J,2),T=i(A),Q=i(T),l=i(Q);{var d=z=>{var C=ze();G(()=>F(C,`No ${H()??""}`)),n(z,C)},c=z=>{var C=cr(),y=M(E(C)),S=i(y,!0);o(y);var Z=M(y,2),ee=i(Z,!0);o(Z);var te=M(Z,2),oe=i(te,!0);o(te);var ce=M(te);G(()=>{F(S,e(v)),F(ee,e(a)),F(oe,h()),F(ce,` ${H()??""}`)}),n(z,C)};P(l,z=>{h()===0?z(d):z(c,!1)})}o(Q),o(T);var g=M(T,2),D=i(g),W=i(D);{let z=$(()=>t()===1);we(W,{variant:"secondary",size:"sm",get disabled(){return e(z)},class:"rounded-r-none","aria-label":"Previous page",icon:"",$$events:{click:()=>_(t()-1)}})}var f=M(W,2);ve(f,1,()=>(p(x()),u(()=>Array(x()))),fe,(z,C,y)=>{const S=$(()=>y+1);{let Z=$(()=>e(S)===t()?"primary":"secondary");we(z,{get variant(){return e(Z)},size:"sm",class:"rounded-none border-l-0 first:border-l first:rounded-l-md",$$events:{click:()=>_(e(S))},children:(ee,te)=>{Ne();var oe=ze();G(()=>F(oe,e(S))),n(ee,oe)},$$slots:{default:!0}})}});var V=M(f,2);{let z=$(()=>t()===x());we(V,{variant:"secondary",size:"sm",get disabled(){return e(z)},class:"rounded-l-none","aria-label":"Next page",icon:"",$$events:{click:()=>_(t()+1)}})}o(D),o(g),o(A),o(K),n(B,K)};P(q,B=>{x()>1&&B(R)})}n(N,L),me()}var fr=I('

'),hr=I('

'),mr=I('

'),pr=I('

'),xr=I('
'),kr=I('
'),_r=I('
'),yr=I(" "),br=I('
'),wr=I('
');function Pr(N,r){he(r,!1);const v=Be();let a=s(r,"item",8),t=s(r,"config",8);function x(){if(!a())return"Unknown";const{field:l,useId:d,showOwner:c}=t().primaryText,g=a()[l];return d&&g?`${g.slice(0,8)}...`:c&&a().owner&&a().name?`${a().owner}/${a().name}`:g||"Unknown"}function k(){if(!t().secondaryText)return"";const{field:l,computedValue:d}=t().secondaryText;return d!==void 0?typeof d=="function"?d(a()):d:a()?.[l]||""}function h(){if(!t().primaryText.href||!a())return"#";let l=t().primaryText.href;return l=l.replace("{id}",a().id||""),l=l.replace("{name}",encodeURIComponent(a().name||"")),Nt(l)}function H(l){if(!a())return;const d=t().actions?.find(c=>c.type===l);d&&d.handler(a()),l==="edit"?v("edit",{item:a()}):l==="delete"?v("delete",{item:a()}):l==="clone"?v("clone",{item:a()}):v("action",{type:l,item:a()})}function w(l){switch(l.type){case"status":if(t().entityType==="instance"){const c=a()?.[l.field]||"unknown";let g="neutral",D=c.charAt(0).toUpperCase()+c.slice(1);return l.field==="status"?g=c==="running"?"success":c==="pending"||c==="creating"?"info":c==="failed"||c==="error"?"error":"neutral":l.field==="runner_status"&&(g=c==="idle"?"info":c==="active"||c==="running"?"success":c==="failed"||c==="error"?"error":"neutral"),{variant:g,text:D}}return{variant:"neutral",text:a()?.[l.field]||"Unknown"};case"forge":return{variant:"neutral",text:a()?.[l.field]||"unknown"};case"auth":const d=a()?.[l.field]||"pat";return{variant:d==="pat"?"success":"info",text:d.toUpperCase()};case"custom":if(typeof l.value=="function"){const c=l.value(a());return{variant:c?.variant||"neutral",text:c?.text||""}}return{variant:l.value?.variant||"neutral",text:l.value?.text||""};default:return{variant:"neutral",text:""}}}Ce();var _=wr(),L=i(_),q=i(L);{var R=l=>{var d=hr(),c=i(d),g=i(c,!0);o(c);var D=M(c,2);{var W=f=>{var V=fr(),z=i(V,!0);o(V),G(C=>F(z,C),[()=>u(k)]),n(f,V)};P(D,f=>{p(t()),u(()=>t().secondaryText)&&f(W)})}o(d),G((f,V)=>{Ae(d,"href",f),Pe(c,1,`text-sm font-medium text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 truncate${p(t()),u(()=>t().primaryText.isMonospace?" font-mono":"")??""}`),F(g,V)},[()=>u(h),()=>u(x)]),n(l,d)},B=l=>{var d=pr(),c=i(d),g=i(c,!0);o(c);var D=M(c,2);{var W=f=>{var V=mr(),z=i(V,!0);o(V),G(C=>F(z,C),[()=>u(k)]),n(f,V)};P(D,f=>{p(t()),u(()=>t().secondaryText)&&f(W)})}o(d),G(f=>F(g,f),[()=>u(x)]),n(l,d)};P(q,l=>{p(t()),u(()=>t().primaryText.isClickable)?l(R):l(B,!1)})}var K=M(q,2);{var J=l=>{var d=_r(),c=i(d);{var g=f=>{var V=U(),z=E(V);ve(z,1,()=>(p(t()),u(()=>t().customInfo)),fe,(C,y)=>{const S=$(()=>(e(y),p(a()),u(()=>typeof e(y).icon=="function"?e(y).icon(a()):e(y).icon))),Z=$(()=>(e(y),p(a()),u(()=>typeof e(y).text=="function"?e(y).text(a()):e(y).text)));var ee=xr(),te=i(ee);{var oe=pe=>{var Le=U(),De=E(Le);Xe(De,()=>e(S)),n(pe,Le)};P(te,pe=>{e(S)&&pe(oe)})}var ce=M(te,2),Re=i(ce,!0);o(ce),o(ee),G(()=>F(Re,e(Z))),n(C,ee)}),n(f,V)};P(c,f=>{p(t()),u(()=>t().customInfo)&&f(g)})}var D=M(c,2);{var W=f=>{var V=U(),z=E(V);ve(z,1,()=>(p(t()),u(()=>t().badges.filter(C=>C.type==="forge"))),fe,(C,y)=>{var S=kr(),Z=i(S);Xe(Z,()=>(p(st),e(y),p(a()),u(()=>st(e(y).field?a()?.[e(y).field]||"unknown":a()?.endpoint?.endpoint_type||"unknown"))));var ee=M(Z,2),te=i(ee,!0);o(ee),o(S),G(()=>F(te,(p(a()),u(()=>a()?.endpoint?.name||"Unknown")))),n(C,S)}),n(f,V)};P(D,f=>{p(t()),u(()=>t().badges)&&f(W)})}o(d),n(l,d)};P(K,l=>{p(t()),u(()=>t().customInfo||t().badges?.some(d=>d.type==="forge"))&&l(J)})}o(L);var j=M(L,2),b=i(j);{var A=l=>{var d=U(),c=E(d);ve(c,1,()=>(p(t()),u(()=>t().badges.filter(g=>g.type!=="forge"))),fe,(g,D)=>{var W=U(),f=E(W);{var V=C=>{const y=$(()=>(e(D),u(()=>w(e(D)))));var S=yr(),Z=i(S,!0);o(S),G(()=>{Pe(S,1,`inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ring-1 ring-inset ${p(e(y)),u(()=>e(y).variant==="success"?"bg-green-50 text-green-700 ring-green-600/20 dark:bg-green-900/50 dark:text-green-300 dark:ring-green-400/20":e(y).variant==="info"?"bg-blue-50 text-blue-700 ring-blue-600/20 dark:bg-blue-900/50 dark:text-blue-300 dark:ring-blue-400/20":e(y).variant==="error"?"bg-red-50 text-red-700 ring-red-600/20 dark:bg-red-900/50 dark:text-red-300 dark:ring-red-400/20":"bg-gray-50 text-gray-700 ring-gray-600/20 dark:bg-gray-900/50 dark:text-gray-300 dark:ring-gray-400/20")??""}`),F(Z,(p(e(y)),u(()=>e(y).text)))}),n(C,S)},z=C=>{const y=$(()=>(e(D),u(()=>w(e(D)))));Dt(C,{get variant(){return p(e(y)),u(()=>e(y).variant)},get text(){return p(e(y)),u(()=>e(y).text)}})};P(f,C=>{e(D),u(()=>e(D).type==="status")?C(V):C(z,!1)})}n(g,W)}),n(l,d)};P(b,l=>{p(t()),u(()=>t().badges)&&l(A)})}var T=M(b,2);{var Q=l=>{var d=br();ve(d,5,()=>(p(t()),u(()=>t().actions)),fe,(c,g)=>{{let D=$(()=>(e(g),u(()=>e(g).type==="clone"?"copy":e(g).type))),W=$(()=>(e(g),p(t()),u(()=>e(g).type==="edit"?`Edit ${t().entityType}`:e(g).type==="delete"?`Delete ${t().entityType}`:e(g).type==="clone"?`Clone ${t().entityType}`:e(g).type))),f=$(()=>(e(g),p(t()),u(()=>e(g).type==="edit"?`Edit ${t().entityType}`:e(g).type==="delete"?`Delete ${t().entityType}`:e(g).type==="clone"?`Clone ${t().entityType}`:e(g).type)));Rt(c,{get action(){return e(D)},size:"sm",get title(){return e(W)},get ariaLabel(){return e(f)},$$events:{click:()=>H(e(g).type)}})}}),o(d),n(l,d)};P(T,l=>{p(t()),u(()=>t().actions)&&l(Q)})}o(j),o(_),n(N,_),me()}var Mr=I('
'),Cr=I('
'),jr=I("
"),Tr=I("
"),zr=I(' ',1),Sr=I('
');function qr(N,r){he(r,!1);const v=He();let a=s(r,"columns",24,()=>[]),t=s(r,"data",24,()=>[]),x=s(r,"loading",8,!1),k=s(r,"error",8,""),h=s(r,"totalItems",8,0),H=s(r,"itemName",8,"results"),w=s(r,"searchTerm",12,""),_=s(r,"searchPlaceholder",8,"Search..."),L=s(r,"showSearch",8,!0),q=s(r,"searchType",8,"client"),R=s(r,"searchHelpText",8,""),B=s(r,"currentPage",8,1),K=s(r,"perPage",12,25),J=s(r,"totalPages",8,1),j=s(r,"showPagination",8,!0),b=s(r,"showPerPageSelector",8,!0),A=s(r,"paginationComponent",8,null),T=s(r,"paginationProps",24,()=>({})),Q=s(r,"emptyTitle",8,"No items found"),l=s(r,"emptyMessage",8,""),d=s(r,"emptyIconType",8,"document"),c=s(r,"errorTitle",8,"Error loading data"),g=s(r,"showRetry",8,!1),D=s(r,"showMobileCards",8,!0),W=s(r,"mobileCardConfig",8,null);const f=Be();function V(m){const re=typeof m.detail=="string"?m.detail:m.detail.term;f("search",{term:re})}function z(m){f("pageChange",m.detail)}function C(m){f("perPageChange",m.detail)}function y(){f("retry")}function S(m){f("edit",m.detail)}function Z(m){f("delete",m.detail)}function ee(m){f("clone",m.detail)}function te(m){f("shell",m.detail)}function oe(m){f("action",m.detail)}function ce(m){const re="px-6 py-4 text-sm",xe=m.align==="right"?"text-right":m.align==="center"?"text-center":"text-left",ke=m.key==="actions"?"font-medium":"text-gray-900 dark:text-white",_e=m.flexible?"min-w-0":"";return`${re} ${xe} ${ke} ${_e}`.trim()}function Re(){return a().map(m=>m.flexible?`${m.flexRatio||1}fr`:"auto").join(" ")}Se(()=>(p(l()),p(w()),p(H())),()=>{Ie(v,l()||(w()?`No items found matching "${w()}"`:`No ${H()} found`))}),Ee(),Ce();var pe=Sr(),Le=i(pe);{var De=m=>{var re=U(),xe=E(re);{var ke=X=>{vr(X,{get placeholder(){return _()},get helpText(){return R()},showButton:!1,get value(){return w()},set value(ae){w(ae)},$$events:{search:V},$$legacy:!0})},_e=X=>{ir(X,{get placeholder(){return _()},get showPerPageSelector(){return b()},get searchTerm(){return w()},set searchTerm(ae){w(ae)},get perPage(){return K()},set perPage(ae){K(ae)},$$events:{search:V,perPageChange:C},$$legacy:!0})};P(xe,X=>{q()==="backend"?X(ke):X(_e,!1)})}n(m,re)};P(Le,m=>{L()&&m(De)})}var Ze=M(Le,2),Qe=i(Ze);{var dt=m=>{Ot(m,{get message(){return`Loading ${H()??""}...`}})},vt=m=>{var re=U(),xe=E(re);{var ke=X=>{{let ae=$(()=>g()?y:void 0);Xt(X,{get title(){return c()},get message(){return k()},get showRetry(){return g()},get onRetry(){return e(ae)}})}},_e=X=>{var ae=U(),Ue=E(ae);{var Fe=ue=>{rr(ue,{get title(){return Q()},get message(){return e(v)},get iconType(){return d()}})},Ge=ue=>{var We=zr(),Ye=E(We);{var gt=se=>{var O=Cr();ve(O,7,t,(le,ne)=>le.id||le.name||ne,(le,ne,Oe)=>{var Ve=Mr(),Y=i(Ve);{var je=ge=>{var ye=U(),ie=E(ye);it(ie,()=>(e(ne),u(()=>`${e(ne).id||e(ne).name}-${e(ne).updated_at}-mobile`)),be=>{Pr(be,{get item(){return e(ne)},get config(){return W()},$$events:{edit(de){Te.call(this,r,de)},delete(de){Te.call(this,r,de)},clone(de){Te.call(this,r,de)},action(de){Te.call(this,r,de)}}})}),n(ge,ye)},Ke=ge=>{var ye=U(),ie=E(ye);nt(ie,r,"mobile-card",{get item(){return e(ne)},get index(){return e(Oe)}}),n(ge,ye)};P(Y,ge=>{W()?ge(je):ge(Ke,!1)})}o(Ve),n(le,Ve)}),o(O),n(se,O)};P(Ye,se=>{D()&&se(gt)})}var $e=M(Ye,2),qe=i($e),et=i(qe);ve(et,1,a,fe,(se,O)=>{var le=jr(),ne=i(le,!0);o(le),G(()=>{Pe(le,1,`px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600 ${e(O),u(()=>e(O).align==="right"?"text-right":e(O).align==="center"?"text-center":"text-left")??""}`),F(ne,(e(O),u(()=>e(O).title)))}),n(se,le)});var ft=M(et,2);ve(ft,3,t,(se,O)=>se.id||se.name||O,(se,O,le)=>{var ne=U(),Oe=E(ne);ve(Oe,1,a,fe,(Ve,Y)=>{var je=Tr(),Ke=i(je);{var ge=ie=>{var be=U(),de=E(be);it(de,()=>(e(O),e(Y),u(()=>`${e(O).id||e(O).name}-${e(O).updated_at}-${e(Y).key}`)),ht=>{var tt=U(),mt=E(tt);{let pt=$(()=>typeof e(Y).cellProps=="function"?e(Y).cellProps(e(O)):e(Y).cellProps);ot(mt,()=>e(Y).cellComponent,(xt,kt)=>{kt(xt,at({get item(){return e(O)}},()=>e(pt),{$$events:{edit:S,delete:Z,clone:ee,shell:te,action:oe}}))})}n(ht,tt)}),n(ie,be)},ye=ie=>{var be=U(),de=E(be);nt(de,r,"cell",{get item(){return e(O)},get column(){return e(Y)},get index(){return e(le)},get value(){return e(O),e(Y),u(()=>e(O)[e(Y).key])}}),n(ie,be)};P(Ke,ie=>{e(Y),u(()=>e(Y).cellComponent)?ie(ge):ie(ye,!1)})}o(je),G(ie=>Pe(je,1,`${ie??""} border-b border-gray-200 dark:border-gray-700`),[()=>(e(Y),u(()=>ce(e(Y))))]),n(Ve,je)}),n(se,ne)}),o(qe),o($e),G(se=>At(qe,`grid-template-columns: ${se??""}`),[()=>u(Re)]),n(ue,We)};P(Ue,ue=>{p(t()),u(()=>t().length===0)?ue(Fe):ue(Ge,!1)},!0)}n(X,ae)};P(xe,X=>{k()?X(ke):X(_e,!1)},!0)}n(m,re)};P(Qe,m=>{x()?m(dt):m(vt,!1)})}var ct=M(Qe,2);{var ut=m=>{var re=U(),xe=E(re);{var ke=X=>{var ae=U(),Ue=E(ae);ot(Ue,A,(Fe,Ge)=>{Ge(Fe,at({get currentPage(){return B()},get totalPages(){return J()},get totalItems(){return h()},get pageSize(){return K()},get loading(){return x()},get itemName(){return H()}},T,{$$events:{pageChange:z,pageSizeChange:C,prefetch(ue){Te.call(this,r,ue)}}}))}),n(X,ae)},_e=X=>{gr(X,{get currentPage(){return B()},get totalPages(){return J()},get perPage(){return K()},get totalItems(){return h()},get itemName(){return H()},$$events:{pageChange:z}})};P(xe,X=>{A()?X(ke):X(_e,!1)})}n(m,re)};P(ct,m=>{p(j()),p(x()),p(k()),p(t()),u(()=>j()&&!x()&&!k()&&t().length>0)&&m(ut)})}o(Ze),o(pe),n(N,pe),me()}var Ir=I(" "),Hr=I(" ");function Or(N,r){he(r,!1);const v=He(),a=He();let t=s(r,"item",8),x=s(r,"field",8,void 0),k=s(r,"getValue",8,void 0),h=s(r,"type",8,"text"),H=s(r,"truncateLength",8,50),w=s(r,"showTitle",8,!1);function _(){return t()?k()?k()(t()):x()&&x().split(".").reduce((j,b)=>j?.[b],t())||"":""}function L(){return h()==="date"?Ut(e(v)):h()==="truncated"&&e(v).length>H()?`${e(v).slice(0,H())}...`:e(v)}function q(){switch(h()){case"code":return"inline-block max-w-full truncate bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded text-xs font-mono";case"description":return"block w-full truncate text-sm text-gray-500 dark:text-gray-300";case"date":return"block w-full truncate text-sm text-gray-900 dark:text-white font-mono";default:return"block w-full truncate text-sm text-gray-900 dark:text-white"}}Se(()=>{},()=>{Ie(v,_())}),Se(()=>{},()=>{Ie(a,L())}),Ee(),Ce();var R=U(),B=E(R);{var K=j=>{var b=Ir(),A=i(b,!0);o(b),G(T=>{Pe(b,1,`${T??""} ${w()?"cursor-default":""}`),Ae(b,"title",w()?e(v):""),F(A,e(a))},[()=>u(q)]),n(j,b)},J=j=>{var b=Hr(),A=i(b,!0);o(b),G(T=>{Pe(b,1,`${T??""} ${w()?"cursor-default":""}`),Ae(b,"title",w()?e(v):""),F(A,e(a))},[()=>u(q)]),n(j,b)};P(B,j=>{h()==="code"?j(K):j(J,!1)})}n(N,R),me()}export{qr as D,Or as G,Ot as L,it as k}; +import{b as Me,a as n,f as I,s as F,t as ze,c as U,e as Je}from"./ZGz3X54u.js";import{i as Ce}from"./CY7Wcm-1.js";import{aa as _t,aV as yt,aU as bt,D as wt,F as Pt,G as Mt,H as Ct,I as jt,aj as Tt,B as rt,C as zt,K as St,J as It,X as Ht,p as he,l as Se,d as Ie,m as He,h as p,b as Ee,c as i,g as e,r as o,t as G,a as me,s as M,n as Ne,f as E,v as Be,k as Bt,i as $,u}from"./kDtaAWAK.js";import{p as s,i as P,b as at}from"./Cun6jNAp.js";import{e as ve,i as fe}from"./DdT9Vz5Q.js";import{h as Xe,s as Pe,B as we,r as Lt,c as Ae,b as Vt,d as Nt,f as nt,e as At}from"./CYK-UalN.js";import{c as ot}from"./Imj5EgK1.js";import{b as Et}from"./CYnNqrHp.js";import{A as Rt}from"./DUWZCTMr.js";import{B as Dt}from"./DbE0zTOa.js";import{g as st,b as Ut}from"./ZelbukuJ.js";function it(N,r,v){rt&&zt();var a=N,t=Tt,x,k,h=null,H=_t()?yt:bt;function w(){x&&St(x),h!==null&&(h.lastChild.remove(),a.before(h),h=null),x=k}wt(()=>{if(H(t,t=r())){var _=a,L=jt();L&&(h=document.createDocumentFragment(),h.append(_=Pt())),k=Mt(()=>v(_)),L?Ct.add_callback(w):w()}}),rt&&(a=It)}function Te(N,r){var v=N.$$events?.[r.type],a=Ht(v)?v.slice():v==null?[]:[v];for(var t of a)t.call(this,r)}var Ft=Me('');function Gt(N,r){he(r,!1);const v=He();let a=s(r,"name",8),t=s(r,"class",8,"h-5 w-5");const x={plus:'',edit:'',delete:'',view:'',close:'',check:'',x:'',"chevron-left":'',"chevron-right":'',"chevron-down":'',"chevron-up":'',search:'',refresh:'',menu:'',settings:'',"check-circle":'',"x-circle":'',"exclamation-circle":'',"information-circle":'',loading:'',sun:'',moon:'',document:'',folder:'',"git-branch":''};Se(()=>p(a()),()=>{Ie(v,x[a()]||"")}),Ee();var k=Ft(),h=i(k);Xe(h,()=>e(v),!0),o(k),G(()=>Pe(k,0,`${t()}`)),n(N,k),me()}var qt=I('

');function Ot(N,r){let v=s(r,"message",8,"Loading...");var a=qt(),t=M(i(a),2),x=i(t,!0);o(t),o(a),G(()=>F(x,v())),n(N,a)}var Kt=I('
'),Jt=I('

');function Xt(N,r){let v=s(r,"title",8,"Error"),a=s(r,"message",8),t=s(r,"showRetry",8,!1),x=s(r,"onRetry",8,void 0);var k=Jt(),h=i(k),H=i(h),w=M(i(H),2),_=i(w),L=i(_,!0);o(_);var q=M(_,2),R=i(q,!0);o(q);var B=M(q,2);{var K=J=>{var j=Kt(),b=i(j);we(b,{variant:"secondary",size:"sm",icon:"",class:"text-red-700 dark:text-red-200 bg-red-100 dark:bg-red-800 hover:bg-red-200 dark:hover:bg-red-700 focus:outline-none focus:bg-red-200 dark:focus:bg-red-700",$$events:{click(...A){x()?.apply(this,A)}},children:(A,T)=>{Ne();var Q=ze("Retry");n(A,Q)},$$slots:{default:!0}}),o(j),n(J,j)};P(B,J=>{t()&&x()&&J(K)})}o(w),o(H),o(h),o(k),G(()=>{F(L,v()),F(R,a())}),n(N,k)}var Zt=Me(''),Qt=Me(''),Wt=Me(''),Yt=Me(''),$t=Me(''),er=Me(''),tr=I('

');function rr(N,r){let v=s(r,"title",8),a=s(r,"message",8),t=s(r,"iconType",8,"document");var x=tr(),k=i(x);{var h=R=>{var B=Zt();n(R,B)},H=R=>{var B=U(),K=E(B);{var J=b=>{var A=Qt();n(b,A)},j=b=>{var A=U(),T=E(A);{var Q=d=>{var c=Wt();n(d,c)},l=d=>{var c=U(),g=E(c);{var D=f=>{var V=Yt();n(f,V)},W=f=>{var V=U(),z=E(V);{var C=S=>{var Z=$t();n(S,Z)},y=S=>{var Z=U(),ee=E(Z);{var te=oe=>{var ce=er();n(oe,ce)};P(ee,oe=>{t()==="settings"&&oe(te)},!0)}n(S,Z)};P(z,S=>{t()==="key"?S(C):S(y,!1)},!0)}n(f,V)};P(g,f=>{t()==="cog"?f(D):f(W,!1)},!0)}n(d,c)};P(T,d=>{t()==="users"?d(Q):d(l,!1)},!0)}n(b,A)};P(K,b=>{t()==="building"?b(J):b(j,!1)},!0)}n(R,B)};P(k,R=>{t()==="document"?R(h):R(H,!1)})}var w=M(k,2),_=i(w,!0);o(w);var L=M(w,2),q=i(L,!0);o(L),o(x),G(()=>{F(_,v()),F(q,a())}),n(N,x)}var ar=I('
');function lt(N,r){he(r,!1);let v=s(r,"value",12,""),a=s(r,"placeholder",8,"Search..."),t=s(r,"disabled",8,!1);const x=Be();function k(){x("input",v())}Ce();var h=ar(),H=i(h),w=i(H);Gt(w,{name:"search",class:"h-5 w-5 text-gray-400"}),o(H);var _=M(H,2);Lt(_),o(h),G(()=>{Ae(_,"placeholder",a()),_.disabled=t()}),Et(_,v),Je("input",_,k),Je("keydown",_,function(L){Te.call(this,r,L)}),n(N,h),me()}var nr=I(""),or=I('
'),sr=I('
');function ir(N,r){he(r,!1);let v=s(r,"searchTerm",12,""),a=s(r,"perPage",12,25),t=s(r,"placeholder",8,"Search..."),x=s(r,"showPerPageSelector",8,!0),k=s(r,"perPageOptions",24,()=>[25,50,100]);const h=Be();function H(){h("search",{term:v()})}function w(){h("perPageChange",{perPage:a()})}Ce();var _=sr(),L=i(_),q=i(L),R=i(q),B=M(i(R),2);lt(B,{get placeholder(){return t()},get value(){return v()},set value(j){v(j)},$$events:{input:H},$$legacy:!0}),o(R),o(q);var K=M(q,2);{var J=j=>{var b=or(),A=i(b),T=M(i(A),2);G(()=>{a(),Bt(()=>{k()})}),ve(T,5,k,fe,(Q,l)=>{var d=nr(),c=i(d,!0);o(d);var g={};G(()=>{F(c,e(l)),g!==(g=e(l))&&(d.value=(d.__value=e(l))??"")}),n(Q,d)}),o(T),o(A),o(b),Vt(T,a),Je("change",T,w),n(j,b)};P(K,j=>{x()&&j(J)})}o(L),o(_),n(N,_),me()}var lr=I('

'),dr=I('
');function vr(N,r){he(r,!1);let v=s(r,"value",12,""),a=s(r,"placeholder",8,"Search..."),t=s(r,"disabled",8,!1),x=s(r,"helpText",8,""),k=s(r,"showButton",8,!0);const h=Be();function H(){h("search",v())}function w(){h("search",v())}function _(T){T.key==="Enter"&&H()}Ce();var L=dr(),q=i(L),R=i(q),B=i(R),K=i(B);lt(K,{get placeholder(){return a()},get disabled(){return t()},get value(){return v()},set value(T){v(T)},$$events:{input:w,keydown:_},$$legacy:!0}),o(B);var J=M(B,2);{var j=T=>{we(T,{variant:"secondary",get disabled(){return t()},$$events:{click:H},children:(Q,l)=>{Ne();var d=ze("Search");n(Q,d)},$$slots:{default:!0}})};P(J,T=>{k()&&T(j)})}o(R);var b=M(R,2);{var A=T=>{var Q=lr(),l=i(Q,!0);o(Q),G(()=>F(l,x())),n(T,Q)};P(b,T=>{x()&&T(A)})}o(q),o(L),n(N,L),me()}var cr=I('Showing to of ',1),ur=I('
');function gr(N,r){he(r,!1);const v=He(),a=He();let t=s(r,"currentPage",8,1),x=s(r,"totalPages",8,1),k=s(r,"perPage",8,25),h=s(r,"totalItems",8,0),H=s(r,"itemName",8,"results");const w=Be();function _(B){B>=1&&B<=x()&&B!==t()&&w("pageChange",{page:B})}Se(()=>(p(h()),p(t()),p(k())),()=>{Ie(v,h()===0?0:(t()-1)*k()+1)}),Se(()=>(p(t()),p(k()),p(h())),()=>{Ie(a,Math.min(t()*k(),h()))}),Ee(),Ce();var L=U(),q=E(L);{var R=B=>{var K=ur(),J=i(K),j=i(J);{let z=$(()=>t()===1);we(j,{variant:"secondary",get disabled(){return e(z)},$$events:{click:()=>_(t()-1)},children:(C,y)=>{Ne();var S=ze("Previous");n(C,S)},$$slots:{default:!0}})}var b=M(j,2);{let z=$(()=>t()===x());we(b,{variant:"secondary",get disabled(){return e(z)},class:"ml-3",$$events:{click:()=>_(t()+1)},children:(C,y)=>{Ne();var S=ze("Next");n(C,S)},$$slots:{default:!0}})}o(J);var A=M(J,2),T=i(A),Q=i(T),l=i(Q);{var d=z=>{var C=ze();G(()=>F(C,`No ${H()??""}`)),n(z,C)},c=z=>{var C=cr(),y=M(E(C)),S=i(y,!0);o(y);var Z=M(y,2),ee=i(Z,!0);o(Z);var te=M(Z,2),oe=i(te,!0);o(te);var ce=M(te);G(()=>{F(S,e(v)),F(ee,e(a)),F(oe,h()),F(ce,` ${H()??""}`)}),n(z,C)};P(l,z=>{h()===0?z(d):z(c,!1)})}o(Q),o(T);var g=M(T,2),D=i(g),W=i(D);{let z=$(()=>t()===1);we(W,{variant:"secondary",size:"sm",get disabled(){return e(z)},class:"rounded-r-none","aria-label":"Previous page",icon:"",$$events:{click:()=>_(t()-1)}})}var f=M(W,2);ve(f,1,()=>(p(x()),u(()=>Array(x()))),fe,(z,C,y)=>{const S=$(()=>y+1);{let Z=$(()=>e(S)===t()?"primary":"secondary");we(z,{get variant(){return e(Z)},size:"sm",class:"rounded-none border-l-0 first:border-l first:rounded-l-md",$$events:{click:()=>_(e(S))},children:(ee,te)=>{Ne();var oe=ze();G(()=>F(oe,e(S))),n(ee,oe)},$$slots:{default:!0}})}});var V=M(f,2);{let z=$(()=>t()===x());we(V,{variant:"secondary",size:"sm",get disabled(){return e(z)},class:"rounded-l-none","aria-label":"Next page",icon:"",$$events:{click:()=>_(t()+1)}})}o(D),o(g),o(A),o(K),n(B,K)};P(q,B=>{x()>1&&B(R)})}n(N,L),me()}var fr=I('

'),hr=I('

'),mr=I('

'),pr=I('

'),xr=I('
'),kr=I('
'),_r=I('
'),yr=I(" "),br=I('
'),wr=I('
');function Pr(N,r){he(r,!1);const v=Be();let a=s(r,"item",8),t=s(r,"config",8);function x(){if(!a())return"Unknown";const{field:l,useId:d,showOwner:c}=t().primaryText,g=a()[l];return d&&g?`${g.slice(0,8)}...`:c&&a().owner&&a().name?`${a().owner}/${a().name}`:g||"Unknown"}function k(){if(!t().secondaryText)return"";const{field:l,computedValue:d}=t().secondaryText;return d!==void 0?typeof d=="function"?d(a()):d:a()?.[l]||""}function h(){if(!t().primaryText.href||!a())return"#";let l=t().primaryText.href;return l=l.replace("{id}",a().id||""),l=l.replace("{name}",encodeURIComponent(a().name||"")),Nt(l)}function H(l){if(!a())return;const d=t().actions?.find(c=>c.type===l);d&&d.handler(a()),l==="edit"?v("edit",{item:a()}):l==="delete"?v("delete",{item:a()}):l==="clone"?v("clone",{item:a()}):v("action",{type:l,item:a()})}function w(l){switch(l.type){case"status":if(t().entityType==="instance"){const c=a()?.[l.field]||"unknown";let g="neutral",D=c.charAt(0).toUpperCase()+c.slice(1);return l.field==="status"?g=c==="running"?"success":c==="pending"||c==="creating"?"info":c==="failed"||c==="error"?"error":"neutral":l.field==="runner_status"&&(g=c==="idle"?"info":c==="active"||c==="running"?"success":c==="failed"||c==="error"?"error":"neutral"),{variant:g,text:D}}return{variant:"neutral",text:a()?.[l.field]||"Unknown"};case"forge":return{variant:"neutral",text:a()?.[l.field]||"unknown"};case"auth":const d=a()?.[l.field]||"pat";return{variant:d==="pat"?"success":"info",text:d.toUpperCase()};case"custom":if(typeof l.value=="function"){const c=l.value(a());return{variant:c?.variant||"neutral",text:c?.text||""}}return{variant:l.value?.variant||"neutral",text:l.value?.text||""};default:return{variant:"neutral",text:""}}}Ce();var _=wr(),L=i(_),q=i(L);{var R=l=>{var d=hr(),c=i(d),g=i(c,!0);o(c);var D=M(c,2);{var W=f=>{var V=fr(),z=i(V,!0);o(V),G(C=>F(z,C),[()=>u(k)]),n(f,V)};P(D,f=>{p(t()),u(()=>t().secondaryText)&&f(W)})}o(d),G((f,V)=>{Ae(d,"href",f),Pe(c,1,`text-sm font-medium text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 truncate${p(t()),u(()=>t().primaryText.isMonospace?" font-mono":"")??""}`),F(g,V)},[()=>u(h),()=>u(x)]),n(l,d)},B=l=>{var d=pr(),c=i(d),g=i(c,!0);o(c);var D=M(c,2);{var W=f=>{var V=mr(),z=i(V,!0);o(V),G(C=>F(z,C),[()=>u(k)]),n(f,V)};P(D,f=>{p(t()),u(()=>t().secondaryText)&&f(W)})}o(d),G(f=>F(g,f),[()=>u(x)]),n(l,d)};P(q,l=>{p(t()),u(()=>t().primaryText.isClickable)?l(R):l(B,!1)})}var K=M(q,2);{var J=l=>{var d=_r(),c=i(d);{var g=f=>{var V=U(),z=E(V);ve(z,1,()=>(p(t()),u(()=>t().customInfo)),fe,(C,y)=>{const S=$(()=>(e(y),p(a()),u(()=>typeof e(y).icon=="function"?e(y).icon(a()):e(y).icon))),Z=$(()=>(e(y),p(a()),u(()=>typeof e(y).text=="function"?e(y).text(a()):e(y).text)));var ee=xr(),te=i(ee);{var oe=pe=>{var Le=U(),De=E(Le);Xe(De,()=>e(S)),n(pe,Le)};P(te,pe=>{e(S)&&pe(oe)})}var ce=M(te,2),Re=i(ce,!0);o(ce),o(ee),G(()=>F(Re,e(Z))),n(C,ee)}),n(f,V)};P(c,f=>{p(t()),u(()=>t().customInfo)&&f(g)})}var D=M(c,2);{var W=f=>{var V=U(),z=E(V);ve(z,1,()=>(p(t()),u(()=>t().badges.filter(C=>C.type==="forge"))),fe,(C,y)=>{var S=kr(),Z=i(S);Xe(Z,()=>(p(st),e(y),p(a()),u(()=>st(e(y).field?a()?.[e(y).field]||"unknown":a()?.endpoint?.endpoint_type||"unknown"))));var ee=M(Z,2),te=i(ee,!0);o(ee),o(S),G(()=>F(te,(p(a()),u(()=>a()?.endpoint?.name||"Unknown")))),n(C,S)}),n(f,V)};P(D,f=>{p(t()),u(()=>t().badges)&&f(W)})}o(d),n(l,d)};P(K,l=>{p(t()),u(()=>t().customInfo||t().badges?.some(d=>d.type==="forge"))&&l(J)})}o(L);var j=M(L,2),b=i(j);{var A=l=>{var d=U(),c=E(d);ve(c,1,()=>(p(t()),u(()=>t().badges.filter(g=>g.type!=="forge"))),fe,(g,D)=>{var W=U(),f=E(W);{var V=C=>{const y=$(()=>(e(D),u(()=>w(e(D)))));var S=yr(),Z=i(S,!0);o(S),G(()=>{Pe(S,1,`inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ring-1 ring-inset ${p(e(y)),u(()=>e(y).variant==="success"?"bg-green-50 text-green-700 ring-green-600/20 dark:bg-green-900/50 dark:text-green-300 dark:ring-green-400/20":e(y).variant==="info"?"bg-blue-50 text-blue-700 ring-blue-600/20 dark:bg-blue-900/50 dark:text-blue-300 dark:ring-blue-400/20":e(y).variant==="error"?"bg-red-50 text-red-700 ring-red-600/20 dark:bg-red-900/50 dark:text-red-300 dark:ring-red-400/20":"bg-gray-50 text-gray-700 ring-gray-600/20 dark:bg-gray-900/50 dark:text-gray-300 dark:ring-gray-400/20")??""}`),F(Z,(p(e(y)),u(()=>e(y).text)))}),n(C,S)},z=C=>{const y=$(()=>(e(D),u(()=>w(e(D)))));Dt(C,{get variant(){return p(e(y)),u(()=>e(y).variant)},get text(){return p(e(y)),u(()=>e(y).text)}})};P(f,C=>{e(D),u(()=>e(D).type==="status")?C(V):C(z,!1)})}n(g,W)}),n(l,d)};P(b,l=>{p(t()),u(()=>t().badges)&&l(A)})}var T=M(b,2);{var Q=l=>{var d=br();ve(d,5,()=>(p(t()),u(()=>t().actions)),fe,(c,g)=>{{let D=$(()=>(e(g),u(()=>e(g).type==="clone"?"copy":e(g).type))),W=$(()=>(e(g),p(t()),u(()=>e(g).type==="edit"?`Edit ${t().entityType}`:e(g).type==="delete"?`Delete ${t().entityType}`:e(g).type==="clone"?`Clone ${t().entityType}`:e(g).type))),f=$(()=>(e(g),p(t()),u(()=>e(g).type==="edit"?`Edit ${t().entityType}`:e(g).type==="delete"?`Delete ${t().entityType}`:e(g).type==="clone"?`Clone ${t().entityType}`:e(g).type)));Rt(c,{get action(){return e(D)},size:"sm",get title(){return e(W)},get ariaLabel(){return e(f)},$$events:{click:()=>H(e(g).type)}})}}),o(d),n(l,d)};P(T,l=>{p(t()),u(()=>t().actions)&&l(Q)})}o(j),o(_),n(N,_),me()}var Mr=I('
'),Cr=I('
'),jr=I("
"),Tr=I("
"),zr=I(' ',1),Sr=I('
');function qr(N,r){he(r,!1);const v=He();let a=s(r,"columns",24,()=>[]),t=s(r,"data",24,()=>[]),x=s(r,"loading",8,!1),k=s(r,"error",8,""),h=s(r,"totalItems",8,0),H=s(r,"itemName",8,"results"),w=s(r,"searchTerm",12,""),_=s(r,"searchPlaceholder",8,"Search..."),L=s(r,"showSearch",8,!0),q=s(r,"searchType",8,"client"),R=s(r,"searchHelpText",8,""),B=s(r,"currentPage",8,1),K=s(r,"perPage",12,25),J=s(r,"totalPages",8,1),j=s(r,"showPagination",8,!0),b=s(r,"showPerPageSelector",8,!0),A=s(r,"paginationComponent",8,null),T=s(r,"paginationProps",24,()=>({})),Q=s(r,"emptyTitle",8,"No items found"),l=s(r,"emptyMessage",8,""),d=s(r,"emptyIconType",8,"document"),c=s(r,"errorTitle",8,"Error loading data"),g=s(r,"showRetry",8,!1),D=s(r,"showMobileCards",8,!0),W=s(r,"mobileCardConfig",8,null);const f=Be();function V(m){const re=typeof m.detail=="string"?m.detail:m.detail.term;f("search",{term:re})}function z(m){f("pageChange",m.detail)}function C(m){f("perPageChange",m.detail)}function y(){f("retry")}function S(m){f("edit",m.detail)}function Z(m){f("delete",m.detail)}function ee(m){f("clone",m.detail)}function te(m){f("shell",m.detail)}function oe(m){f("action",m.detail)}function ce(m){const re="px-6 py-4 text-sm",xe=m.align==="right"?"text-right":m.align==="center"?"text-center":"text-left",ke=m.key==="actions"?"font-medium":"text-gray-900 dark:text-white",_e=m.flexible?"min-w-0":"";return`${re} ${xe} ${ke} ${_e}`.trim()}function Re(){return a().map(m=>m.flexible?`${m.flexRatio||1}fr`:"auto").join(" ")}Se(()=>(p(l()),p(w()),p(H())),()=>{Ie(v,l()||(w()?`No items found matching "${w()}"`:`No ${H()} found`))}),Ee(),Ce();var pe=Sr(),Le=i(pe);{var De=m=>{var re=U(),xe=E(re);{var ke=X=>{vr(X,{get placeholder(){return _()},get helpText(){return R()},showButton:!1,get value(){return w()},set value(ae){w(ae)},$$events:{search:V},$$legacy:!0})},_e=X=>{ir(X,{get placeholder(){return _()},get showPerPageSelector(){return b()},get searchTerm(){return w()},set searchTerm(ae){w(ae)},get perPage(){return K()},set perPage(ae){K(ae)},$$events:{search:V,perPageChange:C},$$legacy:!0})};P(xe,X=>{q()==="backend"?X(ke):X(_e,!1)})}n(m,re)};P(Le,m=>{L()&&m(De)})}var Ze=M(Le,2),Qe=i(Ze);{var dt=m=>{Ot(m,{get message(){return`Loading ${H()??""}...`}})},vt=m=>{var re=U(),xe=E(re);{var ke=X=>{{let ae=$(()=>g()?y:void 0);Xt(X,{get title(){return c()},get message(){return k()},get showRetry(){return g()},get onRetry(){return e(ae)}})}},_e=X=>{var ae=U(),Ue=E(ae);{var Fe=ue=>{rr(ue,{get title(){return Q()},get message(){return e(v)},get iconType(){return d()}})},Ge=ue=>{var We=zr(),Ye=E(We);{var gt=se=>{var O=Cr();ve(O,7,t,(le,ne)=>le.id||le.name||ne,(le,ne,Oe)=>{var Ve=Mr(),Y=i(Ve);{var je=ge=>{var ye=U(),ie=E(ye);it(ie,()=>(e(ne),u(()=>`${e(ne).id||e(ne).name}-${e(ne).updated_at}-mobile`)),be=>{Pr(be,{get item(){return e(ne)},get config(){return W()},$$events:{edit(de){Te.call(this,r,de)},delete(de){Te.call(this,r,de)},clone(de){Te.call(this,r,de)},action(de){Te.call(this,r,de)}}})}),n(ge,ye)},Ke=ge=>{var ye=U(),ie=E(ye);nt(ie,r,"mobile-card",{get item(){return e(ne)},get index(){return e(Oe)}}),n(ge,ye)};P(Y,ge=>{W()?ge(je):ge(Ke,!1)})}o(Ve),n(le,Ve)}),o(O),n(se,O)};P(Ye,se=>{D()&&se(gt)})}var $e=M(Ye,2),qe=i($e),et=i(qe);ve(et,1,a,fe,(se,O)=>{var le=jr(),ne=i(le,!0);o(le),G(()=>{Pe(le,1,`px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600 ${e(O),u(()=>e(O).align==="right"?"text-right":e(O).align==="center"?"text-center":"text-left")??""}`),F(ne,(e(O),u(()=>e(O).title)))}),n(se,le)});var ft=M(et,2);ve(ft,3,t,(se,O)=>se.id||se.name||O,(se,O,le)=>{var ne=U(),Oe=E(ne);ve(Oe,1,a,fe,(Ve,Y)=>{var je=Tr(),Ke=i(je);{var ge=ie=>{var be=U(),de=E(be);it(de,()=>(e(O),e(Y),u(()=>`${e(O).id||e(O).name}-${e(O).updated_at}-${e(Y).key}`)),ht=>{var tt=U(),mt=E(tt);{let pt=$(()=>typeof e(Y).cellProps=="function"?e(Y).cellProps(e(O)):e(Y).cellProps);ot(mt,()=>e(Y).cellComponent,(xt,kt)=>{kt(xt,at({get item(){return e(O)}},()=>e(pt),{$$events:{edit:S,delete:Z,clone:ee,shell:te,action:oe}}))})}n(ht,tt)}),n(ie,be)},ye=ie=>{var be=U(),de=E(be);nt(de,r,"cell",{get item(){return e(O)},get column(){return e(Y)},get index(){return e(le)},get value(){return e(O),e(Y),u(()=>e(O)[e(Y).key])}}),n(ie,be)};P(Ke,ie=>{e(Y),u(()=>e(Y).cellComponent)?ie(ge):ie(ye,!1)})}o(je),G(ie=>Pe(je,1,`${ie??""} border-b border-gray-200 dark:border-gray-700`),[()=>(e(Y),u(()=>ce(e(Y))))]),n(Ve,je)}),n(se,ne)}),o(qe),o($e),G(se=>At(qe,`grid-template-columns: ${se??""}`),[()=>u(Re)]),n(ue,We)};P(Ue,ue=>{p(t()),u(()=>t().length===0)?ue(Fe):ue(Ge,!1)},!0)}n(X,ae)};P(xe,X=>{k()?X(ke):X(_e,!1)},!0)}n(m,re)};P(Qe,m=>{x()?m(dt):m(vt,!1)})}var ct=M(Qe,2);{var ut=m=>{var re=U(),xe=E(re);{var ke=X=>{var ae=U(),Ue=E(ae);ot(Ue,A,(Fe,Ge)=>{Ge(Fe,at({get currentPage(){return B()},get totalPages(){return J()},get totalItems(){return h()},get pageSize(){return K()},get loading(){return x()},get itemName(){return H()}},T,{$$events:{pageChange:z,pageSizeChange:C,prefetch(ue){Te.call(this,r,ue)}}}))}),n(X,ae)},_e=X=>{gr(X,{get currentPage(){return B()},get totalPages(){return J()},get perPage(){return K()},get totalItems(){return h()},get itemName(){return H()},$$events:{pageChange:z}})};P(xe,X=>{A()?X(ke):X(_e,!1)})}n(m,re)};P(ct,m=>{p(j()),p(x()),p(k()),p(t()),u(()=>j()&&!x()&&!k()&&t().length>0)&&m(ut)})}o(Ze),o(pe),n(N,pe),me()}var Ir=I(" "),Hr=I(" ");function Or(N,r){he(r,!1);const v=He(),a=He();let t=s(r,"item",8),x=s(r,"field",8,void 0),k=s(r,"getValue",8,void 0),h=s(r,"type",8,"text"),H=s(r,"truncateLength",8,50),w=s(r,"showTitle",8,!1);function _(){return t()?k()?k()(t()):x()&&x().split(".").reduce((j,b)=>j?.[b],t())||"":""}function L(){return h()==="date"?Ut(e(v)):h()==="truncated"&&e(v).length>H()?`${e(v).slice(0,H())}...`:e(v)}function q(){switch(h()){case"code":return"inline-block max-w-full truncate bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded text-xs font-mono";case"description":return"block w-full truncate text-sm text-gray-500 dark:text-gray-300";case"date":return"block w-full truncate text-sm text-gray-900 dark:text-white font-mono";default:return"block w-full truncate text-sm text-gray-900 dark:text-white"}}Se(()=>{},()=>{Ie(v,_())}),Se(()=>{},()=>{Ie(a,L())}),Ee(),Ce();var R=U(),B=E(R);{var K=j=>{var b=Ir(),A=i(b,!0);o(b),G(T=>{Pe(b,1,`${T??""} ${w()?"cursor-default":""}`),Ae(b,"title",w()?e(v):""),F(A,e(a))},[()=>u(q)]),n(j,b)},J=j=>{var b=Hr(),A=i(b,!0);o(b),G(T=>{Pe(b,1,`${T??""} ${w()?"cursor-default":""}`),Ae(b,"title",w()?e(v):""),F(A,e(a))},[()=>u(q)]),n(j,b)};P(B,j=>{h()==="code"?j(K):j(J,!1)})}n(N,R),me()}export{qr as D,Or as G,Ot as L,it as k}; diff --git a/webapp/assets/_app/immutable/chunks/BTeTCgJA.js b/webapp/assets/_app/immutable/chunks/BStwtkX8.js similarity index 94% rename from webapp/assets/_app/immutable/chunks/BTeTCgJA.js rename to webapp/assets/_app/immutable/chunks/BStwtkX8.js index 6a1996dd..d81a3418 100644 --- a/webapp/assets/_app/immutable/chunks/BTeTCgJA.js +++ b/webapp/assets/_app/immutable/chunks/BStwtkX8.js @@ -1 +1 @@ -import{c as S,a as C}from"./ZGz3X54u.js";import{i as L}from"./CY7Wcm-1.js";import{p as B,l as w,h as n,g as t,m as y,b as V,f as A,a as E,d as _,u as f}from"./kDtaAWAK.js";import{k as F}from"./Cfdue6T6.js";import{p as m}from"./Cun6jNAp.js";import{B as G}from"./DovBLKjH.js";import{k as x}from"./DNHT2U_W.js";import{f as D}from"./ow_oMtSd.js";function J(v,u){B(u,!1);const s=y(),c=y();let e=m(u,"item",8),g=m(u,"statusType",8,"entity"),r=m(u,"statusField",8,"status");w(()=>(n(e()),n(r())),()=>{_(s,e()?.[r()]||"unknown")}),w(()=>(n(e()),n(g()),t(s),n(r())),()=>{_(c,(()=>{if(!e())return{variant:"error",text:"Unknown"};switch(g()){case"entity":return x(e());case"instance":let a="secondary";switch(t(s).toLowerCase()){case"running":a="success";break;case"stopped":a="info";break;case"creating":case"pending_create":a="warning";break;case"deleting":case"pending_delete":case"pending_force_delete":a="warning";break;case"error":case"deleted":a="error";break;case"active":case"online":a="success";break;case"idle":a="info";break;case"pending":case"installing":a="warning";break;case"failed":case"terminated":case"offline":a="error";break;case"unknown":default:a="secondary";break}return{variant:a,text:D(t(s))};case"enabled":return{variant:e().enabled?"success":"error",text:e().enabled?"Enabled":"Disabled"};case"os_type":const T=(t(s)||"").toLowerCase();let i="secondary",o=t(s)||"Unknown";switch(T){case"linux":i="success",o="Linux";break;case"windows":i="blue",o="Windows";break;case"macos":case"darwin":i="purple",o="macOS";break;default:i="gray",o=t(s)||"Unknown";break}return{variant:i,text:o};case"forge_type":const U=(t(s)||"").toLowerCase();let d="secondary",l=t(s)||"Unknown";switch(U){case"github":d="gray",l="GitHub";break;case"gitea":d="green",l="Gitea";break;default:d="secondary",l=t(s)||"Unknown";break}return{variant:d,text:l};case"custom":const p=e()[r()]||"Unknown";if(r()==="auth-type"){const b=p==="pat"||!p?"pat":"app";return{variant:b==="pat"?"success":"info",text:b==="pat"?"PAT":"App"}}return{variant:"info",text:p};default:return x(e())}})())}),V(),L();var k=S(),h=A(k);F(h,()=>(n(e()),n(r()),f(()=>`${e()?.name||"item"}-${e()?.[r()]||"status"}-${e()?.updated_at||"time"}`)),a=>{G(a,{get variant(){return t(c),f(()=>t(c).variant)},get text(){return t(c),f(()=>t(c).text)}})}),C(v,k),E()}export{J as S}; +import{c as S,a as C}from"./ZGz3X54u.js";import{i as L}from"./CY7Wcm-1.js";import{p as B,l as w,h as n,g as t,m as y,b as V,f as A,a as E,d as _,u as f}from"./kDtaAWAK.js";import{k as F}from"./BKeluGSY.js";import{p as m}from"./Cun6jNAp.js";import{B as G}from"./DbE0zTOa.js";import{k as x}from"./ZelbukuJ.js";import{f as D}from"./ow_oMtSd.js";function J(v,u){B(u,!1);const s=y(),c=y();let e=m(u,"item",8),g=m(u,"statusType",8,"entity"),r=m(u,"statusField",8,"status");w(()=>(n(e()),n(r())),()=>{_(s,e()?.[r()]||"unknown")}),w(()=>(n(e()),n(g()),t(s),n(r())),()=>{_(c,(()=>{if(!e())return{variant:"error",text:"Unknown"};switch(g()){case"entity":return x(e());case"instance":let a="secondary";switch(t(s).toLowerCase()){case"running":a="success";break;case"stopped":a="info";break;case"creating":case"pending_create":a="warning";break;case"deleting":case"pending_delete":case"pending_force_delete":a="warning";break;case"error":case"deleted":a="error";break;case"active":case"online":a="success";break;case"idle":a="info";break;case"pending":case"installing":a="warning";break;case"failed":case"terminated":case"offline":a="error";break;case"unknown":default:a="secondary";break}return{variant:a,text:D(t(s))};case"enabled":return{variant:e().enabled?"success":"error",text:e().enabled?"Enabled":"Disabled"};case"os_type":const T=(t(s)||"").toLowerCase();let i="secondary",o=t(s)||"Unknown";switch(T){case"linux":i="success",o="Linux";break;case"windows":i="blue",o="Windows";break;case"macos":case"darwin":i="purple",o="macOS";break;default:i="gray",o=t(s)||"Unknown";break}return{variant:i,text:o};case"forge_type":const U=(t(s)||"").toLowerCase();let d="secondary",l=t(s)||"Unknown";switch(U){case"github":d="gray",l="GitHub";break;case"gitea":d="green",l="Gitea";break;default:d="secondary",l=t(s)||"Unknown";break}return{variant:d,text:l};case"custom":const p=e()[r()]||"Unknown";if(r()==="auth-type"){const b=p==="pat"||!p?"pat":"app";return{variant:b==="pat"?"success":"info",text:b==="pat"?"PAT":"App"}}return{variant:"info",text:p};default:return x(e())}})())}),V(),L();var k=S(),h=A(k);F(h,()=>(n(e()),n(r()),f(()=>`${e()?.name||"item"}-${e()?.[r()]||"status"}-${e()?.updated_at||"time"}`)),a=>{G(a,{get variant(){return t(c),f(()=>t(c).variant)},get text(){return t(c),f(()=>t(c).text)}})}),C(v,k),E()}export{J as S}; diff --git a/webapp/assets/_app/immutable/chunks/CUtPzwFi.js b/webapp/assets/_app/immutable/chunks/Bmm5UxxZ.js similarity index 98% rename from webapp/assets/_app/immutable/chunks/CUtPzwFi.js rename to webapp/assets/_app/immutable/chunks/Bmm5UxxZ.js index 769adb80..0be32151 100644 --- a/webapp/assets/_app/immutable/chunks/CUtPzwFi.js +++ b/webapp/assets/_app/immutable/chunks/Bmm5UxxZ.js @@ -1,2 +1,2 @@ -import{f as x,s as E,e as V,a as f,c as ae,t as Pr}from"./ZGz3X54u.js";import{i as ct}from"./CY7Wcm-1.js";import{p as bt,v as vt,m as p,o as mt,d as s,q as yt,l as we,g as e,b as _t,f as W,c as d,r as o,s as n,t as _,k as tr,u as g,n as ar,h as j,a as xt,i as ht}from"./kDtaAWAK.js";import{p as kt,i as v,s as wt,a as Et}from"./Cun6jNAp.js";import{e as Ir,i as Jr}from"./DdT9Vz5Q.js";import{r as T,s as ir,b as or,c as Nr,g as Ee,d as Cr}from"./Cvcp5xHB.js";import{b as A,a as Br}from"./CYnNqrHp.js";import{p as Tt}from"./CdEA5IGF.js";import{M as $t}from"./C6jYEeWP.js";import{J as St,U as Rt,a as Mt,b as Ot}from"./C6Z10Ipi.js";import{e as Lr}from"./BZiHL9L3.js";import{e as Ut}from"./C2c_wqo6.js";import{w as nr}from"./KU08Mex1.js";var zt=x('

'),jt=x('

'),At=x('
Loading templates...
'),Pt=x(""),It=x('

',1),Jt=x('

Create a template first or proceed without a template to use default behavior.

'),Nt=x(' '),Ct=x('
'),Bt=x('
'),Lt=x('
Updating...
'),Dt=x('

Pool Information (Read-only)

Provider:
Entity:

Image & OS Configuration

Runner Limits & Timing

Advanced Settings

Tags
Extra Specs (JSON)
'),Gt=x(" ",1);function aa(Dr,dr){bt(dr,!1);const[Gr,qr]=wt(),c=()=>Et(Ut,"$eagerCache",Gr),M=p();let r=kt(dr,"pool",8);const Te=vt();let ie=p(!1),X=p(""),O=p(""),$=p([]),$e=p(!1),F=p(!1),H=null,oe=p(r().image||""),ne=p(r().flavor||""),P=p(r().max_runners),I=p(r().min_idle_runners),de=p(r().runner_bootstrap_timeout),se=p(r().priority),le=p(r().runner_prefix||""),S=p(r().os_type||"linux"),Y=p(r().os_arch||"amd64"),ue=p(r()["github-runner-group"]||""),pe=p(r().enabled),Z=p(r().enable_shell??!1),R=p((r().tags||[]).map(t=>t.name||"").filter(Boolean)),K=p(""),J=p("{}"),U=p(r().template_id);function Wr(t){if(t.repo_id){const a=c().repositories.find(l=>l.id===t.repo_id);return a?`${a.owner}/${a.name}`:"Unknown Entity"}if(t.org_id){const a=c().organizations.find(l=>l.id===t.org_id);return a&&a.name?a.name:"Unknown Entity"}if(t.enterprise_id){const a=c().enterprises.find(l=>l.id===t.enterprise_id);return a&&a.name?a.name:"Unknown Entity"}return"Unknown Entity"}function sr(t){return t.repo_id?"Repository":t.org_id?"Organization":t.enterprise_id?"Enterprise":"Unknown"}function Se(){if(r().endpoint?.endpoint_type)return r().endpoint.endpoint_type;if(r().repo_id){const t=c().repositories.find(a=>a.id===r().repo_id);if(t?.endpoint?.endpoint_type)return t.endpoint.endpoint_type}if(r().org_id){const t=c().organizations.find(a=>a.id===r().org_id);if(t?.endpoint?.endpoint_type)return t.endpoint.endpoint_type}if(r().enterprise_id){const t=c().enterprises.find(a=>a.id===r().enterprise_id);if(t?.endpoint?.endpoint_type)return t.endpoint.endpoint_type}return null}function Fr(){return r().repo_id?c().repositories.find(a=>a.id===r().repo_id)?.agent_mode??!1:r().org_id?c().organizations.find(a=>a.id===r().org_id)?.agent_mode??!1:r().enterprise_id?c().enterprises.find(a=>a.id===r().enterprise_id)?.agent_mode??!1:!1}function Re(t){if(t.operation!=="update")return;const a=t.payload;if(r().repo_id&&a.id===r().repo_id){const l=c().repositories.find(h=>h.id===r().repo_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(M,a.agent_mode??!1))}else if(r().org_id&&a.id===r().org_id){const l=c().organizations.find(h=>h.id===r().org_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(M,a.agent_mode??!1))}else if(r().enterprise_id&&a.id===r().enterprise_id){const l=c().enterprises.find(h=>h.id===r().enterprise_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(M,a.agent_mode??!1))}}async function Me(t){try{if(r().repo_id){await Ee.updateRepository(r().repo_id,t);const a=c().repositories.find(l=>l.id===r().repo_id);a&&Object.assign(a,t)}else if(r().org_id){await Ee.updateOrganization(r().org_id,t);const a=c().organizations.find(l=>l.id===r().org_id);a&&Object.assign(a,t)}else if(r().enterprise_id){await Ee.updateEnterprise(r().enterprise_id,t);const a=c().enterprises.find(l=>l.id===r().enterprise_id);a&&Object.assign(a,t)}s(F,!1)}catch(a){throw a}}function Hr(){return r().repo_id?c().repositories.find(t=>t.id===r().repo_id)||null:r().org_id?c().organizations.find(t=>t.id===r().org_id)||null:r().enterprise_id&&c().enterprises.find(t=>t.id===r().enterprise_id)||null}async function lr(){try{s($e,!0);const t=Se();if(!t){s($,[]);return}if(s($,await Ee.listTemplates(e(S),void 0,t)),!e(U)||!e($).find(a=>a.id===e(U))){const a=e($).find(l=>l.owner_id==="system");a?s(U,a.id):e($).length>0&&s(U,e($)[0].id)}}catch(t){s(X,Lr(t))}finally{s($e,!1)}}mt(()=>{if(r().extra_specs)try{if(typeof r().extra_specs=="object")s(J,JSON.stringify(r().extra_specs,null,2));else{const t=JSON.parse(r().extra_specs);s(J,JSON.stringify(t,null,2))}}catch{s(J,r().extra_specs||"{}")}lr(),r().repo_id?H=nr.subscribeToEntity("repository",["update"],Re):r().org_id?H=nr.subscribeToEntity("organization",["update"],Re):r().enterprise_id&&(H=nr.subscribeToEntity("enterprise",["update"],Re))}),yt(()=>{H&&(H(),H=null)});function ur(){e(K).trim()&&!e(R).includes(e(K).trim())&&(s(R,[...e(R),e(K).trim()]),s(K,""))}function Kr(t){s(R,e(R).filter((a,l)=>l!==t))}function Qr(t){t.key==="Enter"&&(t.preventDefault(),ur())}async function Vr(){try{if(s(ie,!0),s(X,""),e(O))throw new Error(e(O));let t={};if(e(J).trim())try{t=JSON.parse(e(J))}catch{throw new Error("Invalid JSON in extra specs")}const a={image:e(oe)!==r().image?e(oe):void 0,flavor:e(ne)!==r().flavor?e(ne):void 0,max_runners:e(P)!==r().max_runners?e(P):void 0,min_idle_runners:e(I)!==r().min_idle_runners?e(I):void 0,runner_bootstrap_timeout:e(de)!==r().runner_bootstrap_timeout?e(de):void 0,priority:e(se)!==r().priority?e(se):void 0,runner_prefix:e(le)!==r().runner_prefix?e(le):void 0,os_type:e(S)!==r().os_type?e(S):void 0,os_arch:e(Y)!==r().os_arch?e(Y):void 0,"github-runner-group":e(ue)!==r()["github-runner-group"]&&e(ue)||void 0,enabled:e(pe)!==r().enabled?e(pe):void 0,enable_shell:e(Z)!==r().enable_shell?e(Z):void 0,tags:JSON.stringify(e(R))!==JSON.stringify((r().tags||[]).map(l=>l.name||"").filter(Boolean))?e(R):void 0,extra_specs:e(J).trim()!==JSON.stringify(r().extra_specs||{},null,2).trim()?t:void 0,template_id:e(U)!==r().template_id?e(U):void 0};Object.keys(a).forEach(l=>{a[l]===void 0&&delete a[l]}),Te("submit",a)}catch(t){s(X,Lr(t))}finally{s(ie,!1)}}we(()=>{},()=>{s(M,Fr())}),we(()=>e(M),()=>{e(M)||s(Z,!1)}),we(()=>e(S),()=>{e(S)&&lr()}),we(()=>(e(I),e(P)),()=>{e(I)!==null&&e(I)!==void 0&&e(P)!==null&&e(P)!==void 0&&e(I)>e(P)?s(O,"Min idle runners cannot be greater than max runners"):s(O,"")}),_t(),ct();var pr=Gt(),gr=W(pr);$t(gr,{$$events:{close:()=>Te("close")},children:(t,a)=>{var l=Dt(),h=d(l),ge=d(h),ee=d(ge);o(ge),o(h);var Q=n(h,2),fe=d(Q);{var Oe=i=>{var u=zt(),m=d(u),k=d(m,!0);o(m),o(u),_(()=>E(k,e(X))),f(i,u)};v(fe,i=>{e(X)&&i(Oe)})}var ce=n(fe,2);{var N=i=>{var u=jt(),m=d(u),k=d(m,!0);o(m),o(u),_(()=>E(k,e(O))),f(i,u)};v(ce,i=>{e(O)&&i(N)})}var C=n(ce,2),be=n(d(C),2),re=d(be),ve=n(d(re),2),B=d(ve,!0);o(ve),o(re);var L=n(re,2),me=n(d(L),2),Ue=d(me);o(me),o(L),o(be),o(C);var D=n(C,2),ye=n(d(D),2),ze=d(ye),fr=n(d(ze),2);T(fr),o(ze);var je=n(ze,2),cr=n(d(je),2);T(cr),o(je);var Ae=n(je,2),Pe=n(d(Ae),2);_(()=>{e(S),tr(()=>{})});var Ie=d(Pe);Ie.value=Ie.__value="linux";var br=n(Ie);br.value=br.__value="windows",o(Pe),o(Ae);var Je=n(Ae,2),Ne=n(d(Je),2);_(()=>{e(Y),tr(()=>{})});var Ce=d(Ne);Ce.value=Ce.__value="amd64";var vr=n(Ce);vr.value=vr.__value="arm64",o(Ne),o(Je);var mr=n(Je,2),Zr=n(d(mr),2);{var et=i=>{var u=At();f(i,u)},rt=i=>{var u=ae(),m=W(u);{var k=y=>{var z=It(),w=W(z);_(()=>{e(U),tr(()=>{e($)})}),Ir(w,5,()=>e($),Jr,(G,b)=>{var q=Pt(),zr=d(q),gt=n(zr);{var ft=rr=>{var Ar=Pr();_(()=>E(Ar,`- ${e(b),g(()=>e(b).description)??""}`)),f(rr,Ar)};v(gt,rr=>{e(b),g(()=>e(b).description)&&rr(ft)})}o(q);var jr={};_(()=>{E(zr,`${e(b),g(()=>e(b).name)??""} ${e(b),g(()=>e(b).owner_id==="system"?"(System)":"")??""} `),jr!==(jr=(e(b),g(()=>e(b).id)))&&(q.value=(q.__value=(e(b),g(()=>e(b).id)))??"")}),f(G,q)}),o(w);var he=n(w,2),ke=d(he);o(he),_(G=>E(ke,`Templates define how the runner software is installed and configured. +import{f as x,s as E,e as V,a as f,c as ae,t as Pr}from"./ZGz3X54u.js";import{i as ct}from"./CY7Wcm-1.js";import{p as bt,v as vt,m as p,o as mt,d as s,q as yt,l as we,g as e,b as _t,f as W,c as d,r as o,s as n,t as _,k as tr,u as g,n as ar,h as j,a as xt,i as ht}from"./kDtaAWAK.js";import{p as kt,i as v,s as wt,a as Et}from"./Cun6jNAp.js";import{e as Ir,i as Jr}from"./DdT9Vz5Q.js";import{r as T,s as ir,b as or,c as Nr,g as Ee,d as Cr}from"./CYK-UalN.js";import{b as A,a as Br}from"./CYnNqrHp.js";import{p as Tt}from"./CdEA5IGF.js";import{M as $t}from"./CVBpH3Sf.js";import{J as St,U as Rt,a as Mt,b as Ot}from"./C6-Yv_jr.js";import{e as Lr}from"./BZiHL9L3.js";import{e as Ut}from"./Vo3Mv3dp.js";import{w as nr}from"./KU08Mex1.js";var zt=x('

'),jt=x('

'),At=x('
Loading templates...
'),Pt=x(""),It=x('

',1),Jt=x('

Create a template first or proceed without a template to use default behavior.

'),Nt=x(' '),Ct=x('
'),Bt=x('
'),Lt=x('
Updating...
'),Dt=x('

Pool Information (Read-only)

Provider:
Entity:

Image & OS Configuration

Runner Limits & Timing

Advanced Settings

Tags
Extra Specs (JSON)
'),Gt=x(" ",1);function aa(Dr,dr){bt(dr,!1);const[Gr,qr]=wt(),c=()=>Et(Ut,"$eagerCache",Gr),M=p();let r=kt(dr,"pool",8);const Te=vt();let ie=p(!1),X=p(""),O=p(""),$=p([]),$e=p(!1),F=p(!1),H=null,oe=p(r().image||""),ne=p(r().flavor||""),P=p(r().max_runners),I=p(r().min_idle_runners),de=p(r().runner_bootstrap_timeout),se=p(r().priority),le=p(r().runner_prefix||""),S=p(r().os_type||"linux"),Y=p(r().os_arch||"amd64"),ue=p(r()["github-runner-group"]||""),pe=p(r().enabled),Z=p(r().enable_shell??!1),R=p((r().tags||[]).map(t=>t.name||"").filter(Boolean)),K=p(""),J=p("{}"),U=p(r().template_id);function Wr(t){if(t.repo_id){const a=c().repositories.find(l=>l.id===t.repo_id);return a?`${a.owner}/${a.name}`:"Unknown Entity"}if(t.org_id){const a=c().organizations.find(l=>l.id===t.org_id);return a&&a.name?a.name:"Unknown Entity"}if(t.enterprise_id){const a=c().enterprises.find(l=>l.id===t.enterprise_id);return a&&a.name?a.name:"Unknown Entity"}return"Unknown Entity"}function sr(t){return t.repo_id?"Repository":t.org_id?"Organization":t.enterprise_id?"Enterprise":"Unknown"}function Se(){if(r().endpoint?.endpoint_type)return r().endpoint.endpoint_type;if(r().repo_id){const t=c().repositories.find(a=>a.id===r().repo_id);if(t?.endpoint?.endpoint_type)return t.endpoint.endpoint_type}if(r().org_id){const t=c().organizations.find(a=>a.id===r().org_id);if(t?.endpoint?.endpoint_type)return t.endpoint.endpoint_type}if(r().enterprise_id){const t=c().enterprises.find(a=>a.id===r().enterprise_id);if(t?.endpoint?.endpoint_type)return t.endpoint.endpoint_type}return null}function Fr(){return r().repo_id?c().repositories.find(a=>a.id===r().repo_id)?.agent_mode??!1:r().org_id?c().organizations.find(a=>a.id===r().org_id)?.agent_mode??!1:r().enterprise_id?c().enterprises.find(a=>a.id===r().enterprise_id)?.agent_mode??!1:!1}function Re(t){if(t.operation!=="update")return;const a=t.payload;if(r().repo_id&&a.id===r().repo_id){const l=c().repositories.find(h=>h.id===r().repo_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(M,a.agent_mode??!1))}else if(r().org_id&&a.id===r().org_id){const l=c().organizations.find(h=>h.id===r().org_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(M,a.agent_mode??!1))}else if(r().enterprise_id&&a.id===r().enterprise_id){const l=c().enterprises.find(h=>h.id===r().enterprise_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(M,a.agent_mode??!1))}}async function Me(t){try{if(r().repo_id){await Ee.updateRepository(r().repo_id,t);const a=c().repositories.find(l=>l.id===r().repo_id);a&&Object.assign(a,t)}else if(r().org_id){await Ee.updateOrganization(r().org_id,t);const a=c().organizations.find(l=>l.id===r().org_id);a&&Object.assign(a,t)}else if(r().enterprise_id){await Ee.updateEnterprise(r().enterprise_id,t);const a=c().enterprises.find(l=>l.id===r().enterprise_id);a&&Object.assign(a,t)}s(F,!1)}catch(a){throw a}}function Hr(){return r().repo_id?c().repositories.find(t=>t.id===r().repo_id)||null:r().org_id?c().organizations.find(t=>t.id===r().org_id)||null:r().enterprise_id&&c().enterprises.find(t=>t.id===r().enterprise_id)||null}async function lr(){try{s($e,!0);const t=Se();if(!t){s($,[]);return}if(s($,await Ee.listTemplates(e(S),void 0,t)),!e(U)||!e($).find(a=>a.id===e(U))){const a=e($).find(l=>l.owner_id==="system");a?s(U,a.id):e($).length>0&&s(U,e($)[0].id)}}catch(t){s(X,Lr(t))}finally{s($e,!1)}}mt(()=>{if(r().extra_specs)try{if(typeof r().extra_specs=="object")s(J,JSON.stringify(r().extra_specs,null,2));else{const t=JSON.parse(r().extra_specs);s(J,JSON.stringify(t,null,2))}}catch{s(J,r().extra_specs||"{}")}lr(),r().repo_id?H=nr.subscribeToEntity("repository",["update"],Re):r().org_id?H=nr.subscribeToEntity("organization",["update"],Re):r().enterprise_id&&(H=nr.subscribeToEntity("enterprise",["update"],Re))}),yt(()=>{H&&(H(),H=null)});function ur(){e(K).trim()&&!e(R).includes(e(K).trim())&&(s(R,[...e(R),e(K).trim()]),s(K,""))}function Kr(t){s(R,e(R).filter((a,l)=>l!==t))}function Qr(t){t.key==="Enter"&&(t.preventDefault(),ur())}async function Vr(){try{if(s(ie,!0),s(X,""),e(O))throw new Error(e(O));let t={};if(e(J).trim())try{t=JSON.parse(e(J))}catch{throw new Error("Invalid JSON in extra specs")}const a={image:e(oe)!==r().image?e(oe):void 0,flavor:e(ne)!==r().flavor?e(ne):void 0,max_runners:e(P)!==r().max_runners?e(P):void 0,min_idle_runners:e(I)!==r().min_idle_runners?e(I):void 0,runner_bootstrap_timeout:e(de)!==r().runner_bootstrap_timeout?e(de):void 0,priority:e(se)!==r().priority?e(se):void 0,runner_prefix:e(le)!==r().runner_prefix?e(le):void 0,os_type:e(S)!==r().os_type?e(S):void 0,os_arch:e(Y)!==r().os_arch?e(Y):void 0,"github-runner-group":e(ue)!==r()["github-runner-group"]&&e(ue)||void 0,enabled:e(pe)!==r().enabled?e(pe):void 0,enable_shell:e(Z)!==r().enable_shell?e(Z):void 0,tags:JSON.stringify(e(R))!==JSON.stringify((r().tags||[]).map(l=>l.name||"").filter(Boolean))?e(R):void 0,extra_specs:e(J).trim()!==JSON.stringify(r().extra_specs||{},null,2).trim()?t:void 0,template_id:e(U)!==r().template_id?e(U):void 0};Object.keys(a).forEach(l=>{a[l]===void 0&&delete a[l]}),Te("submit",a)}catch(t){s(X,Lr(t))}finally{s(ie,!1)}}we(()=>{},()=>{s(M,Fr())}),we(()=>e(M),()=>{e(M)||s(Z,!1)}),we(()=>e(S),()=>{e(S)&&lr()}),we(()=>(e(I),e(P)),()=>{e(I)!==null&&e(I)!==void 0&&e(P)!==null&&e(P)!==void 0&&e(I)>e(P)?s(O,"Min idle runners cannot be greater than max runners"):s(O,"")}),_t(),ct();var pr=Gt(),gr=W(pr);$t(gr,{$$events:{close:()=>Te("close")},children:(t,a)=>{var l=Dt(),h=d(l),ge=d(h),ee=d(ge);o(ge),o(h);var Q=n(h,2),fe=d(Q);{var Oe=i=>{var u=zt(),m=d(u),k=d(m,!0);o(m),o(u),_(()=>E(k,e(X))),f(i,u)};v(fe,i=>{e(X)&&i(Oe)})}var ce=n(fe,2);{var N=i=>{var u=jt(),m=d(u),k=d(m,!0);o(m),o(u),_(()=>E(k,e(O))),f(i,u)};v(ce,i=>{e(O)&&i(N)})}var C=n(ce,2),be=n(d(C),2),re=d(be),ve=n(d(re),2),B=d(ve,!0);o(ve),o(re);var L=n(re,2),me=n(d(L),2),Ue=d(me);o(me),o(L),o(be),o(C);var D=n(C,2),ye=n(d(D),2),ze=d(ye),fr=n(d(ze),2);T(fr),o(ze);var je=n(ze,2),cr=n(d(je),2);T(cr),o(je);var Ae=n(je,2),Pe=n(d(Ae),2);_(()=>{e(S),tr(()=>{})});var Ie=d(Pe);Ie.value=Ie.__value="linux";var br=n(Ie);br.value=br.__value="windows",o(Pe),o(Ae);var Je=n(Ae,2),Ne=n(d(Je),2);_(()=>{e(Y),tr(()=>{})});var Ce=d(Ne);Ce.value=Ce.__value="amd64";var vr=n(Ce);vr.value=vr.__value="arm64",o(Ne),o(Je);var mr=n(Je,2),Zr=n(d(mr),2);{var et=i=>{var u=At();f(i,u)},rt=i=>{var u=ae(),m=W(u);{var k=y=>{var z=It(),w=W(z);_(()=>{e(U),tr(()=>{e($)})}),Ir(w,5,()=>e($),Jr,(G,b)=>{var q=Pt(),zr=d(q),gt=n(zr);{var ft=rr=>{var Ar=Pr();_(()=>E(Ar,`- ${e(b),g(()=>e(b).description)??""}`)),f(rr,Ar)};v(gt,rr=>{e(b),g(()=>e(b).description)&&rr(ft)})}o(q);var jr={};_(()=>{E(zr,`${e(b),g(()=>e(b).name)??""} ${e(b),g(()=>e(b).owner_id==="system"?"(System)":"")??""} `),jr!==(jr=(e(b),g(()=>e(b).id)))&&(q.value=(q.__value=(e(b),g(()=>e(b).id)))??"")}),f(G,q)}),o(w);var he=n(w,2),ke=d(he);o(he),_(G=>E(ke,`Templates define how the runner software is installed and configured. Showing templates for ${G??""} ${e(S)??""}.`),[()=>g(Se)]),or(w,()=>e(U),G=>s(U,G)),f(y,z)},te=y=>{var z=Jt(),w=d(z),he=d(w);o(w);var ke=n(w,2),G=d(ke);ar(),o(ke),o(z),_((b,q)=>{E(he,`No templates found for ${b??""} ${e(S)??""}.`),Nr(G,"href",q)},[()=>g(Se),()=>(j(Cr),g(()=>Cr("/templates")))]),f(y,z)};v(m,y=>{e($),g(()=>e($).length>0)?y(k):y(te,!1)},!0)}f(i,u)};v(Zr,i=>{e($e)?i(et):i(rt,!1)})}o(mr),o(ye),o(D);var Be=n(D,2),yr=n(d(Be),2),Le=d(yr),De=n(d(Le),2);T(De),o(Le);var Ge=n(Le,2),qe=n(d(Ge),2);T(qe),o(Ge);var _r=n(Ge,2),xr=n(d(_r),2);T(xr),o(_r),o(yr),o(Be);var We=n(Be,2),Fe=n(d(We),2),He=d(Fe),hr=n(d(He),2);T(hr),o(He);var Ke=n(He,2),kr=n(d(Ke),2);T(kr),o(Ke);var wr=n(Ke,2),Er=n(d(wr),2);T(Er),o(wr),o(Fe);var Qe=n(Fe,2),Tr=d(Qe),$r=n(d(Tr),2),Ve=d($r),_e=d(Ve);T(_e);var tt=n(_e,2);o(Ve);var at=n(Ve,2);{var it=i=>{var u=Ct();Ir(u,5,()=>e(R),Jr,(m,k,te)=>{var y=Nt(),z=d(y),w=n(z);o(y),_(()=>{E(z,`${e(k)??""} `),Nr(w,"aria-label",`Remove tag ${e(k)??""}`)}),V("click",w,()=>Kr(te)),f(m,y)}),o(u),f(i,u)};v(at,i=>{e(R),g(()=>e(R).length>0)&&i(it)})}o($r),o(Tr),o(Qe);var Xe=n(Qe,2),Sr=d(Xe),ot=n(d(Sr),2);St(ot,{rows:4,placeholder:"{}",get value(){return e(J)},set value(i){s(J,i)},$$legacy:!0}),o(Sr),o(Xe);var Ye=n(Xe,2),Rr=d(Ye);T(Rr),ar(2),o(Ye);var Mr=n(Ye,2),Ze=d(Mr),xe=d(Ze);T(xe);var nt=n(xe,2);ar(2),o(Ze);var dt=n(Ze,2);{var st=i=>{var u=Bt(),m=n(d(u),2),k=d(m),te=n(k);o(m),o(u),_(y=>E(k,`Shell access requires agent mode to be enabled on the ${y??""}. `),[()=>(j(r()),g(()=>sr(r()).toLowerCase()))]),V("click",te,()=>s(F,!0)),f(i,u)};v(dt,i=>{e(M)||i(st)})}o(Mr),o(We);var Or=n(We,2),Ur=d(Or),er=n(Ur,2),lt=d(er);{var ut=i=>{var u=Lt();f(i,u)},pt=i=>{var u=Pr("Update Pool");f(i,u)};v(lt,i=>{e(ie)?i(ut):i(pt,!1)})}o(er),o(Or),o(Q),o(l),_((i,u)=>{E(ee,`Update Pool ${j(r()),g(()=>r().id)??""}`),E(B,(j(r()),g(()=>r().provider_name))),E(Ue,`${i??""}: ${u??""}`),ir(De,1,`w-full px-3 py-2 border ${e(O)?"border-red-300 dark:border-red-500":"border-gray-300 dark:border-gray-600"} rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white`),ir(qe,1,`w-full px-3 py-2 border ${e(O)?"border-red-300 dark:border-red-500":"border-gray-300 dark:border-gray-600"} rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white`),xe.disabled=!e(M),ir(nt,1,`ml-2 block text-sm font-medium text-gray-700 dark:text-gray-300 ${e(M)?"":"opacity-50"}`),er.disabled=e(ie)||e(O)!==""},[()=>(j(r()),g(()=>sr(r()))),()=>(j(r()),g(()=>Wr(r())))]),A(fr,()=>e(oe),i=>s(oe,i)),A(cr,()=>e(ne),i=>s(ne,i)),or(Pe,()=>e(S),i=>s(S,i)),or(Ne,()=>e(Y),i=>s(Y,i)),A(De,()=>e(I),i=>s(I,i)),A(qe,()=>e(P),i=>s(P,i)),A(xr,()=>e(de),i=>s(de,i)),A(hr,()=>e(le),i=>s(le,i)),A(kr,()=>e(se),i=>s(se,i)),A(Er,()=>e(ue),i=>s(ue,i)),A(_e,()=>e(K),i=>s(K,i)),V("keydown",_e,Qr),V("click",tt,ur),Br(Rr,()=>e(pe),i=>s(pe,i)),Br(xe,()=>e(Z),i=>s(Z,i)),V("click",Ur,()=>Te("close")),V("submit",Q,Tt(Vr)),f(t,l)},$$slots:{default:!0}});var Xr=n(gr,2);{var Yr=t=>{const a=ht(()=>g(Hr));var l=ae(),h=W(l);{var ge=ee=>{var Q=ae(),fe=W(Q);{var Oe=N=>{Rt(N,{get repository(){return e(a)},$$events:{close:()=>s(F,!1),submit:C=>Me(C.detail)}})},ce=N=>{var C=ae(),be=W(C);{var re=B=>{Mt(B,{get organization(){return e(a)},$$events:{close:()=>s(F,!1),submit:L=>Me(L.detail)}})},ve=B=>{var L=ae(),me=W(L);{var Ue=D=>{Ot(D,{get enterprise(){return e(a)},$$events:{close:()=>s(F,!1),submit:ye=>Me(ye.detail)}})};v(me,D=>{j(r()),g(()=>r().enterprise_id)&&D(Ue)},!0)}f(B,L)};v(be,B=>{j(r()),g(()=>r().org_id)?B(re):B(ve,!1)},!0)}f(N,C)};v(fe,N=>{j(r()),g(()=>r().repo_id)?N(Oe):N(ce,!1)})}f(ee,Q)};v(h,ee=>{e(a)&&ee(ge)})}f(t,l)};v(Xr,t=>{e(F)&&t(Yr)})}f(Dr,pr),xt(),qr()}export{aa as U}; diff --git a/webapp/assets/_app/immutable/chunks/DH5setay.js b/webapp/assets/_app/immutable/chunks/Bql5nQdO.js similarity index 81% rename from webapp/assets/_app/immutable/chunks/DH5setay.js rename to webapp/assets/_app/immutable/chunks/Bql5nQdO.js index 9b9ef6c8..96716a72 100644 --- a/webapp/assets/_app/immutable/chunks/DH5setay.js +++ b/webapp/assets/_app/immutable/chunks/Bql5nQdO.js @@ -1 +1 @@ -import{p as r}from"./8ZO9Ka4R.js";import{s as t}from"./BU_V7FOQ.js";const e={get data(){return r.data},get error(){return r.error},get form(){return r.form},get params(){return r.params},get route(){return r.route},get state(){return r.state},get status(){return r.status},get url(){return r.url}};t.updated.check;const u=e;export{u as p}; +import{p as r}from"./DR0xnkWv.js";import{s as t}from"./C8dZhfFx.js";const e={get data(){return r.data},get error(){return r.error},get form(){return r.form},get params(){return r.params},get route(){return r.route},get state(){return r.state},get status(){return r.status},get url(){return r.url}};t.updated.check;const u=e;export{u as p}; diff --git a/webapp/assets/_app/immutable/chunks/CRSOHHg7.js b/webapp/assets/_app/immutable/chunks/BrlhCerN.js similarity index 97% rename from webapp/assets/_app/immutable/chunks/CRSOHHg7.js rename to webapp/assets/_app/immutable/chunks/BrlhCerN.js index d9c476e9..8091bf5b 100644 --- a/webapp/assets/_app/immutable/chunks/CRSOHHg7.js +++ b/webapp/assets/_app/immutable/chunks/BrlhCerN.js @@ -1 +1 @@ -import{f as k,s as m,a as v,t as p}from"./ZGz3X54u.js";import"./CY7Wcm-1.js";import{c as a,s as f,r as i,t as g,n as H}from"./kDtaAWAK.js";import{p as t,i as u}from"./Cun6jNAp.js";import{s as Y,h as Z,B as j}from"./Cvcp5xHB.js";var $=k('
'),ee=k('
'),te=k('

');function se(z,e){let E=t(e,"title",8),M=t(e,"subtitle",8),y=t(e,"forgeIcon",8,""),h=t(e,"onEdit",8,null),x=t(e,"onDelete",8,null),B=t(e,"editLabel",8,"Edit"),C=t(e,"deleteLabel",8,"Delete"),P=t(e,"editVariant",8,"secondary"),A=t(e,"deleteVariant",8,"danger"),q=t(e,"editDisabled",8,!1),F=t(e,"deleteDisabled",8,!1),G=t(e,"editIcon",8,""),J=t(e,"deleteIcon",8,""),K=t(e,"titleClass",8,"");var _=te(),D=a(_),w=a(D),b=a(w),I=a(b);{var N=l=>{var r=$(),c=a(r);Z(c,y),i(r),v(l,r)};u(I,l=>{y()&&l(N)})}var L=f(I,2),o=a(L),O=a(o,!0);i(o);var V=f(o,2),Q=a(V,!0);i(V),i(L),i(b);var R=f(b,2);{var S=l=>{var r=ee(),c=a(r);{var T=d=>{j(d,{get variant(){return P()},size:"md",get disabled(){return q()},get icon(){return G()},$$events:{click(...s){h()?.apply(this,s)}},children:(s,X)=>{H();var n=p();g(()=>m(n,B())),v(s,n)},$$slots:{default:!0}})};u(c,d=>{h()&&d(T)})}var U=f(c,2);{var W=d=>{j(d,{get variant(){return A()},size:"md",get disabled(){return F()},get icon(){return J()},$$events:{click(...s){x()?.apply(this,s)}},children:(s,X)=>{H();var n=p();g(()=>m(n,C())),v(s,n)},$$slots:{default:!0}})};u(U,d=>{x()&&d(W)})}i(r),v(l,r)};u(R,l=>{(h()||x())&&l(S)})}i(w),i(D),i(_),g(()=>{Y(o,1,`text-2xl font-bold text-gray-900 dark:text-white ${K()??""}`),m(O,E()),m(Q,M())}),v(z,_)}export{se as D}; +import{f as k,s as m,a as v,t as p}from"./ZGz3X54u.js";import"./CY7Wcm-1.js";import{c as a,s as f,r as i,t as g,n as H}from"./kDtaAWAK.js";import{p as t,i as u}from"./Cun6jNAp.js";import{s as Y,h as Z,B as j}from"./CYK-UalN.js";var $=k('
'),ee=k('
'),te=k('

');function se(z,e){let E=t(e,"title",8),M=t(e,"subtitle",8),y=t(e,"forgeIcon",8,""),h=t(e,"onEdit",8,null),x=t(e,"onDelete",8,null),B=t(e,"editLabel",8,"Edit"),C=t(e,"deleteLabel",8,"Delete"),P=t(e,"editVariant",8,"secondary"),A=t(e,"deleteVariant",8,"danger"),q=t(e,"editDisabled",8,!1),F=t(e,"deleteDisabled",8,!1),G=t(e,"editIcon",8,""),J=t(e,"deleteIcon",8,""),K=t(e,"titleClass",8,"");var _=te(),D=a(_),w=a(D),b=a(w),I=a(b);{var N=l=>{var r=$(),c=a(r);Z(c,y),i(r),v(l,r)};u(I,l=>{y()&&l(N)})}var L=f(I,2),o=a(L),O=a(o,!0);i(o);var V=f(o,2),Q=a(V,!0);i(V),i(L),i(b);var R=f(b,2);{var S=l=>{var r=ee(),c=a(r);{var T=d=>{j(d,{get variant(){return P()},size:"md",get disabled(){return q()},get icon(){return G()},$$events:{click(...s){h()?.apply(this,s)}},children:(s,X)=>{H();var n=p();g(()=>m(n,B())),v(s,n)},$$slots:{default:!0}})};u(c,d=>{h()&&d(T)})}var U=f(c,2);{var W=d=>{j(d,{get variant(){return A()},size:"md",get disabled(){return F()},get icon(){return J()},$$events:{click(...s){x()?.apply(this,s)}},children:(s,X)=>{H();var n=p();g(()=>m(n,C())),v(s,n)},$$slots:{default:!0}})};u(U,d=>{x()&&d(W)})}i(r),v(l,r)};u(R,l=>{(h()||x())&&l(S)})}i(w),i(D),i(_),g(()=>{Y(o,1,`text-2xl font-bold text-gray-900 dark:text-white ${K()??""}`),m(O,E()),m(Q,M())}),v(z,_)}export{se as D}; diff --git a/webapp/assets/_app/immutable/chunks/C6Z10Ipi.js b/webapp/assets/_app/immutable/chunks/C6-Yv_jr.js similarity index 99% rename from webapp/assets/_app/immutable/chunks/C6Z10Ipi.js rename to webapp/assets/_app/immutable/chunks/C6-Yv_jr.js index 2a295e3b..faaa19ce 100644 --- a/webapp/assets/_app/immutable/chunks/C6Z10Ipi.js +++ b/webapp/assets/_app/immutable/chunks/C6-Yv_jr.js @@ -1,4 +1,4 @@ -import{f,r as Ie,a as m,s as A,e as _e,t as Le}from"./ZGz3X54u.js";import{i as Ce}from"./CY7Wcm-1.js";import{p as ze,l as Me,d as o,m as p,h as J,b as Ee,c as t,s as a,g as e,r,t as M,a as Ue,v as Re,n as H,u as w,o as Be,k as Se,j as he}from"./kDtaAWAK.js";import{p as pe,i as B}from"./Cun6jNAp.js";import{c as Oe,s as Je,r as T,b as $e,g as De}from"./Cvcp5xHB.js";import{b as Ae,a as de}from"./CYnNqrHp.js";import{p as We}from"./CdEA5IGF.js";import{e as we}from"./BZiHL9L3.js";import{M as je}from"./C6jYEeWP.js";import{e as Ge,i as Te}from"./DdT9Vz5Q.js";var He=f('
'),Ne=f('
');function wt(le,P){ze(P,!1);let i=pe(P,"value",12,""),S=pe(P,"placeholder",8,"{}"),y=pe(P,"rows",8,4),x=pe(P,"disabled",8,!1),l=p(!0);Me(()=>J(i()),()=>{if(i().trim())try{JSON.parse(i()),o(l,!0)}catch{o(l,!1)}else o(l,!0)}),Ee(),Ce();var v=Ne(),s=t(v);Ie(s);var n=a(s,2);{var c=k=>{var O=He();m(k,O)};B(n,k=>{e(l)||k(c)})}r(v),M(()=>{Oe(s,"placeholder",S()),Oe(s,"rows",y()),s.disabled=x(),Je(s,1,`w-full px-3 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 font-mono text-sm resize-none +import{f,r as Ie,a as m,s as A,e as _e,t as Le}from"./ZGz3X54u.js";import{i as Ce}from"./CY7Wcm-1.js";import{p as ze,l as Me,d as o,m as p,h as J,b as Ee,c as t,s as a,g as e,r,t as M,a as Ue,v as Re,n as H,u as w,o as Be,k as Se,j as he}from"./kDtaAWAK.js";import{p as pe,i as B}from"./Cun6jNAp.js";import{c as Oe,s as Je,r as T,b as $e,g as De}from"./CYK-UalN.js";import{b as Ae,a as de}from"./CYnNqrHp.js";import{p as We}from"./CdEA5IGF.js";import{e as we}from"./BZiHL9L3.js";import{M as je}from"./CVBpH3Sf.js";import{e as Ge,i as Te}from"./DdT9Vz5Q.js";var He=f('
'),Ne=f('
');function wt(le,P){ze(P,!1);let i=pe(P,"value",12,""),S=pe(P,"placeholder",8,"{}"),y=pe(P,"rows",8,4),x=pe(P,"disabled",8,!1),l=p(!0);Me(()=>J(i()),()=>{if(i().trim())try{JSON.parse(i()),o(l,!0)}catch{o(l,!1)}else o(l,!0)}),Ee(),Ce();var v=Ne(),s=t(v);Ie(s);var n=a(s,2);{var c=k=>{var O=He();m(k,O)};B(n,k=>{e(l)||k(c)})}r(v),M(()=>{Oe(s,"placeholder",S()),Oe(s,"rows",y()),s.disabled=x(),Je(s,1,`w-full px-3 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 font-mono text-sm resize-none ${e(l)?"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white":"border-red-300 dark:border-red-600 bg-red-50 dark:bg-red-900/20 text-red-900 dark:text-red-100"} ${x()?"opacity-50 cursor-not-allowed":""} `)}),Ae(s,i),m(le,v),Ue()}var Ve=f('

'),Fe=f('

Leave empty to auto-generate a new secret

'),Ke=f('
Updating...
'),Qe=f('

Update Repository

Repository Information

Owner:
Name:
Endpoint:
Credentials:
');function Mt(le,P){ze(P,!1);let i=pe(P,"repository",8);const S=Re();let y=p(!1),x=p(""),l=p(""),v=p(!1),s=p(i().agent_mode??!1);async function n(){try{o(y,!0),o(x,"");const c={};if(e(v)){if(!e(l).trim()){o(x,"Please enter a webhook secret or uncheck the option to change it");return}c.webhook_secret=e(l)}if(e(s)!==i().agent_mode&&(c.agent_mode=e(s)),Object.keys(c).length===0){S("close");return}S("submit",c)}catch(c){o(x,we(c))}finally{o(y,!1)}}Ce(),je(le,{$$events:{close:()=>S("close")},children:(c,k)=>{var O=Qe(),ne=t(O),$=a(t(ne),2),z=t($);r($),r(ne);var Q=a(ne,2),q=t(Q);{var X=u=>{var d=Ve(),g=t(d),U=t(g,!0);r(g),r(d),M(()=>A(U,e(x))),m(u,d)};B(q,u=>{e(x)&&u(X)})}var Y=a(q,2),ie=a(t(Y),2),N=t(ie),ce=a(t(N),2),ke=t(ce,!0);r(ce),r(N);var be=a(N,2),me=a(t(be),2),E=t(me,!0);r(me),r(be);var b=a(be,2),h=a(t(b),2),R=t(h,!0);r(h),r(b);var W=a(b,2),Z=a(t(W),2),ue=t(Z,!0);r(Z),r(W),r(ie),r(Y);var I=a(Y,2),ee=t(I);T(ee),H(4),r(I);var L=a(I,2),D=t(L),V=t(D);T(V),H(2),r(D);var te=a(D,2);{var F=u=>{var d=Fe(),g=a(t(d),2);T(g),H(2),r(d),M(()=>g.required=e(v)),Ae(g,()=>e(l),U=>o(l,U)),m(u,d)};B(te,u=>{e(v)&&u(F)})}r(L);var re=a(L,2),ae=t(re),K=a(ae,2),ve=t(K);{var fe=u=>{var d=Ke();m(u,d)},ge=u=>{var d=Le("Update Repository");m(u,d)};B(ve,u=>{e(y)?u(fe):u(ge,!1)})}r(K),r(re),r(Q),r(O),M(u=>{A(z,`${J(i()),w(()=>i().owner)??""}/${J(i()),w(()=>i().name)??""}`),A(ke,(J(i()),w(()=>i().owner))),A(E,(J(i()),w(()=>i().name))),A(R,(J(i()),w(()=>i().endpoint?.name))),A(ue,(J(i()),w(()=>i().credentials_name))),K.disabled=u},[()=>(e(y),e(v),e(l),w(()=>e(y)||e(v)&&!e(l).trim()))]),de(ee,()=>e(s),u=>o(s,u)),de(V,()=>e(v),u=>o(v,u)),_e("click",ae,()=>S("close")),_e("submit",Q,We(n)),m(c,O)},$$slots:{default:!0}}),Ue()}var Xe=f('

'),Ye=f('

Loading...

'),Ze=f(""),et=f(''),tt=f('

A new webhook secret will be automatically generated

'),rt=f('
'),at=f('

'),ot=f('

Update Organization

');function St(le,P){ze(P,!1);const i=p(),S=p();let y=pe(P,"organization",8);const x=Re();let l=p(!1),v=p(""),s=p([]),n=p({credentials_name:y().credentials_name||"",webhook_secret:"",pool_balancer_type:y().pool_balancing_type||"roundrobin"}),c=p(!1),k=p(!0),O=p(y().agent_mode??!1);async function ne(){try{o(l,!0),o(s,await De.listAllCredentials())}catch(z){o(v,we(z))}finally{o(l,!1)}}async function $(){if(!e(n).credentials_name){o(v,"Please select credentials");return}if(e(c)&&!e(k)&&!e(n).webhook_secret?.trim()){o(v,"Please enter a webhook secret or uncheck the change webhook secret option");return}try{o(l,!0),o(v,"");const z={...e(n)};e(c)?e(k)&&(z.webhook_secret=""):delete z.webhook_secret,e(O)!==y().agent_mode&&(z.agent_mode=e(O)),x("submit",z)}catch(z){o(v,we(z)),o(l,!1)}}Be(()=>{ne()}),Me(()=>J(y()),()=>{o(i,y().endpoint?.endpoint_type)}),Me(()=>(e(s),e(i)),()=>{o(S,e(s).filter(z=>z.forge_type===e(i)))}),Ee(),Ce(),je(le,{$$events:{close:()=>x("close")},children:(z,Q)=>{var q=ot(),X=t(q),Y=a(t(X),2),ie=t(Y,!0);r(Y),r(X);var N=a(X,2),ce=t(N);{var ke=b=>{var h=Xe(),R=t(h),W=t(R,!0);r(R),r(h),M(()=>A(W,e(v))),m(b,h)};B(ce,b=>{e(v)&&b(ke)})}var be=a(ce,2);{var me=b=>{var h=Ye();m(b,h)},E=b=>{var h=at(),R=t(h),W=a(t(R),2);M(()=>{e(n),Se(()=>{e(S)})});var Z=t(W);Z.value=Z.__value="";var ue=a(Z);Ge(ue,1,()=>e(S),Te,(_,C)=>{var G=Ze(),xe=t(G);r(G);var j={};M(()=>{A(xe,`${e(C),w(()=>e(C).name)??""} (${e(C),w(()=>e(C).endpoint?.name||"Unknown endpoint")??""})`),j!==(j=(e(C),w(()=>e(C).name)))&&(G.value=(G.__value=(e(C),w(()=>e(C).name)))??"")}),m(_,G)}),r(W);var I=a(W,2),ee=t(I);r(I),r(R);var L=a(R,2),D=a(t(L),2);M(()=>{e(n),Se(()=>{})});var V=t(D);V.value=V.__value="roundrobin";var te=a(V);te.value=te.__value="pack",r(D),r(L);var F=a(L,2),re=t(F);T(re),H(4),r(F);var ae=a(F,2),K=t(ae),ve=t(K);T(ve),H(2),r(K);var fe=a(K,2);{var ge=_=>{var C=rt(),G=t(C),xe=t(G);T(xe),H(2),r(G);var j=a(G,2);{var oe=se=>{var ye=et();T(ye),M(()=>ye.required=e(c)&&!e(k)),Ae(ye,()=>e(n).webhook_secret,qe=>he(n,e(n).webhook_secret=qe)),m(se,ye)},Pe=se=>{var ye=tt();m(se,ye)};B(j,se=>{e(k)?se(Pe,!1):se(oe)})}r(C),de(xe,()=>e(k),se=>o(k,se)),m(_,C)};B(fe,_=>{e(c)&&_(ge)})}r(ae);var u=a(ae,2),d=t(u),g=a(d,2),U=t(g,!0);r(g),r(u),r(h),M(_=>{A(ee,`Only showing credentials for ${e(i)??""} endpoints`),g.disabled=_,A(U,e(l)?"Updating...":"Update Organization")},[()=>(e(l),e(c),e(k),e(n),w(()=>e(l)||e(c)&&!e(k)&&!e(n).webhook_secret?.trim()))]),$e(W,()=>e(n).credentials_name,_=>he(n,e(n).credentials_name=_)),$e(D,()=>e(n).pool_balancer_type,_=>he(n,e(n).pool_balancer_type=_)),de(re,()=>e(O),_=>o(O,_)),de(ve,()=>e(c),_=>o(c,_)),_e("click",d,()=>x("close")),_e("submit",h,We($)),m(b,h)};B(be,b=>{e(l)?b(me):b(E,!1)})}r(N),r(q),M(()=>A(ie,(J(y()),w(()=>y().name)))),m(z,q)},$$slots:{default:!0}}),Ue()}var st=f('

'),dt=f('

Loading...

'),lt=f(""),nt=f(''),it=f('

A new webhook secret will be automatically generated

'),ct=f('
'),bt=f('

Only showing credentials for GitHub endpoints

'),ut=f('

Update Enterprise

');function $t(le,P){ze(P,!1);const i=p();let S=pe(P,"enterprise",8);const y=Re();let x=p(!1),l=p(""),v=p([]),s=p({credentials_name:S().credentials_name||"",webhook_secret:"",pool_balancer_type:S().pool_balancing_type||"roundrobin"}),n=p(!1),c=p(!0),k=p(S().agent_mode??!1);async function O(){try{o(x,!0),o(v,await De.listAllCredentials())}catch($){o(l,we($))}finally{o(x,!1)}}async function ne(){if(!e(s).credentials_name){o(l,"Please select credentials");return}if(e(n)&&!e(c)&&!e(s).webhook_secret?.trim()){o(l,"Please enter a webhook secret or uncheck the change webhook secret option");return}try{o(x,!0),o(l,"");const $={...e(s)};e(n)?e(c)&&($.webhook_secret=""):delete $.webhook_secret,e(k)!==S().agent_mode&&($.agent_mode=e(k)),y("submit",$)}catch($){o(l,we($)),o(x,!1)}}Be(()=>{O()}),Me(()=>e(v),()=>{o(i,e(v).filter($=>$.forge_type==="github"))}),Ee(),Ce(),je(le,{$$events:{close:()=>y("close")},children:($,z)=>{var Q=ut(),q=t(Q),X=a(t(q),2),Y=t(X,!0);r(X),r(q);var ie=a(q,2),N=t(ie);{var ce=E=>{var b=st(),h=t(b),R=t(h,!0);r(h),r(b),M(()=>A(R,e(l))),m(E,b)};B(N,E=>{e(l)&&E(ce)})}var ke=a(N,2);{var be=E=>{var b=dt();m(E,b)},me=E=>{var b=bt(),h=t(b),R=a(t(h),2);M(()=>{e(s),Se(()=>{e(i)})});var W=t(R);W.value=W.__value="";var Z=a(W);Ge(Z,1,()=>e(i),Te,(d,g)=>{var U=lt(),_=t(U);r(U);var C={};M(()=>{A(_,`${e(g),w(()=>e(g).name)??""} (${e(g),w(()=>e(g).endpoint?.name||"Unknown endpoint")??""})`),C!==(C=(e(g),w(()=>e(g).name)))&&(U.value=(U.__value=(e(g),w(()=>e(g).name)))??"")}),m(d,U)}),r(R),H(2),r(h);var ue=a(h,2),I=a(t(ue),2);M(()=>{e(s),Se(()=>{})});var ee=t(I);ee.value=ee.__value="roundrobin";var L=a(ee);L.value=L.__value="pack",r(I),r(ue);var D=a(ue,2),V=t(D);T(V),H(4),r(D);var te=a(D,2),F=t(te),re=t(F);T(re),H(2),r(F);var ae=a(F,2);{var K=d=>{var g=ct(),U=t(g),_=t(U);T(_),H(2),r(U);var C=a(U,2);{var G=j=>{var oe=nt();T(oe),M(()=>oe.required=e(n)&&!e(c)),Ae(oe,()=>e(s).webhook_secret,Pe=>he(s,e(s).webhook_secret=Pe)),m(j,oe)},xe=j=>{var oe=it();m(j,oe)};B(C,j=>{e(c)?j(xe,!1):j(G)})}r(g),de(_,()=>e(c),j=>o(c,j)),m(d,g)};B(ae,d=>{e(n)&&d(K)})}r(te);var ve=a(te,2),fe=t(ve),ge=a(fe,2),u=t(ge,!0);r(ge),r(ve),r(b),M(d=>{ge.disabled=d,A(u,e(x)?"Updating...":"Update Enterprise")},[()=>(e(x),e(n),e(c),e(s),w(()=>e(x)||e(n)&&!e(c)&&!e(s).webhook_secret?.trim()))]),$e(R,()=>e(s).credentials_name,d=>he(s,e(s).credentials_name=d)),$e(I,()=>e(s).pool_balancer_type,d=>he(s,e(s).pool_balancer_type=d)),de(V,()=>e(k),d=>o(k,d)),de(re,()=>e(n),d=>o(n,d)),_e("click",fe,()=>y("close")),_e("submit",b,We(ne)),m(E,b)};B(ke,E=>{e(x)?E(be):E(me,!1)})}r(ie),r(Q),M(()=>A(Y,(J(S()),w(()=>S().name)))),m($,Q)},$$slots:{default:!0}}),Ue()}export{wt as J,Mt as U,St as a,$t as b}; diff --git a/webapp/assets/_app/immutable/chunks/BaTN8n88.js b/webapp/assets/_app/immutable/chunks/C681KorI.js similarity index 98% rename from webapp/assets/_app/immutable/chunks/BaTN8n88.js rename to webapp/assets/_app/immutable/chunks/C681KorI.js index fb5ad495..1d3fa5d5 100644 --- a/webapp/assets/_app/immutable/chunks/BaTN8n88.js +++ b/webapp/assets/_app/immutable/chunks/C681KorI.js @@ -1 +1 @@ -import{f as p,a as l,c as T,t as D,s as B}from"./ZGz3X54u.js";import{i as ae}from"./CY7Wcm-1.js";import{p as se,v as re,l as V,h as ie,d as r,g as t,m as y,b as le,c as v,s as F,r as f,a as oe,f as N,n as q,t as R,u as ne}from"./kDtaAWAK.js";import{p as A,i as m}from"./Cun6jNAp.js";import{g as h,B as G}from"./Cvcp5xHB.js";import{t as k}from"./BVGCMSWJ.js";import{e as de}from"./BZiHL9L3.js";var ce=p('
Checking...
'),ve=p('
'),fe=p('
Webhook installed
',1),he=p('
No webhook installed
'),ue=p('

Webhook Status

');function _e(H,g){se(g,!1);const x=y();let u=A(g,"entityType",8),s=A(g,"entityId",8),E=A(g,"entityName",8),i=y(null),o=y(!1),b=y(!0);const O=re();async function _(){if(s())try{r(b,!0),u()==="repository"?r(i,await h.getRepositoryWebhookInfo(s())):r(i,await h.getOrganizationWebhookInfo(s()))}catch(e){e&&typeof e=="object"&&"response"in e&&e.response?.status===404?r(i,null):(console.warn("Failed to check webhook status:",e),r(i,null))}finally{r(b,!1)}}async function J(){if(s())try{r(o,!0),u()==="repository"?await h.installRepositoryWebhook(s()):await h.installOrganizationWebhook(s()),k.success("Webhook Installed",`Webhook for ${u()} ${E()} has been installed successfully.`),await _(),O("webhookStatusChanged",{installed:!0})}catch(e){k.error("Webhook Installation Failed",e instanceof Error?e.message:"Failed to install webhook.")}finally{r(o,!1)}}async function K(){if(s())try{r(o,!0),u()==="repository"?await h.uninstallRepositoryWebhook(s()):await h.uninstallOrganizationWebhook(s()),k.success("Webhook Uninstalled",`Webhook for ${u()} ${E()} has been uninstalled successfully.`),await _(),O("webhookStatusChanged",{installed:!1})}catch(e){k.error("Webhook Uninstall Failed",de(e))}finally{r(o,!1)}}V(()=>ie(s()),()=>{s()&&_()}),V(()=>t(i),()=>{r(x,t(i)&&t(i).active)}),le(),ae();var w=ue(),P=v(w),j=v(P),W=v(j),L=F(v(W),2),Q=v(L);{var X=e=>{var d=ce();l(e,d)},Y=e=>{var d=T(),I=N(d);{var z=a=>{var n=fe(),C=F(N(n),2);{var c=U=>{var $=ve(),te=v($);f($),R(()=>B(te,`URL: ${t(i),ne(()=>t(i).url||"N/A")??""}`)),l(U,$)};m(C,U=>{t(i)&&U(c)})}l(a,n)},S=a=>{var n=he();l(a,n)};m(I,a=>{t(x)?a(z):a(S,!1)},!0)}l(e,d)};m(Q,e=>{t(b)?e(X):e(Y,!1)})}f(L),f(W);var M=F(W,2),Z=v(M);{var ee=e=>{var d=T(),I=N(d);{var z=a=>{G(a,{variant:"danger",size:"sm",get disabled(){return t(o)},$$events:{click:K},children:(n,C)=>{q();var c=D();R(()=>B(c,t(o)?"Uninstalling...":"Uninstall")),l(n,c)},$$slots:{default:!0}})},S=a=>{G(a,{variant:"primary",size:"sm",get disabled(){return t(o)},$$events:{click:J},children:(n,C)=>{q();var c=D();R(()=>B(c,t(o)?"Installing...":"Install Webhook")),l(n,c)},$$slots:{default:!0}})};m(I,a=>{t(x)?a(z):a(S,!1)})}l(e,d)};m(Z,e=>{t(b)||e(ee)})}f(M),f(j),f(P),f(w),l(H,w),oe()}export{_e as W}; +import{f as p,a as l,c as T,t as D,s as B}from"./ZGz3X54u.js";import{i as ae}from"./CY7Wcm-1.js";import{p as se,v as re,l as V,h as ie,d as r,g as t,m as y,b as le,c as v,s as F,r as f,a as oe,f as N,n as q,t as R,u as ne}from"./kDtaAWAK.js";import{p as A,i as m}from"./Cun6jNAp.js";import{g as h,B as G}from"./CYK-UalN.js";import{t as k}from"./BVGCMSWJ.js";import{e as de}from"./BZiHL9L3.js";var ce=p('
Checking...
'),ve=p('
'),fe=p('
Webhook installed
',1),he=p('
No webhook installed
'),ue=p('

Webhook Status

');function _e(H,g){se(g,!1);const x=y();let u=A(g,"entityType",8),s=A(g,"entityId",8),E=A(g,"entityName",8),i=y(null),o=y(!1),b=y(!0);const O=re();async function _(){if(s())try{r(b,!0),u()==="repository"?r(i,await h.getRepositoryWebhookInfo(s())):r(i,await h.getOrganizationWebhookInfo(s()))}catch(e){e&&typeof e=="object"&&"response"in e&&e.response?.status===404?r(i,null):(console.warn("Failed to check webhook status:",e),r(i,null))}finally{r(b,!1)}}async function J(){if(s())try{r(o,!0),u()==="repository"?await h.installRepositoryWebhook(s()):await h.installOrganizationWebhook(s()),k.success("Webhook Installed",`Webhook for ${u()} ${E()} has been installed successfully.`),await _(),O("webhookStatusChanged",{installed:!0})}catch(e){k.error("Webhook Installation Failed",e instanceof Error?e.message:"Failed to install webhook.")}finally{r(o,!1)}}async function K(){if(s())try{r(o,!0),u()==="repository"?await h.uninstallRepositoryWebhook(s()):await h.uninstallOrganizationWebhook(s()),k.success("Webhook Uninstalled",`Webhook for ${u()} ${E()} has been uninstalled successfully.`),await _(),O("webhookStatusChanged",{installed:!1})}catch(e){k.error("Webhook Uninstall Failed",de(e))}finally{r(o,!1)}}V(()=>ie(s()),()=>{s()&&_()}),V(()=>t(i),()=>{r(x,t(i)&&t(i).active)}),le(),ae();var w=ue(),P=v(w),j=v(P),W=v(j),L=F(v(W),2),Q=v(L);{var X=e=>{var d=ce();l(e,d)},Y=e=>{var d=T(),I=N(d);{var z=a=>{var n=fe(),C=F(N(n),2);{var c=U=>{var $=ve(),te=v($);f($),R(()=>B(te,`URL: ${t(i),ne(()=>t(i).url||"N/A")??""}`)),l(U,$)};m(C,U=>{t(i)&&U(c)})}l(a,n)},S=a=>{var n=he();l(a,n)};m(I,a=>{t(x)?a(z):a(S,!1)},!0)}l(e,d)};m(Q,e=>{t(b)?e(X):e(Y,!1)})}f(L),f(W);var M=F(W,2),Z=v(M);{var ee=e=>{var d=T(),I=N(d);{var z=a=>{G(a,{variant:"danger",size:"sm",get disabled(){return t(o)},$$events:{click:K},children:(n,C)=>{q();var c=D();R(()=>B(c,t(o)?"Uninstalling...":"Uninstall")),l(n,c)},$$slots:{default:!0}})},S=a=>{G(a,{variant:"primary",size:"sm",get disabled(){return t(o)},$$events:{click:J},children:(n,C)=>{q();var c=D();R(()=>B(c,t(o)?"Installing...":"Install Webhook")),l(n,c)},$$slots:{default:!0}})};m(I,a=>{t(x)?a(z):a(S,!1)})}l(e,d)};m(Z,e=>{t(b)||e(ee)})}f(M),f(j),f(P),f(w),l(H,w),oe()}export{_e as W}; diff --git a/webapp/assets/_app/immutable/chunks/BU_V7FOQ.js b/webapp/assets/_app/immutable/chunks/C8dZhfFx.js similarity index 99% rename from webapp/assets/_app/immutable/chunks/BU_V7FOQ.js rename to webapp/assets/_app/immutable/chunks/C8dZhfFx.js index e4ec44e8..f5bbfaee 100644 --- a/webapp/assets/_app/immutable/chunks/BU_V7FOQ.js +++ b/webapp/assets/_app/immutable/chunks/C8dZhfFx.js @@ -1 +1 @@ -import{aF as G,w as tt,b4 as at}from"./kDtaAWAK.js";import{c as nt,H as j,N as H,r as he,i as pe,s as ae,p as R,n as ie,f as Ce,g as ce,a as z,b as oe,S as Ne,P as rt,d as xe,o as je,e as ot,m as st,h as it,j as q,k as ct,l as De,q as lt,t as ft,u as qe,v as ut}from"./8ZO9Ka4R.js";import{p as dt,e as ht,b as L}from"./CkTG2UXI.js";class _e{constructor(t,a){this.status=t,typeof a=="string"?this.body={message:a}:a?this.body=a:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class ge{constructor(t,a){this.status=t,this.location=a}}class me extends Error{constructor(t,a,n){super(n),this.status=t,this.text=a}}function pt({nodes:e,server_loads:t,dictionary:a,matchers:n}){const r=new Set(t);return Object.entries(a).map(([i,[c,f,_]])=>{const{pattern:g,params:u}=dt(i),l={id:i,exec:h=>{const v=g.exec(h);if(v)return ht(v,u,n)},errors:[1,..._||[]].map(h=>e[h]),layouts:[0,...f||[]].map(s),leaf:o(c)};return l.errors.length=l.layouts.length=Math.max(l.errors.length,l.layouts.length),l});function o(i){const c=i<0;return c&&(i=~i),[c,e[i]]}function s(i){return i===void 0?i:[r.has(i),e[i]]}}function Ke(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Pe(e,t,a=JSON.stringify){const n=a(t);try{sessionStorage[e]=n}catch{}}function _t(e){return e.filter(t=>t!=null)}function ve(e){return e instanceof _e||e instanceof me?e.status:500}function gt(e){return e instanceof me?e.text:"Internal Error"}const Ae={spanContext(){return mt},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},mt={traceId:"",spanId:"",traceFlags:0},vt=new Set(["icon","shortcut icon","apple-touch-icon"]),C=Ke(qe)??{},B=Ke(De)??{},I={url:xe({}),page:xe({}),navigating:tt(null),updated:nt()};function we(e){C[e]=ae()}function wt(e,t){let a=e+1;for(;C[a];)delete C[a],a+=1;for(a=t+1;B[a];)delete B[a],a+=1}function M(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function Fe(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(L||"/");e&&await e.update()}}function Ue(){}let ye,le,J,A,fe,w;const X=[],W=[];let x=null;function ue(){x?.fork?.then(e=>e?.discard()),x=null}const $=new Map,He=new Set,yt=new Set,F=new Set;let m={branch:[],error:null,url:null},Be=!1,Q=!1,Te=!0,V=!1,K=!1,Me=!1,be=!1,Ve,y,S,O;const Z=new Set,Ie=new Map;async function Kt(e,t,a){globalThis.__sveltekit_1p53tct?.data&&globalThis.__sveltekit_1p53tct.data,document.URL!==location.href&&(location.href=location.href),w=e,await e.hooks.init?.(),ye=pt(e),A=document.documentElement,fe=t,le=e.nodes[0],J=e.nodes[1],le(),J(),y=history.state?.[j],S=history.state?.[H],y||(y=S=Date.now(),history.replaceState({...history.state,[j]:y,[H]:S},""));const n=C[y];function r(){n&&(history.scrollRestoration="manual",scrollTo(n.x,n.y))}a?(r(),await It(fe,a)):(await D({type:"enter",url:he(w.hash?Nt(new URL(location.href)):location.href),replace_state:!0}),r()),Tt()}function bt(){X.length=0,be=!1}function Ye(e){W.some(t=>t?.snapshot)&&(B[e]=W.map(t=>t?.snapshot?.capture()))}function $e(e){B[e]?.forEach((t,a)=>{W[a]?.snapshot?.restore(t)})}function Oe(){we(y),Pe(qe,C),Ye(S),Pe(De,B)}async function Ge(e,t,a,n){let r;t.invalidateAll&&ue(),await D({type:"goto",url:he(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:a,nav_token:n,accept:()=>{t.invalidateAll&&(be=!0,r=[...Ie.keys()]),t.invalidate&&t.invalidate.forEach(Ut)}}),t.invalidateAll&&G().then(G).then(()=>{Ie.forEach(({resource:o},s)=>{r?.includes(s)&&o.refresh?.()})})}async function kt(e){if(e.id!==x?.id){ue();const t={};Z.add(t),x={id:e.id,token:t,promise:Xe({...e,preload:t}).then(a=>(Z.delete(t),a.type==="loaded"&&a.state.error&&ue(),a)),fork:null}}return x.promise}async function se(e){const t=(await ne(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].map(a=>a?.[1]()))}async function ze(e,t,a){m=e.state;const n=document.querySelector("style[data-sveltekit]");if(n&&n.remove(),Object.assign(R,e.props.page),Ve=new w.root({target:t,props:{...e.props,stores:I,components:W},hydrate:a,sync:!1}),await Promise.resolve(),$e(S),a){const r={from:null,to:{params:m.params,route:{id:m.route?.id??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};F.forEach(o=>o(r))}Q=!0}function ee({url:e,params:t,branch:a,status:n,error:r,route:o,form:s}){let i="never";if(L&&(e.pathname===L||e.pathname===L+"/"))i="always";else for(const l of a)l?.slash!==void 0&&(i=l.slash);e.pathname=it(e.pathname,i),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:a,error:r,route:o},props:{constructors:_t(a).map(l=>l.node.component),page:Le(R)}};s!==void 0&&(c.props.form=s);let f={},_=!R,g=0;for(let l=0;l(i&&(c.route=!0),u[l])}),params:new Proxy(n,{get:(u,l)=>(i&&c.params.add(l),u[l])}),data:o?.data??null,url:st(a,()=>{i&&(c.url=!0)},u=>{i&&c.search_params.add(u)},w.hash),async fetch(u,l){u instanceof Request&&(l={body:u.method==="GET"||u.method==="HEAD"?void 0:await u.blob(),cache:u.cache,credentials:u.credentials,headers:[...u.headers].length>0?u?.headers:void 0,integrity:u.integrity,keepalive:u.keepalive,method:u.method,mode:u.mode,redirect:u.redirect,referrer:u.referrer,referrerPolicy:u.referrerPolicy,signal:u.signal,...l});const{resolved:h,promise:v}=Je(u,l,a);return i&&_(h.href),v},setHeaders:()=>{},depends:_,parent(){return i&&(c.parent=!0),t()},untrack(u){i=!1;try{return u()}finally{i=!0}}};s=await f.universal.load.call(null,g)??null}return{node:f,loader:e,server:o,universal:f.universal?.load?{type:"data",data:s,uses:c}:null,data:s??o?.data??null,slash:f.universal?.trailingSlash??o?.slash}}function Je(e,t,a){let n=e instanceof Request?e.url:e;const r=new URL(n,a);r.origin===a.origin&&(n=r.href.slice(a.origin.length));const o=Q?lt(n,r.href,t):ft(n,t);return{resolved:r,promise:o}}function Et(e,t,a,n,r,o){if(be)return!0;if(!r)return!1;if(r.parent&&e||r.route&&t||r.url&&a)return!0;for(const s of r.search_params)if(n.has(s))return!0;for(const s of r.params)if(o[s]!==m.params[s])return!0;for(const s of r.dependencies)if(X.some(i=>i(new URL(s))))return!0;return!1}function Ee(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function St(e,t){if(!e)return new Set(t.searchParams.keys());const a=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const n of a){const r=e.searchParams.getAll(n),o=t.searchParams.getAll(n);r.every(s=>o.includes(s))&&o.every(s=>r.includes(s))&&a.delete(n)}return a}function Rt({error:e,url:t,route:a,params:n}){return{type:"loaded",state:{error:e,url:t,route:a,params:n,branch:[]},props:{page:Le(R),constructors:[]}}}async function Xe({id:e,invalidating:t,url:a,params:n,route:r,preload:o}){if(x?.id===e)return Z.delete(x.token),x.promise;const{errors:s,layouts:i,leaf:c}=r,f=[...i,c];s.forEach(p=>p?.().catch(()=>{})),f.forEach(p=>p?.[1]().catch(()=>{}));const _=m.url?e!==te(m.url):!1,g=m.route?r.id!==m.route.id:!1,u=St(m.url,a);let l=!1;const h=f.map(async(p,d)=>{if(!p)return;const k=m.branch[d];return p[1]===k?.loader&&!Et(l,g,_,u,k.universal?.uses,n)?k:(l=!0,ke({loader:p[1],url:a,params:n,route:r,parent:async()=>{const U={};for(let P=0;P{});const v=[];for(let p=0;pPromise.resolve({}),server_data_node:Ee(o)}),i={node:await J(),loader:J,universal:null,server:null,data:null};return ee({url:a,params:r,branch:[s,i],status:e,error:t,route:null})}catch(s){if(s instanceof ge)return Ge(new URL(s.location,location.href),{},0);throw s}}async function xt(e){const t=e.href;if($.has(t))return $.get(t);let a;try{const n=(async()=>{let r=await w.hooks.reroute({url:new URL(e),fetch:async(o,s)=>Je(o,s,e).promise})??e;if(typeof r=="string"){const o=new URL(e);w.hash?o.hash=r:o.pathname=r,r=o}return r})();$.set(t,n),a=await n}catch{$.delete(t);return}return a}async function ne(e,t){if(e&&!pe(e,L,w.hash)){const a=await xt(e);if(!a)return;const n=Pt(a);for(const r of ye){const o=r.exec(n);if(o)return{id:te(e),invalidating:t,route:r,params:ot(o),url:e}}}}function Pt(e){return ct(w.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(L.length))||"/"}function te(e){return(w.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function We({url:e,type:t,intent:a,delta:n,event:r}){let o=!1;const s=Re(m,a,e,t);n!==void 0&&(s.navigation.delta=n),r!==void 0&&(s.navigation.event=r);const i={...s.navigation,cancel:()=>{o=!0,s.reject(new Error("navigation cancelled"))}};return V||He.forEach(c=>c(i)),o?null:s}async function D({type:e,url:t,popped:a,keepfocus:n,noscroll:r,replace_state:o,state:s={},redirect_count:i=0,nav_token:c={},accept:f=Ue,block:_=Ue,event:g}){const u=O;O=c;const l=await ne(t,!1),h=e==="enter"?Re(m,l,t,e):We({url:t,type:e,delta:a?.delta,intent:l,event:g});if(!h){_(),O===c&&(O=u);return}const v=y,p=S;f(),V=!0,Q&&h.navigation.type!=="enter"&&I.navigating.set(ie.current=h.navigation);let d=l&&await Xe(l);if(!d){if(pe(t,L,w.hash))return await M(t,o);d=await Qe(t,{id:null},await Y(new me(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,o)}if(t=l?.url||t,O!==c)return h.reject(new Error("navigation aborted")),!1;if(d.type==="redirect"){if(i<20){await D({type:e,url:new URL(d.location,t),popped:a,keepfocus:n,noscroll:r,replace_state:o,state:s,redirect_count:i+1,nav_token:c}),h.fulfil(void 0);return}d=await Se({status:500,error:await Y(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else d.props.page.status>=400&&await I.updated.check()&&(await Fe(),await M(t,o));if(bt(),we(v),Ye(p),d.props.page.url.pathname!==t.pathname&&(t.pathname=d.props.page.url.pathname),s=a?a.state:s,!a){const b=o?0:1,N={[j]:y+=b,[H]:S+=b,[Ne]:s};(o?history.replaceState:history.pushState).call(history,N,"",t),o||wt(y,S)}const k=l&&x?.id===l.id?x.fork:null;x=null,d.props.page.state=s;let E;if(Q){const b=(await Promise.all(Array.from(yt,T=>T(h.navigation)))).filter(T=>typeof T=="function");if(b.length>0){let T=function(){b.forEach(re=>{F.delete(re)})};b.push(T),b.forEach(re=>{F.add(re)})}m=d.state,d.props.page&&(d.props.page.url=t);const N=k&&await k;N?E=N.commit():(Ve.$set(d.props),ut(d.props.page),E=at?.()),Me=!0}else await ze(d,fe,!1);const{activeElement:U}=document;await E,await G(),await G();let P=a?a.scroll:r?ae():null;if(Te){const b=t.hash&&document.getElementById(Ze(t));if(P)scrollTo(P.x,P.y);else if(b){b.scrollIntoView();const{top:N,left:T}=b.getBoundingClientRect();P={x:pageXOffset+T,y:pageYOffset+N}}else scrollTo(0,0)}const et=document.activeElement!==U&&document.activeElement!==document.body;!n&&!et&&Ct(t,P),Te=!0,d.props.page&&Object.assign(R,d.props.page),V=!1,e==="popstate"&&$e(S),h.fulfil(void 0),F.forEach(b=>b(h.navigation)),I.navigating.set(ie.current=null)}async function Qe(e,t,a,n,r){return e.origin===je&&e.pathname===location.pathname&&!Be?await Se({status:n,error:a,url:e,route:t}):await M(e,r)}function At(){let e,t={element:void 0,href:void 0},a;A.addEventListener("mousemove",i=>{const c=i.target;clearTimeout(e),e=setTimeout(()=>{o(c,q.hover)},20)});function n(i){i.defaultPrevented||o(i.composedPath()[0],q.tap)}A.addEventListener("mousedown",n),A.addEventListener("touchstart",n,{passive:!0});const r=new IntersectionObserver(i=>{for(const c of i)c.isIntersecting&&(se(new URL(c.target.href)),r.unobserve(c.target))},{threshold:0});async function o(i,c){const f=Ce(i,A),_=f===t.element&&f?.href===t.href&&c>=a;if(!f||_)return;const{url:g,external:u,download:l}=ce(f,L,w.hash);if(u||l)return;const h=z(f),v=g&&te(m.url)===te(g);if(!(h.reload||v))if(c<=h.preload_data){t={element:f,href:f.href},a=q.tap;const p=await ne(g,!1);if(!p)return;kt(p)}else c<=h.preload_code&&(t={element:f,href:f.href},a=c,se(g))}function s(){r.disconnect();for(const i of A.querySelectorAll("a")){const{url:c,external:f,download:_}=ce(i,L,w.hash);if(f||_)continue;const g=z(i);g.reload||(g.preload_code===q.viewport&&r.observe(i),g.preload_code===q.eager&&se(c))}}F.add(s),s()}function Y(e,t){if(e instanceof _e)return e.body;const a=ve(e),n=gt(e);return w.hooks.handleError({error:e,event:t,status:a,message:n})??{message:n}}function Ft(e,t={}){return e=new URL(he(e)),e.origin!==je?Promise.reject(new Error("goto: invalid URL")):Ge(e,t,0)}function Ut(e){if(typeof e=="function")X.push(e);else{const{href:t}=new URL(e,location.href);X.push(a=>a.href===t)}}function Tt(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let a=!1;if(Oe(),!V){const n=Re(m,void 0,null,"leave"),r={...n.navigation,cancel:()=>{a=!0,n.reject(new Error("navigation cancelled"))}};He.forEach(o=>o(r))}a?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Oe()}),navigator.connection?.saveData||At(),A.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const a=Ce(t.composedPath()[0],A);if(!a)return;const{url:n,external:r,target:o,download:s}=ce(a,L,w.hash);if(!n)return;if(o==="_parent"||o==="_top"){if(window.parent!==window)return}else if(o&&o!=="_self")return;const i=z(a);if(!(a instanceof SVGAElement)&&n.protocol!==location.protocol&&!(n.protocol==="https:"||n.protocol==="http:")||s)return;const[f,_]=(w.hash?n.hash.replace(/^#/,""):n.href).split("#"),g=f===oe(location);if(r||i.reload&&(!g||!_)){We({url:n,type:"link",event:t})?V=!0:t.preventDefault();return}if(_!==void 0&&g){const[,u]=m.url.href.split("#");if(u===_){if(t.preventDefault(),_===""||_==="top"&&a.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const l=a.ownerDocument.getElementById(decodeURIComponent(_));l&&(l.scrollIntoView(),l.focus())}return}if(K=!0,we(y),e(n),!i.replace_state)return;K=!1}t.preventDefault(),await new Promise(u=>{requestAnimationFrame(()=>{setTimeout(u,0)}),setTimeout(u,100)}),await D({type:"link",url:n,keepfocus:i.keepfocus,noscroll:i.noscroll,replace_state:i.replace_state??n.href===location.href,event:t})}),A.addEventListener("submit",t=>{if(t.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(t.target),n=t.submitter;if((n?.formTarget||a.target)==="_blank"||(n?.formMethod||a.method)!=="get")return;const s=new URL(n?.hasAttribute("formaction")&&n?.formAction||a.action);if(pe(s,L,!1))return;const i=t.target,c=z(i);if(c.reload)return;t.preventDefault(),t.stopPropagation();const f=new FormData(i,n);s.search=new URLSearchParams(f).toString(),D({type:"form",url:s,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??s.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!de){if(t.state?.[j]){const a=t.state[j];if(O={},a===y)return;const n=C[a],r=t.state[Ne]??{},o=new URL(t.state[rt]??location.href),s=t.state[H],i=m.url?oe(location)===oe(m.url):!1;if(s===S&&(Me||i)){r!==R.state&&(R.state=r),e(o),C[y]=ae(),n&&scrollTo(n.x,n.y),y=a;return}const f=a-y;await D({type:"popstate",url:o,popped:{state:r,scroll:n,delta:f},accept:()=>{y=a,S=s},block:()=>{history.go(-f)},nav_token:O,event:t})}else if(!K){const a=new URL(location.href);e(a),w.hash&&location.reload()}}}),addEventListener("hashchange",()=>{K&&(K=!1,history.replaceState({...history.state,[j]:++y,[H]:S},"",location.href))});for(const t of document.querySelectorAll("link"))vt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&I.navigating.set(ie.current=null)});function e(t){m.url=R.url=t,I.page.set(Le(R)),I.page.notify()}}async function It(e,{status:t=200,error:a,node_ids:n,params:r,route:o,server_route:s,data:i,form:c}){Be=!0;const f=new URL(location.href);let _;({params:r={},route:o={id:null}}=await ne(f,!1)||{}),_=ye.find(({id:l})=>l===o.id);let g,u=!0;try{const l=n.map(async(v,p)=>{const d=i[p];return d?.uses&&(d.uses=Ot(d.uses)),ke({loader:w.nodes[v],url:f,params:r,route:o,parent:async()=>{const k={};for(let E=0;E{const i=history.state;de=!0,location.replace(`#${n}`),w.hash&&location.replace(e.hash),history.replaceState(i,"",e.hash),scrollTo(o,s),de=!1})}else{const o=document.body,s=o.getAttribute("tabindex");o.tabIndex=-1,o.focus({preventScroll:!0,focusVisible:!1}),s!==null?o.setAttribute("tabindex",s):o.removeAttribute("tabindex")}const r=getSelection();if(r&&r.type!=="None"){const o=[];for(let s=0;s{if(r.rangeCount===o.length){for(let s=0;s{r=c,o=f});return s.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url},to:a&&{params:t?.params??null,route:{id:t?.route?.id??null},url:a},willUnload:!t,type:n,complete:s},fulfil:r,reject:o}}function Le(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function Nt(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function Ze(e){let t;if(w.hash){const[,,a]=e.hash.split("#",3);t=a??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{Kt as a,Ft as g,I as s}; +import{aF as G,w as tt,b4 as at}from"./kDtaAWAK.js";import{c as nt,H as j,N as H,r as he,i as pe,s as ae,p as R,n as ie,f as Ce,g as ce,a as z,b as oe,S as Ne,P as rt,d as xe,o as je,e as ot,m as st,h as it,j as q,k as ct,l as De,q as lt,t as ft,u as qe,v as ut}from"./DR0xnkWv.js";import{p as dt,e as ht,b as L}from"./DWgB-t1g.js";class _e{constructor(t,a){this.status=t,typeof a=="string"?this.body={message:a}:a?this.body=a:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class ge{constructor(t,a){this.status=t,this.location=a}}class me extends Error{constructor(t,a,n){super(n),this.status=t,this.text=a}}function pt({nodes:e,server_loads:t,dictionary:a,matchers:n}){const r=new Set(t);return Object.entries(a).map(([i,[c,f,_]])=>{const{pattern:g,params:u}=dt(i),l={id:i,exec:h=>{const v=g.exec(h);if(v)return ht(v,u,n)},errors:[1,..._||[]].map(h=>e[h]),layouts:[0,...f||[]].map(s),leaf:o(c)};return l.errors.length=l.layouts.length=Math.max(l.errors.length,l.layouts.length),l});function o(i){const c=i<0;return c&&(i=~i),[c,e[i]]}function s(i){return i===void 0?i:[r.has(i),e[i]]}}function Ke(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Pe(e,t,a=JSON.stringify){const n=a(t);try{sessionStorage[e]=n}catch{}}function _t(e){return e.filter(t=>t!=null)}function ve(e){return e instanceof _e||e instanceof me?e.status:500}function gt(e){return e instanceof me?e.text:"Internal Error"}const Ae={spanContext(){return mt},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},mt={traceId:"",spanId:"",traceFlags:0},vt=new Set(["icon","shortcut icon","apple-touch-icon"]),C=Ke(qe)??{},B=Ke(De)??{},I={url:xe({}),page:xe({}),navigating:tt(null),updated:nt()};function we(e){C[e]=ae()}function wt(e,t){let a=e+1;for(;C[a];)delete C[a],a+=1;for(a=t+1;B[a];)delete B[a],a+=1}function M(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function Fe(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(L||"/");e&&await e.update()}}function Ue(){}let ye,le,J,A,fe,w;const X=[],W=[];let x=null;function ue(){x?.fork?.then(e=>e?.discard()),x=null}const $=new Map,He=new Set,yt=new Set,F=new Set;let m={branch:[],error:null,url:null},Be=!1,Q=!1,Te=!0,V=!1,K=!1,Me=!1,be=!1,Ve,y,S,O;const Z=new Set,Ie=new Map;async function Kt(e,t,a){globalThis.__sveltekit_1o53hto?.data&&globalThis.__sveltekit_1o53hto.data,document.URL!==location.href&&(location.href=location.href),w=e,await e.hooks.init?.(),ye=pt(e),A=document.documentElement,fe=t,le=e.nodes[0],J=e.nodes[1],le(),J(),y=history.state?.[j],S=history.state?.[H],y||(y=S=Date.now(),history.replaceState({...history.state,[j]:y,[H]:S},""));const n=C[y];function r(){n&&(history.scrollRestoration="manual",scrollTo(n.x,n.y))}a?(r(),await It(fe,a)):(await D({type:"enter",url:he(w.hash?Nt(new URL(location.href)):location.href),replace_state:!0}),r()),Tt()}function bt(){X.length=0,be=!1}function Ye(e){W.some(t=>t?.snapshot)&&(B[e]=W.map(t=>t?.snapshot?.capture()))}function $e(e){B[e]?.forEach((t,a)=>{W[a]?.snapshot?.restore(t)})}function Oe(){we(y),Pe(qe,C),Ye(S),Pe(De,B)}async function Ge(e,t,a,n){let r;t.invalidateAll&&ue(),await D({type:"goto",url:he(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:a,nav_token:n,accept:()=>{t.invalidateAll&&(be=!0,r=[...Ie.keys()]),t.invalidate&&t.invalidate.forEach(Ut)}}),t.invalidateAll&&G().then(G).then(()=>{Ie.forEach(({resource:o},s)=>{r?.includes(s)&&o.refresh?.()})})}async function kt(e){if(e.id!==x?.id){ue();const t={};Z.add(t),x={id:e.id,token:t,promise:Xe({...e,preload:t}).then(a=>(Z.delete(t),a.type==="loaded"&&a.state.error&&ue(),a)),fork:null}}return x.promise}async function se(e){const t=(await ne(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].map(a=>a?.[1]()))}async function ze(e,t,a){m=e.state;const n=document.querySelector("style[data-sveltekit]");if(n&&n.remove(),Object.assign(R,e.props.page),Ve=new w.root({target:t,props:{...e.props,stores:I,components:W},hydrate:a,sync:!1}),await Promise.resolve(),$e(S),a){const r={from:null,to:{params:m.params,route:{id:m.route?.id??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};F.forEach(o=>o(r))}Q=!0}function ee({url:e,params:t,branch:a,status:n,error:r,route:o,form:s}){let i="never";if(L&&(e.pathname===L||e.pathname===L+"/"))i="always";else for(const l of a)l?.slash!==void 0&&(i=l.slash);e.pathname=it(e.pathname,i),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:a,error:r,route:o},props:{constructors:_t(a).map(l=>l.node.component),page:Le(R)}};s!==void 0&&(c.props.form=s);let f={},_=!R,g=0;for(let l=0;l(i&&(c.route=!0),u[l])}),params:new Proxy(n,{get:(u,l)=>(i&&c.params.add(l),u[l])}),data:o?.data??null,url:st(a,()=>{i&&(c.url=!0)},u=>{i&&c.search_params.add(u)},w.hash),async fetch(u,l){u instanceof Request&&(l={body:u.method==="GET"||u.method==="HEAD"?void 0:await u.blob(),cache:u.cache,credentials:u.credentials,headers:[...u.headers].length>0?u?.headers:void 0,integrity:u.integrity,keepalive:u.keepalive,method:u.method,mode:u.mode,redirect:u.redirect,referrer:u.referrer,referrerPolicy:u.referrerPolicy,signal:u.signal,...l});const{resolved:h,promise:v}=Je(u,l,a);return i&&_(h.href),v},setHeaders:()=>{},depends:_,parent(){return i&&(c.parent=!0),t()},untrack(u){i=!1;try{return u()}finally{i=!0}}};s=await f.universal.load.call(null,g)??null}return{node:f,loader:e,server:o,universal:f.universal?.load?{type:"data",data:s,uses:c}:null,data:s??o?.data??null,slash:f.universal?.trailingSlash??o?.slash}}function Je(e,t,a){let n=e instanceof Request?e.url:e;const r=new URL(n,a);r.origin===a.origin&&(n=r.href.slice(a.origin.length));const o=Q?lt(n,r.href,t):ft(n,t);return{resolved:r,promise:o}}function Et(e,t,a,n,r,o){if(be)return!0;if(!r)return!1;if(r.parent&&e||r.route&&t||r.url&&a)return!0;for(const s of r.search_params)if(n.has(s))return!0;for(const s of r.params)if(o[s]!==m.params[s])return!0;for(const s of r.dependencies)if(X.some(i=>i(new URL(s))))return!0;return!1}function Ee(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function St(e,t){if(!e)return new Set(t.searchParams.keys());const a=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const n of a){const r=e.searchParams.getAll(n),o=t.searchParams.getAll(n);r.every(s=>o.includes(s))&&o.every(s=>r.includes(s))&&a.delete(n)}return a}function Rt({error:e,url:t,route:a,params:n}){return{type:"loaded",state:{error:e,url:t,route:a,params:n,branch:[]},props:{page:Le(R),constructors:[]}}}async function Xe({id:e,invalidating:t,url:a,params:n,route:r,preload:o}){if(x?.id===e)return Z.delete(x.token),x.promise;const{errors:s,layouts:i,leaf:c}=r,f=[...i,c];s.forEach(p=>p?.().catch(()=>{})),f.forEach(p=>p?.[1]().catch(()=>{}));const _=m.url?e!==te(m.url):!1,g=m.route?r.id!==m.route.id:!1,u=St(m.url,a);let l=!1;const h=f.map(async(p,d)=>{if(!p)return;const k=m.branch[d];return p[1]===k?.loader&&!Et(l,g,_,u,k.universal?.uses,n)?k:(l=!0,ke({loader:p[1],url:a,params:n,route:r,parent:async()=>{const U={};for(let P=0;P{});const v=[];for(let p=0;pPromise.resolve({}),server_data_node:Ee(o)}),i={node:await J(),loader:J,universal:null,server:null,data:null};return ee({url:a,params:r,branch:[s,i],status:e,error:t,route:null})}catch(s){if(s instanceof ge)return Ge(new URL(s.location,location.href),{},0);throw s}}async function xt(e){const t=e.href;if($.has(t))return $.get(t);let a;try{const n=(async()=>{let r=await w.hooks.reroute({url:new URL(e),fetch:async(o,s)=>Je(o,s,e).promise})??e;if(typeof r=="string"){const o=new URL(e);w.hash?o.hash=r:o.pathname=r,r=o}return r})();$.set(t,n),a=await n}catch{$.delete(t);return}return a}async function ne(e,t){if(e&&!pe(e,L,w.hash)){const a=await xt(e);if(!a)return;const n=Pt(a);for(const r of ye){const o=r.exec(n);if(o)return{id:te(e),invalidating:t,route:r,params:ot(o),url:e}}}}function Pt(e){return ct(w.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(L.length))||"/"}function te(e){return(w.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function We({url:e,type:t,intent:a,delta:n,event:r}){let o=!1;const s=Re(m,a,e,t);n!==void 0&&(s.navigation.delta=n),r!==void 0&&(s.navigation.event=r);const i={...s.navigation,cancel:()=>{o=!0,s.reject(new Error("navigation cancelled"))}};return V||He.forEach(c=>c(i)),o?null:s}async function D({type:e,url:t,popped:a,keepfocus:n,noscroll:r,replace_state:o,state:s={},redirect_count:i=0,nav_token:c={},accept:f=Ue,block:_=Ue,event:g}){const u=O;O=c;const l=await ne(t,!1),h=e==="enter"?Re(m,l,t,e):We({url:t,type:e,delta:a?.delta,intent:l,event:g});if(!h){_(),O===c&&(O=u);return}const v=y,p=S;f(),V=!0,Q&&h.navigation.type!=="enter"&&I.navigating.set(ie.current=h.navigation);let d=l&&await Xe(l);if(!d){if(pe(t,L,w.hash))return await M(t,o);d=await Qe(t,{id:null},await Y(new me(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,o)}if(t=l?.url||t,O!==c)return h.reject(new Error("navigation aborted")),!1;if(d.type==="redirect"){if(i<20){await D({type:e,url:new URL(d.location,t),popped:a,keepfocus:n,noscroll:r,replace_state:o,state:s,redirect_count:i+1,nav_token:c}),h.fulfil(void 0);return}d=await Se({status:500,error:await Y(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else d.props.page.status>=400&&await I.updated.check()&&(await Fe(),await M(t,o));if(bt(),we(v),Ye(p),d.props.page.url.pathname!==t.pathname&&(t.pathname=d.props.page.url.pathname),s=a?a.state:s,!a){const b=o?0:1,N={[j]:y+=b,[H]:S+=b,[Ne]:s};(o?history.replaceState:history.pushState).call(history,N,"",t),o||wt(y,S)}const k=l&&x?.id===l.id?x.fork:null;x=null,d.props.page.state=s;let E;if(Q){const b=(await Promise.all(Array.from(yt,T=>T(h.navigation)))).filter(T=>typeof T=="function");if(b.length>0){let T=function(){b.forEach(re=>{F.delete(re)})};b.push(T),b.forEach(re=>{F.add(re)})}m=d.state,d.props.page&&(d.props.page.url=t);const N=k&&await k;N?E=N.commit():(Ve.$set(d.props),ut(d.props.page),E=at?.()),Me=!0}else await ze(d,fe,!1);const{activeElement:U}=document;await E,await G(),await G();let P=a?a.scroll:r?ae():null;if(Te){const b=t.hash&&document.getElementById(Ze(t));if(P)scrollTo(P.x,P.y);else if(b){b.scrollIntoView();const{top:N,left:T}=b.getBoundingClientRect();P={x:pageXOffset+T,y:pageYOffset+N}}else scrollTo(0,0)}const et=document.activeElement!==U&&document.activeElement!==document.body;!n&&!et&&Ct(t,P),Te=!0,d.props.page&&Object.assign(R,d.props.page),V=!1,e==="popstate"&&$e(S),h.fulfil(void 0),F.forEach(b=>b(h.navigation)),I.navigating.set(ie.current=null)}async function Qe(e,t,a,n,r){return e.origin===je&&e.pathname===location.pathname&&!Be?await Se({status:n,error:a,url:e,route:t}):await M(e,r)}function At(){let e,t={element:void 0,href:void 0},a;A.addEventListener("mousemove",i=>{const c=i.target;clearTimeout(e),e=setTimeout(()=>{o(c,q.hover)},20)});function n(i){i.defaultPrevented||o(i.composedPath()[0],q.tap)}A.addEventListener("mousedown",n),A.addEventListener("touchstart",n,{passive:!0});const r=new IntersectionObserver(i=>{for(const c of i)c.isIntersecting&&(se(new URL(c.target.href)),r.unobserve(c.target))},{threshold:0});async function o(i,c){const f=Ce(i,A),_=f===t.element&&f?.href===t.href&&c>=a;if(!f||_)return;const{url:g,external:u,download:l}=ce(f,L,w.hash);if(u||l)return;const h=z(f),v=g&&te(m.url)===te(g);if(!(h.reload||v))if(c<=h.preload_data){t={element:f,href:f.href},a=q.tap;const p=await ne(g,!1);if(!p)return;kt(p)}else c<=h.preload_code&&(t={element:f,href:f.href},a=c,se(g))}function s(){r.disconnect();for(const i of A.querySelectorAll("a")){const{url:c,external:f,download:_}=ce(i,L,w.hash);if(f||_)continue;const g=z(i);g.reload||(g.preload_code===q.viewport&&r.observe(i),g.preload_code===q.eager&&se(c))}}F.add(s),s()}function Y(e,t){if(e instanceof _e)return e.body;const a=ve(e),n=gt(e);return w.hooks.handleError({error:e,event:t,status:a,message:n})??{message:n}}function Ft(e,t={}){return e=new URL(he(e)),e.origin!==je?Promise.reject(new Error("goto: invalid URL")):Ge(e,t,0)}function Ut(e){if(typeof e=="function")X.push(e);else{const{href:t}=new URL(e,location.href);X.push(a=>a.href===t)}}function Tt(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let a=!1;if(Oe(),!V){const n=Re(m,void 0,null,"leave"),r={...n.navigation,cancel:()=>{a=!0,n.reject(new Error("navigation cancelled"))}};He.forEach(o=>o(r))}a?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Oe()}),navigator.connection?.saveData||At(),A.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const a=Ce(t.composedPath()[0],A);if(!a)return;const{url:n,external:r,target:o,download:s}=ce(a,L,w.hash);if(!n)return;if(o==="_parent"||o==="_top"){if(window.parent!==window)return}else if(o&&o!=="_self")return;const i=z(a);if(!(a instanceof SVGAElement)&&n.protocol!==location.protocol&&!(n.protocol==="https:"||n.protocol==="http:")||s)return;const[f,_]=(w.hash?n.hash.replace(/^#/,""):n.href).split("#"),g=f===oe(location);if(r||i.reload&&(!g||!_)){We({url:n,type:"link",event:t})?V=!0:t.preventDefault();return}if(_!==void 0&&g){const[,u]=m.url.href.split("#");if(u===_){if(t.preventDefault(),_===""||_==="top"&&a.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const l=a.ownerDocument.getElementById(decodeURIComponent(_));l&&(l.scrollIntoView(),l.focus())}return}if(K=!0,we(y),e(n),!i.replace_state)return;K=!1}t.preventDefault(),await new Promise(u=>{requestAnimationFrame(()=>{setTimeout(u,0)}),setTimeout(u,100)}),await D({type:"link",url:n,keepfocus:i.keepfocus,noscroll:i.noscroll,replace_state:i.replace_state??n.href===location.href,event:t})}),A.addEventListener("submit",t=>{if(t.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(t.target),n=t.submitter;if((n?.formTarget||a.target)==="_blank"||(n?.formMethod||a.method)!=="get")return;const s=new URL(n?.hasAttribute("formaction")&&n?.formAction||a.action);if(pe(s,L,!1))return;const i=t.target,c=z(i);if(c.reload)return;t.preventDefault(),t.stopPropagation();const f=new FormData(i,n);s.search=new URLSearchParams(f).toString(),D({type:"form",url:s,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??s.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!de){if(t.state?.[j]){const a=t.state[j];if(O={},a===y)return;const n=C[a],r=t.state[Ne]??{},o=new URL(t.state[rt]??location.href),s=t.state[H],i=m.url?oe(location)===oe(m.url):!1;if(s===S&&(Me||i)){r!==R.state&&(R.state=r),e(o),C[y]=ae(),n&&scrollTo(n.x,n.y),y=a;return}const f=a-y;await D({type:"popstate",url:o,popped:{state:r,scroll:n,delta:f},accept:()=>{y=a,S=s},block:()=>{history.go(-f)},nav_token:O,event:t})}else if(!K){const a=new URL(location.href);e(a),w.hash&&location.reload()}}}),addEventListener("hashchange",()=>{K&&(K=!1,history.replaceState({...history.state,[j]:++y,[H]:S},"",location.href))});for(const t of document.querySelectorAll("link"))vt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&I.navigating.set(ie.current=null)});function e(t){m.url=R.url=t,I.page.set(Le(R)),I.page.notify()}}async function It(e,{status:t=200,error:a,node_ids:n,params:r,route:o,server_route:s,data:i,form:c}){Be=!0;const f=new URL(location.href);let _;({params:r={},route:o={id:null}}=await ne(f,!1)||{}),_=ye.find(({id:l})=>l===o.id);let g,u=!0;try{const l=n.map(async(v,p)=>{const d=i[p];return d?.uses&&(d.uses=Ot(d.uses)),ke({loader:w.nodes[v],url:f,params:r,route:o,parent:async()=>{const k={};for(let E=0;E{const i=history.state;de=!0,location.replace(`#${n}`),w.hash&&location.replace(e.hash),history.replaceState(i,"",e.hash),scrollTo(o,s),de=!1})}else{const o=document.body,s=o.getAttribute("tabindex");o.tabIndex=-1,o.focus({preventScroll:!0,focusVisible:!1}),s!==null?o.setAttribute("tabindex",s):o.removeAttribute("tabindex")}const r=getSelection();if(r&&r.type!=="None"){const o=[];for(let s=0;s{if(r.rangeCount===o.length){for(let s=0;s{r=c,o=f});return s.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url},to:a&&{params:t?.params??null,route:{id:t?.route?.id??null},url:a},willUnload:!t,type:n,complete:s},fulfil:r,reject:o}}function Le(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function Nt(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function Ze(e){let t;if(w.hash){const[,,a]=e.hash.split("#",3);t=a??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{Kt as a,Ft as g,I as s}; diff --git a/webapp/assets/_app/immutable/chunks/C6jYEeWP.js b/webapp/assets/_app/immutable/chunks/CVBpH3Sf.js similarity index 91% rename from webapp/assets/_app/immutable/chunks/C6jYEeWP.js rename to webapp/assets/_app/immutable/chunks/CVBpH3Sf.js index 9414be73..9f524375 100644 --- a/webapp/assets/_app/immutable/chunks/C6jYEeWP.js +++ b/webapp/assets/_app/immutable/chunks/CVBpH3Sf.js @@ -1 +1 @@ -import{f as v,e as t,a as m}from"./ZGz3X54u.js";import{i as u}from"./CY7Wcm-1.js";import{p as h,v as k,c as r,r as s,a as g}from"./kDtaAWAK.js";import{f as b}from"./Cvcp5xHB.js";var w=v('');function M(d,i){h(i,!1);const l=k();function n(){l("close")}function c(o){o.stopPropagation()}function f(o){o.key==="Escape"&&l("close")}u();var a=w(),e=r(a),p=r(e);b(p,i,"default",{}),s(e),s(a),t("click",e,c),t("click",a,n),t("keydown",a,f),m(d,a),g()}export{M}; +import{f as v,e as t,a as m}from"./ZGz3X54u.js";import{i as u}from"./CY7Wcm-1.js";import{p as h,v as k,c as r,r as s,a as g}from"./kDtaAWAK.js";import{f as b}from"./CYK-UalN.js";var w=v('');function M(d,i){h(i,!1);const l=k();function n(){l("close")}function c(o){o.stopPropagation()}function f(o){o.key==="Escape"&&l("close")}u();var a=w(),e=r(a),p=r(e);b(p,i,"default",{}),s(e),s(a),t("click",e,c),t("click",a,n),t("keydown",a,f),m(d,a),g()}export{M}; diff --git a/webapp/assets/_app/immutable/chunks/Cvcp5xHB.js b/webapp/assets/_app/immutable/chunks/CYK-UalN.js similarity index 99% rename from webapp/assets/_app/immutable/chunks/Cvcp5xHB.js rename to webapp/assets/_app/immutable/chunks/CYK-UalN.js index 48c591a3..41e7e567 100644 --- a/webapp/assets/_app/immutable/chunks/Cvcp5xHB.js +++ b/webapp/assets/_app/immutable/chunks/CYK-UalN.js @@ -1,4 +1,4 @@ -import{b as _r,r as Gr}from"./CkTG2UXI.js";import{g as Rt,i as qr,l as Hr,j as $r,k as Nr,n as Qr,o as Wr,p as Mr,q as Jr,v as Kr,f as Xr,e as Yr,a as ye,b as ut,c as Zr}from"./ZGz3X54u.js";import{i as es}from"./CY7Wcm-1.js";import{t as ze,B as ee,C as nt,a7 as ts,aW as rs,J as yt,R as ss,a3 as as,aR as os,aQ as ns,L as ls,M as je,D as ir,a2 as lt,G as cr,y as Ot,am as is,X as cs,aX as ps,aY as ds,aZ as hs,a_ as us,a$ as Os,b0 as Ps,g as z,b1 as ms,b2 as bs,Q as ft,aj as Vs,b3 as Ss,p as As,v as Rs,l as se,b as ys,a as fs,h as ce,m as ae,d as oe,c as Ye,s as wt,r as Ze,f as ws}from"./kDtaAWAK.js";import{l as It,p as ne,i as et}from"./Cun6jNAp.js";function Et(r,e,t=!1,s=!1,o=!1){var a=r,n="";ze(()=>{var l=ts;if(n===(n=e()??"")){ee&&nt();return}if(l.nodes_start!==null&&(rs(l.nodes_start,l.nodes_end),l.nodes_start=l.nodes_end=null),n!==""){if(ee){yt.data;for(var i=nt(),c=i;i!==null&&(i.nodeType!==ss||i.data!=="");)c=i,i=as(i);if(i===null)throw os(),ns;Rt(yt,c),a=ls(i);return}var p=n+"";t?p=`${p}`:s&&(p=`${p}`);var R=qr(p);if((t||s)&&(R=je(R)),Rt(je(R),R.lastChild),t||s)for(;je(R);)a.before(je(R));else a.before(R)}})}function Is(r,e,t,s,o){ee&&nt();var a=e.$$slots?.[t],n=!1;a===!0&&(a=e[t==="default"?"children":t],n=!0),a===void 0||a(r,n?()=>s:s)}function No(r){const e={};r.children&&(e.default=!0);for(const t in r.$$slots)e[t]=!0;return e}function Es(r,e){var t=void 0,s;ir(()=>{t!==(t=e())&&(s&&(lt(s),s=null),t&&(s=cr(()=>{Ot(()=>t(r))})))})}function pr(r){var e,t,s="";if(typeof r=="string"||typeof r=="number")s+=r;else if(typeof r=="object")if(Array.isArray(r)){var o=r.length;for(e=0;e{var l=ts;if(n===(n=e()??"")){ee&&nt();return}if(l.nodes_start!==null&&(rs(l.nodes_start,l.nodes_end),l.nodes_start=l.nodes_end=null),n!==""){if(ee){yt.data;for(var i=nt(),c=i;i!==null&&(i.nodeType!==ss||i.data!=="");)c=i,i=as(i);if(i===null)throw os(),ns;Rt(yt,c),a=ls(i);return}var p=n+"";t?p=`${p}`:s&&(p=`${p}`);var R=qr(p);if((t||s)&&(R=je(R)),Rt(je(R),R.lastChild),t||s)for(;je(R);)a.before(je(R));else a.before(R)}})}function Is(r,e,t,s,o){ee&&nt();var a=e.$$slots?.[t],n=!1;a===!0&&(a=e[t==="default"?"children":t],n=!0),a===void 0||a(r,n?()=>s:s)}function No(r){const e={};r.children&&(e.default=!0);for(const t in r.$$slots)e[t]=!0;return e}function Es(r,e){var t=void 0,s;ir(()=>{t!==(t=e())&&(s&&(lt(s),s=null),t&&(s=cr(()=>{Ot(()=>t(r))})))})}function pr(r){var e,t,s="";if(typeof r=="string"||typeof r=="number")s+=r;else if(typeof r=="object")if(Array.isArray(r)){var o=r.length;for(e=0;e=0;){var l=n+a;(n===0||xt.includes(s[n-1]))&&(l===s.length||xt.includes(s[l]))?s=(n===0?"":s.substring(0,n))+s.substring(l+1):n=l}}return s===""?null:s}function gt(r,e=!1){var t=e?" !important;":";",s="";for(var o in r){var a=r[o];a!=null&&a!==""&&(s+=" "+o+": "+a+t)}return s}function tt(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function Us(r,e){if(e){var t="",s,o;if(Array.isArray(e)?(s=e[0],o=e[1]):s=e,r){r=String(r).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var a=!1,n=0,l=!1,i=[];s&&i.push(...Object.keys(s).map(tt)),o&&i.push(...Object.keys(o).map(tt));var c=0,p=-1;const f=r.length;for(var R=0;R{He(r,r.__value)});e.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),is(()=>{e.disconnect()})}function Qo(r,e,t=e){var s=!0;Hr(r,"change",o=>{var a=o?"[selected]":":checked",n;if(r.multiple)n=[].map.call(r.querySelectorAll(a),Ee);else{var l=r.querySelector(a)??r.querySelector("option:not([disabled])");n=l&&Ee(l)}t(n)}),Ot(()=>{var o=e();if(He(r,o,s),s&&o===void 0){var a=r.querySelector(":checked");a!==null&&(o=Ee(a),t(o))}r.__value=o,s=!1}),dr(r)}function Ee(r){return"__value"in r?r.__value:r.value}const fe=Symbol("class"),we=Symbol("style"),hr=Symbol("is custom element"),ur=Symbol("is html");function Wo(r){if(ee){var e=!1,t=()=>{if(!e){if(e=!0,r.hasAttribute("value")){var s=r.value;$e(r,"value",null),r.value=s}if(r.hasAttribute("checked")){var o=r.checked;$e(r,"checked",null),r.checked=o}}};r.__on_r=t,Ss(t),Jr()}}function Mo(r,e){var t=Pt(r);t.value===(t.value=e??void 0)||r.value===e&&(e!==0||r.nodeName!=="PROGRESS")||(r.value=e??"")}function Ts(r,e){e?r.hasAttribute("selected")||r.setAttribute("selected",""):r.removeAttribute("selected")}function $e(r,e,t,s){var o=Pt(r);ee&&(o[e]=r.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&r.nodeName==="LINK")||o[e]!==(o[e]=t)&&(e==="loading"&&(r[us]=t),t==null?r.removeAttribute(e):typeof t!="string"&&Or(r).includes(e)?r[e]=t:r.setAttribute(e,t))}function Bs(r,e,t,s,o=!1){var a=Pt(r),n=a[hr],l=!a[ur];let i=ee&&n;i&&ft(!1);var c=e||{},p=r.tagName==="OPTION";for(var R in e)R in t||(t[R]=null);t.class?t.class=gs(t.class):t[fe]&&(t.class=null),t[we]&&(t.style??=null);var I=Or(r);for(const E in t){let g=t[E];if(p&&E==="value"&&g==null){r.value=r.__value="",c[E]=g;continue}if(E==="class"){var B=r.namespaceURI==="http://www.w3.org/1999/xhtml";ke(r,B,g,s,e?.[fe],t[fe]),c[E]=g,c[fe]=t[fe];continue}if(E==="style"){Cs(r,g,e?.[we],t[we]),c[E]=g,c[we]=t[we];continue}var y=c[E];if(!(g===y&&!(g===void 0&&r.hasAttribute(E)))){c[E]=g;var f=E[0]+E[1];if(f!=="$$")if(f==="on"){const T={},D="$$"+E;let C=E.slice(2);var w=Kr(C);if($r(C)&&(C=C.slice(0,-7),T.capture=!0),!w&&y){if(g!=null)continue;r.removeEventListener(C,c[D],T),c[D]=null}if(g!=null)if(w)r[`__${C}`]=g,Qr([C]);else{let ie=function(te){c[E].call(this,te)};c[D]=Nr(C,r,ie,T)}else w&&(r[`__${C}`]=void 0)}else if(E==="style")$e(r,E,g);else if(E==="autofocus")Wr(r,!!g);else if(!n&&(E==="__value"||E==="value"&&g!=null))r.value=r.__value=g;else if(E==="selected"&&p)Ts(r,g);else{var U=E;l||(U=Mr(U));var F=U==="defaultValue"||U==="defaultChecked";if(g==null&&!n&&!F)if(a[E]=null,U==="value"||U==="checked"){let T=r;const D=e===void 0;if(U==="value"){let C=T.defaultValue;T.removeAttribute(U),T.defaultValue=C,T.value=T.__value=D?C:null}else{let C=T.defaultChecked;T.removeAttribute(U),T.defaultChecked=C,T.checked=D?C:!1}}else r.removeAttribute(E);else F||I.includes(U)&&(n||typeof g!="string")?(r[U]=g,U in a&&(a[U]=Vs)):typeof g!="function"&&$e(r,U,g)}}}return i&&ft(!0),c}function Ds(r,e,t=[],s=[],o,a=!1){hs(t,s,n=>{var l=void 0,i={},c=r.nodeName==="SELECT",p=!1;if(ir(()=>{var I=e(...n.map(z)),B=Bs(r,l,I,o,a);p&&c&&"value"in I&&He(r,I.value);for(let f of Object.getOwnPropertySymbols(i))I[f]||lt(i[f]);for(let f of Object.getOwnPropertySymbols(I)){var y=I[f];f.description===ms&&(!l||y!==l[f])&&(i[f]&<(i[f]),i[f]=cr(()=>Es(r,()=>y))),B[f]=y}l=B}),c){var R=r;Ot(()=>{He(R,l.value,!0),dr(R)})}p=!0})}function Pt(r){return r.__attributes??={[hr]:r.nodeName.includes("-"),[ur]:r.namespaceURI===Os}}var vt=new Map;function Or(r){var e=vt.get(r.nodeName);if(e)return e;vt.set(r.nodeName,e=[]);for(var t,s=r,o=Element.prototype;o!==s;){t=bs(s);for(var a in t)t[a].set&&e.push(a);s=Ps(s)}return e}const js="";function Jo(...r){return _r+js+Gr(r[0],r[1])}function Pr(r,e){return function(){return r.apply(e,arguments)}}const{toString:Fs}=Object.prototype,{getPrototypeOf:mt}=Object,{iterator:Qe,toStringTag:mr}=Symbol,We=(r=>e=>{const t=Fs.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),J=r=>(r=r.toLowerCase(),e=>We(e)===r),Me=r=>e=>typeof e===r,{isArray:Ae}=Array,Se=Me("undefined");function xe(r){return r!==null&&!Se(r)&&r.constructor!==null&&!Se(r.constructor)&&$(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const br=J("ArrayBuffer");function Ls(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&br(r.buffer),e}const zs=Me("string"),$=Me("function"),Vr=Me("number"),ge=r=>r!==null&&typeof r=="object",ks=r=>r===!0||r===!1,_e=r=>{if(We(r)!=="object")return!1;const e=mt(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(mr in r)&&!(Qe in r)},_s=r=>{if(!ge(r)||xe(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},Gs=J("Date"),qs=J("File"),Hs=J("Blob"),$s=J("FileList"),Ns=r=>ge(r)&&$(r.pipe),Qs=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||$(r.append)&&((e=We(r))==="formdata"||e==="object"&&$(r.toString)&&r.toString()==="[object FormData]"))},Ws=J("URLSearchParams"),[Ms,Js,Ks,Xs]=["ReadableStream","Request","Response","Headers"].map(J),Ys=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ve(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let s,o;if(typeof r!="object"&&(r=[r]),Ae(r))for(s=0,o=r.length;s0;)if(o=t[s],e===o.toLowerCase())return o;return null}const pe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ar=r=>!Se(r)&&r!==pe;function it(){const{caseless:r,skipUndefined:e}=Ar(this)&&this||{},t={},s=(o,a)=>{const n=r&&Sr(t,a)||a;_e(t[n])&&_e(o)?t[n]=it(t[n],o):_e(o)?t[n]=it({},o):Ae(o)?t[n]=o.slice():(!e||!Se(o))&&(t[n]=o)};for(let o=0,a=arguments.length;o(ve(e,(o,a)=>{t&&$(o)?Object.defineProperty(r,a,{value:Pr(o,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,a,{value:o,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),r),ea=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),ta=(r,e,t,s)=>{r.prototype=Object.create(e.prototype,s),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},ra=(r,e,t,s)=>{let o,a,n;const l={};if(e=e||{},r==null)return e;do{for(o=Object.getOwnPropertyNames(r),a=o.length;a-- >0;)n=o[a],(!s||s(n,r,e))&&!l[n]&&(e[n]=r[n],l[n]=!0);r=t!==!1&&mt(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},sa=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const s=r.indexOf(e,t);return s!==-1&&s===t},aa=r=>{if(!r)return null;if(Ae(r))return r;let e=r.length;if(!Vr(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},oa=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&mt(Uint8Array)),na=(r,e)=>{const s=(r&&r[Qe]).call(r);let o;for(;(o=s.next())&&!o.done;){const a=o.value;e.call(r,a[0],a[1])}},la=(r,e)=>{let t;const s=[];for(;(t=r.exec(e))!==null;)s.push(t);return s},ia=J("HTMLFormElement"),ca=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,s,o){return s.toUpperCase()+o}),Ut=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),pa=J("RegExp"),Rr=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),s={};ve(t,(o,a)=>{let n;(n=e(o,a,r))!==!1&&(s[a]=n||o)}),Object.defineProperties(r,s)},da=r=>{Rr(r,(e,t)=>{if($(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const s=r[t];if($(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},ha=(r,e)=>{const t={},s=o=>{o.forEach(a=>{t[a]=!0})};return Ae(r)?s(r):s(String(r).split(e)),t},ua=()=>{},Oa=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function Pa(r){return!!(r&&$(r.append)&&r[mr]==="FormData"&&r[Qe])}const ma=r=>{const e=new Array(10),t=(s,o)=>{if(ge(s)){if(e.indexOf(s)>=0)return;if(xe(s))return s;if(!("toJSON"in s)){e[o]=s;const a=Ae(s)?[]:{};return ve(s,(n,l)=>{const i=t(n,o+1);!Se(i)&&(a[l]=i)}),e[o]=void 0,a}}return s};return t(r,0)},ba=J("AsyncFunction"),Va=r=>r&&(ge(r)||$(r))&&$(r.then)&&$(r.catch),yr=((r,e)=>r?setImmediate:e?((t,s)=>(pe.addEventListener("message",({source:o,data:a})=>{o===pe&&a===t&&s.length&&s.shift()()},!1),o=>{s.push(o),pe.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",$(pe.postMessage)),Sa=typeof queueMicrotask<"u"?queueMicrotask.bind(pe):typeof process<"u"&&process.nextTick||yr,Aa=r=>r!=null&&$(r[Qe]),u={isArray:Ae,isArrayBuffer:br,isBuffer:xe,isFormData:Qs,isArrayBufferView:Ls,isString:zs,isNumber:Vr,isBoolean:ks,isObject:ge,isPlainObject:_e,isEmptyObject:_s,isReadableStream:Ms,isRequest:Js,isResponse:Ks,isHeaders:Xs,isUndefined:Se,isDate:Gs,isFile:qs,isBlob:Hs,isRegExp:pa,isFunction:$,isStream:Ns,isURLSearchParams:Ws,isTypedArray:oa,isFileList:$s,forEach:ve,merge:it,extend:Zs,trim:Ys,stripBOM:ea,inherits:ta,toFlatObject:ra,kindOf:We,kindOfTest:J,endsWith:sa,toArray:aa,forEachEntry:na,matchAll:la,isHTMLForm:ia,hasOwnProperty:Ut,hasOwnProp:Ut,reduceDescriptors:Rr,freezeMethods:da,toObjectSet:ha,toCamelCase:ca,noop:ua,toFiniteNumber:Oa,findKey:Sr,global:pe,isContextDefined:Ar,isSpecCompliantForm:Pa,toJSONObject:ma,isAsyncFn:ba,isThenable:Va,setImmediate:yr,asap:Sa,isIterable:Aa};let x=class fr extends Error{static from(e,t,s,o,a,n){const l=new fr(e.message,t||e.code,s,o,a);return l.cause=e,l.name=e.name,n&&Object.assign(l,n),l}constructor(e,t,s,o,a){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),s&&(this.config=s),o&&(this.request=o),a&&(this.response=a,this.status=a.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:u.toJSONObject(this.config),code:this.code,status:this.status}}};x.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";x.ERR_BAD_OPTION="ERR_BAD_OPTION";x.ECONNABORTED="ECONNABORTED";x.ETIMEDOUT="ETIMEDOUT";x.ERR_NETWORK="ERR_NETWORK";x.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";x.ERR_DEPRECATED="ERR_DEPRECATED";x.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";x.ERR_BAD_REQUEST="ERR_BAD_REQUEST";x.ERR_CANCELED="ERR_CANCELED";x.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";x.ERR_INVALID_URL="ERR_INVALID_URL";const Ra=null;function ct(r){return u.isPlainObject(r)||u.isArray(r)}function wr(r){return u.endsWith(r,"[]")?r.slice(0,-2):r}function Ct(r,e,t){return r?r.concat(e).map(function(o,a){return o=wr(o),!t&&a?"["+o+"]":o}).join(t?".":""):e}function ya(r){return u.isArray(r)&&!r.some(ct)}const fa=u.toFlatObject(u,{},null,function(e){return/^is[A-Z]/.test(e)});function Je(r,e,t){if(!u.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=u.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,w){return!u.isUndefined(w[f])});const s=t.metaTokens,o=t.visitor||p,a=t.dots,n=t.indexes,i=(t.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(e);if(!u.isFunction(o))throw new TypeError("visitor must be a function");function c(y){if(y===null)return"";if(u.isDate(y))return y.toISOString();if(u.isBoolean(y))return y.toString();if(!i&&u.isBlob(y))throw new x("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(y)||u.isTypedArray(y)?i&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function p(y,f,w){let U=y;if(y&&!w&&typeof y=="object"){if(u.endsWith(f,"{}"))f=s?f:f.slice(0,-2),y=JSON.stringify(y);else if(u.isArray(y)&&ya(y)||(u.isFileList(y)||u.endsWith(f,"[]"))&&(U=u.toArray(y)))return f=wr(f),U.forEach(function(E,g){!(u.isUndefined(E)||E===null)&&e.append(n===!0?Ct([f],g,a):n===null?f:f+"[]",c(E))}),!1}return ct(y)?!0:(e.append(Ct(w,f,a),c(y)),!1)}const R=[],I=Object.assign(fa,{defaultVisitor:p,convertValue:c,isVisitable:ct});function B(y,f){if(!u.isUndefined(y)){if(R.indexOf(y)!==-1)throw Error("Circular reference detected in "+f.join("."));R.push(y),u.forEach(y,function(U,F){(!(u.isUndefined(U)||U===null)&&o.call(e,U,u.isString(F)?F.trim():F,f,I))===!0&&B(U,f?f.concat(F):[F])}),R.pop()}}if(!u.isObject(r))throw new TypeError("data must be an object");return B(r),e}function Tt(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function bt(r,e){this._pairs=[],r&&Je(r,this,e)}const Ir=bt.prototype;Ir.append=function(e,t){this._pairs.push([e,t])};Ir.toString=function(e){const t=e?function(s){return e.call(this,s,Tt)}:Tt;return this._pairs.map(function(o){return t(o[0])+"="+t(o[1])},"").join("&")};function wa(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Er(r,e,t){if(!e)return r;const s=t&&t.encode||wa,o=u.isFunction(t)?{serialize:t}:t,a=o&&o.serialize;let n;if(a?n=a(e,o):n=u.isURLSearchParams(e)?e.toString():new bt(e,o).toString(s),n){const l=r.indexOf("#");l!==-1&&(r=r.slice(0,l)),r+=(r.indexOf("?")===-1?"?":"&")+n}return r}class Bt{constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){u.forEach(this.handlers,function(s){s!==null&&e(s)})}}const xr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ia=typeof URLSearchParams<"u"?URLSearchParams:bt,Ea=typeof FormData<"u"?FormData:null,xa=typeof Blob<"u"?Blob:null,ga={isBrowser:!0,classes:{URLSearchParams:Ia,FormData:Ea,Blob:xa},protocols:["http","https","file","blob","url","data"]},Vt=typeof window<"u"&&typeof document<"u",pt=typeof navigator=="object"&&navigator||void 0,va=Vt&&(!pt||["ReactNative","NativeScript","NS"].indexOf(pt.product)<0),Ua=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ca=Vt&&window.location.href||"http://localhost",Ta=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Vt,hasStandardBrowserEnv:va,hasStandardBrowserWebWorkerEnv:Ua,navigator:pt,origin:Ca},Symbol.toStringTag,{value:"Module"})),q={...Ta,...ga};function Ba(r,e){return Je(r,new q.classes.URLSearchParams,{visitor:function(t,s,o,a){return q.isNode&&u.isBuffer(t)?(this.append(s,t.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...e})}function Da(r){return u.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function ja(r){const e={},t=Object.keys(r);let s;const o=t.length;let a;for(s=0;s=t.length;return n=!n&&u.isArray(o)?o.length:n,i?(u.hasOwnProp(o,n)?o[n]=[o[n],s]:o[n]=s,!l):((!o[n]||!u.isObject(o[n]))&&(o[n]=[]),e(t,s,o[n],a)&&u.isArray(o[n])&&(o[n]=ja(o[n])),!l)}if(u.isFormData(r)&&u.isFunction(r.entries)){const t={};return u.forEachEntry(r,(s,o)=>{e(Da(s),o,t,0)}),t}return null}function Fa(r,e,t){if(u.isString(r))try{return(e||JSON.parse)(r),u.trim(r)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(r)}const Ue={transitional:xr,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const s=t.getContentType()||"",o=s.indexOf("application/json")>-1,a=u.isObject(e);if(a&&u.isHTMLForm(e)&&(e=new FormData(e)),u.isFormData(e))return o?JSON.stringify(gr(e)):e;if(u.isArrayBuffer(e)||u.isBuffer(e)||u.isStream(e)||u.isFile(e)||u.isBlob(e)||u.isReadableStream(e))return e;if(u.isArrayBufferView(e))return e.buffer;if(u.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(a){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Ba(e,this.formSerializer).toString();if((l=u.isFileList(e))||s.indexOf("multipart/form-data")>-1){const i=this.env&&this.env.FormData;return Je(l?{"files[]":e}:e,i&&new i,this.formSerializer)}}return a||o?(t.setContentType("application/json",!1),Fa(e)):e}],transformResponse:[function(e){const t=this.transitional||Ue.transitional,s=t&&t.forcedJSONParsing,o=this.responseType==="json";if(u.isResponse(e)||u.isReadableStream(e))return e;if(e&&u.isString(e)&&(s&&!this.responseType||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(l){if(n)throw l.name==="SyntaxError"?x.from(l,x.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:q.classes.FormData,Blob:q.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};u.forEach(["delete","get","head","post","put","patch"],r=>{Ue.headers[r]={}});const La=u.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),za=r=>{const e={};let t,s,o;return r&&r.split(` `).forEach(function(n){o=n.indexOf(":"),t=n.substring(0,o).trim().toLowerCase(),s=n.substring(o+1).trim(),!(!t||e[t]&&La[t])&&(t==="set-cookie"?e[t]?e[t].push(s):e[t]=[s]:e[t]=e[t]?e[t]+", "+s:s)}),e},Dt=Symbol("internals");function Ie(r){return r&&String(r).trim().toLowerCase()}function Ge(r){return r===!1||r==null?r:u.isArray(r)?r.map(Ge):String(r)}function ka(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=t.exec(r);)e[s[1]]=s[2];return e}const _a=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function st(r,e,t,s,o){if(u.isFunction(s))return s.call(this,e,t);if(o&&(e=t),!!u.isString(e)){if(u.isString(s))return e.indexOf(s)!==-1;if(u.isRegExp(s))return s.test(e)}}function Ga(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}function qa(r,e){const t=u.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(r,s+t,{value:function(o,a,n){return this[s].call(this,e,o,a,n)},configurable:!0})})}let N=class{constructor(e){e&&this.set(e)}set(e,t,s){const o=this;function a(l,i,c){const p=Ie(i);if(!p)throw new Error("header name must be a non-empty string");const R=u.findKey(o,p);(!R||o[R]===void 0||c===!0||c===void 0&&o[R]!==!1)&&(o[R||i]=Ge(l))}const n=(l,i)=>u.forEach(l,(c,p)=>a(c,p,i));if(u.isPlainObject(e)||e instanceof this.constructor)n(e,t);else if(u.isString(e)&&(e=e.trim())&&!_a(e))n(za(e),t);else if(u.isObject(e)&&u.isIterable(e)){let l={},i,c;for(const p of e){if(!u.isArray(p))throw TypeError("Object iterator must return a key-value pair");l[c=p[0]]=(i=l[c])?u.isArray(i)?[...i,p[1]]:[i,p[1]]:p[1]}n(l,t)}else e!=null&&a(t,e,s);return this}get(e,t){if(e=Ie(e),e){const s=u.findKey(this,e);if(s){const o=this[s];if(!t)return o;if(t===!0)return ka(o);if(u.isFunction(t))return t.call(this,o,s);if(u.isRegExp(t))return t.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ie(e),e){const s=u.findKey(this,e);return!!(s&&this[s]!==void 0&&(!t||st(this,this[s],s,t)))}return!1}delete(e,t){const s=this;let o=!1;function a(n){if(n=Ie(n),n){const l=u.findKey(s,n);l&&(!t||st(s,s[l],l,t))&&(delete s[l],o=!0)}}return u.isArray(e)?e.forEach(a):a(e),o}clear(e){const t=Object.keys(this);let s=t.length,o=!1;for(;s--;){const a=t[s];(!e||st(this,this[a],a,e,!0))&&(delete this[a],o=!0)}return o}normalize(e){const t=this,s={};return u.forEach(this,(o,a)=>{const n=u.findKey(s,a);if(n){t[n]=Ge(o),delete t[a];return}const l=e?Ga(a):String(a).trim();l!==a&&delete t[a],t[l]=Ge(o),s[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return u.forEach(this,(s,o)=>{s!=null&&s!==!1&&(t[o]=e&&u.isArray(s)?s.join(", "):s)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach(o=>s.set(o)),s}static accessor(e){const s=(this[Dt]=this[Dt]={accessors:{}}).accessors,o=this.prototype;function a(n){const l=Ie(n);s[l]||(qa(o,n),s[l]=!0)}return u.isArray(e)?e.forEach(a):a(e),this}};N.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);u.reduceDescriptors(N.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(s){this[t]=s}}});u.freezeMethods(N);function at(r,e){const t=this||Ue,s=e||t,o=N.from(s.headers);let a=s.data;return u.forEach(r,function(l){a=l.call(t,a,o.normalize(),e?e.status:void 0)}),o.normalize(),a}function vr(r){return!!(r&&r.__CANCEL__)}let Ce=class extends x{constructor(e,t,s){super(e??"canceled",x.ERR_CANCELED,t,s),this.name="CanceledError",this.__CANCEL__=!0}};function Ur(r,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?r(t):e(new x("Request failed with status code "+t.status,[x.ERR_BAD_REQUEST,x.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Ha(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function $a(r,e){r=r||10;const t=new Array(r),s=new Array(r);let o=0,a=0,n;return e=e!==void 0?e:1e3,function(i){const c=Date.now(),p=s[a];n||(n=c),t[o]=i,s[o]=c;let R=a,I=0;for(;R!==o;)I+=t[R++],R=R%r;if(o=(o+1)%r,o===a&&(a=(a+1)%r),c-n{t=p,o=null,a&&(clearTimeout(a),a=null),r(...c)};return[(...c)=>{const p=Date.now(),R=p-t;R>=s?n(c,p):(o=c,a||(a=setTimeout(()=>{a=null,n(o)},s-R)))},()=>o&&n(o)]}const Ne=(r,e,t=3)=>{let s=0;const o=$a(50,250);return Na(a=>{const n=a.loaded,l=a.lengthComputable?a.total:void 0,i=n-s,c=o(i),p=n<=l;s=n;const R={loaded:n,total:l,progress:l?n/l:void 0,bytes:i,rate:c||void 0,estimated:c&&l&&p?(l-n)/c:void 0,event:a,lengthComputable:l!=null,[e?"download":"upload"]:!0};r(R)},t)},jt=(r,e)=>{const t=r!=null;return[s=>e[0]({lengthComputable:t,total:r,loaded:s}),e[1]]},Ft=r=>(...e)=>u.asap(()=>r(...e)),Qa=q.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,q.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(q.origin),q.navigator&&/(msie|trident)/i.test(q.navigator.userAgent)):()=>!0,Wa=q.hasStandardBrowserEnv?{write(r,e,t,s,o,a,n){if(typeof document>"u")return;const l=[`${r}=${encodeURIComponent(e)}`];u.isNumber(t)&&l.push(`expires=${new Date(t).toUTCString()}`),u.isString(s)&&l.push(`path=${s}`),u.isString(o)&&l.push(`domain=${o}`),a===!0&&l.push("secure"),u.isString(n)&&l.push(`SameSite=${n}`),document.cookie=l.join("; ")},read(r){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+r+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ma(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function Ja(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function Cr(r,e,t){let s=!Ma(e);return r&&(s||t==!1)?Ja(r,e):e}const Lt=r=>r instanceof N?{...r}:r;function he(r,e){e=e||{};const t={};function s(c,p,R,I){return u.isPlainObject(c)&&u.isPlainObject(p)?u.merge.call({caseless:I},c,p):u.isPlainObject(p)?u.merge({},p):u.isArray(p)?p.slice():p}function o(c,p,R,I){if(u.isUndefined(p)){if(!u.isUndefined(c))return s(void 0,c,R,I)}else return s(c,p,R,I)}function a(c,p){if(!u.isUndefined(p))return s(void 0,p)}function n(c,p){if(u.isUndefined(p)){if(!u.isUndefined(c))return s(void 0,c)}else return s(void 0,p)}function l(c,p,R){if(R in e)return s(c,p);if(R in r)return s(void 0,c)}const i={url:a,method:a,data:a,baseURL:n,transformRequest:n,transformResponse:n,paramsSerializer:n,timeout:n,timeoutMessage:n,withCredentials:n,withXSRFToken:n,adapter:n,responseType:n,xsrfCookieName:n,xsrfHeaderName:n,onUploadProgress:n,onDownloadProgress:n,decompress:n,maxContentLength:n,maxBodyLength:n,beforeRedirect:n,transport:n,httpAgent:n,httpsAgent:n,cancelToken:n,socketPath:n,responseEncoding:n,validateStatus:l,headers:(c,p,R)=>o(Lt(c),Lt(p),R,!0)};return u.forEach(Object.keys({...r,...e}),function(p){const R=i[p]||o,I=R(r[p],e[p],p);u.isUndefined(I)&&R!==l||(t[p]=I)}),t}const Tr=r=>{const e=he({},r);let{data:t,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:a,headers:n,auth:l}=e;if(e.headers=n=N.from(n),e.url=Er(Cr(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),l&&n.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),u.isFormData(t)){if(q.hasStandardBrowserEnv||q.hasStandardBrowserWebWorkerEnv)n.setContentType(void 0);else if(u.isFunction(t.getHeaders)){const i=t.getHeaders(),c=["content-type","content-length"];Object.entries(i).forEach(([p,R])=>{c.includes(p.toLowerCase())&&n.set(p,R)})}}if(q.hasStandardBrowserEnv&&(s&&u.isFunction(s)&&(s=s(e)),s||s!==!1&&Qa(e.url))){const i=o&&a&&Wa.read(a);i&&n.set(o,i)}return e},Ka=typeof XMLHttpRequest<"u",Xa=Ka&&function(r){return new Promise(function(t,s){const o=Tr(r);let a=o.data;const n=N.from(o.headers).normalize();let{responseType:l,onUploadProgress:i,onDownloadProgress:c}=o,p,R,I,B,y;function f(){B&&B(),y&&y(),o.cancelToken&&o.cancelToken.unsubscribe(p),o.signal&&o.signal.removeEventListener("abort",p)}let w=new XMLHttpRequest;w.open(o.method.toUpperCase(),o.url,!0),w.timeout=o.timeout;function U(){if(!w)return;const E=N.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),T={data:!l||l==="text"||l==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:E,config:r,request:w};Ur(function(C){t(C),f()},function(C){s(C),f()},T),w=null}"onloadend"in w?w.onloadend=U:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(U)},w.onabort=function(){w&&(s(new x("Request aborted",x.ECONNABORTED,r,w)),w=null)},w.onerror=function(g){const T=g&&g.message?g.message:"Network Error",D=new x(T,x.ERR_NETWORK,r,w);D.event=g||null,s(D),w=null},w.ontimeout=function(){let g=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const T=o.transitional||xr;o.timeoutErrorMessage&&(g=o.timeoutErrorMessage),s(new x(g,T.clarifyTimeoutError?x.ETIMEDOUT:x.ECONNABORTED,r,w)),w=null},a===void 0&&n.setContentType(null),"setRequestHeader"in w&&u.forEach(n.toJSON(),function(g,T){w.setRequestHeader(T,g)}),u.isUndefined(o.withCredentials)||(w.withCredentials=!!o.withCredentials),l&&l!=="json"&&(w.responseType=o.responseType),c&&([I,y]=Ne(c,!0),w.addEventListener("progress",I)),i&&w.upload&&([R,B]=Ne(i),w.upload.addEventListener("progress",R),w.upload.addEventListener("loadend",B)),(o.cancelToken||o.signal)&&(p=E=>{w&&(s(!E||E.type?new Ce(null,r,w):E),w.abort(),w=null)},o.cancelToken&&o.cancelToken.subscribe(p),o.signal&&(o.signal.aborted?p():o.signal.addEventListener("abort",p)));const F=Ha(o.url);if(F&&q.protocols.indexOf(F)===-1){s(new x("Unsupported protocol "+F+":",x.ERR_BAD_REQUEST,r));return}w.send(a||null)})},Ya=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let s=new AbortController,o;const a=function(c){if(!o){o=!0,l();const p=c instanceof Error?c:this.reason;s.abort(p instanceof x?p:new Ce(p instanceof Error?p.message:p))}};let n=e&&setTimeout(()=>{n=null,a(new x(`timeout of ${e}ms exceeded`,x.ETIMEDOUT))},e);const l=()=>{r&&(n&&clearTimeout(n),n=null,r.forEach(c=>{c.unsubscribe?c.unsubscribe(a):c.removeEventListener("abort",a)}),r=null)};r.forEach(c=>c.addEventListener("abort",a));const{signal:i}=s;return i.unsubscribe=()=>u.asap(l),i}},Za=function*(r,e){let t=r.byteLength;if(t{const o=eo(r,e);let a=0,n,l=i=>{n||(n=!0,s&&s(i))};return new ReadableStream({async pull(i){try{const{done:c,value:p}=await o.next();if(c){l(),i.close();return}let R=p.byteLength;if(t){let I=a+=R;t(I)}i.enqueue(new Uint8Array(p))}catch(c){throw l(c),c}},cancel(i){return l(i),o.return()}},{highWaterMark:2})},kt=64*1024,{isFunction:Fe}=u,ro=(({Request:r,Response:e})=>({Request:r,Response:e}))(u.global),{ReadableStream:_t,TextEncoder:Gt}=u.global,qt=(r,...e)=>{try{return!!r(...e)}catch{return!1}},so=r=>{r=u.merge.call({skipUndefined:!0},ro,r);const{fetch:e,Request:t,Response:s}=r,o=e?Fe(e):typeof fetch=="function",a=Fe(t),n=Fe(s);if(!o)return!1;const l=o&&Fe(_t),i=o&&(typeof Gt=="function"?(y=>f=>y.encode(f))(new Gt):async y=>new Uint8Array(await new t(y).arrayBuffer())),c=a&&l&&qt(()=>{let y=!1;const f=new t(q.origin,{body:new _t,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!f}),p=n&&l&&qt(()=>u.isReadableStream(new s("").body)),R={stream:p&&(y=>y.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!R[y]&&(R[y]=(f,w)=>{let U=f&&f[y];if(U)return U.call(f);throw new x(`Response type '${y}' is not supported`,x.ERR_NOT_SUPPORT,w)})});const I=async y=>{if(y==null)return 0;if(u.isBlob(y))return y.size;if(u.isSpecCompliantForm(y))return(await new t(q.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(u.isArrayBufferView(y)||u.isArrayBuffer(y))return y.byteLength;if(u.isURLSearchParams(y)&&(y=y+""),u.isString(y))return(await i(y)).byteLength},B=async(y,f)=>{const w=u.toFiniteNumber(y.getContentLength());return w??I(f)};return async y=>{let{url:f,method:w,data:U,signal:F,cancelToken:E,timeout:g,onDownloadProgress:T,onUploadProgress:D,responseType:C,headers:ie,withCredentials:te="same-origin",fetchOptions:Re}=Tr(y),Te=e||fetch;C=C?(C+"").toLowerCase():"text";let ue=Ya([F,E&&E.toAbortSignal()],g),k=null;const L=ue&&ue.unsubscribe&&(()=>{ue.unsubscribe()});let Oe;try{if(D&&c&&w!=="get"&&w!=="head"&&(Oe=await B(ie,U))!==0){let re=new t(f,{method:"POST",body:U,duplex:"half"}),me;if(u.isFormData(U)&&(me=re.headers.get("content-type"))&&ie.setContentType(me),re.body){const[Xe,De]=jt(Oe,Ne(Ft(D)));U=zt(re.body,kt,Xe,De)}}u.isString(te)||(te=te?"include":"omit");const M=a&&"credentials"in t.prototype,Pe={...Re,signal:ue,method:w.toUpperCase(),headers:ie.normalize().toJSON(),body:U,duplex:"half",credentials:M?te:void 0};k=a&&new t(f,Pe);let Q=await(a?Te(k,Re):Te(f,Pe));const Be=p&&(C==="stream"||C==="response");if(p&&(T||Be&&L)){const re={};["status","statusText","headers"].forEach(At=>{re[At]=Q[At]});const me=u.toFiniteNumber(Q.headers.get("content-length")),[Xe,De]=T&&jt(me,Ne(Ft(T),!0))||[];Q=new s(zt(Q.body,kt,Xe,()=>{De&&De(),L&&L()}),re)}C=C||"text";let kr=await R[u.findKey(R,C)||"text"](Q,y);return!Be&&L&&L(),await new Promise((re,me)=>{Ur(re,me,{data:kr,headers:N.from(Q.headers),status:Q.status,statusText:Q.statusText,config:y,request:k})})}catch(M){throw L&&L(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new x("Network Error",x.ERR_NETWORK,y,k),{cause:M.cause||M}):x.from(M,M&&M.code,y,k)}}},ao=new Map,Br=r=>{let e=r&&r.env||{};const{fetch:t,Request:s,Response:o}=e,a=[s,o,t];let n=a.length,l=n,i,c,p=ao;for(;l--;)i=a[l],c=p.get(i),c===void 0&&p.set(i,c=l?new Map:so(e)),p=c;return c};Br();const St={http:Ra,xhr:Xa,fetch:{get:Br}};u.forEach(St,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const Ht=r=>`- ${r}`,oo=r=>u.isFunction(r)||r===null||r===!1;function no(r,e){r=u.isArray(r)?r:[r];const{length:t}=r;let s,o;const a={};for(let n=0;n`adapter ${i} `+(c===!1?"is not supported by the environment":"is not available in the build"));let l=t?n.length>1?`since : diff --git a/webapp/assets/_app/immutable/chunks/DuwadzDF.js b/webapp/assets/_app/immutable/chunks/CiCSB29J.js similarity index 76% rename from webapp/assets/_app/immutable/chunks/DuwadzDF.js rename to webapp/assets/_app/immutable/chunks/CiCSB29J.js index 726cfb24..e60eaaae 100644 --- a/webapp/assets/_app/immutable/chunks/DuwadzDF.js +++ b/webapp/assets/_app/immutable/chunks/CiCSB29J.js @@ -1 +1 @@ -import{f as b,s as f,a as k}from"./ZGz3X54u.js";import{i as E}from"./CY7Wcm-1.js";import{p as C,t as P,u as i,h as t,a as j,s as z,c as l,r as o}from"./kDtaAWAK.js";import{c as N}from"./Cvcp5xHB.js";import{p as n}from"./Cun6jNAp.js";import{j as x,e as c,i as u}from"./DNHT2U_W.js";var T=b('');function F(d,r){C(r,!1);let e=n(r,"item",8),m=n(r,"eagerCache",8,null);E();var s=T(),a=l(s),v=l(a,!0);o(a);var p=z(a,2),h=l(p,!0);o(p),o(s),P((g,y,_)=>{N(a,"href",g),f(v,y),f(h,_)},[()=>(t(x),t(e()),i(()=>x(e()))),()=>(t(c),t(e()),t(m()),i(()=>c(e(),m()))),()=>(t(u),t(e()),i(()=>u(e())))]),k(d,s),j()}export{F as P}; +import{f as b,s as f,a as k}from"./ZGz3X54u.js";import{i as E}from"./CY7Wcm-1.js";import{p as C,t as P,u as i,h as t,a as j,s as z,c as l,r as o}from"./kDtaAWAK.js";import{c as N}from"./CYK-UalN.js";import{p as n}from"./Cun6jNAp.js";import{j as x,e as c,i as u}from"./ZelbukuJ.js";var T=b('');function F(d,r){C(r,!1);let e=n(r,"item",8),m=n(r,"eagerCache",8,null);E();var s=T(),a=l(s),v=l(a,!0);o(a);var p=z(a,2),h=l(p,!0);o(p),o(s),P((g,y,_)=>{N(a,"href",g),f(v,y),f(h,_)},[()=>(t(x),t(e()),i(()=>x(e()))),()=>(t(c),t(e()),t(m()),i(()=>c(e(),m()))),()=>(t(u),t(e()),i(()=>u(e())))]),k(d,s),j()}export{F as P}; diff --git a/webapp/assets/_app/immutable/chunks/CCoxuXg5.js b/webapp/assets/_app/immutable/chunks/CovvT05J.js similarity index 92% rename from webapp/assets/_app/immutable/chunks/CCoxuXg5.js rename to webapp/assets/_app/immutable/chunks/CovvT05J.js index 23987874..5243d2e4 100644 --- a/webapp/assets/_app/immutable/chunks/CCoxuXg5.js +++ b/webapp/assets/_app/immutable/chunks/CovvT05J.js @@ -1 +1 @@ -import{f as j,s as G,e as g,a as S}from"./ZGz3X54u.js";import{i as D}from"./CY7Wcm-1.js";import{p as E,v as H,c as t,r,s as u,u as p,h as m,n as f,t as I,a as q}from"./kDtaAWAK.js";import{h as y,s as h}from"./Cvcp5xHB.js";import{p as v}from"./Cun6jNAp.js";import{g as o}from"./DNHT2U_W.js";var z=j('
');function M(x,s){E(s,!1);const k=H();let i=v(s,"selectedForgeType",12,""),_=v(s,"label",8,"Select Forge Type");function n(c){i(c),k("select",c)}D();var l=z(),d=t(l),F=t(d,!0);r(d);var b=u(d,2),e=t(b),w=t(e);y(w,()=>(m(o),p(()=>o("github","w-8 h-8")))),f(2),r(e);var a=u(e,2),T=t(a);y(T,()=>(m(o),p(()=>o("gitea","w-8 h-8")))),f(2),r(a),r(b),r(l),I(()=>{G(F,_()),h(e,1,`flex flex-col items-center justify-center p-6 border-2 rounded-lg transition-colors cursor-pointer ${i()==="github"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),h(a,1,`flex flex-col items-center justify-center p-6 border-2 rounded-lg transition-colors cursor-pointer ${i()==="gitea"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`)}),g("click",e,()=>n("github")),g("click",a,()=>n("gitea")),S(x,l),q()}export{M as F}; +import{f as j,s as G,e as g,a as S}from"./ZGz3X54u.js";import{i as D}from"./CY7Wcm-1.js";import{p as E,v as H,c as t,r,s as u,u as p,h as m,n as f,t as I,a as q}from"./kDtaAWAK.js";import{h as y,s as h}from"./CYK-UalN.js";import{p as v}from"./Cun6jNAp.js";import{g as o}from"./ZelbukuJ.js";var z=j('
');function M(x,s){E(s,!1);const k=H();let i=v(s,"selectedForgeType",12,""),_=v(s,"label",8,"Select Forge Type");function n(c){i(c),k("select",c)}D();var l=z(),d=t(l),F=t(d,!0);r(d);var b=u(d,2),e=t(b),w=t(e);y(w,()=>(m(o),p(()=>o("github","w-8 h-8")))),f(2),r(e);var a=u(e,2),T=t(a);y(T,()=>(m(o),p(()=>o("gitea","w-8 h-8")))),f(2),r(a),r(b),r(l),I(()=>{G(F,_()),h(e,1,`flex flex-col items-center justify-center p-6 border-2 rounded-lg transition-colors cursor-pointer ${i()==="github"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),h(a,1,`flex flex-col items-center justify-center p-6 border-2 rounded-lg transition-colors cursor-pointer ${i()==="gitea"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`)}),g("click",e,()=>n("github")),g("click",a,()=>n("gitea")),S(x,l),q()}export{M as F}; diff --git a/webapp/assets/_app/immutable/chunks/BS0eXXA4.js b/webapp/assets/_app/immutable/chunks/DAg7Eq1U.js similarity index 98% rename from webapp/assets/_app/immutable/chunks/BS0eXXA4.js rename to webapp/assets/_app/immutable/chunks/DAg7Eq1U.js index 6f91410c..2ba8ad21 100644 --- a/webapp/assets/_app/immutable/chunks/BS0eXXA4.js +++ b/webapp/assets/_app/immutable/chunks/DAg7Eq1U.js @@ -1,2 +1,2 @@ -import{f as $,s as k,e as Ye,a as p,t as V,c as q}from"./ZGz3X54u.js";import{i as Zr}from"./CY7Wcm-1.js";import{p as et,v as rt,m as c,o as tt,d as s,q as at,l as ye,g as e,b as it,f as j,c as d,r as i,s as o,h as w,u as g,t as y,k as Ze,n as er,a as ot,i as dt}from"./kDtaAWAK.js";import{p as nt,i as m,s as st,a as lt}from"./Cun6jNAp.js";import{e as ut,i as pt}from"./DdT9Vz5Q.js";import{r as O,s as rr,b as tr,g as xe,d as Or,c as gt}from"./Cvcp5xHB.js";import{b as D,a as $r}from"./CYnNqrHp.js";import{p as ct}from"./CdEA5IGF.js";import{M as ft}from"./C6jYEeWP.js";import{e as zr}from"./BZiHL9L3.js";import{J as bt,U as vt,a as mt,b as _t}from"./C6Z10Ipi.js";import{e as yt}from"./C2c_wqo6.js";import{w as ar}from"./KU08Mex1.js";var xt=$('

'),ht=$('

'),kt=$('
Loading templates...
'),wt=$(""),St=$('

',1),Et=$('

Create a template first or proceed without a template to use default behavior.

'),Tt=$('
'),Rt=$('
Updating...
'),Mt=$('

Scale Set Information

Provider:
Entity:

Image & OS Configuration

Runner Limits & Timing

Advanced Settings

Extra Specs (JSON)
'),Ot=$(" ",1);function Bt(Ur,ir){et(ir,!1);const[Ar,jr]=st(),b=()=>lt(yt,"$eagerCache",Ar),z=c();let r=nt(ir,"scaleSet",8);const he=rt();let ie=c(!1),X=c(""),U=c(""),E=c([]),ke=c(!1),W=c(!1),F=null,oe=c(r().name||""),de=c(r().image||""),ne=c(r().flavor||""),I=c(r().max_runners),J=c(r().min_idle_runners),se=c(r().runner_bootstrap_timeout),le=c(r().runner_prefix||""),T=c(r().os_type||"linux"),Y=c(r().os_arch||"amd64"),ue=c(r()["github-runner-group"]||""),pe=c(r().enabled),Z=c(r().enable_shell??!1),N=c("{}"),A=c(r().template_id);function we(){if(r().endpoint?.endpoint_type)return r().endpoint.endpoint_type;if(r().repo_id){const n=b().repositories.find(a=>a.id===r().repo_id);if(n?.endpoint?.endpoint_type)return n.endpoint.endpoint_type}if(r().org_id){const n=b().organizations.find(a=>a.id===r().org_id);if(n?.endpoint?.endpoint_type)return n.endpoint.endpoint_type}if(r().enterprise_id){const n=b().enterprises.find(a=>a.id===r().enterprise_id);if(n?.endpoint?.endpoint_type)return n.endpoint.endpoint_type}return null}function Ir(){return r().repo_id?b().repositories.find(a=>a.id===r().repo_id)?.agent_mode??!1:r().org_id?b().organizations.find(a=>a.id===r().org_id)?.agent_mode??!1:r().enterprise_id?b().enterprises.find(a=>a.id===r().enterprise_id)?.agent_mode??!1:!1}function Jr(){return r().repo_id?"repository":r().org_id?"organization":r().enterprise_id?"enterprise":"entity"}function Se(n){if(n.operation!=="update")return;const a=n.payload;if(r().repo_id&&a.id===r().repo_id){const l=b().repositories.find(S=>S.id===r().repo_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(z,a.agent_mode??!1))}else if(r().org_id&&a.id===r().org_id){const l=b().organizations.find(S=>S.id===r().org_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(z,a.agent_mode??!1))}else if(r().enterprise_id&&a.id===r().enterprise_id){const l=b().enterprises.find(S=>S.id===r().enterprise_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(z,a.agent_mode??!1))}}async function Ee(n){try{if(r().repo_id){await xe.updateRepository(r().repo_id,n);const a=b().repositories.find(l=>l.id===r().repo_id);a&&Object.assign(a,n)}else if(r().org_id){await xe.updateOrganization(r().org_id,n);const a=b().organizations.find(l=>l.id===r().org_id);a&&Object.assign(a,n)}else if(r().enterprise_id){await xe.updateEnterprise(r().enterprise_id,n);const a=b().enterprises.find(l=>l.id===r().enterprise_id);a&&Object.assign(a,n)}s(W,!1)}catch(a){throw a}}function Nr(){return r().repo_id?b().repositories.find(n=>n.id===r().repo_id)||null:r().org_id?b().organizations.find(n=>n.id===r().org_id)||null:r().enterprise_id&&b().enterprises.find(n=>n.id===r().enterprise_id)||null}async function or(){try{s(ke,!0);const n=we();if(!n){s(E,[]);return}if(s(E,await xe.listTemplates(e(T),void 0,n)),!e(A)||!e(E).find(a=>a.id===e(A))){const a=e(E).find(l=>l.owner_id==="system");a?s(A,a.id):e(E).length>0&&s(A,e(E)[0].id)}}catch(n){s(X,zr(n))}finally{s(ke,!1)}}tt(()=>{if(r().extra_specs)try{if(typeof r().extra_specs=="object")s(N,JSON.stringify(r().extra_specs,null,2));else{const n=JSON.parse(r().extra_specs);s(N,JSON.stringify(n,null,2))}}catch{s(N,r().extra_specs||"{}")}or(),r().repo_id?F=ar.subscribeToEntity("repository",["update"],Se):r().org_id?F=ar.subscribeToEntity("organization",["update"],Se):r().enterprise_id&&(F=ar.subscribeToEntity("enterprise",["update"],Se))}),at(()=>{F&&(F(),F=null)});async function Cr(){try{if(s(ie,!0),s(X,""),e(U))throw new Error(e(U));let n={};if(e(N).trim())try{n=JSON.parse(e(N))}catch{throw new Error("Invalid JSON in extra specs")}const a={name:e(oe)!==r().name?e(oe):void 0,image:e(de)!==r().image?e(de):void 0,flavor:e(ne)!==r().flavor?e(ne):void 0,max_runners:e(I)!==r().max_runners?e(I):void 0,min_idle_runners:e(J)!==r().min_idle_runners?e(J):void 0,runner_bootstrap_timeout:e(se)!==r().runner_bootstrap_timeout?e(se):void 0,runner_prefix:e(le)!==r().runner_prefix?e(le):void 0,os_type:e(T)!==r().os_type?e(T):void 0,os_arch:e(Y)!==r().os_arch?e(Y):void 0,"github-runner-group":e(ue)!==r()["github-runner-group"]&&e(ue)||void 0,enabled:e(pe)!==r().enabled?e(pe):void 0,enable_shell:e(Z)!==r().enable_shell?e(Z):void 0,extra_specs:e(N).trim()!==JSON.stringify(r().extra_specs||{},null,2).trim()?n:void 0,template_id:e(A)!==r().template_id?e(A):void 0};Object.keys(a).forEach(l=>{a[l]===void 0&&delete a[l]}),he("submit",a)}catch(n){s(X,zr(n))}finally{s(ie,!1)}}ye(()=>{},()=>{s(z,Ir())}),ye(()=>e(z),()=>{e(z)||s(Z,!1)}),ye(()=>e(T),()=>{e(T)&&or()}),ye(()=>(e(J),e(I)),()=>{e(J)!==null&&e(J)!==void 0&&e(I)!==null&&e(I)!==void 0&&e(J)>e(I)?s(U,"Min idle runners cannot be greater than max runners"):s(U,"")}),it(),Zr();var dr=Ot(),nr=j(dr);ft(nr,{$$events:{close:()=>he("close")},children:(n,a)=>{var l=Mt(),S=d(l),ge=d(S),ee=d(ge);i(ge),i(S);var H=o(S,2),ce=d(H);{var Te=t=>{var u=xt(),x=d(u),R=d(x,!0);i(x),i(u),y(()=>k(R,e(X))),p(t,u)};m(ce,t=>{e(X)&&t(Te)})}var fe=o(ce,2);{var C=t=>{var u=ht(),x=d(u),R=d(x,!0);i(x),i(u),y(()=>k(R,e(U))),p(t,u)};m(fe,t=>{e(U)&&t(C)})}var P=o(fe,2),be=o(d(P),2),re=d(be),ve=o(d(re),2),G=d(ve,!0);i(ve),i(re);var L=o(re,2),me=o(d(L),2),Re=d(me);{var te=t=>{var u=V();y(()=>k(u,`Repository: ${w(r()),g(()=>r().repo_name)??""}`)),p(t,u)},Me=t=>{var u=q(),x=j(u);{var R=v=>{var h=V();y(()=>k(h,`Organization: ${w(r()),g(()=>r().org_name)??""}`)),p(v,h)},ae=v=>{var h=q(),M=j(h);{var K=_=>{var f=V();y(()=>k(f,`Enterprise: ${w(r()),g(()=>r().enterprise_name)??""}`)),p(_,f)},Q=_=>{var f=V("Unknown Entity");p(_,f)};m(M,_=>{w(r()),g(()=>r().enterprise_name)?_(K):_(Q,!1)},!0)}p(v,h)};m(x,v=>{w(r()),g(()=>r().org_name)?v(R):v(ae,!1)},!0)}p(t,u)};m(Re,t=>{w(r()),g(()=>r().repo_name)?t(te):t(Me,!1)})}i(me),i(L),i(be),i(P);var Oe=o(P,2),sr=o(d(Oe),2);O(sr),i(Oe);var $e=o(Oe,2),lr=o(d($e),2),ze=d(lr),ur=o(d(ze),2);O(ur),i(ze);var Ue=o(ze,2),pr=o(d(Ue),2);O(pr),i(Ue);var Ae=o(Ue,2),je=o(d(Ae),2);y(()=>{e(T),Ze(()=>{})});var Ie=d(je);Ie.value=Ie.__value="linux";var gr=o(Ie);gr.value=gr.__value="windows",i(je),i(Ae);var Je=o(Ae,2),Ne=o(d(Je),2);y(()=>{e(Y),Ze(()=>{})});var Ce=d(Ne);Ce.value=Ce.__value="amd64";var cr=o(Ce);cr.value=cr.__value="arm64",i(Ne),i(Je);var fr=o(Je,2),Dr=o(d(fr),2);{var Lr=t=>{var u=kt();p(t,u)},Br=t=>{var u=q(),x=j(u);{var R=v=>{var h=St(),M=j(h);y(()=>{e(A),Ze(()=>{e(E)})}),ut(M,5,()=>e(E),pt,(_,f)=>{var B=wt(),Tr=d(B),Xr=o(Tr);{var Yr=Xe=>{var Mr=V();y(()=>k(Mr,`- ${e(f),g(()=>e(f).description)??""}`)),p(Xe,Mr)};m(Xr,Xe=>{e(f),g(()=>e(f).description)&&Xe(Yr)})}i(B);var Rr={};y(()=>{k(Tr,`${e(f),g(()=>e(f).name)??""} ${e(f),g(()=>e(f).owner_id==="system"?"(System)":"")??""} `),Rr!==(Rr=(e(f),g(()=>e(f).id)))&&(B.value=(B.__value=(e(f),g(()=>e(f).id)))??"")}),p(_,B)}),i(M);var K=o(M,2),Q=d(K);i(K),y(_=>k(Q,`Templates define how the runner software is installed and configured. +import{f as $,s as k,e as Ye,a as p,t as V,c as q}from"./ZGz3X54u.js";import{i as Zr}from"./CY7Wcm-1.js";import{p as et,v as rt,m as c,o as tt,d as s,q as at,l as ye,g as e,b as it,f as j,c as d,r as i,s as o,h as w,u as g,t as y,k as Ze,n as er,a as ot,i as dt}from"./kDtaAWAK.js";import{p as nt,i as m,s as st,a as lt}from"./Cun6jNAp.js";import{e as ut,i as pt}from"./DdT9Vz5Q.js";import{r as O,s as rr,b as tr,g as xe,d as Or,c as gt}from"./CYK-UalN.js";import{b as D,a as $r}from"./CYnNqrHp.js";import{p as ct}from"./CdEA5IGF.js";import{M as ft}from"./CVBpH3Sf.js";import{e as zr}from"./BZiHL9L3.js";import{J as bt,U as vt,a as mt,b as _t}from"./C6-Yv_jr.js";import{e as yt}from"./Vo3Mv3dp.js";import{w as ar}from"./KU08Mex1.js";var xt=$('

'),ht=$('

'),kt=$('
Loading templates...
'),wt=$(""),St=$('

',1),Et=$('

Create a template first or proceed without a template to use default behavior.

'),Tt=$('
'),Rt=$('
Updating...
'),Mt=$('

Scale Set Information

Provider:
Entity:

Image & OS Configuration

Runner Limits & Timing

Advanced Settings

Extra Specs (JSON)
'),Ot=$(" ",1);function Bt(Ur,ir){et(ir,!1);const[Ar,jr]=st(),b=()=>lt(yt,"$eagerCache",Ar),z=c();let r=nt(ir,"scaleSet",8);const he=rt();let ie=c(!1),X=c(""),U=c(""),E=c([]),ke=c(!1),W=c(!1),F=null,oe=c(r().name||""),de=c(r().image||""),ne=c(r().flavor||""),I=c(r().max_runners),J=c(r().min_idle_runners),se=c(r().runner_bootstrap_timeout),le=c(r().runner_prefix||""),T=c(r().os_type||"linux"),Y=c(r().os_arch||"amd64"),ue=c(r()["github-runner-group"]||""),pe=c(r().enabled),Z=c(r().enable_shell??!1),N=c("{}"),A=c(r().template_id);function we(){if(r().endpoint?.endpoint_type)return r().endpoint.endpoint_type;if(r().repo_id){const n=b().repositories.find(a=>a.id===r().repo_id);if(n?.endpoint?.endpoint_type)return n.endpoint.endpoint_type}if(r().org_id){const n=b().organizations.find(a=>a.id===r().org_id);if(n?.endpoint?.endpoint_type)return n.endpoint.endpoint_type}if(r().enterprise_id){const n=b().enterprises.find(a=>a.id===r().enterprise_id);if(n?.endpoint?.endpoint_type)return n.endpoint.endpoint_type}return null}function Ir(){return r().repo_id?b().repositories.find(a=>a.id===r().repo_id)?.agent_mode??!1:r().org_id?b().organizations.find(a=>a.id===r().org_id)?.agent_mode??!1:r().enterprise_id?b().enterprises.find(a=>a.id===r().enterprise_id)?.agent_mode??!1:!1}function Jr(){return r().repo_id?"repository":r().org_id?"organization":r().enterprise_id?"enterprise":"entity"}function Se(n){if(n.operation!=="update")return;const a=n.payload;if(r().repo_id&&a.id===r().repo_id){const l=b().repositories.find(S=>S.id===r().repo_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(z,a.agent_mode??!1))}else if(r().org_id&&a.id===r().org_id){const l=b().organizations.find(S=>S.id===r().org_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(z,a.agent_mode??!1))}else if(r().enterprise_id&&a.id===r().enterprise_id){const l=b().enterprises.find(S=>S.id===r().enterprise_id);l&&(Object.assign(l,a),"agent_mode"in a&&s(z,a.agent_mode??!1))}}async function Ee(n){try{if(r().repo_id){await xe.updateRepository(r().repo_id,n);const a=b().repositories.find(l=>l.id===r().repo_id);a&&Object.assign(a,n)}else if(r().org_id){await xe.updateOrganization(r().org_id,n);const a=b().organizations.find(l=>l.id===r().org_id);a&&Object.assign(a,n)}else if(r().enterprise_id){await xe.updateEnterprise(r().enterprise_id,n);const a=b().enterprises.find(l=>l.id===r().enterprise_id);a&&Object.assign(a,n)}s(W,!1)}catch(a){throw a}}function Nr(){return r().repo_id?b().repositories.find(n=>n.id===r().repo_id)||null:r().org_id?b().organizations.find(n=>n.id===r().org_id)||null:r().enterprise_id&&b().enterprises.find(n=>n.id===r().enterprise_id)||null}async function or(){try{s(ke,!0);const n=we();if(!n){s(E,[]);return}if(s(E,await xe.listTemplates(e(T),void 0,n)),!e(A)||!e(E).find(a=>a.id===e(A))){const a=e(E).find(l=>l.owner_id==="system");a?s(A,a.id):e(E).length>0&&s(A,e(E)[0].id)}}catch(n){s(X,zr(n))}finally{s(ke,!1)}}tt(()=>{if(r().extra_specs)try{if(typeof r().extra_specs=="object")s(N,JSON.stringify(r().extra_specs,null,2));else{const n=JSON.parse(r().extra_specs);s(N,JSON.stringify(n,null,2))}}catch{s(N,r().extra_specs||"{}")}or(),r().repo_id?F=ar.subscribeToEntity("repository",["update"],Se):r().org_id?F=ar.subscribeToEntity("organization",["update"],Se):r().enterprise_id&&(F=ar.subscribeToEntity("enterprise",["update"],Se))}),at(()=>{F&&(F(),F=null)});async function Cr(){try{if(s(ie,!0),s(X,""),e(U))throw new Error(e(U));let n={};if(e(N).trim())try{n=JSON.parse(e(N))}catch{throw new Error("Invalid JSON in extra specs")}const a={name:e(oe)!==r().name?e(oe):void 0,image:e(de)!==r().image?e(de):void 0,flavor:e(ne)!==r().flavor?e(ne):void 0,max_runners:e(I)!==r().max_runners?e(I):void 0,min_idle_runners:e(J)!==r().min_idle_runners?e(J):void 0,runner_bootstrap_timeout:e(se)!==r().runner_bootstrap_timeout?e(se):void 0,runner_prefix:e(le)!==r().runner_prefix?e(le):void 0,os_type:e(T)!==r().os_type?e(T):void 0,os_arch:e(Y)!==r().os_arch?e(Y):void 0,"github-runner-group":e(ue)!==r()["github-runner-group"]&&e(ue)||void 0,enabled:e(pe)!==r().enabled?e(pe):void 0,enable_shell:e(Z)!==r().enable_shell?e(Z):void 0,extra_specs:e(N).trim()!==JSON.stringify(r().extra_specs||{},null,2).trim()?n:void 0,template_id:e(A)!==r().template_id?e(A):void 0};Object.keys(a).forEach(l=>{a[l]===void 0&&delete a[l]}),he("submit",a)}catch(n){s(X,zr(n))}finally{s(ie,!1)}}ye(()=>{},()=>{s(z,Ir())}),ye(()=>e(z),()=>{e(z)||s(Z,!1)}),ye(()=>e(T),()=>{e(T)&&or()}),ye(()=>(e(J),e(I)),()=>{e(J)!==null&&e(J)!==void 0&&e(I)!==null&&e(I)!==void 0&&e(J)>e(I)?s(U,"Min idle runners cannot be greater than max runners"):s(U,"")}),it(),Zr();var dr=Ot(),nr=j(dr);ft(nr,{$$events:{close:()=>he("close")},children:(n,a)=>{var l=Mt(),S=d(l),ge=d(S),ee=d(ge);i(ge),i(S);var H=o(S,2),ce=d(H);{var Te=t=>{var u=xt(),x=d(u),R=d(x,!0);i(x),i(u),y(()=>k(R,e(X))),p(t,u)};m(ce,t=>{e(X)&&t(Te)})}var fe=o(ce,2);{var C=t=>{var u=ht(),x=d(u),R=d(x,!0);i(x),i(u),y(()=>k(R,e(U))),p(t,u)};m(fe,t=>{e(U)&&t(C)})}var P=o(fe,2),be=o(d(P),2),re=d(be),ve=o(d(re),2),G=d(ve,!0);i(ve),i(re);var L=o(re,2),me=o(d(L),2),Re=d(me);{var te=t=>{var u=V();y(()=>k(u,`Repository: ${w(r()),g(()=>r().repo_name)??""}`)),p(t,u)},Me=t=>{var u=q(),x=j(u);{var R=v=>{var h=V();y(()=>k(h,`Organization: ${w(r()),g(()=>r().org_name)??""}`)),p(v,h)},ae=v=>{var h=q(),M=j(h);{var K=_=>{var f=V();y(()=>k(f,`Enterprise: ${w(r()),g(()=>r().enterprise_name)??""}`)),p(_,f)},Q=_=>{var f=V("Unknown Entity");p(_,f)};m(M,_=>{w(r()),g(()=>r().enterprise_name)?_(K):_(Q,!1)},!0)}p(v,h)};m(x,v=>{w(r()),g(()=>r().org_name)?v(R):v(ae,!1)},!0)}p(t,u)};m(Re,t=>{w(r()),g(()=>r().repo_name)?t(te):t(Me,!1)})}i(me),i(L),i(be),i(P);var Oe=o(P,2),sr=o(d(Oe),2);O(sr),i(Oe);var $e=o(Oe,2),lr=o(d($e),2),ze=d(lr),ur=o(d(ze),2);O(ur),i(ze);var Ue=o(ze,2),pr=o(d(Ue),2);O(pr),i(Ue);var Ae=o(Ue,2),je=o(d(Ae),2);y(()=>{e(T),Ze(()=>{})});var Ie=d(je);Ie.value=Ie.__value="linux";var gr=o(Ie);gr.value=gr.__value="windows",i(je),i(Ae);var Je=o(Ae,2),Ne=o(d(Je),2);y(()=>{e(Y),Ze(()=>{})});var Ce=d(Ne);Ce.value=Ce.__value="amd64";var cr=o(Ce);cr.value=cr.__value="arm64",i(Ne),i(Je);var fr=o(Je,2),Dr=o(d(fr),2);{var Lr=t=>{var u=kt();p(t,u)},Br=t=>{var u=q(),x=j(u);{var R=v=>{var h=St(),M=j(h);y(()=>{e(A),Ze(()=>{e(E)})}),ut(M,5,()=>e(E),pt,(_,f)=>{var B=wt(),Tr=d(B),Xr=o(Tr);{var Yr=Xe=>{var Mr=V();y(()=>k(Mr,`- ${e(f),g(()=>e(f).description)??""}`)),p(Xe,Mr)};m(Xr,Xe=>{e(f),g(()=>e(f).description)&&Xe(Yr)})}i(B);var Rr={};y(()=>{k(Tr,`${e(f),g(()=>e(f).name)??""} ${e(f),g(()=>e(f).owner_id==="system"?"(System)":"")??""} `),Rr!==(Rr=(e(f),g(()=>e(f).id)))&&(B.value=(B.__value=(e(f),g(()=>e(f).id)))??"")}),p(_,B)}),i(M);var K=o(M,2),Q=d(K);i(K),y(_=>k(Q,`Templates define how the runner software is installed and configured. Showing templates for ${_??""} ${e(T)??""}.`),[()=>g(we)]),tr(M,()=>e(A),_=>s(A,_)),p(v,h)},ae=v=>{var h=Et(),M=d(h),K=d(M);i(M);var Q=o(M,2),_=d(Q);er(),i(Q),i(h),y((f,B)=>{k(K,`No templates found for ${f??""} ${e(T)??""}.`),gt(_,"href",B)},[()=>g(we),()=>(w(Or),g(()=>Or("/templates")))]),p(v,h)};m(x,v=>{e(E),g(()=>e(E).length>0)?v(R):v(ae,!1)},!0)}p(t,u)};m(Dr,t=>{e(ke)?t(Lr):t(Br,!1)})}i(fr),i(lr),i($e);var Pe=o($e,2),br=o(d(Pe),2),Ge=d(br),De=o(d(Ge),2);O(De),i(Ge);var Le=o(Ge,2),Be=o(d(Le),2);O(Be),i(Le);var vr=o(Le,2),mr=o(d(vr),2);O(mr),i(vr),i(br),i(Pe);var qe=o(Pe,2),We=o(d(qe),2),Fe=d(We),_r=o(d(Fe),2);O(_r),i(Fe);var yr=o(Fe,2),xr=o(d(yr),2);O(xr),i(yr),i(We);var He=o(We,2),hr=d(He),qr=o(d(hr),2);bt(qr,{rows:4,placeholder:"{}",get value(){return e(N)},set value(t){s(N,t)},$$legacy:!0}),i(hr),i(He);var Ke=o(He,2),kr=d(Ke);O(kr),er(2),i(Ke);var wr=o(Ke,2),Qe=d(wr),_e=d(Qe);O(_e);var Wr=o(_e,2);er(2),i(Qe);var Fr=o(Qe,2);{var Hr=t=>{var u=Tt(),x=o(d(u),2),R=d(x),ae=o(R);i(x),i(u),y(v=>k(R,`Shell access requires agent mode to be enabled on the ${v??""}. `),[()=>g(Jr)]),Ye("click",ae,()=>s(W,!0)),p(t,u)};m(Fr,t=>{e(z)||t(Hr)})}i(wr),i(qe);var Sr=o(qe,2),Er=d(Sr),Ve=o(Er,2),Kr=d(Ve);{var Qr=t=>{var u=Rt();p(t,u)},Vr=t=>{var u=V("Update Scale Set");p(t,u)};m(Kr,t=>{e(ie)?t(Qr):t(Vr,!1)})}i(Ve),i(Sr),i(H),i(l),y(()=>{k(ee,`Update Scale Set ${w(r()),g(()=>r().name)??""}`),k(G,(w(r()),g(()=>r().provider_name))),rr(De,1,`w-full px-3 py-2 border ${e(U)?"border-red-300 dark:border-red-500":"border-gray-300 dark:border-gray-600"} rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white`),rr(Be,1,`w-full px-3 py-2 border ${e(U)?"border-red-300 dark:border-red-500":"border-gray-300 dark:border-gray-600"} rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white`),_e.disabled=!e(z),rr(Wr,1,`ml-2 block text-sm font-medium text-gray-700 dark:text-gray-300 ${e(z)?"":"opacity-50"}`),Ve.disabled=e(ie)||e(U)!==""}),D(sr,()=>e(oe),t=>s(oe,t)),D(ur,()=>e(de),t=>s(de,t)),D(pr,()=>e(ne),t=>s(ne,t)),tr(je,()=>e(T),t=>s(T,t)),tr(Ne,()=>e(Y),t=>s(Y,t)),D(De,()=>e(J),t=>s(J,t)),D(Be,()=>e(I),t=>s(I,t)),D(mr,()=>e(se),t=>s(se,t)),D(_r,()=>e(le),t=>s(le,t)),D(xr,()=>e(ue),t=>s(ue,t)),$r(kr,()=>e(pe),t=>s(pe,t)),$r(_e,()=>e(Z),t=>s(Z,t)),Ye("click",Er,()=>he("close")),Ye("submit",H,ct(Cr)),p(n,l)},$$slots:{default:!0}});var Pr=o(nr,2);{var Gr=n=>{const a=dt(()=>g(Nr));var l=q(),S=j(l);{var ge=ee=>{var H=q(),ce=j(H);{var Te=C=>{vt(C,{get repository(){return e(a)},$$events:{close:()=>s(W,!1),submit:P=>Ee(P.detail)}})},fe=C=>{var P=q(),be=j(P);{var re=G=>{mt(G,{get organization(){return e(a)},$$events:{close:()=>s(W,!1),submit:L=>Ee(L.detail)}})},ve=G=>{var L=q(),me=j(L);{var Re=te=>{_t(te,{get enterprise(){return e(a)},$$events:{close:()=>s(W,!1),submit:Me=>Ee(Me.detail)}})};m(me,te=>{w(r()),g(()=>r().enterprise_id)&&te(Re)},!0)}p(G,L)};m(be,G=>{w(r()),g(()=>r().org_id)?G(re):G(ve,!1)},!0)}p(C,P)};m(ce,C=>{w(r()),g(()=>r().repo_id)?C(Te):C(fe,!1)})}p(ee,H)};m(S,ee=>{e(a)&&ee(ge)})}p(n,l)};m(Pr,n=>{e(W)&&n(Gr)})}p(Ur,dr),ot(),jr()}export{Bt as U}; diff --git a/webapp/assets/_app/immutable/chunks/-FPg0SOX.js b/webapp/assets/_app/immutable/chunks/DC7O3Apj.js similarity index 99% rename from webapp/assets/_app/immutable/chunks/-FPg0SOX.js rename to webapp/assets/_app/immutable/chunks/DC7O3Apj.js index 8fecfdb0..5fc43370 100644 --- a/webapp/assets/_app/immutable/chunks/-FPg0SOX.js +++ b/webapp/assets/_app/immutable/chunks/DC7O3Apj.js @@ -1,4 +1,4 @@ -import{f as We,s as Xe,e as Te,a as De,c as St,b as lt}from"./ZGz3X54u.js";import{i as Ct}from"./CY7Wcm-1.js";import{y as bt,u as Se,z as wt,h as yt,aU as Et,p as kt,o as Lt,g as R,m as we,j as te,d as ne,q as Dt,l as me,aF as it,b as Rt,c as ve,r as _e,s as Be,t as ze,f as xt,a as At}from"./kDtaAWAK.js";import{p as st,i as je}from"./Cun6jNAp.js";import{e as rt}from"./DdT9Vz5Q.js";import{s as nt,c as qe}from"./Cvcp5xHB.js";import{b as Tt}from"./DochbgGJ.js";import{s as Bt}from"./CdEA5IGF.js";function Mt(oe,re,X){bt(()=>{var Y=Se(()=>re(oe,X?.())||{});if(X&&Y?.update){var Z=!1,he={};wt(()=>{var O=X();yt(O),Z&&Et(he,O)&&(he=O,Y.update(O))}),Z=!0}if(Y?.destroy)return()=>Y.destroy()})}const Ot=5,ct=6,Pt=7,It=8,Ht=9;function Qe(oe,re){const X=new ArrayBuffer(1+re.byteLength);return new DataView(X).setUint8(0,oe),new Uint8Array(X,1).set(new Uint8Array(re)),X}function Ft(oe){const re=new DataView(oe);if(oe.byteLength<1)throw new Error("Message too short");return{type:re.getUint8(0),payload:oe.slice(1)}}function Wt(oe,re){const X=new ArrayBuffer(16+re.length);return new Uint8Array(X,0,16).set(new Uint8Array(oe)),new Uint8Array(X,16).set(re),Qe(ct,X)}function $t(oe,re,X){const Y=new ArrayBuffer(20),Z=new DataView(Y);return new Uint8Array(Y,0,16).set(new Uint8Array(oe)),Z.setUint16(16,X,!1),Z.setUint16(18,re,!1),Qe(Pt,Y)}function Ut(oe){const re=new ArrayBuffer(16);return new Uint8Array(re).set(new Uint8Array(oe)),Qe(Ht,re)}function Nt(oe,re,X,Y,Z){return new Promise((he,O)=>{try{const o=`${window.location.origin.replace(/^http/,"ws")}/api/v1/ws/agent/${encodeURIComponent(oe)}/shell`,c=new WebSocket(o);c.binaryType="arraybuffer";let _=null,r=!1;const d={ws:c,sessionId:null,onData:re,onReady:X,onExit:Y,onError:Z,sendData:f=>{if(_&&c.readyState===WebSocket.OPEN){const u=Wt(_,f);c.send(u)}},resize:(f,u)=>{if(_&&c.readyState===WebSocket.OPEN){const h=$t(_,f,u);c.send(h)}},close:()=>{if(_&&c.readyState===WebSocket.OPEN){const f=Ut(_);c.send(f)}c.close()}};c.onopen=()=>{r=!0},c.onmessage=f=>{try{const{type:u,payload:h}=Ft(f.data);switch(u){case Ot:if(h.byteLength>=17){const i=new DataView(h),s=h.slice(0,16),e=i.getUint8(16),t=h.byteLength>17?new TextDecoder("utf-8").decode(h.slice(17)):"";e?Z(t||"Shell initialization failed"):(_=s,d.sessionId=_,X())}break;case ct:if(h.byteLength>=16){const i=new Uint8Array(h.slice(16));re(i)}break;case It:Y();break;default:console.warn("Unknown message type:",u);break}}catch(u){Z(`Failed to parse message: ${u instanceof Error?u.message:"Unknown error"}`)}},c.onerror=f=>{Z("WebSocket error occurred")},c.onclose=f=>{r?Y():O(new Error(`Failed to connect: ${f.reason||"Connection closed"}`))},he(d)}catch(n){O(n)}})}var Ye={exports:{}},ot;function zt(){return ot||(ot=1,function(oe,re){(function(X,Y){oe.exports=Y()})(globalThis,()=>(()=>{var X={4567:function(O,n,o){var c=this&&this.__decorate||function(e,t,a,g){var v,p=arguments.length,l=p<3?t:g===null?g=Object.getOwnPropertyDescriptor(t,a):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,a,g);else for(var S=e.length-1;S>=0;S--)(v=e[S])&&(l=(p<3?v(l):p>3?v(t,a,l):v(t,a))||l);return p>3&&l&&Object.defineProperty(t,a,l),l},_=this&&this.__param||function(e,t){return function(a,g){t(a,g,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.AccessibilityManager=void 0;const r=o(9042),d=o(9924),f=o(844),u=o(4725),h=o(2585),i=o(3656);let s=n.AccessibilityManager=class extends f.Disposable{constructor(e,t,a,g){super(),this._terminal=e,this._coreBrowserService=a,this._renderService=g,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let v=0;vthis._handleBoundaryFocus(v,0),this._bottomBoundaryFocusListener=v=>this._handleBoundaryFocus(v,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new d.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(v=>this._handleResize(v.rows))),this.register(this._terminal.onRender(v=>this._refreshRows(v.start,v.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(v=>this._handleChar(v))),this.register(this._terminal.onLineFeed(()=>this._handleChar(` +import{f as We,s as Xe,e as Te,a as De,c as St,b as lt}from"./ZGz3X54u.js";import{i as Ct}from"./CY7Wcm-1.js";import{y as bt,u as Se,z as wt,h as yt,aU as Et,p as kt,o as Lt,g as R,m as we,j as te,d as ne,q as Dt,l as me,aF as it,b as Rt,c as ve,r as _e,s as Be,t as ze,f as xt,a as At}from"./kDtaAWAK.js";import{p as st,i as je}from"./Cun6jNAp.js";import{e as rt}from"./DdT9Vz5Q.js";import{s as nt,c as qe}from"./CYK-UalN.js";import{b as Tt}from"./DochbgGJ.js";import{s as Bt}from"./CdEA5IGF.js";function Mt(oe,re,X){bt(()=>{var Y=Se(()=>re(oe,X?.())||{});if(X&&Y?.update){var Z=!1,he={};wt(()=>{var O=X();yt(O),Z&&Et(he,O)&&(he=O,Y.update(O))}),Z=!0}if(Y?.destroy)return()=>Y.destroy()})}const Ot=5,ct=6,Pt=7,It=8,Ht=9;function Qe(oe,re){const X=new ArrayBuffer(1+re.byteLength);return new DataView(X).setUint8(0,oe),new Uint8Array(X,1).set(new Uint8Array(re)),X}function Ft(oe){const re=new DataView(oe);if(oe.byteLength<1)throw new Error("Message too short");return{type:re.getUint8(0),payload:oe.slice(1)}}function Wt(oe,re){const X=new ArrayBuffer(16+re.length);return new Uint8Array(X,0,16).set(new Uint8Array(oe)),new Uint8Array(X,16).set(re),Qe(ct,X)}function $t(oe,re,X){const Y=new ArrayBuffer(20),Z=new DataView(Y);return new Uint8Array(Y,0,16).set(new Uint8Array(oe)),Z.setUint16(16,X,!1),Z.setUint16(18,re,!1),Qe(Pt,Y)}function Ut(oe){const re=new ArrayBuffer(16);return new Uint8Array(re).set(new Uint8Array(oe)),Qe(Ht,re)}function Nt(oe,re,X,Y,Z){return new Promise((he,O)=>{try{const o=`${window.location.origin.replace(/^http/,"ws")}/api/v1/ws/agent/${encodeURIComponent(oe)}/shell`,c=new WebSocket(o);c.binaryType="arraybuffer";let _=null,r=!1;const d={ws:c,sessionId:null,onData:re,onReady:X,onExit:Y,onError:Z,sendData:f=>{if(_&&c.readyState===WebSocket.OPEN){const u=Wt(_,f);c.send(u)}},resize:(f,u)=>{if(_&&c.readyState===WebSocket.OPEN){const h=$t(_,f,u);c.send(h)}},close:()=>{if(_&&c.readyState===WebSocket.OPEN){const f=Ut(_);c.send(f)}c.close()}};c.onopen=()=>{r=!0},c.onmessage=f=>{try{const{type:u,payload:h}=Ft(f.data);switch(u){case Ot:if(h.byteLength>=17){const i=new DataView(h),s=h.slice(0,16),e=i.getUint8(16),t=h.byteLength>17?new TextDecoder("utf-8").decode(h.slice(17)):"";e?Z(t||"Shell initialization failed"):(_=s,d.sessionId=_,X())}break;case ct:if(h.byteLength>=16){const i=new Uint8Array(h.slice(16));re(i)}break;case It:Y();break;default:console.warn("Unknown message type:",u);break}}catch(u){Z(`Failed to parse message: ${u instanceof Error?u.message:"Unknown error"}`)}},c.onerror=f=>{Z("WebSocket error occurred")},c.onclose=f=>{r?Y():O(new Error(`Failed to connect: ${f.reason||"Connection closed"}`))},he(d)}catch(n){O(n)}})}var Ye={exports:{}},ot;function zt(){return ot||(ot=1,function(oe,re){(function(X,Y){oe.exports=Y()})(globalThis,()=>(()=>{var X={4567:function(O,n,o){var c=this&&this.__decorate||function(e,t,a,g){var v,p=arguments.length,l=p<3?t:g===null?g=Object.getOwnPropertyDescriptor(t,a):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,a,g);else for(var S=e.length-1;S>=0;S--)(v=e[S])&&(l=(p<3?v(l):p>3?v(t,a,l):v(t,a))||l);return p>3&&l&&Object.defineProperty(t,a,l),l},_=this&&this.__param||function(e,t){return function(a,g){t(a,g,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.AccessibilityManager=void 0;const r=o(9042),d=o(9924),f=o(844),u=o(4725),h=o(2585),i=o(3656);let s=n.AccessibilityManager=class extends f.Disposable{constructor(e,t,a,g){super(),this._terminal=e,this._coreBrowserService=a,this._renderService=g,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let v=0;vthis._handleBoundaryFocus(v,0),this._bottomBoundaryFocusListener=v=>this._handleBoundaryFocus(v,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new d.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(v=>this._handleResize(v.rows))),this.register(this._terminal.onRender(v=>this._refreshRows(v.start,v.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(v=>this._handleChar(v))),this.register(this._terminal.onLineFeed(()=>this._handleChar(` `))),this.register(this._terminal.onA11yTab(v=>this._handleTab(v))),this.register(this._terminal.onKey(v=>this._handleKey(v.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,i.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,f.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=r.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){const a=this._terminal.buffer,g=a.lines.length.toString();for(let v=e;v<=t;v++){const p=a.lines.get(a.ydisp+v),l=[],S=p?.translateToString(!0,void 0,void 0,l)||"",E=(a.ydisp+v+1).toString(),k=this._rowElements[v];k&&(S.length===0?(k.innerText=" ",this._rowColumns.set(k,[0,1])):(k.textContent=S,this._rowColumns.set(k,l)),k.setAttribute("aria-posinset",E),k.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const a=e.target,g=this._rowElements[t===0?1:this._rowElements.length-2];if(a.getAttribute("aria-posinset")===(t===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==g)return;let v,p;if(t===0?(v=a,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(v=this._rowElements.shift(),p=a,this._rowContainer.removeChild(v)),v.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){const l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{const l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}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;const e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let t={node:e.anchorNode,offset:e.anchorOffset},a={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(a.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===a.node&&t.offset>a.offset)&&([t,a]=[a,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;const g=this._rowElements.slice(-1)[0];if(a.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(a={node:g,offset:g.textContent?.length??0}),!this._rowContainer.contains(a.node))return;const v=({node:S,offset:E})=>{const k=S instanceof Text?S.parentNode:S;let x=parseInt(k?.getAttribute("aria-posinset"),10)-1;if(isNaN(x))return console.warn("row is invalid. Race condition?"),null;const w=this._rowColumns.get(k);if(!w)return console.warn("columns is null. Race condition?"),null;let B=E=this._terminal.cols&&(++x,B=0),{row:x,column:B}},p=v(t),l=v(a);if(p&&l){if(p.row>l.row||p.row===l.row&&p.column>=l.column)throw new Error("invalid range");this._terminal.select(p.column,p.row,(l.row-p.row)*this._terminal.cols-p.column+l.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;te;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const 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){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{function o(d){return d.replace(/\r?\n/g,"\r")}function c(d,f){return f?"\x1B[200~"+d+"\x1B[201~":d}function _(d,f,u,h){d=c(d=o(d),u.decPrivateModes.bracketedPasteMode&&h.rawOptions.ignoreBracketedPasteMode!==!0),u.triggerDataEvent(d,!0),f.value=""}function r(d,f,u){const h=u.getBoundingClientRect(),i=d.clientX-h.left-10,s=d.clientY-h.top-10;f.style.width="20px",f.style.height="20px",f.style.left=`${i}px`,f.style.top=`${s}px`,f.style.zIndex="1000",f.focus()}Object.defineProperty(n,"__esModule",{value:!0}),n.rightClickHandler=n.moveTextAreaUnderMouseCursor=n.paste=n.handlePasteEvent=n.copyHandler=n.bracketTextForPaste=n.prepareTextForTerminal=void 0,n.prepareTextForTerminal=o,n.bracketTextForPaste=c,n.copyHandler=function(d,f){d.clipboardData&&d.clipboardData.setData("text/plain",f.selectionText),d.preventDefault()},n.handlePasteEvent=function(d,f,u,h){d.stopPropagation(),d.clipboardData&&_(d.clipboardData.getData("text/plain"),f,u,h)},n.paste=_,n.moveTextAreaUnderMouseCursor=r,n.rightClickHandler=function(d,f,u,h,i){r(d,f,u),i&&h.rightClickSelect(d),f.value=h.selectionText,f.select()}},7239:(O,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ColorContrastCache=void 0;const c=o(1505);n.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(_,r,d){this._css.set(_,r,d)}getCss(_,r){return this._css.get(_,r)}setColor(_,r,d){this._color.set(_,r,d)}getColor(_,r){return this._color.get(_,r)}clear(){this._color.clear(),this._css.clear()}}},3656:(O,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.addDisposableDomListener=void 0,n.addDisposableDomListener=function(o,c,_,r){o.addEventListener(c,_,r);let d=!1;return{dispose:()=>{d||(d=!0,o.removeEventListener(c,_,r))}}}},3551:function(O,n,o){var c=this&&this.__decorate||function(s,e,t,a){var g,v=arguments.length,p=v<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(s,e,t,a);else for(var l=s.length-1;l>=0;l--)(g=s[l])&&(p=(v<3?g(p):v>3?g(e,t,p):g(e,t))||p);return v>3&&p&&Object.defineProperty(e,t,p),p},_=this&&this.__param||function(s,e){return function(t,a){e(t,a,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.Linkifier=void 0;const r=o(3656),d=o(8460),f=o(844),u=o(2585),h=o(4725);let i=n.Linkifier=class extends f.Disposable{get currentLink(){return this._currentLink}constructor(s,e,t,a,g){super(),this._element=s,this._mouseService=e,this._renderService=t,this._bufferService=a,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,f.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,f.toDisposable)(()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,r.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,r.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,r.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,r.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(s){this._lastMouseEvent=s;const e=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;const t=s.composedPath();for(let a=0;a{a?.forEach(g=>{g.link.dispose&&g.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=s.y);let t=!1;for(const[a,g]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(a)&&(t=this._checkLinkProviderResult(a,s,t)):g.provideLinks(s.y,v=>{if(this._isMouseOut)return;const p=v?.map(l=>({link:l}));this._activeProviderReplies?.set(a,p),t=this._checkLinkProviderResult(a,s,t),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)})}_removeIntersectingLinks(s,e){const t=new Set;for(let a=0;as?this._bufferService.cols:p.link.range.end.x;for(let E=l;E<=S;E++){if(t.has(E)){g.splice(v--,1);break}t.add(E)}}}}_checkLinkProviderResult(s,e,t){if(!this._activeProviderReplies)return t;const a=this._activeProviderReplies.get(s);let g=!1;for(let v=0;vthis._linkAtPosition(p.link,e));v&&(t=!0,this._handleNewLink(v))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!t)for(let v=0;vthis._linkAtPosition(l.link,e));if(p){t=!0,this._handleNewLink(p);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._currentLink)return;const e=this._positionFromMouseEvent(s,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,e){this._currentLink&&this._lastMouseEvent&&(!s||!e||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._lastMouseEvent)return;const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(s.link,e)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:t=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",t))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(t=>{if(!this._currentLink)return;const a=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(a,g),this._lastMouseEvent)){const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._askForLink(v,!1)}})))}_linkHover(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(t,e.text)}_fireUnderlineEvent(s,e){const t=s.range,a=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-a-1,t.end.x,t.end.y-a-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(t,e.text)}_linkAtPosition(s,e){const t=s.range.start.y*this._bufferService.cols+s.range.start.x,a=s.range.end.y*this._bufferService.cols+s.range.end.x,g=e.y*this._bufferService.cols+e.x;return t<=g&&g<=a}_positionFromMouseEvent(s,e,t){const a=t.getCoords(s,e,this._bufferService.cols,this._bufferService.rows);if(a)return{x:a[0],y:a[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,e,t,a,g){return{x1:s,y1:e,x2:t,y2:a,cols:this._bufferService.cols,fg:g}}};n.Linkifier=i=c([_(1,h.IMouseService),_(2,h.IRenderService),_(3,u.IBufferService),_(4,h.ILinkProviderService)],i)},9042:(O,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.tooMuchOutput=n.promptLabel=void 0,n.promptLabel="Terminal input",n.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(O,n,o){var c=this&&this.__decorate||function(h,i,s,e){var t,a=arguments.length,g=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(h,i,s,e);else for(var v=h.length-1;v>=0;v--)(t=h[v])&&(g=(a<3?t(g):a>3?t(i,s,g):t(i,s))||g);return a>3&&g&&Object.defineProperty(i,s,g),g},_=this&&this.__param||function(h,i){return function(s,e){i(s,e,h)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkProvider=void 0;const r=o(511),d=o(2585);let f=n.OscLinkProvider=class{constructor(h,i,s){this._bufferService=h,this._optionsService=i,this._oscLinkService=s}provideLinks(h,i){const s=this._bufferService.buffer.lines.get(h-1);if(!s)return void i(void 0);const e=[],t=this._optionsService.rawOptions.linkHandler,a=new r.CellData,g=s.getTrimmedLength();let v=-1,p=-1,l=!1;for(let S=0;St?t.activate(w,B,k):u(0,B),hover:(w,B)=>t?.hover?.(w,B,k),leave:(w,B)=>t?.leave?.(w,B,k)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(p=S,v=a.extended.urlId):(p=-1,v=-1)}}i(e)}};function u(h,i){if(confirm(`Do you want to navigate to ${i}? diff --git a/webapp/assets/_app/immutable/chunks/DOA3alhD.js b/webapp/assets/_app/immutable/chunks/DQfnVUrv.js similarity index 96% rename from webapp/assets/_app/immutable/chunks/DOA3alhD.js rename to webapp/assets/_app/immutable/chunks/DQfnVUrv.js index 36e29e49..9e19f6cb 100644 --- a/webapp/assets/_app/immutable/chunks/DOA3alhD.js +++ b/webapp/assets/_app/immutable/chunks/DQfnVUrv.js @@ -1 +1 @@ -import{f as z,s as g,a as h,t as mt,c as Z}from"./ZGz3X54u.js";import{i as O}from"./CY7Wcm-1.js";import{p as Q,c as e,r as t,s,h as c,u as o,n as rt,t as q,a as X,v as ut,f as tt,g as P}from"./kDtaAWAK.js";import{p as T,i as G,s as gt,a as pt}from"./Cun6jNAp.js";import{c as st,d as et,B as xt}from"./Cvcp5xHB.js";import{b as R,e as ft}from"./DNHT2U_W.js";import{B as H}from"./DovBLKjH.js";import{e as yt}from"./C2c_wqo6.js";import{D as ht,G as at}from"./Cfdue6T6.js";import{E as _t}from"./CEJvqnOn.js";import{S as kt}from"./BTeTCgJA.js";import{e as bt,i as wt}from"./DdT9Vz5Q.js";import{b as Ct}from"./DochbgGJ.js";var Pt=z('

ID
Created At
Updated At
Status
Pool Balancer Type
');function Wt(L,v){Q(v,!1);let a=T(v,"entity",8),p=T(v,"entityType",8);function B(){return`${p().charAt(0).toUpperCase()+p().slice(1)} Information`}function n(){if(!a().endpoint?.base_url)return"#";const i=a().endpoint.base_url.replace(/\/$/,"");switch(p()){case"repository":const K=a();return`${i}/${K.owner}/${a().name}`;case"organization":return`${i}/${a().name}`;case"enterprise":return`${i}/enterprises/${a().name}`;default:return"#"}}function E(){return`${p().charAt(0).toUpperCase()+p().slice(1)} URL`}function V(){const i=a().pool_balancing_type;if(!i||i===""||i==="none")return"Round Robin (default)";switch(i){case"roundrobin":return"Round Robin";case"pack":return"Pack";default:return i}}O();var m=Pt(),x=e(m),_=e(x),I=e(_,!0);t(_);var k=s(_,2),d=e(k),f=s(e(d),2),b=e(f,!0);t(f),t(d);var u=s(d,2),D=s(e(u),2),M=e(D,!0);t(D),t(u);var w=s(u,2),S=s(e(w),2),$=e(S,!0);t(S),t(w);var r=s(w,2),C=s(e(r),2),l=e(C);{var U=i=>{H(i,{variant:"success",text:"Running"})},j=i=>{H(i,{variant:"error",text:"Stopped"})};G(l,i=>{c(a()),o(()=>a().pool_manager_status?.running)?i(U):i(j,!1)})}t(C),t(r);var N=s(r,2),A=s(e(N),2),y=e(A,!0);t(A),t(N);var W=s(N,2),F=e(W),ot=e(F,!0);t(F);var Y=s(F,2),J=e(Y),it=e(J);rt(),t(J),t(Y),t(W),t(k),t(x),t(m),q((i,K,dt,nt,lt,vt,ct)=>{g(I,i),g(b,(c(a()),o(()=>a().id))),g(M,K),g($,dt),g(y,nt),g(ot,lt),st(J,"href",vt),g(it,`${ct??""} `)},[()=>o(B),()=>(c(R),c(a()),o(()=>R(a().created_at))),()=>(c(R),c(a()),o(()=>R(a().updated_at))),()=>o(V),()=>o(E),()=>o(n),()=>o(n)]),h(L,m),X()}var Tt=z('

No pools configured

'),Et=z('');function qt(L,v){Q(v,!1);const[a,p]=gt(),B=()=>pt(yt,"$eagerCache",a);let n=T(v,"pools",8),E=T(v,"entityType",8),V=T(v,"entityId",8,""),m=T(v,"entityName",8,"");const x=ut();function _(){x("addPool",{entityType:E(),entityId:V(),entityName:m()})}const I=[{key:"id",title:"ID",flexible:!0,cellComponent:_t,cellProps:{entityType:"pool",showId:!0,fontMono:!0}},{key:"image",title:"Image",flexible:!0,cellComponent:at,cellProps:{field:"image",type:"code",showTitle:!0}},{key:"provider",title:"Provider",cellComponent:at,cellProps:{field:"provider_name"}},{key:"status",title:"Status",cellComponent:kt,cellProps:{statusType:"enabled"}}],k={entityType:"pool",primaryText:{field:"id",isClickable:!0,href:"/pools/{id}",useId:!0,isMonospace:!0},secondaryText:{field:"entity_name",computedValue:r=>ft(r,B())},badges:[{type:"custom",value:r=>({variant:r.enabled?"success":"error",text:r.enabled?"Enabled":"Disabled"})}]};O();var d=Et(),f=e(d),b=e(f),u=e(b),D=e(u);t(u);var M=s(u,2);t(b);var w=s(b,2);{var S=r=>{var C=Tt(),l=s(e(C),4),U=e(l);t(l);var j=s(l,2),N=e(j);xt(N,{variant:"primary",size:"sm",$$events:{click:_},children:(A,y)=>{rt();var W=mt("Add Pool");h(A,W)},$$slots:{default:!0}}),t(j),t(C),q(()=>g(U,`No pools configured for this ${E()??""}.`)),h(r,C)},$=r=>{ht(r,{get columns(){return I},get data(){return n()},loading:!1,error:"",searchTerm:"",showSearch:!1,showPagination:!1,currentPage:1,get perPage(){return c(n()),o(()=>n().length)},totalPages:1,get totalItems(){return c(n()),o(()=>n().length)},itemName:"pools",emptyTitle:"No pools configured",get emptyMessage(){return`No pools configured for this ${E()??""}.`},emptyIconType:"cog",get mobileCardConfig(){return k}})};G(w,r=>{c(n()),o(()=>n().length===0)?r(S):r($,!1)})}t(f),t(d),q(r=>{g(D,`Pools (${c(n()),o(()=>n().length)??""})`),st(M,"href",r)},[()=>(c(et),o(()=>et("/pools")))]),h(L,d),X(),p()}var It=z('

'),Nt=z('

Events

'),Bt=z('

Events

No events available

');function Ft(L,v){Q(v,!1);let a=T(v,"events",8),p=T(v,"eventsContainer",12,void 0);O();var B=Z(),n=tt(B);{var E=m=>{var x=Nt(),_=e(x),I=s(e(_),2);bt(I,5,a,wt,(k,d)=>{var f=It(),b=e(f),u=e(b),D=e(u,!0);t(u);var M=s(u,2),w=e(M);{var S=l=>{H(l,{variant:"error",text:"Error"})},$=l=>{var U=Z(),j=tt(U);{var N=y=>{H(y,{variant:"warning",text:"Warning"})},A=y=>{H(y,{variant:"info",text:"Info"})};G(j,y=>{P(d),o(()=>(P(d).event_level||"info").toLowerCase()==="warning")?y(N):y(A,!1)},!0)}h(l,U)};G(w,l=>{P(d),o(()=>(P(d).event_level||"info").toLowerCase()==="error")?l(S):l($,!1)})}var r=s(w,2),C=e(r,!0);t(r),t(M),t(b),t(f),q(l=>{g(D,(P(d),o(()=>P(d).message))),g(C,l)},[()=>(c(R),P(d),o(()=>R(P(d).created_at)))]),h(k,f)}),t(I),Ct(I,k=>p(k),()=>p()),t(_),t(x),h(m,x)},V=m=>{var x=Bt();h(m,x)};G(n,m=>{c(a()),o(()=>a()&&a().length>0)?m(E):m(V,!1)})}h(L,B),X()}export{Wt as E,qt as P,Ft as a}; +import{f as z,s as g,a as h,t as mt,c as Z}from"./ZGz3X54u.js";import{i as O}from"./CY7Wcm-1.js";import{p as Q,c as e,r as t,s,h as c,u as o,n as rt,t as q,a as X,v as ut,f as tt,g as P}from"./kDtaAWAK.js";import{p as T,i as G,s as gt,a as pt}from"./Cun6jNAp.js";import{c as st,d as et,B as xt}from"./CYK-UalN.js";import{b as R,e as ft}from"./ZelbukuJ.js";import{B as H}from"./DbE0zTOa.js";import{e as yt}from"./Vo3Mv3dp.js";import{D as ht,G as at}from"./BKeluGSY.js";import{E as _t}from"./Dd4NFVf9.js";import{S as kt}from"./BStwtkX8.js";import{e as bt,i as wt}from"./DdT9Vz5Q.js";import{b as Ct}from"./DochbgGJ.js";var Pt=z('

ID
Created At
Updated At
Status
Pool Balancer Type
');function Wt(L,v){Q(v,!1);let a=T(v,"entity",8),p=T(v,"entityType",8);function B(){return`${p().charAt(0).toUpperCase()+p().slice(1)} Information`}function n(){if(!a().endpoint?.base_url)return"#";const i=a().endpoint.base_url.replace(/\/$/,"");switch(p()){case"repository":const K=a();return`${i}/${K.owner}/${a().name}`;case"organization":return`${i}/${a().name}`;case"enterprise":return`${i}/enterprises/${a().name}`;default:return"#"}}function E(){return`${p().charAt(0).toUpperCase()+p().slice(1)} URL`}function V(){const i=a().pool_balancing_type;if(!i||i===""||i==="none")return"Round Robin (default)";switch(i){case"roundrobin":return"Round Robin";case"pack":return"Pack";default:return i}}O();var m=Pt(),x=e(m),_=e(x),I=e(_,!0);t(_);var k=s(_,2),d=e(k),f=s(e(d),2),b=e(f,!0);t(f),t(d);var u=s(d,2),D=s(e(u),2),M=e(D,!0);t(D),t(u);var w=s(u,2),S=s(e(w),2),$=e(S,!0);t(S),t(w);var r=s(w,2),C=s(e(r),2),l=e(C);{var U=i=>{H(i,{variant:"success",text:"Running"})},j=i=>{H(i,{variant:"error",text:"Stopped"})};G(l,i=>{c(a()),o(()=>a().pool_manager_status?.running)?i(U):i(j,!1)})}t(C),t(r);var N=s(r,2),A=s(e(N),2),y=e(A,!0);t(A),t(N);var W=s(N,2),F=e(W),ot=e(F,!0);t(F);var Y=s(F,2),J=e(Y),it=e(J);rt(),t(J),t(Y),t(W),t(k),t(x),t(m),q((i,K,dt,nt,lt,vt,ct)=>{g(I,i),g(b,(c(a()),o(()=>a().id))),g(M,K),g($,dt),g(y,nt),g(ot,lt),st(J,"href",vt),g(it,`${ct??""} `)},[()=>o(B),()=>(c(R),c(a()),o(()=>R(a().created_at))),()=>(c(R),c(a()),o(()=>R(a().updated_at))),()=>o(V),()=>o(E),()=>o(n),()=>o(n)]),h(L,m),X()}var Tt=z('

No pools configured

'),Et=z('');function qt(L,v){Q(v,!1);const[a,p]=gt(),B=()=>pt(yt,"$eagerCache",a);let n=T(v,"pools",8),E=T(v,"entityType",8),V=T(v,"entityId",8,""),m=T(v,"entityName",8,"");const x=ut();function _(){x("addPool",{entityType:E(),entityId:V(),entityName:m()})}const I=[{key:"id",title:"ID",flexible:!0,cellComponent:_t,cellProps:{entityType:"pool",showId:!0,fontMono:!0}},{key:"image",title:"Image",flexible:!0,cellComponent:at,cellProps:{field:"image",type:"code",showTitle:!0}},{key:"provider",title:"Provider",cellComponent:at,cellProps:{field:"provider_name"}},{key:"status",title:"Status",cellComponent:kt,cellProps:{statusType:"enabled"}}],k={entityType:"pool",primaryText:{field:"id",isClickable:!0,href:"/pools/{id}",useId:!0,isMonospace:!0},secondaryText:{field:"entity_name",computedValue:r=>ft(r,B())},badges:[{type:"custom",value:r=>({variant:r.enabled?"success":"error",text:r.enabled?"Enabled":"Disabled"})}]};O();var d=Et(),f=e(d),b=e(f),u=e(b),D=e(u);t(u);var M=s(u,2);t(b);var w=s(b,2);{var S=r=>{var C=Tt(),l=s(e(C),4),U=e(l);t(l);var j=s(l,2),N=e(j);xt(N,{variant:"primary",size:"sm",$$events:{click:_},children:(A,y)=>{rt();var W=mt("Add Pool");h(A,W)},$$slots:{default:!0}}),t(j),t(C),q(()=>g(U,`No pools configured for this ${E()??""}.`)),h(r,C)},$=r=>{ht(r,{get columns(){return I},get data(){return n()},loading:!1,error:"",searchTerm:"",showSearch:!1,showPagination:!1,currentPage:1,get perPage(){return c(n()),o(()=>n().length)},totalPages:1,get totalItems(){return c(n()),o(()=>n().length)},itemName:"pools",emptyTitle:"No pools configured",get emptyMessage(){return`No pools configured for this ${E()??""}.`},emptyIconType:"cog",get mobileCardConfig(){return k}})};G(w,r=>{c(n()),o(()=>n().length===0)?r(S):r($,!1)})}t(f),t(d),q(r=>{g(D,`Pools (${c(n()),o(()=>n().length)??""})`),st(M,"href",r)},[()=>(c(et),o(()=>et("/pools")))]),h(L,d),X(),p()}var It=z('

'),Nt=z('

Events

'),Bt=z('

Events

No events available

');function Ft(L,v){Q(v,!1);let a=T(v,"events",8),p=T(v,"eventsContainer",12,void 0);O();var B=Z(),n=tt(B);{var E=m=>{var x=Nt(),_=e(x),I=s(e(_),2);bt(I,5,a,wt,(k,d)=>{var f=It(),b=e(f),u=e(b),D=e(u,!0);t(u);var M=s(u,2),w=e(M);{var S=l=>{H(l,{variant:"error",text:"Error"})},$=l=>{var U=Z(),j=tt(U);{var N=y=>{H(y,{variant:"warning",text:"Warning"})},A=y=>{H(y,{variant:"info",text:"Info"})};G(j,y=>{P(d),o(()=>(P(d).event_level||"info").toLowerCase()==="warning")?y(N):y(A,!1)},!0)}h(l,U)};G(w,l=>{P(d),o(()=>(P(d).event_level||"info").toLowerCase()==="error")?l(S):l($,!1)})}var r=s(w,2),C=e(r,!0);t(r),t(M),t(b),t(f),q(l=>{g(D,(P(d),o(()=>P(d).message))),g(C,l)},[()=>(c(R),P(d),o(()=>R(P(d).created_at)))]),h(k,f)}),t(I),Ct(I,k=>p(k),()=>p()),t(_),t(x),h(m,x)},V=m=>{var x=Bt();h(m,x)};G(n,m=>{c(a()),o(()=>a()&&a().length>0)?m(E):m(V,!1)})}h(L,B),X()}export{Wt as E,qt as P,Ft as a}; diff --git a/webapp/assets/_app/immutable/chunks/8ZO9Ka4R.js b/webapp/assets/_app/immutable/chunks/DR0xnkWv.js similarity index 97% rename from webapp/assets/_app/immutable/chunks/8ZO9Ka4R.js rename to webapp/assets/_app/immutable/chunks/DR0xnkWv.js index fa7a6790..7fbc7e06 100644 --- a/webapp/assets/_app/immutable/chunks/8ZO9Ka4R.js +++ b/webapp/assets/_app/immutable/chunks/DR0xnkWv.js @@ -1 +1 @@ -import{w as R,o as m,aE as c,g as u,d as f}from"./kDtaAWAK.js";import{a as T}from"./CkTG2UXI.js";new URL("sveltekit-internal://");function j(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function G(t){return t.split("%25").map(decodeURI).join("%25")}function Y(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}function q({href:t}){return t.split("#")[0]}function D(t,e,n,r=!1){const s=new URL(t);Object.defineProperty(s,"searchParams",{value:new Proxy(s.searchParams,{get(a,o){if(o==="get"||o==="getAll"||o==="has")return(g,...k)=>(n(g),a[o](g,...k));e();const l=Reflect.get(a,o);return typeof l=="function"?l.bind(a):l}}),enumerable:!0,configurable:!0});const i=["href","pathname","search","toString","toJSON"];r&&i.push("hash");for(const a of i)Object.defineProperty(s,a,{get(){return e(),t[a]},enumerable:!0,configurable:!0});return s}function O(...t){let e=5381;for(const n of t)if(typeof n=="string"){let r=n.length;for(;r;)e=e*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let s=r.length;for(;s;)e=e*33^r[--s]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}new TextEncoder;new TextDecoder;function x(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r((t instanceof Request?t.method:e?.method||"GET")!=="GET"&&h.delete(w(t)),N(t,e));const h=new Map;function H(t,e){const n=w(t,e),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:s,...i}=JSON.parse(r.textContent);const a=r.getAttribute("data-ttl");return a&&h.set(n,{body:s,init:i,ttl:1e3*Number(a)}),r.getAttribute("data-b64")!==null&&(s=x(s)),Promise.resolve(new Response(s,i))}return window.fetch(t,e)}function K(t,e,n){if(h.size>0){const r=w(t,n),s=h.get(r);if(s){if(performance.now()a)}function s(a){n=!1,e.set(a)}function i(a){let o;return e.subscribe(l=>{(o===void 0||n&&l!==o)&&a(o=l)})}return{notify:r,set:s,subscribe:i}}const E={v:()=>{}};function re(){const{set:t,subscribe:e}=R(!1);let n;async function r(){clearTimeout(n);try{const s=await fetch(`${T}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!s.ok)return!1;const a=(await s.json()).version!==I;return a&&(t(!0),E.v(),clearTimeout(n)),a}catch{return!1}}return{subscribe:e,check:r}}function L(t,e,n){return t.origin!==S||!t.pathname.startsWith(e)?!0:n?t.pathname!==location.pathname:!1}function se(t){}const U=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...U];const P=new Set([...U]);[...P];let b,y,p;const $=m.toString().includes("$$")||/function \w+\(\) \{\}/.test(m.toString());$?(b={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},y={current:null},p={current:!1}):(b=new class{#e=c({});get data(){return u(this.#e)}set data(e){f(this.#e,e)}#t=c(null);get form(){return u(this.#t)}set form(e){f(this.#t,e)}#n=c(null);get error(){return u(this.#n)}set error(e){f(this.#n,e)}#r=c({});get params(){return u(this.#r)}set params(e){f(this.#r,e)}#s=c({id:null});get route(){return u(this.#s)}set route(e){f(this.#s,e)}#a=c({});get state(){return u(this.#a)}set state(e){f(this.#a,e)}#o=c(-1);get status(){return u(this.#o)}set status(e){f(this.#o,e)}#i=c(new URL("https://example.com"));get url(){return u(this.#i)}set url(e){f(this.#i,e)}},y=new class{#e=c(null);get current(){return u(this.#e)}set current(e){f(this.#e,e)}},p=new class{#e=c(!1);get current(){return u(this.#e)}set current(e){f(this.#e,e)}},E.v=()=>p.current=!0);function le(t){Object.assign(b,t)}export{z as H,M as N,X as P,W as S,te as a,q as b,re as c,ne as d,Y as e,Z as f,ee as g,j as h,L as i,_ as j,G as k,B as l,D as m,y as n,S as o,b as p,K as q,F as r,Q as s,H as t,J as u,le as v,se as w}; +import{w as R,o as m,aE as c,g as u,d as f}from"./kDtaAWAK.js";import{a as T}from"./DWgB-t1g.js";new URL("sveltekit-internal://");function j(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function G(t){return t.split("%25").map(decodeURI).join("%25")}function Y(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}function q({href:t}){return t.split("#")[0]}function D(t,e,n,r=!1){const s=new URL(t);Object.defineProperty(s,"searchParams",{value:new Proxy(s.searchParams,{get(a,o){if(o==="get"||o==="getAll"||o==="has")return(g,...k)=>(n(g),a[o](g,...k));e();const l=Reflect.get(a,o);return typeof l=="function"?l.bind(a):l}}),enumerable:!0,configurable:!0});const i=["href","pathname","search","toString","toJSON"];r&&i.push("hash");for(const a of i)Object.defineProperty(s,a,{get(){return e(),t[a]},enumerable:!0,configurable:!0});return s}function O(...t){let e=5381;for(const n of t)if(typeof n=="string"){let r=n.length;for(;r;)e=e*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let s=r.length;for(;s;)e=e*33^r[--s]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}new TextEncoder;new TextDecoder;function x(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r((t instanceof Request?t.method:e?.method||"GET")!=="GET"&&h.delete(w(t)),N(t,e));const h=new Map;function H(t,e){const n=w(t,e),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:s,...i}=JSON.parse(r.textContent);const a=r.getAttribute("data-ttl");return a&&h.set(n,{body:s,init:i,ttl:1e3*Number(a)}),r.getAttribute("data-b64")!==null&&(s=x(s)),Promise.resolve(new Response(s,i))}return window.fetch(t,e)}function K(t,e,n){if(h.size>0){const r=w(t,n),s=h.get(r);if(s){if(performance.now()a)}function s(a){n=!1,e.set(a)}function i(a){let o;return e.subscribe(l=>{(o===void 0||n&&l!==o)&&a(o=l)})}return{notify:r,set:s,subscribe:i}}const E={v:()=>{}};function re(){const{set:t,subscribe:e}=R(!1);let n;async function r(){clearTimeout(n);try{const s=await fetch(`${T}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!s.ok)return!1;const a=(await s.json()).version!==I;return a&&(t(!0),E.v(),clearTimeout(n)),a}catch{return!1}}return{subscribe:e,check:r}}function L(t,e,n){return t.origin!==S||!t.pathname.startsWith(e)?!0:n?t.pathname!==location.pathname:!1}function se(t){}const U=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...U];const P=new Set([...U]);[...P];let b,y,p;const $=m.toString().includes("$$")||/function \w+\(\) \{\}/.test(m.toString());$?(b={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},y={current:null},p={current:!1}):(b=new class{#e=c({});get data(){return u(this.#e)}set data(e){f(this.#e,e)}#t=c(null);get form(){return u(this.#t)}set form(e){f(this.#t,e)}#n=c(null);get error(){return u(this.#n)}set error(e){f(this.#n,e)}#r=c({});get params(){return u(this.#r)}set params(e){f(this.#r,e)}#s=c({id:null});get route(){return u(this.#s)}set route(e){f(this.#s,e)}#a=c({});get state(){return u(this.#a)}set state(e){f(this.#a,e)}#o=c(-1);get status(){return u(this.#o)}set status(e){f(this.#o,e)}#i=c(new URL("https://example.com"));get url(){return u(this.#i)}set url(e){f(this.#i,e)}},y=new class{#e=c(null);get current(){return u(this.#e)}set current(e){f(this.#e,e)}},p=new class{#e=c(!1);get current(){return u(this.#e)}set current(e){f(this.#e,e)}},E.v=()=>p.current=!0);function le(t){Object.assign(b,t)}export{z as H,M as N,X as P,W as S,te as a,q as b,re as c,ne as d,Y as e,Z as f,ee as g,j as h,L as i,_ as j,G as k,B as l,D as m,y as n,S as o,b as p,K as q,F as r,Q as s,H as t,J as u,le as v,se as w}; diff --git a/webapp/assets/_app/immutable/chunks/uzzFhb3G.js b/webapp/assets/_app/immutable/chunks/DUWZCTMr.js similarity index 98% rename from webapp/assets/_app/immutable/chunks/uzzFhb3G.js rename to webapp/assets/_app/immutable/chunks/DUWZCTMr.js index d6d9e32d..beb84f63 100644 --- a/webapp/assets/_app/immutable/chunks/uzzFhb3G.js +++ b/webapp/assets/_app/immutable/chunks/DUWZCTMr.js @@ -1 +1 @@ -import{f as D,e as B,a as E}from"./ZGz3X54u.js";import{i as P}from"./CY7Wcm-1.js";import{p as S,v as T,l as t,h as s,g as e,m as o,b as q,t as F,a as G,u as I,c as _,d as a,r as z}from"./kDtaAWAK.js";import{j as J,h as K,s as N,k as O}from"./Cvcp5xHB.js";import{l as j,p as l}from"./Cun6jNAp.js";var Q=D('');function Z(M,i){const C=j(i,["children","$$slots","$$events","$$legacy"]),H=j(C,["action","disabled","title","ariaLabel","size"]);S(i,!1);const u=o(),h=o(),k=o(),p=o(),f=o(),v=o(),n=o(),m=o(),x=o(),L=T();let r=l(i,"action",8,"edit"),b=l(i,"disabled",8,!1),w=l(i,"title",8,""),y=l(i,"ariaLabel",8,""),c=l(i,"size",8,"md");function A(){b()||L("click")}t(()=>{},()=>{a(u,"transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 dark:focus:ring-offset-gray-900 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50")}),t(()=>s(c()),()=>{a(h,{sm:"p-1",md:"p-2"}[c()])}),t(()=>s(r()),()=>{a(k,{edit:"text-indigo-600 dark:text-indigo-400 hover:text-indigo-900 dark:hover:text-indigo-300 focus:ring-indigo-500",delete:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 focus:ring-red-500",view:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-300 focus:ring-gray-500",add:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 focus:ring-green-500",copy:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 focus:ring-blue-500",download:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 focus:ring-blue-500",shell:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 focus:ring-green-500"}[r()])}),t(()=>s(c()),()=>{a(p,c()==="sm"?"h-4 w-4":"h-5 w-5")}),t(()=>(e(u),e(h),e(k)),()=>{a(f,[e(u),e(h),e(k)].join(" "))}),t(()=>{},()=>{a(v,{edit:'',delete:'',view:'',add:'',copy:'',download:'',shell:''})}),t(()=>{},()=>{a(n,{edit:"Edit",delete:"Delete",view:"View",add:"Add",copy:"Clone",download:"Download",shell:"Shell"})}),t(()=>(s(w()),e(n),s(r())),()=>{a(m,w()||e(n)[r()])}),t(()=>(s(y()),e(n),s(r())),()=>{a(x,y()||`${e(n)[r()]} item`)}),q(),P();var d=Q();J(d,()=>({type:"button",class:e(f),disabled:b(),title:e(m),"aria-label":e(x),...H}));var g=_(d),V=_(g);K(V,()=>(e(v),s(r()),I(()=>e(v)[r()])),!0),z(g),z(d),F(()=>N(g,0,O(e(p)))),B("click",d,A),E(M,d),G()}export{Z as A}; +import{f as D,e as B,a as E}from"./ZGz3X54u.js";import{i as P}from"./CY7Wcm-1.js";import{p as S,v as T,l as t,h as s,g as e,m as o,b as q,t as F,a as G,u as I,c as _,d as a,r as z}from"./kDtaAWAK.js";import{j as J,h as K,s as N,k as O}from"./CYK-UalN.js";import{l as j,p as l}from"./Cun6jNAp.js";var Q=D('');function Z(M,i){const C=j(i,["children","$$slots","$$events","$$legacy"]),H=j(C,["action","disabled","title","ariaLabel","size"]);S(i,!1);const u=o(),h=o(),k=o(),p=o(),f=o(),v=o(),n=o(),m=o(),x=o(),L=T();let r=l(i,"action",8,"edit"),b=l(i,"disabled",8,!1),w=l(i,"title",8,""),y=l(i,"ariaLabel",8,""),c=l(i,"size",8,"md");function A(){b()||L("click")}t(()=>{},()=>{a(u,"transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 dark:focus:ring-offset-gray-900 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50")}),t(()=>s(c()),()=>{a(h,{sm:"p-1",md:"p-2"}[c()])}),t(()=>s(r()),()=>{a(k,{edit:"text-indigo-600 dark:text-indigo-400 hover:text-indigo-900 dark:hover:text-indigo-300 focus:ring-indigo-500",delete:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 focus:ring-red-500",view:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-300 focus:ring-gray-500",add:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 focus:ring-green-500",copy:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 focus:ring-blue-500",download:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 focus:ring-blue-500",shell:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 focus:ring-green-500"}[r()])}),t(()=>s(c()),()=>{a(p,c()==="sm"?"h-4 w-4":"h-5 w-5")}),t(()=>(e(u),e(h),e(k)),()=>{a(f,[e(u),e(h),e(k)].join(" "))}),t(()=>{},()=>{a(v,{edit:'',delete:'',view:'',add:'',copy:'',download:'',shell:''})}),t(()=>{},()=>{a(n,{edit:"Edit",delete:"Delete",view:"View",add:"Add",copy:"Clone",download:"Download",shell:"Shell"})}),t(()=>(s(w()),e(n),s(r())),()=>{a(m,w()||e(n)[r()])}),t(()=>(s(y()),e(n),s(r())),()=>{a(x,y()||`${e(n)[r()]} item`)}),q(),P();var d=Q();J(d,()=>({type:"button",class:e(f),disabled:b(),title:e(m),"aria-label":e(x),...H}));var g=_(d),V=_(g);K(V,()=>(e(v),s(r()),I(()=>e(v)[r()])),!0),z(g),z(d),F(()=>N(g,0,O(e(p)))),B("click",d,A),E(M,d),G()}export{Z as A}; diff --git a/webapp/assets/_app/immutable/chunks/CkTG2UXI.js b/webapp/assets/_app/immutable/chunks/DWgB-t1g.js similarity index 94% rename from webapp/assets/_app/immutable/chunks/CkTG2UXI.js rename to webapp/assets/_app/immutable/chunks/DWgB-t1g.js index e585e514..84f42f13 100644 --- a/webapp/assets/_app/immutable/chunks/CkTG2UXI.js +++ b/webapp/assets/_app/immutable/chunks/DWgB-t1g.js @@ -1 +1 @@ -const w=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function x(t){const s=[];return{pattern:t==="/"?/^\/$/:new RegExp(`^${_(t).map(i=>{const o=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(i);if(o)return s.push({name:o[1],matcher:o[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const l=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(i);if(l)return s.push({name:l[1],matcher:l[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!i)return;const n=i.split(/\[(.+?)\](?!\])/);return"/"+n.map((e,r)=>{if(r%2){if(e.startsWith("x+"))return h(String.fromCharCode(parseInt(e.slice(2),16)));if(e.startsWith("u+"))return h(String.fromCharCode(...e.slice(2).split("-").map(g=>parseInt(g,16))));const c=w.exec(e),[,u,p,m,d]=c;return s.push({name:m,matcher:d,optional:!!u,rest:!!p,chained:p?r===1&&n[0]==="":!1}),p?"([^]*?)":u?"([^/]*)?":"([^/]+?)"}return h(e)}).join("")}).join("")}/?$`),params:s}}function $(t){return t!==""&&!/^\([^)]+\)$/.test(t)}function _(t){return t.slice(1).split("/").filter($)}function j(t,s,f){const i={},o=t.slice(1),l=o.filter(a=>a!==void 0);let n=0;for(let a=0;ac).join("/"),n=0),r===void 0)if(e.rest)r="";else continue;if(!e.matcher||f[e.matcher](r)){i[e.name]=r;const c=s[a+1],u=o[a+1];c&&!c.rest&&c.optional&&u&&e.chained&&(n=0),!c&&!u&&Object.keys(i).length===l.length&&(n=0);continue}if(e.optional&&e.chained){n++;continue}return}if(!n)return i}function h(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}const b=/\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;function W(t,s){const f=_(t),i=t!="/"&&t.endsWith("/");return"/"+f.map(o=>o.replace(b,(l,n,a,e)=>{const r=s[e];if(!r){if(n||a&&r!==void 0)return"";throw new Error(`Missing parameter '${e}' in route ${t}`)}if(r.startsWith("/")||r.endsWith("/"))throw new Error(`Parameter '${e}' in route ${t} cannot start or end with a slash -- this would cause an invalid route like foo//bar`);return r})).filter(Boolean).join("/")+(i?"/":"")}const v=globalThis.__sveltekit_1p53tct?.base??"/ui",k=globalThis.__sveltekit_1p53tct?.assets??v??"";export{k as a,v as b,j as e,x as p,W as r}; +const w=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function x(t){const s=[];return{pattern:t==="/"?/^\/$/:new RegExp(`^${_(t).map(i=>{const o=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(i);if(o)return s.push({name:o[1],matcher:o[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const l=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(i);if(l)return s.push({name:l[1],matcher:l[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!i)return;const n=i.split(/\[(.+?)\](?!\])/);return"/"+n.map((e,r)=>{if(r%2){if(e.startsWith("x+"))return h(String.fromCharCode(parseInt(e.slice(2),16)));if(e.startsWith("u+"))return h(String.fromCharCode(...e.slice(2).split("-").map(g=>parseInt(g,16))));const c=w.exec(e),[,u,p,m,d]=c;return s.push({name:m,matcher:d,optional:!!u,rest:!!p,chained:p?r===1&&n[0]==="":!1}),p?"([^]*?)":u?"([^/]*)?":"([^/]+?)"}return h(e)}).join("")}).join("")}/?$`),params:s}}function $(t){return t!==""&&!/^\([^)]+\)$/.test(t)}function _(t){return t.slice(1).split("/").filter($)}function j(t,s,f){const i={},o=t.slice(1),l=o.filter(a=>a!==void 0);let n=0;for(let a=0;ac).join("/"),n=0),r===void 0)if(e.rest)r="";else continue;if(!e.matcher||f[e.matcher](r)){i[e.name]=r;const c=s[a+1],u=o[a+1];c&&!c.rest&&c.optional&&u&&e.chained&&(n=0),!c&&!u&&Object.keys(i).length===l.length&&(n=0);continue}if(e.optional&&e.chained){n++;continue}return}if(!n)return i}function h(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}const b=/\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;function W(t,s){const f=_(t),i=t!="/"&&t.endsWith("/");return"/"+f.map(o=>o.replace(b,(l,n,a,e)=>{const r=s[e];if(!r){if(n||a&&r!==void 0)return"";throw new Error(`Missing parameter '${e}' in route ${t}`)}if(r.startsWith("/")||r.endsWith("/"))throw new Error(`Parameter '${e}' in route ${t} cannot start or end with a slash -- this would cause an invalid route like foo//bar`);return r})).filter(Boolean).join("/")+(i?"/":"")}const v=globalThis.__sveltekit_1o53hto?.base??"/ui",k=globalThis.__sveltekit_1o53hto?.assets??v??"";export{k as a,v as b,j as e,x as p,W as r}; diff --git a/webapp/assets/_app/immutable/chunks/D3FdGlax.js b/webapp/assets/_app/immutable/chunks/DXEzcvud.js similarity index 71% rename from webapp/assets/_app/immutable/chunks/D3FdGlax.js rename to webapp/assets/_app/immutable/chunks/DXEzcvud.js index 233b6360..03d0c367 100644 --- a/webapp/assets/_app/immutable/chunks/D3FdGlax.js +++ b/webapp/assets/_app/immutable/chunks/DXEzcvud.js @@ -1 +1 @@ -import{s as e}from"./BU_V7FOQ.js";const r=()=>{const s=e;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},b={subscribe(s){return r().page.subscribe(s)}};export{b as p}; +import{s as e}from"./C8dZhfFx.js";const r=()=>{const s=e;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},b={subscribe(s){return r().page.subscribe(s)}};export{b as p}; diff --git a/webapp/assets/_app/immutable/chunks/JRrg5LRu.js b/webapp/assets/_app/immutable/chunks/DZ2a7TNP.js similarity index 94% rename from webapp/assets/_app/immutable/chunks/JRrg5LRu.js rename to webapp/assets/_app/immutable/chunks/DZ2a7TNP.js index cdd86d04..b10d7955 100644 --- a/webapp/assets/_app/immutable/chunks/JRrg5LRu.js +++ b/webapp/assets/_app/immutable/chunks/DZ2a7TNP.js @@ -1 +1 @@ -import{f as b,a as m,s as F}from"./ZGz3X54u.js";import{i as B}from"./CY7Wcm-1.js";import{p as G,l,d as u,m as c,h as d,g as t,b as L,c as g,i as T,s as q,r as _,a as D,u as H,t as N}from"./kDtaAWAK.js";import{p as v,i as V}from"./Cun6jNAp.js";import{c as j}from"./Cvcp5xHB.js";import{B as z}from"./DovBLKjH.js";var A=b(' '),E=b('
');function Q(h,n){G(n,!1);const a=c(),r=c(),f=c();let s=v(n,"item",8),x=v(n,"showUrl",8,!0);function w(e){switch(e?.toLowerCase()){case"github":return"gray";case"gitea":return"green";default:return"secondary"}}function k(e){switch(e?.toLowerCase()){case"github":return"GitHub";case"gitea":return"Gitea";default:return e||"Unknown"}}l(()=>d(s()),()=>{u(a,s()?.endpoint?.endpoint_type||"Unknown")}),l(()=>d(s()),()=>{u(r,s()?.endpoint?.base_url)}),l(()=>t(a),()=>{u(f,w(t(a)))}),L(),B();var i=E(),p=g(i);{let e=T(()=>(t(a),H(()=>k(t(a)))));z(p,{get variant(){return t(f)},get text(){return t(e)}})}var y=q(p,2);{var U=e=>{var o=A(),C=g(o,!0);_(o),N(()=>{j(o,"href",t(r)),F(C,t(r))}),m(e,o)};V(y,e=>{x()&&t(r)&&e(U)})}_(i),m(h,i),D()}export{Q as F}; +import{f as b,a as m,s as F}from"./ZGz3X54u.js";import{i as B}from"./CY7Wcm-1.js";import{p as G,l,d as u,m as c,h as d,g as t,b as L,c as g,i as T,s as q,r as _,a as D,u as H,t as N}from"./kDtaAWAK.js";import{p as v,i as V}from"./Cun6jNAp.js";import{c as j}from"./CYK-UalN.js";import{B as z}from"./DbE0zTOa.js";var A=b(' '),E=b('
');function Q(h,n){G(n,!1);const a=c(),r=c(),f=c();let s=v(n,"item",8),x=v(n,"showUrl",8,!0);function w(e){switch(e?.toLowerCase()){case"github":return"gray";case"gitea":return"green";default:return"secondary"}}function k(e){switch(e?.toLowerCase()){case"github":return"GitHub";case"gitea":return"Gitea";default:return e||"Unknown"}}l(()=>d(s()),()=>{u(a,s()?.endpoint?.endpoint_type||"Unknown")}),l(()=>d(s()),()=>{u(r,s()?.endpoint?.base_url)}),l(()=>t(a),()=>{u(f,w(t(a)))}),L(),B();var i=E(),p=g(i);{let e=T(()=>(t(a),H(()=>k(t(a)))));z(p,{get variant(){return t(f)},get text(){return t(e)}})}var y=q(p,2);{var U=e=>{var o=A(),C=g(o,!0);_(o),N(()=>{j(o,"href",t(r)),F(C,t(r))}),m(e,o)};V(y,e=>{x()&&t(r)&&e(U)})}_(i),m(h,i),D()}export{Q as F}; diff --git a/webapp/assets/_app/immutable/chunks/CLZesvzF.js b/webapp/assets/_app/immutable/chunks/DacI6VAP.js similarity index 96% rename from webapp/assets/_app/immutable/chunks/CLZesvzF.js rename to webapp/assets/_app/immutable/chunks/DacI6VAP.js index e5471ead..222637e0 100644 --- a/webapp/assets/_app/immutable/chunks/CLZesvzF.js +++ b/webapp/assets/_app/immutable/chunks/DacI6VAP.js @@ -1 +1 @@ -import{f as b,a as r,s as k,c as B,t as T}from"./ZGz3X54u.js";import{i as U}from"./CY7Wcm-1.js";import{p as V,v as W,t as H,a as X,c as i,r as o,s as y,u as g,f as L,h as z,n as Y}from"./kDtaAWAK.js";import{p as v,i as l}from"./Cun6jNAp.js";import{i as Z,f as D,B as $}from"./Cvcp5xHB.js";var tt=b('
'),at=b('
'),et=b('

');function ct(E,t){const d=Z(t);V(t,!1);const M=W();let q=v(t,"title",8),C=v(t,"description",8),n=v(t,"actionLabel",8,null),m=v(t,"showAction",8,!0);function F(){M("action")}U();var f=et(),_=i(f),x=i(_),G=i(x,!0);o(x);var w=y(x,2),I=i(w,!0);o(w),o(_);var J=y(_,2);{var K=e=>{var s=tt(),h=i(s);D(h,t,"actions",{}),o(s),r(e,s)},N=e=>{var s=B(),h=L(s);{var O=p=>{var u=at(),A=i(u);{var Q=a=>{var c=B(),P=L(c);D(P,t,"secondary-actions",{}),r(a,c)};l(A,a=>{g(()=>d["secondary-actions"])&&a(Q)})}var R=y(A,2);{var S=a=>{$(a,{variant:"primary",icon:'',$$events:{click:F},children:(c,P)=>{Y();var j=T();H(()=>k(j,n())),r(c,j)},$$slots:{default:!0}})};l(R,a=>{m()&&n()&&a(S)})}o(u),r(p,u)};l(h,p=>{z(m()),z(n()),g(()=>m()&&n()||d["secondary-actions"])&&p(O)},!0)}r(e,s)};l(J,e=>{g(()=>d.actions)?e(K):e(N,!1)})}o(f),H(()=>{k(G,q()),k(I,C())}),r(E,f),X()}export{ct as P}; +import{f as b,a as r,s as k,c as B,t as T}from"./ZGz3X54u.js";import{i as U}from"./CY7Wcm-1.js";import{p as V,v as W,t as H,a as X,c as i,r as o,s as y,u as g,f as L,h as z,n as Y}from"./kDtaAWAK.js";import{p as v,i as l}from"./Cun6jNAp.js";import{i as Z,f as D,B as $}from"./CYK-UalN.js";var tt=b('
'),at=b('
'),et=b('

');function ct(E,t){const d=Z(t);V(t,!1);const M=W();let q=v(t,"title",8),C=v(t,"description",8),n=v(t,"actionLabel",8,null),m=v(t,"showAction",8,!0);function F(){M("action")}U();var f=et(),_=i(f),x=i(_),G=i(x,!0);o(x);var w=y(x,2),I=i(w,!0);o(w),o(_);var J=y(_,2);{var K=e=>{var s=tt(),h=i(s);D(h,t,"actions",{}),o(s),r(e,s)},N=e=>{var s=B(),h=L(s);{var O=p=>{var u=at(),A=i(u);{var Q=a=>{var c=B(),P=L(c);D(P,t,"secondary-actions",{}),r(a,c)};l(A,a=>{g(()=>d["secondary-actions"])&&a(Q)})}var R=y(A,2);{var S=a=>{$(a,{variant:"primary",icon:'',$$events:{click:F},children:(c,P)=>{Y();var j=T();H(()=>k(j,n())),r(c,j)},$$slots:{default:!0}})};l(R,a=>{m()&&n()&&a(S)})}o(u),r(p,u)};l(h,p=>{z(m()),z(n()),g(()=>m()&&n()||d["secondary-actions"])&&p(O)},!0)}r(e,s)};l(J,e=>{g(()=>d.actions)?e(K):e(N,!1)})}o(f),H(()=>{k(G,q()),k(I,C())}),r(E,f),X()}export{ct as P}; diff --git a/webapp/assets/_app/immutable/chunks/DovBLKjH.js b/webapp/assets/_app/immutable/chunks/DbE0zTOa.js similarity index 96% rename from webapp/assets/_app/immutable/chunks/DovBLKjH.js rename to webapp/assets/_app/immutable/chunks/DbE0zTOa.js index 4642117b..e6aacfe8 100644 --- a/webapp/assets/_app/immutable/chunks/DovBLKjH.js +++ b/webapp/assets/_app/immutable/chunks/DbE0zTOa.js @@ -1 +1 @@ -import{f as k,a as p,s as u}from"./ZGz3X54u.js";import{i as c}from"./CY7Wcm-1.js";import{p as f,l as m,h as g,b as w,t as _,a as v,d as h,m as z,c as B,r as j,g as V}from"./kDtaAWAK.js";import{s as q,k as A}from"./Cvcp5xHB.js";import{p as a}from"./Cun6jNAp.js";var C=k(" ");function I(d,e){f(e,!1);const l=z();let t=a(e,"variant",8,"gray"),n=a(e,"size",8,"sm"),i=a(e,"text",8),s=a(e,"ring",8,!1);const o={success:"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200",error:"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200",warning:"bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200",info:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200",gray:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200",blue:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200",green:"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200",red:"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200",yellow:"bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200",secondary:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200",purple:"bg-purple-100 dark:bg-purple-900 text-purple-800 dark:text-purple-200"},b={success:"ring-green-600/20 dark:ring-green-400/30",error:"ring-red-600/20 dark:ring-red-400/30",warning:"ring-yellow-600/20 dark:ring-yellow-400/30",info:"ring-blue-600/20 dark:ring-blue-400/30",gray:"ring-gray-500/20 dark:ring-gray-400/30",blue:"ring-blue-600/20 dark:ring-blue-400/30",green:"ring-green-600/20 dark:ring-green-400/30",red:"ring-red-600/20 dark:ring-red-400/30",yellow:"ring-yellow-600/20 dark:ring-yellow-400/30",secondary:"ring-gray-500/20 dark:ring-gray-400/30",purple:"ring-purple-600/20 dark:ring-purple-400/30"},x={sm:"px-2 py-1 text-xs",md:"px-2.5 py-0.5 text-xs"};m(()=>(g(t()),g(n()),g(s())),()=>{h(l,["inline-flex items-center rounded-full font-semibold",o[t()],x[n()],s()?`ring-1 ring-inset ${b[t()]}`:""].filter(Boolean).join(" "))}),w(),c();var r=C(),y=B(r,!0);j(r),_(()=>{q(r,1,A(V(l))),u(y,i())}),p(d,r),v()}export{I as B}; +import{f as k,a as p,s as u}from"./ZGz3X54u.js";import{i as c}from"./CY7Wcm-1.js";import{p as f,l as m,h as g,b as w,t as _,a as v,d as h,m as z,c as B,r as j,g as V}from"./kDtaAWAK.js";import{s as q,k as A}from"./CYK-UalN.js";import{p as a}from"./Cun6jNAp.js";var C=k(" ");function I(d,e){f(e,!1);const l=z();let t=a(e,"variant",8,"gray"),n=a(e,"size",8,"sm"),i=a(e,"text",8),s=a(e,"ring",8,!1);const o={success:"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200",error:"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200",warning:"bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200",info:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200",gray:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200",blue:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200",green:"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200",red:"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200",yellow:"bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200",secondary:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200",purple:"bg-purple-100 dark:bg-purple-900 text-purple-800 dark:text-purple-200"},b={success:"ring-green-600/20 dark:ring-green-400/30",error:"ring-red-600/20 dark:ring-red-400/30",warning:"ring-yellow-600/20 dark:ring-yellow-400/30",info:"ring-blue-600/20 dark:ring-blue-400/30",gray:"ring-gray-500/20 dark:ring-gray-400/30",blue:"ring-blue-600/20 dark:ring-blue-400/30",green:"ring-green-600/20 dark:ring-green-400/30",red:"ring-red-600/20 dark:ring-red-400/30",yellow:"ring-yellow-600/20 dark:ring-yellow-400/30",secondary:"ring-gray-500/20 dark:ring-gray-400/30",purple:"ring-purple-600/20 dark:ring-purple-400/30"},x={sm:"px-2 py-1 text-xs",md:"px-2.5 py-0.5 text-xs"};m(()=>(g(t()),g(n()),g(s())),()=>{h(l,["inline-flex items-center rounded-full font-semibold",o[t()],x[n()],s()?`ring-1 ring-inset ${b[t()]}`:""].filter(Boolean).join(" "))}),w(),c();var r=C(),y=B(r,!0);j(r),_(()=>{q(r,1,A(V(l))),u(y,i())}),p(d,r),v()}export{I as B}; diff --git a/webapp/assets/_app/immutable/chunks/CEJvqnOn.js b/webapp/assets/_app/immutable/chunks/Dd4NFVf9.js similarity index 96% rename from webapp/assets/_app/immutable/chunks/CEJvqnOn.js rename to webapp/assets/_app/immutable/chunks/Dd4NFVf9.js index e1deaacb..c711ffb0 100644 --- a/webapp/assets/_app/immutable/chunks/CEJvqnOn.js +++ b/webapp/assets/_app/immutable/chunks/Dd4NFVf9.js @@ -1 +1 @@ -import{f as x,a as b,s as j,e as T}from"./ZGz3X54u.js";import{i as Z}from"./CY7Wcm-1.js";import{p as ee,o as te,q as ne,l as $,b as re,f as ae,t as L,a as se,s as k,c as i,d as a,m as v,r as l,h as c,u as p,g as r}from"./kDtaAWAK.js";import{p as w,i as B}from"./Cun6jNAp.js";import{c as D,s as oe,d,e as ie}from"./Cvcp5xHB.js";import{b as le}from"./DochbgGJ.js";var ce=x('
'),de=x('
'),ve=x('
Description:
'),ue=x(' ',1);function ge(N,u){ee(u,!1);const y=v(),C=v();let t=w(u,"item",8),s=w(u,"entityType",8,"repository"),O=w(u,"showOwner",8,!1),R=w(u,"showId",8,!1),Y=w(u,"fontMono",8,!1),h=v(null),_=v(!1),H=v(0),U=v(0),E=v(!1);function f(){if(r(h)){const e=r(h).getBoundingClientRect();a(H,e.left),window.innerHeight-e.bottom<150?(a(E,!0),a(U,e.top)):(a(E,!1),a(U,e.bottom+4))}}function q(){a(_,!0),f()}function A(){a(_,!1)}te(()=>{window.addEventListener("scroll",f,!0),window.addEventListener("resize",f)}),ne(()=>{window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)});function P(){if(!t())return"Unknown";switch(s()){case"repository":return O()?`${t().owner||"Unknown"}/${t().name||"Unknown"}`:t().name||"Unknown";case"organization":case"enterprise":return t().name||"Unknown";case"pool":return R()?t().id||"Unknown":t().name||"Unknown";case"scaleset":return t().name||"Unknown";case"instance":return t().name||"Unknown";case"template":return t().name||"Unknown";case"object":return t().name||"Unknown";default:return t().name||t().id||"Unknown"}}function X(){if(!t())return"#";let e;switch(s()){case"instance":e=t().name;break;default:e=t().id||t().name;break}if(!e)return"#";switch(s()){case"repository":return d(`/repositories/${e}`);case"organization":return d(`/organizations/${e}`);case"enterprise":return d(`/enterprises/${e}`);case"pool":return d(`/pools/${e}`);case"scaleset":return d(`/scalesets/${e}`);case"instance":return d(`/instances/${encodeURIComponent(e)}`);case"template":return d(`/templates/${e}`);case"object":return d(`/objects/${e}`);default:return"#"}}$(()=>{},()=>{a(y,P())}),$(()=>{},()=>{a(C,X())}),re(),Z();var I=ue(),z=ae(I),M=i(z),m=i(M),F=i(m,!0);l(m);var G=k(m,2);{var J=e=>{var n=ce(),o=i(n);le(o,g=>a(h,g),()=>r(h)),l(n),T("mouseenter",o,q),T("mouseleave",o,A),b(e,n)};B(G,e=>{c(s()),c(t()),p(()=>s()==="object"&&t()?.description)&&e(J)})}l(M);var K=k(M,2);{var Q=e=>{var n=de(),o=i(n,!0);l(n),L(()=>j(o,(c(t()),p(()=>t().provider_id)))),b(e,n)};B(K,e=>{c(s()),c(t()),p(()=>s()==="instance"&&t()?.provider_id)&&e(Q)})}l(z);var S=k(z,2);{var V=e=>{var n=ve(),o=i(n),g=k(i(o),2),W=i(g,!0);l(g),l(o),l(n),L(()=>{ie(n,`left: ${r(H)??""}px; top: ${r(U)??""}px; transform: translateY(${r(E)?"-100%":"0"});`),j(W,(c(t()),p(()=>t().description)))}),b(e,n)};B(S,e=>{c(s()),c(t()),r(_),p(()=>s()==="object"&&t()?.description&&r(_))&&e(V)})}L(()=>{D(m,"href",r(C)),oe(m,1,`truncate text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 ${Y()?"font-mono":""}`),D(m,"title",r(y)),j(F,r(y))}),b(N,I),se()}export{ge as E}; +import{f as x,a as b,s as j,e as T}from"./ZGz3X54u.js";import{i as Z}from"./CY7Wcm-1.js";import{p as ee,o as te,q as ne,l as $,b as re,f as ae,t as L,a as se,s as k,c as i,d as a,m as v,r as l,h as c,u as p,g as r}from"./kDtaAWAK.js";import{p as w,i as B}from"./Cun6jNAp.js";import{c as D,s as oe,d,e as ie}from"./CYK-UalN.js";import{b as le}from"./DochbgGJ.js";var ce=x('
'),de=x('
'),ve=x('
Description:
'),ue=x(' ',1);function ge(N,u){ee(u,!1);const y=v(),C=v();let t=w(u,"item",8),s=w(u,"entityType",8,"repository"),O=w(u,"showOwner",8,!1),R=w(u,"showId",8,!1),Y=w(u,"fontMono",8,!1),h=v(null),_=v(!1),H=v(0),U=v(0),E=v(!1);function f(){if(r(h)){const e=r(h).getBoundingClientRect();a(H,e.left),window.innerHeight-e.bottom<150?(a(E,!0),a(U,e.top)):(a(E,!1),a(U,e.bottom+4))}}function q(){a(_,!0),f()}function A(){a(_,!1)}te(()=>{window.addEventListener("scroll",f,!0),window.addEventListener("resize",f)}),ne(()=>{window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)});function P(){if(!t())return"Unknown";switch(s()){case"repository":return O()?`${t().owner||"Unknown"}/${t().name||"Unknown"}`:t().name||"Unknown";case"organization":case"enterprise":return t().name||"Unknown";case"pool":return R()?t().id||"Unknown":t().name||"Unknown";case"scaleset":return t().name||"Unknown";case"instance":return t().name||"Unknown";case"template":return t().name||"Unknown";case"object":return t().name||"Unknown";default:return t().name||t().id||"Unknown"}}function X(){if(!t())return"#";let e;switch(s()){case"instance":e=t().name;break;default:e=t().id||t().name;break}if(!e)return"#";switch(s()){case"repository":return d(`/repositories/${e}`);case"organization":return d(`/organizations/${e}`);case"enterprise":return d(`/enterprises/${e}`);case"pool":return d(`/pools/${e}`);case"scaleset":return d(`/scalesets/${e}`);case"instance":return d(`/instances/${encodeURIComponent(e)}`);case"template":return d(`/templates/${e}`);case"object":return d(`/objects/${e}`);default:return"#"}}$(()=>{},()=>{a(y,P())}),$(()=>{},()=>{a(C,X())}),re(),Z();var I=ue(),z=ae(I),M=i(z),m=i(M),F=i(m,!0);l(m);var G=k(m,2);{var J=e=>{var n=ce(),o=i(n);le(o,g=>a(h,g),()=>r(h)),l(n),T("mouseenter",o,q),T("mouseleave",o,A),b(e,n)};B(G,e=>{c(s()),c(t()),p(()=>s()==="object"&&t()?.description)&&e(J)})}l(M);var K=k(M,2);{var Q=e=>{var n=de(),o=i(n,!0);l(n),L(()=>j(o,(c(t()),p(()=>t().provider_id)))),b(e,n)};B(K,e=>{c(s()),c(t()),p(()=>s()==="instance"&&t()?.provider_id)&&e(Q)})}l(z);var S=k(z,2);{var V=e=>{var n=ve(),o=i(n),g=k(i(o),2),W=i(g,!0);l(g),l(o),l(n),L(()=>{ie(n,`left: ${r(H)??""}px; top: ${r(U)??""}px; transform: translateY(${r(E)?"-100%":"0"});`),j(W,(c(t()),p(()=>t().description)))}),b(e,n)};B(S,e=>{c(s()),c(t()),r(_),p(()=>s()==="object"&&t()?.description&&r(_))&&e(V)})}L(()=>{D(m,"href",r(C)),oe(m,1,`truncate text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 ${Y()?"font-mono":""}`),D(m,"title",r(y)),j(F,r(y))}),b(N,I),se()}export{ge as E}; diff --git a/webapp/assets/_app/immutable/chunks/lQWw1Z23.js b/webapp/assets/_app/immutable/chunks/Dxx83T0m.js similarity index 97% rename from webapp/assets/_app/immutable/chunks/lQWw1Z23.js rename to webapp/assets/_app/immutable/chunks/Dxx83T0m.js index cd884843..d9857587 100644 --- a/webapp/assets/_app/immutable/chunks/lQWw1Z23.js +++ b/webapp/assets/_app/immutable/chunks/Dxx83T0m.js @@ -1 +1 @@ -import{f as j,t as $,a as n,s as v}from"./ZGz3X54u.js";import{i as J}from"./CY7Wcm-1.js";import{p as K,v as O,c as e,r as t,s as i,n as D,t as h,g as Q,i as R,a as S}from"./kDtaAWAK.js";import{p as l,i as T}from"./Cun6jNAp.js";import{B as L,s as M}from"./Cvcp5xHB.js";import{M as U}from"./C6jYEeWP.js";var V=j('

'),W=j('

');function se(B,a){K(a,!1);let C=l(a,"title",8),P=l(a,"message",8),_=l(a,"itemName",8,""),c=l(a,"loading",8,!1),N=l(a,"confirmLabel",8,"Delete"),m=l(a,"danger",8,!0);const f=O();function q(){f("confirm")}J(),U(B,{$$events:{close:()=>f("close")},children:(z,X)=>{var u=W(),d=e(u),E=e(d);t(d);var x=i(d,2),g=e(x),A=e(g,!0);t(g);var k=i(g,2),p=e(k),F=e(p,!0);t(p);var G=i(p,2);{var H=r=>{var s=V(),o=e(s,!0);t(s),h(()=>v(o,_())),n(r,s)};T(G,r=>{_()&&r(H)})}t(k),t(x);var b=i(x,2),w=e(b);L(w,{variant:"secondary",get disabled(){return c()},$$events:{click:()=>f("close")},children:(r,s)=>{D();var o=$("Cancel");n(r,o)},$$slots:{default:!0}});var I=i(w,2);{let r=R(()=>m()?"danger":"primary");L(I,{get variant(){return Q(r)},get disabled(){return c()},get loading(){return c()},$$events:{click:q},children:(s,o)=>{D();var y=$();h(()=>v(y,N())),n(s,y)},$$slots:{default:!0}})}t(b),t(u),h(()=>{M(d,1,`mx-auto flex items-center justify-center h-12 w-12 rounded-full ${m()?"bg-red-100 dark:bg-red-900":"bg-yellow-100 dark:bg-yellow-900"} mb-4`),M(E,0,`h-6 w-6 ${m()?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`),v(A,C()),v(F,P())}),n(z,u)},$$slots:{default:!0}}),S()}export{se as D}; +import{f as j,t as $,a as n,s as v}from"./ZGz3X54u.js";import{i as J}from"./CY7Wcm-1.js";import{p as K,v as O,c as e,r as t,s as i,n as D,t as h,g as Q,i as R,a as S}from"./kDtaAWAK.js";import{p as l,i as T}from"./Cun6jNAp.js";import{B as L,s as M}from"./CYK-UalN.js";import{M as U}from"./CVBpH3Sf.js";var V=j('

'),W=j('

');function se(B,a){K(a,!1);let C=l(a,"title",8),P=l(a,"message",8),_=l(a,"itemName",8,""),c=l(a,"loading",8,!1),N=l(a,"confirmLabel",8,"Delete"),m=l(a,"danger",8,!0);const f=O();function q(){f("confirm")}J(),U(B,{$$events:{close:()=>f("close")},children:(z,X)=>{var u=W(),d=e(u),E=e(d);t(d);var x=i(d,2),g=e(x),A=e(g,!0);t(g);var k=i(g,2),p=e(k),F=e(p,!0);t(p);var G=i(p,2);{var H=r=>{var s=V(),o=e(s,!0);t(s),h(()=>v(o,_())),n(r,s)};T(G,r=>{_()&&r(H)})}t(k),t(x);var b=i(x,2),w=e(b);L(w,{variant:"secondary",get disabled(){return c()},$$events:{click:()=>f("close")},children:(r,s)=>{D();var o=$("Cancel");n(r,o)},$$slots:{default:!0}});var I=i(w,2);{let r=R(()=>m()?"danger":"primary");L(I,{get variant(){return Q(r)},get disabled(){return c()},get loading(){return c()},$$events:{click:q},children:(s,o)=>{D();var y=$();h(()=>v(y,N())),n(s,y)},$$slots:{default:!0}})}t(b),t(u),h(()=>{M(d,1,`mx-auto flex items-center justify-center h-12 w-12 rounded-full ${m()?"bg-red-100 dark:bg-red-900":"bg-yellow-100 dark:bg-yellow-900"} mb-4`),M(E,0,`h-6 w-6 ${m()?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`),v(A,C()),v(F,P())}),n(z,u)},$$slots:{default:!0}}),S()}export{se as D}; diff --git a/webapp/assets/_app/immutable/chunks/Ckgw6FMz.js b/webapp/assets/_app/immutable/chunks/ONKDshdz.js similarity index 96% rename from webapp/assets/_app/immutable/chunks/Ckgw6FMz.js rename to webapp/assets/_app/immutable/chunks/ONKDshdz.js index df5a63a5..1a4deeb1 100644 --- a/webapp/assets/_app/immutable/chunks/Ckgw6FMz.js +++ b/webapp/assets/_app/immutable/chunks/ONKDshdz.js @@ -1 +1 @@ -import{f as l,s as w,a as r,c as h}from"./ZGz3X54u.js";import"./CY7Wcm-1.js";import{s as x,c as n,r as f,t as N,f as y}from"./kDtaAWAK.js";import{p as m,i as p}from"./Cun6jNAp.js";import{s as O}from"./Cvcp5xHB.js";var P=l('
'),Q=l('
'),R=l('
'),S=l('
'),U=l('
');function $(k,s){let z=m(s,"title",8),M=m(s,"content",8),t=m(s,"position",8,"top"),T=m(s,"width",8,"w-80");var b=U(),u=x(n(b),2),c=n(u),j=n(c,!0);f(c);var _=x(c,2),B=n(_,!0);f(_);var C=x(_,2);{var q=a=>{var i=P();r(a,i)},A=a=>{var i=h(),D=y(i);{var E=o=>{var v=Q();r(o,v)},F=o=>{var v=h(),G=y(v);{var H=e=>{var d=R();r(e,d)},I=e=>{var d=h(),J=y(d);{var K=g=>{var L=S();r(g,L)};p(J,g=>{t()==="right"&&g(K)},!0)}r(e,d)};p(G,e=>{t()==="left"?e(H):e(I,!1)},!0)}r(o,v)};p(D,o=>{t()==="bottom"?o(E):o(F,!1)},!0)}r(a,i)};p(C,a=>{t()==="top"?a(q):a(A,!1)})}f(u),f(b),N(()=>{O(u,1,`absolute ${t()==="top"?"bottom-full":t()==="bottom"?"top-full":t()==="left"?"right-full top-1/2 -translate-y-1/2":"left-full top-1/2 -translate-y-1/2"} left-1/2 transform -translate-x-1/2 ${t()==="top"?"mb-2":t()==="bottom"?"mt-2":"mx-2"} ${T()??""} p-3 bg-gray-900 text-white text-xs rounded-lg shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50`),w(j,z()),w(B,M())}),r(k,b)}export{$ as T}; +import{f as l,s as w,a as r,c as h}from"./ZGz3X54u.js";import"./CY7Wcm-1.js";import{s as x,c as n,r as f,t as N,f as y}from"./kDtaAWAK.js";import{p as m,i as p}from"./Cun6jNAp.js";import{s as O}from"./CYK-UalN.js";var P=l('
'),Q=l('
'),R=l('
'),S=l('
'),U=l('
');function $(k,s){let z=m(s,"title",8),M=m(s,"content",8),t=m(s,"position",8,"top"),T=m(s,"width",8,"w-80");var b=U(),u=x(n(b),2),c=n(u),j=n(c,!0);f(c);var _=x(c,2),B=n(_,!0);f(_);var C=x(_,2);{var q=a=>{var i=P();r(a,i)},A=a=>{var i=h(),D=y(i);{var E=o=>{var v=Q();r(o,v)},F=o=>{var v=h(),G=y(v);{var H=e=>{var d=R();r(e,d)},I=e=>{var d=h(),J=y(d);{var K=g=>{var L=S();r(g,L)};p(J,g=>{t()==="right"&&g(K)},!0)}r(e,d)};p(G,e=>{t()==="left"?e(H):e(I,!1)},!0)}r(o,v)};p(D,o=>{t()==="bottom"?o(E):o(F,!1)},!0)}r(a,i)};p(C,a=>{t()==="top"?a(q):a(A,!1)})}f(u),f(b),N(()=>{O(u,1,`absolute ${t()==="top"?"bottom-full":t()==="bottom"?"top-full":t()==="left"?"right-full top-1/2 -translate-y-1/2":"left-full top-1/2 -translate-y-1/2"} left-1/2 transform -translate-x-1/2 ${t()==="top"?"mb-2":t()==="bottom"?"mt-2":"mx-2"} ${T()??""} p-3 bg-gray-900 text-white text-xs rounded-lg shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50`),w(j,z()),w(B,M())}),r(k,b)}export{$ as T}; diff --git a/webapp/assets/_app/immutable/chunks/CkcEJ1BA.js b/webapp/assets/_app/immutable/chunks/OrLoP7JZ.js similarity index 97% rename from webapp/assets/_app/immutable/chunks/CkcEJ1BA.js rename to webapp/assets/_app/immutable/chunks/OrLoP7JZ.js index ff4fe30a..0aa607f1 100644 --- a/webapp/assets/_app/immutable/chunks/CkcEJ1BA.js +++ b/webapp/assets/_app/immutable/chunks/OrLoP7JZ.js @@ -1 +1 @@ -import{w as m}from"./kDtaAWAK.js";import{g as s}from"./Cvcp5xHB.js";const z=!0,I=()=>window.location.port==="5173",_={isAuthenticated:!1,user:null,loading:!0,needsInitialization:!1},o=m(_);function f(t,a,e=7){const i=new Date;i.setTime(i.getTime()+e*24*60*60*1e3),document.cookie=`${t}=${a};expires=${i.toUTCString()};path=/;SameSite=Lax`}function d(t){const a=t+"=",e=document.cookie.split(";");for(let i=0;i({...i,loading:!0}));const e=await s.login({username:t,password:a});z&&(f("garm_token",e.token),f("garm_user",t)),s.setToken(e.token),o.set({isAuthenticated:!0,user:t,loading:!1,needsInitialization:!1})}catch(e){throw o.update(i=>({...i,loading:!1})),e}},logout(){g("garm_token"),g("garm_user"),o.set({isAuthenticated:!1,user:null,loading:!1,needsInitialization:!1})},async init(){try{o.update(e=>({...e,loading:!0})),await c.checkInitializationStatus();const t=d("garm_token"),a=d("garm_user");if(t&&a&&(s.setToken(t),await c.checkAuth())){o.set({isAuthenticated:!0,user:a,loading:!1,needsInitialization:!1});return}o.update(e=>({...e,loading:!1,needsInitialization:!1}))}catch{o.update(a=>({...a,loading:!1}))}},async checkInitializationStatus(){try{const t={Accept:"application/json"},a=d("garm_token"),e=I();e&&a&&(t.Authorization=`Bearer ${a}`);const i=await fetch("/api/v1/login",{method:"GET",headers:t,credentials:e?"omit":"include"});if(!i.ok){if(i.status===409&&(await i.json()).error==="init_required")throw o.update(l=>({...l,needsInitialization:!0,loading:!1})),new Error("Initialization required");return}return}catch(t){if(t instanceof Error&&t.message==="Initialization required")throw t;return}},async checkAuth(){try{return await c.checkInitializationStatus(),await s.getControllerInfo(),!0}catch(t){return t instanceof Error&&t.message==="Initialization required"?!1:t?.response?.status===409&&t?.response?.data?.error==="init_required"?(o.update(a=>({...a,needsInitialization:!0,loading:!1})),!1):(c.logout(),!1)}},async initialize(t,a,e,i,n){try{o.update(u=>({...u,loading:!0}));const l=await s.firstRun({username:t,email:a,password:e,full_name:i||t});await c.login(t,e);const r=window.location.origin,h=n?.metadataUrl||`${r}/api/v1/metadata`,p=n?.callbackUrl||`${r}/api/v1/callbacks`,k=n?.webhookUrl||`${r}/webhooks`,w=n?.agentUrl||`${r}/agent`;await s.updateController({metadata_url:h,callback_url:p,webhook_url:k,agent_url:w}),o.update(u=>({...u,needsInitialization:!1}))}catch(l){throw o.update(r=>({...r,loading:!1})),l}}};export{o as a,c as b}; +import{w as m}from"./kDtaAWAK.js";import{g as s}from"./CYK-UalN.js";const z=!0,I=()=>window.location.port==="5173",_={isAuthenticated:!1,user:null,loading:!0,needsInitialization:!1},o=m(_);function f(t,a,e=7){const i=new Date;i.setTime(i.getTime()+e*24*60*60*1e3),document.cookie=`${t}=${a};expires=${i.toUTCString()};path=/;SameSite=Lax`}function d(t){const a=t+"=",e=document.cookie.split(";");for(let i=0;i({...i,loading:!0}));const e=await s.login({username:t,password:a});z&&(f("garm_token",e.token),f("garm_user",t)),s.setToken(e.token),o.set({isAuthenticated:!0,user:t,loading:!1,needsInitialization:!1})}catch(e){throw o.update(i=>({...i,loading:!1})),e}},logout(){g("garm_token"),g("garm_user"),o.set({isAuthenticated:!1,user:null,loading:!1,needsInitialization:!1})},async init(){try{o.update(e=>({...e,loading:!0})),await c.checkInitializationStatus();const t=d("garm_token"),a=d("garm_user");if(t&&a&&(s.setToken(t),await c.checkAuth())){o.set({isAuthenticated:!0,user:a,loading:!1,needsInitialization:!1});return}o.update(e=>({...e,loading:!1,needsInitialization:!1}))}catch{o.update(a=>({...a,loading:!1}))}},async checkInitializationStatus(){try{const t={Accept:"application/json"},a=d("garm_token"),e=I();e&&a&&(t.Authorization=`Bearer ${a}`);const i=await fetch("/api/v1/login",{method:"GET",headers:t,credentials:e?"omit":"include"});if(!i.ok){if(i.status===409&&(await i.json()).error==="init_required")throw o.update(l=>({...l,needsInitialization:!0,loading:!1})),new Error("Initialization required");return}return}catch(t){if(t instanceof Error&&t.message==="Initialization required")throw t;return}},async checkAuth(){try{return await c.checkInitializationStatus(),await s.getControllerInfo(),!0}catch(t){return t instanceof Error&&t.message==="Initialization required"?!1:t?.response?.status===409&&t?.response?.data?.error==="init_required"?(o.update(a=>({...a,needsInitialization:!0,loading:!1})),!1):(c.logout(),!1)}},async initialize(t,a,e,i,n){try{o.update(u=>({...u,loading:!0}));const l=await s.firstRun({username:t,email:a,password:e,full_name:i||t});await c.login(t,e);const r=window.location.origin,h=n?.metadataUrl||`${r}/api/v1/metadata`,p=n?.callbackUrl||`${r}/api/v1/callbacks`,k=n?.webhookUrl||`${r}/webhooks`,w=n?.agentUrl||`${r}/agent`;await s.updateController({metadata_url:h,callback_url:p,webhook_url:k,agent_url:w}),o.update(u=>({...u,needsInitialization:!1}))}catch(l){throw o.update(r=>({...r,loading:!1})),l}}};export{o as a,c as b}; diff --git a/webapp/assets/_app/immutable/chunks/C2c_wqo6.js b/webapp/assets/_app/immutable/chunks/Vo3Mv3dp.js similarity index 98% rename from webapp/assets/_app/immutable/chunks/C2c_wqo6.js rename to webapp/assets/_app/immutable/chunks/Vo3Mv3dp.js index 49538649..c8912c92 100644 --- a/webapp/assets/_app/immutable/chunks/C2c_wqo6.js +++ b/webapp/assets/_app/immutable/chunks/Vo3Mv3dp.js @@ -1 +1 @@ -import{w as p,x as l}from"./kDtaAWAK.js";import{g as d}from"./Cvcp5xHB.js";import{w as r}from"./KU08Mex1.js";const f={repositories:[],organizations:[],enterprises:[],pools:[],scalesets:[],credentials:[],endpoints:[],controllerInfo:null,templates:[],loading:{repositories:!1,organizations:!1,enterprises:!1,pools:!1,scalesets:!1,credentials:!1,endpoints:!1,controllerInfo:!1,templates:!1},loaded:{repositories:!1,organizations:!1,enterprises:!1,pools:!1,scalesets:!1,credentials:!1,endpoints:!1,controllerInfo:!1,templates:!1},errorMessages:{repositories:"",organizations:"",enterprises:"",pools:"",scalesets:"",credentials:"",endpoints:"",controllerInfo:"",templates:""}},a=p(f);class u{unsubscribers=[];loadingPromises=new Map;retryAttempts=new Map;MAX_RETRIES=3;RETRY_DELAY_MS=1e3;websocketStatusUnsubscriber=null;async loadResource(e,t=!1){if(this.loadingPromises.has(e))return this.loadingPromises.get(e);a.update(o=>({...o,loading:{...o.loading,[e]:!0},errorMessages:{...o.errorMessages,[e]:""}}));const s=this.attemptLoad(e);this.loadingPromises.set(e,s);try{const o=await s;return a.update(n=>({...n,[e]:o,loading:{...n.loading,[e]:!1},loaded:{...n.loaded,[e]:!0},errorMessages:{...n.errorMessages,[e]:""}})),this.retryAttempts.delete(e),t&&this.startBackgroundLoading(e),o}catch(o){const n=o instanceof Error?o.message:"Failed to load data";throw a.update(i=>({...i,loading:{...i.loading,[e]:!1},errorMessages:{...i.errorMessages,[e]:n}})),console.error(`Failed to load ${e}:`,o),o}finally{this.loadingPromises.delete(e)}}async attemptLoad(e){const t=(this.retryAttempts.get(e)||0)+1;this.retryAttempts.set(e,t);try{let s;switch(e){case"repositories":s=d.listRepositories();break;case"organizations":s=d.listOrganizations();break;case"enterprises":s=d.listEnterprises();break;case"pools":s=d.listAllPools();break;case"scalesets":s=d.listScaleSets();break;case"credentials":s=d.listAllCredentials();break;case"endpoints":s=d.listAllEndpoints();break;case"controllerInfo":s=d.getControllerInfo();break;case"templates":s=d.listTemplates();break;default:throw new Error(`Unknown resource type: ${e}`)}return await s}catch(s){if(tsetTimeout(n,o)),this.attemptLoad(e)}else throw console.error(`All ${this.MAX_RETRIES} attempts failed for ${e}:`,s),s}}async startBackgroundLoading(e){const s=["repositories","organizations","enterprises","pools","scalesets","credentials","endpoints","templates"].filter(o=>o!==e);for(const o of s)setTimeout(()=>{this.loadResource(o,!1).catch(n=>{console.warn(`Background loading failed for ${o}:`,n)})},100*s.indexOf(o))}retryResource(e){return this.retryAttempts.delete(e),this.loadResource(e,!0)}setupWebSocketSubscriptions(){this.cleanup();const e=[r.subscribeToEntity("repository",["create","update","delete"],this.handleRepositoryEvent.bind(this)),r.subscribeToEntity("organization",["create","update","delete"],this.handleOrganizationEvent.bind(this)),r.subscribeToEntity("enterprise",["create","update","delete"],this.handleEnterpriseEvent.bind(this)),r.subscribeToEntity("pool",["create","update","delete"],this.handlePoolEvent.bind(this)),r.subscribeToEntity("scaleset",["create","update","delete"],this.handleScaleSetEvent.bind(this)),r.subscribeToEntity("controller",["update"],this.handleControllerEvent.bind(this)),r.subscribeToEntity("github_credentials",["create","update","delete"],this.handleCredentialsEvent.bind(this)),r.subscribeToEntity("gitea_credentials",["create","update","delete"],this.handleCredentialsEvent.bind(this)),r.subscribeToEntity("github_endpoint",["create","update","delete"],this.handleEndpointEvent.bind(this)),r.subscribeToEntity("template",["create","update","delete"],this.handleTemplateEvent.bind(this))];this.unsubscribers=e,this.setupWebSocketStatusMonitoring()}setupWebSocketStatusMonitoring(){this.websocketStatusUnsubscriber&&this.websocketStatusUnsubscriber();let e=!1;this.websocketStatusUnsubscriber=r.subscribe(t=>{t.connected&&!e&&(console.log("[EagerCache] WebSocket connected - reinitializing cache"),this.initializeAllResources()),e=t.connected})}async initializeAllResources(){const t=["repositories","organizations","enterprises","pools","scalesets","credentials","endpoints","controllerInfo","templates"].map(s=>this.loadResource(s,!0).catch(o=>{console.warn(`Failed to reload ${s} on WebSocket reconnect:`,o)}));await Promise.allSettled(t)}handleRepositoryEvent(e){a.update(t=>{if(!t.loaded.repositories)return t;const s=[...t.repositories],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,repositories:s}})}handleOrganizationEvent(e){a.update(t=>{if(!t.loaded.organizations)return t;const s=[...t.organizations],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,organizations:s}})}handleEnterpriseEvent(e){a.update(t=>{if(!t.loaded.enterprises)return t;const s=[...t.enterprises],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,enterprises:s}})}handlePoolEvent(e){a.update(t=>{if(!t.loaded.pools)return t;const s=[...t.pools],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,pools:s}})}handleScaleSetEvent(e){a.update(t=>{if(!t.loaded.scalesets)return t;const s=[...t.scalesets],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,scalesets:s}})}handleCredentialsEvent(e){a.update(t=>{if(!t.loaded.credentials)return t;const s=[...t.credentials],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,credentials:s}})}handleEndpointEvent(e){a.update(t=>{if(!t.loaded.endpoints)return t;const s=[...t.endpoints],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.name===o.name);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.name:o,i=s.findIndex(c=>c.name===n);i!==-1&&s.splice(i,1)}return{...t,endpoints:s}})}cleanup(){this.unsubscribers.forEach(e=>e()),this.unsubscribers=[],this.websocketStatusUnsubscriber&&(this.websocketStatusUnsubscriber(),this.websocketStatusUnsubscriber=null)}shouldUseCache(){return l(r).connected}async getRepositories(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching repositories directly from API"),await d.listRepositories();const t=l(a);return t.loaded.repositories?t.repositories:this.loadResource("repositories",!0)}async getOrganizations(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching organizations directly from API"),await d.listOrganizations();const t=l(a);return t.loaded.organizations?t.organizations:this.loadResource("organizations",!0)}async getEnterprises(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching enterprises directly from API"),await d.listEnterprises();const t=l(a);return t.loaded.enterprises?t.enterprises:this.loadResource("enterprises",!0)}async getPools(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching pools directly from API"),await d.listAllPools();const t=l(a);return t.loaded.pools?t.pools:this.loadResource("pools",!0)}async getScaleSets(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching scalesets directly from API"),await d.listScaleSets();const t=l(a);return t.loaded.scalesets?t.scalesets:this.loadResource("scalesets",!0)}async getCredentials(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching credentials directly from API"),await d.listAllCredentials();const t=l(a);return t.loaded.credentials?t.credentials:this.loadResource("credentials",!0)}async getEndpoints(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching endpoints directly from API"),await d.listAllEndpoints();const t=l(a);return t.loaded.endpoints?t.endpoints:this.loadResource("endpoints",!0)}async getControllerInfo(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching controller info directly from API"),await d.getControllerInfo();const t=l(a);return t.loaded.controllerInfo?t.controllerInfo:this.loadResource("controllerInfo",!0)}async getTemplates(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching templates directly from API"),await d.listTemplates();const t=l(a);return t.loaded.templates?t.templates:this.loadResource("templates",!0)}handleControllerEvent(e){a.update(t=>{if(!t.loaded.controllerInfo)return t;const s=e.payload;return e.operation==="update"?{...t,controllerInfo:s}:t})}handleTemplateEvent(e){a.update(t=>{if(!t.loaded.templates)return t;const s=[...t.templates],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,templates:s}})}}const h=new u;typeof window<"u"&&h.setupWebSocketSubscriptions();export{h as a,a as e}; +import{w as p,x as l}from"./kDtaAWAK.js";import{g as d}from"./CYK-UalN.js";import{w as r}from"./KU08Mex1.js";const f={repositories:[],organizations:[],enterprises:[],pools:[],scalesets:[],credentials:[],endpoints:[],controllerInfo:null,templates:[],loading:{repositories:!1,organizations:!1,enterprises:!1,pools:!1,scalesets:!1,credentials:!1,endpoints:!1,controllerInfo:!1,templates:!1},loaded:{repositories:!1,organizations:!1,enterprises:!1,pools:!1,scalesets:!1,credentials:!1,endpoints:!1,controllerInfo:!1,templates:!1},errorMessages:{repositories:"",organizations:"",enterprises:"",pools:"",scalesets:"",credentials:"",endpoints:"",controllerInfo:"",templates:""}},a=p(f);class u{unsubscribers=[];loadingPromises=new Map;retryAttempts=new Map;MAX_RETRIES=3;RETRY_DELAY_MS=1e3;websocketStatusUnsubscriber=null;async loadResource(e,t=!1){if(this.loadingPromises.has(e))return this.loadingPromises.get(e);a.update(o=>({...o,loading:{...o.loading,[e]:!0},errorMessages:{...o.errorMessages,[e]:""}}));const s=this.attemptLoad(e);this.loadingPromises.set(e,s);try{const o=await s;return a.update(n=>({...n,[e]:o,loading:{...n.loading,[e]:!1},loaded:{...n.loaded,[e]:!0},errorMessages:{...n.errorMessages,[e]:""}})),this.retryAttempts.delete(e),t&&this.startBackgroundLoading(e),o}catch(o){const n=o instanceof Error?o.message:"Failed to load data";throw a.update(i=>({...i,loading:{...i.loading,[e]:!1},errorMessages:{...i.errorMessages,[e]:n}})),console.error(`Failed to load ${e}:`,o),o}finally{this.loadingPromises.delete(e)}}async attemptLoad(e){const t=(this.retryAttempts.get(e)||0)+1;this.retryAttempts.set(e,t);try{let s;switch(e){case"repositories":s=d.listRepositories();break;case"organizations":s=d.listOrganizations();break;case"enterprises":s=d.listEnterprises();break;case"pools":s=d.listAllPools();break;case"scalesets":s=d.listScaleSets();break;case"credentials":s=d.listAllCredentials();break;case"endpoints":s=d.listAllEndpoints();break;case"controllerInfo":s=d.getControllerInfo();break;case"templates":s=d.listTemplates();break;default:throw new Error(`Unknown resource type: ${e}`)}return await s}catch(s){if(tsetTimeout(n,o)),this.attemptLoad(e)}else throw console.error(`All ${this.MAX_RETRIES} attempts failed for ${e}:`,s),s}}async startBackgroundLoading(e){const s=["repositories","organizations","enterprises","pools","scalesets","credentials","endpoints","templates"].filter(o=>o!==e);for(const o of s)setTimeout(()=>{this.loadResource(o,!1).catch(n=>{console.warn(`Background loading failed for ${o}:`,n)})},100*s.indexOf(o))}retryResource(e){return this.retryAttempts.delete(e),this.loadResource(e,!0)}setupWebSocketSubscriptions(){this.cleanup();const e=[r.subscribeToEntity("repository",["create","update","delete"],this.handleRepositoryEvent.bind(this)),r.subscribeToEntity("organization",["create","update","delete"],this.handleOrganizationEvent.bind(this)),r.subscribeToEntity("enterprise",["create","update","delete"],this.handleEnterpriseEvent.bind(this)),r.subscribeToEntity("pool",["create","update","delete"],this.handlePoolEvent.bind(this)),r.subscribeToEntity("scaleset",["create","update","delete"],this.handleScaleSetEvent.bind(this)),r.subscribeToEntity("controller",["update"],this.handleControllerEvent.bind(this)),r.subscribeToEntity("github_credentials",["create","update","delete"],this.handleCredentialsEvent.bind(this)),r.subscribeToEntity("gitea_credentials",["create","update","delete"],this.handleCredentialsEvent.bind(this)),r.subscribeToEntity("github_endpoint",["create","update","delete"],this.handleEndpointEvent.bind(this)),r.subscribeToEntity("template",["create","update","delete"],this.handleTemplateEvent.bind(this))];this.unsubscribers=e,this.setupWebSocketStatusMonitoring()}setupWebSocketStatusMonitoring(){this.websocketStatusUnsubscriber&&this.websocketStatusUnsubscriber();let e=!1;this.websocketStatusUnsubscriber=r.subscribe(t=>{t.connected&&!e&&(console.log("[EagerCache] WebSocket connected - reinitializing cache"),this.initializeAllResources()),e=t.connected})}async initializeAllResources(){const t=["repositories","organizations","enterprises","pools","scalesets","credentials","endpoints","controllerInfo","templates"].map(s=>this.loadResource(s,!0).catch(o=>{console.warn(`Failed to reload ${s} on WebSocket reconnect:`,o)}));await Promise.allSettled(t)}handleRepositoryEvent(e){a.update(t=>{if(!t.loaded.repositories)return t;const s=[...t.repositories],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,repositories:s}})}handleOrganizationEvent(e){a.update(t=>{if(!t.loaded.organizations)return t;const s=[...t.organizations],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,organizations:s}})}handleEnterpriseEvent(e){a.update(t=>{if(!t.loaded.enterprises)return t;const s=[...t.enterprises],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,enterprises:s}})}handlePoolEvent(e){a.update(t=>{if(!t.loaded.pools)return t;const s=[...t.pools],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,pools:s}})}handleScaleSetEvent(e){a.update(t=>{if(!t.loaded.scalesets)return t;const s=[...t.scalesets],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,scalesets:s}})}handleCredentialsEvent(e){a.update(t=>{if(!t.loaded.credentials)return t;const s=[...t.credentials],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,credentials:s}})}handleEndpointEvent(e){a.update(t=>{if(!t.loaded.endpoints)return t;const s=[...t.endpoints],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.name===o.name);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.name:o,i=s.findIndex(c=>c.name===n);i!==-1&&s.splice(i,1)}return{...t,endpoints:s}})}cleanup(){this.unsubscribers.forEach(e=>e()),this.unsubscribers=[],this.websocketStatusUnsubscriber&&(this.websocketStatusUnsubscriber(),this.websocketStatusUnsubscriber=null)}shouldUseCache(){return l(r).connected}async getRepositories(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching repositories directly from API"),await d.listRepositories();const t=l(a);return t.loaded.repositories?t.repositories:this.loadResource("repositories",!0)}async getOrganizations(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching organizations directly from API"),await d.listOrganizations();const t=l(a);return t.loaded.organizations?t.organizations:this.loadResource("organizations",!0)}async getEnterprises(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching enterprises directly from API"),await d.listEnterprises();const t=l(a);return t.loaded.enterprises?t.enterprises:this.loadResource("enterprises",!0)}async getPools(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching pools directly from API"),await d.listAllPools();const t=l(a);return t.loaded.pools?t.pools:this.loadResource("pools",!0)}async getScaleSets(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching scalesets directly from API"),await d.listScaleSets();const t=l(a);return t.loaded.scalesets?t.scalesets:this.loadResource("scalesets",!0)}async getCredentials(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching credentials directly from API"),await d.listAllCredentials();const t=l(a);return t.loaded.credentials?t.credentials:this.loadResource("credentials",!0)}async getEndpoints(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching endpoints directly from API"),await d.listAllEndpoints();const t=l(a);return t.loaded.endpoints?t.endpoints:this.loadResource("endpoints",!0)}async getControllerInfo(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching controller info directly from API"),await d.getControllerInfo();const t=l(a);return t.loaded.controllerInfo?t.controllerInfo:this.loadResource("controllerInfo",!0)}async getTemplates(){if(!l(r).connected)return console.log("[EagerCache] WebSocket disconnected - fetching templates directly from API"),await d.listTemplates();const t=l(a);return t.loaded.templates?t.templates:this.loadResource("templates",!0)}handleControllerEvent(e){a.update(t=>{if(!t.loaded.controllerInfo)return t;const s=e.payload;return e.operation==="update"?{...t,controllerInfo:s}:t})}handleTemplateEvent(e){a.update(t=>{if(!t.loaded.templates)return t;const s=[...t.templates],o=e.payload;if(e.operation==="create")s.push(o);else if(e.operation==="update"){const n=s.findIndex(i=>i.id===o.id);n!==-1&&(s[n]=o)}else if(e.operation==="delete"){const n=typeof o=="object"?o.id:o,i=s.findIndex(c=>c.id===n);i!==-1&&s.splice(i,1)}return{...t,templates:s}})}}const h=new u;typeof window<"u"&&h.setupWebSocketSubscriptions();export{h as a,a as e}; diff --git a/webapp/assets/_app/immutable/chunks/DNHT2U_W.js b/webapp/assets/_app/immutable/chunks/ZelbukuJ.js similarity index 99% rename from webapp/assets/_app/immutable/chunks/DNHT2U_W.js rename to webapp/assets/_app/immutable/chunks/ZelbukuJ.js index 97f9721e..59febfb4 100644 --- a/webapp/assets/_app/immutable/chunks/DNHT2U_W.js +++ b/webapp/assets/_app/immutable/chunks/ZelbukuJ.js @@ -1,4 +1,4 @@ -import{d as o}from"./Cvcp5xHB.js";function l(r){if(!r)return"N/A";try{return(typeof r=="string"?new Date(r):r).toLocaleString()}catch{return"Invalid Date"}}function f(r,e="w-4 h-4"){return r==="gitea"?``:r==="github"?`
`:` +import{d as o}from"./CYK-UalN.js";function l(r){if(!r)return"N/A";try{return(typeof r=="string"?new Date(r):r).toLocaleString()}catch{return"Invalid Date"}}function f(r,e="w-4 h-4"){return r==="gitea"?``:r==="github"?`
`:` `}function d(r,e){if(r.repo_name)return r.repo_name;if(r.org_name)return r.org_name;if(r.enterprise_name)return r.enterprise_name;if(r.repo_id&&!r.repo_name&&e?.repositories){const n=e.repositories.find(t=>t.id===r.repo_id);return n?`${n.owner}/${n.name}`:"Unknown Entity"}if(r.org_id&&!r.org_name&&e?.organizations){const n=e.organizations.find(t=>t.id===r.org_id);return n&&n.name?n.name:"Unknown Entity"}if(r.enterprise_id&&!r.enterprise_name&&e?.enterprises){const n=e.enterprises.find(t=>t.id===r.enterprise_id);return n&&n.name?n.name:"Unknown Entity"}return"Unknown Entity"}function p(r){return r.repo_id?"repository":r.org_id?"organization":r.enterprise_id?"enterprise":"unknown"}function g(r){return r.repo_id?o(`/repositories/${r.repo_id}`):r.org_id?o(`/organizations/${r.org_id}`):r.enterprise_id?o(`/enterprises/${r.enterprise_id}`):"#"}function w(r){r&&(r.scrollTop=r.scrollHeight)}function m(r){return{newPerPage:r,newCurrentPage:1}}function v(r){return r.pool_manager_status?.running?{text:"Running",variant:"success"}:{text:"Stopped",variant:"error"}}function _(r){switch(r.toLowerCase()){case"error":return{text:"Error",variant:"error"};case"warning":return{text:"Warning",variant:"warning"};case"info":return{text:"Info",variant:"info"};default:return{text:r,variant:"info"}}}function i(r,e,n){if(!e.trim())return r;const t=e.toLowerCase();return r.filter(s=>typeof n=="function"?n(s).toLowerCase().includes(t):n.some(a=>s[a]?.toString().toLowerCase().includes(t)))}function h(r,e){return i(r,e,["name","owner"])}function x(r,e){return i(r,e,["name"])}function k(r,e){return i(r,e,n=>[n.name||"",n.description||"",n.endpoint?.name||""].join(" "))}function E(r,e){return i(r,e,["name","description","base_url","api_base_url"])}function L(r,e,n){return r.slice((e-1)*n,e*n)}export{E as a,l as b,m as c,_ as d,d as e,k as f,f as g,i as h,p as i,g as j,v as k,x as l,h as m,L as p,w as s}; diff --git a/webapp/assets/_app/immutable/chunks/C-3AL0iB.js b/webapp/assets/_app/immutable/chunks/oWoYyEl8.js similarity index 75% rename from webapp/assets/_app/immutable/chunks/C-3AL0iB.js rename to webapp/assets/_app/immutable/chunks/oWoYyEl8.js index eb15b6af..5a5636a7 100644 --- a/webapp/assets/_app/immutable/chunks/C-3AL0iB.js +++ b/webapp/assets/_app/immutable/chunks/oWoYyEl8.js @@ -1 +1 @@ -import{f as _,a as h,s as x}from"./ZGz3X54u.js";import{i as u}from"./CY7Wcm-1.js";import{p as g,t as k,a as w,s as y,c as o,u as m,h as e,r}from"./kDtaAWAK.js";import{h as z}from"./Cvcp5xHB.js";import{p as d}from"./Cun6jNAp.js";import{g as l}from"./DNHT2U_W.js";var E=_('
');function j(v,i){g(i,!1);let t=d(i,"item",8),s=d(i,"iconSize",8,"w-5 h-5");u();var a=E(),n=o(a),f=o(n);z(f,()=>(e(l),e(t()),e(s()),m(()=>l(t()?.endpoint?.endpoint_type||t()?.endpoint_type||"unknown",s())))),r(n);var p=y(n,2),c=o(p,!0);r(p),r(a),k(()=>x(c,(e(t()),m(()=>t()?.endpoint?.name||t()?.endpoint_name||t()?.endpoint_type||"Unknown")))),h(v,a),w()}export{j as E}; +import{f as _,a as h,s as x}from"./ZGz3X54u.js";import{i as u}from"./CY7Wcm-1.js";import{p as g,t as k,a as w,s as y,c as o,u as m,h as e,r}from"./kDtaAWAK.js";import{h as z}from"./CYK-UalN.js";import{p as d}from"./Cun6jNAp.js";import{g as l}from"./ZelbukuJ.js";var E=_('
');function j(v,i){g(i,!1);let t=d(i,"item",8),s=d(i,"iconSize",8,"w-5 h-5");u();var a=E(),n=o(a),f=o(n);z(f,()=>(e(l),e(t()),e(s()),m(()=>l(t()?.endpoint?.endpoint_type||t()?.endpoint_type||"unknown",s())))),r(n);var p=y(n,2),c=o(p,!0);r(p),r(a),k(()=>x(c,(e(t()),m(()=>t()?.endpoint?.name||t()?.endpoint_name||t()?.endpoint_type||"Unknown")))),h(v,a),w()}export{j as E}; diff --git a/webapp/assets/_app/immutable/chunks/Cs0pYghy.js b/webapp/assets/_app/immutable/chunks/rb89c4PS.js similarity index 92% rename from webapp/assets/_app/immutable/chunks/Cs0pYghy.js rename to webapp/assets/_app/immutable/chunks/rb89c4PS.js index 28be0bf9..3a842333 100644 --- a/webapp/assets/_app/immutable/chunks/Cs0pYghy.js +++ b/webapp/assets/_app/immutable/chunks/rb89c4PS.js @@ -1 +1 @@ -import{f as D,a as A}from"./ZGz3X54u.js";import{i as g}from"./CY7Wcm-1.js";import{p as x,v as E,a as T,r as _,g as e,i as d,u as p,h as a}from"./kDtaAWAK.js";import{e as L,i as C}from"./DdT9Vz5Q.js";import{p as y}from"./Cun6jNAp.js";import{A as k}from"./uzzFhb3G.js";var j=D('
');function F(n,m){x(m,!1);const s=E();let l=y(m,"item",8),b=y(m,"actions",24,()=>[{type:"edit",title:"Edit",ariaLabel:"Edit item",action:"edit"},{type:"delete",title:"Delete",ariaLabel:"Delete item",action:"delete"}]);function u(r,t){if(!l())return;const i=t||r;i==="edit"?s("edit",{item:l()}):i==="delete"?s("delete",{item:l()}):i==="copy"||i==="clone"?s("clone",{item:l()}):r==="shell"?s("shell",{item:l()}):s("action",{type:i,item:l()})}g();var f=j();L(f,5,b,C,(r,t)=>{const i=d(()=>(e(t),a(l()),p(()=>e(t).isDisabled?e(t).isDisabled(l()):!1))),h=d(()=>(e(t),p(()=>e(t).action==="clone"?"copy":e(t).action||(e(t).type==="edit"?"edit":e(t).type==="delete"?"delete":e(t).type==="copy"?"copy":e(t).type==="shell"?"shell":"view")))),o=d(()=>(e(t),a(l()),p(()=>typeof e(t).disabledTitle=="function"?e(t).disabledTitle(l()):e(t).disabledTitle))),c=d(()=>(a(e(i)),a(e(o)),e(t),p(()=>e(i)&&e(o)?e(o):e(t).title||(e(t).type==="edit"?"Edit":e(t).type==="delete"?"Delete":e(t).type==="copy"?"Clone":e(t).type==="shell"?"Shell":e(t).label))));{let v=d(()=>(e(t),p(()=>e(t).ariaLabel||(e(t).type==="edit"?"Edit item":e(t).type==="delete"?"Delete item":e(t).type==="copy"?"Clone item":e(t).type==="shell"?"Open shell":e(t).label))));k(r,{get action(){return e(h)},get title(){return e(c)},get ariaLabel(){return e(v)},get disabled(){return e(i)},$$events:{click:()=>u(e(t).type,e(t).action)}})}}),_(f),A(n,f),T()}export{F as A}; +import{f as D,a as A}from"./ZGz3X54u.js";import{i as g}from"./CY7Wcm-1.js";import{p as x,v as E,a as T,r as _,g as e,i as d,u as p,h as a}from"./kDtaAWAK.js";import{e as L,i as C}from"./DdT9Vz5Q.js";import{p as y}from"./Cun6jNAp.js";import{A as k}from"./DUWZCTMr.js";var j=D('
');function F(n,m){x(m,!1);const s=E();let l=y(m,"item",8),b=y(m,"actions",24,()=>[{type:"edit",title:"Edit",ariaLabel:"Edit item",action:"edit"},{type:"delete",title:"Delete",ariaLabel:"Delete item",action:"delete"}]);function u(r,t){if(!l())return;const i=t||r;i==="edit"?s("edit",{item:l()}):i==="delete"?s("delete",{item:l()}):i==="copy"||i==="clone"?s("clone",{item:l()}):r==="shell"?s("shell",{item:l()}):s("action",{type:i,item:l()})}g();var f=j();L(f,5,b,C,(r,t)=>{const i=d(()=>(e(t),a(l()),p(()=>e(t).isDisabled?e(t).isDisabled(l()):!1))),h=d(()=>(e(t),p(()=>e(t).action==="clone"?"copy":e(t).action||(e(t).type==="edit"?"edit":e(t).type==="delete"?"delete":e(t).type==="copy"?"copy":e(t).type==="shell"?"shell":"view")))),o=d(()=>(e(t),a(l()),p(()=>typeof e(t).disabledTitle=="function"?e(t).disabledTitle(l()):e(t).disabledTitle))),c=d(()=>(a(e(i)),a(e(o)),e(t),p(()=>e(i)&&e(o)?e(o):e(t).title||(e(t).type==="edit"?"Edit":e(t).type==="delete"?"Delete":e(t).type==="copy"?"Clone":e(t).type==="shell"?"Shell":e(t).label))));{let v=d(()=>(e(t),p(()=>e(t).ariaLabel||(e(t).type==="edit"?"Edit item":e(t).type==="delete"?"Delete item":e(t).type==="copy"?"Clone item":e(t).type==="shell"?"Open shell":e(t).label))));k(r,{get action(){return e(h)},get title(){return e(c)},get ariaLabel(){return e(v)},get disabled(){return e(i)},$$events:{click:()=>u(e(t).type,e(t).action)}})}}),_(f),A(n,f),T()}export{F as A}; diff --git a/webapp/assets/_app/immutable/chunks/B87zT258.js b/webapp/assets/_app/immutable/chunks/xMqsWuAL.js similarity index 98% rename from webapp/assets/_app/immutable/chunks/B87zT258.js rename to webapp/assets/_app/immutable/chunks/xMqsWuAL.js index d379d403..b3e3f5df 100644 --- a/webapp/assets/_app/immutable/chunks/B87zT258.js +++ b/webapp/assets/_app/immutable/chunks/xMqsWuAL.js @@ -1 +1 @@ -import{f as x,e as G,a as b,s as z,t as ue,c as re}from"./ZGz3X54u.js";import{i as Rt}from"./CY7Wcm-1.js";import{p as Pt,v as Ct,m as c,o as $t,g as e,d as r,q as jt,l as be,b as At,f as J,s as t,c as i,r as o,t as h,n as Se,k as ce,u as f,a as It,i as Ot,h as Lt}from"./kDtaAWAK.js";import{p as Yr,i as _,s as qt,a as Bt}from"./Cun6jNAp.js";import{e as ze,i as Re}from"./DdT9Vz5Q.js";import{s as Pe,r as j,b as ve,g as A,c as Zr,d as et}from"./Cvcp5xHB.js";import{b as N,a as rt}from"./CYnNqrHp.js";import{p as Ut}from"./CdEA5IGF.js";import{M as Ht}from"./C6jYEeWP.js";import{e as Ce}from"./BZiHL9L3.js";import{J as Dt,U as Gt,a as Jt,b as Nt}from"./C6Z10Ipi.js";import{w as Er}from"./KU08Mex1.js";import{e as Vt}from"./C2c_wqo6.js";var Wt=x('

'),Ft=x('
'),Kt=x(""),Qt=x(''),Xt=x('
'),Yt=x(""),Zt=x(''),ea=x('
Loading templates...
'),ra=x(""),ta=x('

Templates define how the runner software is installed and configured.

',1),aa=x('

Create a template first or proceed without a template to use default behavior.

'),oa=x('

Select an entity first to see available templates

'),ia=x(' '),sa=x('
'),da=x(''),la=x('
'),na=x('

Entity & Provider Configuration

Image & OS Configuration

Runner Limits & Timing

Advanced Settings

Extra Specs (JSON)
',1),ua=x('
Creating...
'),ba=x('

Create New Pool

Entity Level *
'),ca=x(" ",1);function Ta(tt,$e){Pt($e,!1);const[at,ot]=qt(),je=()=>Bt(Vt,"$eagerCache",at),q=c(),ge=Ct();let Ae=Yr($e,"initialEntityType",8,""),Mr=Yr($e,"initialEntityId",8,""),pe=c(!1),V=c(""),d=c(Ae()),T=c([]),Ie=c([]),I=c([]),Oe=c(!1),Le=c(!1),qe=c(!1),K=c(!1),W=c(null),n=c(Mr()),Q=c(""),te=c(""),ae=c(""),Be=c(void 0),Ue=c(void 0),He=c(void 0),De=c(100),Ge=c("garm"),R=c("linux"),fe=c("amd64"),Je=c(""),Ne=c(!0),me=c(!1),B=c([]),X=c(""),oe=c("{}"),U=c(void 0);async function it(){try{r(Le,!0),r(Ie,await A.listProviders())}catch(s){r(V,Ce(s))}finally{r(Le,!1)}}async function Tr(){try{r(qe,!0);const s=Ve();if(!s){r(I,[]);return}if(r(I,await A.listTemplates(e(R),void 0,s)),!e(U)||!e(I).find(l=>l.id===e(U))){const l=e(I).find(m=>m.owner_id==="system");l?r(U,l.id):e(I).length>0&&r(U,e(I)[0].id)}}catch(s){r(V,Ce(s))}finally{r(qe,!1)}}function Ve(){if(!e(n)||!e(T))return null;const s=e(T).find(l=>l.id===e(n));if(!s)return null;if("forge_type"in s)return s.forge_type;if("endpoint"in s){const l=s.endpoint;if(l&&"endpoint_type"in l)return l.endpoint_type||null}return"github"}function ye(){if(!e(n)||!e(T))return!1;const s=e(T).find(l=>l.id===e(n));return s&&"agent_mode"in s?s.agent_mode??!1:!1}async function We(){if(e(d))try{switch(r(Oe,!0),r(T,[]),e(d)){case"repository":r(T,await A.listRepositories());break;case"organization":r(T,await A.listOrganizations());break;case"enterprise":r(T,await A.listEnterprises());break}}catch(s){r(V,Ce(s))}finally{r(Oe,!1)}}function Fe(s){e(d)!==s&&(r(d,s),r(n,""),r(U,void 0),We())}function Sr(s){if(s.operation!=="update")return;const l=s.payload;if(e(d)==="repository"&&l.id===e(n)){const m=je().repositories.find(P=>P.id===e(n));m&&(Object.assign(m,l),r(q,ye()))}else if(e(d)==="organization"&&l.id===e(n)){const m=je().organizations.find(P=>P.id===e(n));m&&(Object.assign(m,l),r(q,ye()))}else if(e(d)==="enterprise"&&l.id===e(n)){const m=je().enterprises.find(P=>P.id===e(n));m&&(Object.assign(m,l),r(q,ye()))}}async function Ke(s){if(!(!e(n)||!e(d)))try{switch(e(d)){case"repository":await A.updateRepository(e(n),s);break;case"organization":await A.updateOrganization(e(n),s);break;case"enterprise":await A.updateEnterprise(e(n),s);break}await We(),r(K,!1)}catch(l){throw l}}function st(){return!e(n)||!e(T)?null:e(T).find(s=>s.id===e(n))||null}function zr(){e(X).trim()&&!e(B).includes(e(X).trim())&&(r(B,[...e(B),e(X).trim()]),r(X,""))}function dt(s){r(B,e(B).filter((l,m)=>m!==s))}function lt(s){s.key==="Enter"&&(s.preventDefault(),zr())}async function nt(){if(!e(d)||!e(n)||!e(Q)||!e(te)||!e(ae)){r(V,"Please fill in all required fields");return}try{r(pe,!0),r(V,"");let s={};if(e(oe).trim())try{s=JSON.parse(e(oe))}catch{throw new Error("Invalid JSON in extra specs")}const l={provider_name:e(Q),image:e(te),flavor:e(ae),max_runners:e(Be)||10,min_idle_runners:e(Ue)||0,runner_bootstrap_timeout:e(He)||20,priority:e(De),runner_prefix:e(Ge),os_type:e(R),os_arch:e(fe),"github-runner-group":e(Je)||void 0,enabled:e(Ne),enable_shell:e(me),tags:e(B),extra_specs:e(oe).trim()?s:void 0,template_id:e(U)};if(Ae()&&Mr())ge("submit",l);else{switch(e(d)){case"repository":await A.createRepositoryPool(e(n),l);break;case"organization":await A.createOrganizationPool(e(n),l);break;case"enterprise":await A.createEnterprisePool(e(n),l);break;default:throw new Error("Invalid entity level")}ge("submit",l)}}catch(s){r(V,Ce(s))}finally{r(pe,!1)}}$t(()=>{it(),Ae()&&We(),e(d)&&(e(d)==="repository"||e(d)==="organization"||e(d)==="enterprise")&&r(W,Er.subscribeToEntity(e(d),["update"],Sr))}),jt(()=>{e(W)&&(e(W)(),r(W,null))}),be(()=>{},()=>{r(q,ye())}),be(()=>e(q),()=>{e(q)||r(me,!1)}),be(()=>(e(n),e(R)),()=>{e(n)&&e(R)&&Tr()}),be(()=>(e(R),e(n)),()=>{e(R)&&e(n)&&Tr()}),be(()=>(e(d),e(W),Er),()=>{e(d)&&(e(d)==="repository"||e(d)==="organization"||e(d)==="enterprise")&&(e(W)&&e(W)(),r(W,Er.subscribeToEntity(e(d),["update"],Sr)))}),At(),Rt();var Rr=ca(),Pr=J(Rr);Ht(Pr,{$$events:{close:()=>ge("close")},children:(s,l)=>{var m=ba(),P=t(i(m),2),xe=i(P);{var ie=k=>{var S=Wt(),ee=i(S),we=i(ee,!0);o(ee),o(S),h(()=>z(we,e(V))),b(k,S)};_(xe,k=>{e(V)&&k(ie)})}var Y=t(xe,2),he=t(i(Y),2),se=i(he),de=t(se,2),H=t(de,2);o(he),o(Y);var F=t(Y,2);{var Qe=k=>{var S=na(),ee=J(S),we=t(i(ee),2),Ze=i(we),er=i(Ze),ct=i(er);Se(),o(er);var vt=t(er,2);{var gt=a=>{var v=Ft();b(a,v)},pt=a=>{var v=Qt();h(()=>{e(n),ce(()=>{e(d),e(T)})});var w=i(v),C=i(w);o(w),w.value=w.__value="";var $=t(w);ze($,1,()=>e(T),Re,(p,u)=>{var y=Kt(),D=i(y);{var le=g=>{var M=ue();h(()=>z(M,`${e(u),f(()=>e(u).owner)??""}/${e(u),f(()=>e(u).name)??""} (${e(u),f(()=>e(u).endpoint?.name)??""})`)),b(g,M)},L=g=>{var M=ue();h(()=>z(M,`${e(u),f(()=>e(u).name)??""} (${e(u),f(()=>e(u).endpoint?.name)??""})`)),b(g,M)};_(D,g=>{e(d)==="repository"?g(le):g(L,!1)})}o(y);var E={};h(()=>{E!==(E=(e(u),f(()=>e(u).id)))&&(y.value=(y.__value=(e(u),f(()=>e(u).id)))??"")}),b(p,y)}),o(v),h(()=>z(C,`Select a ${e(d)??""}`)),ve(v,()=>e(n),p=>r(n,p)),b(a,v)};_(vt,a=>{e(Oe)?a(gt):a(pt,!1)})}o(Ze);var Cr=t(Ze,2),ft=t(i(Cr),2);{var mt=a=>{var v=Xt();b(a,v)},yt=a=>{var v=Zt();h(()=>{e(Q),ce(()=>{e(Ie)})});var w=i(v);w.value=w.__value="";var C=t(w);ze(C,1,()=>e(Ie),Re,($,p)=>{var u=Yt(),y=i(u,!0);o(u);var D={};h(()=>{z(y,(e(p),f(()=>e(p).name))),D!==(D=(e(p),f(()=>e(p).name)))&&(u.value=(u.__value=(e(p),f(()=>e(p).name)))??"")}),b($,u)}),o(v),ve(v,()=>e(Q),$=>r(Q,$)),b(a,v)};_(ft,a=>{e(Le)?a(mt):a(yt,!1)})}o(Cr),o(we),o(ee);var rr=t(ee,2),tr=t(i(rr),2),ar=i(tr),$r=t(i(ar),2);j($r),o(ar);var or=t(ar,2),jr=t(i(or),2);j(jr),o(or);var ir=t(or,2),sr=t(i(ir),2);h(()=>{e(R),ce(()=>{})});var dr=i(sr);dr.value=dr.__value="linux";var Ar=t(dr);Ar.value=Ar.__value="windows",o(sr),o(ir);var Ir=t(ir,2),lr=t(i(Ir),2);h(()=>{e(fe),ce(()=>{})});var nr=i(lr);nr.value=nr.__value="amd64";var Or=t(nr);Or.value=Or.__value="arm64",o(lr),o(Ir),o(tr);var Lr=t(tr,2),xt=t(i(Lr),2);{var ht=a=>{var v=ea();b(a,v)},_t=a=>{var v=re(),w=J(v);{var C=p=>{var u=ta(),y=J(u);h(()=>{e(U),ce(()=>{e(I)})}),ze(y,5,()=>e(I),Re,(E,g)=>{var M=ra(),ne=i(M),_r=t(ne);{var kr=wr=>{var Xr=ue();h(()=>z(Xr,`- ${e(g),f(()=>e(g).description)??""}`)),b(wr,Xr)};_(_r,wr=>{e(g),f(()=>e(g).description)&&wr(kr)})}o(M);var Te={};h(()=>{z(ne,`${e(g),f(()=>e(g).name)??""} ${e(g),f(()=>e(g).owner_id==="system"?"(System)":"")??""} `),Te!==(Te=(e(g),f(()=>e(g).id)))&&(M.value=(M.__value=(e(g),f(()=>e(g).id)))??"")}),b(E,M)}),o(y);var D=t(y,2),le=t(i(D));{var L=E=>{var g=ue();h(M=>z(g,`Showing templates for ${M??""} ${e(R)??""}.`),[()=>f(Ve)]),b(E,g)};_(le,E=>{e(n)&&E(L)})}o(D),ve(y,()=>e(U),E=>r(U,E)),b(p,u)},$=p=>{var u=re(),y=J(u);{var D=L=>{var E=aa(),g=i(E),M=i(g);o(g);var ne=t(g,2),_r=i(ne);Se(),o(ne),o(E),h((kr,Te)=>{z(M,`No templates found for ${kr??""} ${e(R)??""}.`),Zr(_r,"href",Te)},[()=>f(Ve),()=>(Lt(et),f(()=>et("/templates")))]),b(L,E)},le=L=>{var E=oa();b(L,E)};_(y,L=>{e(n)?L(D):L(le,!1)},!0)}b(p,u)};_(w,p=>{e(I),f(()=>e(I).length>0)?p(C):p($,!1)},!0)}b(a,v)};_(xt,a=>{e(qe)?a(ht):a(_t,!1)})}o(Lr),o(rr);var ur=t(rr,2),qr=t(i(ur),2),br=i(qr),Br=t(i(br),2);j(Br),o(br);var cr=t(br,2),Ur=t(i(cr),2);j(Ur),o(cr);var Hr=t(cr,2),Dr=t(i(Hr),2);j(Dr),o(Hr),o(qr),o(ur);var Gr=t(ur,2),vr=t(i(Gr),2),gr=i(vr),Jr=t(i(gr),2);j(Jr),o(gr);var pr=t(gr,2),Nr=t(i(pr),2);j(Nr),o(pr);var Vr=t(pr,2),Wr=t(i(Vr),2);j(Wr),o(Vr),o(vr);var fr=t(vr,2),Fr=t(i(fr),2),mr=i(Fr),Ee=i(mr);j(Ee);var kt=t(Ee,2);o(mr);var wt=t(mr,2);{var Et=a=>{var v=sa();ze(v,5,()=>e(B),Re,(w,C,$)=>{var p=ia(),u=i(p),y=t(u);o(p),h(()=>{z(u,`${e(C)??""} `),Zr(y,"aria-label",`Remove tag ${e(C)}`)}),G("click",y,()=>dt($)),b(w,p)}),o(v),b(a,v)};_(wt,a=>{e(B),f(()=>e(B).length>0)&&a(Et)})}o(Fr),o(fr);var yr=t(fr,2),Mt=t(i(yr),2);Dt(Mt,{rows:4,placeholder:"{}",get value(){return e(oe)},set value(a){r(oe,a)},$$legacy:!0}),o(yr);var xr=t(yr,2),Kr=i(xr);j(Kr),Se(2),o(xr);var Qr=t(xr,2),hr=i(Qr),Me=i(hr);j(Me);var Tt=t(Me,2);Se(2),o(hr);var St=t(hr,2);{var zt=a=>{var v=la(),w=t(i(v),2),C=i(w),$=t(C);{var p=u=>{var y=da();G("click",y,()=>r(K,!0)),b(u,y)};_($,u=>{e(n)&&u(p)})}o(w),o(v),h(()=>z(C,`Shell access requires agent mode to be enabled on the ${e(d)??""}. `)),b(a,v)};_(St,a=>{e(q)||a(zt)})}o(Qr),o(Gr),h(a=>{z(ct,`${a??""} `),Me.disabled=!e(q),Pe(Tt,1,`ml-2 block text-sm font-medium text-gray-700 dark:text-gray-300 ${e(q)?"":"opacity-50"}`)},[()=>(e(d),f(()=>e(d).charAt(0).toUpperCase()+e(d).slice(1)))]),N($r,()=>e(te),a=>r(te,a)),N(jr,()=>e(ae),a=>r(ae,a)),ve(sr,()=>e(R),a=>r(R,a)),ve(lr,()=>e(fe),a=>r(fe,a)),N(Br,()=>e(Ue),a=>r(Ue,a)),N(Ur,()=>e(Be),a=>r(Be,a)),N(Dr,()=>e(He),a=>r(He,a)),N(Jr,()=>e(Ge),a=>r(Ge,a)),N(Nr,()=>e(De),a=>r(De,a)),N(Wr,()=>e(Je),a=>r(Je,a)),N(Ee,()=>e(X),a=>r(X,a)),G("keydown",Ee,lt),G("click",kt,zr),rt(Kr,()=>e(Ne),a=>r(Ne,a)),rt(Me,()=>e(me),a=>r(me,a)),b(k,S)};_(F,k=>{e(d)&&k(Qe)})}var _e=t(F,2),ke=i(_e),O=t(ke,2),Z=i(O);{var Xe=k=>{var S=ua();b(k,S)},Ye=k=>{var S=ue("Create Pool");b(k,S)};_(Z,k=>{e(pe)?k(Xe):k(Ye,!1)})}o(O),o(_e),o(P),o(m),h(()=>{Pe(se,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="repository"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),Pe(de,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="organization"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),Pe(H,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="enterprise"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),O.disabled=e(pe)||!e(d)||!e(n)||!e(Q)||!e(te)||!e(ae)}),G("click",se,()=>Fe("repository")),G("click",de,()=>Fe("organization")),G("click",H,()=>Fe("enterprise")),G("click",ke,()=>ge("close")),G("submit",P,Ut(nt)),b(s,m)},$$slots:{default:!0}});var ut=t(Pr,2);{var bt=s=>{const l=Ot(()=>f(st));var m=re(),P=J(m);{var xe=ie=>{var Y=re(),he=J(Y);{var se=H=>{Gt(H,{get repository(){return e(l)},$$events:{close:()=>r(K,!1),submit:F=>Ke(F.detail)}})},de=H=>{var F=re(),Qe=J(F);{var _e=O=>{Jt(O,{get organization(){return e(l)},$$events:{close:()=>r(K,!1),submit:Z=>Ke(Z.detail)}})},ke=O=>{var Z=re(),Xe=J(Z);{var Ye=k=>{Nt(k,{get enterprise(){return e(l)},$$events:{close:()=>r(K,!1),submit:S=>Ke(S.detail)}})};_(Xe,k=>{e(d)==="enterprise"&&k(Ye)},!0)}b(O,Z)};_(Qe,O=>{e(d)==="organization"?O(_e):O(ke,!1)},!0)}b(H,F)};_(he,H=>{e(d)==="repository"?H(se):H(de,!1)})}b(ie,Y)};_(P,ie=>{e(l)&&ie(xe)})}b(s,m)};_(ut,s=>{e(K)&&e(n)&&s(bt)})}b(tt,Rr),It(),ot()}export{Ta as C}; +import{f as x,e as G,a as b,s as z,t as ue,c as re}from"./ZGz3X54u.js";import{i as Rt}from"./CY7Wcm-1.js";import{p as Pt,v as Ct,m as c,o as $t,g as e,d as r,q as jt,l as be,b as At,f as J,s as t,c as i,r as o,t as h,n as Se,k as ce,u as f,a as It,i as Ot,h as Lt}from"./kDtaAWAK.js";import{p as Yr,i as _,s as qt,a as Bt}from"./Cun6jNAp.js";import{e as ze,i as Re}from"./DdT9Vz5Q.js";import{s as Pe,r as j,b as ve,g as A,c as Zr,d as et}from"./CYK-UalN.js";import{b as N,a as rt}from"./CYnNqrHp.js";import{p as Ut}from"./CdEA5IGF.js";import{M as Ht}from"./CVBpH3Sf.js";import{e as Ce}from"./BZiHL9L3.js";import{J as Dt,U as Gt,a as Jt,b as Nt}from"./C6-Yv_jr.js";import{w as Er}from"./KU08Mex1.js";import{e as Vt}from"./Vo3Mv3dp.js";var Wt=x('

'),Ft=x('
'),Kt=x(""),Qt=x(''),Xt=x('
'),Yt=x(""),Zt=x(''),ea=x('
Loading templates...
'),ra=x(""),ta=x('

Templates define how the runner software is installed and configured.

',1),aa=x('

Create a template first or proceed without a template to use default behavior.

'),oa=x('

Select an entity first to see available templates

'),ia=x(' '),sa=x('
'),da=x(''),la=x('
'),na=x('

Entity & Provider Configuration

Image & OS Configuration

Runner Limits & Timing

Advanced Settings

Extra Specs (JSON)
',1),ua=x('
Creating...
'),ba=x('

Create New Pool

Entity Level *
'),ca=x(" ",1);function Ta(tt,$e){Pt($e,!1);const[at,ot]=qt(),je=()=>Bt(Vt,"$eagerCache",at),q=c(),ge=Ct();let Ae=Yr($e,"initialEntityType",8,""),Mr=Yr($e,"initialEntityId",8,""),pe=c(!1),V=c(""),d=c(Ae()),T=c([]),Ie=c([]),I=c([]),Oe=c(!1),Le=c(!1),qe=c(!1),K=c(!1),W=c(null),n=c(Mr()),Q=c(""),te=c(""),ae=c(""),Be=c(void 0),Ue=c(void 0),He=c(void 0),De=c(100),Ge=c("garm"),R=c("linux"),fe=c("amd64"),Je=c(""),Ne=c(!0),me=c(!1),B=c([]),X=c(""),oe=c("{}"),U=c(void 0);async function it(){try{r(Le,!0),r(Ie,await A.listProviders())}catch(s){r(V,Ce(s))}finally{r(Le,!1)}}async function Tr(){try{r(qe,!0);const s=Ve();if(!s){r(I,[]);return}if(r(I,await A.listTemplates(e(R),void 0,s)),!e(U)||!e(I).find(l=>l.id===e(U))){const l=e(I).find(m=>m.owner_id==="system");l?r(U,l.id):e(I).length>0&&r(U,e(I)[0].id)}}catch(s){r(V,Ce(s))}finally{r(qe,!1)}}function Ve(){if(!e(n)||!e(T))return null;const s=e(T).find(l=>l.id===e(n));if(!s)return null;if("forge_type"in s)return s.forge_type;if("endpoint"in s){const l=s.endpoint;if(l&&"endpoint_type"in l)return l.endpoint_type||null}return"github"}function ye(){if(!e(n)||!e(T))return!1;const s=e(T).find(l=>l.id===e(n));return s&&"agent_mode"in s?s.agent_mode??!1:!1}async function We(){if(e(d))try{switch(r(Oe,!0),r(T,[]),e(d)){case"repository":r(T,await A.listRepositories());break;case"organization":r(T,await A.listOrganizations());break;case"enterprise":r(T,await A.listEnterprises());break}}catch(s){r(V,Ce(s))}finally{r(Oe,!1)}}function Fe(s){e(d)!==s&&(r(d,s),r(n,""),r(U,void 0),We())}function Sr(s){if(s.operation!=="update")return;const l=s.payload;if(e(d)==="repository"&&l.id===e(n)){const m=je().repositories.find(P=>P.id===e(n));m&&(Object.assign(m,l),r(q,ye()))}else if(e(d)==="organization"&&l.id===e(n)){const m=je().organizations.find(P=>P.id===e(n));m&&(Object.assign(m,l),r(q,ye()))}else if(e(d)==="enterprise"&&l.id===e(n)){const m=je().enterprises.find(P=>P.id===e(n));m&&(Object.assign(m,l),r(q,ye()))}}async function Ke(s){if(!(!e(n)||!e(d)))try{switch(e(d)){case"repository":await A.updateRepository(e(n),s);break;case"organization":await A.updateOrganization(e(n),s);break;case"enterprise":await A.updateEnterprise(e(n),s);break}await We(),r(K,!1)}catch(l){throw l}}function st(){return!e(n)||!e(T)?null:e(T).find(s=>s.id===e(n))||null}function zr(){e(X).trim()&&!e(B).includes(e(X).trim())&&(r(B,[...e(B),e(X).trim()]),r(X,""))}function dt(s){r(B,e(B).filter((l,m)=>m!==s))}function lt(s){s.key==="Enter"&&(s.preventDefault(),zr())}async function nt(){if(!e(d)||!e(n)||!e(Q)||!e(te)||!e(ae)){r(V,"Please fill in all required fields");return}try{r(pe,!0),r(V,"");let s={};if(e(oe).trim())try{s=JSON.parse(e(oe))}catch{throw new Error("Invalid JSON in extra specs")}const l={provider_name:e(Q),image:e(te),flavor:e(ae),max_runners:e(Be)||10,min_idle_runners:e(Ue)||0,runner_bootstrap_timeout:e(He)||20,priority:e(De),runner_prefix:e(Ge),os_type:e(R),os_arch:e(fe),"github-runner-group":e(Je)||void 0,enabled:e(Ne),enable_shell:e(me),tags:e(B),extra_specs:e(oe).trim()?s:void 0,template_id:e(U)};if(Ae()&&Mr())ge("submit",l);else{switch(e(d)){case"repository":await A.createRepositoryPool(e(n),l);break;case"organization":await A.createOrganizationPool(e(n),l);break;case"enterprise":await A.createEnterprisePool(e(n),l);break;default:throw new Error("Invalid entity level")}ge("submit",l)}}catch(s){r(V,Ce(s))}finally{r(pe,!1)}}$t(()=>{it(),Ae()&&We(),e(d)&&(e(d)==="repository"||e(d)==="organization"||e(d)==="enterprise")&&r(W,Er.subscribeToEntity(e(d),["update"],Sr))}),jt(()=>{e(W)&&(e(W)(),r(W,null))}),be(()=>{},()=>{r(q,ye())}),be(()=>e(q),()=>{e(q)||r(me,!1)}),be(()=>(e(n),e(R)),()=>{e(n)&&e(R)&&Tr()}),be(()=>(e(R),e(n)),()=>{e(R)&&e(n)&&Tr()}),be(()=>(e(d),e(W),Er),()=>{e(d)&&(e(d)==="repository"||e(d)==="organization"||e(d)==="enterprise")&&(e(W)&&e(W)(),r(W,Er.subscribeToEntity(e(d),["update"],Sr)))}),At(),Rt();var Rr=ca(),Pr=J(Rr);Ht(Pr,{$$events:{close:()=>ge("close")},children:(s,l)=>{var m=ba(),P=t(i(m),2),xe=i(P);{var ie=k=>{var S=Wt(),ee=i(S),we=i(ee,!0);o(ee),o(S),h(()=>z(we,e(V))),b(k,S)};_(xe,k=>{e(V)&&k(ie)})}var Y=t(xe,2),he=t(i(Y),2),se=i(he),de=t(se,2),H=t(de,2);o(he),o(Y);var F=t(Y,2);{var Qe=k=>{var S=na(),ee=J(S),we=t(i(ee),2),Ze=i(we),er=i(Ze),ct=i(er);Se(),o(er);var vt=t(er,2);{var gt=a=>{var v=Ft();b(a,v)},pt=a=>{var v=Qt();h(()=>{e(n),ce(()=>{e(d),e(T)})});var w=i(v),C=i(w);o(w),w.value=w.__value="";var $=t(w);ze($,1,()=>e(T),Re,(p,u)=>{var y=Kt(),D=i(y);{var le=g=>{var M=ue();h(()=>z(M,`${e(u),f(()=>e(u).owner)??""}/${e(u),f(()=>e(u).name)??""} (${e(u),f(()=>e(u).endpoint?.name)??""})`)),b(g,M)},L=g=>{var M=ue();h(()=>z(M,`${e(u),f(()=>e(u).name)??""} (${e(u),f(()=>e(u).endpoint?.name)??""})`)),b(g,M)};_(D,g=>{e(d)==="repository"?g(le):g(L,!1)})}o(y);var E={};h(()=>{E!==(E=(e(u),f(()=>e(u).id)))&&(y.value=(y.__value=(e(u),f(()=>e(u).id)))??"")}),b(p,y)}),o(v),h(()=>z(C,`Select a ${e(d)??""}`)),ve(v,()=>e(n),p=>r(n,p)),b(a,v)};_(vt,a=>{e(Oe)?a(gt):a(pt,!1)})}o(Ze);var Cr=t(Ze,2),ft=t(i(Cr),2);{var mt=a=>{var v=Xt();b(a,v)},yt=a=>{var v=Zt();h(()=>{e(Q),ce(()=>{e(Ie)})});var w=i(v);w.value=w.__value="";var C=t(w);ze(C,1,()=>e(Ie),Re,($,p)=>{var u=Yt(),y=i(u,!0);o(u);var D={};h(()=>{z(y,(e(p),f(()=>e(p).name))),D!==(D=(e(p),f(()=>e(p).name)))&&(u.value=(u.__value=(e(p),f(()=>e(p).name)))??"")}),b($,u)}),o(v),ve(v,()=>e(Q),$=>r(Q,$)),b(a,v)};_(ft,a=>{e(Le)?a(mt):a(yt,!1)})}o(Cr),o(we),o(ee);var rr=t(ee,2),tr=t(i(rr),2),ar=i(tr),$r=t(i(ar),2);j($r),o(ar);var or=t(ar,2),jr=t(i(or),2);j(jr),o(or);var ir=t(or,2),sr=t(i(ir),2);h(()=>{e(R),ce(()=>{})});var dr=i(sr);dr.value=dr.__value="linux";var Ar=t(dr);Ar.value=Ar.__value="windows",o(sr),o(ir);var Ir=t(ir,2),lr=t(i(Ir),2);h(()=>{e(fe),ce(()=>{})});var nr=i(lr);nr.value=nr.__value="amd64";var Or=t(nr);Or.value=Or.__value="arm64",o(lr),o(Ir),o(tr);var Lr=t(tr,2),xt=t(i(Lr),2);{var ht=a=>{var v=ea();b(a,v)},_t=a=>{var v=re(),w=J(v);{var C=p=>{var u=ta(),y=J(u);h(()=>{e(U),ce(()=>{e(I)})}),ze(y,5,()=>e(I),Re,(E,g)=>{var M=ra(),ne=i(M),_r=t(ne);{var kr=wr=>{var Xr=ue();h(()=>z(Xr,`- ${e(g),f(()=>e(g).description)??""}`)),b(wr,Xr)};_(_r,wr=>{e(g),f(()=>e(g).description)&&wr(kr)})}o(M);var Te={};h(()=>{z(ne,`${e(g),f(()=>e(g).name)??""} ${e(g),f(()=>e(g).owner_id==="system"?"(System)":"")??""} `),Te!==(Te=(e(g),f(()=>e(g).id)))&&(M.value=(M.__value=(e(g),f(()=>e(g).id)))??"")}),b(E,M)}),o(y);var D=t(y,2),le=t(i(D));{var L=E=>{var g=ue();h(M=>z(g,`Showing templates for ${M??""} ${e(R)??""}.`),[()=>f(Ve)]),b(E,g)};_(le,E=>{e(n)&&E(L)})}o(D),ve(y,()=>e(U),E=>r(U,E)),b(p,u)},$=p=>{var u=re(),y=J(u);{var D=L=>{var E=aa(),g=i(E),M=i(g);o(g);var ne=t(g,2),_r=i(ne);Se(),o(ne),o(E),h((kr,Te)=>{z(M,`No templates found for ${kr??""} ${e(R)??""}.`),Zr(_r,"href",Te)},[()=>f(Ve),()=>(Lt(et),f(()=>et("/templates")))]),b(L,E)},le=L=>{var E=oa();b(L,E)};_(y,L=>{e(n)?L(D):L(le,!1)},!0)}b(p,u)};_(w,p=>{e(I),f(()=>e(I).length>0)?p(C):p($,!1)},!0)}b(a,v)};_(xt,a=>{e(qe)?a(ht):a(_t,!1)})}o(Lr),o(rr);var ur=t(rr,2),qr=t(i(ur),2),br=i(qr),Br=t(i(br),2);j(Br),o(br);var cr=t(br,2),Ur=t(i(cr),2);j(Ur),o(cr);var Hr=t(cr,2),Dr=t(i(Hr),2);j(Dr),o(Hr),o(qr),o(ur);var Gr=t(ur,2),vr=t(i(Gr),2),gr=i(vr),Jr=t(i(gr),2);j(Jr),o(gr);var pr=t(gr,2),Nr=t(i(pr),2);j(Nr),o(pr);var Vr=t(pr,2),Wr=t(i(Vr),2);j(Wr),o(Vr),o(vr);var fr=t(vr,2),Fr=t(i(fr),2),mr=i(Fr),Ee=i(mr);j(Ee);var kt=t(Ee,2);o(mr);var wt=t(mr,2);{var Et=a=>{var v=sa();ze(v,5,()=>e(B),Re,(w,C,$)=>{var p=ia(),u=i(p),y=t(u);o(p),h(()=>{z(u,`${e(C)??""} `),Zr(y,"aria-label",`Remove tag ${e(C)}`)}),G("click",y,()=>dt($)),b(w,p)}),o(v),b(a,v)};_(wt,a=>{e(B),f(()=>e(B).length>0)&&a(Et)})}o(Fr),o(fr);var yr=t(fr,2),Mt=t(i(yr),2);Dt(Mt,{rows:4,placeholder:"{}",get value(){return e(oe)},set value(a){r(oe,a)},$$legacy:!0}),o(yr);var xr=t(yr,2),Kr=i(xr);j(Kr),Se(2),o(xr);var Qr=t(xr,2),hr=i(Qr),Me=i(hr);j(Me);var Tt=t(Me,2);Se(2),o(hr);var St=t(hr,2);{var zt=a=>{var v=la(),w=t(i(v),2),C=i(w),$=t(C);{var p=u=>{var y=da();G("click",y,()=>r(K,!0)),b(u,y)};_($,u=>{e(n)&&u(p)})}o(w),o(v),h(()=>z(C,`Shell access requires agent mode to be enabled on the ${e(d)??""}. `)),b(a,v)};_(St,a=>{e(q)||a(zt)})}o(Qr),o(Gr),h(a=>{z(ct,`${a??""} `),Me.disabled=!e(q),Pe(Tt,1,`ml-2 block text-sm font-medium text-gray-700 dark:text-gray-300 ${e(q)?"":"opacity-50"}`)},[()=>(e(d),f(()=>e(d).charAt(0).toUpperCase()+e(d).slice(1)))]),N($r,()=>e(te),a=>r(te,a)),N(jr,()=>e(ae),a=>r(ae,a)),ve(sr,()=>e(R),a=>r(R,a)),ve(lr,()=>e(fe),a=>r(fe,a)),N(Br,()=>e(Ue),a=>r(Ue,a)),N(Ur,()=>e(Be),a=>r(Be,a)),N(Dr,()=>e(He),a=>r(He,a)),N(Jr,()=>e(Ge),a=>r(Ge,a)),N(Nr,()=>e(De),a=>r(De,a)),N(Wr,()=>e(Je),a=>r(Je,a)),N(Ee,()=>e(X),a=>r(X,a)),G("keydown",Ee,lt),G("click",kt,zr),rt(Kr,()=>e(Ne),a=>r(Ne,a)),rt(Me,()=>e(me),a=>r(me,a)),b(k,S)};_(F,k=>{e(d)&&k(Qe)})}var _e=t(F,2),ke=i(_e),O=t(ke,2),Z=i(O);{var Xe=k=>{var S=ua();b(k,S)},Ye=k=>{var S=ue("Create Pool");b(k,S)};_(Z,k=>{e(pe)?k(Xe):k(Ye,!1)})}o(O),o(_e),o(P),o(m),h(()=>{Pe(se,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="repository"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),Pe(de,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="organization"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),Pe(H,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="enterprise"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),O.disabled=e(pe)||!e(d)||!e(n)||!e(Q)||!e(te)||!e(ae)}),G("click",se,()=>Fe("repository")),G("click",de,()=>Fe("organization")),G("click",H,()=>Fe("enterprise")),G("click",ke,()=>ge("close")),G("submit",P,Ut(nt)),b(s,m)},$$slots:{default:!0}});var ut=t(Pr,2);{var bt=s=>{const l=Ot(()=>f(st));var m=re(),P=J(m);{var xe=ie=>{var Y=re(),he=J(Y);{var se=H=>{Gt(H,{get repository(){return e(l)},$$events:{close:()=>r(K,!1),submit:F=>Ke(F.detail)}})},de=H=>{var F=re(),Qe=J(F);{var _e=O=>{Jt(O,{get organization(){return e(l)},$$events:{close:()=>r(K,!1),submit:Z=>Ke(Z.detail)}})},ke=O=>{var Z=re(),Xe=J(Z);{var Ye=k=>{Nt(k,{get enterprise(){return e(l)},$$events:{close:()=>r(K,!1),submit:S=>Ke(S.detail)}})};_(Xe,k=>{e(d)==="enterprise"&&k(Ye)},!0)}b(O,Z)};_(Qe,O=>{e(d)==="organization"?O(_e):O(ke,!1)},!0)}b(H,F)};_(he,H=>{e(d)==="repository"?H(se):H(de,!1)})}b(ie,Y)};_(P,ie=>{e(l)&&ie(xe)})}b(s,m)};_(ut,s=>{e(K)&&e(n)&&s(bt)})}b(tt,Rr),It(),ot()}export{Ta as C}; diff --git a/webapp/assets/_app/immutable/entry/app.CRkYa7Qr.js b/webapp/assets/_app/immutable/entry/app.CRkYa7Qr.js deleted file mode 100644 index dc06bb0e..00000000 --- a/webapp/assets/_app/immutable/entry/app.CRkYa7Qr.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.JalwDZMc.js","../chunks/ZGz3X54u.js","../chunks/kDtaAWAK.js","../chunks/CY7Wcm-1.js","../chunks/Cun6jNAp.js","../chunks/Cvcp5xHB.js","../chunks/CkTG2UXI.js","../chunks/DH5setay.js","../chunks/8ZO9Ka4R.js","../chunks/BU_V7FOQ.js","../chunks/CkcEJ1BA.js","../chunks/C8nIl9By.js","../chunks/DdT9Vz5Q.js","../chunks/D3FdGlax.js","../chunks/KU08Mex1.js","../chunks/BVGCMSWJ.js","../assets/0.Xtu_mOgF.css","../nodes/1.DfUf2A_9.js","../nodes/2.DwM7F70n.js","../chunks/C2c_wqo6.js","../chunks/CYnNqrHp.js","../chunks/CdEA5IGF.js","../chunks/C6jYEeWP.js","../chunks/Ckgw6FMz.js","../chunks/BZiHL9L3.js","../nodes/3.BzLzrOWy.js","../chunks/CLZesvzF.js","../chunks/CCoxuXg5.js","../chunks/DNHT2U_W.js","../chunks/uzzFhb3G.js","../chunks/Cfdue6T6.js","../chunks/Imj5EgK1.js","../chunks/DovBLKjH.js","../chunks/C-3AL0iB.js","../chunks/BTeTCgJA.js","../chunks/ow_oMtSd.js","../chunks/Cs0pYghy.js","../nodes/4.4T8ji-4a.js","../nodes/5.D-IgI9y1.js","../chunks/io-Ugua7.js","../chunks/lQWw1Z23.js","../chunks/CEJvqnOn.js","../chunks/DochbgGJ.js","../nodes/6.DzEKB4QD.js","../chunks/DOA3alhD.js","../chunks/CRSOHHg7.js","../chunks/vYI-AT_7.js","../chunks/B87zT258.js","../chunks/C6Z10Ipi.js","../nodes/7.DLPvTRtH.js","../nodes/8.CQSV4FuF.js","../chunks/-FPg0SOX.js","../assets/ShellTerminal.Bno-wGqG.css","../nodes/9.DOPDjgGY.js","../nodes/10.4V8r82tY.js","../nodes/11.hAL_Iuyo.js","../chunks/aK-A9Gop.js","../nodes/12.Csus4sgy.js","../nodes/13.hS6EkA-z.js","../nodes/14.BjI1asMm.js","../chunks/BaTN8n88.js","../nodes/15.D2oFYgN3.js","../chunks/CUtPzwFi.js","../chunks/DuwadzDF.js","../nodes/16.CnTD7yhj.js","../chunks/JRrg5LRu.js","../nodes/17.LPpjfVrH.js","../nodes/18.DZSsQ4kC.js","../nodes/19.DCbbcuA3.js","../chunks/BS0eXXA4.js","../nodes/20.D8JTfsn9.js","../nodes/21.D25eFoe0.js","../chunks/C98nByjP.js","../nodes/22.laAA6k8S.js","../chunks/CD4S0w_x.js","../nodes/23.D4QqDH8N.js","../nodes/24.BLkBUd5n.js"])))=>i.map(i=>d[i]); -import{d as D,aB as G,g as d,aD as U,an as F,m as W,p as Y,ad as H,ae as J,o as K,aE as T,aF as Q,f as y,s as X,a as Z,c as $,r as tt,aG as I,t as et}from"../chunks/kDtaAWAK.js";import{d as rt,m as ot,u as st,f as C,a as P,c as V,t as at,s as it}from"../chunks/ZGz3X54u.js";import{p as b,i as w}from"../chunks/Cun6jNAp.js";import{c as k}from"../chunks/Imj5EgK1.js";import{b as j}from"../chunks/DochbgGJ.js";function nt(n){return class extends _t{constructor(t){super({component:n,...t})}}}class _t{#e;#t;constructor(t){var a=new Map,m=(o,e)=>{var s=W(e,!1,!1);return a.set(o,s),s};const c=new Proxy({...t.props||{},$$events:{}},{get(o,e){return d(a.get(e)??m(e,Reflect.get(o,e)))},has(o,e){return e===G?!0:(d(a.get(e)??m(e,Reflect.get(o,e))),Reflect.has(o,e))},set(o,e,s){return D(a.get(e)??m(e,s),s),Reflect.set(o,e,s)}});this.#t=(t.hydrate?rt:ot)(t.component,{target:t.target,anchor:t.anchor,props:c,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&U(),this.#e=c.$$events;for(const o of Object.keys(this.#t))o==="$set"||o==="$destroy"||o==="$on"||F(this,o,{get(){return this.#t[o]},set(e){this.#t[o]=e},enumerable:!0});this.#t.$set=o=>{Object.assign(c,o)},this.#t.$destroy=()=>{st(this.#t)}}$set(t){this.#t.$set(t)}$on(t,a){this.#e[t]=this.#e[t]||[];const m=(...c)=>a.call(this,...c);return this.#e[t].push(m),()=>{this.#e[t]=this.#e[t].filter(c=>c!==m)}}$destroy(){this.#t.$destroy()}}const mt="modulepreload",ct=function(n,t){return new URL(n,t).href},S={},r=function(t,a,m){let c=Promise.resolve();if(a&&a.length>0){let A=function(_){return Promise.all(_.map(l=>Promise.resolve(l).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const e=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),L=s?.nonce||s?.getAttribute("nonce");c=A(a.map(_=>{if(_=ct(_,m),_ in S)return;S[_]=!0;const l=_.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(m)for(let v=e.length-1;v>=0;v--){const i=e[v];if(i.href===_&&(!l||i.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${_}"]${f}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":mt,l||(u.as="script"),u.crossOrigin="",u.href=_,L&&u.setAttribute("nonce",L),document.head.appendChild(u),l)return new Promise((v,i)=>{u.addEventListener("load",v),u.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${_}`)))})}))}function o(e){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=e,window.dispatchEvent(s),!s.defaultPrevented)throw e}return c.then(e=>{for(const s of e||[])s.status==="rejected"&&o(s.reason);return t().catch(o)})},Rt={};var ut=C('
'),lt=C(" ",1);function dt(n,t){Y(t,!0);let a=b(t,"components",23,()=>[]),m=b(t,"data_0",3,null),c=b(t,"data_1",3,null);H(()=>t.stores.page.set(t.page)),J(()=>{t.stores,t.page,t.constructors,a(),t.form,m(),c(),t.stores.page.notify()});let o=T(!1),e=T(!1),s=T(null);K(()=>{const i=t.stores.page.subscribe(()=>{d(o)&&(D(e,!0),Q().then(()=>{D(s,document.title||"untitled page",!0)}))});return D(o,!0),i});const L=I(()=>t.constructors[1]);var A=lt(),_=y(A);{var l=i=>{const p=I(()=>t.constructors[0]);var E=V(),R=y(E);k(R,()=>d(p),(h,g)=>{j(g(h,{get data(){return m()},get form(){return t.form},get params(){return t.page.params},children:(O,vt)=>{var x=V(),N=y(x);k(N,()=>d(L),(q,z)=>{j(z(q,{get data(){return c()},get form(){return t.form},get params(){return t.page.params}}),B=>a()[1]=B,()=>a()?.[1])}),P(O,x)},$$slots:{default:!0}}),O=>a()[0]=O,()=>a()?.[0])}),P(i,E)},f=i=>{const p=I(()=>t.constructors[0]);var E=V(),R=y(E);k(R,()=>d(p),(h,g)=>{j(g(h,{get data(){return m()},get form(){return t.form},get params(){return t.page.params}}),O=>a()[0]=O,()=>a()?.[0])}),P(i,E)};w(_,i=>{t.constructors[1]?i(l):i(f,!1)})}var u=X(_,2);{var v=i=>{var p=ut(),E=$(p);{var R=h=>{var g=at();et(()=>it(g,d(s))),P(h,g)};w(E,h=>{d(e)&&h(R)})}tt(p),P(i,p)};w(u,i=>{d(o)&&i(v)})}P(n,A),Z()}const Ot=nt(dt),Lt=[()=>r(()=>import("../nodes/0.JalwDZMc.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url),()=>r(()=>import("../nodes/1.DfUf2A_9.js"),__vite__mapDeps([17,1,2,3,7,8,6,9]),import.meta.url),()=>r(()=>import("../nodes/2.DwM7F70n.js"),__vite__mapDeps([18,1,2,3,4,12,5,6,14,19,20,21,22,23,15,24]),import.meta.url),()=>r(()=>import("../nodes/3.BzLzrOWy.js"),__vite__mapDeps([25,1,2,3,4,12,5,6,20,21,26,27,28,29,30,31,32,19,14,15,24,33,34,35,36]),import.meta.url),()=>r(()=>import("../nodes/4.4T8ji-4a.js"),__vite__mapDeps([37,1,2,3,4,5,6,20,21,26,27,28,29,19,14,15,24,30,12,31,32,33,36,23]),import.meta.url),()=>r(()=>import("../nodes/5.D-IgI9y1.js"),__vite__mapDeps([38,1,2,3,4,5,6,26,12,20,21,22,24,19,14,39,40,15,28,32,30,31,29,41,42,33,34,35,36]),import.meta.url),()=>r(()=>import("../nodes/6.DzEKB4QD.js"),__vite__mapDeps([43,1,2,3,4,5,6,13,9,8,39,12,20,21,24,22,40,44,28,32,19,14,30,31,29,41,42,34,35,45,46,36,15,47,48]),import.meta.url),()=>r(()=>import("../nodes/7.DLPvTRtH.js"),__vite__mapDeps([49,1,2,3,4,5,6,20,21,9,8,10,15,24]),import.meta.url),()=>r(()=>import("../nodes/8.CQSV4FuF.js"),__vite__mapDeps([50,1,2,3,4,5,6,40,22,26,51,12,42,21,52,14,15,30,31,20,29,32,28,24,41,34,35,36]),import.meta.url),()=>r(()=>import("../nodes/9.DOPDjgGY.js"),__vite__mapDeps([53,1,2,3,4,12,5,6,42,13,9,8,40,22,51,21,52,14,35,28,24,32]),import.meta.url),()=>r(()=>import("../nodes/10.4V8r82tY.js"),__vite__mapDeps([54,1,2,3,4,5,6,20,21,9,8,10,24]),import.meta.url),()=>r(()=>import("../nodes/11.hAL_Iuyo.js"),__vite__mapDeps([55,1,2,3,4,12,5,6,20,21,8,26,30,31,29,32,28,22,15,24,40,41,42,36,56,14]),import.meta.url),()=>r(()=>import("../nodes/12.Csus4sgy.js"),__vite__mapDeps([57,1,2,3,4,12,5,6,20,21,13,9,8,15,24,56,40,22,32]),import.meta.url),()=>r(()=>import("../nodes/13.hS6EkA-z.js"),__vite__mapDeps([58,1,2,3,4,5,6,12,20,21,22,27,28,24,19,14,39,40,26,15,32,30,31,29,41,42,33,34,35,36]),import.meta.url),()=>r(()=>import("../nodes/14.BjI1asMm.js"),__vite__mapDeps([59,1,2,3,4,5,6,13,9,8,39,12,20,21,24,22,40,44,28,32,19,14,30,31,29,41,42,34,35,45,46,36,60,15,47,48]),import.meta.url),()=>r(()=>import("../nodes/15.D2oFYgN3.js"),__vite__mapDeps([61,1,2,3,4,5,6,26,47,12,20,21,22,24,48,14,19,62,40,30,31,29,32,28,15,41,42,33,34,35,36,63]),import.meta.url),()=>r(()=>import("../nodes/16.CnTD7yhj.js"),__vite__mapDeps([64,1,2,3,4,12,5,6,7,8,9,62,20,21,22,48,24,19,14,40,46,30,31,29,32,28,41,42,34,35,36,45,15,65]),import.meta.url),()=>r(()=>import("../nodes/17.LPpjfVrH.js"),__vite__mapDeps([66,1,2,3,4,5,6,12,20,21,22,24,27,28,19,14,39,40,26,15,30,31,29,32,41,42,33,34,35,36]),import.meta.url),()=>r(()=>import("../nodes/18.DZSsQ4kC.js"),__vite__mapDeps([67,1,2,3,4,5,6,13,9,8,39,12,20,21,24,22,40,44,28,32,19,14,30,31,29,41,42,34,35,45,46,36,60,15,47,48]),import.meta.url),()=>r(()=>import("../nodes/19.DCbbcuA3.js"),__vite__mapDeps([68,1,2,3,4,5,6,26,12,20,21,22,48,24,14,19,69,40,30,31,29,32,28,15,41,42,33,34,35,36,63]),import.meta.url),()=>r(()=>import("../nodes/20.D8JTfsn9.js"),__vite__mapDeps([70,1,2,3,4,5,6,7,8,9,69,12,20,21,22,24,48,19,14,40,46,30,31,29,32,28,41,42,34,35,36,45,15,65]),import.meta.url),()=>r(()=>import("../nodes/21.D25eFoe0.js"),__vite__mapDeps([71,1,2,3,4,9,8,6,5,26,29,30,12,31,20,32,28,15,24,40,22,41,42,36,72,19,14]),import.meta.url),()=>r(()=>import("../nodes/22.laAA6k8S.js"),__vite__mapDeps([73,1,2,3,4,5,6,20,21,7,8,9,29,15,24,32,45,74,42,11,22,40,72,28,14]),import.meta.url),()=>r(()=>import("../nodes/23.D4QqDH8N.js"),__vite__mapDeps([75,1,2,3,4,5,6,20,42,21,9,8,7,15,24,45,74,11,22]),import.meta.url),()=>r(()=>import("../nodes/24.BLkBUd5n.js"),__vite__mapDeps([76,1,2,3,4,5,6,26,30,12,31,20,29,32,28,24]),import.meta.url)],At=[],yt={"/":[2],"/credentials":[3],"/endpoints":[4],"/enterprises":[5],"/enterprises/[id]":[6],"/init":[7],"/instances":[8],"/instances/[id]":[9],"/login":[10],"/objects":[11],"/objects/[id]":[12],"/organizations":[13],"/organizations/[id]":[14],"/pools":[15],"/pools/[id]":[16],"/repositories":[17],"/repositories/[id]":[18],"/scalesets":[19],"/scalesets/[id]":[20],"/templates":[21],"/templates/create":[23],"/templates/[id]":[22],"/users":[24]},M={handleError:({error:n})=>{console.error(n)},reroute:()=>{},transport:{}},ft=Object.fromEntries(Object.entries(M.transport).map(([n,t])=>[n,t.decode])),Dt=Object.fromEntries(Object.entries(M.transport).map(([n,t])=>[n,t.encode])),Tt=!1,It=(n,t)=>ft[n](t);export{It as decode,ft as decoders,yt as dictionary,Dt as encoders,Tt as hash,M as hooks,Rt as matchers,Lt as nodes,Ot as root,At as server_loads}; diff --git a/webapp/assets/_app/immutable/entry/app.CxzbqMLz.js b/webapp/assets/_app/immutable/entry/app.CxzbqMLz.js new file mode 100644 index 00000000..b1b4410d --- /dev/null +++ b/webapp/assets/_app/immutable/entry/app.CxzbqMLz.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.B_YQfsM9.js","../chunks/ZGz3X54u.js","../chunks/kDtaAWAK.js","../chunks/CY7Wcm-1.js","../chunks/Cun6jNAp.js","../chunks/CYK-UalN.js","../chunks/DWgB-t1g.js","../chunks/Bql5nQdO.js","../chunks/DR0xnkWv.js","../chunks/C8dZhfFx.js","../chunks/OrLoP7JZ.js","../chunks/C8nIl9By.js","../chunks/DdT9Vz5Q.js","../chunks/DXEzcvud.js","../chunks/KU08Mex1.js","../chunks/Vo3Mv3dp.js","../chunks/BVGCMSWJ.js","../assets/0.Xtu_mOgF.css","../nodes/1.BkJ9sG2d.js","../nodes/2.CyNGYHEu.js","../chunks/CYnNqrHp.js","../chunks/CdEA5IGF.js","../chunks/CVBpH3Sf.js","../chunks/ONKDshdz.js","../chunks/BZiHL9L3.js","../nodes/3.Ylobjoa9.js","../chunks/DacI6VAP.js","../chunks/CovvT05J.js","../chunks/ZelbukuJ.js","../chunks/DUWZCTMr.js","../chunks/BKeluGSY.js","../chunks/Imj5EgK1.js","../chunks/DbE0zTOa.js","../chunks/oWoYyEl8.js","../chunks/BStwtkX8.js","../chunks/ow_oMtSd.js","../chunks/rb89c4PS.js","../nodes/4.BEiTKBiZ.js","../nodes/5.g7cRDIWD.js","../chunks/6aKjRj0k.js","../chunks/Dxx83T0m.js","../chunks/Dd4NFVf9.js","../chunks/DochbgGJ.js","../nodes/6.C_k9lHXG.js","../chunks/DQfnVUrv.js","../chunks/BrlhCerN.js","../chunks/B9RC0dq5.js","../chunks/xMqsWuAL.js","../chunks/C6-Yv_jr.js","../nodes/7.C88HESSe.js","../nodes/8.DnJntumo.js","../chunks/DC7O3Apj.js","../assets/ShellTerminal.Bno-wGqG.css","../nodes/9.DS05dI_2.js","../nodes/10.Dy2Me2Kb.js","../nodes/11.CrioD3y5.js","../chunks/aK-A9Gop.js","../nodes/12.B-iY07X5.js","../nodes/13.R0etGrgT.js","../nodes/14.5u0NL8hV.js","../chunks/C681KorI.js","../nodes/15.BA3p6CkM.js","../chunks/Bmm5UxxZ.js","../chunks/CiCSB29J.js","../nodes/16.NNUit-Zw.js","../chunks/DZ2a7TNP.js","../nodes/17.D-lQvPgz.js","../nodes/18.DvnMNUxr.js","../nodes/19.B50u3Qn5.js","../chunks/DAg7Eq1U.js","../nodes/20.DITIOxJB.js","../nodes/21.v2GZiIwr.js","../chunks/C98nByjP.js","../nodes/22.SjbkZ9mL.js","../chunks/B-QyJt36.js","../nodes/23.CJXOkL1d.js","../nodes/24.DG4EX-2D.js"])))=>i.map(i=>d[i]); +import{d as D,aB as G,g as d,aD as U,an as F,m as W,p as Y,ad as H,ae as J,o as K,aE as T,aF as Q,f as y,s as X,a as Z,c as $,r as tt,aG as I,t as et}from"../chunks/kDtaAWAK.js";import{d as rt,m as ot,u as st,f as C,a as P,c as V,t as at,s as it}from"../chunks/ZGz3X54u.js";import{p as b,i as w}from"../chunks/Cun6jNAp.js";import{c as k}from"../chunks/Imj5EgK1.js";import{b as j}from"../chunks/DochbgGJ.js";function nt(n){return class extends _t{constructor(t){super({component:n,...t})}}}class _t{#e;#t;constructor(t){var a=new Map,m=(o,e)=>{var s=W(e,!1,!1);return a.set(o,s),s};const c=new Proxy({...t.props||{},$$events:{}},{get(o,e){return d(a.get(e)??m(e,Reflect.get(o,e)))},has(o,e){return e===G?!0:(d(a.get(e)??m(e,Reflect.get(o,e))),Reflect.has(o,e))},set(o,e,s){return D(a.get(e)??m(e,s),s),Reflect.set(o,e,s)}});this.#t=(t.hydrate?rt:ot)(t.component,{target:t.target,anchor:t.anchor,props:c,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&U(),this.#e=c.$$events;for(const o of Object.keys(this.#t))o==="$set"||o==="$destroy"||o==="$on"||F(this,o,{get(){return this.#t[o]},set(e){this.#t[o]=e},enumerable:!0});this.#t.$set=o=>{Object.assign(c,o)},this.#t.$destroy=()=>{st(this.#t)}}$set(t){this.#t.$set(t)}$on(t,a){this.#e[t]=this.#e[t]||[];const m=(...c)=>a.call(this,...c);return this.#e[t].push(m),()=>{this.#e[t]=this.#e[t].filter(c=>c!==m)}}$destroy(){this.#t.$destroy()}}const mt="modulepreload",ct=function(n,t){return new URL(n,t).href},S={},r=function(t,a,m){let c=Promise.resolve();if(a&&a.length>0){let A=function(_){return Promise.all(_.map(l=>Promise.resolve(l).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const e=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),L=s?.nonce||s?.getAttribute("nonce");c=A(a.map(_=>{if(_=ct(_,m),_ in S)return;S[_]=!0;const l=_.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(m)for(let v=e.length-1;v>=0;v--){const i=e[v];if(i.href===_&&(!l||i.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${_}"]${f}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":mt,l||(u.as="script"),u.crossOrigin="",u.href=_,L&&u.setAttribute("nonce",L),document.head.appendChild(u),l)return new Promise((v,i)=>{u.addEventListener("load",v),u.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${_}`)))})}))}function o(e){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=e,window.dispatchEvent(s),!s.defaultPrevented)throw e}return c.then(e=>{for(const s of e||[])s.status==="rejected"&&o(s.reason);return t().catch(o)})},Rt={};var ut=C('
'),lt=C(" ",1);function dt(n,t){Y(t,!0);let a=b(t,"components",23,()=>[]),m=b(t,"data_0",3,null),c=b(t,"data_1",3,null);H(()=>t.stores.page.set(t.page)),J(()=>{t.stores,t.page,t.constructors,a(),t.form,m(),c(),t.stores.page.notify()});let o=T(!1),e=T(!1),s=T(null);K(()=>{const i=t.stores.page.subscribe(()=>{d(o)&&(D(e,!0),Q().then(()=>{D(s,document.title||"untitled page",!0)}))});return D(o,!0),i});const L=I(()=>t.constructors[1]);var A=lt(),_=y(A);{var l=i=>{const p=I(()=>t.constructors[0]);var E=V(),R=y(E);k(R,()=>d(p),(h,g)=>{j(g(h,{get data(){return m()},get form(){return t.form},get params(){return t.page.params},children:(O,vt)=>{var x=V(),N=y(x);k(N,()=>d(L),(q,z)=>{j(z(q,{get data(){return c()},get form(){return t.form},get params(){return t.page.params}}),B=>a()[1]=B,()=>a()?.[1])}),P(O,x)},$$slots:{default:!0}}),O=>a()[0]=O,()=>a()?.[0])}),P(i,E)},f=i=>{const p=I(()=>t.constructors[0]);var E=V(),R=y(E);k(R,()=>d(p),(h,g)=>{j(g(h,{get data(){return m()},get form(){return t.form},get params(){return t.page.params}}),O=>a()[0]=O,()=>a()?.[0])}),P(i,E)};w(_,i=>{t.constructors[1]?i(l):i(f,!1)})}var u=X(_,2);{var v=i=>{var p=ut(),E=$(p);{var R=h=>{var g=at();et(()=>it(g,d(s))),P(h,g)};w(E,h=>{d(e)&&h(R)})}tt(p),P(i,p)};w(u,i=>{d(o)&&i(v)})}P(n,A),Z()}const Ot=nt(dt),Lt=[()=>r(()=>import("../nodes/0.B_YQfsM9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url),()=>r(()=>import("../nodes/1.BkJ9sG2d.js"),__vite__mapDeps([18,1,2,3,7,8,6,9]),import.meta.url),()=>r(()=>import("../nodes/2.CyNGYHEu.js"),__vite__mapDeps([19,1,2,3,4,12,5,6,14,15,20,21,22,23,16,24]),import.meta.url),()=>r(()=>import("../nodes/3.Ylobjoa9.js"),__vite__mapDeps([25,1,2,3,4,12,5,6,20,21,26,27,28,29,30,31,32,15,14,16,24,33,34,35,36]),import.meta.url),()=>r(()=>import("../nodes/4.BEiTKBiZ.js"),__vite__mapDeps([37,1,2,3,4,5,6,20,21,26,27,28,29,15,14,16,24,30,12,31,32,33,36,23]),import.meta.url),()=>r(()=>import("../nodes/5.g7cRDIWD.js"),__vite__mapDeps([38,1,2,3,4,5,6,26,12,20,21,22,24,15,14,39,40,16,28,32,30,31,29,41,42,33,34,35,36]),import.meta.url),()=>r(()=>import("../nodes/6.C_k9lHXG.js"),__vite__mapDeps([43,1,2,3,4,5,6,13,9,8,39,12,20,21,24,22,40,44,28,32,15,14,30,31,29,41,42,34,35,45,46,36,16,47,48]),import.meta.url),()=>r(()=>import("../nodes/7.C88HESSe.js"),__vite__mapDeps([49,1,2,3,4,5,6,20,21,9,8,10,16,24]),import.meta.url),()=>r(()=>import("../nodes/8.DnJntumo.js"),__vite__mapDeps([50,1,2,3,4,5,6,40,22,26,51,12,42,21,52,14,16,30,31,20,29,32,28,24,41,34,35,36]),import.meta.url),()=>r(()=>import("../nodes/9.DS05dI_2.js"),__vite__mapDeps([53,1,2,3,4,12,5,6,42,13,9,8,40,22,51,21,52,14,35,28,24,32]),import.meta.url),()=>r(()=>import("../nodes/10.Dy2Me2Kb.js"),__vite__mapDeps([54,1,2,3,4,5,6,20,21,9,8,10,24]),import.meta.url),()=>r(()=>import("../nodes/11.CrioD3y5.js"),__vite__mapDeps([55,1,2,3,4,12,5,6,20,21,8,26,30,31,29,32,28,22,16,24,40,41,42,36,56,14]),import.meta.url),()=>r(()=>import("../nodes/12.B-iY07X5.js"),__vite__mapDeps([57,1,2,3,4,12,5,6,20,21,13,9,8,16,24,56,40,22,32]),import.meta.url),()=>r(()=>import("../nodes/13.R0etGrgT.js"),__vite__mapDeps([58,1,2,3,4,5,6,12,20,21,22,27,28,24,15,14,39,40,26,16,32,30,31,29,41,42,33,34,35,36]),import.meta.url),()=>r(()=>import("../nodes/14.5u0NL8hV.js"),__vite__mapDeps([59,1,2,3,4,5,6,13,9,8,39,12,20,21,24,22,40,44,28,32,15,14,30,31,29,41,42,34,35,45,46,36,60,16,47,48]),import.meta.url),()=>r(()=>import("../nodes/15.BA3p6CkM.js"),__vite__mapDeps([61,1,2,3,4,5,6,26,47,12,20,21,22,24,48,14,15,62,40,30,31,29,32,28,16,41,42,33,34,35,36,63]),import.meta.url),()=>r(()=>import("../nodes/16.NNUit-Zw.js"),__vite__mapDeps([64,1,2,3,4,12,5,6,7,8,9,62,20,21,22,48,24,15,14,40,46,30,31,29,32,28,41,42,34,35,36,45,16,65]),import.meta.url),()=>r(()=>import("../nodes/17.D-lQvPgz.js"),__vite__mapDeps([66,1,2,3,4,5,6,12,20,21,22,24,27,28,15,14,39,40,26,16,30,31,29,32,41,42,33,34,35,36]),import.meta.url),()=>r(()=>import("../nodes/18.DvnMNUxr.js"),__vite__mapDeps([67,1,2,3,4,5,6,13,9,8,39,12,20,21,24,22,40,44,28,32,15,14,30,31,29,41,42,34,35,45,46,36,60,16,47,48]),import.meta.url),()=>r(()=>import("../nodes/19.B50u3Qn5.js"),__vite__mapDeps([68,1,2,3,4,5,6,26,12,20,21,22,48,24,14,15,69,40,30,31,29,32,28,16,41,42,33,34,35,36,63]),import.meta.url),()=>r(()=>import("../nodes/20.DITIOxJB.js"),__vite__mapDeps([70,1,2,3,4,5,6,7,8,9,69,12,20,21,22,24,48,15,14,40,46,30,31,29,32,28,41,42,34,35,36,45,16,65]),import.meta.url),()=>r(()=>import("../nodes/21.v2GZiIwr.js"),__vite__mapDeps([71,1,2,3,4,9,8,6,5,26,29,30,12,31,20,32,28,16,24,40,22,41,42,36,72,15,14]),import.meta.url),()=>r(()=>import("../nodes/22.SjbkZ9mL.js"),__vite__mapDeps([73,1,2,3,4,5,6,20,21,7,8,9,29,16,24,32,45,74,42,11,22,40,72,28,14]),import.meta.url),()=>r(()=>import("../nodes/23.CJXOkL1d.js"),__vite__mapDeps([75,1,2,3,4,5,6,20,42,21,9,8,7,16,24,45,74,11,22]),import.meta.url),()=>r(()=>import("../nodes/24.DG4EX-2D.js"),__vite__mapDeps([76,1,2,3,4,5,6,26,30,12,31,20,29,32,28,24]),import.meta.url)],At=[],yt={"/":[2],"/credentials":[3],"/endpoints":[4],"/enterprises":[5],"/enterprises/[id]":[6],"/init":[7],"/instances":[8],"/instances/[id]":[9],"/login":[10],"/objects":[11],"/objects/[id]":[12],"/organizations":[13],"/organizations/[id]":[14],"/pools":[15],"/pools/[id]":[16],"/repositories":[17],"/repositories/[id]":[18],"/scalesets":[19],"/scalesets/[id]":[20],"/templates":[21],"/templates/create":[23],"/templates/[id]":[22],"/users":[24]},M={handleError:({error:n})=>{console.error(n)},reroute:()=>{},transport:{}},ft=Object.fromEntries(Object.entries(M.transport).map(([n,t])=>[n,t.decode])),Dt=Object.fromEntries(Object.entries(M.transport).map(([n,t])=>[n,t.encode])),Tt=!1,It=(n,t)=>ft[n](t);export{It as decode,ft as decoders,yt as dictionary,Dt as encoders,Tt as hash,M as hooks,Rt as matchers,Lt as nodes,Ot as root,At as server_loads}; diff --git a/webapp/assets/_app/immutable/entry/start.0dEn5882.js b/webapp/assets/_app/immutable/entry/start.0dEn5882.js deleted file mode 100644 index bd6fbf59..00000000 --- a/webapp/assets/_app/immutable/entry/start.0dEn5882.js +++ /dev/null @@ -1 +0,0 @@ -import{a as r}from"../chunks/BU_V7FOQ.js";import{w as t}from"../chunks/8ZO9Ka4R.js";export{t as load_css,r as start}; diff --git a/webapp/assets/_app/immutable/entry/start.C0YH1vK2.js b/webapp/assets/_app/immutable/entry/start.C0YH1vK2.js new file mode 100644 index 00000000..aaf08595 --- /dev/null +++ b/webapp/assets/_app/immutable/entry/start.C0YH1vK2.js @@ -0,0 +1 @@ +import{a as r}from"../chunks/C8dZhfFx.js";import{w as t}from"../chunks/DR0xnkWv.js";export{t as load_css,r as start}; diff --git a/webapp/assets/_app/immutable/nodes/0.B_YQfsM9.js b/webapp/assets/_app/immutable/nodes/0.B_YQfsM9.js new file mode 100644 index 00000000..64444723 --- /dev/null +++ b/webapp/assets/_app/immutable/nodes/0.B_YQfsM9.js @@ -0,0 +1,13 @@ +import{f as u,s as oe,a as s,c as Q,b as se,e as I,h as br,t as We}from"../chunks/ZGz3X54u.js";import{i as De}from"../chunks/CY7Wcm-1.js";import{p as Ue,o as Ze,l as L,d as f,m as B,b as Ne,f as G,c as o,s as l,r as a,g as e,u as i,t as A,h as we,a as Qe,i as kr,$ as yr}from"../chunks/kDtaAWAK.js";import{a as ke,i as x,s as qe}from"../chunks/Cun6jNAp.js";import{d,c as _,s as X,h as _r,B as wr,f as Xe}from"../chunks/CYK-UalN.js";import{p as ze}from"../chunks/Bql5nQdO.js";import{g as Ee}from"../chunks/C8dZhfFx.js";import{b as er,a as Mr}from"../chunks/OrLoP7JZ.js";import{t as je}from"../chunks/C8nIl9By.js";import{e as ge,i as be}from"../chunks/DdT9Vz5Q.js";import{p as zr}from"../chunks/DXEzcvud.js";import{w as jr}from"../chunks/KU08Mex1.js";import{e as Cr}from"../chunks/Vo3Mv3dp.js";import{t as Ye}from"../chunks/BVGCMSWJ.js";const Sr=async({url:ie})=>({url:ie.pathname}),$r=!1,Hr=!1,za=Object.freeze(Object.defineProperty({__proto__:null,load:Sr,prerender:$r,ssr:Hr},Symbol.toStringTag,{value:"Module"}));var Ar=u('
Live Updates
'),Lr=u('
Connecting
'),Br=u('
Updates Unavailable
'),Rr=u('
Manual Refresh
'),Vr=se(''),Ir=se(''),Gr=se(''),Pr=se(''),Tr=u(' '),Or=u(' '),Er=u('
GARM
'),Dr=u('
'),Ur=u('
'),Nr=u('
'),Qr=u('
'),qr=se(''),Fr=se(''),Jr=se(''),Kr=se(''),Wr=u(' '),Xr=u(' '),Yr=u('
GARM
'),Zr=u('
'),ea=u('
'),ra=u('
GARM GARM

GARM

',1);function aa(ie,ne){Ue(ne,!1);const[Y,ye]=qe(),c=()=>ke(jr,"$websocketStore",Y),le=()=>ke(je,"$themeStore",Y),he=()=>ke(Cr,"$eagerCache",Y),P=()=>ke(zr,"$page",Y),m=B(),z=B(),R=B(),h=B();let n=B(!1),T=B(!1);Ze(()=>{window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",ue)});function ue(t){(!localStorage.getItem("theme")||localStorage.getItem("theme")==="system")&&je.set(t.matches)}function Z(){je.toggle()}function w(){er.logout(),f(T,!1)}const j=[{href:d("/"),label:"Dashboard",icon:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"},{href:d("/repositories"),label:"Repositories",icon:"M7 16V4m0 0a2 2 0 100-4 2 2 0 000 4zm0 0a2 2 0 100 4 2 2 0 000-4zm10 12a2 2 0 100-4 2 2 0 000 4zm0 0V9a5 5 0 00-5-5"},{href:d("/organizations"),label:"Organizations",icon:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"},{href:d("/users"),label:"Users",icon:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"},{href:d("/enterprises"),label:"Enterprises",icon:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"},{href:d("/pools"),label:"Pools",icon:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"},{href:d("/scalesets"),label:"Scale Sets",icon:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"},{href:d("/instances"),label:"Runners",icon:"M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"}],q=[{href:d("/credentials"),label:"Credentials",icon:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},{href:d("/endpoints"),label:"Endpoints",icon:"M13 10V3L4 14h7v7l9-11h-7z"},{href:d("/templates"),label:"Runner Install Templates",icon:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"},{href:d("/objects"),label:"Object Storage",icon:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"}];L(()=>c(),()=>{f(m,c())}),L(()=>le(),()=>{f(z,le())}),L(()=>he(),()=>{f(R,he().controllerInfo?.version||"")}),L(()=>P(),()=>{P().url.pathname&&f(n,!1)}),L(()=>P(),()=>{f(h,P().url.pathname)}),Ne(),De();var fe=ra(),de=G(fe),O=o(de),V=o(O),F=o(V),C=o(F),E=o(C),N=l(E,2);a(C),a(F);var D=l(F,2),ve=o(D),ee=o(ve),re=o(ee);{var ae=t=>{var r=Ar();s(t,r)},me=t=>{var r=Q(),v=G(r);{var k=p=>{var M=Lr();s(p,M)},S=p=>{var M=Q(),te=G(M);{var $=b=>{var U=Br();s(b,U)},H=b=>{var U=Rr();s(b,U)};x(te,b=>{e(m),i(()=>e(m).error)?b($):b(H,!1)},!0)}s(p,M)};x(v,p=>{e(m),i(()=>e(m).connecting)?p(k):p(S,!1)},!0)}s(t,r)};x(re,t=>{e(m),i(()=>e(m).connected)?t(ae):t(me,!1)})}a(ee);var ce=l(ee,2),Ce=o(ce);{var Se=t=>{var r=Vr();s(t,r)},$e=t=>{var r=Ir();s(t,r)};x(Ce,t=>{e(z)?t(Se):t($e,!1)})}a(ce),a(ve),a(D),a(V);var J=l(V,2),xe=o(J);ge(xe,1,()=>j,be,(t,r)=>{var v=Tr(),k=o(v),S=o(k);{var p=$=>{var H=Q(),b=G(H);ge(b,1,()=>(e(r),i(()=>e(r).icon)),be,(U,Pe)=>{var Me=Gr();A(()=>_(Me,"d",e(Pe))),s(U,Me)}),s($,H)},M=$=>{var H=Pr();A(()=>_(H,"d",(e(r),i(()=>e(r).icon)))),s($,H)};x(S,$=>{e(r),i(()=>Array.isArray(e(r).icon))?$(p):$(M,!1)})}a(k);var te=l(k);a(v),A(()=>{_(v,"href",(e(r),i(()=>e(r).href))),X(v,1,`group flex items-center px-2 py-2 text-sm font-medium rounded-md transition-colors duration-200 + ${e(h),e(r),i(()=>e(h)===e(r).href?"bg-gray-100 text-gray-900 dark:bg-gray-700 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),oe(te,` ${e(r),i(()=>e(r).label)??""}`)}),s(t,v)});var He=l(xe,2);ge(He,5,()=>q,be,(t,r)=>{var v=Or(),k=o(v),S=o(k);a(k);var p=l(k);a(v),A(()=>{_(v,"href",(e(r),i(()=>e(r).href))),X(v,1,`group flex items-center px-2 py-2 text-sm font-medium rounded-md transition-colors duration-200 + ${e(h),e(r),i(()=>e(h)===e(r).href?"bg-gray-100 text-gray-900 dark:bg-gray-700 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),_(S,"d",(e(r),i(()=>e(r).icon))),oe(p,` ${e(r),i(()=>e(r).label)??""}`)}),s(t,v)}),a(He);var Ae=l(He,2),rr=o(Ae);a(Ae);var ar=l(Ae,2);{var tr=t=>{var r=Er(),v=o(r),k=l(o(v));a(v),a(r),A(()=>oe(k,` ${e(R)??""}`)),s(t,r)};x(ar,t=>{e(R)&&t(tr)})}a(J),a(O),a(de);var Le=l(de,2),Be=o(Le),Fe=o(Be),Re=l(Fe,2),Ve=o(Re),Ie=l(Ve,2),Je=l(Ie,4),or=o(Je);{var sr=t=>{var r=Dr();s(t,r)},ir=t=>{var r=Q(),v=G(r);{var k=p=>{var M=Ur();s(p,M)},S=p=>{var M=Q(),te=G(M);{var $=b=>{var U=Nr();s(b,U)},H=b=>{var U=Qr();s(b,U)};x(te,b=>{e(m),i(()=>e(m).error)?b($):b(H,!1)},!0)}s(p,M)};x(v,p=>{e(m),i(()=>e(m).connecting)?p(k):p(S,!1)},!0)}s(t,r)};x(or,t=>{e(m),i(()=>e(m).connected)?t(sr):t(ir,!1)})}a(Je),a(Re);var Ge=l(Re,2),nr=o(Ge);{var lr=t=>{var r=qr();s(t,r)},dr=t=>{var r=Fr();s(t,r)};x(nr,t=>{e(z)?t(lr):t(dr,!1)})}a(Ge),a(Be);var vr=l(Be,2);{var cr=t=>{var r=Zr(),v=o(r),k=l(v,2),S=o(k),p=o(S);a(S);var M=l(S,2),te=o(M),$=o(te);ge($,1,()=>j,be,(K,g)=>{var y=Wr(),W=o(y),Te=o(W);{var Oe=pe=>{var _e=Q(),mr=G(_e);ge(mr,1,()=>(e(g),i(()=>e(g).icon)),be,(xr,pr)=>{var Ke=Jr();A(()=>_(Ke,"d",e(pr))),s(xr,Ke)}),s(pe,_e)},ur=pe=>{var _e=Kr();A(()=>_(_e,"d",(e(g),i(()=>e(g).icon)))),s(pe,_e)};x(Te,pe=>{e(g),i(()=>Array.isArray(e(g).icon))?pe(Oe):pe(ur,!1)})}a(W);var fr=l(W);a(y),A(()=>{_(y,"href",(e(g),i(()=>e(g).href))),X(y,1,`group flex items-center px-2 py-2 text-base font-medium rounded-md transition-colors duration-200 + ${e(h),e(g),i(()=>e(h)===e(g).href?"bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),oe(fr,` ${e(g),i(()=>e(g).label)??""}`)}),I("click",y,()=>f(n,!1)),s(K,y)});var H=l($,2);ge(H,5,()=>q,be,(K,g)=>{var y=Xr(),W=o(y),Te=o(W);a(W);var Oe=l(W);a(y),A(()=>{_(y,"href",(e(g),i(()=>e(g).href))),X(y,1,`group flex items-center px-2 py-2 text-base font-medium rounded-md transition-colors duration-200 + ${e(h),e(g),i(()=>e(h)===e(g).href?"bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),_(Te,"d",(e(g),i(()=>e(g).icon))),oe(Oe,` ${e(g),i(()=>e(g).label)??""}`)}),I("click",y,()=>f(n,!1)),s(K,y)}),a(H);var b=l(H,2),U=o(b);a(b);var Pe=l(b,2);{var Me=K=>{var g=Yr(),y=o(g),W=l(o(y));a(y),a(g),A(()=>oe(W,` ${e(R)??""}`)),s(K,g)};x(Pe,K=>{e(R)&&K(Me)})}a(te),a(M),a(k),a(r),I("click",v,()=>f(n,!1)),I("keydown",v,K=>{K.key==="Escape"&&f(n,!1)}),I("click",p,()=>f(n,!1)),I("click",U,w),s(t,r)};x(vr,t=>{e(n)&&t(cr)})}a(Le);var gr=l(Le,2);{var hr=t=>{var r=ea();I("click",r,()=>f(T,!1)),I("keydown",r,v=>{v.key==="Escape"&&f(T,!1)}),s(t,r)};x(gr,t=>{e(T)&&t(hr)})}A((t,r,v,k,S)=>{_(C,"href",t),_(E,"src",r),_(N,"src",v),_(ce,"title",e(z)?"Switch to Light Mode":"Switch to Dark Mode"),_(Ve,"src",k),X(Ve,1,`${e(z)?"hidden":"block"} h-8 w-8`),_(Ie,"src",S),X(Ie,1,`${e(z)?"block":"hidden"} h-8 w-8`)},[()=>(we(d),i(()=>d("/"))),()=>(we(d),i(()=>d("/assets/garm-light.svg"))),()=>(we(d),i(()=>d("/assets/garm-dark.svg"))),()=>(we(d),i(()=>d("/assets/garm-light.svg"))),()=>(we(d),i(()=>d("/assets/garm-dark.svg")))]),I("click",ce,Z),I("click",rr,w),I("click",Fe,()=>f(n,!e(n))),I("click",Ge,Z),s(ie,fe),Qe(),ye()}var ta=u("
"),oa=u('

'),sa=u('
');function ia(ie,ne){Ue(ne,!1);const[Y,ye]=qe(),c=()=>ke(Ye,"$toastStore",Y),le=B();function he(h){switch(h){case"success":return` + + `;case"error":return` + + `;case"warning":return` + + `;case"info":default:return` + + `}}function P(h){switch(h){case"success":return"bg-green-50 dark:bg-green-900 border-green-200 dark:border-green-700";case"error":return"bg-red-50 dark:bg-red-900 border-red-200 dark:border-red-700";case"warning":return"bg-yellow-50 dark:bg-yellow-900 border-yellow-200 dark:border-yellow-700";case"info":default:return"bg-blue-50 dark:bg-blue-900 border-blue-200 dark:border-blue-700"}}function m(h){switch(h){case"success":return"text-green-800 dark:text-green-200";case"error":return"text-red-800 dark:text-red-200";case"warning":return"text-yellow-800 dark:text-yellow-200";case"info":default:return"text-blue-800 dark:text-blue-200"}}function z(h){switch(h){case"success":return"text-green-700 dark:text-green-300";case"error":return"text-red-700 dark:text-red-300";case"warning":return"text-yellow-700 dark:text-yellow-300";case"info":default:return"text-blue-700 dark:text-blue-300"}}L(()=>c(),()=>{f(le,c())}),Ne(),De();var R=sa();ge(R,5,()=>e(le),h=>h.id,(h,n)=>{var T=oa(),ue=o(T),Z=o(ue),w=o(Z);_r(w,()=>(e(n),i(()=>he(e(n).type)))),a(Z);var j=l(Z,2),q=o(j),fe=o(q,!0);a(q);var de=l(q,2);{var O=C=>{var E=ta(),N=o(E,!0);a(E),A(D=>{X(E,1,`mt-1 text-sm ${D??""}`),oe(N,(e(n),i(()=>e(n).message)))},[()=>(e(n),i(()=>z(e(n).type)))]),s(C,E)};x(de,C=>{e(n),i(()=>e(n).message)&&C(O)})}a(j);var V=l(j,2),F=o(V);{let C=kr(()=>(e(n),i(()=>e(n).type==="success"?"text-green-400 hover:text-green-500 focus:ring-green-500":e(n).type==="error"?"text-red-400 hover:text-red-500 focus:ring-red-500":e(n).type==="warning"?"text-yellow-400 hover:text-yellow-500 focus:ring-yellow-500":"text-blue-400 hover:text-blue-500 focus:ring-blue-500")));wr(F,{variant:"ghost",size:"sm","aria-label":"Dismiss notification",icon:"",get class(){return e(C)},$$events:{click:()=>Ye.remove(e(n).id)}})}a(V),a(ue),a(T),A((C,E)=>{X(T,1,`relative rounded-lg border p-4 shadow-lg transition-all duration-300 ease-in-out ${C??""}`),X(q,1,`text-sm font-medium ${E??""}`),oe(fe,(e(n),i(()=>e(n).title)))},[()=>(e(n),i(()=>P(e(n).type))),()=>(e(n),i(()=>m(e(n).type)))]),s(h,T)}),a(R),s(ie,R),Qe(),ye()}var na=u('

Loading...

'),la=u('
'),da=u('

'),va=u(" ",1);function ja(ie,ne){Ue(ne,!1);const[Y,ye]=qe(),c=()=>ke(Mr,"$authStore",Y),le=B(),he=B(),P=B(),m=B(),z=B(),R=B();Ze(()=>{er.init(),je.init()}),L(()=>(c(),Ee),()=>{if(!c().loading){const w=ze.url.pathname===d("/login"),j=ze.url.pathname===d("/init");!w&&!j&&!c().isAuthenticated&&(c().needsInitialization?Ee(d("/init"),{replaceState:!0}):Ee(d("/login"),{replaceState:!0}))}}),L(()=>d,()=>{f(le,ze.url.pathname===d("/login"))}),L(()=>d,()=>{f(he,ze.url.pathname===d("/init"))}),L(()=>c(),()=>{f(P,c().needsInitialization&&!c().isAuthenticated&&!c().loading)}),L(()=>c(),()=>{f(m,!c().needsInitialization&&!c().isAuthenticated&&!c().loading)}),L(()=>c(),()=>{f(z,c().isAuthenticated&&!c().loading)}),L(()=>(e(P),e(m),e(z)),()=>{f(R,!e(P)&&!e(m)&&!e(z))}),Ne(),De();var h=va();br(w=>{yr.title="GARM - GitHub Actions Runner Manager"});var n=G(h);{var T=w=>{var j=na();s(w,j)},ue=w=>{var j=Q(),q=G(j);{var fe=O=>{var V=Q(),F=G(V);Xe(F,ne,"default",{}),s(O,V)},de=O=>{var V=Q(),F=G(V);{var C=N=>{var D=la(),ve=o(D);aa(ve,{});var ee=l(ve,2),re=o(ee),ae=o(re),me=o(ae);Xe(me,ne,"default",{}),a(ae),a(re),a(ee),a(D),s(N,D)},E=N=>{var D=Q(),ve=G(D);{var ee=re=>{var ae=da(),me=o(ae),ce=l(o(me),2),Ce=o(ce);{var Se=J=>{var xe=We("Redirecting to initialization...");s(J,xe)},$e=J=>{var xe=We("Redirecting to login...");s(J,xe)};x(Ce,J=>{c(),i(()=>c().needsInitialization)?J(Se):J($e,!1)})}a(ce),a(me),a(ae),s(re,ae)};x(ve,re=>{e(R)&&re(ee)},!0)}s(N,D)};x(F,N=>{e(z)?N(C):N(E,!1)},!0)}s(O,V)};x(q,O=>{e(m)||e(P)?O(fe):O(de,!1)},!0)}s(w,j)};x(n,w=>{c(),i(()=>c().loading)?w(T):w(ue,!1)})}var Z=l(n,2);ia(Z,{}),s(ie,h),Qe(),ye()}export{ja as component,za as universal}; diff --git a/webapp/assets/_app/immutable/nodes/0.JalwDZMc.js b/webapp/assets/_app/immutable/nodes/0.JalwDZMc.js deleted file mode 100644 index 68f82a84..00000000 --- a/webapp/assets/_app/immutable/nodes/0.JalwDZMc.js +++ /dev/null @@ -1,13 +0,0 @@ -import{f as h,s as pe,a as s,c as F,b as re,e as R,h as hr,t as qe}from"../chunks/ZGz3X54u.js";import{i as Te}from"../chunks/CY7Wcm-1.js";import{p as Ge,o as Ke,l as I,d as f,m as T,b as Oe,f as P,c as o,s as l,r as a,g as e,u as i,t as N,h as ye,a as Ee,i as ur,$ as fr}from"../chunks/kDtaAWAK.js";import{a as _e,i as b,s as De}from"../chunks/Cun6jNAp.js";import{d as n,c as w,s as K,h as mr,B as xr,f as Fe}from"../chunks/Cvcp5xHB.js";import{p as je}from"../chunks/DH5setay.js";import{g as Pe}from"../chunks/BU_V7FOQ.js";import{b as We,a as pr}from"../chunks/CkcEJ1BA.js";import{t as Se}from"../chunks/C8nIl9By.js";import{e as ve,i as xe}from"../chunks/DdT9Vz5Q.js";import{p as br}from"../chunks/D3FdGlax.js";import{w as kr}from"../chunks/KU08Mex1.js";import{t as Je}from"../chunks/BVGCMSWJ.js";const yr=async({url:ae})=>({url:ae.pathname}),_r=!1,wr=!1,fa=Object.freeze(Object.defineProperty({__proto__:null,load:yr,prerender:_r,ssr:wr},Symbol.toStringTag,{value:"Module"}));var Mr=h('
Live Updates
'),zr=h('
Connecting
'),jr=h('
Updates Unavailable
'),Sr=h('
Manual Refresh
'),Cr=re(''),Hr=re(''),Lr=re(''),$r=re(''),Ar=h(' '),Br=h(' '),Vr=h('
'),Rr=h('
'),Ir=h('
'),Pr=h('
'),Tr=re(''),Gr=re(''),Or=re(''),Er=re(''),Dr=h(' '),Ur=h(' '),Nr=h('
'),Qr=h('
'),qr=h('
GARM GARM

GARM

',1);function Fr(ae,te){Ge(te,!1);const[oe,be]=De(),d=()=>_e(kr,"$websocketStore",oe),se=()=>_e(Se,"$themeStore",oe),W=()=>_e(br,"$page",oe),u=T(),j=T(),k=T();let y=T(!1),m=T(!1);Ke(()=>{window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",v)});function v(t){(!localStorage.getItem("theme")||localStorage.getItem("theme")==="system")&&Se.set(t.matches)}function J(){Se.toggle()}function ie(){We.logout(),f(m,!1)}const X=[{href:n("/"),label:"Dashboard",icon:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"},{href:n("/repositories"),label:"Repositories",icon:"M7 16V4m0 0a2 2 0 100-4 2 2 0 000 4zm0 0a2 2 0 100 4 2 2 0 000-4zm10 12a2 2 0 100-4 2 2 0 000 4zm0 0V9a5 5 0 00-5-5"},{href:n("/organizations"),label:"Organizations",icon:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"},{href:n("/users"),label:"Users",icon:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"},{href:n("/enterprises"),label:"Enterprises",icon:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"},{href:n("/pools"),label:"Pools",icon:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"},{href:n("/scalesets"),label:"Scale Sets",icon:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"},{href:n("/instances"),label:"Runners",icon:"M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"}],M=[{href:n("/credentials"),label:"Credentials",icon:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},{href:n("/endpoints"),label:"Endpoints",icon:"M13 10V3L4 14h7v7l9-11h-7z"},{href:n("/templates"),label:"Runner Install Templates",icon:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"},{href:n("/objects"),label:"Object Storage",icon:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"}];I(()=>d(),()=>{f(u,d())}),I(()=>se(),()=>{f(j,se())}),I(()=>W(),()=>{W().url.pathname&&f(y,!1)}),I(()=>W(),()=>{f(k,W().url.pathname)}),Oe(),Te();var S=qr(),Q=P(S),ce=o(Q),ne=o(ce),A=o(ne),B=o(A),Y=o(B),G=l(Y,2);a(B),a(A);var O=l(A,2),E=o(O),V=o(E),ge=o(V);{var he=t=>{var r=Mr();s(t,r)},Z=t=>{var r=F(),g=P(r);{var _=x=>{var z=zr();s(x,z)},C=x=>{var z=F(),ee=P(z);{var H=p=>{var U=jr();s(p,U)},L=p=>{var U=Sr();s(p,U)};b(ee,p=>{e(u),i(()=>e(u).error)?p(H):p(L,!1)},!0)}s(x,z)};b(g,x=>{e(u),i(()=>e(u).connecting)?x(_):x(C,!1)},!0)}s(t,r)};b(ge,t=>{e(u),i(()=>e(u).connected)?t(he):t(Z,!1)})}a(V);var D=l(V,2),ue=o(D);{var we=t=>{var r=Cr();s(t,r)},Ce=t=>{var r=Hr();s(t,r)};b(ue,t=>{e(j)?t(we):t(Ce,!1)})}a(D),a(E),a(O),a(ne);var Me=l(ne,2),ze=o(Me);ve(ze,1,()=>X,xe,(t,r)=>{var g=Ar(),_=o(g),C=o(_);{var x=H=>{var L=F(),p=P(L);ve(p,1,()=>(e(r),i(()=>e(r).icon)),xe,(U,le)=>{var c=Lr();N(()=>w(c,"d",e(le))),s(U,c)}),s(H,L)},z=H=>{var L=$r();N(()=>w(L,"d",(e(r),i(()=>e(r).icon)))),s(H,L)};b(C,H=>{e(r),i(()=>Array.isArray(e(r).icon))?H(x):H(z,!1)})}a(_);var ee=l(_);a(g),N(()=>{w(g,"href",(e(r),i(()=>e(r).href))),K(g,1,`group flex items-center px-2 py-2 text-sm font-medium rounded-md transition-colors duration-200 - ${e(k),e(r),i(()=>e(k)===e(r).href?"bg-gray-100 text-gray-900 dark:bg-gray-700 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),pe(ee,` ${e(r),i(()=>e(r).label)??""}`)}),s(t,g)});var q=l(ze,2);ve(q,5,()=>M,xe,(t,r)=>{var g=Br(),_=o(g),C=o(_);a(_);var x=l(_);a(g),N(()=>{w(g,"href",(e(r),i(()=>e(r).href))),K(g,1,`group flex items-center px-2 py-2 text-sm font-medium rounded-md transition-colors duration-200 - ${e(k),e(r),i(()=>e(k)===e(r).href?"bg-gray-100 text-gray-900 dark:bg-gray-700 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),w(C,"d",(e(r),i(()=>e(r).icon))),pe(x,` ${e(r),i(()=>e(r).label)??""}`)}),s(t,g)}),a(q);var fe=l(q,2),Xe=o(fe);a(fe),a(Me),a(ce),a(Q);var He=l(Q,2),Le=o(He),Ue=o(Le),$e=l(Ue,2),Ae=o($e),Be=l(Ae,2),Ne=l(Be,4),Ye=o(Ne);{var Ze=t=>{var r=Vr();s(t,r)},er=t=>{var r=F(),g=P(r);{var _=x=>{var z=Rr();s(x,z)},C=x=>{var z=F(),ee=P(z);{var H=p=>{var U=Ir();s(p,U)},L=p=>{var U=Pr();s(p,U)};b(ee,p=>{e(u),i(()=>e(u).error)?p(H):p(L,!1)},!0)}s(x,z)};b(g,x=>{e(u),i(()=>e(u).connecting)?x(_):x(C,!1)},!0)}s(t,r)};b(Ye,t=>{e(u),i(()=>e(u).connected)?t(Ze):t(er,!1)})}a(Ne),a($e);var Ve=l($e,2),rr=o(Ve);{var ar=t=>{var r=Tr();s(t,r)},tr=t=>{var r=Gr();s(t,r)};b(rr,t=>{e(j)?t(ar):t(tr,!1)})}a(Ve),a(Le);var or=l(Le,2);{var sr=t=>{var r=Nr(),g=o(r),_=l(g,2),C=o(_),x=o(C);a(C);var z=l(C,2),ee=o(z),H=o(ee);ve(H,1,()=>X,xe,(le,c)=>{var $=Dr(),de=o($),Re=o(de);{var Ie=me=>{var ke=F(),vr=P(ke);ve(vr,1,()=>(e(c),i(()=>e(c).icon)),xe,(cr,gr)=>{var Qe=Or();N(()=>w(Qe,"d",e(gr))),s(cr,Qe)}),s(me,ke)},lr=me=>{var ke=Er();N(()=>w(ke,"d",(e(c),i(()=>e(c).icon)))),s(me,ke)};b(Re,me=>{e(c),i(()=>Array.isArray(e(c).icon))?me(Ie):me(lr,!1)})}a(de);var dr=l(de);a($),N(()=>{w($,"href",(e(c),i(()=>e(c).href))),K($,1,`group flex items-center px-2 py-2 text-base font-medium rounded-md transition-colors duration-200 - ${e(k),e(c),i(()=>e(k)===e(c).href?"bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),pe(dr,` ${e(c),i(()=>e(c).label)??""}`)}),R("click",$,()=>f(y,!1)),s(le,$)});var L=l(H,2);ve(L,5,()=>M,xe,(le,c)=>{var $=Ur(),de=o($),Re=o(de);a(de);var Ie=l(de);a($),N(()=>{w($,"href",(e(c),i(()=>e(c).href))),K($,1,`group flex items-center px-2 py-2 text-base font-medium rounded-md transition-colors duration-200 - ${e(k),e(c),i(()=>e(k)===e(c).href?"bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),w(Re,"d",(e(c),i(()=>e(c).icon))),pe(Ie,` ${e(c),i(()=>e(c).label)??""}`)}),R("click",$,()=>f(y,!1)),s(le,$)}),a(L);var p=l(L,2),U=o(p);a(p),a(ee),a(z),a(_),a(r),R("click",g,()=>f(y,!1)),R("keydown",g,le=>{le.key==="Escape"&&f(y,!1)}),R("click",x,()=>f(y,!1)),R("click",U,ie),s(t,r)};b(or,t=>{e(y)&&t(sr)})}a(He);var ir=l(He,2);{var nr=t=>{var r=Qr();R("click",r,()=>f(m,!1)),R("keydown",r,g=>{g.key==="Escape"&&f(m,!1)}),s(t,r)};b(ir,t=>{e(m)&&t(nr)})}N((t,r,g,_,C)=>{w(B,"href",t),w(Y,"src",r),w(G,"src",g),w(D,"title",e(j)?"Switch to Light Mode":"Switch to Dark Mode"),w(Ae,"src",_),K(Ae,1,`${e(j)?"hidden":"block"} h-8 w-8`),w(Be,"src",C),K(Be,1,`${e(j)?"block":"hidden"} h-8 w-8`)},[()=>(ye(n),i(()=>n("/"))),()=>(ye(n),i(()=>n("/assets/garm-light.svg"))),()=>(ye(n),i(()=>n("/assets/garm-dark.svg"))),()=>(ye(n),i(()=>n("/assets/garm-light.svg"))),()=>(ye(n),i(()=>n("/assets/garm-dark.svg")))]),R("click",D,J),R("click",Xe,ie),R("click",Ue,()=>f(y,!e(y))),R("click",Ve,J),s(ae,S),Ee(),be()}var Jr=h("
"),Kr=h('

'),Wr=h('
');function Xr(ae,te){Ge(te,!1);const[oe,be]=De(),d=()=>_e(Je,"$toastStore",oe),se=T();function W(m){switch(m){case"success":return` - - `;case"error":return` - - `;case"warning":return` - - `;case"info":default:return` - - `}}function u(m){switch(m){case"success":return"bg-green-50 dark:bg-green-900 border-green-200 dark:border-green-700";case"error":return"bg-red-50 dark:bg-red-900 border-red-200 dark:border-red-700";case"warning":return"bg-yellow-50 dark:bg-yellow-900 border-yellow-200 dark:border-yellow-700";case"info":default:return"bg-blue-50 dark:bg-blue-900 border-blue-200 dark:border-blue-700"}}function j(m){switch(m){case"success":return"text-green-800 dark:text-green-200";case"error":return"text-red-800 dark:text-red-200";case"warning":return"text-yellow-800 dark:text-yellow-200";case"info":default:return"text-blue-800 dark:text-blue-200"}}function k(m){switch(m){case"success":return"text-green-700 dark:text-green-300";case"error":return"text-red-700 dark:text-red-300";case"warning":return"text-yellow-700 dark:text-yellow-300";case"info":default:return"text-blue-700 dark:text-blue-300"}}I(()=>d(),()=>{f(se,d())}),Oe(),Te();var y=Wr();ve(y,5,()=>e(se),m=>m.id,(m,v)=>{var J=Kr(),ie=o(J),X=o(ie),M=o(X);mr(M,()=>(e(v),i(()=>W(e(v).type)))),a(X);var S=l(X,2),Q=o(S),ce=o(Q,!0);a(Q);var ne=l(Q,2);{var A=G=>{var O=Jr(),E=o(O,!0);a(O),N(V=>{K(O,1,`mt-1 text-sm ${V??""}`),pe(E,(e(v),i(()=>e(v).message)))},[()=>(e(v),i(()=>k(e(v).type)))]),s(G,O)};b(ne,G=>{e(v),i(()=>e(v).message)&&G(A)})}a(S);var B=l(S,2),Y=o(B);{let G=ur(()=>(e(v),i(()=>e(v).type==="success"?"text-green-400 hover:text-green-500 focus:ring-green-500":e(v).type==="error"?"text-red-400 hover:text-red-500 focus:ring-red-500":e(v).type==="warning"?"text-yellow-400 hover:text-yellow-500 focus:ring-yellow-500":"text-blue-400 hover:text-blue-500 focus:ring-blue-500")));xr(Y,{variant:"ghost",size:"sm","aria-label":"Dismiss notification",icon:"",get class(){return e(G)},$$events:{click:()=>Je.remove(e(v).id)}})}a(B),a(ie),a(J),N((G,O)=>{K(J,1,`relative rounded-lg border p-4 shadow-lg transition-all duration-300 ease-in-out ${G??""}`),K(Q,1,`text-sm font-medium ${O??""}`),pe(ce,(e(v),i(()=>e(v).title)))},[()=>(e(v),i(()=>u(e(v).type))),()=>(e(v),i(()=>j(e(v).type)))]),s(m,J)}),a(y),s(ae,y),Ee(),be()}var Yr=h('

Loading...

'),Zr=h('
'),ea=h('

'),ra=h(" ",1);function ma(ae,te){Ge(te,!1);const[oe,be]=De(),d=()=>_e(pr,"$authStore",oe),se=T(),W=T(),u=T(),j=T(),k=T(),y=T();Ke(()=>{We.init(),Se.init()}),I(()=>(d(),Pe),()=>{if(!d().loading){const M=je.url.pathname===n("/login"),S=je.url.pathname===n("/init");!M&&!S&&!d().isAuthenticated&&(d().needsInitialization?Pe(n("/init"),{replaceState:!0}):Pe(n("/login"),{replaceState:!0}))}}),I(()=>n,()=>{f(se,je.url.pathname===n("/login"))}),I(()=>n,()=>{f(W,je.url.pathname===n("/init"))}),I(()=>d(),()=>{f(u,d().needsInitialization&&!d().isAuthenticated&&!d().loading)}),I(()=>d(),()=>{f(j,!d().needsInitialization&&!d().isAuthenticated&&!d().loading)}),I(()=>d(),()=>{f(k,d().isAuthenticated&&!d().loading)}),I(()=>(e(u),e(j),e(k)),()=>{f(y,!e(u)&&!e(j)&&!e(k))}),Oe(),Te();var m=ra();hr(M=>{fr.title="GARM - GitHub Actions Runner Manager"});var v=P(m);{var J=M=>{var S=Yr();s(M,S)},ie=M=>{var S=F(),Q=P(S);{var ce=A=>{var B=F(),Y=P(B);Fe(Y,te,"default",{}),s(A,B)},ne=A=>{var B=F(),Y=P(B);{var G=E=>{var V=Zr(),ge=o(V);Fr(ge,{});var he=l(ge,2),Z=o(he),D=o(Z),ue=o(D);Fe(ue,te,"default",{}),a(D),a(Z),a(he),a(V),s(E,V)},O=E=>{var V=F(),ge=P(V);{var he=Z=>{var D=ea(),ue=o(D),we=l(o(ue),2),Ce=o(we);{var Me=q=>{var fe=qe("Redirecting to initialization...");s(q,fe)},ze=q=>{var fe=qe("Redirecting to login...");s(q,fe)};b(Ce,q=>{d(),i(()=>d().needsInitialization)?q(Me):q(ze,!1)})}a(we),a(ue),a(D),s(Z,D)};b(ge,Z=>{e(y)&&Z(he)},!0)}s(E,V)};b(Y,E=>{e(k)?E(G):E(O,!1)},!0)}s(A,B)};b(Q,A=>{e(j)||e(u)?A(ce):A(ne,!1)},!0)}s(M,S)};b(v,M=>{d(),i(()=>d().loading)?M(J):M(ie,!1)})}var X=l(v,2);Xr(X,{}),s(ae,m),Ee(),be()}export{ma as component,fa as universal}; diff --git a/webapp/assets/_app/immutable/nodes/1.DfUf2A_9.js b/webapp/assets/_app/immutable/nodes/1.BkJ9sG2d.js similarity index 84% rename from webapp/assets/_app/immutable/nodes/1.DfUf2A_9.js rename to webapp/assets/_app/immutable/nodes/1.BkJ9sG2d.js index 009b3a9e..aea89392 100644 --- a/webapp/assets/_app/immutable/nodes/1.DfUf2A_9.js +++ b/webapp/assets/_app/immutable/nodes/1.BkJ9sG2d.js @@ -1 +1 @@ -import{f as h,a as c,s}from"../chunks/ZGz3X54u.js";import{i as l}from"../chunks/CY7Wcm-1.js";import{p as v,f as u,t as _,a as g,c as e,r as o,s as x}from"../chunks/kDtaAWAK.js";import{p}from"../chunks/DH5setay.js";var d=h("

",1);function q(m,f){v(f,!1),l();var a=d(),r=u(a),i=e(r,!0);o(r);var t=x(r,2),n=e(t,!0);o(t),_(()=>{s(i,p.status),s(n,p.error?.message)}),c(m,a),g()}export{q as component}; +import{f as h,a as c,s}from"../chunks/ZGz3X54u.js";import{i as l}from"../chunks/CY7Wcm-1.js";import{p as v,f as u,t as _,a as g,c as e,r as o,s as x}from"../chunks/kDtaAWAK.js";import{p}from"../chunks/Bql5nQdO.js";var d=h("

",1);function q(m,f){v(f,!1),l();var a=d(),r=u(a),i=e(r,!0);o(r);var t=x(r,2),n=e(t,!0);o(t),_(()=>{s(i,p.status),s(n,p.error?.message)}),c(m,a),g()}export{q as component}; diff --git a/webapp/assets/_app/immutable/nodes/10.4V8r82tY.js b/webapp/assets/_app/immutable/nodes/10.Dy2Me2Kb.js similarity index 96% rename from webapp/assets/_app/immutable/nodes/10.4V8r82tY.js rename to webapp/assets/_app/immutable/nodes/10.Dy2Me2Kb.js index 7c5df024..63ac652d 100644 --- a/webapp/assets/_app/immutable/nodes/10.4V8r82tY.js +++ b/webapp/assets/_app/immutable/nodes/10.Dy2Me2Kb.js @@ -1 +1 @@ -import{f as L,h as oe,e as b,a as y,t as le,s as j}from"../chunks/ZGz3X54u.js";import{i as ne}from"../chunks/CY7Wcm-1.js";import{p as ce,o as ue,l as ve,b as me,t as S,g as r,a as ge,$ as fe,s as d,m as c,c as t,u as B,h as U,d as i,r as s,n as q}from"../chunks/kDtaAWAK.js";import{i as H,s as pe,a as he}from"../chunks/Cun6jNAp.js";import{B as be,d as n,c as T,g as K,r as V}from"../chunks/Cvcp5xHB.js";import{b as W}from"../chunks/CYnNqrHp.js";import{p as ye}from"../chunks/CdEA5IGF.js";import{g as F}from"../chunks/BU_V7FOQ.js";import{a as xe,b as ke}from"../chunks/CkcEJ1BA.js";import{e as we}from"../chunks/BZiHL9L3.js";var _e=L('

'),$e=L('
Or continue with
'),Se=L('
GARM

Sign in to GARM

GitHub Actions Runner Manager

');function Ge(J,N){ce(N,!1);const[Q,X]=pe(),M=()=>he(xe,"$authStore",Q);let v=c(""),m=c(""),l=c(!1),u=c(""),x=c(!1),z=c(!0);ue(async()=>{ee(),await Y()});async function Y(){try{const e=await K.getOIDCStatus();i(x,e.enabled)}catch{i(x,!1)}finally{i(z,!1)}}function Z(){window.location.href=K.getOIDCLoginUrl()}function ee(){const e=localStorage.getItem("theme");let a=!1;e==="dark"?a=!0:e==="light"?a=!1:a=window.matchMedia("(prefers-color-scheme: dark)").matches,a?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}async function A(){if(!r(v)||!r(m)){i(u,"Please enter both username and password");return}i(l,!0),i(u,"");try{await ke.login(r(v),r(m)),F(n("/"))}catch(e){i(u,we(e))}finally{i(l,!1)}}function C(e){e.key==="Enter"&&A()}ve(()=>(M(),n),()=>{M().isAuthenticated&&F(n("/"))}),me(),ne();var k=Se();oe(e=>{fe.title="Login - GARM"});var D=t(k),w=t(D),I=t(w),O=t(I),ae=d(O,2);s(I),q(4),s(w);var g=d(w,2),_=t(g),$=t(_),f=d(t($),2);V(f),s($);var P=d($,2),p=d(t(P),2);V(p),s(P),s(_);var E=d(_,2);{var re=e=>{var a=_e(),o=t(a),h=d(t(o),2),R=t(h),ie=t(R,!0);s(R),s(h),s(o),s(a),S(()=>j(ie,r(u))),y(e,a)};H(E,e=>{r(u)&&e(re)})}var G=d(E,2),te=t(G);be(te,{type:"submit",variant:"primary",size:"md",fullWidth:!0,get disabled(){return r(l)},get loading(){return r(l)},children:(e,a)=>{q();var o=le();S(()=>j(o,r(l)?"Signing in...":"Sign in")),y(e,o)},$$slots:{default:!0}}),s(G),s(g);var se=d(g,2);{var de=e=>{var a=$e(),o=d(t(a),2),h=t(o);s(o),s(a),b("click",h,Z),y(e,a)};H(se,e=>{!r(z)&&r(x)&&e(de)})}s(D),s(k),S((e,a)=>{T(O,"src",e),T(ae,"src",a),f.disabled=r(l),p.disabled=r(l)},[()=>(U(n),B(()=>n("/assets/garm-light.svg"))),()=>(U(n),B(()=>n("/assets/garm-dark.svg")))]),W(f,()=>r(v),e=>i(v,e)),b("keypress",f,C),W(p,()=>r(m),e=>i(m,e)),b("keypress",p,C),b("submit",g,ye(A)),y(J,k),ge(),X()}export{Ge as component}; +import{f as L,h as oe,e as b,a as y,t as le,s as j}from"../chunks/ZGz3X54u.js";import{i as ne}from"../chunks/CY7Wcm-1.js";import{p as ce,o as ue,l as ve,b as me,t as S,g as r,a as ge,$ as fe,s as d,m as c,c as t,u as B,h as U,d as i,r as s,n as q}from"../chunks/kDtaAWAK.js";import{i as H,s as pe,a as he}from"../chunks/Cun6jNAp.js";import{B as be,d as n,c as T,g as K,r as V}from"../chunks/CYK-UalN.js";import{b as W}from"../chunks/CYnNqrHp.js";import{p as ye}from"../chunks/CdEA5IGF.js";import{g as F}from"../chunks/C8dZhfFx.js";import{a as xe,b as ke}from"../chunks/OrLoP7JZ.js";import{e as we}from"../chunks/BZiHL9L3.js";var _e=L('

'),$e=L('
Or continue with
'),Se=L('
GARM

Sign in to GARM

GitHub Actions Runner Manager

');function Ge(J,N){ce(N,!1);const[Q,X]=pe(),M=()=>he(xe,"$authStore",Q);let v=c(""),m=c(""),l=c(!1),u=c(""),x=c(!1),z=c(!0);ue(async()=>{ee(),await Y()});async function Y(){try{const e=await K.getOIDCStatus();i(x,e.enabled)}catch{i(x,!1)}finally{i(z,!1)}}function Z(){window.location.href=K.getOIDCLoginUrl()}function ee(){const e=localStorage.getItem("theme");let a=!1;e==="dark"?a=!0:e==="light"?a=!1:a=window.matchMedia("(prefers-color-scheme: dark)").matches,a?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}async function A(){if(!r(v)||!r(m)){i(u,"Please enter both username and password");return}i(l,!0),i(u,"");try{await ke.login(r(v),r(m)),F(n("/"))}catch(e){i(u,we(e))}finally{i(l,!1)}}function C(e){e.key==="Enter"&&A()}ve(()=>(M(),n),()=>{M().isAuthenticated&&F(n("/"))}),me(),ne();var k=Se();oe(e=>{fe.title="Login - GARM"});var D=t(k),w=t(D),I=t(w),O=t(I),ae=d(O,2);s(I),q(4),s(w);var g=d(w,2),_=t(g),$=t(_),f=d(t($),2);V(f),s($);var P=d($,2),p=d(t(P),2);V(p),s(P),s(_);var E=d(_,2);{var re=e=>{var a=_e(),o=t(a),h=d(t(o),2),R=t(h),ie=t(R,!0);s(R),s(h),s(o),s(a),S(()=>j(ie,r(u))),y(e,a)};H(E,e=>{r(u)&&e(re)})}var G=d(E,2),te=t(G);be(te,{type:"submit",variant:"primary",size:"md",fullWidth:!0,get disabled(){return r(l)},get loading(){return r(l)},children:(e,a)=>{q();var o=le();S(()=>j(o,r(l)?"Signing in...":"Sign in")),y(e,o)},$$slots:{default:!0}}),s(G),s(g);var se=d(g,2);{var de=e=>{var a=$e(),o=d(t(a),2),h=t(o);s(o),s(a),b("click",h,Z),y(e,a)};H(se,e=>{!r(z)&&r(x)&&e(de)})}s(D),s(k),S((e,a)=>{T(O,"src",e),T(ae,"src",a),f.disabled=r(l),p.disabled=r(l)},[()=>(U(n),B(()=>n("/assets/garm-light.svg"))),()=>(U(n),B(()=>n("/assets/garm-dark.svg")))]),W(f,()=>r(v),e=>i(v,e)),b("keypress",f,C),W(p,()=>r(m),e=>i(m,e)),b("keypress",p,C),b("submit",g,ye(A)),y(J,k),ge(),X()}export{Ge as component}; diff --git a/webapp/assets/_app/immutable/nodes/11.hAL_Iuyo.js b/webapp/assets/_app/immutable/nodes/11.CrioD3y5.js similarity index 98% rename from webapp/assets/_app/immutable/nodes/11.hAL_Iuyo.js rename to webapp/assets/_app/immutable/nodes/11.CrioD3y5.js index 08b1b113..96de6f62 100644 --- a/webapp/assets/_app/immutable/nodes/11.hAL_Iuyo.js +++ b/webapp/assets/_app/immutable/nodes/11.CrioD3y5.js @@ -1,4 +1,4 @@ -import{f as S,a as f,s as j,e as U,t as ie,b as bt,r as ct}from"../chunks/ZGz3X54u.js";import{i as tt}from"../chunks/CY7Wcm-1.js";import{p as at,o as ht,q as xt,l as le,h as O,g as e,m as p,b as yt,f as _t,a as rt,s,d as r,u as pt,c as l,r as i,t as z,v as Ut,i as qe,n as Y,k as At,j as K}from"../chunks/kDtaAWAK.js";import{p as me,i as ne}from"../chunks/Cun6jNAp.js";import{e as Ye,i as We}from"../chunks/DdT9Vz5Q.js";import{e as wt,B as W,b as It,g as Ve,s as Lt,r as Xe,c as Ke}from"../chunks/Cvcp5xHB.js";import{b as Pe}from"../chunks/CYnNqrHp.js";import{p as ut}from"../chunks/CdEA5IGF.js";import"../chunks/8ZO9Ka4R.js";import"../chunks/CkTG2UXI.js";import{P as Bt}from"../chunks/CLZesvzF.js";import{D as Ft,G as gt}from"../chunks/Cfdue6T6.js";import{M as mt}from"../chunks/C6jYEeWP.js";import{t as te}from"../chunks/BVGCMSWJ.js";import{e as Ue}from"../chunks/BZiHL9L3.js";import{D as Rt}from"../chunks/lQWw1Z23.js";import{E as Nt}from"../chunks/CEJvqnOn.js";import{A as Ht}from"../chunks/Cs0pYghy.js";import{b as Gt}from"../chunks/DochbgGJ.js";import{f as ft,a as vt}from"../chunks/aK-A9Gop.js";import{w as qt}from"../chunks/KU08Mex1.js";var Vt=S('-'),Xt=S(' '),Kt=S(' '),Yt=S('
'),Wt=S(' '),Zt=S('
All tags:
'),Jt=S(" ",1);function Qt(je,A){at(A,!1);const m=p(),I=p(),R=p();let T=me(A,"item",8);const d=3;let x=p(null),D=p(!1),E=p(0),w=p(0),ae=p(!1);function b(){if(e(x)){const v=e(x).getBoundingClientRect();r(E,v.left),window.innerHeight-v.bottom<150?(r(ae,!0),r(w,v.top)):(r(ae,!1),r(w,v.bottom+4))}}function re(){r(D,!0),b()}function Z(){r(D,!1)}ht(()=>{window.addEventListener("scroll",b,!0),window.addEventListener("resize",b)}),xt(()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}),le(()=>O(T()),()=>{r(m,T()?.tags||[])}),le(()=>e(m),()=>{r(I,e(m).slice(0,d))}),le(()=>e(m),()=>{r(R,Math.max(0,e(m).length-d))}),yt(),tt();var fe=Jt(),N=_t(fe);{var H=v=>{var o=Vt();f(v,o)},V=v=>{var o=Yt(),$=l(o);Ye($,1,()=>e(I),We,(P,C)=>{var G=Xt(),L=l(G,!0);i(G),z(()=>j(L,e(C))),f(P,G)});var h=s($,2);{var u=P=>{var C=Kt(),G=l(C);i(C),z(()=>j(G,`+${e(R)??""} more`)),f(P,C)};ne(h,P=>{e(R)>0&&P(u)})}i(o),Gt(o,P=>r(x,P),()=>e(x)),U("mouseenter",o,function(...P){(e(m).length>d?re:void 0)?.apply(this,P)}),U("mouseleave",o,function(...P){(e(m).length>d?Z:void 0)?.apply(this,P)}),f(v,o)};ne(N,v=>{e(m),pt(()=>!e(m)||e(m).length===0)?v(H):v(V,!1)})}var k=s(N,2);{var J=v=>{var o=Zt(),$=l(o),h=s(l($),2);Ye(h,5,()=>e(m),We,(u,P)=>{var C=Wt(),G=l(C,!0);i(C),z(()=>j(G,e(P))),f(u,C)}),i(h),i($),i(o),z(()=>wt(o,`left: ${e(E)??""}px; top: ${e(w)??""}px; transform: translateY(${e(ae)?"-100%":"0"});`)),f(v,o)};ne(k,v=>{e(m),e(D),pt(()=>e(m).length>d&&e(D))&&v(J)})}f(je,fe),rt()}var ea=bt(''),ta=bt(''),aa=S('
');function ra(je,A){at(A,!1);const m=p(),I=p(),R=p(),T=p();let d=me(A,"currentPage",8,1),x=me(A,"totalPages",8,1),D=me(A,"totalItems",8,0),E=me(A,"pageSize",12,25),w=me(A,"loading",8,!1),ae=me(A,"itemName",8,"items");const b=Ut();function re(){e(I)&&!w()&&(b("pageChange",{page:d()-1}),d()-2>0&&b("prefetch",{page:d()-2}))}function Z(){e(m)&&!w()&&(b("pageChange",{page:d()+1}),d()+2<=x()&&b("prefetch",{page:d()+2}))}function fe(M){const B=M.target,se=parseInt(B.value);b("pageSizeChange",{pageSize:se})}le(()=>(O(d()),O(x())),()=>{r(m,d()O(d()),()=>{r(I,d()>1)}),le(()=>(O(D()),O(d()),O(E())),()=>{r(R,D()===0?0:(d()-1)*E()+1)}),le(()=>(O(d()),O(E()),O(D())),()=>{r(T,Math.min(d()*E(),D()))}),le(()=>(O(d()),O(x()),O(w())),()=>{d()!e(I)||w());W(V,{variant:"secondary",size:"sm",get disabled(){return e(M)},$$events:{click:re},children:(B,se)=>{Y();var X=ie("Previous");f(B,X)},$$slots:{default:!0}})}var k=s(V,2);{let M=qe(()=>!e(m)||w());W(k,{variant:"secondary",size:"sm",get disabled(){return e(M)},$$events:{click:Z},children:(B,se)=>{Y();var X=ie("Next");f(B,X)},$$slots:{default:!0}})}i(H);var J=s(H,2),v=l(J),o=l(v),$=s(l(o)),h=l($,!0);i($);var u=s($,2),P=l(u,!0);i(u);var C=s(u,2),G=l(C,!0);i(C);var L=s(C);i(o);var Ae=s(o,2),de=s(l(Ae),2);z(()=>{E(),At(()=>{w()})});var Ce=l(de);Ce.value=Ce.__value=10;var ve=s(Ce);ve.value=ve.__value=25;var be=s(ve);be.value=be.__value=50;var Ie=s(be);Ie.value=Ie.__value=100,i(de),i(Ae),i(v);var Le=s(v,2),Be=l(Le);{let M=qe(()=>!e(I)||w());W(Be,{variant:"secondary",size:"sm",get disabled(){return e(M)},$$events:{click:re},children:(B,se)=>{var X=ea();f(B,X)},$$slots:{default:!0}})}var Me=s(Be,2),Se=s(l(Me)),Ze=l(Se,!0);i(Se);var Fe=s(Se,2),Je=l(Fe,!0);i(Fe),i(Me);var ce=s(Me,2);{let M=qe(()=>!e(m)||w());W(ce,{variant:"secondary",size:"sm",get disabled(){return e(M)},$$events:{click:Z},children:(B,se)=>{var X=ta();f(B,X)},$$slots:{default:!0}})}i(Le),i(J),i(N),z(()=>{j(h,e(R)),j(P,e(T)),j(G,D()),j(L,` ${ae()??""}`),de.disabled=w(),j(Ze,d()),j(Je,x())}),It(de,E),U("change",de,fe),f(je,N),rt()}var sa=S('
'),oa=S(' '),ia=S('
Uploading...
'),la=S('

Upload New Object

Press Space or Enter to add a tag. Press Backspace to remove the last tag.

'),na=S(' '),da=S('

Update Object

Press Space or Enter to add a tag. Press Backspace to remove the last tag.

'),ca=S(`
`,1);function Ea(je,A){at(A,!1);let m=p([]),I=p(!0),R=p(""),T=p(""),d=p(1),x=p(25),D=p(1),E=p(0),w=1;const ae="garm_objects_page_size";let b=new Map;const re=300*1e3;let Z=null;const fe=500;let N=p(!1),H=p(!1),V=p(!1),k=p(null),J=p(!1),v=null,o=p({name:"",file:null,tags:[],description:""}),$=p(0),h=p(!1),u=p({name:"",tags:[],description:""});function P(t){if(t.operation==="create")L();else if(t.operation==="update"){const a=t.payload;r(m,e(m).map(n=>n.id===a.id?a:n))}else if(t.operation==="delete"){const a=t.payload.id||t.payload;r(m,e(m).filter(n=>n.id!==a)),r(E,Math.max(0,e(E)-1))}}ht(async()=>{const t=localStorage.getItem(ae);if(t){const a=parseInt(t,10);!isNaN(a)&&a>0&&r(x,a)}await L(),v=qt.subscribeToEntity("file_object",["create","update","delete"],P)}),xt(()=>{v&&(v(),v=null)});function C(t,a,n=e(x)){return`${t}-${a||"all"}-${n}`}function G(){const t=Date.now();for(const[a,n]of b.entries())t-n.timestamp>re&&b.delete(a)}async function L(t=!1){try{r(I,!t),r(R,"");const a=e(T).trim()?e(T).trim().replace(/\s+/g,","):void 0,n=C(e(d),a);if(t){const g=b.get(n);if(g&&Date.now()-g.timestampe(D))return;const a=e(T).trim()?e(T).trim().replace(/\s+/g,","):void 0,n=C(t,a),c=b.get(n);if(!(c&&Date.now()-c.timestamp{n.lengthComputable&&r($,Math.round(n.loaded/n.total*100))}),await new Promise((n,c)=>{a.addEventListener("load",async()=>{a.status>=200&&a.status<300?n():c(new Error(`Upload failed with status ${a.status}`))}),a.addEventListener("error",()=>{c(new Error("Upload failed"))});const g=localStorage.getItem("token"),q=window.location.origin;a.open("POST",`${q}/api/v1/objects/`),g&&a.setRequestHeader("Authorization",`Bearer ${g}`),a.setRequestHeader("X-File-Name",e(o).name),e(o).tags.length>0&&a.setRequestHeader("X-Tags",e(o).tags.join(",")),e(o).description.trim()&&a.setRequestHeader("X-File-Description",e(o).description.trim()),a.send(e(o).file)}),te.add({type:"success",title:"Upload successful",message:`File "${e(o).name}" has been uploaded successfully.`}),r(H,!1),await L()}catch(t){const a=Ue(t);te.add({type:"error",title:"Upload failed",message:a})}finally{r(h,!1),r($,0)}}async function Le(){if(e(k)?.id)try{await Ve.updateFileObject(e(k).id.toString(),{name:e(u).name||void 0,tags:e(u).tags,description:e(u).description||void 0}),te.add({type:"success",title:"Object updated",message:"Object has been updated successfully."}),r(V,!1),r(k,null),await L()}catch(t){const a=Ue(t);te.add({type:"error",title:"Failed to update object",message:a})}}async function Be(t){try{const n=`${window.location.origin}/api/v1/objects/${t.id}/download`,c=await fetch(n,{method:"HEAD",credentials:"include"});if(!c.ok){const q=await c.text();throw new Error(q||`Download failed with status ${c.status}`)}const g=document.createElement("a");g.href=n,g.download=t.name||"download",document.body.appendChild(g),g.click(),document.body.removeChild(g)}catch(a){const n=Ue(a);te.add({type:"error",title:"Download failed",message:n})}}function Me(t){const a=t.detail.term,n=e(T).length>0,c=a.length>0;r(T,a),Z&&clearTimeout(Z),Z=setTimeout(()=>{!n&&c?(w=e(d),r(d,1)):n&&!c?r(d,w):c&&r(d,1),b.clear(),L(),Z=null},fe)}function Se(t){r(d,t.detail.page),L(!0)}function Ze(t){r(x,t.detail.pageSize),localStorage.setItem(ae,e(x).toString()),r(d,1),b.clear(),L()}function Fe(t){Ae(t.detail.page)}function Je(t){const a=t.target;a.files&&a.files[0]&&(K(o,e(o).file=a.files[0]),K(o,e(o).name=a.files[0].name))}let ce=p(""),M=p("");function B(t,a){const c=t.target.value.trim();if((t.key===" "||t.key==="Enter")&&c)t.preventDefault(),X(c,a),a==="upload"?r(ce,""):r(M,"");else if(t.key==="Backspace"&&!c){t.preventDefault();const g=a==="upload"?e(o).tags:e(u).tags;g.length>0&&Qe(g.length-1,a)}}function se(t){const a=t==="upload"?e(ce).trim():e(M).trim();a&&(X(a,t),t==="upload"?r(ce,""):r(M,""))}function X(t,a){const n=t.trim().toLowerCase();n&&(a==="upload"?e(o).tags.includes(n)||K(o,e(o).tags=[...e(o).tags,n]):e(u).tags.includes(n)||K(u,e(u).tags=[...e(u).tags,n]))}function Qe(t,a){a==="upload"?K(o,e(o).tags=e(o).tags.filter((n,c)=>c!==t)):K(u,e(u).tags=e(u).tags.filter((n,c)=>c!==t))}const kt=[{key:"name",title:"Name",cellComponent:Nt,cellProps:{entityType:"object"}},{key:"size",title:"Size",cellComponent:gt,cellProps:{getValue:t=>ft(t.size||0)}},{key:"tags",title:"Tags",cellComponent:Qt,hideOnMobile:!0,cellProps:{tags:[]}},{key:"updated_at",title:"Last Modified",hideOnMobile:!0,cellComponent:gt,cellProps:{getValue:t=>vt(t.updated_at)}},{key:"actions",title:"Actions",align:"right",width:"min",cellComponent:Ht,cellProps:{actions:[{type:"custom",label:"Download",action:"download",title:"Download",ariaLabel:"Download object"},{type:"edit",action:"edit",title:"Update",ariaLabel:"Update object"},{type:"delete",action:"delete",title:"Delete",ariaLabel:"Delete object"}]}}],$t=` +import{f as S,a as f,s as j,e as U,t as ie,b as bt,r as ct}from"../chunks/ZGz3X54u.js";import{i as tt}from"../chunks/CY7Wcm-1.js";import{p as at,o as ht,q as xt,l as le,h as O,g as e,m as p,b as yt,f as _t,a as rt,s,d as r,u as pt,c as l,r as i,t as z,v as Ut,i as qe,n as Y,k as At,j as K}from"../chunks/kDtaAWAK.js";import{p as me,i as ne}from"../chunks/Cun6jNAp.js";import{e as Ye,i as We}from"../chunks/DdT9Vz5Q.js";import{e as wt,B as W,b as It,g as Ve,s as Lt,r as Xe,c as Ke}from"../chunks/CYK-UalN.js";import{b as Pe}from"../chunks/CYnNqrHp.js";import{p as ut}from"../chunks/CdEA5IGF.js";import"../chunks/DR0xnkWv.js";import"../chunks/DWgB-t1g.js";import{P as Bt}from"../chunks/DacI6VAP.js";import{D as Ft,G as gt}from"../chunks/BKeluGSY.js";import{M as mt}from"../chunks/CVBpH3Sf.js";import{t as te}from"../chunks/BVGCMSWJ.js";import{e as Ue}from"../chunks/BZiHL9L3.js";import{D as Rt}from"../chunks/Dxx83T0m.js";import{E as Nt}from"../chunks/Dd4NFVf9.js";import{A as Ht}from"../chunks/rb89c4PS.js";import{b as Gt}from"../chunks/DochbgGJ.js";import{f as ft,a as vt}from"../chunks/aK-A9Gop.js";import{w as qt}from"../chunks/KU08Mex1.js";var Vt=S('-'),Xt=S(' '),Kt=S(' '),Yt=S('
'),Wt=S(' '),Zt=S('
All tags:
'),Jt=S(" ",1);function Qt(je,A){at(A,!1);const m=p(),I=p(),R=p();let T=me(A,"item",8);const d=3;let x=p(null),D=p(!1),E=p(0),w=p(0),ae=p(!1);function b(){if(e(x)){const v=e(x).getBoundingClientRect();r(E,v.left),window.innerHeight-v.bottom<150?(r(ae,!0),r(w,v.top)):(r(ae,!1),r(w,v.bottom+4))}}function re(){r(D,!0),b()}function Z(){r(D,!1)}ht(()=>{window.addEventListener("scroll",b,!0),window.addEventListener("resize",b)}),xt(()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}),le(()=>O(T()),()=>{r(m,T()?.tags||[])}),le(()=>e(m),()=>{r(I,e(m).slice(0,d))}),le(()=>e(m),()=>{r(R,Math.max(0,e(m).length-d))}),yt(),tt();var fe=Jt(),N=_t(fe);{var H=v=>{var o=Vt();f(v,o)},V=v=>{var o=Yt(),$=l(o);Ye($,1,()=>e(I),We,(P,C)=>{var G=Xt(),L=l(G,!0);i(G),z(()=>j(L,e(C))),f(P,G)});var h=s($,2);{var u=P=>{var C=Kt(),G=l(C);i(C),z(()=>j(G,`+${e(R)??""} more`)),f(P,C)};ne(h,P=>{e(R)>0&&P(u)})}i(o),Gt(o,P=>r(x,P),()=>e(x)),U("mouseenter",o,function(...P){(e(m).length>d?re:void 0)?.apply(this,P)}),U("mouseleave",o,function(...P){(e(m).length>d?Z:void 0)?.apply(this,P)}),f(v,o)};ne(N,v=>{e(m),pt(()=>!e(m)||e(m).length===0)?v(H):v(V,!1)})}var k=s(N,2);{var J=v=>{var o=Zt(),$=l(o),h=s(l($),2);Ye(h,5,()=>e(m),We,(u,P)=>{var C=Wt(),G=l(C,!0);i(C),z(()=>j(G,e(P))),f(u,C)}),i(h),i($),i(o),z(()=>wt(o,`left: ${e(E)??""}px; top: ${e(w)??""}px; transform: translateY(${e(ae)?"-100%":"0"});`)),f(v,o)};ne(k,v=>{e(m),e(D),pt(()=>e(m).length>d&&e(D))&&v(J)})}f(je,fe),rt()}var ea=bt(''),ta=bt(''),aa=S('
');function ra(je,A){at(A,!1);const m=p(),I=p(),R=p(),T=p();let d=me(A,"currentPage",8,1),x=me(A,"totalPages",8,1),D=me(A,"totalItems",8,0),E=me(A,"pageSize",12,25),w=me(A,"loading",8,!1),ae=me(A,"itemName",8,"items");const b=Ut();function re(){e(I)&&!w()&&(b("pageChange",{page:d()-1}),d()-2>0&&b("prefetch",{page:d()-2}))}function Z(){e(m)&&!w()&&(b("pageChange",{page:d()+1}),d()+2<=x()&&b("prefetch",{page:d()+2}))}function fe(M){const B=M.target,se=parseInt(B.value);b("pageSizeChange",{pageSize:se})}le(()=>(O(d()),O(x())),()=>{r(m,d()O(d()),()=>{r(I,d()>1)}),le(()=>(O(D()),O(d()),O(E())),()=>{r(R,D()===0?0:(d()-1)*E()+1)}),le(()=>(O(d()),O(E()),O(D())),()=>{r(T,Math.min(d()*E(),D()))}),le(()=>(O(d()),O(x()),O(w())),()=>{d()!e(I)||w());W(V,{variant:"secondary",size:"sm",get disabled(){return e(M)},$$events:{click:re},children:(B,se)=>{Y();var X=ie("Previous");f(B,X)},$$slots:{default:!0}})}var k=s(V,2);{let M=qe(()=>!e(m)||w());W(k,{variant:"secondary",size:"sm",get disabled(){return e(M)},$$events:{click:Z},children:(B,se)=>{Y();var X=ie("Next");f(B,X)},$$slots:{default:!0}})}i(H);var J=s(H,2),v=l(J),o=l(v),$=s(l(o)),h=l($,!0);i($);var u=s($,2),P=l(u,!0);i(u);var C=s(u,2),G=l(C,!0);i(C);var L=s(C);i(o);var Ae=s(o,2),de=s(l(Ae),2);z(()=>{E(),At(()=>{w()})});var Ce=l(de);Ce.value=Ce.__value=10;var ve=s(Ce);ve.value=ve.__value=25;var be=s(ve);be.value=be.__value=50;var Ie=s(be);Ie.value=Ie.__value=100,i(de),i(Ae),i(v);var Le=s(v,2),Be=l(Le);{let M=qe(()=>!e(I)||w());W(Be,{variant:"secondary",size:"sm",get disabled(){return e(M)},$$events:{click:re},children:(B,se)=>{var X=ea();f(B,X)},$$slots:{default:!0}})}var Me=s(Be,2),Se=s(l(Me)),Ze=l(Se,!0);i(Se);var Fe=s(Se,2),Je=l(Fe,!0);i(Fe),i(Me);var ce=s(Me,2);{let M=qe(()=>!e(m)||w());W(ce,{variant:"secondary",size:"sm",get disabled(){return e(M)},$$events:{click:Z},children:(B,se)=>{var X=ta();f(B,X)},$$slots:{default:!0}})}i(Le),i(J),i(N),z(()=>{j(h,e(R)),j(P,e(T)),j(G,D()),j(L,` ${ae()??""}`),de.disabled=w(),j(Ze,d()),j(Je,x())}),It(de,E),U("change",de,fe),f(je,N),rt()}var sa=S('
'),oa=S(' '),ia=S('
Uploading...
'),la=S('

Upload New Object

Press Space or Enter to add a tag. Press Backspace to remove the last tag.

'),na=S(' '),da=S('

Update Object

Press Space or Enter to add a tag. Press Backspace to remove the last tag.

'),ca=S(`
`,1);function Ea(je,A){at(A,!1);let m=p([]),I=p(!0),R=p(""),T=p(""),d=p(1),x=p(25),D=p(1),E=p(0),w=1;const ae="garm_objects_page_size";let b=new Map;const re=300*1e3;let Z=null;const fe=500;let N=p(!1),H=p(!1),V=p(!1),k=p(null),J=p(!1),v=null,o=p({name:"",file:null,tags:[],description:""}),$=p(0),h=p(!1),u=p({name:"",tags:[],description:""});function P(t){if(t.operation==="create")L();else if(t.operation==="update"){const a=t.payload;r(m,e(m).map(n=>n.id===a.id?a:n))}else if(t.operation==="delete"){const a=t.payload.id||t.payload;r(m,e(m).filter(n=>n.id!==a)),r(E,Math.max(0,e(E)-1))}}ht(async()=>{const t=localStorage.getItem(ae);if(t){const a=parseInt(t,10);!isNaN(a)&&a>0&&r(x,a)}await L(),v=qt.subscribeToEntity("file_object",["create","update","delete"],P)}),xt(()=>{v&&(v(),v=null)});function C(t,a,n=e(x)){return`${t}-${a||"all"}-${n}`}function G(){const t=Date.now();for(const[a,n]of b.entries())t-n.timestamp>re&&b.delete(a)}async function L(t=!1){try{r(I,!t),r(R,"");const a=e(T).trim()?e(T).trim().replace(/\s+/g,","):void 0,n=C(e(d),a);if(t){const g=b.get(n);if(g&&Date.now()-g.timestampe(D))return;const a=e(T).trim()?e(T).trim().replace(/\s+/g,","):void 0,n=C(t,a),c=b.get(n);if(!(c&&Date.now()-c.timestamp{n.lengthComputable&&r($,Math.round(n.loaded/n.total*100))}),await new Promise((n,c)=>{a.addEventListener("load",async()=>{a.status>=200&&a.status<300?n():c(new Error(`Upload failed with status ${a.status}`))}),a.addEventListener("error",()=>{c(new Error("Upload failed"))});const g=localStorage.getItem("token"),q=window.location.origin;a.open("POST",`${q}/api/v1/objects/`),g&&a.setRequestHeader("Authorization",`Bearer ${g}`),a.setRequestHeader("X-File-Name",e(o).name),e(o).tags.length>0&&a.setRequestHeader("X-Tags",e(o).tags.join(",")),e(o).description.trim()&&a.setRequestHeader("X-File-Description",e(o).description.trim()),a.send(e(o).file)}),te.add({type:"success",title:"Upload successful",message:`File "${e(o).name}" has been uploaded successfully.`}),r(H,!1),await L()}catch(t){const a=Ue(t);te.add({type:"error",title:"Upload failed",message:a})}finally{r(h,!1),r($,0)}}async function Le(){if(e(k)?.id)try{await Ve.updateFileObject(e(k).id.toString(),{name:e(u).name||void 0,tags:e(u).tags,description:e(u).description||void 0}),te.add({type:"success",title:"Object updated",message:"Object has been updated successfully."}),r(V,!1),r(k,null),await L()}catch(t){const a=Ue(t);te.add({type:"error",title:"Failed to update object",message:a})}}async function Be(t){try{const n=`${window.location.origin}/api/v1/objects/${t.id}/download`,c=await fetch(n,{method:"HEAD",credentials:"include"});if(!c.ok){const q=await c.text();throw new Error(q||`Download failed with status ${c.status}`)}const g=document.createElement("a");g.href=n,g.download=t.name||"download",document.body.appendChild(g),g.click(),document.body.removeChild(g)}catch(a){const n=Ue(a);te.add({type:"error",title:"Download failed",message:n})}}function Me(t){const a=t.detail.term,n=e(T).length>0,c=a.length>0;r(T,a),Z&&clearTimeout(Z),Z=setTimeout(()=>{!n&&c?(w=e(d),r(d,1)):n&&!c?r(d,w):c&&r(d,1),b.clear(),L(),Z=null},fe)}function Se(t){r(d,t.detail.page),L(!0)}function Ze(t){r(x,t.detail.pageSize),localStorage.setItem(ae,e(x).toString()),r(d,1),b.clear(),L()}function Fe(t){Ae(t.detail.page)}function Je(t){const a=t.target;a.files&&a.files[0]&&(K(o,e(o).file=a.files[0]),K(o,e(o).name=a.files[0].name))}let ce=p(""),M=p("");function B(t,a){const c=t.target.value.trim();if((t.key===" "||t.key==="Enter")&&c)t.preventDefault(),X(c,a),a==="upload"?r(ce,""):r(M,"");else if(t.key==="Backspace"&&!c){t.preventDefault();const g=a==="upload"?e(o).tags:e(u).tags;g.length>0&&Qe(g.length-1,a)}}function se(t){const a=t==="upload"?e(ce).trim():e(M).trim();a&&(X(a,t),t==="upload"?r(ce,""):r(M,""))}function X(t,a){const n=t.trim().toLowerCase();n&&(a==="upload"?e(o).tags.includes(n)||K(o,e(o).tags=[...e(o).tags,n]):e(u).tags.includes(n)||K(u,e(u).tags=[...e(u).tags,n]))}function Qe(t,a){a==="upload"?K(o,e(o).tags=e(o).tags.filter((n,c)=>c!==t)):K(u,e(u).tags=e(u).tags.filter((n,c)=>c!==t))}const kt=[{key:"name",title:"Name",cellComponent:Nt,cellProps:{entityType:"object"}},{key:"size",title:"Size",cellComponent:gt,cellProps:{getValue:t=>ft(t.size||0)}},{key:"tags",title:"Tags",cellComponent:Qt,hideOnMobile:!0,cellProps:{tags:[]}},{key:"updated_at",title:"Last Modified",hideOnMobile:!0,cellComponent:gt,cellProps:{getValue:t=>vt(t.updated_at)}},{key:"actions",title:"Actions",align:"right",width:"min",cellComponent:Ht,cellProps:{actions:[{type:"custom",label:"Download",action:"download",title:"Download",ariaLabel:"Download object"},{type:"edit",action:"edit",title:"Update",ariaLabel:"Update object"},{type:"delete",action:"delete",title:"Delete",ariaLabel:"Delete object"}]}}],$t=` This feature allows you to use GARM as a simple, private internal-use object storage system. The primary goal of this is to allow users to store provider binaries, agent binaries, runner tools and any other type of files needed for a functional GARM deployment. Files are stored in the database as blobs. You do not need to configure additional storage. diff --git a/webapp/assets/_app/immutable/nodes/12.Csus4sgy.js b/webapp/assets/_app/immutable/nodes/12.B-iY07X5.js similarity index 97% rename from webapp/assets/_app/immutable/nodes/12.Csus4sgy.js rename to webapp/assets/_app/immutable/nodes/12.B-iY07X5.js index 83ae9451..abd8ce24 100644 --- a/webapp/assets/_app/immutable/nodes/12.Csus4sgy.js +++ b/webapp/assets/_app/immutable/nodes/12.B-iY07X5.js @@ -1 +1 @@ -import{f as y,a as x,s as p,c as ct,e as j,r as vt,t as Ae}from"../chunks/ZGz3X54u.js";import{i as mt}from"../chunks/CY7Wcm-1.js";import{p as ut,o as gt,l as xt,b as pt,f as de,t as C,a as ft,u as n,h as J,g as e,m as k,c as r,s,d as l,r as a,n as se,j as Q}from"../chunks/kDtaAWAK.js";import{i as $,s as bt,a as yt}from"../chunks/Cun6jNAp.js";import{e as Be,i as Ee}from"../chunks/DdT9Vz5Q.js";import{d as ie,c as oe,g as le,r as Se,B as Ue}from"../chunks/Cvcp5xHB.js";import{b as ne}from"../chunks/CYnNqrHp.js";import{p as ht}from"../chunks/CdEA5IGF.js";import{p as _t}from"../chunks/D3FdGlax.js";import{g as kt}from"../chunks/BU_V7FOQ.js";import{t as D}from"../chunks/BVGCMSWJ.js";import{e as V}from"../chunks/BZiHL9L3.js";import{f as Ce,a as W}from"../chunks/aK-A9Gop.js";import{D as wt}from"../chunks/lQWw1Z23.js";import{M as jt}from"../chunks/C6jYEeWP.js";import{B as $t}from"../chunks/DovBLKjH.js";var Dt=y('

Error

'),Mt=y('

Loading object details...

'),Ot=y('
'),Tt=y('No tags'),Ft=y('

Description

'),At=y('

File Information

ID:
Name:
Size:
File Type:
SHA256:

Metadata & Timestamps

Created At:
Updated At:
Tags:
',1),Bt=y(' '),Et=y('

Update Object

Press Space or Enter to add a tag. Press Backspace on empty field to remove last tag.

'),St=y(' ',1);function Xt(Ie,Le){ut(Le,!1);const[Pe,ze]=bt(),ce=()=>yt(_t,"$page",Pe),X=k();let t=k(null),K=k(!0),M=k(""),Y=k(!1),I=k(!1),i=k({name:"",tags:[],description:""}),O=k("");gt(async()=>{await ve()});async function ve(){if(!e(X)){l(M,"Invalid object ID"),l(K,!1);return}try{l(K,!0),l(M,""),l(t,await le.getFileObject(e(X)))}catch(d){l(M,V(d)),D.add({type:"error",title:"Failed to load object",message:e(M)})}finally{l(K,!1)}}async function Ne(){if(e(t)?.id)try{await le.deleteFileObject(e(t).id.toString()),D.add({type:"success",title:"Object deleted",message:`Object "${e(t).name}" has been deleted successfully.`}),kt(ie("/objects"))}catch(d){const o=V(d);D.add({type:"error",title:"Failed to delete object",message:o})}}async function Re(){if(e(t)?.id)try{const o=`${window.location.origin}/api/v1/objects/${e(t).id}/download`,c=await fetch(o,{method:"HEAD",credentials:"include"});if(!c.ok){const u=await c.text();throw new Error(u||`Download failed with status ${c.status}`)}const v=document.createElement("a");v.href=o,v.download=e(t).name||"download",document.body.appendChild(v),v.click(),document.body.removeChild(v),D.add({type:"success",title:"Download started",message:`Downloading "${e(t).name}"...`})}catch(d){const o=V(d);D.add({type:"error",title:"Download failed",message:o})}}function He(){e(t)&&(l(i,{name:e(t).name||"",tags:e(t).tags||[],description:e(t).description||""}),l(O,""),l(I,!0))}async function Ke(){if(e(t)?.id)try{await le.updateFileObject(e(t).id.toString(),{name:e(i).name||void 0,tags:e(i).tags,description:e(i).description||void 0}),D.add({type:"success",title:"Object updated",message:"Object has been updated successfully."}),l(I,!1),await ve()}catch(d){const o=V(d);D.add({type:"error",title:"Failed to update object",message:o})}}function qe(d){const c=d.target.value.trim();(d.key===" "||d.key==="Enter")&&c?(d.preventDefault(),me(c),l(O,"")):d.key==="Backspace"&&!c&&e(i).tags.length>0&&(d.preventDefault(),ue(e(i).tags.length-1))}function Ge(){const d=e(O).trim();d&&(me(d),l(O,""))}function me(d){const o=d.trim().toLowerCase();o&&(e(i).tags.includes(o)||Q(i,e(i).tags=[...e(i).tags,o]))}function ue(d){Q(i,e(i).tags=e(i).tags.filter((o,c)=>c!==d))}xt(()=>ce(),()=>{l(X,ce().params.id||"")}),pt(),mt();var ge=St(),Z=de(ge),xe=r(Z),ee=r(xe),Je=r(ee);a(ee);var pe=s(ee,2),fe=r(pe),be=s(r(fe),2),Qe=r(be,!0);a(be),a(fe),a(pe),a(xe),a(Z);var ye=s(Z,2);{var Ve=d=>{var o=Dt(),c=r(o),v=r(c),u=s(r(v),2),h=r(u,!0);a(u),a(v),a(c),a(o),C(()=>p(h,e(M))),x(d,o)};$(ye,d=>{e(M)&&d(Ve)})}var he=s(ye,2);{var We=d=>{var o=Mt();x(d,o)},Xe=d=>{var o=ct(),c=de(o);{var v=u=>{var h=At(),T=de(h),w=r(T),F=r(w),L=s(r(F),2),_=r(L),A=s(_,2),P=s(A,2);a(L),a(F);var z=s(F,2),N=r(z),R=s(r(N),2),q=r(R,!0);a(R),a(N);var H=s(N,2),m=s(r(H),2),B=r(m,!0);a(m),a(H);var b=s(H,2),E=s(r(b),2),G=r(E,!0);a(E),a(b);var S=s(b,2),ke=s(r(S),2),tt=r(ke,!0);a(ke),a(S);var we=s(S,2),je=s(r(we),2),at=r(je,!0);a(je),a(we),a(z),a(w);var $e=s(w,2),De=s(r($e),2),te=r(De),Me=s(r(te),2),rt=r(Me,!0);a(Me),a(te);var ae=s(te,2),Oe=s(r(ae),2),dt=r(Oe,!0);a(Oe),a(ae);var Te=s(ae,2),Fe=s(r(Te),2),st=r(Fe);{var it=g=>{var f=Ot();Be(f,5,()=>(e(t),n(()=>e(t).tags)),Ee,(U,re)=>{$t(U,{variant:"blue",get text(){return e(re)}})}),a(f),x(g,f)},ot=g=>{var f=Tt();x(g,f)};$(st,g=>{e(t),n(()=>e(t).tags&&e(t).tags.length>0)?g(it):g(ot,!1)})}a(Fe),a(Te),a(De),a($e),a(T);var lt=s(T,2);{var nt=g=>{var f=Ft(),U=s(r(f),2),re=r(U,!0);a(U),a(f),C(()=>p(re,(e(t),n(()=>e(t).description)))),x(g,f)};$(lt,g=>{e(t),n(()=>e(t).description)&&g(nt)})}C((g,f,U)=>{p(q,(e(t),n(()=>e(t).id))),p(B,(e(t),n(()=>e(t).name))),p(G,g),p(tt,(e(t),n(()=>e(t).file_type||"N/A"))),p(at,(e(t),n(()=>e(t).sha256||"N/A"))),p(rt,f),p(dt,U)},[()=>(J(Ce),e(t),n(()=>Ce(e(t).size||0))),()=>(J(W),e(t),n(()=>W(e(t).created_at))),()=>(J(W),e(t),n(()=>W(e(t).updated_at)))]),j("click",_,He),j("click",A,Re),j("click",P,()=>l(Y,!0)),x(u,h)};$(c,u=>{e(t)&&u(v)},!0)}x(d,o)};$(he,d=>{e(K)?d(We):d(Xe,!1)})}var _e=s(he,2);{var Ye=d=>{jt(d,{$$events:{close:()=>l(I,!1)},children:(o,c)=>{var v=Et(),u=s(r(v),2),h=r(u),T=s(r(h),2);Se(T),a(h);var w=s(h,2),F=s(r(w),2),L=r(F);Be(L,1,()=>(e(i),n(()=>e(i).tags)),Ee,(m,B,b)=>{var E=Bt(),G=r(E),S=s(G);a(E),C(()=>{p(G,`${e(B)??""} `),oe(S,"aria-label",`Remove tag ${e(B)??""}`)}),j("click",S,()=>ue(b)),x(m,E)});var _=s(L,2);Se(_),a(F),se(2),a(w);var A=s(w,2),P=s(r(A),2);vt(P);var z=s(P,2),N=r(z);a(z),a(A);var R=s(A,2),q=r(R);Ue(q,{type:"button",variant:"secondary",$$events:{click:()=>l(I,!1)},children:(m,B)=>{se();var b=Ae("Cancel");x(m,b)},$$slots:{default:!0}});var H=s(q,2);Ue(H,{type:"submit",variant:"primary",children:(m,B)=>{se();var b=Ae("Update Object");x(m,b)},$$slots:{default:!0}}),a(R),a(u),a(v),C(()=>{oe(_,"placeholder",(e(i),n(()=>e(i).tags.length===0?"Type and press Space or Enter":""))),p(N,`${e(i),n(()=>e(i).description.length)??""} / 8192 characters`)}),ne(T,()=>e(i).name,m=>Q(i,e(i).name=m)),ne(_,()=>e(O),m=>l(O,m)),j("keydown",_,qe),j("blur",_,Ge),ne(P,()=>e(i).description,m=>Q(i,e(i).description=m)),j("submit",u,ht(Ke)),x(o,v)},$$slots:{default:!0}})};$(_e,d=>{e(I)&&e(t)&&d(Ye)})}var Ze=s(_e,2);{var et=d=>{wt(d,{title:"Delete Object",get message(){return`Are you sure you want to delete the object '${e(t),n(()=>e(t).name)??""}'? This action cannot be undone.`},$$events:{confirm:Ne,close:()=>l(Y,!1)}})};$(Ze,d=>{e(Y)&&e(t)&&d(et)})}C(d=>{oe(Je,"href",d),p(Qe,(e(t),n(()=>e(t)?e(t).name:"Object Details")))},[()=>(J(ie),n(()=>ie("/objects")))]),x(Ie,ge),ft(),ze()}export{Xt as component}; +import{f as y,a as x,s as p,c as ct,e as j,r as vt,t as Ae}from"../chunks/ZGz3X54u.js";import{i as mt}from"../chunks/CY7Wcm-1.js";import{p as ut,o as gt,l as xt,b as pt,f as de,t as C,a as ft,u as n,h as J,g as e,m as k,c as r,s,d as l,r as a,n as se,j as Q}from"../chunks/kDtaAWAK.js";import{i as $,s as bt,a as yt}from"../chunks/Cun6jNAp.js";import{e as Be,i as Ee}from"../chunks/DdT9Vz5Q.js";import{d as ie,c as oe,g as le,r as Se,B as Ue}from"../chunks/CYK-UalN.js";import{b as ne}from"../chunks/CYnNqrHp.js";import{p as ht}from"../chunks/CdEA5IGF.js";import{p as _t}from"../chunks/DXEzcvud.js";import{g as kt}from"../chunks/C8dZhfFx.js";import{t as D}from"../chunks/BVGCMSWJ.js";import{e as V}from"../chunks/BZiHL9L3.js";import{f as Ce,a as W}from"../chunks/aK-A9Gop.js";import{D as wt}from"../chunks/Dxx83T0m.js";import{M as jt}from"../chunks/CVBpH3Sf.js";import{B as $t}from"../chunks/DbE0zTOa.js";var Dt=y('

Error

'),Mt=y('

Loading object details...

'),Ot=y('
'),Tt=y('No tags'),Ft=y('

Description

'),At=y('

File Information

ID:
Name:
Size:
File Type:
SHA256:

Metadata & Timestamps

Created At:
Updated At:
Tags:
',1),Bt=y(' '),Et=y('

Update Object

Press Space or Enter to add a tag. Press Backspace on empty field to remove last tag.

'),St=y(' ',1);function Xt(Ie,Le){ut(Le,!1);const[Pe,ze]=bt(),ce=()=>yt(_t,"$page",Pe),X=k();let t=k(null),K=k(!0),M=k(""),Y=k(!1),I=k(!1),i=k({name:"",tags:[],description:""}),O=k("");gt(async()=>{await ve()});async function ve(){if(!e(X)){l(M,"Invalid object ID"),l(K,!1);return}try{l(K,!0),l(M,""),l(t,await le.getFileObject(e(X)))}catch(d){l(M,V(d)),D.add({type:"error",title:"Failed to load object",message:e(M)})}finally{l(K,!1)}}async function Ne(){if(e(t)?.id)try{await le.deleteFileObject(e(t).id.toString()),D.add({type:"success",title:"Object deleted",message:`Object "${e(t).name}" has been deleted successfully.`}),kt(ie("/objects"))}catch(d){const o=V(d);D.add({type:"error",title:"Failed to delete object",message:o})}}async function Re(){if(e(t)?.id)try{const o=`${window.location.origin}/api/v1/objects/${e(t).id}/download`,c=await fetch(o,{method:"HEAD",credentials:"include"});if(!c.ok){const u=await c.text();throw new Error(u||`Download failed with status ${c.status}`)}const v=document.createElement("a");v.href=o,v.download=e(t).name||"download",document.body.appendChild(v),v.click(),document.body.removeChild(v),D.add({type:"success",title:"Download started",message:`Downloading "${e(t).name}"...`})}catch(d){const o=V(d);D.add({type:"error",title:"Download failed",message:o})}}function He(){e(t)&&(l(i,{name:e(t).name||"",tags:e(t).tags||[],description:e(t).description||""}),l(O,""),l(I,!0))}async function Ke(){if(e(t)?.id)try{await le.updateFileObject(e(t).id.toString(),{name:e(i).name||void 0,tags:e(i).tags,description:e(i).description||void 0}),D.add({type:"success",title:"Object updated",message:"Object has been updated successfully."}),l(I,!1),await ve()}catch(d){const o=V(d);D.add({type:"error",title:"Failed to update object",message:o})}}function qe(d){const c=d.target.value.trim();(d.key===" "||d.key==="Enter")&&c?(d.preventDefault(),me(c),l(O,"")):d.key==="Backspace"&&!c&&e(i).tags.length>0&&(d.preventDefault(),ue(e(i).tags.length-1))}function Ge(){const d=e(O).trim();d&&(me(d),l(O,""))}function me(d){const o=d.trim().toLowerCase();o&&(e(i).tags.includes(o)||Q(i,e(i).tags=[...e(i).tags,o]))}function ue(d){Q(i,e(i).tags=e(i).tags.filter((o,c)=>c!==d))}xt(()=>ce(),()=>{l(X,ce().params.id||"")}),pt(),mt();var ge=St(),Z=de(ge),xe=r(Z),ee=r(xe),Je=r(ee);a(ee);var pe=s(ee,2),fe=r(pe),be=s(r(fe),2),Qe=r(be,!0);a(be),a(fe),a(pe),a(xe),a(Z);var ye=s(Z,2);{var Ve=d=>{var o=Dt(),c=r(o),v=r(c),u=s(r(v),2),h=r(u,!0);a(u),a(v),a(c),a(o),C(()=>p(h,e(M))),x(d,o)};$(ye,d=>{e(M)&&d(Ve)})}var he=s(ye,2);{var We=d=>{var o=Mt();x(d,o)},Xe=d=>{var o=ct(),c=de(o);{var v=u=>{var h=At(),T=de(h),w=r(T),F=r(w),L=s(r(F),2),_=r(L),A=s(_,2),P=s(A,2);a(L),a(F);var z=s(F,2),N=r(z),R=s(r(N),2),q=r(R,!0);a(R),a(N);var H=s(N,2),m=s(r(H),2),B=r(m,!0);a(m),a(H);var b=s(H,2),E=s(r(b),2),G=r(E,!0);a(E),a(b);var S=s(b,2),ke=s(r(S),2),tt=r(ke,!0);a(ke),a(S);var we=s(S,2),je=s(r(we),2),at=r(je,!0);a(je),a(we),a(z),a(w);var $e=s(w,2),De=s(r($e),2),te=r(De),Me=s(r(te),2),rt=r(Me,!0);a(Me),a(te);var ae=s(te,2),Oe=s(r(ae),2),dt=r(Oe,!0);a(Oe),a(ae);var Te=s(ae,2),Fe=s(r(Te),2),st=r(Fe);{var it=g=>{var f=Ot();Be(f,5,()=>(e(t),n(()=>e(t).tags)),Ee,(U,re)=>{$t(U,{variant:"blue",get text(){return e(re)}})}),a(f),x(g,f)},ot=g=>{var f=Tt();x(g,f)};$(st,g=>{e(t),n(()=>e(t).tags&&e(t).tags.length>0)?g(it):g(ot,!1)})}a(Fe),a(Te),a(De),a($e),a(T);var lt=s(T,2);{var nt=g=>{var f=Ft(),U=s(r(f),2),re=r(U,!0);a(U),a(f),C(()=>p(re,(e(t),n(()=>e(t).description)))),x(g,f)};$(lt,g=>{e(t),n(()=>e(t).description)&&g(nt)})}C((g,f,U)=>{p(q,(e(t),n(()=>e(t).id))),p(B,(e(t),n(()=>e(t).name))),p(G,g),p(tt,(e(t),n(()=>e(t).file_type||"N/A"))),p(at,(e(t),n(()=>e(t).sha256||"N/A"))),p(rt,f),p(dt,U)},[()=>(J(Ce),e(t),n(()=>Ce(e(t).size||0))),()=>(J(W),e(t),n(()=>W(e(t).created_at))),()=>(J(W),e(t),n(()=>W(e(t).updated_at)))]),j("click",_,He),j("click",A,Re),j("click",P,()=>l(Y,!0)),x(u,h)};$(c,u=>{e(t)&&u(v)},!0)}x(d,o)};$(he,d=>{e(K)?d(We):d(Xe,!1)})}var _e=s(he,2);{var Ye=d=>{jt(d,{$$events:{close:()=>l(I,!1)},children:(o,c)=>{var v=Et(),u=s(r(v),2),h=r(u),T=s(r(h),2);Se(T),a(h);var w=s(h,2),F=s(r(w),2),L=r(F);Be(L,1,()=>(e(i),n(()=>e(i).tags)),Ee,(m,B,b)=>{var E=Bt(),G=r(E),S=s(G);a(E),C(()=>{p(G,`${e(B)??""} `),oe(S,"aria-label",`Remove tag ${e(B)??""}`)}),j("click",S,()=>ue(b)),x(m,E)});var _=s(L,2);Se(_),a(F),se(2),a(w);var A=s(w,2),P=s(r(A),2);vt(P);var z=s(P,2),N=r(z);a(z),a(A);var R=s(A,2),q=r(R);Ue(q,{type:"button",variant:"secondary",$$events:{click:()=>l(I,!1)},children:(m,B)=>{se();var b=Ae("Cancel");x(m,b)},$$slots:{default:!0}});var H=s(q,2);Ue(H,{type:"submit",variant:"primary",children:(m,B)=>{se();var b=Ae("Update Object");x(m,b)},$$slots:{default:!0}}),a(R),a(u),a(v),C(()=>{oe(_,"placeholder",(e(i),n(()=>e(i).tags.length===0?"Type and press Space or Enter":""))),p(N,`${e(i),n(()=>e(i).description.length)??""} / 8192 characters`)}),ne(T,()=>e(i).name,m=>Q(i,e(i).name=m)),ne(_,()=>e(O),m=>l(O,m)),j("keydown",_,qe),j("blur",_,Ge),ne(P,()=>e(i).description,m=>Q(i,e(i).description=m)),j("submit",u,ht(Ke)),x(o,v)},$$slots:{default:!0}})};$(_e,d=>{e(I)&&e(t)&&d(Ye)})}var Ze=s(_e,2);{var et=d=>{wt(d,{title:"Delete Object",get message(){return`Are you sure you want to delete the object '${e(t),n(()=>e(t).name)??""}'? This action cannot be undone.`},$$events:{confirm:Ne,close:()=>l(Y,!1)}})};$(Ze,d=>{e(Y)&&e(t)&&d(et)})}C(d=>{oe(Je,"href",d),p(Qe,(e(t),n(()=>e(t)?e(t).name:"Object Details")))},[()=>(J(ie),n(()=>ie("/objects")))]),x(Ie,ge),ft(),ze()}export{Xt as component}; diff --git a/webapp/assets/_app/immutable/nodes/13.hS6EkA-z.js b/webapp/assets/_app/immutable/nodes/13.R0etGrgT.js similarity index 95% rename from webapp/assets/_app/immutable/nodes/13.hS6EkA-z.js rename to webapp/assets/_app/immutable/nodes/13.R0etGrgT.js index ae44613f..339ebac6 100644 --- a/webapp/assets/_app/immutable/nodes/13.hS6EkA-z.js +++ b/webapp/assets/_app/immutable/nodes/13.R0etGrgT.js @@ -1 +1 @@ -import{f as E,a as T,s as de,e as Pe,h as Qe}from"../chunks/ZGz3X54u.js";import{i as je}from"../chunks/CY7Wcm-1.js";import{p as Ge,v as Xe,o as Le,l as x,d as a,m as l,g as e,j as F,b as Ne,s,c as o,r as n,t as K,k as Ue,u as v,n as Me,a as qe,f as Ze,$ as et,h as P,i as be}from"../chunks/kDtaAWAK.js";import{a as He,i as Q,s as Je}from"../chunks/Cun6jNAp.js";import{r as le,b as Re,h as tt,d as We,c as at,g as ve}from"../chunks/Cvcp5xHB.js";import{e as rt,i as ot}from"../chunks/DdT9Vz5Q.js";import{b as Ie,a as Te}from"../chunks/CYnNqrHp.js";import{p as nt}from"../chunks/CdEA5IGF.js";import{M as it}from"../chunks/C6jYEeWP.js";import{F as st}from"../chunks/CCoxuXg5.js";import{e as Ae}from"../chunks/BZiHL9L3.js";import{e as Ve,a as Se}from"../chunks/C2c_wqo6.js";import{U as lt}from"../chunks/io-Ugua7.js";import{D as dt}from"../chunks/lQWw1Z23.js";import{P as ct}from"../chunks/CLZesvzF.js";import{t as Y}from"../chunks/BVGCMSWJ.js";import{k as Ee,g as De,l as ut}from"../chunks/DNHT2U_W.js";import{B as gt}from"../chunks/DovBLKjH.js";import{D as mt,G as pt}from"../chunks/Cfdue6T6.js";import{A as Be}from"../chunks/uzzFhb3G.js";import{E as ft}from"../chunks/CEJvqnOn.js";import{E as bt}from"../chunks/C-3AL0iB.js";import{S as vt}from"../chunks/BTeTCgJA.js";import{A as ht}from"../chunks/Cs0pYghy.js";var yt=E('

'),_t=E('

Loading...

'),xt=E(""),kt=E(''),wt=E('

Webhook secret will be automatically generated

'),zt=E('
'),$t=E('

Create Organization

');function Ct(he,ye){Ge(ye,!1);const[_e,xe]=Je(),f=()=>He(Ve,"$eagerCache",_e),D=l(),w=l(),z=l(),X=l(),$=Xe();let C=l(!1),b=l(""),h=l("github"),r=l({name:"",credentials_name:"",webhook_secret:"",pool_balancer_type:"roundrobin",agent_mode:!1}),k=l(!0),p=l(!0);async function U(){if(!f().loaded.credentials&&!f().loading.credentials)try{await Se.getCredentials()}catch(d){a(b,Ae(d))}}function B(d){a(h,d.detail),F(r,e(r).credentials_name="")}function u(){if(e(r).credentials_name){const d=e(D).find(j=>j.name===e(r).credentials_name);d&&d.forge_type&&a(h,d.forge_type)}}function ke(){const d=new Uint8Array(32);return crypto.getRandomValues(d),Array.from(d,j=>j.toString(16).padStart(2,"0")).join("")}async function we(){if(!e(r).name?.trim()){a(b,"Organization name is required");return}if(!e(r).credentials_name){a(b,"Please select credentials");return}try{a(C,!0),a(b,"");const d={...e(r),install_webhook:e(k),auto_generate_secret:e(p)};$("submit",d)}catch(d){a(b,d instanceof Error?d.message:"Failed to create organization"),a(C,!1)}}Le(()=>{U()}),x(()=>f(),()=>{a(D,f().credentials)}),x(()=>f(),()=>{a(w,f().loading.credentials)}),x(()=>(e(D),e(h)),()=>{a(z,e(D).filter(d=>e(h)?d.forge_type===e(h):!0))}),x(()=>e(p),()=>{e(p)?F(r,e(r).webhook_secret=ke()):e(p)||F(r,e(r).webhook_secret="")}),x(()=>(e(r),e(p)),()=>{a(X,e(r).name?.trim()!==""&&e(r).credentials_name!==""&&(e(p)||e(r).webhook_secret&&e(r).webhook_secret.trim()!==""))}),Ne(),je(),it(he,{$$events:{close:()=>$("close")},children:(d,j)=>{var Z=$t(),G=s(o(Z),2);{var ee=y=>{var _=yt(),R=o(_),W=o(R,!0);n(R),n(_),K(()=>de(W,e(b))),T(y,_)};Q(G,y=>{e(b)&&y(ee)})}var ze=s(G,2);{var $e=y=>{var _=_t();T(y,_)},Ce=y=>{var _=zt(),R=o(_);st(R,{get selectedForgeType(){return e(h)},set selectedForgeType(i){a(h,i)},$$events:{select:B},$$legacy:!0});var W=s(R,2),ce=s(o(W),2);le(ce),n(W);var L=s(W,2),A=s(o(L),2);K(()=>{e(r),Ue(()=>{e(z)})});var N=o(A);N.value=N.__value="";var Oe=s(N);rt(Oe,1,()=>e(z),ot,(i,m)=>{var O=xt(),fe=o(O);n(O);var se={};K(()=>{de(fe,`${e(m),v(()=>e(m).name)??""} (${e(m),v(()=>e(m).endpoint?.name||"Unknown endpoint")??""})`),se!==(se=(e(m),v(()=>e(m).name)))&&(O.value=(O.__value=(e(m),v(()=>e(m).name)))??"")}),T(i,O)}),n(A),n(L);var q=s(L,2),te=s(o(q),2);K(()=>{e(r),Ue(()=>{})});var H=o(te);H.value=H.__value="roundrobin";var ue=s(H);ue.value=ue.__value="pack",n(te),n(q);var ae=s(q,2),ge=o(ae),t=o(ge);le(t),Me(4),n(ge),n(ae);var c=s(ae,2),I=o(c),M=o(I);le(M),Me(2),n(I);var g=s(I,2),S=o(g),J=o(S);le(J),Me(2),n(S);var re=s(S,2);{var oe=i=>{var m=kt();le(m),Ie(m,()=>e(r).webhook_secret,O=>F(r,e(r).webhook_secret=O)),T(i,m)},ne=i=>{var m=wt();T(i,m)};Q(re,i=>{e(p)?i(ne,!1):i(oe)})}n(g),n(c);var me=s(c,2),ie=o(me),V=s(ie,2),pe=o(V,!0);n(V),n(me),n(_),K(()=>{V.disabled=e(C)||e(w)||!e(X),de(pe,e(C)?"Creating...":"Create Organization")}),Ie(ce,()=>e(r).name,i=>F(r,e(r).name=i)),Re(A,()=>e(r).credentials_name,i=>F(r,e(r).credentials_name=i)),Pe("change",A,u),Re(te,()=>e(r).pool_balancer_type,i=>F(r,e(r).pool_balancer_type=i)),Te(t,()=>e(r).agent_mode,i=>F(r,e(r).agent_mode=i)),Te(M,()=>e(k),i=>a(k,i)),Te(J,()=>e(p),i=>a(p,i)),Pe("click",ie,()=>$("close")),Pe("submit",_,nt(we)),T(y,_)};Q(ze,y=>{e(C)?y($e):y(Ce,!1)})}n(Z),T(d,Z)},$$slots:{default:!0}}),qe(),xe()}var Ot=E(''),Pt=E('
',1);function Zt(he,ye){Ge(ye,!1);const[_e,xe]=Je(),f=()=>He(Ve,"$eagerCache",_e),D=l(),w=l(),z=l(),X=l();let $=l([]),C=l(!0),b=l(""),h=l(""),r=l(1),k=l(25),p=l(!1),U=l(!1),B=l(!1),u=l(null);function ke(){a(p,!1),a(B,!1),a(U,!1)}async function we(t){try{a(b,"");const c=t.detail,I={name:c.name,credentials_name:c.credentials_name,webhook_secret:c.webhook_secret,pool_balancer_type:c.pool_balancer_type},M=await ve.createOrganization(I);if(c.install_webhook&&M.id)try{await ve.installOrganizationWebhook(M.id),Y.success("Webhook Installed",`Webhook for organization ${M.name} has been installed successfully.`)}catch(g){console.warn("Organization created but webhook installation failed:",g),Y.error("Webhook Installation Failed",g instanceof Error?g.message:"Failed to install webhook. You can try installing it manually from the organization details page.")}Y.success("Organization Created",`Organization ${M.name} has been created successfully.`),a(p,!1)}catch(c){throw a(b,Ae(c)),c}}async function d(t){if(e(u))try{await ve.updateOrganization(e(u).id,t),Y.success("Organization Updated",`Organization ${e(u).name} has been updated successfully.`),a(U,!1),a(u,null)}catch(c){throw c}}async function j(){if(e(u))try{a(b,""),await ve.deleteOrganization(e(u).id),Y.success("Organization Deleted",`Organization ${e(u).name} has been deleted successfully.`),a(u,null)}catch(t){const c=Ae(t);Y.error("Delete Failed",c)}finally{ke()}}function Z(){a(p,!0)}function G(t){a(u,t),a(U,!0)}function ee(t){a(u,t),a(B,!0)}Le(async()=>{try{a(C,!0);const t=await Se.getOrganizations();t&&Array.isArray(t)&&a($,t)}catch(t){console.error("Failed to load organizations:",t),a(b,t instanceof Error?t.message:"Failed to load organizations")}finally{a(C,!1)}});async function ze(){try{await Se.retryResource("organizations")}catch(t){console.error("Retry failed:",t)}}const $e=[{key:"name",title:"Name",cellComponent:ft,cellProps:{entityType:"organization"}},{key:"endpoint",title:"Endpoint",cellComponent:bt},{key:"credentials",title:"Credentials",cellComponent:pt,cellProps:{field:"credentials_name"}},{key:"status",title:"Status",cellComponent:vt,cellProps:{statusType:"entity"}},{key:"actions",title:"Actions",align:"right",cellComponent:ht}],Ce={entityType:"organization",primaryText:{field:"name",isClickable:!0,href:"/organizations/{id}"},customInfo:[{icon:t=>De(t?.endpoint?.endpoint_type||"unknown"),text:t=>t?.endpoint?.name||"Unknown"}],badges:[{type:"custom",value:t=>Ee(t)}],actions:[{type:"edit",handler:t=>G(t)},{type:"delete",handler:t=>ee(t)}]};function y(t){a(h,t.detail.term),a(r,1)}function _(t){a(r,t.detail.page)}function R(t){a(k,t.detail.perPage),a(r,1)}function W(t){G(t.detail.item)}function ce(t){ee(t.detail.item)}x(()=>(e($),f()),()=>{(!e($).length||f().loaded.organizations)&&a($,f().organizations)}),x(()=>f(),()=>{a(C,f().loading.organizations)}),x(()=>f(),()=>{a(D,f().errorMessages.organizations)}),x(()=>(e($),e(h)),()=>{a(w,ut(e($),e(h)))}),x(()=>(e(w),e(k)),()=>{a(z,Math.ceil(e(w).length/e(k)))}),x(()=>(e(r),e(z)),()=>{e(r)>e(z)&&e(z)>0&&a(r,e(z))}),x(()=>(e(w),e(r),e(k)),()=>{a(X,e(w).slice((e(r)-1)*e(k),e(r)*e(k)))}),Ne(),je();var L=Pt();Qe(t=>{et.title="Organizations - GARM"});var A=Ze(L),N=o(A);ct(N,{title:"Organizations",description:"Manage GitHub and Gitea organizations",actionLabel:"Add Organization",$$events:{action:Z}});var Oe=s(N,2);{let t=be(()=>e(D)||e(b)),c=be(()=>!!e(D));mt(Oe,{get columns(){return $e},get data(){return e(X)},get loading(){return e(C)},get error(){return e(t)},get searchTerm(){return e(h)},searchPlaceholder:"Search organizations...",get currentPage(){return e(r)},get perPage(){return e(k)},get totalPages(){return e(z)},get totalItems(){return e(w),v(()=>e(w).length)},itemName:"organizations",emptyIconType:"building",get showRetry(){return e(c)},get mobileCardConfig(){return Ce},$$events:{search:y,pageChange:_,perPageChange:R,retry:ze,edit:W,delete:ce},$$slots:{"mobile-card":(I,M)=>{const g=be(()=>M.item),S=be(()=>(P(Ee),P(e(g)),v(()=>Ee(e(g)))));var J=Ot(),re=o(J),oe=o(re),ne=o(oe),me=o(ne,!0);n(ne);var ie=s(ne,2),V=o(ie),pe=o(V);tt(pe,()=>(P(De),P(e(g)),v(()=>De(e(g).endpoint?.endpoint_type||"unknown"))));var i=s(pe,2),m=o(i,!0);n(i),n(V),n(ie),n(oe),n(re);var O=s(re,2),fe=o(O);gt(fe,{get variant(){return P(e(S)),v(()=>e(S).variant)},get text(){return P(e(S)),v(()=>e(S).text)}});var se=s(fe,2),Fe=o(se);Be(Fe,{action:"edit",size:"sm",title:"Edit organization",ariaLabel:"Edit organization",$$events:{click:()=>G(e(g))}});var Ye=s(Fe,2);Be(Ye,{action:"delete",size:"sm",title:"Delete organization",ariaLabel:"Delete organization",$$events:{click:()=>ee(e(g))}}),n(se),n(O),n(J),K(Ke=>{at(oe,"href",Ke),de(me,(P(e(g)),v(()=>e(g).name))),de(m,(P(e(g)),v(()=>e(g).endpoint?.name||"Unknown")))},[()=>(P(We),P(e(g)),v(()=>We(`/organizations/${e(g).id}`)))]),T(I,J)}}})}n(A);var q=s(A,2);{var te=t=>{Ct(t,{$$events:{close:()=>a(p,!1),submit:we}})};Q(q,t=>{e(p)&&t(te)})}var H=s(q,2);{var ue=t=>{lt(t,{get entity(){return e(u)},entityType:"organization",$$events:{close:()=>{a(U,!1),a(u,null)},submit:c=>d(c.detail)}})};Q(H,t=>{e(U)&&e(u)&&t(ue)})}var ae=s(H,2);{var ge=t=>{dt(t,{title:"Delete Organization",message:"Are you sure you want to delete this organization? This action cannot be undone.",get itemName(){return e(u),v(()=>e(u).name)},$$events:{close:()=>{a(B,!1),a(u,null)},confirm:j}})};Q(ae,t=>{e(B)&&e(u)&&t(ge)})}T(he,L),qe(),xe()}export{Zt as component}; +import{f as E,a as T,s as de,e as Pe,h as Qe}from"../chunks/ZGz3X54u.js";import{i as je}from"../chunks/CY7Wcm-1.js";import{p as Ge,v as Xe,o as Le,l as x,d as a,m as l,g as e,j as F,b as Ne,s,c as o,r as n,t as K,k as Ue,u as v,n as Me,a as qe,f as Ze,$ as et,h as P,i as be}from"../chunks/kDtaAWAK.js";import{a as He,i as Q,s as Je}from"../chunks/Cun6jNAp.js";import{r as le,b as Re,h as tt,d as We,c as at,g as ve}from"../chunks/CYK-UalN.js";import{e as rt,i as ot}from"../chunks/DdT9Vz5Q.js";import{b as Ie,a as Te}from"../chunks/CYnNqrHp.js";import{p as nt}from"../chunks/CdEA5IGF.js";import{M as it}from"../chunks/CVBpH3Sf.js";import{F as st}from"../chunks/CovvT05J.js";import{e as Ae}from"../chunks/BZiHL9L3.js";import{e as Ve,a as Se}from"../chunks/Vo3Mv3dp.js";import{U as lt}from"../chunks/6aKjRj0k.js";import{D as dt}from"../chunks/Dxx83T0m.js";import{P as ct}from"../chunks/DacI6VAP.js";import{t as Y}from"../chunks/BVGCMSWJ.js";import{k as Ee,g as De,l as ut}from"../chunks/ZelbukuJ.js";import{B as gt}from"../chunks/DbE0zTOa.js";import{D as mt,G as pt}from"../chunks/BKeluGSY.js";import{A as Be}from"../chunks/DUWZCTMr.js";import{E as ft}from"../chunks/Dd4NFVf9.js";import{E as bt}from"../chunks/oWoYyEl8.js";import{S as vt}from"../chunks/BStwtkX8.js";import{A as ht}from"../chunks/rb89c4PS.js";var yt=E('

'),_t=E('

Loading...

'),xt=E(""),kt=E(''),wt=E('

Webhook secret will be automatically generated

'),zt=E('
'),$t=E('

Create Organization

');function Ct(he,ye){Ge(ye,!1);const[_e,xe]=Je(),f=()=>He(Ve,"$eagerCache",_e),D=l(),w=l(),z=l(),X=l(),$=Xe();let C=l(!1),b=l(""),h=l("github"),r=l({name:"",credentials_name:"",webhook_secret:"",pool_balancer_type:"roundrobin",agent_mode:!1}),k=l(!0),p=l(!0);async function U(){if(!f().loaded.credentials&&!f().loading.credentials)try{await Se.getCredentials()}catch(d){a(b,Ae(d))}}function B(d){a(h,d.detail),F(r,e(r).credentials_name="")}function u(){if(e(r).credentials_name){const d=e(D).find(j=>j.name===e(r).credentials_name);d&&d.forge_type&&a(h,d.forge_type)}}function ke(){const d=new Uint8Array(32);return crypto.getRandomValues(d),Array.from(d,j=>j.toString(16).padStart(2,"0")).join("")}async function we(){if(!e(r).name?.trim()){a(b,"Organization name is required");return}if(!e(r).credentials_name){a(b,"Please select credentials");return}try{a(C,!0),a(b,"");const d={...e(r),install_webhook:e(k),auto_generate_secret:e(p)};$("submit",d)}catch(d){a(b,d instanceof Error?d.message:"Failed to create organization"),a(C,!1)}}Le(()=>{U()}),x(()=>f(),()=>{a(D,f().credentials)}),x(()=>f(),()=>{a(w,f().loading.credentials)}),x(()=>(e(D),e(h)),()=>{a(z,e(D).filter(d=>e(h)?d.forge_type===e(h):!0))}),x(()=>e(p),()=>{e(p)?F(r,e(r).webhook_secret=ke()):e(p)||F(r,e(r).webhook_secret="")}),x(()=>(e(r),e(p)),()=>{a(X,e(r).name?.trim()!==""&&e(r).credentials_name!==""&&(e(p)||e(r).webhook_secret&&e(r).webhook_secret.trim()!==""))}),Ne(),je(),it(he,{$$events:{close:()=>$("close")},children:(d,j)=>{var Z=$t(),G=s(o(Z),2);{var ee=y=>{var _=yt(),R=o(_),W=o(R,!0);n(R),n(_),K(()=>de(W,e(b))),T(y,_)};Q(G,y=>{e(b)&&y(ee)})}var ze=s(G,2);{var $e=y=>{var _=_t();T(y,_)},Ce=y=>{var _=zt(),R=o(_);st(R,{get selectedForgeType(){return e(h)},set selectedForgeType(i){a(h,i)},$$events:{select:B},$$legacy:!0});var W=s(R,2),ce=s(o(W),2);le(ce),n(W);var L=s(W,2),A=s(o(L),2);K(()=>{e(r),Ue(()=>{e(z)})});var N=o(A);N.value=N.__value="";var Oe=s(N);rt(Oe,1,()=>e(z),ot,(i,m)=>{var O=xt(),fe=o(O);n(O);var se={};K(()=>{de(fe,`${e(m),v(()=>e(m).name)??""} (${e(m),v(()=>e(m).endpoint?.name||"Unknown endpoint")??""})`),se!==(se=(e(m),v(()=>e(m).name)))&&(O.value=(O.__value=(e(m),v(()=>e(m).name)))??"")}),T(i,O)}),n(A),n(L);var q=s(L,2),te=s(o(q),2);K(()=>{e(r),Ue(()=>{})});var H=o(te);H.value=H.__value="roundrobin";var ue=s(H);ue.value=ue.__value="pack",n(te),n(q);var ae=s(q,2),ge=o(ae),t=o(ge);le(t),Me(4),n(ge),n(ae);var c=s(ae,2),I=o(c),M=o(I);le(M),Me(2),n(I);var g=s(I,2),S=o(g),J=o(S);le(J),Me(2),n(S);var re=s(S,2);{var oe=i=>{var m=kt();le(m),Ie(m,()=>e(r).webhook_secret,O=>F(r,e(r).webhook_secret=O)),T(i,m)},ne=i=>{var m=wt();T(i,m)};Q(re,i=>{e(p)?i(ne,!1):i(oe)})}n(g),n(c);var me=s(c,2),ie=o(me),V=s(ie,2),pe=o(V,!0);n(V),n(me),n(_),K(()=>{V.disabled=e(C)||e(w)||!e(X),de(pe,e(C)?"Creating...":"Create Organization")}),Ie(ce,()=>e(r).name,i=>F(r,e(r).name=i)),Re(A,()=>e(r).credentials_name,i=>F(r,e(r).credentials_name=i)),Pe("change",A,u),Re(te,()=>e(r).pool_balancer_type,i=>F(r,e(r).pool_balancer_type=i)),Te(t,()=>e(r).agent_mode,i=>F(r,e(r).agent_mode=i)),Te(M,()=>e(k),i=>a(k,i)),Te(J,()=>e(p),i=>a(p,i)),Pe("click",ie,()=>$("close")),Pe("submit",_,nt(we)),T(y,_)};Q(ze,y=>{e(C)?y($e):y(Ce,!1)})}n(Z),T(d,Z)},$$slots:{default:!0}}),qe(),xe()}var Ot=E(''),Pt=E('
',1);function Zt(he,ye){Ge(ye,!1);const[_e,xe]=Je(),f=()=>He(Ve,"$eagerCache",_e),D=l(),w=l(),z=l(),X=l();let $=l([]),C=l(!0),b=l(""),h=l(""),r=l(1),k=l(25),p=l(!1),U=l(!1),B=l(!1),u=l(null);function ke(){a(p,!1),a(B,!1),a(U,!1)}async function we(t){try{a(b,"");const c=t.detail,I={name:c.name,credentials_name:c.credentials_name,webhook_secret:c.webhook_secret,pool_balancer_type:c.pool_balancer_type},M=await ve.createOrganization(I);if(c.install_webhook&&M.id)try{await ve.installOrganizationWebhook(M.id),Y.success("Webhook Installed",`Webhook for organization ${M.name} has been installed successfully.`)}catch(g){console.warn("Organization created but webhook installation failed:",g),Y.error("Webhook Installation Failed",g instanceof Error?g.message:"Failed to install webhook. You can try installing it manually from the organization details page.")}Y.success("Organization Created",`Organization ${M.name} has been created successfully.`),a(p,!1)}catch(c){throw a(b,Ae(c)),c}}async function d(t){if(e(u))try{await ve.updateOrganization(e(u).id,t),Y.success("Organization Updated",`Organization ${e(u).name} has been updated successfully.`),a(U,!1),a(u,null)}catch(c){throw c}}async function j(){if(e(u))try{a(b,""),await ve.deleteOrganization(e(u).id),Y.success("Organization Deleted",`Organization ${e(u).name} has been deleted successfully.`),a(u,null)}catch(t){const c=Ae(t);Y.error("Delete Failed",c)}finally{ke()}}function Z(){a(p,!0)}function G(t){a(u,t),a(U,!0)}function ee(t){a(u,t),a(B,!0)}Le(async()=>{try{a(C,!0);const t=await Se.getOrganizations();t&&Array.isArray(t)&&a($,t)}catch(t){console.error("Failed to load organizations:",t),a(b,t instanceof Error?t.message:"Failed to load organizations")}finally{a(C,!1)}});async function ze(){try{await Se.retryResource("organizations")}catch(t){console.error("Retry failed:",t)}}const $e=[{key:"name",title:"Name",cellComponent:ft,cellProps:{entityType:"organization"}},{key:"endpoint",title:"Endpoint",cellComponent:bt},{key:"credentials",title:"Credentials",cellComponent:pt,cellProps:{field:"credentials_name"}},{key:"status",title:"Status",cellComponent:vt,cellProps:{statusType:"entity"}},{key:"actions",title:"Actions",align:"right",cellComponent:ht}],Ce={entityType:"organization",primaryText:{field:"name",isClickable:!0,href:"/organizations/{id}"},customInfo:[{icon:t=>De(t?.endpoint?.endpoint_type||"unknown"),text:t=>t?.endpoint?.name||"Unknown"}],badges:[{type:"custom",value:t=>Ee(t)}],actions:[{type:"edit",handler:t=>G(t)},{type:"delete",handler:t=>ee(t)}]};function y(t){a(h,t.detail.term),a(r,1)}function _(t){a(r,t.detail.page)}function R(t){a(k,t.detail.perPage),a(r,1)}function W(t){G(t.detail.item)}function ce(t){ee(t.detail.item)}x(()=>(e($),f()),()=>{(!e($).length||f().loaded.organizations)&&a($,f().organizations)}),x(()=>f(),()=>{a(C,f().loading.organizations)}),x(()=>f(),()=>{a(D,f().errorMessages.organizations)}),x(()=>(e($),e(h)),()=>{a(w,ut(e($),e(h)))}),x(()=>(e(w),e(k)),()=>{a(z,Math.ceil(e(w).length/e(k)))}),x(()=>(e(r),e(z)),()=>{e(r)>e(z)&&e(z)>0&&a(r,e(z))}),x(()=>(e(w),e(r),e(k)),()=>{a(X,e(w).slice((e(r)-1)*e(k),e(r)*e(k)))}),Ne(),je();var L=Pt();Qe(t=>{et.title="Organizations - GARM"});var A=Ze(L),N=o(A);ct(N,{title:"Organizations",description:"Manage GitHub and Gitea organizations",actionLabel:"Add Organization",$$events:{action:Z}});var Oe=s(N,2);{let t=be(()=>e(D)||e(b)),c=be(()=>!!e(D));mt(Oe,{get columns(){return $e},get data(){return e(X)},get loading(){return e(C)},get error(){return e(t)},get searchTerm(){return e(h)},searchPlaceholder:"Search organizations...",get currentPage(){return e(r)},get perPage(){return e(k)},get totalPages(){return e(z)},get totalItems(){return e(w),v(()=>e(w).length)},itemName:"organizations",emptyIconType:"building",get showRetry(){return e(c)},get mobileCardConfig(){return Ce},$$events:{search:y,pageChange:_,perPageChange:R,retry:ze,edit:W,delete:ce},$$slots:{"mobile-card":(I,M)=>{const g=be(()=>M.item),S=be(()=>(P(Ee),P(e(g)),v(()=>Ee(e(g)))));var J=Ot(),re=o(J),oe=o(re),ne=o(oe),me=o(ne,!0);n(ne);var ie=s(ne,2),V=o(ie),pe=o(V);tt(pe,()=>(P(De),P(e(g)),v(()=>De(e(g).endpoint?.endpoint_type||"unknown"))));var i=s(pe,2),m=o(i,!0);n(i),n(V),n(ie),n(oe),n(re);var O=s(re,2),fe=o(O);gt(fe,{get variant(){return P(e(S)),v(()=>e(S).variant)},get text(){return P(e(S)),v(()=>e(S).text)}});var se=s(fe,2),Fe=o(se);Be(Fe,{action:"edit",size:"sm",title:"Edit organization",ariaLabel:"Edit organization",$$events:{click:()=>G(e(g))}});var Ye=s(Fe,2);Be(Ye,{action:"delete",size:"sm",title:"Delete organization",ariaLabel:"Delete organization",$$events:{click:()=>ee(e(g))}}),n(se),n(O),n(J),K(Ke=>{at(oe,"href",Ke),de(me,(P(e(g)),v(()=>e(g).name))),de(m,(P(e(g)),v(()=>e(g).endpoint?.name||"Unknown")))},[()=>(P(We),P(e(g)),v(()=>We(`/organizations/${e(g).id}`)))]),T(I,J)}}})}n(A);var q=s(A,2);{var te=t=>{Ct(t,{$$events:{close:()=>a(p,!1),submit:we}})};Q(q,t=>{e(p)&&t(te)})}var H=s(q,2);{var ue=t=>{lt(t,{get entity(){return e(u)},entityType:"organization",$$events:{close:()=>{a(U,!1),a(u,null)},submit:c=>d(c.detail)}})};Q(H,t=>{e(U)&&e(u)&&t(ue)})}var ae=s(H,2);{var ge=t=>{dt(t,{title:"Delete Organization",message:"Are you sure you want to delete this organization? This action cannot be undone.",get itemName(){return e(u),v(()=>e(u).name)},$$events:{close:()=>{a(B,!1),a(u,null)},confirm:j}})};Q(ae,t=>{e(B)&&e(u)&&t(ge)})}T(he,L),qe(),xe()}export{Zt as component}; diff --git a/webapp/assets/_app/immutable/nodes/14.BjI1asMm.js b/webapp/assets/_app/immutable/nodes/14.5u0NL8hV.js similarity index 93% rename from webapp/assets/_app/immutable/nodes/14.BjI1asMm.js rename to webapp/assets/_app/immutable/nodes/14.5u0NL8hV.js index 3fc6dc0b..28b0b311 100644 --- a/webapp/assets/_app/immutable/nodes/14.BjI1asMm.js +++ b/webapp/assets/_app/immutable/nodes/14.5u0NL8hV.js @@ -1 +1 @@ -import{f as F,h as We,a as x,s as de,c as ce}from"../chunks/ZGz3X54u.js";import{i as qe}from"../chunks/CY7Wcm-1.js";import{p as He,o as je,q as Ge,l as Re,b as Ve,f as k,t as j,a as Je,u as i,h as ue,g as e,m as l,c as f,s as d,d as o,$ as Ke,r as m,j as Qe,i as g}from"../chunks/kDtaAWAK.js";import{i as h,s as Xe,a as Ye}from"../chunks/Cun6jNAp.js";import{d as A,c as Ze,g as _}from"../chunks/Cvcp5xHB.js";import{p as et}from"../chunks/D3FdGlax.js";import{g as fe}from"../chunks/BU_V7FOQ.js";import{U as tt}from"../chunks/io-Ugua7.js";import{D as me}from"../chunks/lQWw1Z23.js";import{E as at,P as nt,a as ot}from"../chunks/DOA3alhD.js";import{D as rt}from"../chunks/CRSOHHg7.js";import{g as ge}from"../chunks/DNHT2U_W.js";import{e as S}from"../chunks/BZiHL9L3.js";import{I as it}from"../chunks/vYI-AT_7.js";import{W as st}from"../chunks/BaTN8n88.js";import{C as lt}from"../chunks/B87zT258.js";import{w as G}from"../chunks/KU08Mex1.js";import{t as I}from"../chunks/BVGCMSWJ.js";var dt=F('

Loading organization...

'),ct=F('

'),ut=F(" ",1),ft=F(' ',1);function Mt(pe,ve){He(ve,!1);const[ye,he]=Xe(),R=()=>Ye(et,"$page",ye),w=l();let a=l(null),c=l([]),p=l([]),U=l(!0),O=l(""),D=l(!1),P=l(!1),E=l(!1),T=l(!1),u=l(null),M=null,b=l();async function V(){if(e(w))try{o(U,!0),o(O,"");const[t,n,r]=await Promise.all([_.getOrganization(e(w)),_.listOrganizationPools(e(w)).catch(()=>[]),_.listOrganizationInstances(e(w)).catch(()=>[])]);o(a,t),o(c,n),o(p,r)}catch(t){o(O,S(t))}finally{o(U,!1)}}function _e(t,n){const{events:r}=t;return{...n,events:r}}async function be(t){if(e(a))try{await _.updateOrganization(e(a).id,t),await V(),I.success("Organization Updated",`Organization ${e(a).name} has been updated successfully.`),o(D,!1)}catch(n){throw n}}async function ze(){if(e(a)){try{await _.deleteOrganization(e(a).id),fe(A("/organizations"))}catch(t){const n=S(t);I.error("Delete Failed",n)}o(P,!1)}}async function $e(){if(e(u))try{await _.deleteInstance(e(u).name),I.success("Instance Deleted",`Instance ${e(u).name} has been deleted successfully.`),o(E,!1),o(u,null)}catch(t){const n=S(t);I.error("Delete Failed",n),o(E,!1),o(u,null)}}function xe(t){o(u,t),o(E,!0)}function Ie(){o(T,!0)}async function we(t){try{if(!e(a))return;await _.createOrganizationPool(e(a).id,t.detail),I.success("Pool Created",`Pool has been created successfully for organization ${e(a).name}.`),o(T,!1)}catch(n){const r=S(n);I.error("Pool Creation Failed",r)}}function J(){e(b)&&Qe(b,e(b).scrollTop=e(b).scrollHeight)}function Ee(t){if(t.operation==="update"){const n=t.payload;if(e(a)&&n.id===e(a).id){const r=e(a).events?.length||0,s=n.events?.length||0;o(a,_e(e(a),n)),s>r&&setTimeout(()=>{J()},100)}}else if(t.operation==="delete"){const n=t.payload.id||t.payload;e(a)&&e(a).id===n&&fe(A("/organizations"))}}function Oe(t){if(!e(a))return;const n=t.payload;if(n.org_id===e(a).id){if(t.operation==="create")o(c,[...e(c),n]);else if(t.operation==="update")o(c,e(c).map(r=>r.id===n.id?n:r));else if(t.operation==="delete"){const r=n.id||n;o(c,e(c).filter(s=>s.id!==r))}}}function De(t){if(!e(a)||!e(c))return;const n=t.payload;if(e(c).some(s=>s.id===n.pool_id)){if(t.operation==="create")o(p,[...e(p),n]);else if(t.operation==="update")o(p,e(p).map(s=>s.id===n.id?n:s));else if(t.operation==="delete"){const s=n.id||n;o(p,e(p).filter(W=>W.id!==s))}}}je(()=>{V().then(()=>{e(a)?.events?.length&&setTimeout(()=>{J()},100)});const t=G.subscribeToEntity("organization",["update","delete"],Ee),n=G.subscribeToEntity("pool",["create","update","delete"],Oe),r=G.subscribeToEntity("instance",["create","update","delete"],De);M=()=>{t(),n(),r()}}),Ge(()=>{M&&(M(),M=null)}),Re(()=>R(),()=>{o(w,R().params.id)}),Ve(),qe();var K=ft();We(t=>{j(()=>Ke.title=`${e(a),i(()=>e(a)?`${e(a).name} - Organization Details`:"Organization Details")??""} - GARM`)});var B=k(K),L=f(B),Q=f(L),N=f(Q),Pe=f(N);m(N);var X=d(N,2),Y=f(X),Z=d(f(Y),2),Te=f(Z,!0);m(Z),m(Y),m(X),m(Q),m(L);var Me=d(L,2);{var Ce=t=>{var n=dt();x(t,n)},ke=t=>{var n=ce(),r=k(n);{var s=z=>{var $=ct(),C=f($),q=f(C,!0);m(C),m($),j(()=>de(q,e(O))),x(z,$)},W=z=>{var $=ce(),C=k($);{var q=H=>{var ne=ut(),oe=k(ne);{let v=g(()=>(e(a),i(()=>e(a).name||"Organization"))),y=g(()=>(e(a),i(()=>e(a).endpoint?.name))),Ne=g(()=>(ue(ge),e(a),i(()=>ge(e(a).endpoint?.endpoint_type||"unknown"))));rt(oe,{get title(){return e(v)},get subtitle(){return`Endpoint: ${e(y)??""}`},get forgeIcon(){return e(Ne)},onEdit:()=>o(D,!0),onDelete:()=>o(P,!0)})}var re=d(oe,2);at(re,{get entity(){return e(a)},entityType:"organization"});var ie=d(re,2);{let v=g(()=>(e(a),i(()=>e(a).id||""))),y=g(()=>(e(a),i(()=>e(a).name||"")));st(ie,{entityType:"organization",get entityId(){return e(v)},get entityName(){return e(y)}})}var se=d(ie,2);{let v=g(()=>(e(a),i(()=>e(a).id||""))),y=g(()=>(e(a),i(()=>e(a).name||"")));nt(se,{get pools(){return e(c)},entityType:"organization",get entityId(){return e(v)},get entityName(){return e(y)},$$events:{addPool:Ie}})}var le=d(se,2);it(le,{get instances(){return e(p)},entityType:"organization",onDeleteInstance:xe});var Le=d(le,2);{let v=g(()=>(e(a),i(()=>e(a)?.events)));ot(Le,{get events(){return e(v)},get eventsContainer(){return e(b)},set eventsContainer(y){o(b,y)},$$legacy:!0})}x(H,ne)};h(C,H=>{e(a)&&H(q)},!0)}x(z,$)};h(r,z=>{e(O)?z(s):z(W,!1)},!0)}x(t,n)};h(Me,t=>{e(U)?t(Ce):t(ke,!1)})}m(B);var ee=d(B,2);{var Ae=t=>{tt(t,{get entity(){return e(a)},entityType:"organization",$$events:{close:()=>o(D,!1),submit:n=>be(n.detail)}})};h(ee,t=>{e(D)&&e(a)&&t(Ae)})}var te=d(ee,2);{var Se=t=>{me(t,{title:"Delete Organization",message:"Are you sure you want to delete this organization? This action cannot be undone and will remove all associated pools and instances.",get itemName(){return e(a),i(()=>e(a).name)},$$events:{close:()=>o(P,!1),confirm:ze}})};h(te,t=>{e(P)&&e(a)&&t(Se)})}var ae=d(te,2);{var Fe=t=>{me(t,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return e(u),i(()=>e(u).name)},$$events:{close:()=>{o(E,!1),o(u,null)},confirm:$e}})};h(ae,t=>{e(E)&&e(u)&&t(Fe)})}var Ue=d(ae,2);{var Be=t=>{{let n=g(()=>(e(a),i(()=>e(a).id||"")));lt(t,{initialEntityType:"organization",get initialEntityId(){return e(n)},$$events:{close:()=>o(T,!1),submit:we}})}};h(Ue,t=>{e(T)&&e(a)&&t(Be)})}j(t=>{Ze(Pe,"href",t),de(Te,(e(a),i(()=>e(a)?e(a).name:"Loading...")))},[()=>(ue(A),i(()=>A("/organizations")))]),x(pe,K),Je(),he()}export{Mt as component}; +import{f as F,h as We,a as x,s as de,c as ce}from"../chunks/ZGz3X54u.js";import{i as qe}from"../chunks/CY7Wcm-1.js";import{p as He,o as je,q as Ge,l as Re,b as Ve,f as k,t as j,a as Je,u as i,h as ue,g as e,m as l,c as f,s as d,d as o,$ as Ke,r as m,j as Qe,i as g}from"../chunks/kDtaAWAK.js";import{i as h,s as Xe,a as Ye}from"../chunks/Cun6jNAp.js";import{d as A,c as Ze,g as _}from"../chunks/CYK-UalN.js";import{p as et}from"../chunks/DXEzcvud.js";import{g as fe}from"../chunks/C8dZhfFx.js";import{U as tt}from"../chunks/6aKjRj0k.js";import{D as me}from"../chunks/Dxx83T0m.js";import{E as at,P as nt,a as ot}from"../chunks/DQfnVUrv.js";import{D as rt}from"../chunks/BrlhCerN.js";import{g as ge}from"../chunks/ZelbukuJ.js";import{e as S}from"../chunks/BZiHL9L3.js";import{I as it}from"../chunks/B9RC0dq5.js";import{W as st}from"../chunks/C681KorI.js";import{C as lt}from"../chunks/xMqsWuAL.js";import{w as G}from"../chunks/KU08Mex1.js";import{t as I}from"../chunks/BVGCMSWJ.js";var dt=F('

Loading organization...

'),ct=F('

'),ut=F(" ",1),ft=F(' ',1);function Mt(pe,ve){He(ve,!1);const[ye,he]=Xe(),R=()=>Ye(et,"$page",ye),w=l();let a=l(null),c=l([]),p=l([]),U=l(!0),O=l(""),D=l(!1),P=l(!1),E=l(!1),T=l(!1),u=l(null),M=null,b=l();async function V(){if(e(w))try{o(U,!0),o(O,"");const[t,n,r]=await Promise.all([_.getOrganization(e(w)),_.listOrganizationPools(e(w)).catch(()=>[]),_.listOrganizationInstances(e(w)).catch(()=>[])]);o(a,t),o(c,n),o(p,r)}catch(t){o(O,S(t))}finally{o(U,!1)}}function _e(t,n){const{events:r}=t;return{...n,events:r}}async function be(t){if(e(a))try{await _.updateOrganization(e(a).id,t),await V(),I.success("Organization Updated",`Organization ${e(a).name} has been updated successfully.`),o(D,!1)}catch(n){throw n}}async function ze(){if(e(a)){try{await _.deleteOrganization(e(a).id),fe(A("/organizations"))}catch(t){const n=S(t);I.error("Delete Failed",n)}o(P,!1)}}async function $e(){if(e(u))try{await _.deleteInstance(e(u).name),I.success("Instance Deleted",`Instance ${e(u).name} has been deleted successfully.`),o(E,!1),o(u,null)}catch(t){const n=S(t);I.error("Delete Failed",n),o(E,!1),o(u,null)}}function xe(t){o(u,t),o(E,!0)}function Ie(){o(T,!0)}async function we(t){try{if(!e(a))return;await _.createOrganizationPool(e(a).id,t.detail),I.success("Pool Created",`Pool has been created successfully for organization ${e(a).name}.`),o(T,!1)}catch(n){const r=S(n);I.error("Pool Creation Failed",r)}}function J(){e(b)&&Qe(b,e(b).scrollTop=e(b).scrollHeight)}function Ee(t){if(t.operation==="update"){const n=t.payload;if(e(a)&&n.id===e(a).id){const r=e(a).events?.length||0,s=n.events?.length||0;o(a,_e(e(a),n)),s>r&&setTimeout(()=>{J()},100)}}else if(t.operation==="delete"){const n=t.payload.id||t.payload;e(a)&&e(a).id===n&&fe(A("/organizations"))}}function Oe(t){if(!e(a))return;const n=t.payload;if(n.org_id===e(a).id){if(t.operation==="create")o(c,[...e(c),n]);else if(t.operation==="update")o(c,e(c).map(r=>r.id===n.id?n:r));else if(t.operation==="delete"){const r=n.id||n;o(c,e(c).filter(s=>s.id!==r))}}}function De(t){if(!e(a)||!e(c))return;const n=t.payload;if(e(c).some(s=>s.id===n.pool_id)){if(t.operation==="create")o(p,[...e(p),n]);else if(t.operation==="update")o(p,e(p).map(s=>s.id===n.id?n:s));else if(t.operation==="delete"){const s=n.id||n;o(p,e(p).filter(W=>W.id!==s))}}}je(()=>{V().then(()=>{e(a)?.events?.length&&setTimeout(()=>{J()},100)});const t=G.subscribeToEntity("organization",["update","delete"],Ee),n=G.subscribeToEntity("pool",["create","update","delete"],Oe),r=G.subscribeToEntity("instance",["create","update","delete"],De);M=()=>{t(),n(),r()}}),Ge(()=>{M&&(M(),M=null)}),Re(()=>R(),()=>{o(w,R().params.id)}),Ve(),qe();var K=ft();We(t=>{j(()=>Ke.title=`${e(a),i(()=>e(a)?`${e(a).name} - Organization Details`:"Organization Details")??""} - GARM`)});var B=k(K),L=f(B),Q=f(L),N=f(Q),Pe=f(N);m(N);var X=d(N,2),Y=f(X),Z=d(f(Y),2),Te=f(Z,!0);m(Z),m(Y),m(X),m(Q),m(L);var Me=d(L,2);{var Ce=t=>{var n=dt();x(t,n)},ke=t=>{var n=ce(),r=k(n);{var s=z=>{var $=ct(),C=f($),q=f(C,!0);m(C),m($),j(()=>de(q,e(O))),x(z,$)},W=z=>{var $=ce(),C=k($);{var q=H=>{var ne=ut(),oe=k(ne);{let v=g(()=>(e(a),i(()=>e(a).name||"Organization"))),y=g(()=>(e(a),i(()=>e(a).endpoint?.name))),Ne=g(()=>(ue(ge),e(a),i(()=>ge(e(a).endpoint?.endpoint_type||"unknown"))));rt(oe,{get title(){return e(v)},get subtitle(){return`Endpoint: ${e(y)??""}`},get forgeIcon(){return e(Ne)},onEdit:()=>o(D,!0),onDelete:()=>o(P,!0)})}var re=d(oe,2);at(re,{get entity(){return e(a)},entityType:"organization"});var ie=d(re,2);{let v=g(()=>(e(a),i(()=>e(a).id||""))),y=g(()=>(e(a),i(()=>e(a).name||"")));st(ie,{entityType:"organization",get entityId(){return e(v)},get entityName(){return e(y)}})}var se=d(ie,2);{let v=g(()=>(e(a),i(()=>e(a).id||""))),y=g(()=>(e(a),i(()=>e(a).name||"")));nt(se,{get pools(){return e(c)},entityType:"organization",get entityId(){return e(v)},get entityName(){return e(y)},$$events:{addPool:Ie}})}var le=d(se,2);it(le,{get instances(){return e(p)},entityType:"organization",onDeleteInstance:xe});var Le=d(le,2);{let v=g(()=>(e(a),i(()=>e(a)?.events)));ot(Le,{get events(){return e(v)},get eventsContainer(){return e(b)},set eventsContainer(y){o(b,y)},$$legacy:!0})}x(H,ne)};h(C,H=>{e(a)&&H(q)},!0)}x(z,$)};h(r,z=>{e(O)?z(s):z(W,!1)},!0)}x(t,n)};h(Me,t=>{e(U)?t(Ce):t(ke,!1)})}m(B);var ee=d(B,2);{var Ae=t=>{tt(t,{get entity(){return e(a)},entityType:"organization",$$events:{close:()=>o(D,!1),submit:n=>be(n.detail)}})};h(ee,t=>{e(D)&&e(a)&&t(Ae)})}var te=d(ee,2);{var Se=t=>{me(t,{title:"Delete Organization",message:"Are you sure you want to delete this organization? This action cannot be undone and will remove all associated pools and instances.",get itemName(){return e(a),i(()=>e(a).name)},$$events:{close:()=>o(P,!1),confirm:ze}})};h(te,t=>{e(P)&&e(a)&&t(Se)})}var ae=d(te,2);{var Fe=t=>{me(t,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return e(u),i(()=>e(u).name)},$$events:{close:()=>{o(E,!1),o(u,null)},confirm:$e}})};h(ae,t=>{e(E)&&e(u)&&t(Fe)})}var Ue=d(ae,2);{var Be=t=>{{let n=g(()=>(e(a),i(()=>e(a).id||"")));lt(t,{initialEntityType:"organization",get initialEntityId(){return e(n)},$$events:{close:()=>o(T,!1),submit:we}})}};h(Ue,t=>{e(T)&&e(a)&&t(Be)})}j(t=>{Ze(Pe,"href",t),de(Te,(e(a),i(()=>e(a)?e(a).name:"Loading...")))},[()=>(ue(A),i(()=>A("/organizations")))]),x(pe,K),Je(),he()}export{Mt as component}; diff --git a/webapp/assets/_app/immutable/nodes/15.D2oFYgN3.js b/webapp/assets/_app/immutable/nodes/15.BA3p6CkM.js similarity index 87% rename from webapp/assets/_app/immutable/nodes/15.D2oFYgN3.js rename to webapp/assets/_app/immutable/nodes/15.BA3p6CkM.js index 74b83b68..c00fa364 100644 --- a/webapp/assets/_app/immutable/nodes/15.D2oFYgN3.js +++ b/webapp/assets/_app/immutable/nodes/15.BA3p6CkM.js @@ -1 +1 @@ -import{f as J,h as ye,a as V}from"../chunks/ZGz3X54u.js";import{i as he}from"../chunks/CY7Wcm-1.js";import{p as Pe,o as ve,l as p,b as Ce,f as _e,a as $e,g as t,m as r,$ as be,c as q,i as w,u as H,s as y,d as o,r as j,h as Me}from"../chunks/kDtaAWAK.js";import{i as _,s as Te,a as De}from"../chunks/Cun6jNAp.js";import{g as k}from"../chunks/Cvcp5xHB.js";import{P as Ee}from"../chunks/CLZesvzF.js";import{C as we}from"../chunks/B87zT258.js";import{U as ke}from"../chunks/CUtPzwFi.js";import{D as Ae}from"../chunks/lQWw1Z23.js";import{M as Ie}from"../chunks/C6jYEeWP.js";import{D as Se,G as A,L as xe}from"../chunks/Cfdue6T6.js";import{e as Fe,a as z}from"../chunks/C2c_wqo6.js";import{t as m}from"../chunks/BVGCMSWJ.js";import{e as $,h as Ue}from"../chunks/DNHT2U_W.js";import{e as b}from"../chunks/BZiHL9L3.js";import{E as Le}from"../chunks/CEJvqnOn.js";import{E as Ne}from"../chunks/C-3AL0iB.js";import{S as Re}from"../chunks/BTeTCgJA.js";import{A as Ge}from"../chunks/Cs0pYghy.js";import{P as Ve}from"../chunks/DuwadzDF.js";import"../chunks/CkTG2UXI.js";const B={};var qe=J('
'),He=J('
',1);function dt(K,O){Pe(O,!1);const[Q,W]=Te(),s=()=>De(Fe,"$eagerCache",Q),M=r(),c=r(),u=r(),I=r();let f=r([]),h=r(!0),S=r(""),P=r(""),n=r(1),d=r(25),v=r(!1),C=r(!1),g=r(!1),a=r(null),T=r(!1);async function X(e){try{m.success("Pool Created","Pool has been created successfully."),o(v,!1)}catch(l){const i=b(l);m.error("Pool Creation Failed",i)}}async function Y(e){if(t(a))try{await k.updatePool(t(a).id,e),o(C,!1),m.add({type:"success",title:"Pool Updated",message:`Pool ${t(a).id.slice(0,8)}... has been updated successfully.`}),o(a,null)}catch(l){const i=b(l);throw m.add({type:"error",title:"Update Failed",message:i}),l}}async function Z(){if(!t(a))return;const e=`Pool ${t(a).id.slice(0,8)}...`;try{await k.deletePool(t(a).id),o(g,!1),m.add({type:"success",title:"Pool Deleted",message:`${e} has been deleted successfully.`}),o(a,null)}catch(l){const i=b(l);m.add({type:"error",title:"Delete Failed",message:i})}o(g,!1),o(a,null)}function ee(){o(v,!0)}async function x(e){try{o(T,!0);const l=await k.getPool(e.id);o(a,l),o(C,!0)}catch(l){const i=b(l);m.error("Failed to Load Pool Details",i)}finally{o(T,!1)}}function F(e){o(a,e),o(g,!0)}ve(async()=>{try{o(h,!0);const e=await z.getPools();e&&Array.isArray(e)&&o(f,e)}catch(e){B?.VITEST||console.error("Failed to load pools:",e),o(S,e instanceof Error?e.message:"Failed to load pools")}finally{o(h,!1)}});async function te(){try{await z.retryResource("pools")}catch(e){B?.VITEST||console.error("Retry failed:",e)}}const oe=[{key:"id",title:"ID",flexible:!0,cellComponent:Le,cellProps:{entityType:"pool",showId:!0,fontMono:!0}},{key:"image",title:"Image",flexible:!0,cellComponent:A,cellProps:{field:"image",type:"code",showTitle:!0}},{key:"provider",title:"Provider",cellComponent:A,cellProps:{field:"provider_name"}},{key:"flavor",title:"Flavor",cellComponent:A,cellProps:{field:"flavor"}},{key:"entity",title:"Entity",cellComponent:Ve},{key:"endpoint",title:"Endpoint",cellComponent:Ne},{key:"status",title:"Status",cellComponent:Re,cellProps:{statusType:"enabled"}},{key:"actions",title:"Actions",align:"right",cellComponent:Ge}],ae={entityType:"pool",primaryText:{field:"id",isClickable:!0,href:"/pools/{id}",useId:!0,isMonospace:!0},secondaryText:{field:"entity_name",computedValue:e=>$(e,s())},badges:[{type:"custom",value:e=>({variant:e.enabled?"success":"error",text:e.enabled?"Enabled":"Disabled"})}],actions:[{type:"edit",handler:e=>x(e)},{type:"delete",handler:e=>F(e)}]};function le(e){o(P,e.detail.term),o(n,1)}function re(e){o(n,e.detail.page)}function se(e){o(d,e.detail.perPage),o(n,1)}function ne(e){x(e.detail.item)}function ie(e){F(e.detail.item)}p(()=>(t(f),s()),()=>{(!t(f).length||s().loaded.pools)&&o(f,s().pools)}),p(()=>s(),()=>{o(h,s().loading.pools)}),p(()=>s(),()=>{o(M,s().errorMessages.pools)}),p(()=>(t(f),t(P),s()),()=>{o(c,Ue(t(f),t(P),e=>$(e,s())))}),p(()=>(t(c),t(d)),()=>{o(u,Math.ceil(t(c).length/t(d)))}),p(()=>(t(n),t(u)),()=>{t(n)>t(u)&&t(u)>0&&o(n,t(u))}),p(()=>(t(c),t(n),t(d)),()=>{o(I,t(c).slice((t(n)-1)*t(d),t(n)*t(d)))}),Ce(),he();var U=He();ye(e=>{be.title="Pools - GARM"});var D=_e(U),L=q(D);Ee(L,{title:"Pools",description:"Manage runner pools across all entities",actionLabel:"Add Pool",$$events:{action:ee}});var ce=y(L,2);{let e=w(()=>t(M)||t(S)),l=w(()=>!!t(M));Se(ce,{get columns(){return oe},get data(){return t(I)},get loading(){return t(h)},get error(){return t(e)},get searchTerm(){return t(P)},searchPlaceholder:"Search by entity name...",get currentPage(){return t(n)},get perPage(){return t(d)},get totalPages(){return t(u)},get totalItems(){return t(c),H(()=>t(c).length)},itemName:"pools",emptyIconType:"cog",get showRetry(){return t(l)},get mobileCardConfig(){return ae},$$events:{search:le,pageChange:re,perPageChange:se,retry:te,edit:ne,delete:ie}})}j(D);var N=y(D,2);{var de=e=>{we(e,{$$events:{close:()=>o(v,!1),submit:X}})};_(N,e=>{t(v)&&e(de)})}var R=y(N,2);{var pe=e=>{ke(e,{get pool(){return t(a)},$$events:{close:()=>{o(C,!1),o(a,null)},submit:l=>Y(l.detail)}})};_(R,e=>{t(C)&&t(a)&&e(pe)})}var G=y(R,2);{var me=e=>{{let l=w(()=>(t(a),Me($),s(),H(()=>`Pool ${t(a).id.slice(0,8)}... (${$(t(a),s())})`)));Ae(e,{title:"Delete Pool",message:"Are you sure you want to delete this pool? This action cannot be undone and will remove all associated runners.",get itemName(){return t(l)},$$events:{close:()=>{o(g,!1),o(a,null)},confirm:Z}})}};_(G,e=>{t(g)&&t(a)&&e(me)})}var ue=y(G,2);{var fe=e=>{Ie(e,{$$events:{close:()=>{}},children:(l,i)=>{var E=qe(),ge=q(E);xe(ge,{message:"Loading pool details..."}),j(E),V(l,E)},$$slots:{default:!0}})};_(ue,e=>{t(T)&&e(fe)})}V(K,U),$e(),W()}export{dt as component}; +import{f as J,h as ye,a as V}from"../chunks/ZGz3X54u.js";import{i as he}from"../chunks/CY7Wcm-1.js";import{p as Pe,o as ve,l as p,b as Ce,f as _e,a as $e,g as t,m as r,$ as be,c as q,i as w,u as H,s as y,d as o,r as j,h as Me}from"../chunks/kDtaAWAK.js";import{i as _,s as Te,a as De}from"../chunks/Cun6jNAp.js";import{g as k}from"../chunks/CYK-UalN.js";import{P as Ee}from"../chunks/DacI6VAP.js";import{C as we}from"../chunks/xMqsWuAL.js";import{U as ke}from"../chunks/Bmm5UxxZ.js";import{D as Ae}from"../chunks/Dxx83T0m.js";import{M as Ie}from"../chunks/CVBpH3Sf.js";import{D as Se,G as A,L as xe}from"../chunks/BKeluGSY.js";import{e as Fe,a as z}from"../chunks/Vo3Mv3dp.js";import{t as m}from"../chunks/BVGCMSWJ.js";import{e as $,h as Ue}from"../chunks/ZelbukuJ.js";import{e as b}from"../chunks/BZiHL9L3.js";import{E as Le}from"../chunks/Dd4NFVf9.js";import{E as Ne}from"../chunks/oWoYyEl8.js";import{S as Re}from"../chunks/BStwtkX8.js";import{A as Ge}from"../chunks/rb89c4PS.js";import{P as Ve}from"../chunks/CiCSB29J.js";import"../chunks/DWgB-t1g.js";const B={};var qe=J('
'),He=J('
',1);function dt(K,O){Pe(O,!1);const[Q,W]=Te(),s=()=>De(Fe,"$eagerCache",Q),M=r(),c=r(),u=r(),I=r();let f=r([]),h=r(!0),S=r(""),P=r(""),n=r(1),d=r(25),v=r(!1),C=r(!1),g=r(!1),a=r(null),T=r(!1);async function X(e){try{m.success("Pool Created","Pool has been created successfully."),o(v,!1)}catch(l){const i=b(l);m.error("Pool Creation Failed",i)}}async function Y(e){if(t(a))try{await k.updatePool(t(a).id,e),o(C,!1),m.add({type:"success",title:"Pool Updated",message:`Pool ${t(a).id.slice(0,8)}... has been updated successfully.`}),o(a,null)}catch(l){const i=b(l);throw m.add({type:"error",title:"Update Failed",message:i}),l}}async function Z(){if(!t(a))return;const e=`Pool ${t(a).id.slice(0,8)}...`;try{await k.deletePool(t(a).id),o(g,!1),m.add({type:"success",title:"Pool Deleted",message:`${e} has been deleted successfully.`}),o(a,null)}catch(l){const i=b(l);m.add({type:"error",title:"Delete Failed",message:i})}o(g,!1),o(a,null)}function ee(){o(v,!0)}async function x(e){try{o(T,!0);const l=await k.getPool(e.id);o(a,l),o(C,!0)}catch(l){const i=b(l);m.error("Failed to Load Pool Details",i)}finally{o(T,!1)}}function F(e){o(a,e),o(g,!0)}ve(async()=>{try{o(h,!0);const e=await z.getPools();e&&Array.isArray(e)&&o(f,e)}catch(e){B?.VITEST||console.error("Failed to load pools:",e),o(S,e instanceof Error?e.message:"Failed to load pools")}finally{o(h,!1)}});async function te(){try{await z.retryResource("pools")}catch(e){B?.VITEST||console.error("Retry failed:",e)}}const oe=[{key:"id",title:"ID",flexible:!0,cellComponent:Le,cellProps:{entityType:"pool",showId:!0,fontMono:!0}},{key:"image",title:"Image",flexible:!0,cellComponent:A,cellProps:{field:"image",type:"code",showTitle:!0}},{key:"provider",title:"Provider",cellComponent:A,cellProps:{field:"provider_name"}},{key:"flavor",title:"Flavor",cellComponent:A,cellProps:{field:"flavor"}},{key:"entity",title:"Entity",cellComponent:Ve},{key:"endpoint",title:"Endpoint",cellComponent:Ne},{key:"status",title:"Status",cellComponent:Re,cellProps:{statusType:"enabled"}},{key:"actions",title:"Actions",align:"right",cellComponent:Ge}],ae={entityType:"pool",primaryText:{field:"id",isClickable:!0,href:"/pools/{id}",useId:!0,isMonospace:!0},secondaryText:{field:"entity_name",computedValue:e=>$(e,s())},badges:[{type:"custom",value:e=>({variant:e.enabled?"success":"error",text:e.enabled?"Enabled":"Disabled"})}],actions:[{type:"edit",handler:e=>x(e)},{type:"delete",handler:e=>F(e)}]};function le(e){o(P,e.detail.term),o(n,1)}function re(e){o(n,e.detail.page)}function se(e){o(d,e.detail.perPage),o(n,1)}function ne(e){x(e.detail.item)}function ie(e){F(e.detail.item)}p(()=>(t(f),s()),()=>{(!t(f).length||s().loaded.pools)&&o(f,s().pools)}),p(()=>s(),()=>{o(h,s().loading.pools)}),p(()=>s(),()=>{o(M,s().errorMessages.pools)}),p(()=>(t(f),t(P),s()),()=>{o(c,Ue(t(f),t(P),e=>$(e,s())))}),p(()=>(t(c),t(d)),()=>{o(u,Math.ceil(t(c).length/t(d)))}),p(()=>(t(n),t(u)),()=>{t(n)>t(u)&&t(u)>0&&o(n,t(u))}),p(()=>(t(c),t(n),t(d)),()=>{o(I,t(c).slice((t(n)-1)*t(d),t(n)*t(d)))}),Ce(),he();var U=He();ye(e=>{be.title="Pools - GARM"});var D=_e(U),L=q(D);Ee(L,{title:"Pools",description:"Manage runner pools across all entities",actionLabel:"Add Pool",$$events:{action:ee}});var ce=y(L,2);{let e=w(()=>t(M)||t(S)),l=w(()=>!!t(M));Se(ce,{get columns(){return oe},get data(){return t(I)},get loading(){return t(h)},get error(){return t(e)},get searchTerm(){return t(P)},searchPlaceholder:"Search by entity name...",get currentPage(){return t(n)},get perPage(){return t(d)},get totalPages(){return t(u)},get totalItems(){return t(c),H(()=>t(c).length)},itemName:"pools",emptyIconType:"cog",get showRetry(){return t(l)},get mobileCardConfig(){return ae},$$events:{search:le,pageChange:re,perPageChange:se,retry:te,edit:ne,delete:ie}})}j(D);var N=y(D,2);{var de=e=>{we(e,{$$events:{close:()=>o(v,!1),submit:X}})};_(N,e=>{t(v)&&e(de)})}var R=y(N,2);{var pe=e=>{ke(e,{get pool(){return t(a)},$$events:{close:()=>{o(C,!1),o(a,null)},submit:l=>Y(l.detail)}})};_(R,e=>{t(C)&&t(a)&&e(pe)})}var G=y(R,2);{var me=e=>{{let l=w(()=>(t(a),Me($),s(),H(()=>`Pool ${t(a).id.slice(0,8)}... (${$(t(a),s())})`)));Ae(e,{title:"Delete Pool",message:"Are you sure you want to delete this pool? This action cannot be undone and will remove all associated runners.",get itemName(){return t(l)},$$events:{close:()=>{o(g,!1),o(a,null)},confirm:Z}})}};_(G,e=>{t(g)&&t(a)&&e(me)})}var ue=y(G,2);{var fe=e=>{Ie(e,{$$events:{close:()=>{}},children:(l,i)=>{var E=qe(),ge=q(E);xe(ge,{message:"Loading pool details..."}),j(E),V(l,E)},$$slots:{default:!0}})};_(ue,e=>{t(T)&&e(fe)})}V(K,U),$e(),W()}export{dt as component}; diff --git a/webapp/assets/_app/immutable/nodes/16.CnTD7yhj.js b/webapp/assets/_app/immutable/nodes/16.NNUit-Zw.js similarity index 96% rename from webapp/assets/_app/immutable/nodes/16.CnTD7yhj.js rename to webapp/assets/_app/immutable/nodes/16.NNUit-Zw.js index 15f834bb..5ed40a0b 100644 --- a/webapp/assets/_app/immutable/nodes/16.CnTD7yhj.js +++ b/webapp/assets/_app/immutable/nodes/16.NNUit-Zw.js @@ -1 +1 @@ -import{f as _,h as Ze,a as u,s as o,c as ee}from"../chunks/ZGz3X54u.js";import{i as ta}from"../chunks/CY7Wcm-1.js";import{p as ea,o as aa,q as ra,l as da,b as sa,f as B,t as h,a as ia,u as i,h as g,g as t,m as k,c as r,s,d as v,$ as la,r as a,j as M,i as E}from"../chunks/kDtaAWAK.js";import{i as f}from"../chunks/Cun6jNAp.js";import{e as oa,i as na}from"../chunks/DdT9Vz5Q.js";import{d as P,c as _t,g as C,s as ae}from"../chunks/Cvcp5xHB.js";import{p as re}from"../chunks/DH5setay.js";import{g as de}from"../chunks/BU_V7FOQ.js";import{U as va}from"../chunks/CUtPzwFi.js";import{D as se}from"../chunks/lQWw1Z23.js";import{I as ma}from"../chunks/vYI-AT_7.js";import{D as ca}from"../chunks/CRSOHHg7.js";import{w as ie}from"../chunks/KU08Mex1.js";import{t as T}from"../chunks/BVGCMSWJ.js";import{e as D,i as L,j as le,b as O,g as oe}from"../chunks/DNHT2U_W.js";import{e as G}from"../chunks/BZiHL9L3.js";import{F as xa}from"../chunks/JRrg5LRu.js";var ua=_('

Loading pool...

'),ga=_('

'),fa=_('
Runner Install Template
'),pa=_('
GitHub Runner Group
'),_a=_(' '),ya=_('
Tags
'),ba=_('

Extra Specifications

 
'),ha=_('

Basic Information

Pool ID
Provider
Forge Type
Image
Flavor
Status
Entity
Created At
Updated At

Configuration

Max Runners
Min Idle Runners
Bootstrap Timeout
Priority
Runner Prefix
OS Type / Architecture
Shell Access
',1),ka=_(' ',1);function Oa(ne,ve){ea(ve,!1);const J=k();let e=k(null),j=k(!0),A=k(""),F=k(!1),S=k(!1),U=k(!1),p=k(null),N=null;async function me(){if(t(J))try{v(j,!0),v(A,""),v(e,await C.getPool(t(J))),t(e).instances||M(e,t(e).instances=[])}catch(d){v(A,G(d))}finally{v(j,!1)}}async function ce(d){if(t(e))try{const l=await C.updatePool(t(e).id,d);v(e,l),v(F,!1),T.success("Pool Updated",`Pool ${t(e).id} has been updated successfully.`)}catch(l){const y=G(l);T.error("Update Failed",y)}}async function xe(){if(t(e)){try{await C.deletePool(t(e).id),de(P("/pools"))}catch(d){const l=G(d);T.error("Delete Failed",l)}v(S,!1)}}async function ue(){if(t(p)){try{await C.deleteInstance(t(p).name),T.success("Instance Deleted",`Instance ${t(p).name} has been deleted successfully.`)}catch(d){const l=G(d);T.error("Delete Failed",l)}v(U,!1),v(p,null)}}function ge(d){v(p,d),v(U,!0)}function fe(d){if(!d)return"{}";try{if(typeof d=="string"){const l=JSON.parse(d);return JSON.stringify(l,null,2)}return JSON.stringify(d,null,2)}catch{return d.toString()}}function pe(d){if(d.operation==="update"){const l=d.payload;t(e)&&l.id===t(e).id&&v(e,l)}else if(d.operation==="delete"){const l=d.payload.id||d.payload;t(e)&&t(e).id===l&&de(P("/pools"))}}function _e(d){if(!t(e))return;const l=d.payload;if(l.pool_id===t(e).id){if(t(e).instances||M(e,t(e).instances=[]),d.operation==="create")M(e,t(e).instances=[...t(e).instances,l]);else if(d.operation==="update")M(e,t(e).instances=t(e).instances.map(y=>y.id===l.id?l:y));else if(d.operation==="delete"){const y=l.id||l;M(e,t(e).instances=t(e).instances.filter(V=>V.id!==y))}v(e,t(e))}}aa(()=>{me();const d=ie.subscribeToEntity("pool",["update","delete"],pe),l=ie.subscribeToEntity("instance",["create","update","delete"],_e);N=()=>{d(),l()}}),ra(()=>{N&&(N(),N=null)}),da(()=>re,()=>{v(J,re.params.id)}),sa(),ta();var yt=ka();Ze(d=>{h(()=>la.title=`${t(e),i(()=>t(e)?`Pool ${t(e).id} - Pool Details`:"Pool Details")??""} - GARM`)});var q=B(yt),z=r(q),bt=r(z),H=r(bt),ye=r(H);a(H);var ht=s(H,2),kt=r(ht),wt=s(r(kt),2),be=r(wt,!0);a(wt),a(kt),a(ht),a(bt),a(z);var he=s(z,2);{var ke=d=>{var l=ua();u(d,l)},we=d=>{var l=ee(),y=B(l);{var V=$=>{var I=ga(),R=r(I),W=r(R,!0);a(R),a(I),h(()=>o(W,t(A))),u($,I)},Me=$=>{var I=ee(),R=B(I);{var W=K=>{var Pt=ha(),Dt=B(Pt);{let n=E(()=>(g(D),t(e),i(()=>D(t(e))))),m=E(()=>(g(L),t(e),i(()=>L(t(e))))),c=E(()=>(g(oe),t(e),i(()=>oe(t(e).endpoint?.endpoint_type||"unknown"))));ca(Dt,{get title(){return t(e),i(()=>t(e).id)},get subtitle(){return`Pool for ${t(n)??""} (${t(m)??""})`},get forgeIcon(){return t(c)},onEdit:()=>v(F,!0),onDelete:()=>v(S,!0)})}var Q=s(Dt,2),X=r(Q),Mt=r(X),Et=s(r(Mt),2),Y=r(Et),Tt=s(r(Y),2),Ee=r(Tt,!0);a(Tt),a(Y);var Z=s(Y,2),At=s(r(Z),2),Te=r(At,!0);a(At),a(Z);var tt=s(Z,2),Ft=s(r(tt),2),Ae=r(Ft);xa(Ae,{get item(){return t(e)}}),a(Ft),a(tt);var et=s(tt,2),St=s(r(et),2),Ut=r(St),Fe=r(Ut,!0);a(Ut),a(St),a(et);var at=s(et,2),Nt=s(r(at),2),Se=r(Nt,!0);a(Nt),a(at);var rt=s(at,2),Rt=s(r(rt),2),dt=r(Rt),Ue=r(dt,!0);a(dt),a(Rt),a(rt);var st=s(rt,2),Bt=s(r(st),2),Ct=r(Bt),it=r(Ct),Ne=r(it,!0);a(it);var lt=s(it,2),Re=r(lt,!0);a(lt),a(Ct),a(Bt),a(st);var ot=s(st,2),Lt=s(r(ot),2),Be=r(Lt,!0);a(Lt),a(ot);var Ot=s(ot,2),Gt=s(r(Ot),2),Ce=r(Gt,!0);a(Gt),a(Ot),a(Et),a(Mt),a(X);var Jt=s(X,2),jt=r(Jt),qt=s(r(jt),2),nt=r(qt),zt=s(r(nt),2),Le=r(zt,!0);a(zt),a(nt);var vt=s(nt,2),Ht=s(r(vt),2),Oe=r(Ht,!0);a(Ht),a(vt);var mt=s(vt,2),Vt=s(r(mt),2),Ge=r(Vt);a(Vt),a(mt);var ct=s(mt,2),Wt=s(r(ct),2),Je=r(Wt,!0);a(Wt),a(ct);var xt=s(ct,2),Kt=s(r(xt),2),je=r(Kt,!0);a(Kt),a(xt);var ut=s(xt,2),Qt=s(r(ut),2),qe=r(Qt);a(Qt),a(ut);var gt=s(ut,2),Xt=s(r(gt),2),ft=r(Xt),ze=r(ft,!0);a(ft),a(Xt),a(gt);var Yt=s(gt,2);{var He=n=>{var m=fa(),c=s(r(m),2),x=r(c),w=r(x,!0);a(x),a(c),a(m),h(b=>{_t(x,"href",b),o(w,(t(e),i(()=>t(e).template_name)))},[()=>(g(P),t(e),i(()=>P(`/templates/${t(e).template_id}`)))]),u(n,m)};f(Yt,n=>{t(e),i(()=>t(e).template_name)&&n(He)})}var Zt=s(Yt,2);{var Ve=n=>{var m=pa(),c=s(r(m),2),x=r(c,!0);a(c),a(m),h(()=>o(x,(t(e),i(()=>t(e)["github-runner-group"])))),u(n,m)};f(Zt,n=>{t(e),i(()=>t(e)["github-runner-group"])&&n(Ve)})}var We=s(Zt,2);{var Ke=n=>{var m=ya(),c=s(r(m),2),x=r(c);oa(x,5,()=>(t(e),i(()=>t(e).tags)),na,(w,b)=>{var pt=_a(),Ye=r(pt,!0);a(pt),h(()=>o(Ye,(t(b),i(()=>typeof t(b)=="string"?t(b):t(b).name)))),u(w,pt)}),a(x),a(c),a(m),u(n,m)};f(We,n=>{t(e),i(()=>t(e).tags&&t(e).tags.length>0)&&n(Ke)})}a(qt),a(jt),a(Jt),a(Q);var te=s(Q,2);{var Qe=n=>{var m=ba(),c=r(m),x=s(r(c),2),w=r(x,!0);a(x),a(c),a(m),h(b=>o(w,b),[()=>(t(e),i(()=>fe(t(e).extra_specs)))]),u(n,m)};f(te,n=>{t(e),i(()=>t(e).extra_specs)&&n(Qe)})}var Xe=s(te,2);{let n=E(()=>(t(e),i(()=>t(e).instances||[])));ma(Xe,{get instances(){return t(n)},entityType:"pool",onDeleteInstance:ge})}h((n,m,c,x,w)=>{o(Ee,(t(e),i(()=>t(e).id))),o(Te,(t(e),i(()=>t(e).provider_name))),o(Fe,(t(e),i(()=>t(e).image))),o(Se,(t(e),i(()=>t(e).flavor))),ae(dt,1,`inline-flex px-2 py-1 text-xs font-medium rounded-full ${t(e),i(()=>t(e).enabled?"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200":"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200")??""}`),o(Ue,(t(e),i(()=>t(e).enabled?"Enabled":"Disabled"))),o(Ne,n),_t(lt,"href",m),o(Re,c),o(Be,x),o(Ce,w),o(Le,(t(e),i(()=>t(e).max_runners))),o(Oe,(t(e),i(()=>t(e).min_idle_runners))),o(Ge,`${t(e),i(()=>t(e).runner_bootstrap_timeout)??""} minutes`),o(Je,(t(e),i(()=>t(e).priority))),o(je,(t(e),i(()=>t(e).runner_prefix||"garm"))),o(qe,`${t(e),i(()=>t(e).os_type)??""} / ${t(e),i(()=>t(e).os_arch)??""}`),ae(ft,1,`inline-flex px-2 py-1 text-xs font-medium rounded-full ${t(e),i(()=>t(e).enable_shell?"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200":"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200")??""}`),o(ze,(t(e),i(()=>t(e).enable_shell?"Enabled":"Disabled")))},[()=>(g(L),t(e),i(()=>L(t(e)))),()=>(g(le),t(e),i(()=>le(t(e)))),()=>(g(D),t(e),i(()=>D(t(e)))),()=>(g(O),t(e),i(()=>O(t(e).created_at||""))),()=>(g(O),t(e),i(()=>O(t(e).updated_at||"")))]),u(K,Pt)};f(R,K=>{t(e)&&K(W)},!0)}u($,I)};f(y,$=>{t(A)?$(V):$(Me,!1)},!0)}u(d,l)};f(he,d=>{t(j)?d(ke):d(we,!1)})}a(q);var $t=s(q,2);{var $e=d=>{va(d,{get pool(){return t(e)},$$events:{close:()=>v(F,!1),submit:l=>ce(l.detail)}})};f($t,d=>{t(F)&&t(e)&&d($e)})}var It=s($t,2);{var Ie=d=>{{let l=E(()=>(t(e),g(D),i(()=>`Pool ${t(e).id} (${D(t(e))})`)));se(d,{title:"Delete Pool",message:"Are you sure you want to delete this pool? This action cannot be undone and will remove all associated runners.",get itemName(){return t(l)},$$events:{close:()=>v(S,!1),confirm:xe}})}};f(It,d=>{t(S)&&t(e)&&d(Ie)})}var Pe=s(It,2);{var De=d=>{se(d,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return t(p),i(()=>t(p).name)},$$events:{close:()=>{v(U,!1),v(p,null)},confirm:ue}})};f(Pe,d=>{t(U)&&t(p)&&d(De)})}h(d=>{_t(ye,"href",d),o(be,(t(e),i(()=>t(e)?t(e).id:"Loading...")))},[()=>(g(P),i(()=>P("/pools")))]),u(ne,yt),ia()}export{Oa as component}; +import{f as _,h as Ze,a as u,s as o,c as ee}from"../chunks/ZGz3X54u.js";import{i as ta}from"../chunks/CY7Wcm-1.js";import{p as ea,o as aa,q as ra,l as da,b as sa,f as B,t as h,a as ia,u as i,h as g,g as t,m as k,c as r,s,d as v,$ as la,r as a,j as M,i as E}from"../chunks/kDtaAWAK.js";import{i as f}from"../chunks/Cun6jNAp.js";import{e as oa,i as na}from"../chunks/DdT9Vz5Q.js";import{d as P,c as _t,g as C,s as ae}from"../chunks/CYK-UalN.js";import{p as re}from"../chunks/Bql5nQdO.js";import{g as de}from"../chunks/C8dZhfFx.js";import{U as va}from"../chunks/Bmm5UxxZ.js";import{D as se}from"../chunks/Dxx83T0m.js";import{I as ma}from"../chunks/B9RC0dq5.js";import{D as ca}from"../chunks/BrlhCerN.js";import{w as ie}from"../chunks/KU08Mex1.js";import{t as T}from"../chunks/BVGCMSWJ.js";import{e as D,i as L,j as le,b as O,g as oe}from"../chunks/ZelbukuJ.js";import{e as G}from"../chunks/BZiHL9L3.js";import{F as xa}from"../chunks/DZ2a7TNP.js";var ua=_('

Loading pool...

'),ga=_('

'),fa=_('
Runner Install Template
'),pa=_('
GitHub Runner Group
'),_a=_(' '),ya=_('
Tags
'),ba=_('

Extra Specifications

 
'),ha=_('

Basic Information

Pool ID
Provider
Forge Type
Image
Flavor
Status
Entity
Created At
Updated At

Configuration

Max Runners
Min Idle Runners
Bootstrap Timeout
Priority
Runner Prefix
OS Type / Architecture
Shell Access
',1),ka=_(' ',1);function Oa(ne,ve){ea(ve,!1);const J=k();let e=k(null),j=k(!0),A=k(""),F=k(!1),S=k(!1),U=k(!1),p=k(null),N=null;async function me(){if(t(J))try{v(j,!0),v(A,""),v(e,await C.getPool(t(J))),t(e).instances||M(e,t(e).instances=[])}catch(d){v(A,G(d))}finally{v(j,!1)}}async function ce(d){if(t(e))try{const l=await C.updatePool(t(e).id,d);v(e,l),v(F,!1),T.success("Pool Updated",`Pool ${t(e).id} has been updated successfully.`)}catch(l){const y=G(l);T.error("Update Failed",y)}}async function xe(){if(t(e)){try{await C.deletePool(t(e).id),de(P("/pools"))}catch(d){const l=G(d);T.error("Delete Failed",l)}v(S,!1)}}async function ue(){if(t(p)){try{await C.deleteInstance(t(p).name),T.success("Instance Deleted",`Instance ${t(p).name} has been deleted successfully.`)}catch(d){const l=G(d);T.error("Delete Failed",l)}v(U,!1),v(p,null)}}function ge(d){v(p,d),v(U,!0)}function fe(d){if(!d)return"{}";try{if(typeof d=="string"){const l=JSON.parse(d);return JSON.stringify(l,null,2)}return JSON.stringify(d,null,2)}catch{return d.toString()}}function pe(d){if(d.operation==="update"){const l=d.payload;t(e)&&l.id===t(e).id&&v(e,l)}else if(d.operation==="delete"){const l=d.payload.id||d.payload;t(e)&&t(e).id===l&&de(P("/pools"))}}function _e(d){if(!t(e))return;const l=d.payload;if(l.pool_id===t(e).id){if(t(e).instances||M(e,t(e).instances=[]),d.operation==="create")M(e,t(e).instances=[...t(e).instances,l]);else if(d.operation==="update")M(e,t(e).instances=t(e).instances.map(y=>y.id===l.id?l:y));else if(d.operation==="delete"){const y=l.id||l;M(e,t(e).instances=t(e).instances.filter(V=>V.id!==y))}v(e,t(e))}}aa(()=>{me();const d=ie.subscribeToEntity("pool",["update","delete"],pe),l=ie.subscribeToEntity("instance",["create","update","delete"],_e);N=()=>{d(),l()}}),ra(()=>{N&&(N(),N=null)}),da(()=>re,()=>{v(J,re.params.id)}),sa(),ta();var yt=ka();Ze(d=>{h(()=>la.title=`${t(e),i(()=>t(e)?`Pool ${t(e).id} - Pool Details`:"Pool Details")??""} - GARM`)});var q=B(yt),z=r(q),bt=r(z),H=r(bt),ye=r(H);a(H);var ht=s(H,2),kt=r(ht),wt=s(r(kt),2),be=r(wt,!0);a(wt),a(kt),a(ht),a(bt),a(z);var he=s(z,2);{var ke=d=>{var l=ua();u(d,l)},we=d=>{var l=ee(),y=B(l);{var V=$=>{var I=ga(),R=r(I),W=r(R,!0);a(R),a(I),h(()=>o(W,t(A))),u($,I)},Me=$=>{var I=ee(),R=B(I);{var W=K=>{var Pt=ha(),Dt=B(Pt);{let n=E(()=>(g(D),t(e),i(()=>D(t(e))))),m=E(()=>(g(L),t(e),i(()=>L(t(e))))),c=E(()=>(g(oe),t(e),i(()=>oe(t(e).endpoint?.endpoint_type||"unknown"))));ca(Dt,{get title(){return t(e),i(()=>t(e).id)},get subtitle(){return`Pool for ${t(n)??""} (${t(m)??""})`},get forgeIcon(){return t(c)},onEdit:()=>v(F,!0),onDelete:()=>v(S,!0)})}var Q=s(Dt,2),X=r(Q),Mt=r(X),Et=s(r(Mt),2),Y=r(Et),Tt=s(r(Y),2),Ee=r(Tt,!0);a(Tt),a(Y);var Z=s(Y,2),At=s(r(Z),2),Te=r(At,!0);a(At),a(Z);var tt=s(Z,2),Ft=s(r(tt),2),Ae=r(Ft);xa(Ae,{get item(){return t(e)}}),a(Ft),a(tt);var et=s(tt,2),St=s(r(et),2),Ut=r(St),Fe=r(Ut,!0);a(Ut),a(St),a(et);var at=s(et,2),Nt=s(r(at),2),Se=r(Nt,!0);a(Nt),a(at);var rt=s(at,2),Rt=s(r(rt),2),dt=r(Rt),Ue=r(dt,!0);a(dt),a(Rt),a(rt);var st=s(rt,2),Bt=s(r(st),2),Ct=r(Bt),it=r(Ct),Ne=r(it,!0);a(it);var lt=s(it,2),Re=r(lt,!0);a(lt),a(Ct),a(Bt),a(st);var ot=s(st,2),Lt=s(r(ot),2),Be=r(Lt,!0);a(Lt),a(ot);var Ot=s(ot,2),Gt=s(r(Ot),2),Ce=r(Gt,!0);a(Gt),a(Ot),a(Et),a(Mt),a(X);var Jt=s(X,2),jt=r(Jt),qt=s(r(jt),2),nt=r(qt),zt=s(r(nt),2),Le=r(zt,!0);a(zt),a(nt);var vt=s(nt,2),Ht=s(r(vt),2),Oe=r(Ht,!0);a(Ht),a(vt);var mt=s(vt,2),Vt=s(r(mt),2),Ge=r(Vt);a(Vt),a(mt);var ct=s(mt,2),Wt=s(r(ct),2),Je=r(Wt,!0);a(Wt),a(ct);var xt=s(ct,2),Kt=s(r(xt),2),je=r(Kt,!0);a(Kt),a(xt);var ut=s(xt,2),Qt=s(r(ut),2),qe=r(Qt);a(Qt),a(ut);var gt=s(ut,2),Xt=s(r(gt),2),ft=r(Xt),ze=r(ft,!0);a(ft),a(Xt),a(gt);var Yt=s(gt,2);{var He=n=>{var m=fa(),c=s(r(m),2),x=r(c),w=r(x,!0);a(x),a(c),a(m),h(b=>{_t(x,"href",b),o(w,(t(e),i(()=>t(e).template_name)))},[()=>(g(P),t(e),i(()=>P(`/templates/${t(e).template_id}`)))]),u(n,m)};f(Yt,n=>{t(e),i(()=>t(e).template_name)&&n(He)})}var Zt=s(Yt,2);{var Ve=n=>{var m=pa(),c=s(r(m),2),x=r(c,!0);a(c),a(m),h(()=>o(x,(t(e),i(()=>t(e)["github-runner-group"])))),u(n,m)};f(Zt,n=>{t(e),i(()=>t(e)["github-runner-group"])&&n(Ve)})}var We=s(Zt,2);{var Ke=n=>{var m=ya(),c=s(r(m),2),x=r(c);oa(x,5,()=>(t(e),i(()=>t(e).tags)),na,(w,b)=>{var pt=_a(),Ye=r(pt,!0);a(pt),h(()=>o(Ye,(t(b),i(()=>typeof t(b)=="string"?t(b):t(b).name)))),u(w,pt)}),a(x),a(c),a(m),u(n,m)};f(We,n=>{t(e),i(()=>t(e).tags&&t(e).tags.length>0)&&n(Ke)})}a(qt),a(jt),a(Jt),a(Q);var te=s(Q,2);{var Qe=n=>{var m=ba(),c=r(m),x=s(r(c),2),w=r(x,!0);a(x),a(c),a(m),h(b=>o(w,b),[()=>(t(e),i(()=>fe(t(e).extra_specs)))]),u(n,m)};f(te,n=>{t(e),i(()=>t(e).extra_specs)&&n(Qe)})}var Xe=s(te,2);{let n=E(()=>(t(e),i(()=>t(e).instances||[])));ma(Xe,{get instances(){return t(n)},entityType:"pool",onDeleteInstance:ge})}h((n,m,c,x,w)=>{o(Ee,(t(e),i(()=>t(e).id))),o(Te,(t(e),i(()=>t(e).provider_name))),o(Fe,(t(e),i(()=>t(e).image))),o(Se,(t(e),i(()=>t(e).flavor))),ae(dt,1,`inline-flex px-2 py-1 text-xs font-medium rounded-full ${t(e),i(()=>t(e).enabled?"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200":"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200")??""}`),o(Ue,(t(e),i(()=>t(e).enabled?"Enabled":"Disabled"))),o(Ne,n),_t(lt,"href",m),o(Re,c),o(Be,x),o(Ce,w),o(Le,(t(e),i(()=>t(e).max_runners))),o(Oe,(t(e),i(()=>t(e).min_idle_runners))),o(Ge,`${t(e),i(()=>t(e).runner_bootstrap_timeout)??""} minutes`),o(Je,(t(e),i(()=>t(e).priority))),o(je,(t(e),i(()=>t(e).runner_prefix||"garm"))),o(qe,`${t(e),i(()=>t(e).os_type)??""} / ${t(e),i(()=>t(e).os_arch)??""}`),ae(ft,1,`inline-flex px-2 py-1 text-xs font-medium rounded-full ${t(e),i(()=>t(e).enable_shell?"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200":"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200")??""}`),o(ze,(t(e),i(()=>t(e).enable_shell?"Enabled":"Disabled")))},[()=>(g(L),t(e),i(()=>L(t(e)))),()=>(g(le),t(e),i(()=>le(t(e)))),()=>(g(D),t(e),i(()=>D(t(e)))),()=>(g(O),t(e),i(()=>O(t(e).created_at||""))),()=>(g(O),t(e),i(()=>O(t(e).updated_at||"")))]),u(K,Pt)};f(R,K=>{t(e)&&K(W)},!0)}u($,I)};f(y,$=>{t(A)?$(V):$(Me,!1)},!0)}u(d,l)};f(he,d=>{t(j)?d(ke):d(we,!1)})}a(q);var $t=s(q,2);{var $e=d=>{va(d,{get pool(){return t(e)},$$events:{close:()=>v(F,!1),submit:l=>ce(l.detail)}})};f($t,d=>{t(F)&&t(e)&&d($e)})}var It=s($t,2);{var Ie=d=>{{let l=E(()=>(t(e),g(D),i(()=>`Pool ${t(e).id} (${D(t(e))})`)));se(d,{title:"Delete Pool",message:"Are you sure you want to delete this pool? This action cannot be undone and will remove all associated runners.",get itemName(){return t(l)},$$events:{close:()=>v(S,!1),confirm:xe}})}};f(It,d=>{t(S)&&t(e)&&d(Ie)})}var Pe=s(It,2);{var De=d=>{se(d,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return t(p),i(()=>t(p).name)},$$events:{close:()=>{v(U,!1),v(p,null)},confirm:ue}})};f(Pe,d=>{t(U)&&t(p)&&d(De)})}h(d=>{_t(ye,"href",d),o(be,(t(e),i(()=>t(e)?t(e).id:"Loading...")))},[()=>(g(P),i(()=>P("/pools")))]),u(ne,yt),ia()}export{Oa as component}; diff --git a/webapp/assets/_app/immutable/nodes/17.LPpjfVrH.js b/webapp/assets/_app/immutable/nodes/17.D-lQvPgz.js similarity index 95% rename from webapp/assets/_app/immutable/nodes/17.LPpjfVrH.js rename to webapp/assets/_app/immutable/nodes/17.D-lQvPgz.js index e31c0799..3c8a0904 100644 --- a/webapp/assets/_app/immutable/nodes/17.LPpjfVrH.js +++ b/webapp/assets/_app/immutable/nodes/17.D-lQvPgz.js @@ -1 +1 @@ -import{f as S,a as D,s as ye,e as ve,h as Oe}from"../chunks/ZGz3X54u.js";import{i as Se}from"../chunks/CY7Wcm-1.js";import{p as Ae,v as He,o as Fe,l as w,d as r,m as a,g as e,j as $,b as Ie,s as i,c as d,r as c,t as X,k as Te,u as j,n as he,a as We,f as Je,$ as Ve,i as Ee}from"../chunks/kDtaAWAK.js";import{a as Ue,i as Y,s as qe}from"../chunks/Cun6jNAp.js";import{r as J,b as De,g as oe}from"../chunks/Cvcp5xHB.js";import{e as Ye,i as Ke}from"../chunks/DdT9Vz5Q.js";import{b as _e,a as we}from"../chunks/CYnNqrHp.js";import{p as Qe}from"../chunks/CdEA5IGF.js";import{M as Xe}from"../chunks/C6jYEeWP.js";import{e as ae}from"../chunks/BZiHL9L3.js";import{F as Ze}from"../chunks/CCoxuXg5.js";import{e as je,a as xe}from"../chunks/C2c_wqo6.js";import{U as et}from"../chunks/io-Ugua7.js";import{D as tt}from"../chunks/lQWw1Z23.js";import{P as rt}from"../chunks/CLZesvzF.js";import{t as V}from"../chunks/BVGCMSWJ.js";import{k as ot,g as at,c as st,m as nt,p as it}from"../chunks/DNHT2U_W.js";import{D as lt,G as dt}from"../chunks/Cfdue6T6.js";import{E as ct}from"../chunks/CEJvqnOn.js";import{E as ut}from"../chunks/C-3AL0iB.js";import{S as pt}from"../chunks/BTeTCgJA.js";import{A as mt}from"../chunks/Cs0pYghy.js";import"../chunks/CkTG2UXI.js";var gt=S('

'),bt=S('

Loading...

'),ft=S(""),yt=S(''),vt=S('

Webhook secret will be automatically generated

'),ht=S('
'),_t=S('

Create Repository

');function wt(se,ne){Ae(ne,!1);const[ie,le]=qe(),p=()=>Ue(je,"$eagerCache",ie),C=a(),x=a(),G=a(),R=a(),P=He();let y=a(!1),g=a(""),b=a("github"),o=a({name:"",owner:"",credentials_name:"",webhook_secret:"",pool_balancer_type:"roundrobin",agent_mode:!1}),A=a(!0),u=a(!0);async function f(){if(!p().loaded.credentials&&!p().loading.credentials)try{await xe.getCredentials()}catch(l){r(g,ae(l))}}function _(l){r(b,l.detail),$(o,e(o).credentials_name="")}function M(){if(e(o).credentials_name){const l=e(C).find(F=>F.name===e(o).credentials_name);l&&l.forge_type&&r(b,l.forge_type)}}function T(){const l=new Uint8Array(32);return crypto.getRandomValues(l),Array.from(l,F=>F.toString(16).padStart(2,"0")).join("")}Fe(()=>{f()});async function de(){if(!e(o).name?.trim()){r(g,"Repository name is required");return}if(!e(o).owner?.trim()){r(g,"Repository owner is required");return}if(!e(o).credentials_name){r(g,"Please select credentials");return}try{r(y,!0),r(g,"");const l={...e(o),install_webhook:e(A),auto_generate_secret:e(u)};P("submit",l)}catch(l){r(g,ae(l)),r(y,!1)}}w(()=>p(),()=>{r(C,p().credentials)}),w(()=>p(),()=>{r(x,p().loading.credentials)}),w(()=>(e(C),e(b)),()=>{r(G,e(C).filter(l=>e(b)?l.forge_type===e(b):!0))}),w(()=>e(u),()=>{e(u)?$(o,e(o).webhook_secret=T()):e(u)||$(o,e(o).webhook_secret="")}),w(()=>(e(o),e(u)),()=>{r(R,e(o).name?.trim()!==""&&e(o).owner?.trim()!==""&&e(o).credentials_name!==""&&(e(u)||e(o).webhook_secret?.trim()!==""))}),Ie(),Se(),Xe(se,{$$events:{close:()=>P("close")},children:(l,F)=>{var E=_t(),Z=i(d(E),2);{var ce=v=>{var h=gt(),I=d(h),W=d(I,!0);c(I),c(h),X(()=>ye(W,e(g))),D(v,h)};Y(Z,v=>{e(g)&&v(ce)})}var ue=i(Z,2);{var pe=v=>{var h=bt();D(v,h)},me=v=>{var h=ht(),I=d(h);Ze(I,{get selectedForgeType(){return e(b)},set selectedForgeType(s){r(b,s)},$$events:{select:_},$$legacy:!0});var W=i(I,2),ee=i(d(W),2);J(ee),c(W);var z=i(W,2),B=i(d(z),2);J(B),c(z);var L=i(z,2),N=i(d(L),2);X(()=>{e(o),Te(()=>{e(G)})});var O=d(N);O.value=O.__value="";var ge=i(O);Ye(ge,1,()=>e(G),Ke,(s,m)=>{var q=ft(),Ne=d(q);c(q);var Me={};X(()=>{ye(Ne,`${e(m),j(()=>e(m).name)??""} (${e(m),j(()=>e(m).endpoint?.name)??""})`),Me!==(Me=(e(m),j(()=>e(m).name)))&&(q.value=(q.__value=(e(m),j(()=>e(m).name)))??"")}),D(s,q)}),c(N),c(L);var H=i(L,2),K=i(d(H),2);X(()=>{e(o),Te(()=>{})});var Q=d(K);Q.value=Q.__value="roundrobin";var te=i(Q);te.value=te.__value="pack",c(K),c(H);var t=i(H,2),n=d(t),re=d(n);J(re),he(4),c(n),c(t);var k=i(t,2),U=d(k),ke=d(U);J(ke),he(2),c(U);var Re=i(U,2),be=d(Re),$e=d(be);J($e),he(2),c(be);var Ge=i(be,2);{var ze=s=>{var m=yt();J(m),_e(m,()=>e(o).webhook_secret,q=>$(o,e(o).webhook_secret=q)),D(s,m)},Be=s=>{var m=vt();D(s,m)};Y(Ge,s=>{e(u)?s(Be,!1):s(ze)})}c(Re),c(k);var Ce=i(k,2),Pe=d(Ce),fe=i(Pe,2),Le=d(fe,!0);c(fe),c(Ce),c(h),X(()=>{fe.disabled=e(y)||e(x)||!e(R),ye(Le,e(y)?"Creating...":"Create Repository")}),_e(ee,()=>e(o).name,s=>$(o,e(o).name=s)),_e(B,()=>e(o).owner,s=>$(o,e(o).owner=s)),De(N,()=>e(o).credentials_name,s=>$(o,e(o).credentials_name=s)),ve("change",N,M),De(K,()=>e(o).pool_balancer_type,s=>$(o,e(o).pool_balancer_type=s)),we(re,()=>e(o).agent_mode,s=>$(o,e(o).agent_mode=s)),we(ke,()=>e(A),s=>r(A,s)),we($e,()=>e(u),s=>r(u,s)),ve("click",Pe,()=>P("close")),ve("submit",h,Qe(de)),D(v,h)};Y(ue,v=>{e(y)?v(pe):v(me,!1)})}c(E),D(l,E)},$$slots:{default:!0}}),We(),le()}var xt=S('
',1);function Ht(se,ne){Ae(ne,!1);const[ie,le]=qe(),p=()=>Ue(je,"$eagerCache",ie),C=a(),x=a(),G=a();let R=a([]),P=a(!0),y=a(""),g=a(""),b=a(!1),o=a(!1),A=a(!1),u=a(null),f=a(null),_=a(1),M=a(25),T=a(1);Fe(async()=>{try{r(P,!0);const t=await xe.getRepositories();t&&Array.isArray(t)&&r(R,t)}catch(t){console.error("Failed to load repositories:",t),r(y,t instanceof Error?t.message:"Failed to load repositories")}finally{r(P,!1)}});async function de(){try{await xe.retryResource("repositories")}catch(t){console.error("Retry failed:",t)}}function l(t){r(u,t),r(o,!0)}function F(t){r(f,t),r(A,!0)}function E(){r(b,!1),r(o,!1),r(A,!1),r(u,null),r(f,null),r(y,"")}async function Z(t){try{r(y,"");const n=t.detail,re={name:n.name,owner:n.owner,credentials_name:n.credentials_name,webhook_secret:n.webhook_secret},k=await oe.createRepository(re);if(n.install_webhook&&k.id)try{await oe.installRepoWebhook(k.id),V.success("Webhook Installed",`Webhook for repository ${k.owner}/${k.name} has been installed successfully.`)}catch(U){console.warn("Repository created but webhook installation failed:",U),V.error("Webhook Installation Failed",U instanceof Error?U.message:"Failed to install webhook. You can try installing it manually from the repository details page.")}r(b,!1),V.success("Repository Created",`Repository ${k.owner}/${k.name} has been created successfully.`)}catch(n){throw r(y,ae(n)),n}}async function ce(t){if(e(u))try{await oe.updateRepository(e(u).id,t),V.success("Repository Updated",`Repository ${e(u).owner}/${e(u).name} has been updated successfully.`),E()}catch(n){throw n}}async function ue(){if(e(f))try{r(y,""),await oe.deleteRepository(e(f).id),V.success("Repository Deleted",`Repository ${e(f).owner}/${e(f).name} has been deleted successfully.`)}catch(t){const n=ae(t);V.error("Delete Failed",n)}finally{E()}}const pe=[{key:"repository",title:"Repository",cellComponent:ct,cellProps:{entityType:"repository",showOwner:!0}},{key:"endpoint",title:"Endpoint",cellComponent:ut},{key:"credentials",title:"Credentials",cellComponent:dt,cellProps:{field:"credentials_name"}},{key:"status",title:"Status",cellComponent:pt,cellProps:{statusType:"entity"}},{key:"actions",title:"Actions",align:"right",cellComponent:mt}],me={entityType:"repository",primaryText:{field:"name",isClickable:!0,href:"/repositories/{id}",showOwner:!0},customInfo:[{icon:t=>at(t?.endpoint?.endpoint_type||"unknown"),text:t=>t?.endpoint?.name||"Unknown"}],badges:[{type:"custom",value:t=>ot(t)}],actions:[{type:"edit",handler:t=>l(t)},{type:"delete",handler:t=>F(t)}]};function v(t){r(g,t.detail.term),r(_,1)}function h(t){r(_,t.detail.page)}function I(t){const n=st(t.detail.perPage);r(M,n.newPerPage),r(_,n.newCurrentPage)}function W(t){l(t.detail.item)}function ee(t){F(t.detail.item)}w(()=>(e(R),p()),()=>{(!e(R).length||p().loaded.repositories)&&r(R,p().repositories)}),w(()=>p(),()=>{r(P,p().loading.repositories)}),w(()=>p(),()=>{r(C,p().errorMessages.repositories)}),w(()=>(e(R),e(g)),()=>{r(x,nt(e(R),e(g)))}),w(()=>(e(T),e(x),e(M),e(_)),()=>{r(T,Math.ceil(e(x).length/e(M))),e(_)>e(T)&&e(T)>0&&r(_,e(T))}),w(()=>(e(x),e(_),e(M)),()=>{r(G,it(e(x),e(_),e(M)))}),Ie(),Se();var z=xt();Oe(t=>{Ve.title="Repositories - GARM"});var B=Je(z),L=d(B);rt(L,{title:"Repositories",description:"Manage your GitHub repositories and their runners",actionLabel:"Add Repository",$$events:{action:()=>{r(b,!0)}}});var N=i(L,2);{let t=Ee(()=>e(C)||e(y)),n=Ee(()=>!!e(C));lt(N,{get columns(){return pe},get data(){return e(G)},get loading(){return e(P)},get error(){return e(t)},get searchTerm(){return e(g)},searchPlaceholder:"Search repositories by name or owner...",get currentPage(){return e(_)},get perPage(){return e(M)},get totalPages(){return e(T)},get totalItems(){return e(x),j(()=>e(x).length)},itemName:"repositories",emptyIconType:"building",get showRetry(){return e(n)},get mobileCardConfig(){return me},$$events:{search:v,pageChange:h,perPageChange:I,retry:de,edit:W,delete:ee}})}c(B);var O=i(B,2);{var ge=t=>{wt(t,{$$events:{close:()=>r(b,!1),submit:Z}})};Y(O,t=>{e(b)&&t(ge)})}var H=i(O,2);{var K=t=>{et(t,{get entity(){return e(u)},entityType:"repository",$$events:{close:E,submit:n=>ce(n.detail)}})};Y(H,t=>{e(o)&&e(u)&&t(K)})}var Q=i(H,2);{var te=t=>{tt(t,{title:"Delete Repository",message:"Are you sure you want to delete this repository? This action cannot be undone and will remove all associated pools and runners.",get itemName(){return`${e(f),j(()=>e(f).owner)??""}/${e(f),j(()=>e(f).name)??""}`},$$events:{close:E,confirm:ue}})};Y(Q,t=>{e(A)&&e(f)&&t(te)})}D(se,z),We(),le()}export{Ht as component}; +import{f as S,a as D,s as ye,e as ve,h as Oe}from"../chunks/ZGz3X54u.js";import{i as Se}from"../chunks/CY7Wcm-1.js";import{p as Ae,v as He,o as Fe,l as w,d as r,m as a,g as e,j as $,b as Ie,s as i,c as d,r as c,t as X,k as Te,u as j,n as he,a as We,f as Je,$ as Ve,i as Ee}from"../chunks/kDtaAWAK.js";import{a as Ue,i as Y,s as qe}from"../chunks/Cun6jNAp.js";import{r as J,b as De,g as oe}from"../chunks/CYK-UalN.js";import{e as Ye,i as Ke}from"../chunks/DdT9Vz5Q.js";import{b as _e,a as we}from"../chunks/CYnNqrHp.js";import{p as Qe}from"../chunks/CdEA5IGF.js";import{M as Xe}from"../chunks/CVBpH3Sf.js";import{e as ae}from"../chunks/BZiHL9L3.js";import{F as Ze}from"../chunks/CovvT05J.js";import{e as je,a as xe}from"../chunks/Vo3Mv3dp.js";import{U as et}from"../chunks/6aKjRj0k.js";import{D as tt}from"../chunks/Dxx83T0m.js";import{P as rt}from"../chunks/DacI6VAP.js";import{t as V}from"../chunks/BVGCMSWJ.js";import{k as ot,g as at,c as st,m as nt,p as it}from"../chunks/ZelbukuJ.js";import{D as lt,G as dt}from"../chunks/BKeluGSY.js";import{E as ct}from"../chunks/Dd4NFVf9.js";import{E as ut}from"../chunks/oWoYyEl8.js";import{S as pt}from"../chunks/BStwtkX8.js";import{A as mt}from"../chunks/rb89c4PS.js";import"../chunks/DWgB-t1g.js";var gt=S('

'),bt=S('

Loading...

'),ft=S(""),yt=S(''),vt=S('

Webhook secret will be automatically generated

'),ht=S('
'),_t=S('

Create Repository

');function wt(se,ne){Ae(ne,!1);const[ie,le]=qe(),p=()=>Ue(je,"$eagerCache",ie),C=a(),x=a(),G=a(),R=a(),P=He();let y=a(!1),g=a(""),b=a("github"),o=a({name:"",owner:"",credentials_name:"",webhook_secret:"",pool_balancer_type:"roundrobin",agent_mode:!1}),A=a(!0),u=a(!0);async function f(){if(!p().loaded.credentials&&!p().loading.credentials)try{await xe.getCredentials()}catch(l){r(g,ae(l))}}function _(l){r(b,l.detail),$(o,e(o).credentials_name="")}function M(){if(e(o).credentials_name){const l=e(C).find(F=>F.name===e(o).credentials_name);l&&l.forge_type&&r(b,l.forge_type)}}function T(){const l=new Uint8Array(32);return crypto.getRandomValues(l),Array.from(l,F=>F.toString(16).padStart(2,"0")).join("")}Fe(()=>{f()});async function de(){if(!e(o).name?.trim()){r(g,"Repository name is required");return}if(!e(o).owner?.trim()){r(g,"Repository owner is required");return}if(!e(o).credentials_name){r(g,"Please select credentials");return}try{r(y,!0),r(g,"");const l={...e(o),install_webhook:e(A),auto_generate_secret:e(u)};P("submit",l)}catch(l){r(g,ae(l)),r(y,!1)}}w(()=>p(),()=>{r(C,p().credentials)}),w(()=>p(),()=>{r(x,p().loading.credentials)}),w(()=>(e(C),e(b)),()=>{r(G,e(C).filter(l=>e(b)?l.forge_type===e(b):!0))}),w(()=>e(u),()=>{e(u)?$(o,e(o).webhook_secret=T()):e(u)||$(o,e(o).webhook_secret="")}),w(()=>(e(o),e(u)),()=>{r(R,e(o).name?.trim()!==""&&e(o).owner?.trim()!==""&&e(o).credentials_name!==""&&(e(u)||e(o).webhook_secret?.trim()!==""))}),Ie(),Se(),Xe(se,{$$events:{close:()=>P("close")},children:(l,F)=>{var E=_t(),Z=i(d(E),2);{var ce=v=>{var h=gt(),I=d(h),W=d(I,!0);c(I),c(h),X(()=>ye(W,e(g))),D(v,h)};Y(Z,v=>{e(g)&&v(ce)})}var ue=i(Z,2);{var pe=v=>{var h=bt();D(v,h)},me=v=>{var h=ht(),I=d(h);Ze(I,{get selectedForgeType(){return e(b)},set selectedForgeType(s){r(b,s)},$$events:{select:_},$$legacy:!0});var W=i(I,2),ee=i(d(W),2);J(ee),c(W);var z=i(W,2),B=i(d(z),2);J(B),c(z);var L=i(z,2),N=i(d(L),2);X(()=>{e(o),Te(()=>{e(G)})});var O=d(N);O.value=O.__value="";var ge=i(O);Ye(ge,1,()=>e(G),Ke,(s,m)=>{var q=ft(),Ne=d(q);c(q);var Me={};X(()=>{ye(Ne,`${e(m),j(()=>e(m).name)??""} (${e(m),j(()=>e(m).endpoint?.name)??""})`),Me!==(Me=(e(m),j(()=>e(m).name)))&&(q.value=(q.__value=(e(m),j(()=>e(m).name)))??"")}),D(s,q)}),c(N),c(L);var H=i(L,2),K=i(d(H),2);X(()=>{e(o),Te(()=>{})});var Q=d(K);Q.value=Q.__value="roundrobin";var te=i(Q);te.value=te.__value="pack",c(K),c(H);var t=i(H,2),n=d(t),re=d(n);J(re),he(4),c(n),c(t);var k=i(t,2),U=d(k),ke=d(U);J(ke),he(2),c(U);var Re=i(U,2),be=d(Re),$e=d(be);J($e),he(2),c(be);var Ge=i(be,2);{var ze=s=>{var m=yt();J(m),_e(m,()=>e(o).webhook_secret,q=>$(o,e(o).webhook_secret=q)),D(s,m)},Be=s=>{var m=vt();D(s,m)};Y(Ge,s=>{e(u)?s(Be,!1):s(ze)})}c(Re),c(k);var Ce=i(k,2),Pe=d(Ce),fe=i(Pe,2),Le=d(fe,!0);c(fe),c(Ce),c(h),X(()=>{fe.disabled=e(y)||e(x)||!e(R),ye(Le,e(y)?"Creating...":"Create Repository")}),_e(ee,()=>e(o).name,s=>$(o,e(o).name=s)),_e(B,()=>e(o).owner,s=>$(o,e(o).owner=s)),De(N,()=>e(o).credentials_name,s=>$(o,e(o).credentials_name=s)),ve("change",N,M),De(K,()=>e(o).pool_balancer_type,s=>$(o,e(o).pool_balancer_type=s)),we(re,()=>e(o).agent_mode,s=>$(o,e(o).agent_mode=s)),we(ke,()=>e(A),s=>r(A,s)),we($e,()=>e(u),s=>r(u,s)),ve("click",Pe,()=>P("close")),ve("submit",h,Qe(de)),D(v,h)};Y(ue,v=>{e(y)?v(pe):v(me,!1)})}c(E),D(l,E)},$$slots:{default:!0}}),We(),le()}var xt=S('
',1);function Ht(se,ne){Ae(ne,!1);const[ie,le]=qe(),p=()=>Ue(je,"$eagerCache",ie),C=a(),x=a(),G=a();let R=a([]),P=a(!0),y=a(""),g=a(""),b=a(!1),o=a(!1),A=a(!1),u=a(null),f=a(null),_=a(1),M=a(25),T=a(1);Fe(async()=>{try{r(P,!0);const t=await xe.getRepositories();t&&Array.isArray(t)&&r(R,t)}catch(t){console.error("Failed to load repositories:",t),r(y,t instanceof Error?t.message:"Failed to load repositories")}finally{r(P,!1)}});async function de(){try{await xe.retryResource("repositories")}catch(t){console.error("Retry failed:",t)}}function l(t){r(u,t),r(o,!0)}function F(t){r(f,t),r(A,!0)}function E(){r(b,!1),r(o,!1),r(A,!1),r(u,null),r(f,null),r(y,"")}async function Z(t){try{r(y,"");const n=t.detail,re={name:n.name,owner:n.owner,credentials_name:n.credentials_name,webhook_secret:n.webhook_secret},k=await oe.createRepository(re);if(n.install_webhook&&k.id)try{await oe.installRepoWebhook(k.id),V.success("Webhook Installed",`Webhook for repository ${k.owner}/${k.name} has been installed successfully.`)}catch(U){console.warn("Repository created but webhook installation failed:",U),V.error("Webhook Installation Failed",U instanceof Error?U.message:"Failed to install webhook. You can try installing it manually from the repository details page.")}r(b,!1),V.success("Repository Created",`Repository ${k.owner}/${k.name} has been created successfully.`)}catch(n){throw r(y,ae(n)),n}}async function ce(t){if(e(u))try{await oe.updateRepository(e(u).id,t),V.success("Repository Updated",`Repository ${e(u).owner}/${e(u).name} has been updated successfully.`),E()}catch(n){throw n}}async function ue(){if(e(f))try{r(y,""),await oe.deleteRepository(e(f).id),V.success("Repository Deleted",`Repository ${e(f).owner}/${e(f).name} has been deleted successfully.`)}catch(t){const n=ae(t);V.error("Delete Failed",n)}finally{E()}}const pe=[{key:"repository",title:"Repository",cellComponent:ct,cellProps:{entityType:"repository",showOwner:!0}},{key:"endpoint",title:"Endpoint",cellComponent:ut},{key:"credentials",title:"Credentials",cellComponent:dt,cellProps:{field:"credentials_name"}},{key:"status",title:"Status",cellComponent:pt,cellProps:{statusType:"entity"}},{key:"actions",title:"Actions",align:"right",cellComponent:mt}],me={entityType:"repository",primaryText:{field:"name",isClickable:!0,href:"/repositories/{id}",showOwner:!0},customInfo:[{icon:t=>at(t?.endpoint?.endpoint_type||"unknown"),text:t=>t?.endpoint?.name||"Unknown"}],badges:[{type:"custom",value:t=>ot(t)}],actions:[{type:"edit",handler:t=>l(t)},{type:"delete",handler:t=>F(t)}]};function v(t){r(g,t.detail.term),r(_,1)}function h(t){r(_,t.detail.page)}function I(t){const n=st(t.detail.perPage);r(M,n.newPerPage),r(_,n.newCurrentPage)}function W(t){l(t.detail.item)}function ee(t){F(t.detail.item)}w(()=>(e(R),p()),()=>{(!e(R).length||p().loaded.repositories)&&r(R,p().repositories)}),w(()=>p(),()=>{r(P,p().loading.repositories)}),w(()=>p(),()=>{r(C,p().errorMessages.repositories)}),w(()=>(e(R),e(g)),()=>{r(x,nt(e(R),e(g)))}),w(()=>(e(T),e(x),e(M),e(_)),()=>{r(T,Math.ceil(e(x).length/e(M))),e(_)>e(T)&&e(T)>0&&r(_,e(T))}),w(()=>(e(x),e(_),e(M)),()=>{r(G,it(e(x),e(_),e(M)))}),Ie(),Se();var z=xt();Oe(t=>{Ve.title="Repositories - GARM"});var B=Je(z),L=d(B);rt(L,{title:"Repositories",description:"Manage your GitHub repositories and their runners",actionLabel:"Add Repository",$$events:{action:()=>{r(b,!0)}}});var N=i(L,2);{let t=Ee(()=>e(C)||e(y)),n=Ee(()=>!!e(C));lt(N,{get columns(){return pe},get data(){return e(G)},get loading(){return e(P)},get error(){return e(t)},get searchTerm(){return e(g)},searchPlaceholder:"Search repositories by name or owner...",get currentPage(){return e(_)},get perPage(){return e(M)},get totalPages(){return e(T)},get totalItems(){return e(x),j(()=>e(x).length)},itemName:"repositories",emptyIconType:"building",get showRetry(){return e(n)},get mobileCardConfig(){return me},$$events:{search:v,pageChange:h,perPageChange:I,retry:de,edit:W,delete:ee}})}c(B);var O=i(B,2);{var ge=t=>{wt(t,{$$events:{close:()=>r(b,!1),submit:Z}})};Y(O,t=>{e(b)&&t(ge)})}var H=i(O,2);{var K=t=>{et(t,{get entity(){return e(u)},entityType:"repository",$$events:{close:E,submit:n=>ce(n.detail)}})};Y(H,t=>{e(o)&&e(u)&&t(K)})}var Q=i(H,2);{var te=t=>{tt(t,{title:"Delete Repository",message:"Are you sure you want to delete this repository? This action cannot be undone and will remove all associated pools and runners.",get itemName(){return`${e(f),j(()=>e(f).owner)??""}/${e(f),j(()=>e(f).name)??""}`},$$events:{close:E,confirm:ue}})};Y(Q,t=>{e(A)&&e(f)&&t(te)})}D(se,z),We(),le()}export{Ht as component}; diff --git a/webapp/assets/_app/immutable/nodes/18.DZSsQ4kC.js b/webapp/assets/_app/immutable/nodes/18.DvnMNUxr.js similarity index 93% rename from webapp/assets/_app/immutable/nodes/18.DZSsQ4kC.js rename to webapp/assets/_app/immutable/nodes/18.DvnMNUxr.js index 652e2c62..bc3c457b 100644 --- a/webapp/assets/_app/immutable/nodes/18.DZSsQ4kC.js +++ b/webapp/assets/_app/immutable/nodes/18.DvnMNUxr.js @@ -1 +1 @@ -import{f as F,h as ze,a as x,s as de,c as ce}from"../chunks/ZGz3X54u.js";import{i as He}from"../chunks/CY7Wcm-1.js";import{p as je,o as Ge,q as Oe,l as Ve,b as Je,f as k,t as j,a as Ke,u as n,h as pe,g as e,m as l,c as u,s as d,d as r,$ as Qe,r as f,j as Xe,i as m}from"../chunks/kDtaAWAK.js";import{i as g,s as Ye,a as Ze}from"../chunks/Cun6jNAp.js";import{d as A,c as et,g as h}from"../chunks/Cvcp5xHB.js";import{p as tt}from"../chunks/D3FdGlax.js";import{g as ue}from"../chunks/BU_V7FOQ.js";import{U as ot}from"../chunks/io-Ugua7.js";import{D as fe}from"../chunks/lQWw1Z23.js";import{E as at,P as rt,a as st}from"../chunks/DOA3alhD.js";import{D as nt}from"../chunks/CRSOHHg7.js";import{g as me}from"../chunks/DNHT2U_W.js";import{e as S}from"../chunks/BZiHL9L3.js";import{I as it}from"../chunks/vYI-AT_7.js";import{W as lt}from"../chunks/BaTN8n88.js";import{C as dt}from"../chunks/B87zT258.js";import{w as G}from"../chunks/KU08Mex1.js";import{t as w}from"../chunks/BVGCMSWJ.js";var ct=F('

Loading repository...

'),pt=F('

'),ut=F(" ",1),ft=F(' ',1);function kt(ye,ve){je(ve,!1);const[ge,he]=Ye(),O=()=>Ze(tt,"$page",ge),I=l();let t=l(null),c=l([]),y=l([]),U=l(!0),E=l(""),D=l(!1),P=l(!1),R=l(!1),T=l(!1),p=l(null),M=null,_=l();async function V(){if(e(I))try{r(U,!0),r(E,"");const[o,a,s]=await Promise.all([h.getRepository(e(I)),h.listRepositoryPools(e(I)).catch(()=>[]),h.listRepositoryInstances(e(I)).catch(()=>[])]);r(t,o),r(c,a),r(y,s)}catch(o){r(E,S(o))}finally{r(U,!1)}}function _e(o,a){const{events:s}=o;return{...a,events:s}}async function $e(o){if(e(t))try{await h.updateRepository(e(t).id,o),await V(),w.success("Repository Updated",`Repository ${e(t).owner}/${e(t).name} has been updated successfully.`),r(D,!1)}catch(a){throw a}}async function be(){if(e(t)){try{await h.deleteRepository(e(t).id),ue(A("/repositories"))}catch(o){const a=S(o);w.error("Delete Failed",a)}r(P,!1)}}async function xe(){if(e(p))try{await h.deleteInstance(e(p).name),w.success("Instance Deleted",`Instance ${e(p).name} has been deleted successfully.`),r(R,!1),r(p,null)}catch(o){const a=S(o);w.error("Delete Failed",a),r(R,!1),r(p,null)}}function we(o){r(p,o),r(R,!0)}function Ie(){r(T,!0)}async function Re(o){try{if(!e(t))return;await h.createRepositoryPool(e(t).id,o.detail),w.success("Pool Created",`Pool has been created successfully for repository ${e(t).owner}/${e(t).name}.`),r(T,!1)}catch(a){const s=S(a);w.error("Pool Creation Failed",s)}}function J(){e(_)&&Xe(_,e(_).scrollTop=e(_).scrollHeight)}function Ee(o){if(o.operation==="update"){const a=o.payload;if(e(t)&&a.id===e(t).id){const s=e(t).events?.length||0,i=a.events?.length||0;r(t,_e(e(t),a)),i>s&&setTimeout(()=>{J()},100)}}else if(o.operation==="delete"){const a=o.payload.id||o.payload;e(t)&&e(t).id===a&&ue(A("/repositories"))}}function De(o){if(!e(t))return;const a=o.payload;if(a.repo_id===e(t).id){if(o.operation==="create")r(c,[...e(c),a]);else if(o.operation==="update")r(c,e(c).map(s=>s.id===a.id?a:s));else if(o.operation==="delete"){const s=a.id||a;r(c,e(c).filter(i=>i.id!==s))}}}function Pe(o){if(!e(t)||!e(c))return;const a=o.payload;if(e(c).some(i=>i.id===a.pool_id)){if(o.operation==="create")r(y,[...e(y),a]);else if(o.operation==="update")r(y,e(y).map(i=>i.id===a.id?a:i));else if(o.operation==="delete"){const i=a.id||a;r(y,e(y).filter(W=>W.id!==i))}}}Ge(()=>{V().then(()=>{e(t)?.events?.length&&setTimeout(()=>{J()},100)});const o=G.subscribeToEntity("repository",["update","delete"],Ee),a=G.subscribeToEntity("pool",["create","update","delete"],De),s=G.subscribeToEntity("instance",["create","update","delete"],Pe);M=()=>{o(),a(),s()}}),Oe(()=>{M&&(M(),M=null)}),Ve(()=>O(),()=>{r(I,O().params.id)}),Je(),He();var K=ft();ze(o=>{j(()=>Qe.title=`${e(t),n(()=>e(t)?`${e(t).name} - Repository Details`:"Repository Details")??""} - GARM`)});var B=k(K),L=u(B),Q=u(L),N=u(Q),Te=u(N);f(N);var X=d(N,2),Y=u(X),Z=d(u(Y),2),Me=u(Z,!0);f(Z),f(Y),f(X),f(Q),f(L);var Ce=d(L,2);{var ke=o=>{var a=ct();x(o,a)},Ae=o=>{var a=ce(),s=k(a);{var i=$=>{var b=pt(),C=u(b),q=u(C,!0);f(C),f(b),j(()=>de(q,e(E))),x($,b)},W=$=>{var b=ce(),C=k(b);{var q=z=>{var ae=ut(),re=k(ae);{let v=m(()=>(e(t),n(()=>e(t).name||"Repository"))),H=m(()=>(e(t),n(()=>e(t).owner))),We=m(()=>(e(t),n(()=>e(t).endpoint?.name))),qe=m(()=>(pe(me),e(t),n(()=>me(e(t).endpoint?.endpoint_type||"unknown"))));nt(re,{get title(){return e(v)},get subtitle(){return`Owner: ${e(H)??""} • Endpoint: ${e(We)??""}`},get forgeIcon(){return e(qe)},onEdit:()=>r(D,!0),onDelete:()=>r(P,!0)})}var se=d(re,2);at(se,{get entity(){return e(t)},entityType:"repository"});var ne=d(se,2);{let v=m(()=>(e(t),n(()=>e(t).id||"")));lt(ne,{entityType:"repository",get entityId(){return e(v)},get entityName(){return`${e(t),n(()=>e(t).owner)??""}/${e(t),n(()=>e(t).name)??""}`}})}var ie=d(ne,2);{let v=m(()=>(e(t),n(()=>e(t).id||"")));rt(ie,{get pools(){return e(c)},entityType:"repository",get entityId(){return e(v)},get entityName(){return`${e(t),n(()=>e(t).owner)??""}/${e(t),n(()=>e(t).name)??""}`},$$events:{addPool:Ie}})}var le=d(ie,2);it(le,{get instances(){return e(y)},entityType:"repository",onDeleteInstance:we});var Ne=d(le,2);{let v=m(()=>(e(t),n(()=>e(t)?.events)));st(Ne,{get events(){return e(v)},get eventsContainer(){return e(_)},set eventsContainer(H){r(_,H)},$$legacy:!0})}x(z,ae)};g(C,z=>{e(t)&&z(q)},!0)}x($,b)};g(s,$=>{e(E)?$(i):$(W,!1)},!0)}x(o,a)};g(Ce,o=>{e(U)?o(ke):o(Ae,!1)})}f(B);var ee=d(B,2);{var Se=o=>{ot(o,{get entity(){return e(t)},entityType:"repository",$$events:{close:()=>r(D,!1),submit:a=>$e(a.detail)}})};g(ee,o=>{e(D)&&e(t)&&o(Se)})}var te=d(ee,2);{var Fe=o=>{{let a=m(()=>(e(t),n(()=>`${e(t).owner}/${e(t).name}`)));fe(o,{title:"Delete Repository",message:"Are you sure you want to delete this repository? This action cannot be undone and will remove all associated pools and instances.",get itemName(){return e(a)},$$events:{close:()=>r(P,!1),confirm:be}})}};g(te,o=>{e(P)&&e(t)&&o(Fe)})}var oe=d(te,2);{var Ue=o=>{fe(o,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return e(p),n(()=>e(p).name)},$$events:{close:()=>{r(R,!1),r(p,null)},confirm:xe}})};g(oe,o=>{e(R)&&e(p)&&o(Ue)})}var Be=d(oe,2);{var Le=o=>{{let a=m(()=>(e(t),n(()=>e(t).id||"")));dt(o,{initialEntityType:"repository",get initialEntityId(){return e(a)},$$events:{close:()=>r(T,!1),submit:Re}})}};g(Be,o=>{e(T)&&e(t)&&o(Le)})}j(o=>{et(Te,"href",o),de(Me,(e(t),n(()=>e(t)?e(t).name:"Loading...")))},[()=>(pe(A),n(()=>A("/repositories")))]),x(ye,K),Ke(),he()}export{kt as component}; +import{f as F,h as ze,a as x,s as de,c as ce}from"../chunks/ZGz3X54u.js";import{i as He}from"../chunks/CY7Wcm-1.js";import{p as je,o as Ge,q as Oe,l as Ve,b as Je,f as k,t as j,a as Ke,u as n,h as pe,g as e,m as l,c as u,s as d,d as r,$ as Qe,r as f,j as Xe,i as m}from"../chunks/kDtaAWAK.js";import{i as g,s as Ye,a as Ze}from"../chunks/Cun6jNAp.js";import{d as A,c as et,g as h}from"../chunks/CYK-UalN.js";import{p as tt}from"../chunks/DXEzcvud.js";import{g as ue}from"../chunks/C8dZhfFx.js";import{U as ot}from"../chunks/6aKjRj0k.js";import{D as fe}from"../chunks/Dxx83T0m.js";import{E as at,P as rt,a as st}from"../chunks/DQfnVUrv.js";import{D as nt}from"../chunks/BrlhCerN.js";import{g as me}from"../chunks/ZelbukuJ.js";import{e as S}from"../chunks/BZiHL9L3.js";import{I as it}from"../chunks/B9RC0dq5.js";import{W as lt}from"../chunks/C681KorI.js";import{C as dt}from"../chunks/xMqsWuAL.js";import{w as G}from"../chunks/KU08Mex1.js";import{t as w}from"../chunks/BVGCMSWJ.js";var ct=F('

Loading repository...

'),pt=F('

'),ut=F(" ",1),ft=F(' ',1);function kt(ye,ve){je(ve,!1);const[ge,he]=Ye(),O=()=>Ze(tt,"$page",ge),I=l();let t=l(null),c=l([]),y=l([]),U=l(!0),E=l(""),D=l(!1),P=l(!1),R=l(!1),T=l(!1),p=l(null),M=null,_=l();async function V(){if(e(I))try{r(U,!0),r(E,"");const[o,a,s]=await Promise.all([h.getRepository(e(I)),h.listRepositoryPools(e(I)).catch(()=>[]),h.listRepositoryInstances(e(I)).catch(()=>[])]);r(t,o),r(c,a),r(y,s)}catch(o){r(E,S(o))}finally{r(U,!1)}}function _e(o,a){const{events:s}=o;return{...a,events:s}}async function $e(o){if(e(t))try{await h.updateRepository(e(t).id,o),await V(),w.success("Repository Updated",`Repository ${e(t).owner}/${e(t).name} has been updated successfully.`),r(D,!1)}catch(a){throw a}}async function be(){if(e(t)){try{await h.deleteRepository(e(t).id),ue(A("/repositories"))}catch(o){const a=S(o);w.error("Delete Failed",a)}r(P,!1)}}async function xe(){if(e(p))try{await h.deleteInstance(e(p).name),w.success("Instance Deleted",`Instance ${e(p).name} has been deleted successfully.`),r(R,!1),r(p,null)}catch(o){const a=S(o);w.error("Delete Failed",a),r(R,!1),r(p,null)}}function we(o){r(p,o),r(R,!0)}function Ie(){r(T,!0)}async function Re(o){try{if(!e(t))return;await h.createRepositoryPool(e(t).id,o.detail),w.success("Pool Created",`Pool has been created successfully for repository ${e(t).owner}/${e(t).name}.`),r(T,!1)}catch(a){const s=S(a);w.error("Pool Creation Failed",s)}}function J(){e(_)&&Xe(_,e(_).scrollTop=e(_).scrollHeight)}function Ee(o){if(o.operation==="update"){const a=o.payload;if(e(t)&&a.id===e(t).id){const s=e(t).events?.length||0,i=a.events?.length||0;r(t,_e(e(t),a)),i>s&&setTimeout(()=>{J()},100)}}else if(o.operation==="delete"){const a=o.payload.id||o.payload;e(t)&&e(t).id===a&&ue(A("/repositories"))}}function De(o){if(!e(t))return;const a=o.payload;if(a.repo_id===e(t).id){if(o.operation==="create")r(c,[...e(c),a]);else if(o.operation==="update")r(c,e(c).map(s=>s.id===a.id?a:s));else if(o.operation==="delete"){const s=a.id||a;r(c,e(c).filter(i=>i.id!==s))}}}function Pe(o){if(!e(t)||!e(c))return;const a=o.payload;if(e(c).some(i=>i.id===a.pool_id)){if(o.operation==="create")r(y,[...e(y),a]);else if(o.operation==="update")r(y,e(y).map(i=>i.id===a.id?a:i));else if(o.operation==="delete"){const i=a.id||a;r(y,e(y).filter(W=>W.id!==i))}}}Ge(()=>{V().then(()=>{e(t)?.events?.length&&setTimeout(()=>{J()},100)});const o=G.subscribeToEntity("repository",["update","delete"],Ee),a=G.subscribeToEntity("pool",["create","update","delete"],De),s=G.subscribeToEntity("instance",["create","update","delete"],Pe);M=()=>{o(),a(),s()}}),Oe(()=>{M&&(M(),M=null)}),Ve(()=>O(),()=>{r(I,O().params.id)}),Je(),He();var K=ft();ze(o=>{j(()=>Qe.title=`${e(t),n(()=>e(t)?`${e(t).name} - Repository Details`:"Repository Details")??""} - GARM`)});var B=k(K),L=u(B),Q=u(L),N=u(Q),Te=u(N);f(N);var X=d(N,2),Y=u(X),Z=d(u(Y),2),Me=u(Z,!0);f(Z),f(Y),f(X),f(Q),f(L);var Ce=d(L,2);{var ke=o=>{var a=ct();x(o,a)},Ae=o=>{var a=ce(),s=k(a);{var i=$=>{var b=pt(),C=u(b),q=u(C,!0);f(C),f(b),j(()=>de(q,e(E))),x($,b)},W=$=>{var b=ce(),C=k(b);{var q=z=>{var ae=ut(),re=k(ae);{let v=m(()=>(e(t),n(()=>e(t).name||"Repository"))),H=m(()=>(e(t),n(()=>e(t).owner))),We=m(()=>(e(t),n(()=>e(t).endpoint?.name))),qe=m(()=>(pe(me),e(t),n(()=>me(e(t).endpoint?.endpoint_type||"unknown"))));nt(re,{get title(){return e(v)},get subtitle(){return`Owner: ${e(H)??""} • Endpoint: ${e(We)??""}`},get forgeIcon(){return e(qe)},onEdit:()=>r(D,!0),onDelete:()=>r(P,!0)})}var se=d(re,2);at(se,{get entity(){return e(t)},entityType:"repository"});var ne=d(se,2);{let v=m(()=>(e(t),n(()=>e(t).id||"")));lt(ne,{entityType:"repository",get entityId(){return e(v)},get entityName(){return`${e(t),n(()=>e(t).owner)??""}/${e(t),n(()=>e(t).name)??""}`}})}var ie=d(ne,2);{let v=m(()=>(e(t),n(()=>e(t).id||"")));rt(ie,{get pools(){return e(c)},entityType:"repository",get entityId(){return e(v)},get entityName(){return`${e(t),n(()=>e(t).owner)??""}/${e(t),n(()=>e(t).name)??""}`},$$events:{addPool:Ie}})}var le=d(ie,2);it(le,{get instances(){return e(y)},entityType:"repository",onDeleteInstance:we});var Ne=d(le,2);{let v=m(()=>(e(t),n(()=>e(t)?.events)));st(Ne,{get events(){return e(v)},get eventsContainer(){return e(_)},set eventsContainer(H){r(_,H)},$$legacy:!0})}x(z,ae)};g(C,z=>{e(t)&&z(q)},!0)}x($,b)};g(s,$=>{e(E)?$(i):$(W,!1)},!0)}x(o,a)};g(Ce,o=>{e(U)?o(ke):o(Ae,!1)})}f(B);var ee=d(B,2);{var Se=o=>{ot(o,{get entity(){return e(t)},entityType:"repository",$$events:{close:()=>r(D,!1),submit:a=>$e(a.detail)}})};g(ee,o=>{e(D)&&e(t)&&o(Se)})}var te=d(ee,2);{var Fe=o=>{{let a=m(()=>(e(t),n(()=>`${e(t).owner}/${e(t).name}`)));fe(o,{title:"Delete Repository",message:"Are you sure you want to delete this repository? This action cannot be undone and will remove all associated pools and instances.",get itemName(){return e(a)},$$events:{close:()=>r(P,!1),confirm:be}})}};g(te,o=>{e(P)&&e(t)&&o(Fe)})}var oe=d(te,2);{var Ue=o=>{fe(o,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return e(p),n(()=>e(p).name)},$$events:{close:()=>{r(R,!1),r(p,null)},confirm:xe}})};g(oe,o=>{e(R)&&e(p)&&o(Ue)})}var Be=d(oe,2);{var Le=o=>{{let a=m(()=>(e(t),n(()=>e(t).id||"")));dt(o,{initialEntityType:"repository",get initialEntityId(){return e(a)},$$events:{close:()=>r(T,!1),submit:Re}})}};g(Be,o=>{e(T)&&e(t)&&o(Le)})}j(o=>{et(Te,"href",o),de(Me,(e(t),n(()=>e(t)?e(t).name:"Loading...")))},[()=>(pe(A),n(()=>A("/repositories")))]),x(ye,K),Ke(),he()}export{kt as component}; diff --git a/webapp/assets/_app/immutable/nodes/19.DCbbcuA3.js b/webapp/assets/_app/immutable/nodes/19.B50u3Qn5.js similarity index 97% rename from webapp/assets/_app/immutable/nodes/19.DCbbcuA3.js rename to webapp/assets/_app/immutable/nodes/19.B50u3Qn5.js index bed2da73..d427ccc1 100644 --- a/webapp/assets/_app/immutable/nodes/19.DCbbcuA3.js +++ b/webapp/assets/_app/immutable/nodes/19.B50u3Qn5.js @@ -1 +1 @@ -import{f as k,e as ke,a as v,s as H,t as Oe,c as we,h as Pt}from"../chunks/ZGz3X54u.js";import{i as st}from"../chunks/CY7Wcm-1.js";import{p as lt,v as Rt,o as it,g as e,m as n,d as r,q as zt,l as U,b as nt,f as V,s as a,c as s,r as o,t as S,n as rr,k as Ge,u as f,a as dt,i as ar,h as ct,$ as At}from"../chunks/kDtaAWAK.js";import{i as x,s as ut,a as vt}from"../chunks/Cun6jNAp.js";import{r as B,s as tr,b as He,g as A,d as tt,c as Dt}from"../chunks/Cvcp5xHB.js";import{P as Ut}from"../chunks/CLZesvzF.js";import{e as Ar,i as Dr}from"../chunks/DdT9Vz5Q.js";import{b as le,a as at}from"../chunks/CYnNqrHp.js";import{p as It}from"../chunks/CdEA5IGF.js";import{M as gt}from"../chunks/C6jYEeWP.js";import{J as Lt,U as jt,a as Ot,b as Gt}from"../chunks/C6Z10Ipi.js";import{e as X}from"../chunks/BZiHL9L3.js";import{w as Ur}from"../chunks/KU08Mex1.js";import{e as pt,a as ot}from"../chunks/C2c_wqo6.js";import{U as Ht}from"../chunks/BS0eXXA4.js";import{D as Nt}from"../chunks/lQWw1Z23.js";import{D as qt,G as Ir,L as Ft}from"../chunks/Cfdue6T6.js";import{t as Se}from"../chunks/BVGCMSWJ.js";import{e as Ne,h as Bt}from"../chunks/DNHT2U_W.js";import{E as Vt}from"../chunks/CEJvqnOn.js";import{E as Jt}from"../chunks/C-3AL0iB.js";import{S as Wt}from"../chunks/BTeTCgJA.js";import{A as Kt}from"../chunks/Cs0pYghy.js";import{P as Qt}from"../chunks/DuwadzDF.js";import"../chunks/CkTG2UXI.js";var Xt=k('

'),Yt=k('
'),Zt=k(""),ea=k(''),ra=k('
'),ta=k(""),aa=k(''),oa=k('
Loading templates...
'),sa=k(""),la=k('

Templates define how the runner software is installed and configured.

',1),ia=k('

Create a template first or proceed without a template to use default behavior.

'),na=k('

Select an entity first to see available templates

'),da=k(''),ca=k('
'),ua=k('

Entity & Provider Configuration

Image & OS Configuration

Runner Limits & Timing

Advanced Settings

Extra Specs (JSON)
',1),va=k('
Creating...
'),ga=k('

Create New Scale Set

Scale sets are only available for GitHub endpoints

Entity Level *
'),pa=k(" ",1);function ba(or,sr){lt(sr,!1);const[lr,ir]=ut(),j=()=>vt(pt,"$eagerCache",lr),ie=n(),$=n(),N=Rt();let Y=n(!1),P=n(""),d=n(""),C=n([]),Z=n([]),_=n([]),O=n(!1),ee=n(!1),re=n(!1),G=n(!1),p=n(null),J=n(""),c=n(""),te=n(""),ne=n(""),de=n(""),ge=n(void 0),pe=n(void 0),$e=n(void 0),Ce=n("garm"),D=n("linux"),be=n("amd64"),Ee=n(""),Me=n(!0),fe=n(!1),ce=n("{}"),I=n(void 0);async function Te(){try{r(ee,!0),r(Z,await A.listProviders())}catch(i){r(P,X(i))}finally{r(ee,!1)}}async function Pe(){try{r(re,!0);const i=Re();if(!i){r(_,[]);return}if(r(_,await A.listTemplates(e(D),void 0,i)),!e(I)||!e(_).find(u=>u.id===e(I))){const u=e(_).find(y=>y.owner_id==="system");u?r(I,u.id):e(_).length>0&&r(I,e(_)[0].id)}}catch(i){r(P,X(i))}finally{r(re,!1)}}function Re(){if(!e(c)||!e(C))return null;const i=e(C).find(u=>u.id===e(c));if(!i)return null;if("forge_type"in i)return i.forge_type;if("endpoint"in i){const u=i.endpoint;if(u&&"endpoint_type"in u)return u.endpoint_type||null}return"github"}function ue(){if(!e(c)||!e(C))return!1;const i=e(C).find(u=>u.id===e(c));return i&&"agent_mode"in i?i.agent_mode??!1:!1}async function qe(){if(e(d))try{switch(r(O,!0),r(C,[]),e(d)){case"repository":r(C,await A.listRepositories());break;case"organization":r(C,await A.listOrganizations());break;case"enterprise":r(C,await A.listEnterprises());break}}catch(i){r(P,X(i))}finally{r(O,!1)}}function me(i){e(d)!==i&&(r(d,i),r(c,""),r(I,void 0),qe())}function Fe(i){if(i.operation!=="update")return;const u=i.payload;if(e(d)==="repository"&&u.id===e(c)){const y=j().repositories.find(L=>L.id===e(c));y&&(Object.assign(y,u),r($,ue()))}else if(e(d)==="organization"&&u.id===e(c)){const y=j().organizations.find(L=>L.id===e(c));y&&(Object.assign(y,u),r($,ue()))}else if(e(d)==="enterprise"&&u.id===e(c)){const y=j().enterprises.find(L=>L.id===e(c));y&&(Object.assign(y,u),r($,ue()))}}async function ye(i){if(!(!e(c)||!e(d)))try{switch(e(d)){case"repository":await A.updateRepository(e(c),i);break;case"organization":await A.updateOrganization(e(c),i);break;case"enterprise":await A.updateEnterprise(e(c),i);break}await qe(),r(G,!1)}catch(u){throw u}}function nr(){return!e(c)||!e(C)?null:e(C).find(i=>i.id===e(c))||null}async function dr(){if(!e(ie)){r(P,"Please fill in all required fields");return}try{r(Y,!0),r(P,"");let i={};if(e(ce).trim())try{i=JSON.parse(e(ce))}catch{throw new Error("Invalid JSON in extra specs")}const u={name:e(J),provider_name:e(te),image:e(ne),flavor:e(de),max_runners:e(ge)||10,min_idle_runners:e(pe)||0,runner_bootstrap_timeout:e($e)||20,runner_prefix:e(Ce),os_type:e(D),os_arch:e(be),"github-runner-group":e(Ee)||void 0,enabled:e(Me),enable_shell:e(fe),extra_specs:e(ce).trim()?i:void 0,template_id:e(I)};let y;switch(e(d)){case"repository":y=await A.createRepositoryScaleSet(e(c),u);break;case"organization":y=await A.createOrganizationScaleSet(e(c),u);break;case"enterprise":y=await A.createEnterpriseScaleSet(e(c),u);break;default:throw new Error("Invalid entity level selected")}N("submit",y)}catch(i){r(P,X(i))}finally{r(Y,!1)}}it(()=>{Te(),e(d)&&(e(d)==="repository"||e(d)==="organization"||e(d)==="enterprise")&&r(p,Ur.subscribeToEntity(e(d),["update"],Fe))}),zt(()=>{e(p)&&(e(p)(),r(p,null))}),U(()=>(e(Y),e(J),e(d),e(c),e(te),e(ne),e(de)),()=>{r(ie,!e(Y)&&e(J).trim()!==""&&e(d)!==""&&e(c)!==""&&e(te)!==""&&e(ne).trim()!==""&&e(de).trim()!=="")}),U(()=>{},()=>{r($,ue())}),U(()=>e($),()=>{e($)||r(fe,!1)}),U(()=>(e(c),e(D)),()=>{e(c)&&e(D)&&Pe()}),U(()=>(e(D),e(c)),()=>{e(D)&&e(c)&&Pe()}),U(()=>(e(d),e(p),Ur),()=>{e(d)&&(e(d)==="repository"||e(d)==="organization"||e(d)==="enterprise")&&(e(p)&&e(p)(),r(p,Ur.subscribeToEntity(e(d),["update"],Fe)))}),nt(),st();var Be=pa(),t=V(Be);gt(t,{$$events:{close:()=>N("close")},children:(i,u)=>{var y=ga(),L=a(s(y),2),Ve=s(L);{var ze=M=>{var q=Xt(),_e=s(q),Ye=s(_e,!0);o(_e),o(q),S(()=>H(Ye,e(P))),v(M,q)};x(Ve,M=>{e(P)&&M(ze)})}var xe=a(Ve,2),Je=a(s(xe),2);B(Je),o(xe);var Ae=a(xe,2),We=s(Ae),W=a(s(We),2),ae=s(W),De=a(ae,2),Ke=a(De,2);o(W),o(We),o(Ae);var Qe=a(Ae,2);{var oe=M=>{var q=ua(),_e=V(q),Ye=a(s(_e),2),ur=s(Ye),vr=s(ur),ft=s(vr);rr(),o(vr);var mt=a(vr,2);{var yt=l=>{var h=Yt();v(l,h)},ht=l=>{var h=ea();S(()=>{e(c),Ge(()=>{e(d),e(C)})});var z=s(h),se=s(z);o(z),z.value=z.__value="";var K=a(z);Ar(K,1,()=>e(C),Dr,(w,g)=>{var E=Zt(),Q=s(E);{var Le=b=>{var R=Oe();S(()=>H(R,`${e(g),f(()=>e(g).owner)??""}/${e(g),f(()=>e(g).name)??""} (${e(g),f(()=>e(g).endpoint?.name||"Unknown endpoint")??""})`)),v(b,R)},F=b=>{var R=Oe();S(()=>H(R,`${e(g),f(()=>e(g).name)??""} (${e(g),f(()=>e(g).endpoint?.name||"Unknown endpoint")??""})`)),v(b,R)};x(Q,b=>{e(d)==="repository"?b(Le):b(F,!1)})}o(E);var T={};S(()=>{T!==(T=(e(g),f(()=>e(g).id)))&&(E.value=(E.__value=(e(g),f(()=>e(g).id)))??"")}),v(w,E)}),o(h),S(()=>H(se,`Select a ${e(d)??""}`)),He(h,()=>e(c),w=>r(c,w)),v(l,h)};x(mt,l=>{e(O)?l(yt):l(ht,!1)})}o(ur);var Lr=a(ur,2),xt=a(s(Lr),2);{var _t=l=>{var h=ra();v(l,h)},kt=l=>{var h=aa();S(()=>{e(te),Ge(()=>{e(Z)})});var z=s(h);z.value=z.__value="";var se=a(z);Ar(se,1,()=>e(Z),Dr,(K,w)=>{var g=ta(),E=s(g,!0);o(g);var Q={};S(()=>{H(E,(e(w),f(()=>e(w).name))),Q!==(Q=(e(w),f(()=>e(w).name)))&&(g.value=(g.__value=(e(w),f(()=>e(w).name)))??"")}),v(K,g)}),o(h),He(h,()=>e(te),K=>r(te,K)),v(l,h)};x(xt,l=>{e(ee)?l(_t):l(kt,!1)})}o(Lr),o(Ye),o(_e);var gr=a(_e,2),pr=a(s(gr),2),br=s(pr),jr=a(s(br),2);B(jr),o(br);var fr=a(br,2),Or=a(s(fr),2);B(Or),o(fr);var mr=a(fr,2),yr=a(s(mr),2);S(()=>{e(D),Ge(()=>{})});var hr=s(yr);hr.value=hr.__value="linux";var Gr=a(hr);Gr.value=Gr.__value="windows",o(yr),o(mr);var Hr=a(mr,2),xr=a(s(Hr),2);S(()=>{e(be),Ge(()=>{})});var _r=s(xr);_r.value=_r.__value="amd64";var Nr=a(_r);Nr.value=Nr.__value="arm64",o(xr),o(Hr),o(pr);var qr=a(pr,2),wt=a(s(qr),2);{var St=l=>{var h=oa();v(l,h)},$t=l=>{var h=we(),z=V(h);{var se=w=>{var g=la(),E=V(g);S(()=>{e(I),Ge(()=>{e(_)})}),Ar(E,5,()=>e(_),Dr,(T,b)=>{var R=sa(),je=s(R),Pr=a(je);{var Rr=zr=>{var rt=Oe();S(()=>H(rt,`- ${e(b),f(()=>e(b).description)??""}`)),v(zr,rt)};x(Pr,zr=>{e(b),f(()=>e(b).description)&&zr(Rr)})}o(R);var er={};S(()=>{H(je,`${e(b),f(()=>e(b).name)??""} ${e(b),f(()=>e(b).owner_id==="system"?"(System)":"")??""} `),er!==(er=(e(b),f(()=>e(b).id)))&&(R.value=(R.__value=(e(b),f(()=>e(b).id)))??"")}),v(T,R)}),o(E);var Q=a(E,2),Le=a(s(Q));{var F=T=>{var b=Oe();S(R=>H(b,`Showing templates for ${R??""} ${e(D)??""}.`),[()=>f(Re)]),v(T,b)};x(Le,T=>{e(c)&&T(F)})}o(Q),He(E,()=>e(I),T=>r(I,T)),v(w,g)},K=w=>{var g=we(),E=V(g);{var Q=F=>{var T=ia(),b=s(T),R=s(b);o(b);var je=a(b,2),Pr=s(je);rr(),o(je),o(T),S((Rr,er)=>{H(R,`No templates found for ${Rr??""} ${e(D)??""}.`),Dt(Pr,"href",er)},[()=>f(Re),()=>(ct(tt),f(()=>tt("/templates")))]),v(F,T)},Le=F=>{var T=na();v(F,T)};x(E,F=>{e(c)?F(Q):F(Le,!1)},!0)}v(w,g)};x(z,w=>{e(_),f(()=>e(_).length>0)?w(se):w(K,!1)},!0)}v(l,h)};x(wt,l=>{e(re)?l(St):l($t,!1)})}o(qr),o(gr);var kr=a(gr,2),Fr=a(s(kr),2),wr=s(Fr),Br=a(s(wr),2);B(Br),o(wr);var Sr=a(wr,2),Vr=a(s(Sr),2);B(Vr),o(Sr);var Jr=a(Sr,2),Wr=a(s(Jr),2);B(Wr),o(Jr),o(Fr),o(kr);var Kr=a(kr,2),$r=a(s(Kr),2),Cr=s($r),Qr=a(s(Cr),2);B(Qr),o(Cr);var Xr=a(Cr,2),Yr=a(s(Xr),2);B(Yr),o(Xr),o($r);var Er=a($r,2),Ct=a(s(Er),2);Lt(Ct,{rows:4,placeholder:"{}",get value(){return e(ce)},set value(l){r(ce,l)},$$legacy:!0}),o(Er);var Mr=a(Er,2),Zr=s(Mr);B(Zr),rr(2),o(Mr);var et=a(Mr,2),Tr=s(et),Ze=s(Tr);B(Ze);var Et=a(Ze,2);rr(2),o(Tr);var Mt=a(Tr,2);{var Tt=l=>{var h=ca(),z=a(s(h),2),se=s(z),K=a(se);{var w=g=>{var E=da();ke("click",E,()=>r(G,!0)),v(g,E)};x(K,g=>{e(c)&&g(w)})}o(z),o(h),S(()=>H(se,`Shell access requires agent mode to be enabled on the ${e(d)??""}. `)),v(l,h)};x(Mt,l=>{e($)||l(Tt)})}o(et),o(Kr),S(l=>{H(ft,`${l??""} `),Ze.disabled=!e($),tr(Et,1,`ml-2 block text-sm font-medium text-gray-700 dark:text-gray-300 ${e($)?"":"opacity-50"}`)},[()=>(e(d),f(()=>e(d).charAt(0).toUpperCase()+e(d).slice(1)))]),le(jr,()=>e(ne),l=>r(ne,l)),le(Or,()=>e(de),l=>r(de,l)),He(yr,()=>e(D),l=>r(D,l)),He(xr,()=>e(be),l=>r(be,l)),le(Br,()=>e(pe),l=>r(pe,l)),le(Vr,()=>e(ge),l=>r(ge,l)),le(Wr,()=>e($e),l=>r($e,l)),le(Qr,()=>e(Ce),l=>r(Ce,l)),le(Yr,()=>e(Ee),l=>r(Ee,l)),at(Zr,()=>e(Me),l=>r(Me,l)),at(Ze,()=>e(fe),l=>r(fe,l)),v(M,q)};x(Qe,M=>{e(d)&&M(oe)})}var ve=a(Qe,2),Xe=s(ve),Ue=a(Xe,2),Ie=s(Ue);{var cr=M=>{var q=va();v(M,q)},bt=M=>{var q=Oe("Create Scale Set");v(M,q)};x(Ie,M=>{e(Y)?M(cr):M(bt,!1)})}o(Ue),o(ve),o(L),o(y),S(()=>{tr(ae,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="repository"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),tr(De,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="organization"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),tr(Ke,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="enterprise"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),Ue.disabled=!e(ie)}),le(Je,()=>e(J),M=>r(J,M)),ke("click",ae,()=>me("repository")),ke("click",De,()=>me("organization")),ke("click",Ke,()=>me("enterprise")),ke("click",Xe,()=>N("close")),ke("submit",L,It(dr)),v(i,y)},$$slots:{default:!0}});var m=a(t,2);{var he=i=>{const u=ar(()=>f(nr));var y=we(),L=V(y);{var Ve=ze=>{var xe=we(),Je=V(xe);{var Ae=W=>{jt(W,{get repository(){return e(u)},$$events:{close:()=>r(G,!1),submit:ae=>ye(ae.detail)}})},We=W=>{var ae=we(),De=V(ae);{var Ke=oe=>{Ot(oe,{get organization(){return e(u)},$$events:{close:()=>r(G,!1),submit:ve=>ye(ve.detail)}})},Qe=oe=>{var ve=we(),Xe=V(ve);{var Ue=Ie=>{Gt(Ie,{get enterprise(){return e(u)},$$events:{close:()=>r(G,!1),submit:cr=>ye(cr.detail)}})};x(Xe,Ie=>{e(d)==="enterprise"&&Ie(Ue)},!0)}v(oe,ve)};x(De,oe=>{e(d)==="organization"?oe(Ke):oe(Qe,!1)},!0)}v(W,ae)};x(Je,W=>{e(d)==="repository"?W(Ae):W(We,!1)})}v(ze,xe)};x(L,ze=>{e(u)&&ze(Ve)})}v(i,y)};x(m,i=>{e(G)&&e(c)&&i(he)})}v(or,Be),dt(),ir()}const fa={};var ma=k('
'),ya=k('
',1);function Fa(or,sr){lt(sr,!1);const[lr,ir]=ut(),j=()=>vt(pt,"$eagerCache",lr),ie=n(),$=n(),N=n(),Y=n();let P=n([]),d=n(!0),C=n(""),Z=n(""),_=n(1),O=n(25),ee=n(!1),re=n(!1),G=n(!1),p=n(null),J=n(!1);async function c(t){try{r(C,""),r(ee,!1),Se.success("Scale Set Created","Scale set has been created successfully.")}catch(m){throw r(C,X(m)),m}}async function te(t){if(e(p))try{await A.updateScaleSet(e(p).id,t),Se.success("Scale Set Updated",`Scale set ${e(p).name} has been updated successfully.`),r(re,!1),r(p,null)}catch(m){const he=X(m);throw Se.error("Update Failed",he),m}}async function ne(){if(e(p))try{await A.deleteScaleSet(e(p).id),Se.success("Scale Set Deleted",`Scale set ${e(p).name} has been deleted successfully.`)}catch(t){const m=X(t);Se.error("Delete Failed",m)}finally{r(G,!1),r(p,null)}}function de(){r(ee,!0)}async function ge(t){try{r(J,!0);const m=await A.getScaleSet(t.id);r(p,m),r(re,!0)}catch(m){const he=X(m);Se.error("Failed to Load Scale Set Details",he)}finally{r(J,!1)}}function pe(t){r(p,t),r(G,!0)}it(async()=>{try{r(d,!0);const t=await ot.getScaleSets();t&&Array.isArray(t)&&r(P,t)}catch(t){fa?.VITEST||console.error("Failed to load scale sets:",t),r(C,X(t))}finally{r(d,!1)}});async function $e(){try{await ot.retryResource("scalesets")}catch(t){console.error("Retry failed:",t)}}const Ce=[{key:"name",title:"Name",cellComponent:Vt,cellProps:{entityType:"scaleset"}},{key:"image",title:"Image",cellComponent:Ir,cellProps:{field:"image",type:"code",showTitle:!0}},{key:"provider",title:"Provider",cellComponent:Ir,cellProps:{field:"provider_name"}},{key:"flavor",title:"Flavor",cellComponent:Ir,cellProps:{field:"flavor"}},{key:"entity",title:"Entity",cellComponent:Qt},{key:"endpoint",title:"Endpoint",cellComponent:Jt},{key:"status",title:"Status",cellComponent:Wt,cellProps:{statusType:"enabled"}},{key:"actions",title:"Actions",align:"right",cellComponent:Kt}],D={entityType:"scaleset",primaryText:{field:"name",isClickable:!0,href:"/scalesets/{id}"},secondaryText:{field:"entity_name",computedValue:t=>Ne(t)},badges:[{type:"custom",value:t=>({variant:t.enabled?"success":"error",text:t.enabled?"Enabled":"Disabled"})}],actions:[{type:"edit",handler:t=>ge(t)},{type:"delete",handler:t=>pe(t)}]};function be(t){r(Z,t.detail.term),r(_,1)}function Ee(t){r(_,t.detail.page)}function Me(t){r(O,t.detail.perPage),r(_,1)}function fe(t){ge(t.detail.item)}function ce(t){pe(t.detail.item)}U(()=>(e(P),j()),()=>{(!e(P).length||j().loaded.scalesets)&&r(P,j().scalesets)}),U(()=>j(),()=>{r(d,j().loading.scalesets)}),U(()=>j(),()=>{r(ie,j().errorMessages.scalesets)}),U(()=>(e(P),e(Z),Ne),()=>{r($,Bt(e(P),e(Z),t=>Ne(t)))}),U(()=>(e($),e(O)),()=>{r(N,Math.ceil(e($).length/e(O)))}),U(()=>(e(_),e(N)),()=>{e(_)>e(N)&&e(N)>0&&r(_,e(N))}),U(()=>(e($),e(_),e(O)),()=>{r(Y,e($).slice((e(_)-1)*e(O),e(_)*e(O)))}),nt(),st();var I=ya();Pt(t=>{At.title="Scale Sets - GARM"});var Te=V(I),Pe=s(Te);Ut(Pe,{title:"Scale Sets",description:"Manage GitHub runner scale sets",actionLabel:"Add Scale Set",$$events:{action:de}});var Re=a(Pe,2);{let t=ar(()=>e(ie)||e(C)),m=ar(()=>!!e(ie));qt(Re,{get columns(){return Ce},get data(){return e(Y)},get loading(){return e(d)},get error(){return e(t)},get searchTerm(){return e(Z)},searchPlaceholder:"Search by entity name...",get currentPage(){return e(_)},get perPage(){return e(O)},get totalPages(){return e(N)},get totalItems(){return e($),f(()=>e($).length)},itemName:"scale sets",emptyIconType:"cog",get showRetry(){return e(m)},get mobileCardConfig(){return D},$$events:{search:be,pageChange:Ee,perPageChange:Me,retry:$e,edit:fe,delete:ce}})}o(Te);var ue=a(Te,2);{var qe=t=>{ba(t,{$$events:{close:()=>r(ee,!1),submit:m=>c(m.detail)}})};x(ue,t=>{e(ee)&&t(qe)})}var me=a(ue,2);{var Fe=t=>{Ht(t,{get scaleSet(){return e(p)},$$events:{close:()=>{r(re,!1),r(p,null)},submit:m=>te(m.detail)}})};x(me,t=>{e(re)&&e(p)&&t(Fe)})}var ye=a(me,2);{var nr=t=>{{let m=ar(()=>(e(p),ct(Ne),f(()=>`Scale Set ${e(p).name} (${Ne(e(p))})`)));Nt(t,{title:"Delete Scale Set",message:"Are you sure you want to delete this scale set? This action cannot be undone and will remove all associated runners.",get itemName(){return e(m)},$$events:{close:()=>{r(G,!1),r(p,null)},confirm:ne}})}};x(ye,t=>{e(G)&&e(p)&&t(nr)})}var dr=a(ye,2);{var Be=t=>{gt(t,{$$events:{close:()=>{}},children:(m,he)=>{var i=ma(),u=s(i);Ft(u,{message:"Loading scale set details..."}),o(i),v(m,i)},$$slots:{default:!0}})};x(dr,t=>{e(J)&&t(Be)})}v(or,I),dt(),ir()}export{Fa as component}; +import{f as k,e as ke,a as v,s as H,t as Oe,c as we,h as Pt}from"../chunks/ZGz3X54u.js";import{i as st}from"../chunks/CY7Wcm-1.js";import{p as lt,v as Rt,o as it,g as e,m as n,d as r,q as zt,l as U,b as nt,f as V,s as a,c as s,r as o,t as S,n as rr,k as Ge,u as f,a as dt,i as ar,h as ct,$ as At}from"../chunks/kDtaAWAK.js";import{i as x,s as ut,a as vt}from"../chunks/Cun6jNAp.js";import{r as B,s as tr,b as He,g as A,d as tt,c as Dt}from"../chunks/CYK-UalN.js";import{P as Ut}from"../chunks/DacI6VAP.js";import{e as Ar,i as Dr}from"../chunks/DdT9Vz5Q.js";import{b as le,a as at}from"../chunks/CYnNqrHp.js";import{p as It}from"../chunks/CdEA5IGF.js";import{M as gt}from"../chunks/CVBpH3Sf.js";import{J as Lt,U as jt,a as Ot,b as Gt}from"../chunks/C6-Yv_jr.js";import{e as X}from"../chunks/BZiHL9L3.js";import{w as Ur}from"../chunks/KU08Mex1.js";import{e as pt,a as ot}from"../chunks/Vo3Mv3dp.js";import{U as Ht}from"../chunks/DAg7Eq1U.js";import{D as Nt}from"../chunks/Dxx83T0m.js";import{D as qt,G as Ir,L as Ft}from"../chunks/BKeluGSY.js";import{t as Se}from"../chunks/BVGCMSWJ.js";import{e as Ne,h as Bt}from"../chunks/ZelbukuJ.js";import{E as Vt}from"../chunks/Dd4NFVf9.js";import{E as Jt}from"../chunks/oWoYyEl8.js";import{S as Wt}from"../chunks/BStwtkX8.js";import{A as Kt}from"../chunks/rb89c4PS.js";import{P as Qt}from"../chunks/CiCSB29J.js";import"../chunks/DWgB-t1g.js";var Xt=k('

'),Yt=k('
'),Zt=k(""),ea=k(''),ra=k('
'),ta=k(""),aa=k(''),oa=k('
Loading templates...
'),sa=k(""),la=k('

Templates define how the runner software is installed and configured.

',1),ia=k('

Create a template first or proceed without a template to use default behavior.

'),na=k('

Select an entity first to see available templates

'),da=k(''),ca=k('
'),ua=k('

Entity & Provider Configuration

Image & OS Configuration

Runner Limits & Timing

Advanced Settings

Extra Specs (JSON)
',1),va=k('
Creating...
'),ga=k('

Create New Scale Set

Scale sets are only available for GitHub endpoints

Entity Level *
'),pa=k(" ",1);function ba(or,sr){lt(sr,!1);const[lr,ir]=ut(),j=()=>vt(pt,"$eagerCache",lr),ie=n(),$=n(),N=Rt();let Y=n(!1),P=n(""),d=n(""),C=n([]),Z=n([]),_=n([]),O=n(!1),ee=n(!1),re=n(!1),G=n(!1),p=n(null),J=n(""),c=n(""),te=n(""),ne=n(""),de=n(""),ge=n(void 0),pe=n(void 0),$e=n(void 0),Ce=n("garm"),D=n("linux"),be=n("amd64"),Ee=n(""),Me=n(!0),fe=n(!1),ce=n("{}"),I=n(void 0);async function Te(){try{r(ee,!0),r(Z,await A.listProviders())}catch(i){r(P,X(i))}finally{r(ee,!1)}}async function Pe(){try{r(re,!0);const i=Re();if(!i){r(_,[]);return}if(r(_,await A.listTemplates(e(D),void 0,i)),!e(I)||!e(_).find(u=>u.id===e(I))){const u=e(_).find(y=>y.owner_id==="system");u?r(I,u.id):e(_).length>0&&r(I,e(_)[0].id)}}catch(i){r(P,X(i))}finally{r(re,!1)}}function Re(){if(!e(c)||!e(C))return null;const i=e(C).find(u=>u.id===e(c));if(!i)return null;if("forge_type"in i)return i.forge_type;if("endpoint"in i){const u=i.endpoint;if(u&&"endpoint_type"in u)return u.endpoint_type||null}return"github"}function ue(){if(!e(c)||!e(C))return!1;const i=e(C).find(u=>u.id===e(c));return i&&"agent_mode"in i?i.agent_mode??!1:!1}async function qe(){if(e(d))try{switch(r(O,!0),r(C,[]),e(d)){case"repository":r(C,await A.listRepositories());break;case"organization":r(C,await A.listOrganizations());break;case"enterprise":r(C,await A.listEnterprises());break}}catch(i){r(P,X(i))}finally{r(O,!1)}}function me(i){e(d)!==i&&(r(d,i),r(c,""),r(I,void 0),qe())}function Fe(i){if(i.operation!=="update")return;const u=i.payload;if(e(d)==="repository"&&u.id===e(c)){const y=j().repositories.find(L=>L.id===e(c));y&&(Object.assign(y,u),r($,ue()))}else if(e(d)==="organization"&&u.id===e(c)){const y=j().organizations.find(L=>L.id===e(c));y&&(Object.assign(y,u),r($,ue()))}else if(e(d)==="enterprise"&&u.id===e(c)){const y=j().enterprises.find(L=>L.id===e(c));y&&(Object.assign(y,u),r($,ue()))}}async function ye(i){if(!(!e(c)||!e(d)))try{switch(e(d)){case"repository":await A.updateRepository(e(c),i);break;case"organization":await A.updateOrganization(e(c),i);break;case"enterprise":await A.updateEnterprise(e(c),i);break}await qe(),r(G,!1)}catch(u){throw u}}function nr(){return!e(c)||!e(C)?null:e(C).find(i=>i.id===e(c))||null}async function dr(){if(!e(ie)){r(P,"Please fill in all required fields");return}try{r(Y,!0),r(P,"");let i={};if(e(ce).trim())try{i=JSON.parse(e(ce))}catch{throw new Error("Invalid JSON in extra specs")}const u={name:e(J),provider_name:e(te),image:e(ne),flavor:e(de),max_runners:e(ge)||10,min_idle_runners:e(pe)||0,runner_bootstrap_timeout:e($e)||20,runner_prefix:e(Ce),os_type:e(D),os_arch:e(be),"github-runner-group":e(Ee)||void 0,enabled:e(Me),enable_shell:e(fe),extra_specs:e(ce).trim()?i:void 0,template_id:e(I)};let y;switch(e(d)){case"repository":y=await A.createRepositoryScaleSet(e(c),u);break;case"organization":y=await A.createOrganizationScaleSet(e(c),u);break;case"enterprise":y=await A.createEnterpriseScaleSet(e(c),u);break;default:throw new Error("Invalid entity level selected")}N("submit",y)}catch(i){r(P,X(i))}finally{r(Y,!1)}}it(()=>{Te(),e(d)&&(e(d)==="repository"||e(d)==="organization"||e(d)==="enterprise")&&r(p,Ur.subscribeToEntity(e(d),["update"],Fe))}),zt(()=>{e(p)&&(e(p)(),r(p,null))}),U(()=>(e(Y),e(J),e(d),e(c),e(te),e(ne),e(de)),()=>{r(ie,!e(Y)&&e(J).trim()!==""&&e(d)!==""&&e(c)!==""&&e(te)!==""&&e(ne).trim()!==""&&e(de).trim()!=="")}),U(()=>{},()=>{r($,ue())}),U(()=>e($),()=>{e($)||r(fe,!1)}),U(()=>(e(c),e(D)),()=>{e(c)&&e(D)&&Pe()}),U(()=>(e(D),e(c)),()=>{e(D)&&e(c)&&Pe()}),U(()=>(e(d),e(p),Ur),()=>{e(d)&&(e(d)==="repository"||e(d)==="organization"||e(d)==="enterprise")&&(e(p)&&e(p)(),r(p,Ur.subscribeToEntity(e(d),["update"],Fe)))}),nt(),st();var Be=pa(),t=V(Be);gt(t,{$$events:{close:()=>N("close")},children:(i,u)=>{var y=ga(),L=a(s(y),2),Ve=s(L);{var ze=M=>{var q=Xt(),_e=s(q),Ye=s(_e,!0);o(_e),o(q),S(()=>H(Ye,e(P))),v(M,q)};x(Ve,M=>{e(P)&&M(ze)})}var xe=a(Ve,2),Je=a(s(xe),2);B(Je),o(xe);var Ae=a(xe,2),We=s(Ae),W=a(s(We),2),ae=s(W),De=a(ae,2),Ke=a(De,2);o(W),o(We),o(Ae);var Qe=a(Ae,2);{var oe=M=>{var q=ua(),_e=V(q),Ye=a(s(_e),2),ur=s(Ye),vr=s(ur),ft=s(vr);rr(),o(vr);var mt=a(vr,2);{var yt=l=>{var h=Yt();v(l,h)},ht=l=>{var h=ea();S(()=>{e(c),Ge(()=>{e(d),e(C)})});var z=s(h),se=s(z);o(z),z.value=z.__value="";var K=a(z);Ar(K,1,()=>e(C),Dr,(w,g)=>{var E=Zt(),Q=s(E);{var Le=b=>{var R=Oe();S(()=>H(R,`${e(g),f(()=>e(g).owner)??""}/${e(g),f(()=>e(g).name)??""} (${e(g),f(()=>e(g).endpoint?.name||"Unknown endpoint")??""})`)),v(b,R)},F=b=>{var R=Oe();S(()=>H(R,`${e(g),f(()=>e(g).name)??""} (${e(g),f(()=>e(g).endpoint?.name||"Unknown endpoint")??""})`)),v(b,R)};x(Q,b=>{e(d)==="repository"?b(Le):b(F,!1)})}o(E);var T={};S(()=>{T!==(T=(e(g),f(()=>e(g).id)))&&(E.value=(E.__value=(e(g),f(()=>e(g).id)))??"")}),v(w,E)}),o(h),S(()=>H(se,`Select a ${e(d)??""}`)),He(h,()=>e(c),w=>r(c,w)),v(l,h)};x(mt,l=>{e(O)?l(yt):l(ht,!1)})}o(ur);var Lr=a(ur,2),xt=a(s(Lr),2);{var _t=l=>{var h=ra();v(l,h)},kt=l=>{var h=aa();S(()=>{e(te),Ge(()=>{e(Z)})});var z=s(h);z.value=z.__value="";var se=a(z);Ar(se,1,()=>e(Z),Dr,(K,w)=>{var g=ta(),E=s(g,!0);o(g);var Q={};S(()=>{H(E,(e(w),f(()=>e(w).name))),Q!==(Q=(e(w),f(()=>e(w).name)))&&(g.value=(g.__value=(e(w),f(()=>e(w).name)))??"")}),v(K,g)}),o(h),He(h,()=>e(te),K=>r(te,K)),v(l,h)};x(xt,l=>{e(ee)?l(_t):l(kt,!1)})}o(Lr),o(Ye),o(_e);var gr=a(_e,2),pr=a(s(gr),2),br=s(pr),jr=a(s(br),2);B(jr),o(br);var fr=a(br,2),Or=a(s(fr),2);B(Or),o(fr);var mr=a(fr,2),yr=a(s(mr),2);S(()=>{e(D),Ge(()=>{})});var hr=s(yr);hr.value=hr.__value="linux";var Gr=a(hr);Gr.value=Gr.__value="windows",o(yr),o(mr);var Hr=a(mr,2),xr=a(s(Hr),2);S(()=>{e(be),Ge(()=>{})});var _r=s(xr);_r.value=_r.__value="amd64";var Nr=a(_r);Nr.value=Nr.__value="arm64",o(xr),o(Hr),o(pr);var qr=a(pr,2),wt=a(s(qr),2);{var St=l=>{var h=oa();v(l,h)},$t=l=>{var h=we(),z=V(h);{var se=w=>{var g=la(),E=V(g);S(()=>{e(I),Ge(()=>{e(_)})}),Ar(E,5,()=>e(_),Dr,(T,b)=>{var R=sa(),je=s(R),Pr=a(je);{var Rr=zr=>{var rt=Oe();S(()=>H(rt,`- ${e(b),f(()=>e(b).description)??""}`)),v(zr,rt)};x(Pr,zr=>{e(b),f(()=>e(b).description)&&zr(Rr)})}o(R);var er={};S(()=>{H(je,`${e(b),f(()=>e(b).name)??""} ${e(b),f(()=>e(b).owner_id==="system"?"(System)":"")??""} `),er!==(er=(e(b),f(()=>e(b).id)))&&(R.value=(R.__value=(e(b),f(()=>e(b).id)))??"")}),v(T,R)}),o(E);var Q=a(E,2),Le=a(s(Q));{var F=T=>{var b=Oe();S(R=>H(b,`Showing templates for ${R??""} ${e(D)??""}.`),[()=>f(Re)]),v(T,b)};x(Le,T=>{e(c)&&T(F)})}o(Q),He(E,()=>e(I),T=>r(I,T)),v(w,g)},K=w=>{var g=we(),E=V(g);{var Q=F=>{var T=ia(),b=s(T),R=s(b);o(b);var je=a(b,2),Pr=s(je);rr(),o(je),o(T),S((Rr,er)=>{H(R,`No templates found for ${Rr??""} ${e(D)??""}.`),Dt(Pr,"href",er)},[()=>f(Re),()=>(ct(tt),f(()=>tt("/templates")))]),v(F,T)},Le=F=>{var T=na();v(F,T)};x(E,F=>{e(c)?F(Q):F(Le,!1)},!0)}v(w,g)};x(z,w=>{e(_),f(()=>e(_).length>0)?w(se):w(K,!1)},!0)}v(l,h)};x(wt,l=>{e(re)?l(St):l($t,!1)})}o(qr),o(gr);var kr=a(gr,2),Fr=a(s(kr),2),wr=s(Fr),Br=a(s(wr),2);B(Br),o(wr);var Sr=a(wr,2),Vr=a(s(Sr),2);B(Vr),o(Sr);var Jr=a(Sr,2),Wr=a(s(Jr),2);B(Wr),o(Jr),o(Fr),o(kr);var Kr=a(kr,2),$r=a(s(Kr),2),Cr=s($r),Qr=a(s(Cr),2);B(Qr),o(Cr);var Xr=a(Cr,2),Yr=a(s(Xr),2);B(Yr),o(Xr),o($r);var Er=a($r,2),Ct=a(s(Er),2);Lt(Ct,{rows:4,placeholder:"{}",get value(){return e(ce)},set value(l){r(ce,l)},$$legacy:!0}),o(Er);var Mr=a(Er,2),Zr=s(Mr);B(Zr),rr(2),o(Mr);var et=a(Mr,2),Tr=s(et),Ze=s(Tr);B(Ze);var Et=a(Ze,2);rr(2),o(Tr);var Mt=a(Tr,2);{var Tt=l=>{var h=ca(),z=a(s(h),2),se=s(z),K=a(se);{var w=g=>{var E=da();ke("click",E,()=>r(G,!0)),v(g,E)};x(K,g=>{e(c)&&g(w)})}o(z),o(h),S(()=>H(se,`Shell access requires agent mode to be enabled on the ${e(d)??""}. `)),v(l,h)};x(Mt,l=>{e($)||l(Tt)})}o(et),o(Kr),S(l=>{H(ft,`${l??""} `),Ze.disabled=!e($),tr(Et,1,`ml-2 block text-sm font-medium text-gray-700 dark:text-gray-300 ${e($)?"":"opacity-50"}`)},[()=>(e(d),f(()=>e(d).charAt(0).toUpperCase()+e(d).slice(1)))]),le(jr,()=>e(ne),l=>r(ne,l)),le(Or,()=>e(de),l=>r(de,l)),He(yr,()=>e(D),l=>r(D,l)),He(xr,()=>e(be),l=>r(be,l)),le(Br,()=>e(pe),l=>r(pe,l)),le(Vr,()=>e(ge),l=>r(ge,l)),le(Wr,()=>e($e),l=>r($e,l)),le(Qr,()=>e(Ce),l=>r(Ce,l)),le(Yr,()=>e(Ee),l=>r(Ee,l)),at(Zr,()=>e(Me),l=>r(Me,l)),at(Ze,()=>e(fe),l=>r(fe,l)),v(M,q)};x(Qe,M=>{e(d)&&M(oe)})}var ve=a(Qe,2),Xe=s(ve),Ue=a(Xe,2),Ie=s(Ue);{var cr=M=>{var q=va();v(M,q)},bt=M=>{var q=Oe("Create Scale Set");v(M,q)};x(Ie,M=>{e(Y)?M(cr):M(bt,!1)})}o(Ue),o(ve),o(L),o(y),S(()=>{tr(ae,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="repository"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),tr(De,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="organization"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),tr(Ke,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(d)==="enterprise"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),Ue.disabled=!e(ie)}),le(Je,()=>e(J),M=>r(J,M)),ke("click",ae,()=>me("repository")),ke("click",De,()=>me("organization")),ke("click",Ke,()=>me("enterprise")),ke("click",Xe,()=>N("close")),ke("submit",L,It(dr)),v(i,y)},$$slots:{default:!0}});var m=a(t,2);{var he=i=>{const u=ar(()=>f(nr));var y=we(),L=V(y);{var Ve=ze=>{var xe=we(),Je=V(xe);{var Ae=W=>{jt(W,{get repository(){return e(u)},$$events:{close:()=>r(G,!1),submit:ae=>ye(ae.detail)}})},We=W=>{var ae=we(),De=V(ae);{var Ke=oe=>{Ot(oe,{get organization(){return e(u)},$$events:{close:()=>r(G,!1),submit:ve=>ye(ve.detail)}})},Qe=oe=>{var ve=we(),Xe=V(ve);{var Ue=Ie=>{Gt(Ie,{get enterprise(){return e(u)},$$events:{close:()=>r(G,!1),submit:cr=>ye(cr.detail)}})};x(Xe,Ie=>{e(d)==="enterprise"&&Ie(Ue)},!0)}v(oe,ve)};x(De,oe=>{e(d)==="organization"?oe(Ke):oe(Qe,!1)},!0)}v(W,ae)};x(Je,W=>{e(d)==="repository"?W(Ae):W(We,!1)})}v(ze,xe)};x(L,ze=>{e(u)&&ze(Ve)})}v(i,y)};x(m,i=>{e(G)&&e(c)&&i(he)})}v(or,Be),dt(),ir()}const fa={};var ma=k('
'),ya=k('
',1);function Fa(or,sr){lt(sr,!1);const[lr,ir]=ut(),j=()=>vt(pt,"$eagerCache",lr),ie=n(),$=n(),N=n(),Y=n();let P=n([]),d=n(!0),C=n(""),Z=n(""),_=n(1),O=n(25),ee=n(!1),re=n(!1),G=n(!1),p=n(null),J=n(!1);async function c(t){try{r(C,""),r(ee,!1),Se.success("Scale Set Created","Scale set has been created successfully.")}catch(m){throw r(C,X(m)),m}}async function te(t){if(e(p))try{await A.updateScaleSet(e(p).id,t),Se.success("Scale Set Updated",`Scale set ${e(p).name} has been updated successfully.`),r(re,!1),r(p,null)}catch(m){const he=X(m);throw Se.error("Update Failed",he),m}}async function ne(){if(e(p))try{await A.deleteScaleSet(e(p).id),Se.success("Scale Set Deleted",`Scale set ${e(p).name} has been deleted successfully.`)}catch(t){const m=X(t);Se.error("Delete Failed",m)}finally{r(G,!1),r(p,null)}}function de(){r(ee,!0)}async function ge(t){try{r(J,!0);const m=await A.getScaleSet(t.id);r(p,m),r(re,!0)}catch(m){const he=X(m);Se.error("Failed to Load Scale Set Details",he)}finally{r(J,!1)}}function pe(t){r(p,t),r(G,!0)}it(async()=>{try{r(d,!0);const t=await ot.getScaleSets();t&&Array.isArray(t)&&r(P,t)}catch(t){fa?.VITEST||console.error("Failed to load scale sets:",t),r(C,X(t))}finally{r(d,!1)}});async function $e(){try{await ot.retryResource("scalesets")}catch(t){console.error("Retry failed:",t)}}const Ce=[{key:"name",title:"Name",cellComponent:Vt,cellProps:{entityType:"scaleset"}},{key:"image",title:"Image",cellComponent:Ir,cellProps:{field:"image",type:"code",showTitle:!0}},{key:"provider",title:"Provider",cellComponent:Ir,cellProps:{field:"provider_name"}},{key:"flavor",title:"Flavor",cellComponent:Ir,cellProps:{field:"flavor"}},{key:"entity",title:"Entity",cellComponent:Qt},{key:"endpoint",title:"Endpoint",cellComponent:Jt},{key:"status",title:"Status",cellComponent:Wt,cellProps:{statusType:"enabled"}},{key:"actions",title:"Actions",align:"right",cellComponent:Kt}],D={entityType:"scaleset",primaryText:{field:"name",isClickable:!0,href:"/scalesets/{id}"},secondaryText:{field:"entity_name",computedValue:t=>Ne(t)},badges:[{type:"custom",value:t=>({variant:t.enabled?"success":"error",text:t.enabled?"Enabled":"Disabled"})}],actions:[{type:"edit",handler:t=>ge(t)},{type:"delete",handler:t=>pe(t)}]};function be(t){r(Z,t.detail.term),r(_,1)}function Ee(t){r(_,t.detail.page)}function Me(t){r(O,t.detail.perPage),r(_,1)}function fe(t){ge(t.detail.item)}function ce(t){pe(t.detail.item)}U(()=>(e(P),j()),()=>{(!e(P).length||j().loaded.scalesets)&&r(P,j().scalesets)}),U(()=>j(),()=>{r(d,j().loading.scalesets)}),U(()=>j(),()=>{r(ie,j().errorMessages.scalesets)}),U(()=>(e(P),e(Z),Ne),()=>{r($,Bt(e(P),e(Z),t=>Ne(t)))}),U(()=>(e($),e(O)),()=>{r(N,Math.ceil(e($).length/e(O)))}),U(()=>(e(_),e(N)),()=>{e(_)>e(N)&&e(N)>0&&r(_,e(N))}),U(()=>(e($),e(_),e(O)),()=>{r(Y,e($).slice((e(_)-1)*e(O),e(_)*e(O)))}),nt(),st();var I=ya();Pt(t=>{At.title="Scale Sets - GARM"});var Te=V(I),Pe=s(Te);Ut(Pe,{title:"Scale Sets",description:"Manage GitHub runner scale sets",actionLabel:"Add Scale Set",$$events:{action:de}});var Re=a(Pe,2);{let t=ar(()=>e(ie)||e(C)),m=ar(()=>!!e(ie));qt(Re,{get columns(){return Ce},get data(){return e(Y)},get loading(){return e(d)},get error(){return e(t)},get searchTerm(){return e(Z)},searchPlaceholder:"Search by entity name...",get currentPage(){return e(_)},get perPage(){return e(O)},get totalPages(){return e(N)},get totalItems(){return e($),f(()=>e($).length)},itemName:"scale sets",emptyIconType:"cog",get showRetry(){return e(m)},get mobileCardConfig(){return D},$$events:{search:be,pageChange:Ee,perPageChange:Me,retry:$e,edit:fe,delete:ce}})}o(Te);var ue=a(Te,2);{var qe=t=>{ba(t,{$$events:{close:()=>r(ee,!1),submit:m=>c(m.detail)}})};x(ue,t=>{e(ee)&&t(qe)})}var me=a(ue,2);{var Fe=t=>{Ht(t,{get scaleSet(){return e(p)},$$events:{close:()=>{r(re,!1),r(p,null)},submit:m=>te(m.detail)}})};x(me,t=>{e(re)&&e(p)&&t(Fe)})}var ye=a(me,2);{var nr=t=>{{let m=ar(()=>(e(p),ct(Ne),f(()=>`Scale Set ${e(p).name} (${Ne(e(p))})`)));Nt(t,{title:"Delete Scale Set",message:"Are you sure you want to delete this scale set? This action cannot be undone and will remove all associated runners.",get itemName(){return e(m)},$$events:{close:()=>{r(G,!1),r(p,null)},confirm:ne}})}};x(ye,t=>{e(G)&&e(p)&&t(nr)})}var dr=a(ye,2);{var Be=t=>{gt(t,{$$events:{close:()=>{}},children:(m,he)=>{var i=ma(),u=s(i);Ft(u,{message:"Loading scale set details..."}),o(i),v(m,i)},$$slots:{default:!0}})};x(dr,t=>{e(J)&&t(Be)})}v(or,I),dt(),ir()}export{Fa as component}; diff --git a/webapp/assets/_app/immutable/nodes/2.DwM7F70n.js b/webapp/assets/_app/immutable/nodes/2.CyNGYHEu.js similarity index 99% rename from webapp/assets/_app/immutable/nodes/2.DwM7F70n.js rename to webapp/assets/_app/immutable/nodes/2.CyNGYHEu.js index 23ef1dc2..5369b5fb 100644 --- a/webapp/assets/_app/immutable/nodes/2.DwM7F70n.js +++ b/webapp/assets/_app/immutable/nodes/2.CyNGYHEu.js @@ -1 +1 @@ -import{f as y,b as Et,a as h,s as S,e as Pe,h as Tt}from"../chunks/ZGz3X54u.js";import{i as st}from"../chunks/CY7Wcm-1.js";import{p as it,v as Pt,l as Le,d as v,m as C,g as e,b as nt,f as qt,c as r,s as a,r as t,n as P,h as f,u,t as T,a as lt,o as Dt,q as Wt,$ as Vt,j as J}from"../chunks/kDtaAWAK.js";import{p as Jt,i as U,s as Ft,a as Ot}from"../chunks/Cun6jNAp.js";import{e as Nt,i as Qt}from"../chunks/DdT9Vz5Q.js";import{B as Kt,r as N,s as ae,g as dt,d as E,c as te}from"../chunks/Cvcp5xHB.js";import{w as Re}from"../chunks/KU08Mex1.js";import{e as Xt,a as Me}from"../chunks/C2c_wqo6.js";import{b as re,a as Yt}from"../chunks/CYnNqrHp.js";import{p as Zt}from"../chunks/CdEA5IGF.js";import{M as er}from"../chunks/C6jYEeWP.js";import{T as F}from"../chunks/Ckgw6FMz.js";import{t as ot}from"../chunks/BVGCMSWJ.js";import{e as tr}from"../chunks/BZiHL9L3.js";var rr=Et(' Settings',1),ar=y('Enabled'),or=y('Disabled'),sr=y('
Agent Releases URL
'),ir=y('
Metadata
'),nr=y('
Callback
'),lr=y('
Webhook
'),dr=y('
Agent
'),cr=y('

No URLs configured

'),vr=y('
Controller Webhook URL

Use this URL in your GitHub organization/repository webhook settings

'),ur=y('

Please enter a valid URL

'),gr=y('

Please enter a valid URL

'),mr=y('

Please enter a valid URL

'),pr=y('

Please enter a valid URL

'),br=y('

Please enter a valid URL

'),xr=y('

Controller Settings

URL where runners can fetch metadata and setup information

URL where runners send status updates and lifecycle events

URL where GitHub/Gitea will send webhook events for job notifications

URL where GARM agents connect. Must support websocket connections

Time to wait before spinning up a runner for a new job (0 = immediate)

URL where GARM fetches garm-agent binaries (must be compatible with GitHub releases API)

Automatically synchronize garm-agent tools from the configured releases URL

'),fr=y('

Controller Information

Identity

Controller ID
Hostname
Job Age Backoff
Agent Tools Sync

Integration URLs

',1);function hr(Ae,me){it(me,!1);const m=C(),pe=C();let s=Jt(me,"controllerInfo",12);const be=Pt();let l=C(!1),$=C(!1),R=C(""),z=C(""),p=C(""),j=C(""),B=C(null),G=C(""),O=C(!1);function xe(){v(R,s().metadata_url||""),v(z,s().callback_url||""),v(p,s().webhook_url||""),v(j,s().agent_url||""),v(B,s().minimum_job_age_backoff||null),v(G,s().garm_agent_releases_url||""),v(O,s().enable_agent_tools_sync??!1),v(l,!0)}async function Ce(){try{v($,!0);const o={};e(R).trim()&&(o.metadata_url=e(R).trim()),e(z).trim()&&(o.callback_url=e(z).trim()),e(p).trim()&&(o.webhook_url=e(p).trim()),e(j).trim()&&(o.agent_url=e(j).trim()),e(B)!==null&&e(B)>=0&&(o.minimum_job_age_backoff=e(B)),e(G).trim()&&(o.garm_agent_releases_url=e(G).trim()),o.enable_agent_tools_sync=e(O);const d=await dt.updateController(o);ot.success("Settings Updated","Controller settings have been updated successfully."),v(l,!1),s(d),be("updated",d)}catch(o){ot.error("Update Failed",o instanceof Error?o.message:"Failed to update controller settings")}finally{v($,!1)}}function Q(){v(l,!1),v(R,""),v(z,""),v(p,""),v(j,""),v(B,null),v(G,""),v(O,!1)}Le(()=>{},()=>{v(m,o=>{if(!o.trim())return!0;try{return new URL(o),!0}catch{return!1}})}),Le(()=>(e(m),e(R),e(z),e(p),e(j),e(G),e(B)),()=>{v(pe,e(m)(e(R))&&e(m)(e(z))&&e(m)(e(p))&&e(m)(e(j))&&e(m)(e(G))&&(e(B)===null||e(B)>=0))}),nt(),st();var oe=fr(),se=qt(oe),K=r(se),X=r(K),ie=r(X),ne=a(r(ie),2),le=a(r(ne),2),de=r(le),fe=r(de);t(de),t(le),t(ne),t(ie);var he=a(ie,2);Kt(he,{variant:"secondary",size:"sm",$$events:{click:xe},children:(o,d)=>{var g=rr();P(),h(o,g)},$$slots:{default:!0}}),t(X);var ce=a(X,2),n=r(ce),i=r(n),w=a(r(i),2),M=r(w),k=a(r(M),2),L=r(k,!0);t(k),t(M);var I=a(M,2),V=a(r(I),2),Y=r(V,!0);t(V),t(I);var q=a(I,2),D=r(q),W=a(r(D),2),Z=r(W);F(Z,{title:"Job Age Backoff",content:"Time in seconds GARM waits after receiving a new job before spinning up a runner. This delay allows existing idle runners to pick up jobs first, preventing unnecessary runner creation. Set to 0 for immediate response."}),t(W),t(D);var ee=a(D,2),ze=r(ee);t(ee),t(q);var ve=a(q,2),ue=r(ve),qe=a(r(ue),2),ct=r(qe);F(ct,{title:"Agent Tools Sync",content:"When enabled, GARM will automatically synchronize garm-agent tools from the configured releases URL. This ensures agents are up-to-date with the latest versions."}),t(qe),t(ue);var De=a(ue,2),vt=r(De);{var ut=o=>{var d=ar();h(o,d)},gt=o=>{var d=or();h(o,d)};U(vt,o=>{f(s()),u(()=>s().enable_agent_tools_sync)?o(ut):o(gt,!1)})}t(De),t(ve);var mt=a(ve,2);{var pt=o=>{var d=sr(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Agent Releases URL",content:"URL from where GARM fetches garm-agent binaries. Must be compatible with the GitHub releases API format. Defaults to the official garm-agent releases repository."}),t(b),t(g);var x=a(g,2),_=r(x,!0);t(x),t(d),T(()=>S(_,(f(s()),u(()=>s().garm_agent_releases_url)))),h(o,d)};U(mt,o=>{f(s()),u(()=>s().garm_agent_releases_url)&&o(pt)})}t(w),t(i),t(n);var We=a(n,2),Ve=r(We),Je=a(r(Ve),2),Fe=r(Je);{var bt=o=>{var d=ir(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Metadata URL",content:"URL where runners retrieve setup information and metadata. Runners must be able to connect to this URL during their initialization process. Usually accessible at /api/v1/metadata endpoint."}),t(b),t(g);var x=a(g,2),_=r(x,!0);t(x),t(d),T(()=>S(_,(f(s()),u(()=>s().metadata_url)))),h(o,d)};U(Fe,o=>{f(s()),u(()=>s().metadata_url)&&o(bt)})}var Oe=a(Fe,2);{var xt=o=>{var d=nr(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Callback URL",content:"URL where runners send status updates and system information (OS version, runner agent ID, etc.) to the controller. Runners must be able to connect to this URL. Usually accessible at /api/v1/callbacks endpoint."}),t(b),t(g);var x=a(g,2),_=r(x,!0);t(x),t(d),T(()=>S(_,(f(s()),u(()=>s().callback_url)))),h(o,d)};U(Oe,o=>{f(s()),u(()=>s().callback_url)&&o(xt)})}var Ne=a(Oe,2);{var ft=o=>{var d=lr(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Webhook Base URL",content:"Base URL for webhooks where GitHub sends job notifications. GARM needs to receive these webhooks to know when to create new runners for jobs. GitHub must be able to connect to this URL. Usually accessible at /webhooks endpoint."}),t(b),t(g);var x=a(g,2),_=r(x,!0);t(x),t(d),T(()=>S(_,(f(s()),u(()=>s().webhook_url)))),h(o,d)};U(Ne,o=>{f(s()),u(()=>s().webhook_url)&&o(ft)})}var Qe=a(Ne,2);{var ht=o=>{var d=dr(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Agent URL",content:"URL where GARM agents connect for communication. This URL must support websocket connections for real-time communication between the controller and agent instances. Usually accessible at /agent endpoint."}),t(b),t(g);var x=a(g,2),_=r(x,!0);t(x),t(d),T(()=>S(_,(f(s()),u(()=>s().agent_url)))),h(o,d)};U(Qe,o=>{f(s()),u(()=>s().agent_url)&&o(ht)})}var yt=a(Qe,2);{var kt=o=>{var d=cr(),g=a(r(d),4);t(d),Pe("click",g,xe),h(o,d)};U(yt,o=>{f(s()),u(()=>!s().metadata_url&&!s().callback_url&&!s().webhook_url&&!s().agent_url)&&o(kt)})}t(Je),t(Ve),t(We),t(ce);var _t=a(ce,2);{var wt=o=>{var d=vr(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Controller Webhook URL",content:"Unique webhook URL for this GARM controller. This is the preferred URL to use in GitHub webhook settings as it's controller-specific and allows multiple GARM controllers to work with the same repository. Automatically combines the webhook base URL with the controller ID."}),t(b),t(g);var x=a(g,2),_=r(x),ge=a(r(_),2),ye=r(ge),Se=r(ye,!0);t(ye),P(2),t(ge),t(_),t(x),t(d),T(()=>S(Se,(f(s()),u(()=>s().controller_webhook_url)))),h(o,d)};U(_t,o=>{f(s()),u(()=>s().controller_webhook_url)&&o(wt)})}t(K),t(se);var Ut=a(se,2);{var Rt=o=>{er(o,{$$events:{close:Q},children:(d,g)=>{var b=xr(),A=a(r(b),2),x=r(A),_=a(r(x),2);N(_);let ge;var ye=a(_,2);{var Se=c=>{var H=ur();h(c,H)};U(ye,c=>{e(m),e(R),u(()=>!e(m)(e(R)))&&c(Se)})}P(2),t(x);var $e=a(x,2),ke=a(r($e),2);N(ke);let Ke;var Mt=a(ke,2);{var Lt=c=>{var H=gr();h(c,H)};U(Mt,c=>{e(m),e(z),u(()=>!e(m)(e(z)))&&c(Lt)})}P(2),t($e);var je=a($e,2),_e=a(r(je),2);N(_e);let Xe;var At=a(_e,2);{var Ct=c=>{var H=mr();h(c,H)};U(At,c=>{e(m),e(p),u(()=>!e(m)(e(p)))&&c(Ct)})}P(2),t(je);var Ge=a(je,2),we=a(r(Ge),2);N(we);let Ye;var zt=a(we,2);{var St=c=>{var H=pr();h(c,H)};U(zt,c=>{e(m),e(j),u(()=>!e(m)(e(j)))&&c(St)})}P(2),t(Ge);var Ie=a(Ge,2),Ze=a(r(Ie),2);N(Ze),P(2),t(Ie);var Be=a(Ie,2),Ue=a(r(Be),2);N(Ue);let et;var $t=a(Ue,2);{var jt=c=>{var H=br();h(c,H)};U($t,c=>{e(m),e(G),u(()=>!e(m)(e(G)))&&c(jt)})}P(2),t(Be);var He=a(Be,2),tt=r(He),rt=r(tt);N(rt),P(2),t(tt),P(2),t(He);var at=a(He,2),Ee=r(at),Te=a(Ee,2),Gt=r(Te,!0);t(Te),t(at),t(A),t(b),T((c,H,It,Bt,Ht)=>{ge=ae(_,1,"block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white sm:text-sm",null,ge,c),Ke=ae(ke,1,"block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white sm:text-sm",null,Ke,H),Xe=ae(_e,1,"block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white sm:text-sm",null,Xe,It),Ye=ae(we,1,"block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white sm:text-sm",null,Ye,Bt),et=ae(Ue,1,"block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white sm:text-sm",null,et,Ht),Ee.disabled=e($),Te.disabled=!e(pe)||e($),S(Gt,e($)?"Saving...":"Save Changes")},[()=>({"border-red-300":!e(m)(e(R))}),()=>({"border-red-300":!e(m)(e(z))}),()=>({"border-red-300":!e(m)(e(p))}),()=>({"border-red-300":!e(m)(e(j))}),()=>({"border-red-300":!e(m)(e(G))})]),re(_,()=>e(R),c=>v(R,c)),re(ke,()=>e(z),c=>v(z,c)),re(_e,()=>e(p),c=>v(p,c)),re(we,()=>e(j),c=>v(j,c)),re(Ze,()=>e(B),c=>v(B,c)),re(Ue,()=>e(G),c=>v(G,c)),Yt(rt,()=>e(O),c=>v(O,c)),Pe("click",Ee,Q),Pe("submit",A,Zt(Ce)),h(d,b)},$$slots:{default:!0}})};U(Ut,o=>{e(l)&&o(Rt)})}T(o=>{S(fe,`v${o??""}`),S(L,(f(s()),u(()=>s().controller_id))),S(Y,(f(s()),u(()=>s().hostname||"Unknown"))),S(ze,`${f(s()),u(()=>s().minimum_job_age_backoff||30)??""}s`)},[()=>(f(s()),u(()=>s().version?.replace(/^v/,"")||"Unknown"))]),h(Ae,oe),lt()}var yr=y('

Error loading dashboard

'),kr=y('
'),_r=y('

Dashboard

Welcome to GARM - GitHub Actions Runner Manager

');function Hr(Ae,me){it(me,!1);const[m,pe]=Ft(),s=()=>Ot(Xt,"$eagerCache",m),be=C();let l=C({repositories:0,organizations:0,pools:0,instances:0}),$=C(null),R=C(""),z=[];function p(n,i,w=1e3){const M=parseInt(n.textContent||"0"),k=(i-M)/(w/16);let L=M;const I=()=>{if(L+=k,k>0&&L>=i||k<0&&L<=i){n.textContent=i.toString();return}n.textContent=Math.floor(L).toString(),requestAnimationFrame(I)};M!==i&&requestAnimationFrame(I)}Dt(async()=>{try{const[k,L,I,V,Y]=await Promise.all([Me.getRepositories(),Me.getOrganizations(),Me.getPools(),dt.listInstances(),Me.getControllerInfo()]);setTimeout(()=>{const q=document.querySelector('[data-stat="repositories"]'),D=document.querySelector('[data-stat="organizations"]'),W=document.querySelector('[data-stat="pools"]'),Z=document.querySelector('[data-stat="instances"]');q&&p(q,k.length),D&&p(D,L.length),W&&p(W,I.length),Z&&p(Z,V.length)},100),v(l,{repositories:k.length,organizations:L.length,pools:I.length,instances:V.length}),Y&&v($,Y)}catch(k){v(R,tr(k)),console.error("Dashboard error:",k)}const n=Re.subscribeToEntity("repository",["create","delete"],j),i=Re.subscribeToEntity("organization",["create","delete"],B),w=Re.subscribeToEntity("pool",["create","delete"],G),M=Re.subscribeToEntity("instance",["create","delete"],O);z=[n,i,w,M]}),Wt(()=>{z.forEach(n=>n())});function j(n){const i=document.querySelector('[data-stat="repositories"]');n.operation==="create"?(J(l,e(l).repositories++),i&&p(i,e(l).repositories,500)):n.operation==="delete"&&(J(l,e(l).repositories=Math.max(0,e(l).repositories-1)),i&&p(i,e(l).repositories,500))}function B(n){const i=document.querySelector('[data-stat="organizations"]');n.operation==="create"?(J(l,e(l).organizations++),i&&p(i,e(l).organizations,500)):n.operation==="delete"&&(J(l,e(l).organizations=Math.max(0,e(l).organizations-1)),i&&p(i,e(l).organizations,500))}function G(n){const i=document.querySelector('[data-stat="pools"]');n.operation==="create"?(J(l,e(l).pools++),i&&p(i,e(l).pools,500)):n.operation==="delete"&&(J(l,e(l).pools=Math.max(0,e(l).pools-1)),i&&p(i,e(l).pools,500))}function O(n){const i=document.querySelector('[data-stat="instances"]');n.operation==="create"?(J(l,e(l).instances++),i&&p(i,e(l).instances,500)):n.operation==="delete"&&(J(l,e(l).instances=Math.max(0,e(l).instances-1)),i&&p(i,e(l).instances,500))}function xe(n){v($,n.detail)}function Ce(n){return{blue:"bg-blue-500 text-white",green:"bg-green-500 text-white",purple:"bg-purple-500 text-white",yellow:"bg-yellow-500 text-white"}[n]||"bg-gray-500 text-white"}Le(()=>(e($),s()),()=>{(!e($)||s().loaded.controllerInfo)&&v($,s().controllerInfo)}),Le(()=>(e(l),E),()=>{v(be,[{title:"Repositories",value:e(l).repositories,icon:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z",color:"blue",href:E("/repositories")},{title:"Organizations",value:e(l).organizations,icon:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z",color:"green",href:E("/organizations")},{title:"Pools",value:e(l).pools,icon:"M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z",color:"purple",href:E("/pools")},{title:"Instances",value:e(l).instances,icon:"M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z",color:"yellow",href:E("/instances")}])}),nt(),st();var Q=_r();Tt(n=>{Vt.title="Dashboard - GARM"});var oe=a(r(Q),2);{var se=n=>{var i=yr(),w=r(i),M=a(r(w),2),k=a(r(M),2),L=r(k,!0);t(k),t(M),t(w),t(i),T(()=>S(L,e(R))),h(n,i)};U(oe,n=>{e(R)&&n(se)})}var K=a(oe,2);Nt(K,5,()=>e(be),Qt,(n,i)=>{var w=kr(),M=r(w),k=r(M),L=r(k),I=r(L),V=r(I),Y=r(V);t(V),t(I),t(L);var q=a(L,2),D=r(q),W=r(D),Z=r(W,!0);t(W);var ee=a(W,2),ze=r(ee,!0);t(ee),t(D),t(q),t(k),t(M),t(w),T((ve,ue)=>{te(w,"href",(e(i),u(()=>e(i).href))),ae(I,1,`w-8 h-8 rounded-md ${ve??""} flex items-center justify-center`),te(Y,"d",(e(i),u(()=>e(i).icon))),S(Z,(e(i),u(()=>e(i).title))),te(ee,"data-stat",ue),S(ze,(e(i),u(()=>e(i).value)))},[()=>(e(i),u(()=>Ce(e(i).color))),()=>(e(i),u(()=>e(i).title.toLowerCase()))]),h(n,w)}),t(K);var X=a(K,2);{var ie=n=>{hr(n,{get controllerInfo(){return e($)},$$events:{updated:xe}})};U(X,n=>{e($)&&n(ie)})}var ne=a(X,2),le=r(ne),de=a(r(le),4),fe=r(de),he=a(fe,2),ce=a(he,2);t(de),t(le),t(ne),t(Q),T((n,i,w)=>{te(fe,"href",n),te(he,"href",i),te(ce,"href",w)},[()=>(f(E),u(()=>E("/repositories"))),()=>(f(E),u(()=>E("/pools"))),()=>(f(E),u(()=>E("/instances")))]),h(Ae,Q),lt(),pe()}export{Hr as component}; +import{f as y,b as Et,a as h,s as S,e as Pe,h as Tt}from"../chunks/ZGz3X54u.js";import{i as st}from"../chunks/CY7Wcm-1.js";import{p as it,v as Pt,l as Le,d as v,m as C,g as e,b as nt,f as qt,c as r,s as a,r as t,n as P,h as f,u,t as T,a as lt,o as Dt,q as Wt,$ as Vt,j as J}from"../chunks/kDtaAWAK.js";import{p as Jt,i as U,s as Ft,a as Ot}from"../chunks/Cun6jNAp.js";import{e as Nt,i as Qt}from"../chunks/DdT9Vz5Q.js";import{B as Kt,r as N,s as ae,g as dt,d as E,c as te}from"../chunks/CYK-UalN.js";import{w as Re}from"../chunks/KU08Mex1.js";import{e as Xt,a as Me}from"../chunks/Vo3Mv3dp.js";import{b as re,a as Yt}from"../chunks/CYnNqrHp.js";import{p as Zt}from"../chunks/CdEA5IGF.js";import{M as er}from"../chunks/CVBpH3Sf.js";import{T as F}from"../chunks/ONKDshdz.js";import{t as ot}from"../chunks/BVGCMSWJ.js";import{e as tr}from"../chunks/BZiHL9L3.js";var rr=Et(' Settings',1),ar=y('Enabled'),or=y('Disabled'),sr=y('
Agent Releases URL
'),ir=y('
Metadata
'),nr=y('
Callback
'),lr=y('
Webhook
'),dr=y('
Agent
'),cr=y('

No URLs configured

'),vr=y('
Controller Webhook URL

Use this URL in your GitHub organization/repository webhook settings

'),ur=y('

Please enter a valid URL

'),gr=y('

Please enter a valid URL

'),mr=y('

Please enter a valid URL

'),pr=y('

Please enter a valid URL

'),br=y('

Please enter a valid URL

'),xr=y('

Controller Settings

URL where runners can fetch metadata and setup information

URL where runners send status updates and lifecycle events

URL where GitHub/Gitea will send webhook events for job notifications

URL where GARM agents connect. Must support websocket connections

Time to wait before spinning up a runner for a new job (0 = immediate)

URL where GARM fetches garm-agent binaries (must be compatible with GitHub releases API)

Automatically synchronize garm-agent tools from the configured releases URL

'),fr=y('

Controller Information

Identity

Controller ID
Hostname
Job Age Backoff
Agent Tools Sync

Integration URLs

',1);function hr(Ae,me){it(me,!1);const m=C(),pe=C();let s=Jt(me,"controllerInfo",12);const be=Pt();let l=C(!1),$=C(!1),R=C(""),z=C(""),p=C(""),j=C(""),B=C(null),G=C(""),O=C(!1);function xe(){v(R,s().metadata_url||""),v(z,s().callback_url||""),v(p,s().webhook_url||""),v(j,s().agent_url||""),v(B,s().minimum_job_age_backoff||null),v(G,s().garm_agent_releases_url||""),v(O,s().enable_agent_tools_sync??!1),v(l,!0)}async function Ce(){try{v($,!0);const o={};e(R).trim()&&(o.metadata_url=e(R).trim()),e(z).trim()&&(o.callback_url=e(z).trim()),e(p).trim()&&(o.webhook_url=e(p).trim()),e(j).trim()&&(o.agent_url=e(j).trim()),e(B)!==null&&e(B)>=0&&(o.minimum_job_age_backoff=e(B)),e(G).trim()&&(o.garm_agent_releases_url=e(G).trim()),o.enable_agent_tools_sync=e(O);const d=await dt.updateController(o);ot.success("Settings Updated","Controller settings have been updated successfully."),v(l,!1),s(d),be("updated",d)}catch(o){ot.error("Update Failed",o instanceof Error?o.message:"Failed to update controller settings")}finally{v($,!1)}}function Q(){v(l,!1),v(R,""),v(z,""),v(p,""),v(j,""),v(B,null),v(G,""),v(O,!1)}Le(()=>{},()=>{v(m,o=>{if(!o.trim())return!0;try{return new URL(o),!0}catch{return!1}})}),Le(()=>(e(m),e(R),e(z),e(p),e(j),e(G),e(B)),()=>{v(pe,e(m)(e(R))&&e(m)(e(z))&&e(m)(e(p))&&e(m)(e(j))&&e(m)(e(G))&&(e(B)===null||e(B)>=0))}),nt(),st();var oe=fr(),se=qt(oe),K=r(se),X=r(K),ie=r(X),ne=a(r(ie),2),le=a(r(ne),2),de=r(le),fe=r(de);t(de),t(le),t(ne),t(ie);var he=a(ie,2);Kt(he,{variant:"secondary",size:"sm",$$events:{click:xe},children:(o,d)=>{var g=rr();P(),h(o,g)},$$slots:{default:!0}}),t(X);var ce=a(X,2),n=r(ce),i=r(n),w=a(r(i),2),M=r(w),k=a(r(M),2),L=r(k,!0);t(k),t(M);var I=a(M,2),V=a(r(I),2),Y=r(V,!0);t(V),t(I);var q=a(I,2),D=r(q),W=a(r(D),2),Z=r(W);F(Z,{title:"Job Age Backoff",content:"Time in seconds GARM waits after receiving a new job before spinning up a runner. This delay allows existing idle runners to pick up jobs first, preventing unnecessary runner creation. Set to 0 for immediate response."}),t(W),t(D);var ee=a(D,2),ze=r(ee);t(ee),t(q);var ve=a(q,2),ue=r(ve),qe=a(r(ue),2),ct=r(qe);F(ct,{title:"Agent Tools Sync",content:"When enabled, GARM will automatically synchronize garm-agent tools from the configured releases URL. This ensures agents are up-to-date with the latest versions."}),t(qe),t(ue);var De=a(ue,2),vt=r(De);{var ut=o=>{var d=ar();h(o,d)},gt=o=>{var d=or();h(o,d)};U(vt,o=>{f(s()),u(()=>s().enable_agent_tools_sync)?o(ut):o(gt,!1)})}t(De),t(ve);var mt=a(ve,2);{var pt=o=>{var d=sr(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Agent Releases URL",content:"URL from where GARM fetches garm-agent binaries. Must be compatible with the GitHub releases API format. Defaults to the official garm-agent releases repository."}),t(b),t(g);var x=a(g,2),_=r(x,!0);t(x),t(d),T(()=>S(_,(f(s()),u(()=>s().garm_agent_releases_url)))),h(o,d)};U(mt,o=>{f(s()),u(()=>s().garm_agent_releases_url)&&o(pt)})}t(w),t(i),t(n);var We=a(n,2),Ve=r(We),Je=a(r(Ve),2),Fe=r(Je);{var bt=o=>{var d=ir(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Metadata URL",content:"URL where runners retrieve setup information and metadata. Runners must be able to connect to this URL during their initialization process. Usually accessible at /api/v1/metadata endpoint."}),t(b),t(g);var x=a(g,2),_=r(x,!0);t(x),t(d),T(()=>S(_,(f(s()),u(()=>s().metadata_url)))),h(o,d)};U(Fe,o=>{f(s()),u(()=>s().metadata_url)&&o(bt)})}var Oe=a(Fe,2);{var xt=o=>{var d=nr(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Callback URL",content:"URL where runners send status updates and system information (OS version, runner agent ID, etc.) to the controller. Runners must be able to connect to this URL. Usually accessible at /api/v1/callbacks endpoint."}),t(b),t(g);var x=a(g,2),_=r(x,!0);t(x),t(d),T(()=>S(_,(f(s()),u(()=>s().callback_url)))),h(o,d)};U(Oe,o=>{f(s()),u(()=>s().callback_url)&&o(xt)})}var Ne=a(Oe,2);{var ft=o=>{var d=lr(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Webhook Base URL",content:"Base URL for webhooks where GitHub sends job notifications. GARM needs to receive these webhooks to know when to create new runners for jobs. GitHub must be able to connect to this URL. Usually accessible at /webhooks endpoint."}),t(b),t(g);var x=a(g,2),_=r(x,!0);t(x),t(d),T(()=>S(_,(f(s()),u(()=>s().webhook_url)))),h(o,d)};U(Ne,o=>{f(s()),u(()=>s().webhook_url)&&o(ft)})}var Qe=a(Ne,2);{var ht=o=>{var d=dr(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Agent URL",content:"URL where GARM agents connect for communication. This URL must support websocket connections for real-time communication between the controller and agent instances. Usually accessible at /agent endpoint."}),t(b),t(g);var x=a(g,2),_=r(x,!0);t(x),t(d),T(()=>S(_,(f(s()),u(()=>s().agent_url)))),h(o,d)};U(Qe,o=>{f(s()),u(()=>s().agent_url)&&o(ht)})}var yt=a(Qe,2);{var kt=o=>{var d=cr(),g=a(r(d),4);t(d),Pe("click",g,xe),h(o,d)};U(yt,o=>{f(s()),u(()=>!s().metadata_url&&!s().callback_url&&!s().webhook_url&&!s().agent_url)&&o(kt)})}t(Je),t(Ve),t(We),t(ce);var _t=a(ce,2);{var wt=o=>{var d=vr(),g=r(d),b=a(r(g),2),A=r(b);F(A,{title:"Controller Webhook URL",content:"Unique webhook URL for this GARM controller. This is the preferred URL to use in GitHub webhook settings as it's controller-specific and allows multiple GARM controllers to work with the same repository. Automatically combines the webhook base URL with the controller ID."}),t(b),t(g);var x=a(g,2),_=r(x),ge=a(r(_),2),ye=r(ge),Se=r(ye,!0);t(ye),P(2),t(ge),t(_),t(x),t(d),T(()=>S(Se,(f(s()),u(()=>s().controller_webhook_url)))),h(o,d)};U(_t,o=>{f(s()),u(()=>s().controller_webhook_url)&&o(wt)})}t(K),t(se);var Ut=a(se,2);{var Rt=o=>{er(o,{$$events:{close:Q},children:(d,g)=>{var b=xr(),A=a(r(b),2),x=r(A),_=a(r(x),2);N(_);let ge;var ye=a(_,2);{var Se=c=>{var H=ur();h(c,H)};U(ye,c=>{e(m),e(R),u(()=>!e(m)(e(R)))&&c(Se)})}P(2),t(x);var $e=a(x,2),ke=a(r($e),2);N(ke);let Ke;var Mt=a(ke,2);{var Lt=c=>{var H=gr();h(c,H)};U(Mt,c=>{e(m),e(z),u(()=>!e(m)(e(z)))&&c(Lt)})}P(2),t($e);var je=a($e,2),_e=a(r(je),2);N(_e);let Xe;var At=a(_e,2);{var Ct=c=>{var H=mr();h(c,H)};U(At,c=>{e(m),e(p),u(()=>!e(m)(e(p)))&&c(Ct)})}P(2),t(je);var Ge=a(je,2),we=a(r(Ge),2);N(we);let Ye;var zt=a(we,2);{var St=c=>{var H=pr();h(c,H)};U(zt,c=>{e(m),e(j),u(()=>!e(m)(e(j)))&&c(St)})}P(2),t(Ge);var Ie=a(Ge,2),Ze=a(r(Ie),2);N(Ze),P(2),t(Ie);var Be=a(Ie,2),Ue=a(r(Be),2);N(Ue);let et;var $t=a(Ue,2);{var jt=c=>{var H=br();h(c,H)};U($t,c=>{e(m),e(G),u(()=>!e(m)(e(G)))&&c(jt)})}P(2),t(Be);var He=a(Be,2),tt=r(He),rt=r(tt);N(rt),P(2),t(tt),P(2),t(He);var at=a(He,2),Ee=r(at),Te=a(Ee,2),Gt=r(Te,!0);t(Te),t(at),t(A),t(b),T((c,H,It,Bt,Ht)=>{ge=ae(_,1,"block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white sm:text-sm",null,ge,c),Ke=ae(ke,1,"block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white sm:text-sm",null,Ke,H),Xe=ae(_e,1,"block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white sm:text-sm",null,Xe,It),Ye=ae(we,1,"block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white sm:text-sm",null,Ye,Bt),et=ae(Ue,1,"block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white sm:text-sm",null,et,Ht),Ee.disabled=e($),Te.disabled=!e(pe)||e($),S(Gt,e($)?"Saving...":"Save Changes")},[()=>({"border-red-300":!e(m)(e(R))}),()=>({"border-red-300":!e(m)(e(z))}),()=>({"border-red-300":!e(m)(e(p))}),()=>({"border-red-300":!e(m)(e(j))}),()=>({"border-red-300":!e(m)(e(G))})]),re(_,()=>e(R),c=>v(R,c)),re(ke,()=>e(z),c=>v(z,c)),re(_e,()=>e(p),c=>v(p,c)),re(we,()=>e(j),c=>v(j,c)),re(Ze,()=>e(B),c=>v(B,c)),re(Ue,()=>e(G),c=>v(G,c)),Yt(rt,()=>e(O),c=>v(O,c)),Pe("click",Ee,Q),Pe("submit",A,Zt(Ce)),h(d,b)},$$slots:{default:!0}})};U(Ut,o=>{e(l)&&o(Rt)})}T(o=>{S(fe,`v${o??""}`),S(L,(f(s()),u(()=>s().controller_id))),S(Y,(f(s()),u(()=>s().hostname||"Unknown"))),S(ze,`${f(s()),u(()=>s().minimum_job_age_backoff||30)??""}s`)},[()=>(f(s()),u(()=>s().version?.replace(/^v/,"")||"Unknown"))]),h(Ae,oe),lt()}var yr=y('

Error loading dashboard

'),kr=y('
'),_r=y('

Dashboard

Welcome to GARM - GitHub Actions Runner Manager

');function Hr(Ae,me){it(me,!1);const[m,pe]=Ft(),s=()=>Ot(Xt,"$eagerCache",m),be=C();let l=C({repositories:0,organizations:0,pools:0,instances:0}),$=C(null),R=C(""),z=[];function p(n,i,w=1e3){const M=parseInt(n.textContent||"0"),k=(i-M)/(w/16);let L=M;const I=()=>{if(L+=k,k>0&&L>=i||k<0&&L<=i){n.textContent=i.toString();return}n.textContent=Math.floor(L).toString(),requestAnimationFrame(I)};M!==i&&requestAnimationFrame(I)}Dt(async()=>{try{const[k,L,I,V,Y]=await Promise.all([Me.getRepositories(),Me.getOrganizations(),Me.getPools(),dt.listInstances(),Me.getControllerInfo()]);setTimeout(()=>{const q=document.querySelector('[data-stat="repositories"]'),D=document.querySelector('[data-stat="organizations"]'),W=document.querySelector('[data-stat="pools"]'),Z=document.querySelector('[data-stat="instances"]');q&&p(q,k.length),D&&p(D,L.length),W&&p(W,I.length),Z&&p(Z,V.length)},100),v(l,{repositories:k.length,organizations:L.length,pools:I.length,instances:V.length}),Y&&v($,Y)}catch(k){v(R,tr(k)),console.error("Dashboard error:",k)}const n=Re.subscribeToEntity("repository",["create","delete"],j),i=Re.subscribeToEntity("organization",["create","delete"],B),w=Re.subscribeToEntity("pool",["create","delete"],G),M=Re.subscribeToEntity("instance",["create","delete"],O);z=[n,i,w,M]}),Wt(()=>{z.forEach(n=>n())});function j(n){const i=document.querySelector('[data-stat="repositories"]');n.operation==="create"?(J(l,e(l).repositories++),i&&p(i,e(l).repositories,500)):n.operation==="delete"&&(J(l,e(l).repositories=Math.max(0,e(l).repositories-1)),i&&p(i,e(l).repositories,500))}function B(n){const i=document.querySelector('[data-stat="organizations"]');n.operation==="create"?(J(l,e(l).organizations++),i&&p(i,e(l).organizations,500)):n.operation==="delete"&&(J(l,e(l).organizations=Math.max(0,e(l).organizations-1)),i&&p(i,e(l).organizations,500))}function G(n){const i=document.querySelector('[data-stat="pools"]');n.operation==="create"?(J(l,e(l).pools++),i&&p(i,e(l).pools,500)):n.operation==="delete"&&(J(l,e(l).pools=Math.max(0,e(l).pools-1)),i&&p(i,e(l).pools,500))}function O(n){const i=document.querySelector('[data-stat="instances"]');n.operation==="create"?(J(l,e(l).instances++),i&&p(i,e(l).instances,500)):n.operation==="delete"&&(J(l,e(l).instances=Math.max(0,e(l).instances-1)),i&&p(i,e(l).instances,500))}function xe(n){v($,n.detail)}function Ce(n){return{blue:"bg-blue-500 text-white",green:"bg-green-500 text-white",purple:"bg-purple-500 text-white",yellow:"bg-yellow-500 text-white"}[n]||"bg-gray-500 text-white"}Le(()=>(e($),s()),()=>{(!e($)||s().loaded.controllerInfo)&&v($,s().controllerInfo)}),Le(()=>(e(l),E),()=>{v(be,[{title:"Repositories",value:e(l).repositories,icon:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z",color:"blue",href:E("/repositories")},{title:"Organizations",value:e(l).organizations,icon:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z",color:"green",href:E("/organizations")},{title:"Pools",value:e(l).pools,icon:"M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z",color:"purple",href:E("/pools")},{title:"Instances",value:e(l).instances,icon:"M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z",color:"yellow",href:E("/instances")}])}),nt(),st();var Q=_r();Tt(n=>{Vt.title="Dashboard - GARM"});var oe=a(r(Q),2);{var se=n=>{var i=yr(),w=r(i),M=a(r(w),2),k=a(r(M),2),L=r(k,!0);t(k),t(M),t(w),t(i),T(()=>S(L,e(R))),h(n,i)};U(oe,n=>{e(R)&&n(se)})}var K=a(oe,2);Nt(K,5,()=>e(be),Qt,(n,i)=>{var w=kr(),M=r(w),k=r(M),L=r(k),I=r(L),V=r(I),Y=r(V);t(V),t(I),t(L);var q=a(L,2),D=r(q),W=r(D),Z=r(W,!0);t(W);var ee=a(W,2),ze=r(ee,!0);t(ee),t(D),t(q),t(k),t(M),t(w),T((ve,ue)=>{te(w,"href",(e(i),u(()=>e(i).href))),ae(I,1,`w-8 h-8 rounded-md ${ve??""} flex items-center justify-center`),te(Y,"d",(e(i),u(()=>e(i).icon))),S(Z,(e(i),u(()=>e(i).title))),te(ee,"data-stat",ue),S(ze,(e(i),u(()=>e(i).value)))},[()=>(e(i),u(()=>Ce(e(i).color))),()=>(e(i),u(()=>e(i).title.toLowerCase()))]),h(n,w)}),t(K);var X=a(K,2);{var ie=n=>{hr(n,{get controllerInfo(){return e($)},$$events:{updated:xe}})};U(X,n=>{e($)&&n(ie)})}var ne=a(X,2),le=r(ne),de=a(r(le),4),fe=r(de),he=a(fe,2),ce=a(he,2);t(de),t(le),t(ne),t(Q),T((n,i,w)=>{te(fe,"href",n),te(he,"href",i),te(ce,"href",w)},[()=>(f(E),u(()=>E("/repositories"))),()=>(f(E),u(()=>E("/pools"))),()=>(f(E),u(()=>E("/instances")))]),h(Ae,Q),lt(),pe()}export{Hr as component}; diff --git a/webapp/assets/_app/immutable/nodes/20.D8JTfsn9.js b/webapp/assets/_app/immutable/nodes/20.DITIOxJB.js similarity index 96% rename from webapp/assets/_app/immutable/nodes/20.D8JTfsn9.js rename to webapp/assets/_app/immutable/nodes/20.DITIOxJB.js index 8f1e7d35..8d731d46 100644 --- a/webapp/assets/_app/immutable/nodes/20.D8JTfsn9.js +++ b/webapp/assets/_app/immutable/nodes/20.DITIOxJB.js @@ -1 +1 @@ -import{f as _,h as ea,a as u,s as n,c as yt}from"../chunks/ZGz3X54u.js";import{i as aa}from"../chunks/CY7Wcm-1.js";import{p as ra,o as da,q as sa,l as ia,b as la,f as T,t as h,a as na,u as i,h as g,g as t,m as b,c as a,s,d as v,$ as oa,r,j as A,i as $}from"../chunks/kDtaAWAK.js";import{i as f}from"../chunks/Cun6jNAp.js";import{d as k,c as L,g as O,s as ae}from"../chunks/Cvcp5xHB.js";import{p as re}from"../chunks/DH5setay.js";import{g as de}from"../chunks/BU_V7FOQ.js";import{U as va}from"../chunks/BS0eXXA4.js";import{D as se}from"../chunks/lQWw1Z23.js";import{I as ca}from"../chunks/vYI-AT_7.js";import{D as ma}from"../chunks/CRSOHHg7.js";import{w as ie}from"../chunks/KU08Mex1.js";import{t as H}from"../chunks/BVGCMSWJ.js";import{e as le}from"../chunks/BZiHL9L3.js";import{e as E,i as J,j as ne,b as P,g as oe}from"../chunks/DNHT2U_W.js";import{F as xa}from"../chunks/JRrg5LRu.js";var ua=_('

Loading scale set...

'),ga=_('

'),fa=_(' '),pa=_(' '),_a=_('Default system template'),ya=_('
GitHub Runner Group
'),ha=_('

Extra Specifications

 
'),ba=_('

Basic Information

Scale Set ID
Name
Provider
Forge Type
Image
Flavor
Status
Entity
Created At
Updated At

Configuration

Max Runners
Min Idle Runners
Bootstrap Timeout
Runner Prefix
OS Type / Architecture
Shell Access
Runner Install Template
',1),ka=_(' ',1);function La(ve,ce){ra(ce,!1);const N=b();let e=b(null),j=b(!0),F=b(""),R=b(!1),U=b(!1),B=b(!1),p=b(null),C=null;async function ht(){if(!(!t(N)||isNaN(t(N))))try{v(j,!0),v(F,""),v(e,await O.getScaleSet(t(N))),t(e).instances||A(e,t(e).instances=[])}catch(d){v(F,d instanceof Error?d.message:"Failed to load scale set")}finally{v(j,!1)}}async function me(d){if(t(e))try{await O.updateScaleSet(t(e).id,d),await ht(),H.success("Scale Set Updated",`Scale Set ${t(e).name} has been updated successfully.`),v(R,!1)}catch(l){throw l}}async function xe(){if(t(e)){try{await O.deleteScaleSet(t(e).id),de(k("/scalesets"))}catch(d){const l=le(d);H.error("Delete Failed",l)}v(U,!1)}}async function ue(){if(t(p)){try{await O.deleteInstance(t(p).name),H.success("Instance Deleted",`Instance ${t(p).name} has been deleted successfully.`)}catch(d){const l=le(d);H.error("Delete Failed",l)}v(B,!1),v(p,null)}}function ge(d){v(p,d),v(B,!0)}function fe(d){if(!d)return"{}";try{if(typeof d=="string"){const l=JSON.parse(d);return JSON.stringify(l,null,2)}return JSON.stringify(d,null,2)}catch{return d.toString()}}function pe(d){if(d.operation==="update"){const l=d.payload;t(e)&&l.id===t(e).id&&v(e,l)}else if(d.operation==="delete"){const l=d.payload.id||d.payload;t(e)&&t(e).id===l&&de(k("/scalesets"))}}function _e(d){if(!t(e))return;const l=d.payload;if(l.scale_set_id===t(e).id){if(t(e).instances||A(e,t(e).instances=[]),d.operation==="create")A(e,t(e).instances=[...t(e).instances,l]);else if(d.operation==="update")A(e,t(e).instances=t(e).instances.map(S=>S.id===l.id?l:S));else if(d.operation==="delete"){const S=l.id||l;A(e,t(e).instances=t(e).instances.filter(W=>W.id!==S))}v(e,t(e))}}da(()=>{ht();const d=ie.subscribeToEntity("scaleset",["update","delete"],pe),l=ie.subscribeToEntity("instance",["create","update","delete"],_e);C=()=>{d(),l()}}),sa(()=>{C&&(C(),C=null)}),ia(()=>re,()=>{v(N,parseInt(re.params.id||"0"))}),la(),aa();var bt=ka();ea(d=>{h(()=>oa.title=`${t(e),i(()=>t(e)?`${t(e).name} - Scale Set Details`:"Scale Set Details")??""} - GARM`)});var q=T(bt),z=a(q),kt=a(z),V=a(kt),ye=a(V);r(V);var St=s(V,2),wt=a(St),It=s(a(wt),2),he=a(It,!0);r(It),r(wt),r(St),r(kt),r(z);var be=s(z,2);{var ke=d=>{var l=ua();u(d,l)},Se=d=>{var l=yt(),S=T(l);{var W=w=>{var I=ga(),G=a(I),K=a(G,!0);r(G),r(I),h(()=>n(K,t(F))),u(w,I)},Ee=w=>{var I=yt(),G=T(I);{var K=Q=>{var Et=ba(),Mt=T(Et);{let o=$(()=>(t(e),i(()=>t(e).name||"Scale Set"))),c=$(()=>(g(E),t(e),i(()=>E(t(e))))),m=$(()=>(g(J),t(e),i(()=>J(t(e))))),x=$(()=>(g(oe),i(()=>oe("github"))));ma(Mt,{get title(){return t(o)},get subtitle(){return`Scale set for ${t(c)??""} (${t(m)??""}) • GitHub Runner Scale Set`},get forgeIcon(){return t(x)},onEdit:()=>v(R,!0),onDelete:()=>v(U,!0)})}var X=s(Mt,2),Y=a(X),Tt=a(Y),At=s(a(Tt),2),Z=a(At),Nt=s(a(Z),2),Me=a(Nt,!0);r(Nt),r(Z);var tt=s(Z,2),Ft=s(a(tt),2),Te=a(Ft,!0);r(Ft),r(tt);var et=s(tt,2),Rt=s(a(et),2),Ae=a(Rt,!0);r(Rt),r(et);var at=s(et,2),Ut=s(a(at),2),Ne=a(Ut);xa(Ne,{get item(){return t(e)}}),r(Ut),r(at);var rt=s(at,2),Bt=s(a(rt),2),Ct=a(Bt),Fe=a(Ct,!0);r(Ct),r(Bt),r(rt);var dt=s(rt,2),Gt=s(a(dt),2),Re=a(Gt,!0);r(Gt),r(dt);var st=s(dt,2),Lt=s(a(st),2),it=a(Lt),Ue=a(it,!0);r(it),r(Lt),r(st);var lt=s(st,2),Ot=s(a(lt),2),Ht=a(Ot),nt=a(Ht),Be=a(nt,!0);r(nt);var ot=s(nt,2),Ce=a(ot,!0);r(ot),r(Ht),r(Ot),r(lt);var vt=s(lt,2),Jt=s(a(vt),2),Ge=a(Jt,!0);r(Jt),r(vt);var Pt=s(vt,2),jt=s(a(Pt),2),Le=a(jt,!0);r(jt),r(Pt),r(At),r(Tt),r(Y);var qt=s(Y,2),zt=a(qt),Vt=s(a(zt),2),ct=a(Vt),Wt=s(a(ct),2),Oe=a(Wt,!0);r(Wt),r(ct);var mt=s(ct,2),Kt=s(a(mt),2),He=a(Kt,!0);r(Kt),r(mt);var xt=s(mt,2),Qt=s(a(xt),2),Je=a(Qt);r(Qt),r(xt);var ut=s(xt,2),Xt=s(a(ut),2),Pe=a(Xt,!0);r(Xt),r(ut);var gt=s(ut,2),Yt=s(a(gt),2),je=a(Yt);r(Yt),r(gt);var ft=s(gt,2),Zt=s(a(ft),2),pt=a(Zt),qe=a(pt,!0);r(pt),r(Zt),r(ft);var _t=s(ft,2),te=s(a(_t),2),ze=a(te);{var Ve=o=>{var c=fa(),m=a(c,!0);r(c),h(x=>{L(c,"href",x),n(m,(t(e),i(()=>t(e).template_name)))},[()=>(g(k),t(e),i(()=>k(`/templates/${t(e).template_id}`)))]),u(o,c)},We=o=>{var c=yt(),m=T(c);{var x=y=>{var D=pa(),Ze=a(D);r(D),h(ta=>{L(D,"href",ta),n(Ze,`Template ID: ${t(e),i(()=>t(e).template_id)??""}`)},[()=>(g(k),t(e),i(()=>k(`/templates/${t(e).template_id}`)))]),u(y,D)},M=y=>{var D=_a();u(y,D)};f(m,y=>{t(e),i(()=>t(e).template_id)?y(x):y(M,!1)},!0)}u(o,c)};f(ze,o=>{t(e),i(()=>t(e).template_name)?o(Ve):o(We,!1)})}r(te),r(_t);var Ke=s(_t,2);{var Qe=o=>{var c=ya(),m=s(a(c),2),x=a(m,!0);r(m),r(c),h(()=>n(x,(t(e),i(()=>t(e)["github-runner-group"])))),u(o,c)};f(Ke,o=>{t(e),i(()=>t(e)["github-runner-group"])&&o(Qe)})}r(Vt),r(zt),r(qt),r(X);var ee=s(X,2);{var Xe=o=>{var c=ha(),m=a(c),x=s(a(m),2),M=a(x,!0);r(x),r(m),r(c),h(y=>n(M,y),[()=>(t(e),i(()=>fe(t(e).extra_specs)))]),u(o,c)};f(ee,o=>{t(e),i(()=>t(e).extra_specs)&&o(Xe)})}var Ye=s(ee,2);{let o=$(()=>(t(e),i(()=>t(e).instances||[])));ca(Ye,{get instances(){return t(o)},entityType:"scaleset",onDeleteInstance:ge})}h((o,c,m,x,M)=>{n(Me,(t(e),i(()=>t(e).id))),n(Te,(t(e),i(()=>t(e).name))),n(Ae,(t(e),i(()=>t(e).provider_name))),n(Fe,(t(e),i(()=>t(e).image))),n(Re,(t(e),i(()=>t(e).flavor))),ae(it,1,`inline-flex px-2 py-1 text-xs font-medium rounded-full ${t(e),i(()=>t(e).enabled?"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200":"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200")??""}`),n(Ue,(t(e),i(()=>t(e).enabled?"Enabled":"Disabled"))),n(Be,o),L(ot,"href",c),n(Ce,m),n(Ge,x),n(Le,M),n(Oe,(t(e),i(()=>t(e).max_runners))),n(He,(t(e),i(()=>t(e).min_idle_runners))),n(Je,`${t(e),i(()=>t(e).runner_bootstrap_timeout)??""} minutes`),n(Pe,(t(e),i(()=>t(e).runner_prefix||"garm"))),n(je,`${t(e),i(()=>t(e).os_type)??""} / ${t(e),i(()=>t(e).os_arch)??""}`),ae(pt,1,`inline-flex px-2 py-1 text-xs font-medium rounded-full ${t(e),i(()=>t(e).enable_shell?"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200":"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200")??""}`),n(qe,(t(e),i(()=>t(e).enable_shell?"Enabled":"Disabled")))},[()=>(g(J),t(e),i(()=>J(t(e)))),()=>(g(ne),t(e),i(()=>ne(t(e)))),()=>(g(E),t(e),i(()=>E(t(e)))),()=>(g(P),t(e),i(()=>P(t(e).created_at||""))),()=>(g(P),t(e),i(()=>P(t(e).updated_at||"")))]),u(Q,Et)};f(G,Q=>{t(e)&&Q(K)},!0)}u(w,I)};f(S,w=>{t(F)?w(W):w(Ee,!1)},!0)}u(d,l)};f(be,d=>{t(j)?d(ke):d(Se,!1)})}r(q);var Dt=s(q,2);{var we=d=>{va(d,{get scaleSet(){return t(e)},$$events:{close:()=>v(R,!1),submit:l=>me(l.detail)}})};f(Dt,d=>{t(R)&&t(e)&&d(we)})}var $t=s(Dt,2);{var Ie=d=>{{let l=$(()=>(t(e),g(E),i(()=>`Scale Set ${t(e).name} (${E(t(e))})`)));se(d,{title:"Delete Scale Set",message:"Are you sure you want to delete this scale set? This action cannot be undone and will remove all associated runners.",get itemName(){return t(l)},$$events:{close:()=>v(U,!1),confirm:xe}})}};f($t,d=>{t(U)&&t(e)&&d(Ie)})}var De=s($t,2);{var $e=d=>{se(d,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return t(p),i(()=>t(p).name)},$$events:{close:()=>{v(B,!1),v(p,null)},confirm:ue}})};f(De,d=>{t(B)&&t(p)&&d($e)})}h(d=>{L(ye,"href",d),n(he,(t(e),i(()=>t(e)?t(e).name:"Loading...")))},[()=>(g(k),i(()=>k("/scalesets")))]),u(ve,bt),na()}export{La as component}; +import{f as _,h as ea,a as u,s as n,c as yt}from"../chunks/ZGz3X54u.js";import{i as aa}from"../chunks/CY7Wcm-1.js";import{p as ra,o as da,q as sa,l as ia,b as la,f as T,t as h,a as na,u as i,h as g,g as t,m as b,c as a,s,d as v,$ as oa,r,j as A,i as $}from"../chunks/kDtaAWAK.js";import{i as f}from"../chunks/Cun6jNAp.js";import{d as k,c as L,g as O,s as ae}from"../chunks/CYK-UalN.js";import{p as re}from"../chunks/Bql5nQdO.js";import{g as de}from"../chunks/C8dZhfFx.js";import{U as va}from"../chunks/DAg7Eq1U.js";import{D as se}from"../chunks/Dxx83T0m.js";import{I as ca}from"../chunks/B9RC0dq5.js";import{D as ma}from"../chunks/BrlhCerN.js";import{w as ie}from"../chunks/KU08Mex1.js";import{t as H}from"../chunks/BVGCMSWJ.js";import{e as le}from"../chunks/BZiHL9L3.js";import{e as E,i as J,j as ne,b as P,g as oe}from"../chunks/ZelbukuJ.js";import{F as xa}from"../chunks/DZ2a7TNP.js";var ua=_('

Loading scale set...

'),ga=_('

'),fa=_(' '),pa=_(' '),_a=_('Default system template'),ya=_('
GitHub Runner Group
'),ha=_('

Extra Specifications

 
'),ba=_('

Basic Information

Scale Set ID
Name
Provider
Forge Type
Image
Flavor
Status
Entity
Created At
Updated At

Configuration

Max Runners
Min Idle Runners
Bootstrap Timeout
Runner Prefix
OS Type / Architecture
Shell Access
Runner Install Template
',1),ka=_(' ',1);function La(ve,ce){ra(ce,!1);const N=b();let e=b(null),j=b(!0),F=b(""),R=b(!1),U=b(!1),B=b(!1),p=b(null),C=null;async function ht(){if(!(!t(N)||isNaN(t(N))))try{v(j,!0),v(F,""),v(e,await O.getScaleSet(t(N))),t(e).instances||A(e,t(e).instances=[])}catch(d){v(F,d instanceof Error?d.message:"Failed to load scale set")}finally{v(j,!1)}}async function me(d){if(t(e))try{await O.updateScaleSet(t(e).id,d),await ht(),H.success("Scale Set Updated",`Scale Set ${t(e).name} has been updated successfully.`),v(R,!1)}catch(l){throw l}}async function xe(){if(t(e)){try{await O.deleteScaleSet(t(e).id),de(k("/scalesets"))}catch(d){const l=le(d);H.error("Delete Failed",l)}v(U,!1)}}async function ue(){if(t(p)){try{await O.deleteInstance(t(p).name),H.success("Instance Deleted",`Instance ${t(p).name} has been deleted successfully.`)}catch(d){const l=le(d);H.error("Delete Failed",l)}v(B,!1),v(p,null)}}function ge(d){v(p,d),v(B,!0)}function fe(d){if(!d)return"{}";try{if(typeof d=="string"){const l=JSON.parse(d);return JSON.stringify(l,null,2)}return JSON.stringify(d,null,2)}catch{return d.toString()}}function pe(d){if(d.operation==="update"){const l=d.payload;t(e)&&l.id===t(e).id&&v(e,l)}else if(d.operation==="delete"){const l=d.payload.id||d.payload;t(e)&&t(e).id===l&&de(k("/scalesets"))}}function _e(d){if(!t(e))return;const l=d.payload;if(l.scale_set_id===t(e).id){if(t(e).instances||A(e,t(e).instances=[]),d.operation==="create")A(e,t(e).instances=[...t(e).instances,l]);else if(d.operation==="update")A(e,t(e).instances=t(e).instances.map(S=>S.id===l.id?l:S));else if(d.operation==="delete"){const S=l.id||l;A(e,t(e).instances=t(e).instances.filter(W=>W.id!==S))}v(e,t(e))}}da(()=>{ht();const d=ie.subscribeToEntity("scaleset",["update","delete"],pe),l=ie.subscribeToEntity("instance",["create","update","delete"],_e);C=()=>{d(),l()}}),sa(()=>{C&&(C(),C=null)}),ia(()=>re,()=>{v(N,parseInt(re.params.id||"0"))}),la(),aa();var bt=ka();ea(d=>{h(()=>oa.title=`${t(e),i(()=>t(e)?`${t(e).name} - Scale Set Details`:"Scale Set Details")??""} - GARM`)});var q=T(bt),z=a(q),kt=a(z),V=a(kt),ye=a(V);r(V);var St=s(V,2),wt=a(St),It=s(a(wt),2),he=a(It,!0);r(It),r(wt),r(St),r(kt),r(z);var be=s(z,2);{var ke=d=>{var l=ua();u(d,l)},Se=d=>{var l=yt(),S=T(l);{var W=w=>{var I=ga(),G=a(I),K=a(G,!0);r(G),r(I),h(()=>n(K,t(F))),u(w,I)},Ee=w=>{var I=yt(),G=T(I);{var K=Q=>{var Et=ba(),Mt=T(Et);{let o=$(()=>(t(e),i(()=>t(e).name||"Scale Set"))),c=$(()=>(g(E),t(e),i(()=>E(t(e))))),m=$(()=>(g(J),t(e),i(()=>J(t(e))))),x=$(()=>(g(oe),i(()=>oe("github"))));ma(Mt,{get title(){return t(o)},get subtitle(){return`Scale set for ${t(c)??""} (${t(m)??""}) • GitHub Runner Scale Set`},get forgeIcon(){return t(x)},onEdit:()=>v(R,!0),onDelete:()=>v(U,!0)})}var X=s(Mt,2),Y=a(X),Tt=a(Y),At=s(a(Tt),2),Z=a(At),Nt=s(a(Z),2),Me=a(Nt,!0);r(Nt),r(Z);var tt=s(Z,2),Ft=s(a(tt),2),Te=a(Ft,!0);r(Ft),r(tt);var et=s(tt,2),Rt=s(a(et),2),Ae=a(Rt,!0);r(Rt),r(et);var at=s(et,2),Ut=s(a(at),2),Ne=a(Ut);xa(Ne,{get item(){return t(e)}}),r(Ut),r(at);var rt=s(at,2),Bt=s(a(rt),2),Ct=a(Bt),Fe=a(Ct,!0);r(Ct),r(Bt),r(rt);var dt=s(rt,2),Gt=s(a(dt),2),Re=a(Gt,!0);r(Gt),r(dt);var st=s(dt,2),Lt=s(a(st),2),it=a(Lt),Ue=a(it,!0);r(it),r(Lt),r(st);var lt=s(st,2),Ot=s(a(lt),2),Ht=a(Ot),nt=a(Ht),Be=a(nt,!0);r(nt);var ot=s(nt,2),Ce=a(ot,!0);r(ot),r(Ht),r(Ot),r(lt);var vt=s(lt,2),Jt=s(a(vt),2),Ge=a(Jt,!0);r(Jt),r(vt);var Pt=s(vt,2),jt=s(a(Pt),2),Le=a(jt,!0);r(jt),r(Pt),r(At),r(Tt),r(Y);var qt=s(Y,2),zt=a(qt),Vt=s(a(zt),2),ct=a(Vt),Wt=s(a(ct),2),Oe=a(Wt,!0);r(Wt),r(ct);var mt=s(ct,2),Kt=s(a(mt),2),He=a(Kt,!0);r(Kt),r(mt);var xt=s(mt,2),Qt=s(a(xt),2),Je=a(Qt);r(Qt),r(xt);var ut=s(xt,2),Xt=s(a(ut),2),Pe=a(Xt,!0);r(Xt),r(ut);var gt=s(ut,2),Yt=s(a(gt),2),je=a(Yt);r(Yt),r(gt);var ft=s(gt,2),Zt=s(a(ft),2),pt=a(Zt),qe=a(pt,!0);r(pt),r(Zt),r(ft);var _t=s(ft,2),te=s(a(_t),2),ze=a(te);{var Ve=o=>{var c=fa(),m=a(c,!0);r(c),h(x=>{L(c,"href",x),n(m,(t(e),i(()=>t(e).template_name)))},[()=>(g(k),t(e),i(()=>k(`/templates/${t(e).template_id}`)))]),u(o,c)},We=o=>{var c=yt(),m=T(c);{var x=y=>{var D=pa(),Ze=a(D);r(D),h(ta=>{L(D,"href",ta),n(Ze,`Template ID: ${t(e),i(()=>t(e).template_id)??""}`)},[()=>(g(k),t(e),i(()=>k(`/templates/${t(e).template_id}`)))]),u(y,D)},M=y=>{var D=_a();u(y,D)};f(m,y=>{t(e),i(()=>t(e).template_id)?y(x):y(M,!1)},!0)}u(o,c)};f(ze,o=>{t(e),i(()=>t(e).template_name)?o(Ve):o(We,!1)})}r(te),r(_t);var Ke=s(_t,2);{var Qe=o=>{var c=ya(),m=s(a(c),2),x=a(m,!0);r(m),r(c),h(()=>n(x,(t(e),i(()=>t(e)["github-runner-group"])))),u(o,c)};f(Ke,o=>{t(e),i(()=>t(e)["github-runner-group"])&&o(Qe)})}r(Vt),r(zt),r(qt),r(X);var ee=s(X,2);{var Xe=o=>{var c=ha(),m=a(c),x=s(a(m),2),M=a(x,!0);r(x),r(m),r(c),h(y=>n(M,y),[()=>(t(e),i(()=>fe(t(e).extra_specs)))]),u(o,c)};f(ee,o=>{t(e),i(()=>t(e).extra_specs)&&o(Xe)})}var Ye=s(ee,2);{let o=$(()=>(t(e),i(()=>t(e).instances||[])));ca(Ye,{get instances(){return t(o)},entityType:"scaleset",onDeleteInstance:ge})}h((o,c,m,x,M)=>{n(Me,(t(e),i(()=>t(e).id))),n(Te,(t(e),i(()=>t(e).name))),n(Ae,(t(e),i(()=>t(e).provider_name))),n(Fe,(t(e),i(()=>t(e).image))),n(Re,(t(e),i(()=>t(e).flavor))),ae(it,1,`inline-flex px-2 py-1 text-xs font-medium rounded-full ${t(e),i(()=>t(e).enabled?"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200":"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200")??""}`),n(Ue,(t(e),i(()=>t(e).enabled?"Enabled":"Disabled"))),n(Be,o),L(ot,"href",c),n(Ce,m),n(Ge,x),n(Le,M),n(Oe,(t(e),i(()=>t(e).max_runners))),n(He,(t(e),i(()=>t(e).min_idle_runners))),n(Je,`${t(e),i(()=>t(e).runner_bootstrap_timeout)??""} minutes`),n(Pe,(t(e),i(()=>t(e).runner_prefix||"garm"))),n(je,`${t(e),i(()=>t(e).os_type)??""} / ${t(e),i(()=>t(e).os_arch)??""}`),ae(pt,1,`inline-flex px-2 py-1 text-xs font-medium rounded-full ${t(e),i(()=>t(e).enable_shell?"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200":"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200")??""}`),n(qe,(t(e),i(()=>t(e).enable_shell?"Enabled":"Disabled")))},[()=>(g(J),t(e),i(()=>J(t(e)))),()=>(g(ne),t(e),i(()=>ne(t(e)))),()=>(g(E),t(e),i(()=>E(t(e)))),()=>(g(P),t(e),i(()=>P(t(e).created_at||""))),()=>(g(P),t(e),i(()=>P(t(e).updated_at||"")))]),u(Q,Et)};f(G,Q=>{t(e)&&Q(K)},!0)}u(w,I)};f(S,w=>{t(F)?w(W):w(Ee,!1)},!0)}u(d,l)};f(be,d=>{t(j)?d(ke):d(Se,!1)})}r(q);var Dt=s(q,2);{var we=d=>{va(d,{get scaleSet(){return t(e)},$$events:{close:()=>v(R,!1),submit:l=>me(l.detail)}})};f(Dt,d=>{t(R)&&t(e)&&d(we)})}var $t=s(Dt,2);{var Ie=d=>{{let l=$(()=>(t(e),g(E),i(()=>`Scale Set ${t(e).name} (${E(t(e))})`)));se(d,{title:"Delete Scale Set",message:"Are you sure you want to delete this scale set? This action cannot be undone and will remove all associated runners.",get itemName(){return t(l)},$$events:{close:()=>v(U,!1),confirm:xe}})}};f($t,d=>{t(U)&&t(e)&&d(Ie)})}var De=s($t,2);{var $e=d=>{se(d,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return t(p),i(()=>t(p).name)},$$events:{close:()=>{v(B,!1),v(p,null)},confirm:ue}})};f(De,d=>{t(B)&&t(p)&&d($e)})}h(d=>{L(ye,"href",d),n(he,(t(e),i(()=>t(e)?t(e).name:"Loading...")))},[()=>(g(k),i(()=>k("/scalesets")))]),u(ve,bt),na()}export{La as component}; diff --git a/webapp/assets/_app/immutable/nodes/21.D25eFoe0.js b/webapp/assets/_app/immutable/nodes/21.v2GZiIwr.js similarity index 92% rename from webapp/assets/_app/immutable/nodes/21.D25eFoe0.js rename to webapp/assets/_app/immutable/nodes/21.v2GZiIwr.js index c6725d60..9080acc8 100644 --- a/webapp/assets/_app/immutable/nodes/21.D25eFoe0.js +++ b/webapp/assets/_app/immutable/nodes/21.v2GZiIwr.js @@ -1 +1 @@ -import{f as pe,h as Re,a as p,c as I,t as q,s as oe}from"../chunks/ZGz3X54u.js";import{i as Ee}from"../chunks/CY7Wcm-1.js";import{p as Se,o as Be,l as P,b as Ie,f as L,a as Fe,g as e,m as l,$ as Ge,d as a,u as n,s as b,h as i,n as le,i as F,c as M,r as A,t as ne}from"../chunks/kDtaAWAK.js";import{i as C,s as He,a as Ne}from"../chunks/Cun6jNAp.js";import{g as G}from"../chunks/BU_V7FOQ.js";import{d as H,B as Ue,g as ie}from"../chunks/Cvcp5xHB.js";import{P as ze}from"../chunks/CLZesvzF.js";import{A as Oe}from"../chunks/uzzFhb3G.js";import{D as je,G as N}from"../chunks/Cfdue6T6.js";import{t as D}from"../chunks/BVGCMSWJ.js";import{e as ce}from"../chunks/BZiHL9L3.js";import{B as de}from"../chunks/DovBLKjH.js";import{D as me}from"../chunks/lQWw1Z23.js";import{E as qe}from"../chunks/CEJvqnOn.js";import{A as We}from"../chunks/Cs0pYghy.js";import{i as W}from"../chunks/C98nByjP.js";import{e as Je,a as J}from"../chunks/C2c_wqo6.js";var Ke=pe('

Error loading templates

'),Qe=pe(" ",1);function ut(ue,fe){Se(fe,!1);const[ge,ye]=He(),y=()=>Ne(Je,"$eagerCache",ge),U=l(),z=l(),v=l(),K=l();let h=l([]),R=l(""),u=l(""),c=l(1),_=l(25),$=l(1),E=l(!1),S=l(!1),m=l(null);async function ve(){try{await J.retryResource("templates")}catch(t){console.error("Retry failed:",t)}}async function he(){if(e(m)?.id)try{await ie.deleteTemplate(e(m).id),D.add({type:"success",title:"Template deleted",message:`Template "${e(m).name}" has been deleted successfully.`}),a(E,!1),a(m,null)}catch(t){const r=ce(t);D.add({type:"error",title:"Failed to delete template",message:r})}}function _e(){G(H("/templates/create"))}async function Q(t){if(!t.id){D.add({type:"error",title:"Error",message:"Template ID is missing"});return}G(H(`/templates/create?clone=${t.id}`))}function V(t){a(m,t),a(E,!0)}function we(){a(S,!0)}async function xe(){try{await ie.restoreTemplates({restore_all:!0}),D.add({type:"success",title:"Templates restored",message:"System templates have been restored successfully."}),a(S,!1),await J.retryResource("templates")}catch(t){const r=ce(t);D.add({type:"error",title:"Failed to restore templates",message:r})}}function X(t){switch(t){case"github":return{color:"blue",text:"GitHub"};case"gitea":return{color:"green",text:"Gitea"};default:return{color:"gray",text:t||"Unknown"}}}function Y(t){switch(t){case"linux":return{color:"blue",text:"Linux"};case"windows":return{color:"info",text:"Windows"};default:return{color:"gray",text:t||"Unknown"}}}const be=[{key:"name",title:"Name",cellComponent:qe,cellProps:{entityType:"template"}},{key:"description",title:"Description",cellComponent:N,cellProps:{field:"description",type:"description"}},{key:"forge_type",title:"Forge Type",cellComponent:N,cellProps:{field:"forge_type"}},{key:"os_type",title:"OS Type",cellComponent:N,cellProps:{field:"os_type"}},{key:"owner_id",title:"Owner",cellComponent:N,cellProps:{field:"owner_id"}},{key:"actions",title:"Actions",align:"right",cellComponent:We,cellProps:t=>{const r=W(),s=t.owner_id==="system",o=[];return o.push({type:"copy",title:"Clone",ariaLabel:"Clone template",action:"clone"}),(r||!s)&&o.push({type:"edit",title:"Edit",ariaLabel:"Edit template",action:"edit"}),(r||!s)&&o.push({type:"delete",title:"Delete",ariaLabel:"Delete template",action:"delete"}),{actions:o}}}],Ce={entityType:"template",primaryText:{field:"name",isClickable:!0,href:"/templates/{id}"},secondaryText:{field:"description"},badges:[{type:"custom",value:t=>{const r=X(t.forge_type);return{variant:r.color,text:r.text}}},{type:"custom",value:t=>{const r=Y(t.os_type);return{variant:r.color,text:r.text}}}],actions:[{type:"clone",handler:t=>Q(t)},{type:"edit",handler:t=>G(H(`/templates/${t.id}?edit=true`))},{type:"delete",handler:t=>V(t)}]};Be(async()=>{try{const t=await J.getTemplates();t&&Array.isArray(t)&&a(h,t)}catch(t){console.error("Failed to load templates:",t),a(R,t instanceof Error?t.message:"Failed to load templates")}}),P(()=>(e(h),y()),()=>{(!e(h).length||y().loaded.templates)&&a(h,y().templates)}),P(()=>y(),()=>{a(U,y().loading.templates)}),P(()=>y(),()=>{a(z,y().errorMessages.templates)}),P(()=>(e(u),e(h)),()=>{a(v,e(u)?e(h).filter(t=>t.name?.toLowerCase().includes(e(u).toLowerCase())||t.description?.toLowerCase().includes(e(u).toLowerCase())||t.forge_type?.toLowerCase().includes(e(u).toLowerCase())||t.os_type?.toLowerCase().includes(e(u).toLowerCase())):e(h))}),P(()=>(e($),e(v),e(_),e(c)),()=>{a($,Math.ceil(e(v).length/e(_))),e(c)>e($)&&e($)>0&&a(c,e($))}),P(()=>(e(v),e(c),e(_)),()=>{a(K,e(v).slice((e(c)-1)*e(_),e(c)*e(_)))}),Ie(),Ee();var Z=Qe();Re(t=>{Ge.title="Runner Install Templates - GARM"});var ee=L(Z);ze(ee,{title:"Runner Install Templates",description:"Manage templates for configuring runner software installation. These templates can be set on pools or scale sets.",actionLabel:"Create Template",showAction:!0,$$events:{action:_e},$$slots:{"secondary-actions":(t,r)=>{var s=I(),o=L(s);{var f=w=>{Ue(w,{variant:"secondary",icon:'',$$events:{click:we},children:(T,B)=>{le();var d=q("Restore System Templates");p(T,d)},$$slots:{default:!0}})};C(o,w=>{i(W),n(W)&&w(f)})}p(t,s)}}});var te=b(ee,2);{var $e=t=>{var r=Ke(),s=M(r),o=b(M(s),2),f=b(M(o),2),w=M(f,!0);A(f);var T=b(f,2),B=M(T);Oe(B,{variant:"secondary",size:"sm",$$events:{click:ve},children:(d,g)=>{le();var O=q("Try Again");p(d,O)},$$slots:{default:!0}}),A(T),A(o),A(s),A(r),ne(()=>oe(w,e(R)||e(z))),p(t,r)};C(te,t=>{(e(R)||e(z))&&!e(U)&&t($e)})}var ae=b(te,2);je(ae,{get columns(){return be},get data(){return e(K)},get loading(){return e(U)},get error(){return e(R)},get searchTerm(){return e(u)},searchPlaceholder:"Search templates by name, description, type...",get currentPage(){return e(c)},get perPage(){return e(_)},get totalPages(){return e($)},get totalItems(){return e(v),n(()=>e(v).length)},get mobileCardConfig(){return Ce},emptyMessage:"No templates found",$$events:{search:t=>{a(u,t.detail.term),a(c,1)},pageChange:t=>a(c,t.detail.page),perPageChange:t=>{a(_,t.detail.perPage),a(c,1)},clone:t=>Q(t.detail.item),edit:t=>G(H(`/templates/${t.detail.item.id}?edit=true`)),delete:t=>V(t.detail.item)},$$slots:{cell:(t,r)=>{const s=F(()=>r.item),o=F(()=>r.column);var f=I(),w=L(f);{var T=d=>{const g=F(()=>(i(e(s)),n(()=>X(e(s).forge_type))));de(d,{get variant(){return i(e(g)),n(()=>e(g).color)},get text(){return i(e(g)),n(()=>e(g).text)}})},B=d=>{var g=I(),O=L(g);{var Le=k=>{const x=F(()=>(i(e(s)),n(()=>Y(e(s).os_type))));de(k,{get variant(){return i(e(x)),n(()=>e(x).color)},get text(){return i(e(x)),n(()=>e(x).text)}})},Me=k=>{var x=I(),Ae=L(x);{var De=j=>{var se=q();ne(()=>oe(se,(i(e(s)),n(()=>e(s).owner_id==="system"?"System":e(s).owner_id||"Unknown")))),p(j,se)};C(Ae,j=>{i(e(o)),n(()=>e(o).key==="owner_id")&&j(De)},!0)}p(k,x)};C(O,k=>{i(e(o)),n(()=>e(o).key==="os_type")?k(Le):k(Me,!1)},!0)}p(d,g)};C(w,d=>{i(e(o)),n(()=>e(o).key==="forge_type")?d(T):d(B,!1)})}p(t,f)}}});var re=b(ae,2);{var Te=t=>{me(t,{title:"Delete Template",message:"Are you sure you want to delete this template? This action cannot be undone.",get itemName(){return e(m),n(()=>e(m).name)},$$events:{close:()=>{a(E,!1),a(m,null)},confirm:he}})};C(re,t=>{e(E)&&e(m)&&t(Te)})}var ke=b(re,2);{var Pe=t=>{me(t,{title:"Restore System Templates",message:"This will restore all system templates from the default configuration. Any missing system templates will be created, and any changes made to existing system templates will be overwritten with the default content.",itemName:"",confirmLabel:"Restore Templates",danger:!1,$$events:{close:()=>a(S,!1),confirm:xe}})};C(ke,t=>{e(S)&&t(Pe)})}p(ue,Z),Fe(),ye()}export{ut as component}; +import{f as pe,h as Re,a as p,c as I,t as q,s as oe}from"../chunks/ZGz3X54u.js";import{i as Ee}from"../chunks/CY7Wcm-1.js";import{p as Se,o as Be,l as P,b as Ie,f as L,a as Fe,g as e,m as l,$ as Ge,d as a,u as n,s as b,h as i,n as le,i as F,c as M,r as A,t as ne}from"../chunks/kDtaAWAK.js";import{i as C,s as He,a as Ne}from"../chunks/Cun6jNAp.js";import{g as G}from"../chunks/C8dZhfFx.js";import{d as H,B as Ue,g as ie}from"../chunks/CYK-UalN.js";import{P as ze}from"../chunks/DacI6VAP.js";import{A as Oe}from"../chunks/DUWZCTMr.js";import{D as je,G as N}from"../chunks/BKeluGSY.js";import{t as D}from"../chunks/BVGCMSWJ.js";import{e as ce}from"../chunks/BZiHL9L3.js";import{B as de}from"../chunks/DbE0zTOa.js";import{D as me}from"../chunks/Dxx83T0m.js";import{E as qe}from"../chunks/Dd4NFVf9.js";import{A as We}from"../chunks/rb89c4PS.js";import{i as W}from"../chunks/C98nByjP.js";import{e as Je,a as J}from"../chunks/Vo3Mv3dp.js";var Ke=pe('

Error loading templates

'),Qe=pe(" ",1);function ut(ue,fe){Se(fe,!1);const[ge,ye]=He(),y=()=>Ne(Je,"$eagerCache",ge),U=l(),z=l(),v=l(),K=l();let h=l([]),R=l(""),u=l(""),c=l(1),_=l(25),$=l(1),E=l(!1),S=l(!1),m=l(null);async function ve(){try{await J.retryResource("templates")}catch(t){console.error("Retry failed:",t)}}async function he(){if(e(m)?.id)try{await ie.deleteTemplate(e(m).id),D.add({type:"success",title:"Template deleted",message:`Template "${e(m).name}" has been deleted successfully.`}),a(E,!1),a(m,null)}catch(t){const r=ce(t);D.add({type:"error",title:"Failed to delete template",message:r})}}function _e(){G(H("/templates/create"))}async function Q(t){if(!t.id){D.add({type:"error",title:"Error",message:"Template ID is missing"});return}G(H(`/templates/create?clone=${t.id}`))}function V(t){a(m,t),a(E,!0)}function we(){a(S,!0)}async function xe(){try{await ie.restoreTemplates({restore_all:!0}),D.add({type:"success",title:"Templates restored",message:"System templates have been restored successfully."}),a(S,!1),await J.retryResource("templates")}catch(t){const r=ce(t);D.add({type:"error",title:"Failed to restore templates",message:r})}}function X(t){switch(t){case"github":return{color:"blue",text:"GitHub"};case"gitea":return{color:"green",text:"Gitea"};default:return{color:"gray",text:t||"Unknown"}}}function Y(t){switch(t){case"linux":return{color:"blue",text:"Linux"};case"windows":return{color:"info",text:"Windows"};default:return{color:"gray",text:t||"Unknown"}}}const be=[{key:"name",title:"Name",cellComponent:qe,cellProps:{entityType:"template"}},{key:"description",title:"Description",cellComponent:N,cellProps:{field:"description",type:"description"}},{key:"forge_type",title:"Forge Type",cellComponent:N,cellProps:{field:"forge_type"}},{key:"os_type",title:"OS Type",cellComponent:N,cellProps:{field:"os_type"}},{key:"owner_id",title:"Owner",cellComponent:N,cellProps:{field:"owner_id"}},{key:"actions",title:"Actions",align:"right",cellComponent:We,cellProps:t=>{const r=W(),s=t.owner_id==="system",o=[];return o.push({type:"copy",title:"Clone",ariaLabel:"Clone template",action:"clone"}),(r||!s)&&o.push({type:"edit",title:"Edit",ariaLabel:"Edit template",action:"edit"}),(r||!s)&&o.push({type:"delete",title:"Delete",ariaLabel:"Delete template",action:"delete"}),{actions:o}}}],Ce={entityType:"template",primaryText:{field:"name",isClickable:!0,href:"/templates/{id}"},secondaryText:{field:"description"},badges:[{type:"custom",value:t=>{const r=X(t.forge_type);return{variant:r.color,text:r.text}}},{type:"custom",value:t=>{const r=Y(t.os_type);return{variant:r.color,text:r.text}}}],actions:[{type:"clone",handler:t=>Q(t)},{type:"edit",handler:t=>G(H(`/templates/${t.id}?edit=true`))},{type:"delete",handler:t=>V(t)}]};Be(async()=>{try{const t=await J.getTemplates();t&&Array.isArray(t)&&a(h,t)}catch(t){console.error("Failed to load templates:",t),a(R,t instanceof Error?t.message:"Failed to load templates")}}),P(()=>(e(h),y()),()=>{(!e(h).length||y().loaded.templates)&&a(h,y().templates)}),P(()=>y(),()=>{a(U,y().loading.templates)}),P(()=>y(),()=>{a(z,y().errorMessages.templates)}),P(()=>(e(u),e(h)),()=>{a(v,e(u)?e(h).filter(t=>t.name?.toLowerCase().includes(e(u).toLowerCase())||t.description?.toLowerCase().includes(e(u).toLowerCase())||t.forge_type?.toLowerCase().includes(e(u).toLowerCase())||t.os_type?.toLowerCase().includes(e(u).toLowerCase())):e(h))}),P(()=>(e($),e(v),e(_),e(c)),()=>{a($,Math.ceil(e(v).length/e(_))),e(c)>e($)&&e($)>0&&a(c,e($))}),P(()=>(e(v),e(c),e(_)),()=>{a(K,e(v).slice((e(c)-1)*e(_),e(c)*e(_)))}),Ie(),Ee();var Z=Qe();Re(t=>{Ge.title="Runner Install Templates - GARM"});var ee=L(Z);ze(ee,{title:"Runner Install Templates",description:"Manage templates for configuring runner software installation. These templates can be set on pools or scale sets.",actionLabel:"Create Template",showAction:!0,$$events:{action:_e},$$slots:{"secondary-actions":(t,r)=>{var s=I(),o=L(s);{var f=w=>{Ue(w,{variant:"secondary",icon:'',$$events:{click:we},children:(T,B)=>{le();var d=q("Restore System Templates");p(T,d)},$$slots:{default:!0}})};C(o,w=>{i(W),n(W)&&w(f)})}p(t,s)}}});var te=b(ee,2);{var $e=t=>{var r=Ke(),s=M(r),o=b(M(s),2),f=b(M(o),2),w=M(f,!0);A(f);var T=b(f,2),B=M(T);Oe(B,{variant:"secondary",size:"sm",$$events:{click:ve},children:(d,g)=>{le();var O=q("Try Again");p(d,O)},$$slots:{default:!0}}),A(T),A(o),A(s),A(r),ne(()=>oe(w,e(R)||e(z))),p(t,r)};C(te,t=>{(e(R)||e(z))&&!e(U)&&t($e)})}var ae=b(te,2);je(ae,{get columns(){return be},get data(){return e(K)},get loading(){return e(U)},get error(){return e(R)},get searchTerm(){return e(u)},searchPlaceholder:"Search templates by name, description, type...",get currentPage(){return e(c)},get perPage(){return e(_)},get totalPages(){return e($)},get totalItems(){return e(v),n(()=>e(v).length)},get mobileCardConfig(){return Ce},emptyMessage:"No templates found",$$events:{search:t=>{a(u,t.detail.term),a(c,1)},pageChange:t=>a(c,t.detail.page),perPageChange:t=>{a(_,t.detail.perPage),a(c,1)},clone:t=>Q(t.detail.item),edit:t=>G(H(`/templates/${t.detail.item.id}?edit=true`)),delete:t=>V(t.detail.item)},$$slots:{cell:(t,r)=>{const s=F(()=>r.item),o=F(()=>r.column);var f=I(),w=L(f);{var T=d=>{const g=F(()=>(i(e(s)),n(()=>X(e(s).forge_type))));de(d,{get variant(){return i(e(g)),n(()=>e(g).color)},get text(){return i(e(g)),n(()=>e(g).text)}})},B=d=>{var g=I(),O=L(g);{var Le=k=>{const x=F(()=>(i(e(s)),n(()=>Y(e(s).os_type))));de(k,{get variant(){return i(e(x)),n(()=>e(x).color)},get text(){return i(e(x)),n(()=>e(x).text)}})},Me=k=>{var x=I(),Ae=L(x);{var De=j=>{var se=q();ne(()=>oe(se,(i(e(s)),n(()=>e(s).owner_id==="system"?"System":e(s).owner_id||"Unknown")))),p(j,se)};C(Ae,j=>{i(e(o)),n(()=>e(o).key==="owner_id")&&j(De)},!0)}p(k,x)};C(O,k=>{i(e(o)),n(()=>e(o).key==="os_type")?k(Le):k(Me,!1)},!0)}p(d,g)};C(w,d=>{i(e(o)),n(()=>e(o).key==="forge_type")?d(T):d(B,!1)})}p(t,f)}}});var re=b(ae,2);{var Te=t=>{me(t,{title:"Delete Template",message:"Are you sure you want to delete this template? This action cannot be undone.",get itemName(){return e(m),n(()=>e(m).name)},$$events:{close:()=>{a(E,!1),a(m,null)},confirm:he}})};C(re,t=>{e(E)&&e(m)&&t(Te)})}var ke=b(re,2);{var Pe=t=>{me(t,{title:"Restore System Templates",message:"This will restore all system templates from the default configuration. Any missing system templates will be created, and any changes made to existing system templates will be overwritten with the default content.",itemName:"",confirmLabel:"Restore Templates",danger:!1,$$events:{close:()=>a(S,!1),confirm:xe}})};C(ke,t=>{e(S)&&t(Pe)})}p(ue,Z),Fe(),ye()}export{ut as component}; diff --git a/webapp/assets/_app/immutable/nodes/22.laAA6k8S.js b/webapp/assets/_app/immutable/nodes/22.SjbkZ9mL.js similarity index 97% rename from webapp/assets/_app/immutable/nodes/22.laAA6k8S.js rename to webapp/assets/_app/immutable/nodes/22.SjbkZ9mL.js index 56f431e2..04cb15ff 100644 --- a/webapp/assets/_app/immutable/nodes/22.laAA6k8S.js +++ b/webapp/assets/_app/immutable/nodes/22.SjbkZ9mL.js @@ -1,2 +1,2 @@ -import{f as A,h as Dt,a as _,c as Oe,t as qe,s as S,e as $e}from"../chunks/ZGz3X54u.js";import{i as Ut}from"../chunks/CY7Wcm-1.js";import{p as Lt,o as Rt,l as ue,b as It,f as ee,a as Mt,g as e,m as w,t as P,d as l,u as s,$ as Et,s as r,j as I,c as d,r as o,n as z,i as g,h as U,k as Ft}from"../chunks/kDtaAWAK.js";import{i as T}from"../chunks/Cun6jNAp.js";import{d as te,g as Ae,r as Je,b as St}from"../chunks/Cvcp5xHB.js";import{b as Ye}from"../chunks/CYnNqrHp.js";import{p as Ht}from"../chunks/CdEA5IGF.js";import{p as me}from"../chunks/DH5setay.js";import{g as De}from"../chunks/BU_V7FOQ.js";import{A as Ke}from"../chunks/uzzFhb3G.js";import{t as E}from"../chunks/BVGCMSWJ.js";import{e as Ue}from"../chunks/BZiHL9L3.js";import{B as pe}from"../chunks/DovBLKjH.js";import{D as Bt}from"../chunks/CRSOHHg7.js";import{C as Pt,a as Qe}from"../chunks/CD4S0w_x.js";import{D as jt}from"../chunks/lQWw1Z23.js";import{i as Xe}from"../chunks/C98nByjP.js";import{g as Ze}from"../chunks/DNHT2U_W.js";import{w as Gt}from"../chunks/KU08Mex1.js";var Vt=A('
Loading template...
'),Nt=A('

Error loading template

'),Wt=A('
Forge Type

Cannot be changed

OS Type

Cannot be changed

'),zt=A('
Created
'),Ot=A('
Last Updated
'),qt=A('
Name
Description
Forge Type
OS Type
Owner
Template ID
'),Jt=A('
'),Yt=A('

Available Template Variables

Your template can use the following variables using Go template syntax (e.g., ):

Runner Info
  • .RunnerName - Runner name
  • .RunnerLabels - Comma separated labels
  • .RunnerUsername - Runner service username
  • .RunnerGroup - Runner service group
  • .GitHubRunnerGroup - GitHub runner group
Download & Install
  • .FileName - Download file name
  • .DownloadURL - Runner download URL
  • .TempDownloadToken - Download token
  • .RepoURL - Repository URL
Configuration
  • .MetadataURL - Instance metadata URL
  • .CallbackURL - Status callback URL
  • .CallbackToken - Callback token
  • .CABundle - CA certificate bundle
  • .EnableBootDebug - Enable debug mode
  • .UseJITConfig - Use JIT configuration
  • .ExtraContext - Additional context map

💡 Tip: Use for conditional content, or to iterate over extra context.

'),Kt=A('

'),Qt=A('
',1),Xt=A('

Template Information

Template Content

',1),Zt=A(" ",1);function ya(et,tt){Lt(tt,!1);const ae=w(),ge=w(),ve=w();let re=w(!0),t=w(null),j=w(""),h=w(!1),i=w({name:"",description:"",data:new Uint8Array}),m=w(""),O=w("text"),H=w(!1),C=w({name:"",description:""}),F=w(""),be=w(!1),de=w(!1);async function xe(){try{if(l(re,!0),l(j,""),l(t,await Ae.getTemplate(e(ae))),!e(t))throw new Error("Template not found");if(I(i,e(i).name=e(t).name||""),I(i,e(i).description=e(t).description||""),I(C,e(C).name=e(t).name||""),I(C,e(C).description=e(t).description||""),e(t).data)try{if(Array.isArray(e(t).data)){const a=new Uint8Array(e(t).data);l(m,new TextDecoder().decode(a)),l(F,e(m))}else l(m,atob(e(t).data)),l(F,e(m))}catch(a){console.error("Failed to decode template data:",a),l(m,""),l(F,"")}else l(m,""),l(F,"")}catch(a){l(j,Ue(a)),E.add({type:"error",title:"Failed to load template",message:e(j)})}finally{l(re,!1)}}async function fe(){if(!(!e(t)?.id||!e(ve)))try{const a={name:e(i).name,description:e(i).description||void 0,data:Array.from(new TextEncoder().encode(e(m)))};await Ae.updateTemplate(e(t).id,a),E.add({type:"success",title:"Template updated",message:`Template "${e(i).name}" has been updated successfully.`}),I(C,e(C).name=e(i).name),I(C,e(C).description=e(i).description),l(F,e(m))}catch(a){const n=Ue(a);E.add({type:"error",title:"Failed to update template",message:n})}}async function at(){if(e(t)?.id)try{await Ae.deleteTemplate(e(t).id),E.add({type:"success",title:"Template deleted",message:`Template "${e(t).name}" has been deleted successfully.`}),De(te("/templates"))}catch(a){const n=Ue(a);E.add({type:"error",title:"Failed to delete template",message:n})}}function Le(){l(h,!0),l(H,!1)}function rt(){return e(i).name!==e(C).name||e(i).description!==e(C).description||e(m)!==e(F)}function dt(){if(rt()){l(de,!0);return}Re()}function Re(){if(l(h,!1),l(H,!1),me.url.searchParams.get("edit")==="true"){De(te("/templates"));return}if(e(t))if(I(i,e(i).name=e(t).name||""),I(i,e(i).description=e(t).description||""),e(t).data)try{if(Array.isArray(e(t).data)){const a=new Uint8Array(e(t).data);l(m,new TextDecoder().decode(a))}else l(m,atob(e(t).data))}catch(a){console.error("Failed to decode template data:",a),l(m,"")}else l(m,"")}function ot(){l(de,!1),Re()}function Ie(a){switch(a){case"github":return{color:"blue",text:"GitHub"};case"gitea":return{color:"green",text:"Gitea"};default:return{color:"gray",text:a||"Unknown"}}}function Me(a){switch(a){case"linux":return{color:"blue",text:"Linux"};case"windows":return{color:"info",text:"Windows"};default:return{color:"gray",text:a||"Unknown"}}}function ye(){if(!e(t)?.data)return"";try{if(Array.isArray(e(t).data)){const a=new Uint8Array(e(t).data);return new TextDecoder().decode(a)}else return atob(e(t).data)}catch(a){return console.error("Failed to decode template data:",a),"Error: Failed to decode template content"}}function Ee(a){const L=a.split(` +import{f as A,h as Dt,a as _,c as Oe,t as qe,s as S,e as $e}from"../chunks/ZGz3X54u.js";import{i as Ut}from"../chunks/CY7Wcm-1.js";import{p as Lt,o as Rt,l as ue,b as It,f as ee,a as Mt,g as e,m as w,t as P,d as l,u as s,$ as Et,s as r,j as I,c as d,r as o,n as z,i as g,h as U,k as Ft}from"../chunks/kDtaAWAK.js";import{i as T}from"../chunks/Cun6jNAp.js";import{d as te,g as Ae,r as Je,b as St}from"../chunks/CYK-UalN.js";import{b as Ye}from"../chunks/CYnNqrHp.js";import{p as Ht}from"../chunks/CdEA5IGF.js";import{p as me}from"../chunks/Bql5nQdO.js";import{g as De}from"../chunks/C8dZhfFx.js";import{A as Ke}from"../chunks/DUWZCTMr.js";import{t as E}from"../chunks/BVGCMSWJ.js";import{e as Ue}from"../chunks/BZiHL9L3.js";import{B as pe}from"../chunks/DbE0zTOa.js";import{D as Bt}from"../chunks/BrlhCerN.js";import{C as Pt,a as Qe}from"../chunks/B-QyJt36.js";import{D as jt}from"../chunks/Dxx83T0m.js";import{i as Xe}from"../chunks/C98nByjP.js";import{g as Ze}from"../chunks/ZelbukuJ.js";import{w as Gt}from"../chunks/KU08Mex1.js";var Vt=A('
Loading template...
'),Nt=A('

Error loading template

'),Wt=A('
Forge Type

Cannot be changed

OS Type

Cannot be changed

'),zt=A('
Created
'),Ot=A('
Last Updated
'),qt=A('
Name
Description
Forge Type
OS Type
Owner
Template ID
'),Jt=A('
'),Yt=A('

Available Template Variables

Your template can use the following variables using Go template syntax (e.g., ):

Runner Info
  • .RunnerName - Runner name
  • .RunnerLabels - Comma separated labels
  • .RunnerUsername - Runner service username
  • .RunnerGroup - Runner service group
  • .GitHubRunnerGroup - GitHub runner group
Download & Install
  • .FileName - Download file name
  • .DownloadURL - Runner download URL
  • .TempDownloadToken - Download token
  • .RepoURL - Repository URL
Configuration
  • .MetadataURL - Instance metadata URL
  • .CallbackURL - Status callback URL
  • .CallbackToken - Callback token
  • .CABundle - CA certificate bundle
  • .EnableBootDebug - Enable debug mode
  • .UseJITConfig - Use JIT configuration
  • .ExtraContext - Additional context map

💡 Tip: Use for conditional content, or to iterate over extra context.

'),Kt=A('

'),Qt=A('
',1),Xt=A('

Template Information

Template Content

',1),Zt=A(" ",1);function ya(et,tt){Lt(tt,!1);const ae=w(),ge=w(),ve=w();let re=w(!0),t=w(null),j=w(""),h=w(!1),i=w({name:"",description:"",data:new Uint8Array}),m=w(""),O=w("text"),H=w(!1),C=w({name:"",description:""}),F=w(""),be=w(!1),de=w(!1);async function xe(){try{if(l(re,!0),l(j,""),l(t,await Ae.getTemplate(e(ae))),!e(t))throw new Error("Template not found");if(I(i,e(i).name=e(t).name||""),I(i,e(i).description=e(t).description||""),I(C,e(C).name=e(t).name||""),I(C,e(C).description=e(t).description||""),e(t).data)try{if(Array.isArray(e(t).data)){const a=new Uint8Array(e(t).data);l(m,new TextDecoder().decode(a)),l(F,e(m))}else l(m,atob(e(t).data)),l(F,e(m))}catch(a){console.error("Failed to decode template data:",a),l(m,""),l(F,"")}else l(m,""),l(F,"")}catch(a){l(j,Ue(a)),E.add({type:"error",title:"Failed to load template",message:e(j)})}finally{l(re,!1)}}async function fe(){if(!(!e(t)?.id||!e(ve)))try{const a={name:e(i).name,description:e(i).description||void 0,data:Array.from(new TextEncoder().encode(e(m)))};await Ae.updateTemplate(e(t).id,a),E.add({type:"success",title:"Template updated",message:`Template "${e(i).name}" has been updated successfully.`}),I(C,e(C).name=e(i).name),I(C,e(C).description=e(i).description),l(F,e(m))}catch(a){const n=Ue(a);E.add({type:"error",title:"Failed to update template",message:n})}}async function at(){if(e(t)?.id)try{await Ae.deleteTemplate(e(t).id),E.add({type:"success",title:"Template deleted",message:`Template "${e(t).name}" has been deleted successfully.`}),De(te("/templates"))}catch(a){const n=Ue(a);E.add({type:"error",title:"Failed to delete template",message:n})}}function Le(){l(h,!0),l(H,!1)}function rt(){return e(i).name!==e(C).name||e(i).description!==e(C).description||e(m)!==e(F)}function dt(){if(rt()){l(de,!0);return}Re()}function Re(){if(l(h,!1),l(H,!1),me.url.searchParams.get("edit")==="true"){De(te("/templates"));return}if(e(t))if(I(i,e(i).name=e(t).name||""),I(i,e(i).description=e(t).description||""),e(t).data)try{if(Array.isArray(e(t).data)){const a=new Uint8Array(e(t).data);l(m,new TextDecoder().decode(a))}else l(m,atob(e(t).data))}catch(a){console.error("Failed to decode template data:",a),l(m,"")}else l(m,"")}function ot(){l(de,!1),Re()}function Ie(a){switch(a){case"github":return{color:"blue",text:"GitHub"};case"gitea":return{color:"green",text:"Gitea"};default:return{color:"gray",text:a||"Unknown"}}}function Me(a){switch(a){case"linux":return{color:"blue",text:"Linux"};case"windows":return{color:"info",text:"Windows"};default:return{color:"gray",text:a||"Unknown"}}}function ye(){if(!e(t)?.data)return"";try{if(Array.isArray(e(t).data)){const a=new Uint8Array(e(t).data);return new TextDecoder().decode(a)}else return atob(e(t).data)}catch(a){return console.error("Failed to decode template data:",a),"Error: Failed to decode template content"}}function Ee(a){const L=a.split(` `)[0]?.trim()||"";return L.startsWith("#!/bin/bash")||L.startsWith("#!/bin/sh")?"bash":L.startsWith("#!/usr/bin/env pwsh")||L.includes("#ps1_sysnative")?"powershell":L.startsWith("#!/usr/bin/env python")||L.startsWith("#!/usr/bin/python")?"python":a.includes("param(")||a.includes("Write-Host")||a.includes("$_")?"powershell":a.includes("def ")||a.includes("import ")||a.includes("print(")?"python":a.includes("echo ")||a.includes("export ")||a.includes("if [")?"bash":"text"}async function lt(a){try{navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(a),E.add({type:"success",title:"Copied to clipboard",message:"Template content has been copied to your clipboard."})):Fe(a)}catch(n){console.error("Failed to copy to clipboard:",n),Fe(a)}}function Fe(a){try{const n=document.createElement("textarea");n.value=a,n.style.position="fixed",n.style.left="-999999px",n.style.top="-999999px",document.body.appendChild(n),n.focus(),n.select();const L=document.execCommand("copy");if(document.body.removeChild(n),L)E.add({type:"success",title:"Copied to clipboard",message:"Template content has been copied to your clipboard."});else throw new Error("Copy command failed")}catch(n){console.error("Fallback copy failed:",n),E.add({type:"error",title:"Copy failed",message:"Unable to copy to clipboard. Please manually select and copy the content."})}}Rt(()=>{if(e(ae))return xe().then(()=>{me.url.searchParams.get("edit")==="true"&&Le()}),Gt.subscribeToEntity("template",["update","delete"],n=>{n.payload&&n.payload.id===e(ae)&&(n.operation==="update"?e(h)?l(t,n.payload):xe():n.operation==="delete"&&(E.add({type:"info",title:"Template deleted",message:`Template "${e(t)?.name||"Unknown"}" has been deleted.`}),De(te("/templates"))))});l(j,"Invalid template ID"),l(re,!1)}),ue(()=>me,()=>{l(ae,parseInt(me.params.id||"0"))}),ue(()=>(e(m),e(H)),()=>{e(m)&&!e(H)&&l(O,Ee(e(m)))}),ue(()=>(e(i),e(C),e(m),e(F)),()=>{l(ge,e(i).name!==e(C).name||e(i).description!==e(C).description||e(m)!==e(F))}),ue(()=>(e(ge),e(i),e(m)),()=>{l(ve,e(ge)&&e(i).name.trim().length>0&&e(m).trim().length>0)}),It(),Ut();var Se=Zt();Dt(a=>{P(()=>Et.title=`${e(t),s(()=>e(t)?.name||"Template")??""} - GARM`)});var He=ee(Se);{var st=a=>{var n=Vt();_(a,n)},nt=a=>{var n=Oe(),L=ee(n);{var mt=G=>{var V=Nt(),oe=d(V),le=r(d(oe),2),B=r(d(le),2),se=d(B,!0);o(B);var q=r(B,2),ne=d(q);Ke(ne,{variant:"secondary",size:"sm",$$events:{click:xe},children:(N,J)=>{z();var Y=qe("Try Again");_(N,Y)},$$slots:{default:!0}});var he=r(ne,2);{let N=g(()=>(U(te),s(()=>te("/templates"))));Ke(he,{variant:"secondary",size:"sm",get href(){return e(N)},children:(J,Y)=>{z();var K=qe("Back to Templates");_(J,K)},$$slots:{default:!0}})}o(q),o(le),o(oe),o(V),P(()=>S(se,e(j))),_(G,V)},pt=G=>{var V=Oe(),oe=ee(V);{var le=B=>{const se=g(()=>(U(Xe),s(Xe))),q=g(()=>(e(t),s(()=>e(t).owner_id==="system"))),ne=g(()=>e(se)||!e(q)),he=g(()=>e(se)||!e(q));var N=Xt(),J=ee(N);{let p=g(()=>(e(t),s(()=>e(t).name||"Unnamed Template"))),c=g(()=>(U(Ze),e(t),s(()=>Ze(e(t).forge_type||"unknown")))),u=g(()=>e(h)?dt:e(ne)?Le:null),v=g(()=>e(h)?fe:e(he)?()=>l(be,!0):null),x=g(()=>e(h)?"Close":"Edit"),b=g(()=>e(h)?"Save Changes":"Delete"),f=g(()=>(e(h),"secondary")),R=g(()=>e(h)?"primary":"danger"),M=g(()=>e(h)?!e(ve):!1),W=g(()=>e(h)?"":""),Q=g(()=>e(h)?"":"");Bt(J,{get title(){return e(p)},subtitle:"View and manage template details",get forgeIcon(){return e(c)},get onEdit(){return e(u)},get onDelete(){return e(v)},get editLabel(){return e(x)},get deleteLabel(){return e(b)},get editVariant(){return e(f)},get deleteVariant(){return e(R)},get deleteDisabled(){return e(M)},get editIcon(){return e(W)},get deleteIcon(){return e(Q)}})}var Y=r(J,2),K=d(Y),Pe=d(K),gt=r(d(Pe),2);{var vt=p=>{var c=Wt(),u=d(c),v=d(u),x=r(d(v),2);Je(x),o(v);var b=r(v,2),f=r(d(b),2);Je(f),o(b),o(u);var R=r(u,2),M=d(R),W=r(d(M),2);{var Q=$=>{const D=g(()=>(e(t),s(()=>Ie(e(t).forge_type))));pe($,{get variant(){return U(e(D)),s(()=>e(D).color)},get text(){return U(e(D)),s(()=>e(D).text)}})};T(W,$=>{e(t),s(()=>e(t).forge_type)&&$(Q)})}z(2),o(M);var ie=r(M,2),X=r(d(ie),2);{var ce=$=>{const D=g(()=>(e(t),s(()=>Me(e(t).os_type))));pe($,{get variant(){return U(e(D)),s(()=>e(D).color)},get text(){return U(e(D)),s(()=>e(D).text)}})};T(X,$=>{e(t),s(()=>e(t).os_type)&&$(ce)})}z(2),o(ie),o(R),o(c),Ye(x,()=>e(i).name,$=>I(i,e(i).name=$)),Ye(f,()=>e(i).description,$=>I(i,e(i).description=$)),$e("submit",c,Ht(fe)),_(p,c)},bt=p=>{var c=qt(),u=d(c),v=r(d(u),2),x=d(v,!0);o(v),o(u);var b=r(u,2),f=r(d(b),2),R=d(f,!0);o(f),o(b);var M=r(b,2),W=r(d(M),2),Q=d(W);{var ie=k=>{const y=g(()=>(e(t),s(()=>Ie(e(t).forge_type))));pe(k,{get variant(){return U(e(y)),s(()=>e(y).color)},get text(){return U(e(y)),s(()=>e(y).text)}})};T(Q,k=>{e(t),s(()=>e(t).forge_type)&&k(ie)})}o(W),o(M);var X=r(M,2),ce=r(d(X),2),$=d(ce);{var D=k=>{const y=g(()=>(e(t),s(()=>Me(e(t).os_type))));pe(k,{get variant(){return U(e(y)),s(()=>e(y).color)},get text(){return U(e(y)),s(()=>e(y).text)}})};T($,k=>{e(t),s(()=>e(t).os_type)&&k(D)})}o(ce),o(X);var ke=r(X,2),Ne=r(d(ke),2),wt=d(Ne,!0);o(Ne),o(ke);var we=r(ke,2),We=r(d(we),2),Tt=d(We,!0);o(We),o(we);var ze=r(we,2);{var Ct=k=>{var y=zt(),Z=r(d(y),2),Te=d(Z,!0);o(Z),o(y),P(Ce=>S(Te,Ce),[()=>(e(t),s(()=>new Date(e(t).created_at).toLocaleDateString()))]),_(k,y)};T(ze,k=>{e(t),s(()=>e(t).created_at)&&k(Ct)})}var $t=r(ze,2);{var At=k=>{var y=Ot(),Z=r(d(y),2),Te=d(Z,!0);o(Z),o(y),P(Ce=>S(Te,Ce),[()=>(e(t),s(()=>new Date(e(t).updated_at).toLocaleDateString()))]),_(k,y)};T($t,k=>{e(t),s(()=>e(t).updated_at)&&k(At)})}o(c),P(()=>{S(x,(e(t),s(()=>e(t).name||"Unnamed Template"))),S(R,(e(t),s(()=>e(t).description||"No description"))),S(wt,(e(t),s(()=>e(t).owner_id==="system"?"System":e(t).owner_id||"Unknown"))),S(Tt,(e(t),s(()=>e(t).id)))}),_(p,c)};T(gt,p=>{e(h)?p(vt):p(bt,!1)})}o(Pe),o(K);var je=r(K,2),Ge=d(je),_e=d(Ge),xt=r(d(_e),2);{var ft=p=>{var c=Jt(),u=r(d(c),2);P(()=>{e(O),Ft(()=>{e(H)})});var v=d(u);v.value=v.__value="bash";var x=r(v);x.value=x.__value="powershell";var b=r(x);b.value=b.__value="python";var f=r(b);f.value=f.__value="text",o(u),o(c),St(u,()=>e(O),R=>l(O,R)),$e("change",u,()=>l(H,!0)),_(p,c)};T(xt,p=>{e(h)&&p(ft)})}o(_e);var Ve=r(_e,2);{var yt=p=>{var c=Yt(),u=r(d(c),2),v=r(d(u));v.textContent="{{ .RunnerName }}",z(),o(u);var x=r(u,4),b=r(d(x),3);b.textContent="{{if .CABundle}}...{{end}}";var f=r(b,2);f.textContent="{{range $key, $value := .ExtraContext}}{{$key}}: {{$value}}{{end}}",z(),o(x),o(c),_(p,c)};T(Ve,p=>{e(h)&&p(yt)})}var ht=r(Ve,2);{var _t=p=>{var c=Kt(),u=d(c);{let b=g(()=>!e(H));Qe(u,{get language(){return e(O)},get autoDetect(){return e(b)},enableTemplateCompletion:!0,minHeight:"400px",placeholder:"Enter your template script content here...",get value(){return e(m)},set value(f){l(m,f)},$$events:{change:f=>l(m,f.detail.value),save:fe},$$legacy:!0})}var v=r(u,2),x=d(v);o(v),o(c),P(()=>S(x,`Template content should be a ${e(t),s(()=>e(t).os_type==="windows"?"PowerShell":"bash")??""} script for runner installation and configuration on ${e(t),s(()=>e(t).os_type)??""}.`)),_(p,c)},kt=p=>{var c=Qt(),u=ee(c),v=r(d(u),2);o(u);var x=r(u,2),b=d(x);{let f=g(()=>s(ye)),R=g(()=>s(()=>Ee(ye())));Qe(b,{get value(){return e(f)},get language(){return e(R)},readonly:!0,minHeight:"400px"})}o(x),$e("click",v,()=>lt(ye())),_(p,c)};T(ht,p=>{e(h)?p(_t):p(kt,!1)})}o(Ge),o(je),o(Y),_(B,N)};T(oe,B=>{e(t)&&B(le)},!0)}_(G,V)};T(L,G=>{e(j)&&!e(t)?G(mt):G(pt,!1)},!0)}_(a,n)};T(He,a=>{e(re)?a(st):a(nt,!1)})}var Be=r(He,2);{var it=a=>{jt(a,{title:"Delete Template",message:"Are you sure you want to delete this template? This action cannot be undone.",get itemName(){return e(t),s(()=>e(t).name)},$$events:{close:()=>l(be,!1),confirm:at}})};T(Be,a=>{e(be)&&e(t)&&a(it)})}var ct=r(Be,2);{var ut=a=>{Pt(a,{title:"Unsaved Changes",message:"You have unsaved changes. Are you sure you want to discard them?",confirmText:"Discard Changes",cancelText:"Stay on Page",variant:"warning",$$events:{close:()=>l(de,!1),confirm:ot}})};T(ct,a=>{e(de)&&a(ut)})}_(et,Se),Mt()}export{ya as component}; diff --git a/webapp/assets/_app/immutable/nodes/23.D4QqDH8N.js b/webapp/assets/_app/immutable/nodes/23.CJXOkL1d.js similarity index 97% rename from webapp/assets/_app/immutable/nodes/23.D4QqDH8N.js rename to webapp/assets/_app/immutable/nodes/23.CJXOkL1d.js index 659584ec..554f0d4c 100644 --- a/webapp/assets/_app/immutable/nodes/23.D4QqDH8N.js +++ b/webapp/assets/_app/immutable/nodes/23.CJXOkL1d.js @@ -1,2 +1,2 @@ -import{f as F,h as ze,a as w,s as Ke,e as U,b as Qe}from"../chunks/ZGz3X54u.js";import{i as Xe}from"../chunks/CY7Wcm-1.js";import{p as Ze,o as et,l as Q,b as tt,f as Te,a as at,g as e,m as p,t as C,d as l,u as A,$ as rt,s as r,j as f,i as X,c as o,r as s,k as Z,n as D}from"../chunks/kDtaAWAK.js";import{i as ee}from"../chunks/Cun6jNAp.js";import{g as Le,d as te,r as Re,b as ae}from"../chunks/Cvcp5xHB.js";import{b as $e}from"../chunks/CYnNqrHp.js";import{b as lt}from"../chunks/DochbgGJ.js";import{p as ot}from"../chunks/CdEA5IGF.js";import{g as re}from"../chunks/BU_V7FOQ.js";import{p as st}from"../chunks/DH5setay.js";import{t as h}from"../chunks/BVGCMSWJ.js";import{e as Ue}from"../chunks/BZiHL9L3.js";import{D as dt}from"../chunks/CRSOHHg7.js";import{a as nt,C as it}from"../chunks/CD4S0w_x.js";var ut=F('
Loading...
'),ct=F('
Uploading...',1),pt=Qe(' Upload File',1),bt=F('

Template Information

Template Content

Available Template Variables

Your template can use the following variables using Go template syntax (e.g., ):

Runner Info
  • .RunnerName - Runner name
  • .RunnerLabels - Comma separated labels
  • .RunnerUsername - Runner service username
  • .RunnerGroup - Runner service group
  • .GitHubRunnerGroup - GitHub runner group
Download & Install
  • .FileName - Download file name
  • .DownloadURL - Runner download URL
  • .TempDownloadToken - Download token
  • .RepoURL - Repository URL
Configuration
  • .MetadataURL - Instance metadata URL
  • .CallbackURL - Status callback URL
  • .CallbackToken - Callback token
  • .CABundle - CA certificate bundle
  • .EnableBootDebug - Enable debug mode
  • .UseJITConfig - Use JIT configuration
  • .ExtraContext - Additional context map

💡 Tip: Use for conditional content, or to iterate over extra context.

',1),gt=F(" ",1);function Ut(Ae,De){Ze(De,!1);const le=p(),M=p();let _=p(!1),i=p(null),t=p({name:"",description:"",forge_type:"github",os_type:"linux",data:new Uint8Array}),u=p(""),v=p("text"),x=p(!1),I=p(),T=p(!1),L={name:"",description:"",forge_type:"github",os_type:"linux"},Fe="",R=p(!1);async function oe(){if(e(M))try{l(_,!0);const a={name:e(t).name,description:e(t).description||void 0,forge_type:e(t).forge_type,os_type:e(t).os_type,data:Array.from(new TextEncoder().encode(e(u)))};await Le.createTemplate(a),h.add({type:"success",title:"Template created",message:`Template "${e(t).name}" has been created successfully.`}),re(te("/templates"))}catch(a){const c=Ue(a);h.add({type:"error",title:"Failed to create template",message:c})}finally{l(_,!1)}}function Me(){return e(le)}function Ie(){if(Me()){l(R,!0);return}se()}function se(){re(te("/templates"))}function We(){l(R,!1),se()}function Ee(){e(I).click()}async function Se(a){const c=a.target,n=c.files?.[0];if(n){if(n.size>1024*1024){h.add({type:"error",title:"File too large",message:"Please select a file smaller than 1MB."});return}try{l(T,!0);const y=await n.text();l(u,y);const b=n.name.toLowerCase();let m="text";b.endsWith(".sh")||b.endsWith(".bash")?m="bash":b.endsWith(".ps1")||b.endsWith(".psm1")?m="powershell":b.endsWith(".py")?m="python":m=W(y),l(v,m),l(x,!1),h.add({type:"success",title:"File uploaded",message:`Successfully loaded content from "${n.name}".`})}catch{h.add({type:"error",title:"Failed to read file",message:"Unable to read the selected file. Please try again."})}finally{l(T,!1),c.value=""}}}function W(a){const n=a.split(` +import{f as F,h as ze,a as w,s as Ke,e as U,b as Qe}from"../chunks/ZGz3X54u.js";import{i as Xe}from"../chunks/CY7Wcm-1.js";import{p as Ze,o as et,l as Q,b as tt,f as Te,a as at,g as e,m as p,t as C,d as l,u as A,$ as rt,s as r,j as f,i as X,c as o,r as s,k as Z,n as D}from"../chunks/kDtaAWAK.js";import{i as ee}from"../chunks/Cun6jNAp.js";import{g as Le,d as te,r as Re,b as ae}from"../chunks/CYK-UalN.js";import{b as $e}from"../chunks/CYnNqrHp.js";import{b as lt}from"../chunks/DochbgGJ.js";import{p as ot}from"../chunks/CdEA5IGF.js";import{g as re}from"../chunks/C8dZhfFx.js";import{p as st}from"../chunks/Bql5nQdO.js";import{t as h}from"../chunks/BVGCMSWJ.js";import{e as Ue}from"../chunks/BZiHL9L3.js";import{D as dt}from"../chunks/BrlhCerN.js";import{a as nt,C as it}from"../chunks/B-QyJt36.js";var ut=F('
Loading...
'),ct=F('
Uploading...',1),pt=Qe(' Upload File',1),bt=F('

Template Information

Template Content

Available Template Variables

Your template can use the following variables using Go template syntax (e.g., ):

Runner Info
  • .RunnerName - Runner name
  • .RunnerLabels - Comma separated labels
  • .RunnerUsername - Runner service username
  • .RunnerGroup - Runner service group
  • .GitHubRunnerGroup - GitHub runner group
Download & Install
  • .FileName - Download file name
  • .DownloadURL - Runner download URL
  • .TempDownloadToken - Download token
  • .RepoURL - Repository URL
Configuration
  • .MetadataURL - Instance metadata URL
  • .CallbackURL - Status callback URL
  • .CallbackToken - Callback token
  • .CABundle - CA certificate bundle
  • .EnableBootDebug - Enable debug mode
  • .UseJITConfig - Use JIT configuration
  • .ExtraContext - Additional context map

💡 Tip: Use for conditional content, or to iterate over extra context.

',1),gt=F(" ",1);function Ut(Ae,De){Ze(De,!1);const le=p(),M=p();let _=p(!1),i=p(null),t=p({name:"",description:"",forge_type:"github",os_type:"linux",data:new Uint8Array}),u=p(""),v=p("text"),x=p(!1),I=p(),T=p(!1),L={name:"",description:"",forge_type:"github",os_type:"linux"},Fe="",R=p(!1);async function oe(){if(e(M))try{l(_,!0);const a={name:e(t).name,description:e(t).description||void 0,forge_type:e(t).forge_type,os_type:e(t).os_type,data:Array.from(new TextEncoder().encode(e(u)))};await Le.createTemplate(a),h.add({type:"success",title:"Template created",message:`Template "${e(t).name}" has been created successfully.`}),re(te("/templates"))}catch(a){const c=Ue(a);h.add({type:"error",title:"Failed to create template",message:c})}finally{l(_,!1)}}function Me(){return e(le)}function Ie(){if(Me()){l(R,!0);return}se()}function se(){re(te("/templates"))}function We(){l(R,!1),se()}function Ee(){e(I).click()}async function Se(a){const c=a.target,n=c.files?.[0];if(n){if(n.size>1024*1024){h.add({type:"error",title:"File too large",message:"Please select a file smaller than 1MB."});return}try{l(T,!0);const y=await n.text();l(u,y);const b=n.name.toLowerCase();let m="text";b.endsWith(".sh")||b.endsWith(".bash")?m="bash":b.endsWith(".ps1")||b.endsWith(".psm1")?m="powershell":b.endsWith(".py")?m="python":m=W(y),l(v,m),l(x,!1),h.add({type:"success",title:"File uploaded",message:`Successfully loaded content from "${n.name}".`})}catch{h.add({type:"error",title:"Failed to read file",message:"Unable to read the selected file. Please try again."})}finally{l(T,!1),c.value=""}}}function W(a){const n=a.split(` `)[0]?.trim()||"";return n.startsWith("#!/bin/bash")||n.startsWith("#!/bin/sh")?"bash":n.startsWith("#!/usr/bin/env pwsh")||n.includes("#ps1_sysnative")?"powershell":n.startsWith("#!/usr/bin/env python")||n.startsWith("#!/usr/bin/python")?"python":a.includes("param(")||a.includes("Write-Host")||a.includes("$_")?"powershell":a.includes("def ")||a.includes("import ")||a.includes("print(")?"python":a.includes("echo ")||a.includes("export ")||a.includes("if [")?"bash":"text"}async function Ge(){const a=st.url.searchParams.get("clone");if(a)try{if(l(_,!0),l(i,await Le.getTemplate(parseInt(a))),!e(i))throw new Error("Template not found");if(f(t,e(t).name=`${e(i).name} (Copy)`),f(t,e(t).description=e(i).description||""),f(t,e(t).forge_type=e(i).forge_type||"github"),f(t,e(t).os_type=e(i).os_type||"linux"),e(i).data)try{if(Array.isArray(e(i).data)){const c=new Uint8Array(e(i).data);l(u,new TextDecoder().decode(c))}else l(u,atob(e(i).data));l(v,W(e(u)))}catch(c){console.error("Failed to decode template data:",c),l(u,"")}}catch(c){const n=Ue(c);h.add({type:"error",title:"Failed to load template",message:n}),re(te("/templates"))}finally{l(_,!1)}}et(()=>{Ge()}),Q(()=>(e(t),e(u)),()=>{l(le,e(t).name!==L.name||e(t).description!==L.description||e(t).forge_type!==L.forge_type||e(t).os_type!==L.os_type||e(u)!==Fe)}),Q(()=>(e(t),e(u)),()=>{l(M,e(t).name.trim().length>0&&e(u).trim().length>0)}),Q(()=>(e(u),e(x)),()=>{e(u)&&!e(x)&&l(v,W(e(u)))}),tt(),Xe();var de=gt();ze(a=>{C(()=>rt.title=`${e(i),A(()=>e(i)?`Clone ${e(i).name}`:"Create Template")??""} - GARM`)});var ne=Te(de);{var He=a=>{var c=ut();w(a,c)},Pe=a=>{var c=bt(),n=Te(c);{let d=X(()=>(e(i),A(()=>e(i)?`Clone Template: ${e(i).name}`:"Create New Template"))),g=X(()=>!e(M));dt(n,{get title(){return e(d)},subtitle:"Create a new runner install template",onEdit:Ie,onDelete:oe,editLabel:"Cancel",deleteLabel:"Create Template",editVariant:"secondary",deleteVariant:"primary",get deleteDisabled(){return e(g)},editIcon:"",deleteIcon:""})}var y=r(n,2),b=o(y),m=o(b),E=r(o(m),2),S=o(E),G=o(S),ie=r(o(G),2);Re(ie),s(G);var ue=r(G,2),ce=r(o(ue),2);Re(ce),s(ue),s(S);var pe=r(S,2),H=o(pe),P=r(o(H),2);C(()=>{e(t),Z(()=>{})});var j=o(P);j.value=j.__value="github";var be=r(j);be.value=be.__value="gitea",s(P),s(H);var ge=r(H,2),B=r(o(ge),2);C(()=>{e(t),Z(()=>{})});var N=o(B);N.value=N.__value="linux";var me=r(N);me.value=me.__value="windows",s(B),s(ge),s(pe),s(E),s(m),s(b);var fe=r(b,2),ve=o(fe),V=o(ve),xe=r(o(V),2),k=o(xe),Ne=o(k);{var Ve=d=>{var g=ct();D(),w(d,g)},qe=d=>{var g=pt();D(),w(d,g)};ee(Ne,d=>{e(T)?d(Ve):d(qe,!1)})}s(k);var $=r(k,4);C(()=>{e(v),Z(()=>{e(x)})});var q=o($);q.value=q.__value="bash";var J=r(q);J.value=J.__value="powershell";var O=r(J);O.value=O.__value="python";var ye=r(O);ye.value=ye.__value="text",s($),s(xe),s(V);var Y=r(V,2);lt(Y,d=>l(I,d),()=>e(I));var z=r(Y,2),K=r(o(z),2),Je=r(o(K));Je.textContent="{{ .RunnerName }}",D(),s(K);var he=r(K,4),_e=r(o(he),3);_e.textContent="{{if .CABundle}}...{{end}}";var Oe=r(_e,2);Oe.textContent="{{range $key, $value := .ExtraContext}}{{$key}}: {{$value}}{{end}}",D(),s(he),s(z);var ke=r(z,2),we=o(ke);{let d=X(()=>!e(x));nt(we,{get language(){return e(v)},get autoDetect(){return e(d)},enableTemplateCompletion:!0,minHeight:"400px",placeholder:"Enter your template script content here...",get value(){return e(u)},set value(g){l(u,g)},$$events:{change:g=>l(u,g.detail.value)},$$legacy:!0})}var Ce=r(we,2),Ye=o(Ce);s(Ce),s(ke),s(ve),s(fe),s(y),C(()=>{k.disabled=e(T),Ke(Ye,`Template content should be a ${e(t),A(()=>e(t).os_type==="windows"?"PowerShell":"bash")??""} script for runner installation and configuration on ${e(t),A(()=>e(t).os_type)??""}.`)}),$e(ie,()=>e(t).name,d=>f(t,e(t).name=d)),$e(ce,()=>e(t).description,d=>f(t,e(t).description=d)),ae(P,()=>e(t).forge_type,d=>f(t,e(t).forge_type=d)),ae(B,()=>e(t).os_type,d=>f(t,e(t).os_type=d)),U("submit",E,ot(oe)),U("click",k,Ee),ae($,()=>e(v),d=>l(v,d)),U("change",$,()=>l(x,!0)),U("change",Y,Se),w(a,c)};ee(ne,a=>{e(_)?a(He):a(Pe,!1)})}var je=r(ne,2);{var Be=a=>{it(a,{title:"Unsaved Changes",message:"You have unsaved changes. Are you sure you want to discard them?",confirmText:"Discard Changes",cancelText:"Stay on Page",variant:"danger",$$events:{close:()=>l(R,!1),confirm:We}})};ee(je,a=>{e(R)&&a(Be)})}w(Ae,de),at()}export{Ut as component}; diff --git a/webapp/assets/_app/immutable/nodes/24.BLkBUd5n.js b/webapp/assets/_app/immutable/nodes/24.DG4EX-2D.js similarity index 93% rename from webapp/assets/_app/immutable/nodes/24.BLkBUd5n.js rename to webapp/assets/_app/immutable/nodes/24.DG4EX-2D.js index 5ba4e90b..f91109fc 100644 --- a/webapp/assets/_app/immutable/nodes/24.BLkBUd5n.js +++ b/webapp/assets/_app/immutable/nodes/24.DG4EX-2D.js @@ -1 +1 @@ -import{f as j,h as re,a as w,c as z,s as R}from"../chunks/ZGz3X54u.js";import{i as se}from"../chunks/CY7Wcm-1.js";import{p as le,o as ne,l as E,b as ie,a as oe,g as e,m as c,$ as me,c as v,i,s as T,t as J,f as K,u as a,d as s,r as _,h as l}from"../chunks/kDtaAWAK.js";import{i as F}from"../chunks/Cun6jNAp.js";import{g as ce}from"../chunks/Cvcp5xHB.js";import{P as de}from"../chunks/CLZesvzF.js";import{D as ue,G as N}from"../chunks/Cfdue6T6.js";import{B as L}from"../chunks/DovBLKjH.js";import"../chunks/CkTG2UXI.js";import{e as ge}from"../chunks/BZiHL9L3.js";var fe=j('

'),pe=j('

'),ve=j('
');function Te(O,Q){le(Q,!1);const g=c(),h=c(),q=c();let S=c([]),B=c(!0),U=c(""),A=c(""),o=c(1),f=c(25);function W(r,y){if(!y)return r;const d=y.toLowerCase();return r.filter(t=>t.username?.toLowerCase().includes(d)||t.email?.toLowerCase().includes(d)||t.full_name?.toLowerCase().includes(d))}async function H(){try{s(B,!0),s(U,""),s(S,await ce.listUsers())}catch(r){s(U,ge(r)),console.error("Failed to load users:",r)}finally{s(B,!1)}}ne(()=>{H()});const X=[{key:"username",title:"Username",cellComponent:N,cellProps:{field:"username"}},{key:"email",title:"Email",cellComponent:N,cellProps:{field:"email"}},{key:"full_name",title:"Full Name",cellComponent:N,cellProps:{field:"full_name"}},{key:"is_admin",title:"Role",align:"center"},{key:"enabled",title:"Status",align:"center"}];function Y(r){s(A,r.detail.term),s(o,1)}function Z(r){s(o,r.detail.page)}function ee(r){s(f,r.detail.perPage),s(o,1)}E(()=>(e(S),e(A)),()=>{s(g,W(e(S),e(A)))}),E(()=>(e(g),e(f)),()=>{s(h,Math.ceil(e(g).length/e(f)))}),E(()=>(e(o),e(h)),()=>{e(o)>e(h)&&e(h)>0&&s(o,e(h))}),E(()=>(e(g),e(o),e(f)),()=>{s(q,e(g).slice((e(o)-1)*e(f),e(o)*e(f)))}),ie(),se();var G=ve();re(r=>{me.title="Users - GARM"});var V=v(G);de(V,{title:"Users",description:"View all users in the system"});var te=T(V,2);{let r=i(()=>!!e(U));ue(te,{get columns(){return X},get data(){return e(q)},get loading(){return e(B)},get error(){return e(U)},get searchTerm(){return e(A)},searchPlaceholder:"Search users...",get currentPage(){return e(o)},get perPage(){return e(f)},get totalPages(){return e(h)},get totalItems(){return e(g),a(()=>e(g).length)},itemName:"users",emptyIconType:"users",get showRetry(){return e(r)},$$events:{search:Y,pageChange:Z,perPageChange:ee,retry:H},$$slots:{cell:(y,d)=>{const t=i(()=>d.column),n=i(()=>d.item);var x=z(),$=K(x);{var I=u=>{{let b=i(()=>(l(e(n)),a(()=>e(n).is_admin?"purple":"gray"))),C=i(()=>(l(e(n)),a(()=>e(n).is_admin?"Admin":"User")));L(u,{get variant(){return e(b)},get text(){return e(C)}})}},k=u=>{var b=z(),C=K(b);{var D=P=>{{let M=i(()=>(l(e(n)),a(()=>e(n).enabled?"green":"red"))),m=i(()=>(l(e(n)),a(()=>e(n).enabled?"Enabled":"Disabled")));L(P,{get variant(){return e(M)},get text(){return e(m)}})}};F(C,P=>{l(e(t)),a(()=>e(t).key==="enabled")&&P(D)},!0)}w(u,b)};F($,u=>{l(e(t)),a(()=>e(t).key==="is_admin")?u(I):u(k,!1)})}w(y,x)},"mobile-card":(y,d)=>{const t=i(()=>d.item);var n=pe(),x=v(n),$=v(x),I=v($,!0);_($);var k=T($,2),u=v(k,!0);_(k);var b=T(k,2);{var C=m=>{var p=fe(),ae=v(p,!0);_(p),J(()=>R(ae,(l(e(t)),a(()=>e(t).full_name)))),w(m,p)};F(b,m=>{l(e(t)),a(()=>e(t).full_name)&&m(C)})}_(x);var D=T(x,2),P=v(D);{let m=i(()=>(l(e(t)),a(()=>e(t).is_admin?"purple":"gray"))),p=i(()=>(l(e(t)),a(()=>e(t).is_admin?"Admin":"User")));L(P,{get variant(){return e(m)},get text(){return e(p)}})}var M=T(P,2);{let m=i(()=>(l(e(t)),a(()=>e(t).enabled?"green":"red"))),p=i(()=>(l(e(t)),a(()=>e(t).enabled?"Enabled":"Disabled")));L(M,{get variant(){return e(m)},get text(){return e(p)}})}_(D),_(n),J(()=>{R(I,(l(e(t)),a(()=>e(t).username))),R(u,(l(e(t)),a(()=>e(t).email)))}),w(y,n)}}})}_(G),w(O,G),oe()}export{Te as component}; +import{f as j,h as re,a as w,c as z,s as R}from"../chunks/ZGz3X54u.js";import{i as se}from"../chunks/CY7Wcm-1.js";import{p as le,o as ne,l as E,b as ie,a as oe,g as e,m as c,$ as me,c as v,i,s as T,t as J,f as K,u as a,d as s,r as _,h as l}from"../chunks/kDtaAWAK.js";import{i as F}from"../chunks/Cun6jNAp.js";import{g as ce}from"../chunks/CYK-UalN.js";import{P as de}from"../chunks/DacI6VAP.js";import{D as ue,G as N}from"../chunks/BKeluGSY.js";import{B as L}from"../chunks/DbE0zTOa.js";import"../chunks/DWgB-t1g.js";import{e as ge}from"../chunks/BZiHL9L3.js";var fe=j('

'),pe=j('

'),ve=j('
');function Te(O,Q){le(Q,!1);const g=c(),h=c(),q=c();let S=c([]),B=c(!0),U=c(""),A=c(""),o=c(1),f=c(25);function W(r,y){if(!y)return r;const d=y.toLowerCase();return r.filter(t=>t.username?.toLowerCase().includes(d)||t.email?.toLowerCase().includes(d)||t.full_name?.toLowerCase().includes(d))}async function H(){try{s(B,!0),s(U,""),s(S,await ce.listUsers())}catch(r){s(U,ge(r)),console.error("Failed to load users:",r)}finally{s(B,!1)}}ne(()=>{H()});const X=[{key:"username",title:"Username",cellComponent:N,cellProps:{field:"username"}},{key:"email",title:"Email",cellComponent:N,cellProps:{field:"email"}},{key:"full_name",title:"Full Name",cellComponent:N,cellProps:{field:"full_name"}},{key:"is_admin",title:"Role",align:"center"},{key:"enabled",title:"Status",align:"center"}];function Y(r){s(A,r.detail.term),s(o,1)}function Z(r){s(o,r.detail.page)}function ee(r){s(f,r.detail.perPage),s(o,1)}E(()=>(e(S),e(A)),()=>{s(g,W(e(S),e(A)))}),E(()=>(e(g),e(f)),()=>{s(h,Math.ceil(e(g).length/e(f)))}),E(()=>(e(o),e(h)),()=>{e(o)>e(h)&&e(h)>0&&s(o,e(h))}),E(()=>(e(g),e(o),e(f)),()=>{s(q,e(g).slice((e(o)-1)*e(f),e(o)*e(f)))}),ie(),se();var G=ve();re(r=>{me.title="Users - GARM"});var V=v(G);de(V,{title:"Users",description:"View all users in the system"});var te=T(V,2);{let r=i(()=>!!e(U));ue(te,{get columns(){return X},get data(){return e(q)},get loading(){return e(B)},get error(){return e(U)},get searchTerm(){return e(A)},searchPlaceholder:"Search users...",get currentPage(){return e(o)},get perPage(){return e(f)},get totalPages(){return e(h)},get totalItems(){return e(g),a(()=>e(g).length)},itemName:"users",emptyIconType:"users",get showRetry(){return e(r)},$$events:{search:Y,pageChange:Z,perPageChange:ee,retry:H},$$slots:{cell:(y,d)=>{const t=i(()=>d.column),n=i(()=>d.item);var x=z(),$=K(x);{var I=u=>{{let b=i(()=>(l(e(n)),a(()=>e(n).is_admin?"purple":"gray"))),C=i(()=>(l(e(n)),a(()=>e(n).is_admin?"Admin":"User")));L(u,{get variant(){return e(b)},get text(){return e(C)}})}},k=u=>{var b=z(),C=K(b);{var D=P=>{{let M=i(()=>(l(e(n)),a(()=>e(n).enabled?"green":"red"))),m=i(()=>(l(e(n)),a(()=>e(n).enabled?"Enabled":"Disabled")));L(P,{get variant(){return e(M)},get text(){return e(m)}})}};F(C,P=>{l(e(t)),a(()=>e(t).key==="enabled")&&P(D)},!0)}w(u,b)};F($,u=>{l(e(t)),a(()=>e(t).key==="is_admin")?u(I):u(k,!1)})}w(y,x)},"mobile-card":(y,d)=>{const t=i(()=>d.item);var n=pe(),x=v(n),$=v(x),I=v($,!0);_($);var k=T($,2),u=v(k,!0);_(k);var b=T(k,2);{var C=m=>{var p=fe(),ae=v(p,!0);_(p),J(()=>R(ae,(l(e(t)),a(()=>e(t).full_name)))),w(m,p)};F(b,m=>{l(e(t)),a(()=>e(t).full_name)&&m(C)})}_(x);var D=T(x,2),P=v(D);{let m=i(()=>(l(e(t)),a(()=>e(t).is_admin?"purple":"gray"))),p=i(()=>(l(e(t)),a(()=>e(t).is_admin?"Admin":"User")));L(P,{get variant(){return e(m)},get text(){return e(p)}})}var M=T(P,2);{let m=i(()=>(l(e(t)),a(()=>e(t).enabled?"green":"red"))),p=i(()=>(l(e(t)),a(()=>e(t).enabled?"Enabled":"Disabled")));L(M,{get variant(){return e(m)},get text(){return e(p)}})}_(D),_(n),J(()=>{R(I,(l(e(t)),a(()=>e(t).username))),R(u,(l(e(t)),a(()=>e(t).email)))}),w(y,n)}}})}_(G),w(O,G),oe()}export{Te as component}; diff --git a/webapp/assets/_app/immutable/nodes/3.BzLzrOWy.js b/webapp/assets/_app/immutable/nodes/3.Ylobjoa9.js similarity index 97% rename from webapp/assets/_app/immutable/nodes/3.BzLzrOWy.js rename to webapp/assets/_app/immutable/nodes/3.Ylobjoa9.js index 7864bd43..7b26e762 100644 --- a/webapp/assets/_app/immutable/nodes/3.BzLzrOWy.js +++ b/webapp/assets/_app/immutable/nodes/3.Ylobjoa9.js @@ -1,4 +1,4 @@ -import{f as E,e as f,h as jt,a as $,s as W,r as rt}from"../chunks/ZGz3X54u.js";import{i as Gt}from"../chunks/CY7Wcm-1.js";import{p as Ut,g as e,o as zt,l as J,b as Bt,f as Fe,a as qt,$ as St,m as g,d as n,e as Lt,c as o,s as a,r as i,u,h as be,i as Ke,t as se,j as _,k as Nt,n as X}from"../chunks/kDtaAWAK.js";import{i as G,s as Kt,a as Vt}from"../chunks/Cun6jNAp.js";import{e as Ht,i as Rt}from"../chunks/DdT9Vz5Q.js";import{h as Yt,r as L,s as je,b as Ot,a as Jt,g as fe}from"../chunks/Cvcp5xHB.js";import{b as N,a as Qt}from"../chunks/CYnNqrHp.js";import{p as at}from"../chunks/CdEA5IGF.js";import{P as Wt}from"../chunks/CLZesvzF.js";import{F as Xt}from"../chunks/CCoxuXg5.js";import{A as ot}from"../chunks/uzzFhb3G.js";import{D as Zt,G as it}from"../chunks/Cfdue6T6.js";import{e as er,a as Ve}from"../chunks/C2c_wqo6.js";import{t as ke}from"../chunks/BVGCMSWJ.js";import{f as tr,p as rr,g as He,c as ar}from"../chunks/DNHT2U_W.js";import{e as Re}from"../chunks/BZiHL9L3.js";import{B as nt}from"../chunks/DovBLKjH.js";import"../chunks/CkTG2UXI.js";import{E as or}from"../chunks/C-3AL0iB.js";import{S as ir}from"../chunks/BTeTCgJA.js";import{A as nr}from"../chunks/Cs0pYghy.js";var dr=E('

'),sr=E(""),lr=E('

'),cr=E('

Gitea only supports PAT authentication

'),ur=E('
'),pr=E('

or drag and drop

PEM, KEY files only

',1),gr=E(''),yr=E('
'),br=E('

or drag and drop

PEM, KEY files only. Upload new private key.

',1),fr=E(" ",1),vr=E(''),mr=E(''),xr=E('
',1);function Lr(dt,st){Ut(st,!1);const[lt,ct]=Kt(),U=()=>Vt(er,"$eagerCache",lt),Ge=g(),Z=g(),Ye=g(),Ue=g(),ze=g(),p={PAT:"pat",APP:"app"};let we=g(!0),le=g([]),Q=g([]),Ce=g(""),Pe=g(""),K=g(1),ce=g(25),ue=g(1),Ae=g(!1),Te=g(!1),$e=g(!1),D=g(p.PAT),y=g(null),M=g(null),t=g({name:"",description:"",endpoint:"",auth_type:p.PAT,oauth2_token:"",app_id:"",installation_id:"",private_key_bytes:""}),Ee={...e(t)},ee=g(!1);function ut(r){r.key==="Escape"&&(e(Ae)||e(Te)||e($e))&&P()}zt(async()=>{try{n(we,!0);const[r,d]=await Promise.all([Ve.getCredentials(),Ve.getEndpoints()]);r&&Array.isArray(r)&&n(le,r),d&&Array.isArray(d)&&n(Q,d)}catch(r){console.error("Failed to load credentials:",r),n(Ce,r instanceof Error?r.message:"Failed to load credentials")}finally{n(we,!1)}});async function pt(){try{await Ve.retryResource("credentials")}catch(r){console.error("Retry failed:",r)}}async function gt(){Se(),n(Ae,!0),n(x,"github"),_(t,e(t).auth_type=p.PAT)}let x=g("");function yt(r){n(x,r.detail),Se()}async function Be(r){n(y,r),n(t,{name:r.name||"",description:r.description||"",endpoint:r.endpoint?.name||"",auth_type:r["auth-type"]||p.PAT,oauth2_token:"",app_id:"",installation_id:"",private_key_bytes:""}),n(D,r["auth-type"]||p.PAT),Ee={...e(t)},n(ee,!1),n(Te,!0)}function qe(r){n(M,r),n($e,!0)}function Se(){n(t,{name:"",description:"",endpoint:"",auth_type:p.PAT,oauth2_token:"",app_id:"",installation_id:"",private_key_bytes:""}),Ee={...e(t)},n(D,p.PAT),n(ee,!1)}function P(){n(Ae,!1),n(Te,!1),n($e,!1),n(y,null),n(M,null),n(x,""),Se()}function Oe(r){n(D,r),_(t,e(t).auth_type=r)}function bt(){const r={};if(e(t).name!==Ee.name&&e(t).name.trim()!==""&&(r.name=e(t).name.trim()),e(t).description!==Ee.description&&e(t).description.trim()!==""&&(r.description=e(t).description.trim()),e(ee)&&e(y))if(e(y)["auth-type"]===p.PAT)e(t).oauth2_token.trim()!==""&&(r.pat={oauth2_token:e(t).oauth2_token.trim()});else{const d={};let b=!1;if(e(t).app_id.trim()!==""&&(d.app_id=parseInt(e(t).app_id.trim()),b=!0),e(t).installation_id.trim()!==""&&(d.installation_id=parseInt(e(t).installation_id.trim()),b=!0),e(t).private_key_bytes!=="")try{const v=atob(e(t).private_key_bytes);d.private_key_bytes=Array.from(v,l=>l.charCodeAt(0)),b=!0}catch{}b&&(r.app=d)}return r}async function ft(){try{if(e(x)==="github"){const r={name:e(t).name.trim(),description:e(t).description.trim(),endpoint:e(t).endpoint.trim(),auth_type:e(t).auth_type};e(t).auth_type===p.PAT?(r.pat={oauth2_token:e(t).oauth2_token.trim()},r.app={}):(r.app={app_id:parseInt(e(t).app_id.trim()),installation_id:parseInt(e(t).installation_id.trim()),private_key_bytes:Array.from(atob(e(t).private_key_bytes),d=>d.charCodeAt(0))},r.pat={}),await fe.createGithubCredentials(r)}else if(e(x)==="gitea"){const r={name:e(t).name.trim(),description:e(t).description.trim(),endpoint:e(t).endpoint.trim(),auth_type:p.PAT,pat:{oauth2_token:e(t).oauth2_token.trim()},app:{}};await fe.createGiteaCredentials(r)}else throw new Error("Please select a forge type");ke.success("Credentials Created",`Credentials ${e(t).name} have been created successfully.`),P()}catch(r){n(Ce,Re(r))}}async function vt(){if(!(!e(y)||!e(y).id))try{const r=bt();if(Object.keys(r).length===0){ke.info("No Changes","No fields were modified."),P();return}e(y).forge_type==="github"?await fe.updateGithubCredentials(e(y).id,r):await fe.updateGiteaCredentials(e(y).id,r),ke.success("Credentials Updated",`Credentials ${e(y)?.name||"Unknown"} have been updated successfully.`),P()}catch(r){n(Ce,Re(r))}}async function mt(){if(!(!e(M)||!e(M).id))try{e(M).forge_type==="github"?await fe.deleteGithubCredentials(e(M).id):await fe.deleteGiteaCredentials(e(M).id),ke.success("Credentials Deleted",`Credentials ${e(M)?.name||"Unknown"} have been deleted successfully.`)}catch(r){const d=Re(r);ke.error("Delete Failed",d)}finally{P()}}function Je(r){const b=r.target.files?.[0];if(!b){_(t,e(t).private_key_bytes="");return}const v=new FileReader;v.onload=l=>{const h=l.target?.result;_(t,e(t).private_key_bytes=btoa(h))},v.readAsText(b)}function Qe(){return e(t).name.trim()?e(ee)&&e(y)?e(y)["auth-type"]===p.PAT?!!e(t).oauth2_token.trim():!!e(t).app_id.trim()&&!!e(t).installation_id.trim()&&!!e(t).private_key_bytes:!0:!1}function xt(r){return e(Q).find(b=>b.name===r)?.endpoint_type||""}function _t(r){return xt(r)==="gitea"}const ht=[{key:"name",title:"Name",cellComponent:it,cellProps:{field:"name"}},{key:"description",title:"Description",cellComponent:it,cellProps:{field:"description",type:"description"}},{key:"endpoint",title:"Endpoint",cellComponent:or},{key:"auth_type",title:"Auth Type",cellComponent:ir,cellProps:{statusType:"custom",statusField:"auth-type"}},{key:"actions",title:"Actions",align:"right",cellComponent:nr}],kt={entityType:"credential",primaryText:{field:"name",isClickable:!1},secondaryText:{field:"description"},customInfo:[{icon:r=>He(r?.forge_type||"unknown"),text:r=>r?.endpoint?.name||"Unknown"}],badges:[{type:"auth",field:"auth-type"}],actions:[{type:"edit",handler:r=>Be(r)},{type:"delete",handler:r=>qe(r)}]};function wt(r){n(Pe,r.detail.term),n(K,1)}function Ct(r){n(K,r.detail.page)}function Pt(r){const d=ar(r.detail.perPage);n(ce,d.newPerPage),n(K,d.newCurrentPage)}function At(r){Be(r.detail.item)}function Tt(r){qe(r.detail.item)}J(()=>(e(le),U()),()=>{(!e(le).length||U().loaded.credentials)&&n(le,U().credentials)}),J(()=>U(),()=>{n(we,U().loading.credentials)}),J(()=>U(),()=>{n(Ge,U().errorMessages.credentials)}),J(()=>(e(Q),U()),()=>{(!e(Q).length||U().loaded.endpoints)&&n(Q,U().endpoints)}),J(()=>(e(le),e(Pe)),()=>{n(Z,tr(e(le),e(Pe)))}),J(()=>(e(ue),e(Z),e(ce),e(K)),()=>{n(ue,Math.ceil(e(Z).length/e(ce))),e(K)>e(ue)&&e(ue)>0&&n(K,e(ue))}),J(()=>(e(Z),e(K),e(ce)),()=>{n(Ye,rr(e(Z),e(K),e(ce)))}),J(()=>e(t),()=>{n(Ue,!e(t).name||!e(t).endpoint?!1:e(t).auth_type===p.PAT?!!e(t).oauth2_token:!!e(t).app_id&&!!e(t).installation_id&&!!e(t).private_key_bytes)}),J(()=>(e(x),e(Q)),()=>{n(ze,e(x)?e(Q).filter(r=>r.endpoint_type===e(x)):e(Q))}),Bt(),Gt();var We=xr();f("keydown",Lt,ut),jt(r=>{St.title="Credentials - GARM"});var Le=Fe(We),Xe=o(Le);Wt(Xe,{title:"Credentials",description:"Manage authentication credentials for your GitHub and Gitea endpoints.",actionLabel:"Add Credentials",$$events:{action:gt}});var $t=a(Xe,2);{let r=Ke(()=>e(Ge)||e(Ce)),d=Ke(()=>!!e(Ge));Zt($t,{get columns(){return ht},get data(){return e(Ye)},get loading(){return e(we)},get error(){return e(r)},get searchTerm(){return e(Pe)},searchPlaceholder:"Search credentials by name, description, or endpoint...",get currentPage(){return e(K)},get perPage(){return e(ce)},get totalPages(){return e(ue)},get totalItems(){return e(Z),u(()=>e(Z).length)},itemName:"credentials",emptyIconType:"key",get showRetry(){return e(d)},get mobileCardConfig(){return kt},$$events:{search:wt,pageChange:Ct,perPageChange:Pt,retry:pt,edit:At,delete:Tt},$$slots:{"mobile-card":(b,v)=>{const l=Ke(()=>v.item);var h=dr(),A=o(h),z=o(A),I=o(z),F=o(I,!0);i(I);var k=a(I,2),V=o(k,!0);i(k);var B=a(k,2),q=o(B),S=o(q);Yt(S,()=>(be(He),be(e(l)),u(()=>He(e(l).forge_type||"unknown"))));var te=a(S,2),re=o(te,!0);i(te),i(q),i(B),i(z),i(A);var ae=a(A,2),H=o(ae);{var oe=j=>{nt(j,{variant:"success",text:"PAT"})},R=j=>{nt(j,{variant:"info",text:"App"})};G(H,j=>{be(e(l)),u(()=>(e(l)["auth-type"]||"pat")==="pat")?j(oe):j(R,!1)})}var Y=a(H,2),ie=o(Y);ot(ie,{action:"edit",size:"sm",title:"Edit credentials",ariaLabel:"Edit credentials",$$events:{click:()=>Be(e(l))}});var pe=a(ie,2);ot(pe,{action:"delete",size:"sm",title:"Delete credentials",ariaLabel:"Delete credentials",$$events:{click:()=>qe(e(l))}}),i(Y),i(ae),i(h),se(()=>{W(F,(be(e(l)),u(()=>e(l).name))),W(V,(be(e(l)),u(()=>e(l).description))),W(re,(be(e(l)),u(()=>e(l).endpoint?.name||"Unknown")))}),$(b,h)}}})}i(Le);var Ze=a(Le,2);{var Et=r=>{var d=gr(),b=o(d),v=a(b,2),l=o(v),h=a(o(l),2);i(l);var A=a(l,2),z=o(A);Xt(z,{get selectedForgeType(){return e(x)},set selectedForgeType(s){n(x,s)},$$events:{select:yt},$$legacy:!0});var I=a(z,2),F=a(o(I),2);L(F),i(I);var k=a(I,2),V=a(o(k),2);rt(V),i(k);var B=a(k,2),q=a(o(B),2);se(()=>{e(t),Nt(()=>{e(ze)})});var S=o(q);S.value=S.__value="";var te=a(S);Ht(te,1,()=>e(ze),Rt,(s,c)=>{var m=sr(),C=o(m);i(m);var T={};se(()=>{W(C,`${e(c),u(()=>e(c).name)??""} (${e(c),u(()=>e(c).endpoint_type)??""})`),T!==(T=(e(c),u(()=>e(c).name)))&&(m.value=(m.__value=(e(c),u(()=>e(c).name)))??"")}),$(s,m)}),i(q);var re=a(q,2);{var ae=s=>{var c=lr(),m=o(c);i(c),se(()=>W(m,`Showing only ${e(x)??""} endpoints`)),$(s,c)};G(re,s=>{e(x)&&s(ae)})}i(B);var H=a(B,2),oe=a(o(H),2),R=o(oe),Y=a(R,2);i(oe);var ie=a(oe,2);{var pe=s=>{var c=cr();$(s,c)};G(ie,s=>{e(x)==="gitea"&&s(pe)})}i(H);var j=a(H,2);{var De=s=>{var c=ur(),m=a(o(c),2);L(m),i(c),N(m,()=>e(t).oauth2_token,C=>_(t,e(t).oauth2_token=C)),$(s,c)};G(j,s=>{e(D),u(()=>e(D)===p.PAT)&&s(De)})}var ve=a(j,2);{var Me=s=>{var c=pr(),m=Fe(c),C=a(o(m),2);L(C),i(m);var T=a(m,2),O=a(o(T),2);L(O),i(T);var de=a(T,2),ge=a(o(de),2),xe=o(ge),_e=a(xe,2),he=a(o(_e),2),Ie=o(he);X(),i(he),X(2),i(_e),i(ge),i(de),N(C,()=>e(t).app_id,ye=>_(t,e(t).app_id=ye)),N(O,()=>e(t).installation_id,ye=>_(t,e(t).installation_id=ye)),f("change",xe,Je),f("click",Ie,()=>document.getElementById("private_key")?.click()),$(s,c)};G(ve,s=>{e(D),u(()=>e(D)===p.APP)&&s(Me)})}var w=a(ve,2),ne=o(w),me=a(ne,2);i(w),i(A),i(v),i(d),se(s=>{je(R,1,`flex-1 py-2 px-4 text-sm font-medium rounded-md border focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer +import{f as E,e as f,h as jt,a as $,s as W,r as rt}from"../chunks/ZGz3X54u.js";import{i as Gt}from"../chunks/CY7Wcm-1.js";import{p as Ut,g as e,o as zt,l as J,b as Bt,f as Fe,a as qt,$ as St,m as g,d as n,e as Lt,c as o,s as a,r as i,u,h as be,i as Ke,t as se,j as _,k as Nt,n as X}from"../chunks/kDtaAWAK.js";import{i as G,s as Kt,a as Vt}from"../chunks/Cun6jNAp.js";import{e as Ht,i as Rt}from"../chunks/DdT9Vz5Q.js";import{h as Yt,r as L,s as je,b as Ot,a as Jt,g as fe}from"../chunks/CYK-UalN.js";import{b as N,a as Qt}from"../chunks/CYnNqrHp.js";import{p as at}from"../chunks/CdEA5IGF.js";import{P as Wt}from"../chunks/DacI6VAP.js";import{F as Xt}from"../chunks/CovvT05J.js";import{A as ot}from"../chunks/DUWZCTMr.js";import{D as Zt,G as it}from"../chunks/BKeluGSY.js";import{e as er,a as Ve}from"../chunks/Vo3Mv3dp.js";import{t as ke}from"../chunks/BVGCMSWJ.js";import{f as tr,p as rr,g as He,c as ar}from"../chunks/ZelbukuJ.js";import{e as Re}from"../chunks/BZiHL9L3.js";import{B as nt}from"../chunks/DbE0zTOa.js";import"../chunks/DWgB-t1g.js";import{E as or}from"../chunks/oWoYyEl8.js";import{S as ir}from"../chunks/BStwtkX8.js";import{A as nr}from"../chunks/rb89c4PS.js";var dr=E('

'),sr=E(""),lr=E('

'),cr=E('

Gitea only supports PAT authentication

'),ur=E('
'),pr=E('

or drag and drop

PEM, KEY files only

',1),gr=E(''),yr=E('
'),br=E('

or drag and drop

PEM, KEY files only. Upload new private key.

',1),fr=E(" ",1),vr=E(''),mr=E(''),xr=E('
',1);function Lr(dt,st){Ut(st,!1);const[lt,ct]=Kt(),U=()=>Vt(er,"$eagerCache",lt),Ge=g(),Z=g(),Ye=g(),Ue=g(),ze=g(),p={PAT:"pat",APP:"app"};let we=g(!0),le=g([]),Q=g([]),Ce=g(""),Pe=g(""),K=g(1),ce=g(25),ue=g(1),Ae=g(!1),Te=g(!1),$e=g(!1),D=g(p.PAT),y=g(null),M=g(null),t=g({name:"",description:"",endpoint:"",auth_type:p.PAT,oauth2_token:"",app_id:"",installation_id:"",private_key_bytes:""}),Ee={...e(t)},ee=g(!1);function ut(r){r.key==="Escape"&&(e(Ae)||e(Te)||e($e))&&P()}zt(async()=>{try{n(we,!0);const[r,d]=await Promise.all([Ve.getCredentials(),Ve.getEndpoints()]);r&&Array.isArray(r)&&n(le,r),d&&Array.isArray(d)&&n(Q,d)}catch(r){console.error("Failed to load credentials:",r),n(Ce,r instanceof Error?r.message:"Failed to load credentials")}finally{n(we,!1)}});async function pt(){try{await Ve.retryResource("credentials")}catch(r){console.error("Retry failed:",r)}}async function gt(){Se(),n(Ae,!0),n(x,"github"),_(t,e(t).auth_type=p.PAT)}let x=g("");function yt(r){n(x,r.detail),Se()}async function Be(r){n(y,r),n(t,{name:r.name||"",description:r.description||"",endpoint:r.endpoint?.name||"",auth_type:r["auth-type"]||p.PAT,oauth2_token:"",app_id:"",installation_id:"",private_key_bytes:""}),n(D,r["auth-type"]||p.PAT),Ee={...e(t)},n(ee,!1),n(Te,!0)}function qe(r){n(M,r),n($e,!0)}function Se(){n(t,{name:"",description:"",endpoint:"",auth_type:p.PAT,oauth2_token:"",app_id:"",installation_id:"",private_key_bytes:""}),Ee={...e(t)},n(D,p.PAT),n(ee,!1)}function P(){n(Ae,!1),n(Te,!1),n($e,!1),n(y,null),n(M,null),n(x,""),Se()}function Oe(r){n(D,r),_(t,e(t).auth_type=r)}function bt(){const r={};if(e(t).name!==Ee.name&&e(t).name.trim()!==""&&(r.name=e(t).name.trim()),e(t).description!==Ee.description&&e(t).description.trim()!==""&&(r.description=e(t).description.trim()),e(ee)&&e(y))if(e(y)["auth-type"]===p.PAT)e(t).oauth2_token.trim()!==""&&(r.pat={oauth2_token:e(t).oauth2_token.trim()});else{const d={};let b=!1;if(e(t).app_id.trim()!==""&&(d.app_id=parseInt(e(t).app_id.trim()),b=!0),e(t).installation_id.trim()!==""&&(d.installation_id=parseInt(e(t).installation_id.trim()),b=!0),e(t).private_key_bytes!=="")try{const v=atob(e(t).private_key_bytes);d.private_key_bytes=Array.from(v,l=>l.charCodeAt(0)),b=!0}catch{}b&&(r.app=d)}return r}async function ft(){try{if(e(x)==="github"){const r={name:e(t).name.trim(),description:e(t).description.trim(),endpoint:e(t).endpoint.trim(),auth_type:e(t).auth_type};e(t).auth_type===p.PAT?(r.pat={oauth2_token:e(t).oauth2_token.trim()},r.app={}):(r.app={app_id:parseInt(e(t).app_id.trim()),installation_id:parseInt(e(t).installation_id.trim()),private_key_bytes:Array.from(atob(e(t).private_key_bytes),d=>d.charCodeAt(0))},r.pat={}),await fe.createGithubCredentials(r)}else if(e(x)==="gitea"){const r={name:e(t).name.trim(),description:e(t).description.trim(),endpoint:e(t).endpoint.trim(),auth_type:p.PAT,pat:{oauth2_token:e(t).oauth2_token.trim()},app:{}};await fe.createGiteaCredentials(r)}else throw new Error("Please select a forge type");ke.success("Credentials Created",`Credentials ${e(t).name} have been created successfully.`),P()}catch(r){n(Ce,Re(r))}}async function vt(){if(!(!e(y)||!e(y).id))try{const r=bt();if(Object.keys(r).length===0){ke.info("No Changes","No fields were modified."),P();return}e(y).forge_type==="github"?await fe.updateGithubCredentials(e(y).id,r):await fe.updateGiteaCredentials(e(y).id,r),ke.success("Credentials Updated",`Credentials ${e(y)?.name||"Unknown"} have been updated successfully.`),P()}catch(r){n(Ce,Re(r))}}async function mt(){if(!(!e(M)||!e(M).id))try{e(M).forge_type==="github"?await fe.deleteGithubCredentials(e(M).id):await fe.deleteGiteaCredentials(e(M).id),ke.success("Credentials Deleted",`Credentials ${e(M)?.name||"Unknown"} have been deleted successfully.`)}catch(r){const d=Re(r);ke.error("Delete Failed",d)}finally{P()}}function Je(r){const b=r.target.files?.[0];if(!b){_(t,e(t).private_key_bytes="");return}const v=new FileReader;v.onload=l=>{const h=l.target?.result;_(t,e(t).private_key_bytes=btoa(h))},v.readAsText(b)}function Qe(){return e(t).name.trim()?e(ee)&&e(y)?e(y)["auth-type"]===p.PAT?!!e(t).oauth2_token.trim():!!e(t).app_id.trim()&&!!e(t).installation_id.trim()&&!!e(t).private_key_bytes:!0:!1}function xt(r){return e(Q).find(b=>b.name===r)?.endpoint_type||""}function _t(r){return xt(r)==="gitea"}const ht=[{key:"name",title:"Name",cellComponent:it,cellProps:{field:"name"}},{key:"description",title:"Description",cellComponent:it,cellProps:{field:"description",type:"description"}},{key:"endpoint",title:"Endpoint",cellComponent:or},{key:"auth_type",title:"Auth Type",cellComponent:ir,cellProps:{statusType:"custom",statusField:"auth-type"}},{key:"actions",title:"Actions",align:"right",cellComponent:nr}],kt={entityType:"credential",primaryText:{field:"name",isClickable:!1},secondaryText:{field:"description"},customInfo:[{icon:r=>He(r?.forge_type||"unknown"),text:r=>r?.endpoint?.name||"Unknown"}],badges:[{type:"auth",field:"auth-type"}],actions:[{type:"edit",handler:r=>Be(r)},{type:"delete",handler:r=>qe(r)}]};function wt(r){n(Pe,r.detail.term),n(K,1)}function Ct(r){n(K,r.detail.page)}function Pt(r){const d=ar(r.detail.perPage);n(ce,d.newPerPage),n(K,d.newCurrentPage)}function At(r){Be(r.detail.item)}function Tt(r){qe(r.detail.item)}J(()=>(e(le),U()),()=>{(!e(le).length||U().loaded.credentials)&&n(le,U().credentials)}),J(()=>U(),()=>{n(we,U().loading.credentials)}),J(()=>U(),()=>{n(Ge,U().errorMessages.credentials)}),J(()=>(e(Q),U()),()=>{(!e(Q).length||U().loaded.endpoints)&&n(Q,U().endpoints)}),J(()=>(e(le),e(Pe)),()=>{n(Z,tr(e(le),e(Pe)))}),J(()=>(e(ue),e(Z),e(ce),e(K)),()=>{n(ue,Math.ceil(e(Z).length/e(ce))),e(K)>e(ue)&&e(ue)>0&&n(K,e(ue))}),J(()=>(e(Z),e(K),e(ce)),()=>{n(Ye,rr(e(Z),e(K),e(ce)))}),J(()=>e(t),()=>{n(Ue,!e(t).name||!e(t).endpoint?!1:e(t).auth_type===p.PAT?!!e(t).oauth2_token:!!e(t).app_id&&!!e(t).installation_id&&!!e(t).private_key_bytes)}),J(()=>(e(x),e(Q)),()=>{n(ze,e(x)?e(Q).filter(r=>r.endpoint_type===e(x)):e(Q))}),Bt(),Gt();var We=xr();f("keydown",Lt,ut),jt(r=>{St.title="Credentials - GARM"});var Le=Fe(We),Xe=o(Le);Wt(Xe,{title:"Credentials",description:"Manage authentication credentials for your GitHub and Gitea endpoints.",actionLabel:"Add Credentials",$$events:{action:gt}});var $t=a(Xe,2);{let r=Ke(()=>e(Ge)||e(Ce)),d=Ke(()=>!!e(Ge));Zt($t,{get columns(){return ht},get data(){return e(Ye)},get loading(){return e(we)},get error(){return e(r)},get searchTerm(){return e(Pe)},searchPlaceholder:"Search credentials by name, description, or endpoint...",get currentPage(){return e(K)},get perPage(){return e(ce)},get totalPages(){return e(ue)},get totalItems(){return e(Z),u(()=>e(Z).length)},itemName:"credentials",emptyIconType:"key",get showRetry(){return e(d)},get mobileCardConfig(){return kt},$$events:{search:wt,pageChange:Ct,perPageChange:Pt,retry:pt,edit:At,delete:Tt},$$slots:{"mobile-card":(b,v)=>{const l=Ke(()=>v.item);var h=dr(),A=o(h),z=o(A),I=o(z),F=o(I,!0);i(I);var k=a(I,2),V=o(k,!0);i(k);var B=a(k,2),q=o(B),S=o(q);Yt(S,()=>(be(He),be(e(l)),u(()=>He(e(l).forge_type||"unknown"))));var te=a(S,2),re=o(te,!0);i(te),i(q),i(B),i(z),i(A);var ae=a(A,2),H=o(ae);{var oe=j=>{nt(j,{variant:"success",text:"PAT"})},R=j=>{nt(j,{variant:"info",text:"App"})};G(H,j=>{be(e(l)),u(()=>(e(l)["auth-type"]||"pat")==="pat")?j(oe):j(R,!1)})}var Y=a(H,2),ie=o(Y);ot(ie,{action:"edit",size:"sm",title:"Edit credentials",ariaLabel:"Edit credentials",$$events:{click:()=>Be(e(l))}});var pe=a(ie,2);ot(pe,{action:"delete",size:"sm",title:"Delete credentials",ariaLabel:"Delete credentials",$$events:{click:()=>qe(e(l))}}),i(Y),i(ae),i(h),se(()=>{W(F,(be(e(l)),u(()=>e(l).name))),W(V,(be(e(l)),u(()=>e(l).description))),W(re,(be(e(l)),u(()=>e(l).endpoint?.name||"Unknown")))}),$(b,h)}}})}i(Le);var Ze=a(Le,2);{var Et=r=>{var d=gr(),b=o(d),v=a(b,2),l=o(v),h=a(o(l),2);i(l);var A=a(l,2),z=o(A);Xt(z,{get selectedForgeType(){return e(x)},set selectedForgeType(s){n(x,s)},$$events:{select:yt},$$legacy:!0});var I=a(z,2),F=a(o(I),2);L(F),i(I);var k=a(I,2),V=a(o(k),2);rt(V),i(k);var B=a(k,2),q=a(o(B),2);se(()=>{e(t),Nt(()=>{e(ze)})});var S=o(q);S.value=S.__value="";var te=a(S);Ht(te,1,()=>e(ze),Rt,(s,c)=>{var m=sr(),C=o(m);i(m);var T={};se(()=>{W(C,`${e(c),u(()=>e(c).name)??""} (${e(c),u(()=>e(c).endpoint_type)??""})`),T!==(T=(e(c),u(()=>e(c).name)))&&(m.value=(m.__value=(e(c),u(()=>e(c).name)))??"")}),$(s,m)}),i(q);var re=a(q,2);{var ae=s=>{var c=lr(),m=o(c);i(c),se(()=>W(m,`Showing only ${e(x)??""} endpoints`)),$(s,c)};G(re,s=>{e(x)&&s(ae)})}i(B);var H=a(B,2),oe=a(o(H),2),R=o(oe),Y=a(R,2);i(oe);var ie=a(oe,2);{var pe=s=>{var c=cr();$(s,c)};G(ie,s=>{e(x)==="gitea"&&s(pe)})}i(H);var j=a(H,2);{var De=s=>{var c=ur(),m=a(o(c),2);L(m),i(c),N(m,()=>e(t).oauth2_token,C=>_(t,e(t).oauth2_token=C)),$(s,c)};G(j,s=>{e(D),u(()=>e(D)===p.PAT)&&s(De)})}var ve=a(j,2);{var Me=s=>{var c=pr(),m=Fe(c),C=a(o(m),2);L(C),i(m);var T=a(m,2),O=a(o(T),2);L(O),i(T);var de=a(T,2),ge=a(o(de),2),xe=o(ge),_e=a(xe,2),he=a(o(_e),2),Ie=o(he);X(),i(he),X(2),i(_e),i(ge),i(de),N(C,()=>e(t).app_id,ye=>_(t,e(t).app_id=ye)),N(O,()=>e(t).installation_id,ye=>_(t,e(t).installation_id=ye)),f("change",xe,Je),f("click",Ie,()=>document.getElementById("private_key")?.click()),$(s,c)};G(ve,s=>{e(D),u(()=>e(D)===p.APP)&&s(Me)})}var w=a(ve,2),ne=o(w),me=a(ne,2);i(w),i(A),i(v),i(d),se(s=>{je(R,1,`flex-1 py-2 px-4 text-sm font-medium rounded-md border focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer ${e(D),u(()=>e(D)===p.PAT?"bg-blue-600 text-white border-blue-600":"bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600")??""} ${s??""}`),Y.disabled=e(x)==="gitea",je(Y,1,`flex-1 py-2 px-4 text-sm font-medium rounded-md border focus:outline-none focus:ring-2 focus:ring-blue-500 ${e(D),u(()=>e(D)===p.APP?"bg-blue-600 text-white border-blue-600":"bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600")??""} diff --git a/webapp/assets/_app/immutable/nodes/4.4T8ji-4a.js b/webapp/assets/_app/immutable/nodes/4.BEiTKBiZ.js similarity index 98% rename from webapp/assets/_app/immutable/nodes/4.4T8ji-4a.js rename to webapp/assets/_app/immutable/nodes/4.BEiTKBiZ.js index b74947cb..1fed7d90 100644 --- a/webapp/assets/_app/immutable/nodes/4.4T8ji-4a.js +++ b/webapp/assets/_app/immutable/nodes/4.BEiTKBiZ.js @@ -1,3 +1,3 @@ -import{f as T,e as _,h as Ut,a as P,s as V,r as Qe}from"../chunks/ZGz3X54u.js";import{i as Lt}from"../chunks/CY7Wcm-1.js";import{p as Mt,g as e,o as Pt,l as ae,b as Tt,f as xe,a as $t,m,e as At,$ as Bt,c as o,i as Fe,s as r,t as Q,u as y,d as s,j as b,r as l,h as he,n as re}from"../chunks/kDtaAWAK.js";import{i as oe,s as It,a as Dt}from"../chunks/Cun6jNAp.js";import{h as Gt,r as E,c as Xe,s as z,g as ce}from"../chunks/Cvcp5xHB.js";import{b as R,a as Ye}from"../chunks/CYnNqrHp.js";import{p as Ze}from"../chunks/CdEA5IGF.js";import{P as jt}from"../chunks/CLZesvzF.js";import{F as Ft}from"../chunks/CCoxuXg5.js";import{A as et}from"../chunks/uzzFhb3G.js";import{e as zt,a as tt}from"../chunks/C2c_wqo6.js";import{t as ke}from"../chunks/BVGCMSWJ.js";import{g as ze,c as qt,a as Nt,p as Ht}from"../chunks/DNHT2U_W.js";import{e as qe}from"../chunks/BZiHL9L3.js";import{D as St,G as Ne}from"../chunks/Cfdue6T6.js";import"../chunks/CkTG2UXI.js";import{E as Vt}from"../chunks/C-3AL0iB.js";import{A as Ot}from"../chunks/Cs0pYghy.js";import{T as $e}from"../chunks/Ckgw6FMz.js";var Wt=T('

'),Kt=T('
',1),Jt=T('

If empty, Base URL will be used as API Base URL

',1),Qt=T('

'),Xt=T('

or drag and drop

PEM, CRT, CER, CERT files only

'),Yt=T(''),Zt=T('
',1),ea=T('

If empty, Base URL will be used as API Base URL

',1),ta=T('

'),aa=T('

or drag and drop

PEM, CRT, CER, CERT files only

'),ra=T(''),oa=T(''),la=T('
',1);function Ea(at,rt){Mt(rt,!1);const[ot,lt]=It(),X=()=>Dt(zt,"$eagerCache",ot),Ae=m(),Y=m(),He=m(),pe=m();let we=m(!0),le=m([]),Ce=m(""),Ee=m(""),q=m(1),se=m(25),ie=m(1),Re=m(!1),Ue=m(!1),Le=m(!1),O=m("github"),h=m(null),D=m(null),t=m({name:"",description:"",endpoint_type:"",base_url:"",api_base_url:"",upload_base_url:"",ca_cert_bundle:"",tools_metadata_url:"",use_internal_tools_metadata:!1}),B=m(""),k={...e(t)};Pt(async()=>{try{s(we,!0);const a=await tt.getEndpoints();a&&Array.isArray(a)&&s(le,a)}catch(a){console.error("Failed to load endpoints:",a),s(Ce,a instanceof Error?a.message:"Failed to load endpoints")}finally{s(we,!1)}});async function st(){try{await tt.retryResource("endpoints")}catch(a){console.error("Retry failed:",a)}}const it=[{key:"name",title:"Name",cellComponent:Ne,cellProps:{field:"name"}},{key:"description",title:"Description",cellComponent:Ne,cellProps:{field:"description"}},{key:"api_url",title:"API URL",cellComponent:Ne,cellProps:{field:"api_base_url",fallbackField:"base_url"}},{key:"forge_type",title:"Forge Type",cellComponent:Vt},{key:"actions",title:"Actions",align:"right",cellComponent:Ot}],nt={entityType:"endpoint",primaryText:{field:"name",isClickable:!1},secondaryText:{field:"description"},customInfo:[{icon:a=>ze(a?.endpoint_type||"unknown"),text:a=>a?.api_base_url||"Unknown"}],actions:[{type:"edit",handler:a=>Be(a)},{type:"delete",handler:a=>Ie(a)}]};function dt(a){s(Ee,a.detail.term),s(q,1)}function ut(a){s(q,a.detail.page)}function ct(a){const n=qt(a.detail.perPage);s(se,n.newPerPage),s(q,n.newCurrentPage)}function pt(a){Be(a.detail.item)}function bt(a){Ie(a.detail.item)}function _t(){s(O,"github"),De(),b(t,e(t).endpoint_type="github"),s(Re,!0)}function gt(a){s(O,a.detail),De(),b(t,e(t).endpoint_type=a.detail)}function Be(a){s(h,a),s(t,{name:a.name||"",description:a.description||"",endpoint_type:a.endpoint_type||"",base_url:a.base_url||"",api_base_url:a.api_base_url||"",upload_base_url:a.upload_base_url||"",ca_cert_bundle:typeof a.ca_cert_bundle=="string"?a.ca_cert_bundle:"",tools_metadata_url:a.tools_metadata_url||"",use_internal_tools_metadata:a.use_internal_tools_metadata||!1}),k={...e(t)},s(B,e(t).ca_cert_bundle?"certificate.pem":""),s(Ue,!0)}function Ie(a){s(D,a),s(Le,!0)}function De(){s(t,{name:"",description:"",endpoint_type:"",base_url:"",api_base_url:"",upload_base_url:"",ca_cert_bundle:"",tools_metadata_url:"",use_internal_tools_metadata:!1}),k={...e(t)},s(B,"")}function mt(a){a.key==="Escape"&&(e(Re)||e(Ue)||e(Le))&&U()}function U(){s(Re,!1),s(Ue,!1),s(Le,!1),s(O,"github"),s(h,null),s(D,null),De()}function ft(){const a={};if(e(t).description!==k.description&&(e(t).description.trim()!==""||k.description!=="")&&(a.description=e(t).description.trim()),e(t).base_url!==k.base_url&&e(t).base_url.trim()!==""&&(a.base_url=e(t).base_url.trim()),e(t).api_base_url!==k.api_base_url&&(e(t).api_base_url.trim()!==""||k.api_base_url!=="")&&(a.api_base_url=e(t).api_base_url.trim()),e(h)?.endpoint_type==="github"&&e(t).upload_base_url!==k.upload_base_url&&(e(t).upload_base_url.trim()!==""||k.upload_base_url!=="")&&(a.upload_base_url=e(t).upload_base_url.trim()),e(t).ca_cert_bundle!==k.ca_cert_bundle)if(e(t).ca_cert_bundle!=="")try{const n=atob(e(t).ca_cert_bundle);a.ca_cert_bundle=Array.from(n,f=>f.charCodeAt(0))}catch{k.ca_cert_bundle!==""&&(a.ca_cert_bundle=[])}else k.ca_cert_bundle!==""&&(a.ca_cert_bundle=[]);return e(h)?.endpoint_type==="gitea"&&(e(t).tools_metadata_url!==k.tools_metadata_url&&(a.tools_metadata_url=e(t).tools_metadata_url.trim()),e(t).use_internal_tools_metadata!==k.use_internal_tools_metadata&&(a.use_internal_tools_metadata=e(t).use_internal_tools_metadata)),a}async function vt(){try{const a={name:e(t).name,description:e(t).description,endpoint_type:e(t).endpoint_type,base_url:e(t).base_url,api_base_url:e(t).api_base_url,upload_base_url:e(t).upload_base_url};if(e(t).endpoint_type==="gitea"&&(e(t).tools_metadata_url.trim()!==""&&(a.tools_metadata_url=e(t).tools_metadata_url.trim()),a.use_internal_tools_metadata=e(t).use_internal_tools_metadata),e(t).ca_cert_bundle&&e(t).ca_cert_bundle.trim()!=="")try{const n=atob(e(t).ca_cert_bundle);a.ca_cert_bundle=Array.from(n,f=>f.charCodeAt(0))}catch{}e(t).endpoint_type==="github"?await ce.createGithubEndpoint(a):await ce.createGiteaEndpoint(a),ke.success("Endpoint Created",`Endpoint ${e(t).name} has been created successfully.`),U()}catch(a){s(Ce,qe(a))}}async function yt(){if(e(h))try{const a=ft();if(Object.keys(a).length===0){ke.info("No Changes","No fields were modified."),U();return}e(h).endpoint_type==="github"?await ce.updateGithubEndpoint(e(h).name,a):await ce.updateGiteaEndpoint(e(h).name,a),ke.success("Endpoint Updated",`Endpoint ${e(h).name} has been updated successfully.`),U()}catch(a){s(Ce,qe(a))}}async function xt(){if(e(D)){try{e(D).endpoint_type==="github"?await ce.deleteGithubEndpoint(e(D).name):await ce.deleteGiteaEndpoint(e(D).name),ke.success("Endpoint Deleted",`Endpoint ${e(D).name} has been deleted successfully.`)}catch(a){const n=qe(a);ke.error("Delete Failed",n)}U()}}function Se(a){const f=a.target.files?.[0];if(!f){b(t,e(t).ca_cert_bundle=""),s(B,"");return}s(B,f.name);const L=new FileReader;L.onload=d=>{const w=d.target?.result;b(t,e(t).ca_cert_bundle=btoa(w))},L.readAsText(f)}function Ve(){b(t,e(t).ca_cert_bundle=""),s(B,"");const a=document.getElementById("ca_cert_file");a&&(a.value="");const n=document.getElementById("edit_ca_cert_file");n&&(n.value="")}ae(()=>(e(le),X()),()=>{(!e(le).length||X().loaded.endpoints)&&s(le,X().endpoints)}),ae(()=>X(),()=>{s(we,X().loading.endpoints)}),ae(()=>X(),()=>{s(Ae,X().errorMessages.endpoints)}),ae(()=>(e(le),e(Ee)),()=>{s(Y,Nt(e(le),e(Ee)))}),ae(()=>(e(ie),e(Y),e(se),e(q)),()=>{s(ie,Math.ceil(e(Y).length/e(se))),e(q)>e(ie)&&e(ie)>0&&s(q,e(ie))}),ae(()=>(e(Y),e(q),e(se)),()=>{s(He,Ht(e(Y),e(q),e(se)))}),ae(()=>e(t),()=>{s(pe,!(!e(t).name||!e(t).base_url||e(t).endpoint_type==="github"&&!e(t).api_base_url))}),Tt(),Lt();var Oe=la();_("keydown",At,mt),Ut(a=>{Bt.title="Endpoints - GARM"});var Ge=xe(Oe),We=o(Ge);jt(We,{title:"Endpoints",description:"Manage your GitHub and Gitea endpoints for runner management.",actionLabel:"Add Endpoint",$$events:{action:_t}});var ht=r(We,2);{let a=Fe(()=>e(Ae)||e(Ce)),n=Fe(()=>!!e(Ae));St(ht,{get columns(){return it},get data(){return e(He)},get loading(){return e(we)},get error(){return e(a)},get searchTerm(){return e(Ee)},searchPlaceholder:"Search endpoints by name, description, or URL...",get currentPage(){return e(q)},get perPage(){return e(se)},get totalPages(){return e(ie)},get totalItems(){return e(Y),y(()=>e(Y).length)},itemName:"endpoints",emptyIconType:"settings",get showRetry(){return e(n)},get mobileCardConfig(){return nt},$$events:{search:dt,pageChange:ut,perPageChange:ct,retry:st,edit:pt,delete:bt},$$slots:{"mobile-card":(f,L)=>{const d=Fe(()=>L.item);var w=Wt(),M=o(w),G=o(M),I=o(G),$=o(I,!0);l(I);var C=r(I,2),N=o(C,!0);l(C);var j=r(C,2),H=o(j);Gt(H,()=>(he(ze),he(e(d)),y(()=>ze(e(d).endpoint_type||"","w-5 h-5"))));var S=r(H,2),ne=o(S,!0);l(S),l(j),l(G),l(M);var Z=r(M,2),W=o(Z);et(W,{action:"edit",size:"sm",title:"Edit endpoint",ariaLabel:"Edit endpoint",$$events:{click:()=>Be(e(d))}});var ee=r(W,2);et(ee,{action:"delete",size:"sm",title:"Delete endpoint",ariaLabel:"Delete endpoint",$$events:{click:()=>Ie(e(d))}}),l(Z),l(w),Q(()=>{V($,(he(e(d)),y(()=>e(d).name))),V(N,(he(e(d)),y(()=>e(d).description))),V(ne,(he(e(d)),y(()=>e(d).endpoint_type)))}),P(f,w)}}})}l(Ge);var Ke=r(Ge,2);{var kt=a=>{var n=Yt(),f=o(n),L=r(f,2),d=o(L),w=r(o(d),2);l(d);var M=r(d,2),G=o(M);Ft(G,{get selectedForgeType(){return e(O)},set selectedForgeType(u){s(O,u)},$$events:{select:gt},$$legacy:!0});var I=r(G,2),$=r(o(I),2);E($),l(I);var C=r(I,2),N=r(o(C),2);Qe(N),l(C);var j=r(C,2),H=r(o(j),2);E(H),l(j);var S=r(j,2);{var ne=u=>{var x=Kt(),i=xe(x),p=r(o(i),2);E(p),l(i);var c=r(i,2),g=r(o(c),2);E(g),l(c),R(p,()=>e(t).api_base_url,v=>b(t,e(t).api_base_url=v)),R(g,()=>e(t).upload_base_url,v=>b(t,e(t).upload_base_url=v)),P(u,x)},Z=u=>{var x=Jt(),i=xe(x),p=r(o(i),2);E(p),re(2),l(i);var c=r(i,2),g=o(c),v=o(g),A=r(v,2),F=o(A);$e(F,{title:"Tools Metadata URL",content:"URL where GARM checks for act_runner binary downloads and release information. Defaults to https://gitea.com/api/v1/repos/gitea/act_runner/releases if not specified. Use a custom URL to point to your own tools repository or mirror.",position:"top",width:"w-80"}),l(A),l(g);var K=r(g,2);E(K);var ge=r(K,2),te=o(ge,!0);l(ge),l(c);var ue=r(c,2),me=o(ue);E(me);var fe=r(me,4),ve=o(fe);$e(ve,{title:"Internal Tools Metadata",content:"When enabled, GARM uses built-in URLs for nightly act_runner binaries instead of calling the external tools metadata URL. This is useful in air-gapped environments where runner images already include the binaries and don't need to download them.",position:"top",width:"w-80"}),l(fe),l(ue),Q(()=>{z(v,1,`block text-sm font-medium ${e(t),y(()=>e(t).use_internal_tools_metadata?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300")??""}`),K.disabled=(e(t),y(()=>e(t).use_internal_tools_metadata)),z(K,1,`w-full px-3 py-2 border rounded-md focus:outline-none transition-colors ${e(t),y(()=>e(t).use_internal_tools_metadata?"bg-gray-100 dark:bg-gray-800 border-gray-300 dark:border-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed":"border-gray-300 dark:border-gray-600 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white")??""}`),z(ge,1,`text-xs ${e(t),y(()=>e(t).use_internal_tools_metadata?"text-gray-400 dark:text-gray-500":"text-gray-500 dark:text-gray-400")??""} mt-1`),V(te,(e(t),y(()=>e(t).use_internal_tools_metadata?"Disabled when using internal tools metadata":"Leave empty to use default Gitea releases URL")))}),R(p,()=>e(t).api_base_url,J=>b(t,e(t).api_base_url=J)),R(K,()=>e(t).tools_metadata_url,J=>b(t,e(t).tools_metadata_url=J)),Ye(me,()=>e(t).use_internal_tools_metadata,J=>b(t,e(t).use_internal_tools_metadata=J)),P(u,x)};oe(S,u=>{e(O)==="github"?u(ne):u(Z,!1)})}var W=r(S,2),ee=r(o(W),2),de=o(ee),be=r(de,2);{var Me=u=>{var x=Qt(),i=r(o(x),2),p=o(i,!0);l(i);var c=r(i,2),g=o(c),v=r(g,4);l(c),l(x),Q(()=>V(p,e(B))),_("click",g,()=>document.getElementById("ca_cert_file")?.click()),_("click",v,Ve),P(u,x)},je=u=>{var x=Xt(),i=r(o(x),2),p=o(i);re(),l(i),re(2),l(x),_("click",p,()=>document.getElementById("ca_cert_file")?.click()),P(u,x)};oe(be,u=>{e(B)?u(Me):u(je,!1)})}l(ee),l(W);var Pe=r(W,2),Te=o(Pe),_e=r(Te,2);l(Pe),l(M),l(L),l(n),Q(()=>{Xe($,"placeholder",e(O)==="github"?"e.g., github-enterprise or github-com":"e.g., gitea-main or my-gitea"),Xe(H,"placeholder",e(O)==="github"?"https://github.com or https://github.example.com":"https://gitea.example.com"),z(ee,1,`border-2 border-dashed rounded-lg p-4 text-center transition-colors ${e(B)?"border-green-500 dark:border-green-400 bg-green-50 dark:bg-green-900/20":"border-gray-300 dark:border-gray-600 hover:border-blue-400 dark:hover:border-blue-400"}`),_e.disabled=!e(pe),z(_e,1,`px-4 py-2 text-sm font-medium text-white rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors +import{f as T,e as _,h as Ut,a as P,s as V,r as Qe}from"../chunks/ZGz3X54u.js";import{i as Lt}from"../chunks/CY7Wcm-1.js";import{p as Mt,g as e,o as Pt,l as ae,b as Tt,f as xe,a as $t,m,e as At,$ as Bt,c as o,i as Fe,s as r,t as Q,u as y,d as s,j as b,r as l,h as he,n as re}from"../chunks/kDtaAWAK.js";import{i as oe,s as It,a as Dt}from"../chunks/Cun6jNAp.js";import{h as Gt,r as E,c as Xe,s as z,g as ce}from"../chunks/CYK-UalN.js";import{b as R,a as Ye}from"../chunks/CYnNqrHp.js";import{p as Ze}from"../chunks/CdEA5IGF.js";import{P as jt}from"../chunks/DacI6VAP.js";import{F as Ft}from"../chunks/CovvT05J.js";import{A as et}from"../chunks/DUWZCTMr.js";import{e as zt,a as tt}from"../chunks/Vo3Mv3dp.js";import{t as ke}from"../chunks/BVGCMSWJ.js";import{g as ze,c as qt,a as Nt,p as Ht}from"../chunks/ZelbukuJ.js";import{e as qe}from"../chunks/BZiHL9L3.js";import{D as St,G as Ne}from"../chunks/BKeluGSY.js";import"../chunks/DWgB-t1g.js";import{E as Vt}from"../chunks/oWoYyEl8.js";import{A as Ot}from"../chunks/rb89c4PS.js";import{T as $e}from"../chunks/ONKDshdz.js";var Wt=T('

'),Kt=T('
',1),Jt=T('

If empty, Base URL will be used as API Base URL

',1),Qt=T('

'),Xt=T('

or drag and drop

PEM, CRT, CER, CERT files only

'),Yt=T(''),Zt=T('
',1),ea=T('

If empty, Base URL will be used as API Base URL

',1),ta=T('

'),aa=T('

or drag and drop

PEM, CRT, CER, CERT files only

'),ra=T(''),oa=T(''),la=T('
',1);function Ea(at,rt){Mt(rt,!1);const[ot,lt]=It(),X=()=>Dt(zt,"$eagerCache",ot),Ae=m(),Y=m(),He=m(),pe=m();let we=m(!0),le=m([]),Ce=m(""),Ee=m(""),q=m(1),se=m(25),ie=m(1),Re=m(!1),Ue=m(!1),Le=m(!1),O=m("github"),h=m(null),D=m(null),t=m({name:"",description:"",endpoint_type:"",base_url:"",api_base_url:"",upload_base_url:"",ca_cert_bundle:"",tools_metadata_url:"",use_internal_tools_metadata:!1}),B=m(""),k={...e(t)};Pt(async()=>{try{s(we,!0);const a=await tt.getEndpoints();a&&Array.isArray(a)&&s(le,a)}catch(a){console.error("Failed to load endpoints:",a),s(Ce,a instanceof Error?a.message:"Failed to load endpoints")}finally{s(we,!1)}});async function st(){try{await tt.retryResource("endpoints")}catch(a){console.error("Retry failed:",a)}}const it=[{key:"name",title:"Name",cellComponent:Ne,cellProps:{field:"name"}},{key:"description",title:"Description",cellComponent:Ne,cellProps:{field:"description"}},{key:"api_url",title:"API URL",cellComponent:Ne,cellProps:{field:"api_base_url",fallbackField:"base_url"}},{key:"forge_type",title:"Forge Type",cellComponent:Vt},{key:"actions",title:"Actions",align:"right",cellComponent:Ot}],nt={entityType:"endpoint",primaryText:{field:"name",isClickable:!1},secondaryText:{field:"description"},customInfo:[{icon:a=>ze(a?.endpoint_type||"unknown"),text:a=>a?.api_base_url||"Unknown"}],actions:[{type:"edit",handler:a=>Be(a)},{type:"delete",handler:a=>Ie(a)}]};function dt(a){s(Ee,a.detail.term),s(q,1)}function ut(a){s(q,a.detail.page)}function ct(a){const n=qt(a.detail.perPage);s(se,n.newPerPage),s(q,n.newCurrentPage)}function pt(a){Be(a.detail.item)}function bt(a){Ie(a.detail.item)}function _t(){s(O,"github"),De(),b(t,e(t).endpoint_type="github"),s(Re,!0)}function gt(a){s(O,a.detail),De(),b(t,e(t).endpoint_type=a.detail)}function Be(a){s(h,a),s(t,{name:a.name||"",description:a.description||"",endpoint_type:a.endpoint_type||"",base_url:a.base_url||"",api_base_url:a.api_base_url||"",upload_base_url:a.upload_base_url||"",ca_cert_bundle:typeof a.ca_cert_bundle=="string"?a.ca_cert_bundle:"",tools_metadata_url:a.tools_metadata_url||"",use_internal_tools_metadata:a.use_internal_tools_metadata||!1}),k={...e(t)},s(B,e(t).ca_cert_bundle?"certificate.pem":""),s(Ue,!0)}function Ie(a){s(D,a),s(Le,!0)}function De(){s(t,{name:"",description:"",endpoint_type:"",base_url:"",api_base_url:"",upload_base_url:"",ca_cert_bundle:"",tools_metadata_url:"",use_internal_tools_metadata:!1}),k={...e(t)},s(B,"")}function mt(a){a.key==="Escape"&&(e(Re)||e(Ue)||e(Le))&&U()}function U(){s(Re,!1),s(Ue,!1),s(Le,!1),s(O,"github"),s(h,null),s(D,null),De()}function ft(){const a={};if(e(t).description!==k.description&&(e(t).description.trim()!==""||k.description!=="")&&(a.description=e(t).description.trim()),e(t).base_url!==k.base_url&&e(t).base_url.trim()!==""&&(a.base_url=e(t).base_url.trim()),e(t).api_base_url!==k.api_base_url&&(e(t).api_base_url.trim()!==""||k.api_base_url!=="")&&(a.api_base_url=e(t).api_base_url.trim()),e(h)?.endpoint_type==="github"&&e(t).upload_base_url!==k.upload_base_url&&(e(t).upload_base_url.trim()!==""||k.upload_base_url!=="")&&(a.upload_base_url=e(t).upload_base_url.trim()),e(t).ca_cert_bundle!==k.ca_cert_bundle)if(e(t).ca_cert_bundle!=="")try{const n=atob(e(t).ca_cert_bundle);a.ca_cert_bundle=Array.from(n,f=>f.charCodeAt(0))}catch{k.ca_cert_bundle!==""&&(a.ca_cert_bundle=[])}else k.ca_cert_bundle!==""&&(a.ca_cert_bundle=[]);return e(h)?.endpoint_type==="gitea"&&(e(t).tools_metadata_url!==k.tools_metadata_url&&(a.tools_metadata_url=e(t).tools_metadata_url.trim()),e(t).use_internal_tools_metadata!==k.use_internal_tools_metadata&&(a.use_internal_tools_metadata=e(t).use_internal_tools_metadata)),a}async function vt(){try{const a={name:e(t).name,description:e(t).description,endpoint_type:e(t).endpoint_type,base_url:e(t).base_url,api_base_url:e(t).api_base_url,upload_base_url:e(t).upload_base_url};if(e(t).endpoint_type==="gitea"&&(e(t).tools_metadata_url.trim()!==""&&(a.tools_metadata_url=e(t).tools_metadata_url.trim()),a.use_internal_tools_metadata=e(t).use_internal_tools_metadata),e(t).ca_cert_bundle&&e(t).ca_cert_bundle.trim()!=="")try{const n=atob(e(t).ca_cert_bundle);a.ca_cert_bundle=Array.from(n,f=>f.charCodeAt(0))}catch{}e(t).endpoint_type==="github"?await ce.createGithubEndpoint(a):await ce.createGiteaEndpoint(a),ke.success("Endpoint Created",`Endpoint ${e(t).name} has been created successfully.`),U()}catch(a){s(Ce,qe(a))}}async function yt(){if(e(h))try{const a=ft();if(Object.keys(a).length===0){ke.info("No Changes","No fields were modified."),U();return}e(h).endpoint_type==="github"?await ce.updateGithubEndpoint(e(h).name,a):await ce.updateGiteaEndpoint(e(h).name,a),ke.success("Endpoint Updated",`Endpoint ${e(h).name} has been updated successfully.`),U()}catch(a){s(Ce,qe(a))}}async function xt(){if(e(D)){try{e(D).endpoint_type==="github"?await ce.deleteGithubEndpoint(e(D).name):await ce.deleteGiteaEndpoint(e(D).name),ke.success("Endpoint Deleted",`Endpoint ${e(D).name} has been deleted successfully.`)}catch(a){const n=qe(a);ke.error("Delete Failed",n)}U()}}function Se(a){const f=a.target.files?.[0];if(!f){b(t,e(t).ca_cert_bundle=""),s(B,"");return}s(B,f.name);const L=new FileReader;L.onload=d=>{const w=d.target?.result;b(t,e(t).ca_cert_bundle=btoa(w))},L.readAsText(f)}function Ve(){b(t,e(t).ca_cert_bundle=""),s(B,"");const a=document.getElementById("ca_cert_file");a&&(a.value="");const n=document.getElementById("edit_ca_cert_file");n&&(n.value="")}ae(()=>(e(le),X()),()=>{(!e(le).length||X().loaded.endpoints)&&s(le,X().endpoints)}),ae(()=>X(),()=>{s(we,X().loading.endpoints)}),ae(()=>X(),()=>{s(Ae,X().errorMessages.endpoints)}),ae(()=>(e(le),e(Ee)),()=>{s(Y,Nt(e(le),e(Ee)))}),ae(()=>(e(ie),e(Y),e(se),e(q)),()=>{s(ie,Math.ceil(e(Y).length/e(se))),e(q)>e(ie)&&e(ie)>0&&s(q,e(ie))}),ae(()=>(e(Y),e(q),e(se)),()=>{s(He,Ht(e(Y),e(q),e(se)))}),ae(()=>e(t),()=>{s(pe,!(!e(t).name||!e(t).base_url||e(t).endpoint_type==="github"&&!e(t).api_base_url))}),Tt(),Lt();var Oe=la();_("keydown",At,mt),Ut(a=>{Bt.title="Endpoints - GARM"});var Ge=xe(Oe),We=o(Ge);jt(We,{title:"Endpoints",description:"Manage your GitHub and Gitea endpoints for runner management.",actionLabel:"Add Endpoint",$$events:{action:_t}});var ht=r(We,2);{let a=Fe(()=>e(Ae)||e(Ce)),n=Fe(()=>!!e(Ae));St(ht,{get columns(){return it},get data(){return e(He)},get loading(){return e(we)},get error(){return e(a)},get searchTerm(){return e(Ee)},searchPlaceholder:"Search endpoints by name, description, or URL...",get currentPage(){return e(q)},get perPage(){return e(se)},get totalPages(){return e(ie)},get totalItems(){return e(Y),y(()=>e(Y).length)},itemName:"endpoints",emptyIconType:"settings",get showRetry(){return e(n)},get mobileCardConfig(){return nt},$$events:{search:dt,pageChange:ut,perPageChange:ct,retry:st,edit:pt,delete:bt},$$slots:{"mobile-card":(f,L)=>{const d=Fe(()=>L.item);var w=Wt(),M=o(w),G=o(M),I=o(G),$=o(I,!0);l(I);var C=r(I,2),N=o(C,!0);l(C);var j=r(C,2),H=o(j);Gt(H,()=>(he(ze),he(e(d)),y(()=>ze(e(d).endpoint_type||"","w-5 h-5"))));var S=r(H,2),ne=o(S,!0);l(S),l(j),l(G),l(M);var Z=r(M,2),W=o(Z);et(W,{action:"edit",size:"sm",title:"Edit endpoint",ariaLabel:"Edit endpoint",$$events:{click:()=>Be(e(d))}});var ee=r(W,2);et(ee,{action:"delete",size:"sm",title:"Delete endpoint",ariaLabel:"Delete endpoint",$$events:{click:()=>Ie(e(d))}}),l(Z),l(w),Q(()=>{V($,(he(e(d)),y(()=>e(d).name))),V(N,(he(e(d)),y(()=>e(d).description))),V(ne,(he(e(d)),y(()=>e(d).endpoint_type)))}),P(f,w)}}})}l(Ge);var Ke=r(Ge,2);{var kt=a=>{var n=Yt(),f=o(n),L=r(f,2),d=o(L),w=r(o(d),2);l(d);var M=r(d,2),G=o(M);Ft(G,{get selectedForgeType(){return e(O)},set selectedForgeType(u){s(O,u)},$$events:{select:gt},$$legacy:!0});var I=r(G,2),$=r(o(I),2);E($),l(I);var C=r(I,2),N=r(o(C),2);Qe(N),l(C);var j=r(C,2),H=r(o(j),2);E(H),l(j);var S=r(j,2);{var ne=u=>{var x=Kt(),i=xe(x),p=r(o(i),2);E(p),l(i);var c=r(i,2),g=r(o(c),2);E(g),l(c),R(p,()=>e(t).api_base_url,v=>b(t,e(t).api_base_url=v)),R(g,()=>e(t).upload_base_url,v=>b(t,e(t).upload_base_url=v)),P(u,x)},Z=u=>{var x=Jt(),i=xe(x),p=r(o(i),2);E(p),re(2),l(i);var c=r(i,2),g=o(c),v=o(g),A=r(v,2),F=o(A);$e(F,{title:"Tools Metadata URL",content:"URL where GARM checks for act_runner binary downloads and release information. Defaults to https://gitea.com/api/v1/repos/gitea/act_runner/releases if not specified. Use a custom URL to point to your own tools repository or mirror.",position:"top",width:"w-80"}),l(A),l(g);var K=r(g,2);E(K);var ge=r(K,2),te=o(ge,!0);l(ge),l(c);var ue=r(c,2),me=o(ue);E(me);var fe=r(me,4),ve=o(fe);$e(ve,{title:"Internal Tools Metadata",content:"When enabled, GARM uses built-in URLs for nightly act_runner binaries instead of calling the external tools metadata URL. This is useful in air-gapped environments where runner images already include the binaries and don't need to download them.",position:"top",width:"w-80"}),l(fe),l(ue),Q(()=>{z(v,1,`block text-sm font-medium ${e(t),y(()=>e(t).use_internal_tools_metadata?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300")??""}`),K.disabled=(e(t),y(()=>e(t).use_internal_tools_metadata)),z(K,1,`w-full px-3 py-2 border rounded-md focus:outline-none transition-colors ${e(t),y(()=>e(t).use_internal_tools_metadata?"bg-gray-100 dark:bg-gray-800 border-gray-300 dark:border-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed":"border-gray-300 dark:border-gray-600 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white")??""}`),z(ge,1,`text-xs ${e(t),y(()=>e(t).use_internal_tools_metadata?"text-gray-400 dark:text-gray-500":"text-gray-500 dark:text-gray-400")??""} mt-1`),V(te,(e(t),y(()=>e(t).use_internal_tools_metadata?"Disabled when using internal tools metadata":"Leave empty to use default Gitea releases URL")))}),R(p,()=>e(t).api_base_url,J=>b(t,e(t).api_base_url=J)),R(K,()=>e(t).tools_metadata_url,J=>b(t,e(t).tools_metadata_url=J)),Ye(me,()=>e(t).use_internal_tools_metadata,J=>b(t,e(t).use_internal_tools_metadata=J)),P(u,x)};oe(S,u=>{e(O)==="github"?u(ne):u(Z,!1)})}var W=r(S,2),ee=r(o(W),2),de=o(ee),be=r(de,2);{var Me=u=>{var x=Qt(),i=r(o(x),2),p=o(i,!0);l(i);var c=r(i,2),g=o(c),v=r(g,4);l(c),l(x),Q(()=>V(p,e(B))),_("click",g,()=>document.getElementById("ca_cert_file")?.click()),_("click",v,Ve),P(u,x)},je=u=>{var x=Xt(),i=r(o(x),2),p=o(i);re(),l(i),re(2),l(x),_("click",p,()=>document.getElementById("ca_cert_file")?.click()),P(u,x)};oe(be,u=>{e(B)?u(Me):u(je,!1)})}l(ee),l(W);var Pe=r(W,2),Te=o(Pe),_e=r(Te,2);l(Pe),l(M),l(L),l(n),Q(()=>{Xe($,"placeholder",e(O)==="github"?"e.g., github-enterprise or github-com":"e.g., gitea-main or my-gitea"),Xe(H,"placeholder",e(O)==="github"?"https://github.com or https://github.example.com":"https://gitea.example.com"),z(ee,1,`border-2 border-dashed rounded-lg p-4 text-center transition-colors ${e(B)?"border-green-500 dark:border-green-400 bg-green-50 dark:bg-green-900/20":"border-gray-300 dark:border-gray-600 hover:border-blue-400 dark:hover:border-blue-400"}`),_e.disabled=!e(pe),z(_e,1,`px-4 py-2 text-sm font-medium text-white rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors ${e(pe)?"bg-blue-600 hover:bg-blue-700 focus:ring-blue-500 cursor-pointer":"bg-gray-400 cursor-not-allowed"}`)}),_("click",f,U),_("click",w,U),R($,()=>e(t).name,u=>b(t,e(t).name=u)),R(N,()=>e(t).description,u=>b(t,e(t).description=u)),R(H,()=>e(t).base_url,u=>b(t,e(t).base_url=u)),_("change",de,Se),_("click",Te,U),_("submit",M,Ze(vt)),P(a,n)};oe(Ke,a=>{e(Re)&&a(kt)})}var Je=r(Ke,2);{var wt=a=>{var n=ra(),f=o(n),L=r(f,2),d=o(L),w=o(d),M=o(w),G=o(M);l(M),re(2),l(w);var I=r(w,2);l(d);var $=r(d,2),C=o($),N=r(o(C),2);E(N),l(C);var j=r(C,2),H=r(o(j),2);Qe(H),l(j);var S=r(j,2),ne=r(o(S),2);E(ne),l(S);var Z=r(S,2);{var W=i=>{var p=Zt(),c=xe(p),g=r(o(c),2);E(g),l(c);var v=r(c,2),A=r(o(v),2);E(A),l(v),R(g,()=>e(t).api_base_url,F=>b(t,e(t).api_base_url=F)),R(A,()=>e(t).upload_base_url,F=>b(t,e(t).upload_base_url=F)),P(i,p)},ee=i=>{var p=ea(),c=xe(p),g=r(o(c),2);E(g),re(2),l(c);var v=r(c,2),A=o(v),F=o(A),K=r(F,2),ge=o(K);$e(ge,{title:"Tools Metadata URL",content:"URL where GARM checks for act_runner binary downloads and release information. Defaults to https://gitea.com/api/v1/repos/gitea/act_runner/releases if not specified. Use a custom URL to point to your own tools repository or mirror.",position:"top",width:"w-80"}),l(K),l(A);var te=r(A,2);E(te);var ue=r(te,2),me=o(ue,!0);l(ue),l(v);var fe=r(v,2),ve=o(fe);E(ve);var J=r(ve,4),Rt=o(J);$e(Rt,{title:"Internal Tools Metadata",content:"When enabled, GARM uses built-in URLs for nightly act_runner binaries instead of calling the external tools metadata URL. This is useful in air-gapped environments where runner images already include the binaries and don't need to download them.",position:"top",width:"w-80"}),l(J),l(fe),Q(()=>{z(F,1,`block text-sm font-medium ${e(t),y(()=>e(t).use_internal_tools_metadata?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300")??""}`),te.disabled=(e(t),y(()=>e(t).use_internal_tools_metadata)),z(te,1,`w-full px-3 py-2 border rounded-md focus:outline-none transition-colors ${e(t),y(()=>e(t).use_internal_tools_metadata?"bg-gray-100 dark:bg-gray-800 border-gray-300 dark:border-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed":"border-gray-300 dark:border-gray-600 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white")??""}`),z(ue,1,`text-xs ${e(t),y(()=>e(t).use_internal_tools_metadata?"text-gray-400 dark:text-gray-500":"text-gray-500 dark:text-gray-400")??""} mt-1`),V(me,(e(t),y(()=>e(t).use_internal_tools_metadata?"Disabled when using internal tools metadata":"Leave empty to use default Gitea releases URL")))}),R(g,()=>e(t).api_base_url,ye=>b(t,e(t).api_base_url=ye)),R(te,()=>e(t).tools_metadata_url,ye=>b(t,e(t).tools_metadata_url=ye)),Ye(ve,()=>e(t).use_internal_tools_metadata,ye=>b(t,e(t).use_internal_tools_metadata=ye)),P(i,p)};oe(Z,i=>{e(h),y(()=>e(h).endpoint_type==="github")?i(W):i(ee,!1)})}var de=r(Z,2),be=r(o(de),2),Me=o(be),je=r(Me,2);{var Pe=i=>{var p=ta(),c=r(o(p),2),g=o(c,!0);l(c);var v=r(c,2),A=o(v),F=r(A,4);l(v),l(p),Q(()=>V(g,e(B))),_("click",A,()=>document.getElementById("edit_ca_cert_file")?.click()),_("click",F,Ve),P(i,p)},Te=i=>{var p=aa(),c=r(o(p),2),g=o(c);re(),l(c),re(2),l(p),_("click",g,()=>document.getElementById("edit_ca_cert_file")?.click()),P(i,p)};oe(je,i=>{e(B)?i(Pe):i(Te,!1)})}l(be),l(de);var _e=r(de,2),u=o(_e),x=r(u,2);l(_e),l($),l(L),l(n),Q(()=>{V(G,`Edit ${e(h),y(()=>e(h).endpoint_type==="github"?"GitHub":"Gitea")??""} Endpoint`),z(be,1,`border-2 border-dashed rounded-lg p-4 text-center transition-colors ${e(B)?"border-green-500 dark:border-green-400 bg-green-50 dark:bg-green-900/20":"border-gray-300 dark:border-gray-600 hover:border-blue-400 dark:hover:border-blue-400"}`),x.disabled=!e(pe),z(x,1,`px-4 py-2 text-sm font-medium text-white rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors ${e(pe)?"bg-blue-600 hover:bg-blue-700 focus:ring-blue-500 cursor-pointer":"bg-gray-400 cursor-not-allowed"}`)}),_("click",f,U),_("click",I,U),R(N,()=>e(t).name,i=>b(t,e(t).name=i)),R(H,()=>e(t).description,i=>b(t,e(t).description=i)),R(ne,()=>e(t).base_url,i=>b(t,e(t).base_url=i)),_("change",Me,Se),_("click",u,U),_("submit",$,Ze(yt)),P(a,n)};oe(Je,a=>{e(Ue)&&e(h)&&a(wt)})}var Ct=r(Je,2);{var Et=a=>{var n=oa(),f=o(n),L=r(f,2),d=o(L),w=o(d),M=r(o(w),2),G=r(o(M),2),I=o(G);l(G),l(M),l(w),l(d);var $=r(d,2),C=o($),N=r(C,2);l($),l(L),l(n),Q(()=>V(I,`Are you sure you want to delete the endpoint "${e(D),y(()=>e(D).name)??""}"? This action cannot be undone.`)),_("click",f,U),_("click",C,U),_("click",N,xt),P(a,n)};oe(Ct,a=>{e(Le)&&e(D)&&a(Et)})}P(at,Oe),$t(),lt()}export{Ea as component}; diff --git a/webapp/assets/_app/immutable/nodes/5.D-IgI9y1.js b/webapp/assets/_app/immutable/nodes/5.g7cRDIWD.js similarity index 94% rename from webapp/assets/_app/immutable/nodes/5.D-IgI9y1.js rename to webapp/assets/_app/immutable/nodes/5.g7cRDIWD.js index 54c1e67b..47e4546a 100644 --- a/webapp/assets/_app/immutable/nodes/5.D-IgI9y1.js +++ b/webapp/assets/_app/immutable/nodes/5.g7cRDIWD.js @@ -1 +1 @@ -import{f as M,a as C,s as X,e as Ce,c as We,h as Ve}from"../chunks/ZGz3X54u.js";import{i as Se}from"../chunks/CY7Wcm-1.js";import{p as Re,v as Ye,o as Be,l as w,d as r,m as l,g as e,b as He,s as o,c as n,r as i,t as z,k as Pe,u as b,n as Me,j as Q,a as Ue,f as Le,$ as Ke,h as A,i as re}from"../chunks/kDtaAWAK.js";import{a as Ne,i as B,s as ze}from"../chunks/Cun6jNAp.js";import{r as be,b as De,d as Te,c as Oe,g as he}from"../chunks/Cvcp5xHB.js";import{P as Qe}from"../chunks/CLZesvzF.js";import{e as Xe,i as Ze}from"../chunks/DdT9Vz5Q.js";import{b as Ae,a as et}from"../chunks/CYnNqrHp.js";import{p as tt}from"../chunks/CdEA5IGF.js";import{M as rt}from"../chunks/C6jYEeWP.js";import{e as se}from"../chunks/BZiHL9L3.js";import{e as je,a as xe}from"../chunks/C2c_wqo6.js";import{U as at}from"../chunks/io-Ugua7.js";import{D as st}from"../chunks/lQWw1Z23.js";import{t as ae}from"../chunks/BVGCMSWJ.js";import{k as ye,l as ot}from"../chunks/DNHT2U_W.js";import{B as nt}from"../chunks/DovBLKjH.js";import{D as it,G as lt}from"../chunks/Cfdue6T6.js";import{A as Ge}from"../chunks/uzzFhb3G.js";import{E as dt}from"../chunks/CEJvqnOn.js";import{E as ct}from"../chunks/C-3AL0iB.js";import{S as ut}from"../chunks/BTeTCgJA.js";import{A as pt}from"../chunks/Cs0pYghy.js";var mt=M('

'),gt=M('

Loading...

'),ft=M(""),vt=M('

Loading credentials...

'),bt=M('

No GitHub credentials found. Please create GitHub credentials first.

'),ht=M(`

You'll need to manually configure this secret in GitHub's enterprise webhook settings.

`),yt=M('

Create Enterprise

Enterprises are only available for GitHub endpoints.

');function xt(oe,ne){Re(ne,!1);const[ie,le]=ze(),p=()=>Ne(je,"$eagerCache",ie),G=l(),y=l(),m=l(),H=l(),E=Ye();let _=l(!1),h=l(""),a=l({name:"",credentials_name:"",webhook_secret:"",pool_balancer_type:"roundrobin",agent_mode:!1});async function x(){if(!p().loaded.credentials&&!p().loading.credentials)try{await xe.getCredentials()}catch(g){r(h,se(g))}}async function P(){if(!e(a).name||!e(a).name.trim()){r(h,"Enterprise name is required");return}if(!e(a).credentials_name){r(h,"Please select credentials");return}try{r(_,!0),r(h,"");const g={...e(a)};E("submit",g)}catch(g){r(h,se(g)),r(_,!1)}}Be(()=>{x()}),w(()=>p(),()=>{r(G,p().credentials)}),w(()=>p(),()=>{r(y,p().loading.credentials)}),w(()=>e(G),()=>{r(m,e(G).filter(g=>g.forge_type==="github"))}),w(()=>e(a),()=>{r(H,e(a).name&&e(a).name.trim()!==""&&e(a).credentials_name!==""&&e(a).webhook_secret&&e(a).webhook_secret.trim()!=="")}),He(),Se(),rt(oe,{$$events:{close:()=>E("close")},children:(g,j)=>{var D=yt(),d=o(n(D),4);{var de=f=>{var v=mt(),T=n(v),U=n(T,!0);i(T),i(v),z(()=>X(U,e(h))),C(f,v)};B(d,f=>{e(h)&&f(de)})}var ce=o(d,2);{var ue=f=>{var v=gt();C(f,v)},pe=f=>{var v=ht(),T=n(v),U=o(n(T),2);be(U),i(T);var q=o(T,2),L=o(n(q),2);z(()=>{e(a),Pe(()=>{e(m)})});var F=n(L);F.value=F.__value="";var me=o(F);Xe(me,1,()=>e(m),Ze,(s,c)=>{var k=ft(),R=n(k);i(k);var $={};z(()=>{X(R,`${e(c),b(()=>e(c).name)??""} (${e(c),b(()=>e(c).endpoint?.name||"Unknown endpoint")??""})`),$!==($=(e(c),b(()=>e(c).name)))&&(k.value=(k.__value=(e(c),b(()=>e(c).name)))??"")}),C(s,k)}),i(L);var ge=o(L,2);{var fe=s=>{var c=vt();C(s,c)},Z=s=>{var c=We(),k=Le(c);{var R=$=>{var O=bt();C($,O)};B(k,$=>{e(m),b(()=>e(m).length===0)&&$(R)},!0)}C(s,c)};B(ge,s=>{e(y)?s(fe):s(Z,!1)})}i(q);var S=o(q,2),N=o(n(S),2);z(()=>{e(a),Pe(()=>{})});var I=n(N);I.value=I.__value="roundrobin";var J=o(I);J.value=J.__value="pack",i(N),i(S);var W=o(S,2),V=n(W),ee=n(V);be(ee),Me(4),i(V),i(W);var Y=o(W,2),te=o(n(Y),2);be(te),Me(2),i(Y);var t=o(Y,2),u=n(t),K=o(u,2),ve=n(K,!0);i(K),i(t),i(v),z(()=>{K.disabled=(e(_),e(y),e(H),e(m),b(()=>e(_)||e(y)||!e(H)||e(m).length===0)),X(ve,e(_)?"Creating...":"Create Enterprise")}),Ae(U,()=>e(a).name,s=>Q(a,e(a).name=s)),De(L,()=>e(a).credentials_name,s=>Q(a,e(a).credentials_name=s)),De(N,()=>e(a).pool_balancer_type,s=>Q(a,e(a).pool_balancer_type=s)),et(ee,()=>e(a).agent_mode,s=>Q(a,e(a).agent_mode=s)),Ae(te,()=>e(a).webhook_secret,s=>Q(a,e(a).webhook_secret=s)),Ce("click",u,()=>E("close")),Ce("submit",v,tt(P)),C(f,v)};B(ce,f=>{e(_)?f(ue):f(pe,!1)})}i(D),C(g,D)},$$slots:{default:!0}}),Ue(),le()}var _t=M(''),kt=M('
',1);function Wt(oe,ne){Re(ne,!1);const[ie,le]=ze(),p=()=>Ne(je,"$eagerCache",ie),G=l(),y=l(),m=l(),H=l();let E=l([]),_=l(!0),h=l(""),a=l(""),x=l(1),P=l(25),g=l(!1),j=l(!1),D=l(!1),d=l(null);async function de(t){try{r(h,""),await he.createEnterprise(t),ae.success("Enterprise Created",`Enterprise ${t.name} has been created successfully.`),r(g,!1)}catch(u){throw r(h,se(u)),u}}async function ce(t){if(e(d))try{await he.updateEnterprise(e(d).id,t),ae.success("Enterprise Updated",`Enterprise ${e(d).name} has been updated successfully.`),r(j,!1),r(d,null)}catch(u){throw u}}async function ue(){if(e(d))try{r(h,""),await he.deleteEnterprise(e(d).id),ae.success("Enterprise Deleted",`Enterprise ${e(d).name} has been deleted successfully.`),r(D,!1),r(d,null)}catch(t){const u=se(t);ae.error("Delete Failed",u)}}function pe(){r(g,!0)}function f(t){r(d,t),r(j,!0)}function v(t){r(d,t),r(D,!0)}Be(async()=>{try{r(_,!0);const t=await xe.getEnterprises();t&&Array.isArray(t)&&r(E,t)}catch(t){console.error("Failed to load enterprises:",t),r(h,t instanceof Error?t.message:"Failed to load enterprises")}finally{r(_,!1)}});async function T(){try{await xe.retryResource("enterprises")}catch(t){console.error("Retry failed:",t)}}const U=[{key:"name",title:"Name",cellComponent:dt,cellProps:{entityType:"enterprise"}},{key:"endpoint",title:"Endpoint",cellComponent:ct},{key:"credentials",title:"Credentials",cellComponent:lt,cellProps:{field:"credentials_name"}},{key:"status",title:"Status",cellComponent:ut,cellProps:{statusType:"entity"}},{key:"actions",title:"Actions",align:"right",cellComponent:pt}],q={entityType:"enterprise",primaryText:{field:"name",isClickable:!0,href:"/enterprises/{id}"},secondaryText:{field:"credentials_name"},badges:[{type:"custom",value:t=>ye(t)}],actions:[{type:"edit",handler:t=>f(t)},{type:"delete",handler:t=>v(t)}]};function L(t){r(a,t.detail.term),r(x,1)}function F(t){r(x,t.detail.page)}function me(t){r(P,t.detail.perPage),r(x,1)}function ge(t){f(t.detail.item)}function fe(t){v(t.detail.item)}w(()=>(e(E),p()),()=>{(!e(E).length||p().loaded.enterprises)&&r(E,p().enterprises)}),w(()=>p(),()=>{r(_,p().loading.enterprises)}),w(()=>p(),()=>{r(G,p().errorMessages.enterprises)}),w(()=>(e(E),e(a)),()=>{r(y,ot(e(E),e(a)))}),w(()=>(e(y),e(P)),()=>{r(m,Math.ceil(e(y).length/e(P)))}),w(()=>(e(x),e(m)),()=>{e(x)>e(m)&&e(m)>0&&r(x,e(m))}),w(()=>(e(y),e(x),e(P)),()=>{r(H,e(y).slice((e(x)-1)*e(P),e(x)*e(P)))}),He(),Se();var Z=kt();Ve(t=>{Ke.title="Enterprises - GARM"});var S=Le(Z),N=n(S);Qe(N,{title:"Enterprises",description:"Manage GitHub enterprises",actionLabel:"Add Enterprise",$$events:{action:pe}});var I=o(N,2);{let t=re(()=>e(G)||e(h)),u=re(()=>!!e(G));it(I,{get columns(){return U},get data(){return e(H)},get loading(){return e(_)},get error(){return e(t)},get searchTerm(){return e(a)},searchPlaceholder:"Search enterprises...",get currentPage(){return e(x)},get perPage(){return e(P)},get totalPages(){return e(m)},get totalItems(){return e(y),b(()=>e(y).length)},itemName:"enterprises",emptyIconType:"building",get showRetry(){return e(u)},get mobileCardConfig(){return q},$$events:{search:L,pageChange:F,perPageChange:me,retry:T,edit:ge,delete:fe},$$slots:{"mobile-card":(K,ve)=>{const s=re(()=>ve.item),c=re(()=>(A(ye),A(e(s)),b(()=>ye(e(s)))));var k=_t(),R=n(k),$=n(R),O=n($),qe=n(O,!0);i(O);var _e=o(O,2),Fe=n(_e,!0);i(_e),i($),i(R);var ke=o(R,2),we=n(ke);nt(we,{get variant(){return A(e(c)),b(()=>e(c).variant)},get text(){return A(e(c)),b(()=>e(c).text)}});var Ee=o(we,2),$e=n(Ee);Ge($e,{action:"edit",size:"sm",title:"Edit enterprise",ariaLabel:"Edit enterprise",$$events:{click:()=>f(e(s))}});var Ie=o($e,2);Ge(Ie,{action:"delete",size:"sm",title:"Delete enterprise",ariaLabel:"Delete enterprise",$$events:{click:()=>v(e(s))}}),i(Ee),i(ke),i(k),z(Je=>{Oe($,"href",Je),X(qe,(A(e(s)),b(()=>e(s).name))),X(Fe,(A(e(s)),b(()=>e(s).credentials_name)))},[()=>(A(Te),A(e(s)),b(()=>Te(`/enterprises/${e(s).id}`)))]),C(K,k)}}})}i(S);var J=o(S,2);{var W=t=>{xt(t,{$$events:{close:()=>r(g,!1),submit:u=>de(u.detail)}})};B(J,t=>{e(g)&&t(W)})}var V=o(J,2);{var ee=t=>{at(t,{get entity(){return e(d)},entityType:"enterprise",$$events:{close:()=>{r(j,!1),r(d,null)},submit:u=>ce(u.detail)}})};B(V,t=>{e(j)&&e(d)&&t(ee)})}var Y=o(V,2);{var te=t=>{st(t,{title:"Delete Enterprise",message:"Are you sure you want to delete this enterprise? This action cannot be undone.",get itemName(){return e(d),b(()=>e(d).name)},$$events:{close:()=>{r(D,!1),r(d,null)},confirm:ue}})};B(Y,t=>{e(D)&&e(d)&&t(te)})}C(oe,Z),Ue(),le()}export{Wt as component}; +import{f as M,a as C,s as X,e as Ce,c as We,h as Ve}from"../chunks/ZGz3X54u.js";import{i as Se}from"../chunks/CY7Wcm-1.js";import{p as Re,v as Ye,o as Be,l as w,d as r,m as l,g as e,b as He,s as o,c as n,r as i,t as z,k as Pe,u as b,n as Me,j as Q,a as Ue,f as Le,$ as Ke,h as A,i as re}from"../chunks/kDtaAWAK.js";import{a as Ne,i as B,s as ze}from"../chunks/Cun6jNAp.js";import{r as be,b as De,d as Te,c as Oe,g as he}from"../chunks/CYK-UalN.js";import{P as Qe}from"../chunks/DacI6VAP.js";import{e as Xe,i as Ze}from"../chunks/DdT9Vz5Q.js";import{b as Ae,a as et}from"../chunks/CYnNqrHp.js";import{p as tt}from"../chunks/CdEA5IGF.js";import{M as rt}from"../chunks/CVBpH3Sf.js";import{e as se}from"../chunks/BZiHL9L3.js";import{e as je,a as xe}from"../chunks/Vo3Mv3dp.js";import{U as at}from"../chunks/6aKjRj0k.js";import{D as st}from"../chunks/Dxx83T0m.js";import{t as ae}from"../chunks/BVGCMSWJ.js";import{k as ye,l as ot}from"../chunks/ZelbukuJ.js";import{B as nt}from"../chunks/DbE0zTOa.js";import{D as it,G as lt}from"../chunks/BKeluGSY.js";import{A as Ge}from"../chunks/DUWZCTMr.js";import{E as dt}from"../chunks/Dd4NFVf9.js";import{E as ct}from"../chunks/oWoYyEl8.js";import{S as ut}from"../chunks/BStwtkX8.js";import{A as pt}from"../chunks/rb89c4PS.js";var mt=M('

'),gt=M('

Loading...

'),ft=M(""),vt=M('

Loading credentials...

'),bt=M('

No GitHub credentials found. Please create GitHub credentials first.

'),ht=M(`

You'll need to manually configure this secret in GitHub's enterprise webhook settings.

`),yt=M('

Create Enterprise

Enterprises are only available for GitHub endpoints.

');function xt(oe,ne){Re(ne,!1);const[ie,le]=ze(),p=()=>Ne(je,"$eagerCache",ie),G=l(),y=l(),m=l(),H=l(),E=Ye();let _=l(!1),h=l(""),a=l({name:"",credentials_name:"",webhook_secret:"",pool_balancer_type:"roundrobin",agent_mode:!1});async function x(){if(!p().loaded.credentials&&!p().loading.credentials)try{await xe.getCredentials()}catch(g){r(h,se(g))}}async function P(){if(!e(a).name||!e(a).name.trim()){r(h,"Enterprise name is required");return}if(!e(a).credentials_name){r(h,"Please select credentials");return}try{r(_,!0),r(h,"");const g={...e(a)};E("submit",g)}catch(g){r(h,se(g)),r(_,!1)}}Be(()=>{x()}),w(()=>p(),()=>{r(G,p().credentials)}),w(()=>p(),()=>{r(y,p().loading.credentials)}),w(()=>e(G),()=>{r(m,e(G).filter(g=>g.forge_type==="github"))}),w(()=>e(a),()=>{r(H,e(a).name&&e(a).name.trim()!==""&&e(a).credentials_name!==""&&e(a).webhook_secret&&e(a).webhook_secret.trim()!=="")}),He(),Se(),rt(oe,{$$events:{close:()=>E("close")},children:(g,j)=>{var D=yt(),d=o(n(D),4);{var de=f=>{var v=mt(),T=n(v),U=n(T,!0);i(T),i(v),z(()=>X(U,e(h))),C(f,v)};B(d,f=>{e(h)&&f(de)})}var ce=o(d,2);{var ue=f=>{var v=gt();C(f,v)},pe=f=>{var v=ht(),T=n(v),U=o(n(T),2);be(U),i(T);var q=o(T,2),L=o(n(q),2);z(()=>{e(a),Pe(()=>{e(m)})});var F=n(L);F.value=F.__value="";var me=o(F);Xe(me,1,()=>e(m),Ze,(s,c)=>{var k=ft(),R=n(k);i(k);var $={};z(()=>{X(R,`${e(c),b(()=>e(c).name)??""} (${e(c),b(()=>e(c).endpoint?.name||"Unknown endpoint")??""})`),$!==($=(e(c),b(()=>e(c).name)))&&(k.value=(k.__value=(e(c),b(()=>e(c).name)))??"")}),C(s,k)}),i(L);var ge=o(L,2);{var fe=s=>{var c=vt();C(s,c)},Z=s=>{var c=We(),k=Le(c);{var R=$=>{var O=bt();C($,O)};B(k,$=>{e(m),b(()=>e(m).length===0)&&$(R)},!0)}C(s,c)};B(ge,s=>{e(y)?s(fe):s(Z,!1)})}i(q);var S=o(q,2),N=o(n(S),2);z(()=>{e(a),Pe(()=>{})});var I=n(N);I.value=I.__value="roundrobin";var J=o(I);J.value=J.__value="pack",i(N),i(S);var W=o(S,2),V=n(W),ee=n(V);be(ee),Me(4),i(V),i(W);var Y=o(W,2),te=o(n(Y),2);be(te),Me(2),i(Y);var t=o(Y,2),u=n(t),K=o(u,2),ve=n(K,!0);i(K),i(t),i(v),z(()=>{K.disabled=(e(_),e(y),e(H),e(m),b(()=>e(_)||e(y)||!e(H)||e(m).length===0)),X(ve,e(_)?"Creating...":"Create Enterprise")}),Ae(U,()=>e(a).name,s=>Q(a,e(a).name=s)),De(L,()=>e(a).credentials_name,s=>Q(a,e(a).credentials_name=s)),De(N,()=>e(a).pool_balancer_type,s=>Q(a,e(a).pool_balancer_type=s)),et(ee,()=>e(a).agent_mode,s=>Q(a,e(a).agent_mode=s)),Ae(te,()=>e(a).webhook_secret,s=>Q(a,e(a).webhook_secret=s)),Ce("click",u,()=>E("close")),Ce("submit",v,tt(P)),C(f,v)};B(ce,f=>{e(_)?f(ue):f(pe,!1)})}i(D),C(g,D)},$$slots:{default:!0}}),Ue(),le()}var _t=M(''),kt=M('
',1);function Wt(oe,ne){Re(ne,!1);const[ie,le]=ze(),p=()=>Ne(je,"$eagerCache",ie),G=l(),y=l(),m=l(),H=l();let E=l([]),_=l(!0),h=l(""),a=l(""),x=l(1),P=l(25),g=l(!1),j=l(!1),D=l(!1),d=l(null);async function de(t){try{r(h,""),await he.createEnterprise(t),ae.success("Enterprise Created",`Enterprise ${t.name} has been created successfully.`),r(g,!1)}catch(u){throw r(h,se(u)),u}}async function ce(t){if(e(d))try{await he.updateEnterprise(e(d).id,t),ae.success("Enterprise Updated",`Enterprise ${e(d).name} has been updated successfully.`),r(j,!1),r(d,null)}catch(u){throw u}}async function ue(){if(e(d))try{r(h,""),await he.deleteEnterprise(e(d).id),ae.success("Enterprise Deleted",`Enterprise ${e(d).name} has been deleted successfully.`),r(D,!1),r(d,null)}catch(t){const u=se(t);ae.error("Delete Failed",u)}}function pe(){r(g,!0)}function f(t){r(d,t),r(j,!0)}function v(t){r(d,t),r(D,!0)}Be(async()=>{try{r(_,!0);const t=await xe.getEnterprises();t&&Array.isArray(t)&&r(E,t)}catch(t){console.error("Failed to load enterprises:",t),r(h,t instanceof Error?t.message:"Failed to load enterprises")}finally{r(_,!1)}});async function T(){try{await xe.retryResource("enterprises")}catch(t){console.error("Retry failed:",t)}}const U=[{key:"name",title:"Name",cellComponent:dt,cellProps:{entityType:"enterprise"}},{key:"endpoint",title:"Endpoint",cellComponent:ct},{key:"credentials",title:"Credentials",cellComponent:lt,cellProps:{field:"credentials_name"}},{key:"status",title:"Status",cellComponent:ut,cellProps:{statusType:"entity"}},{key:"actions",title:"Actions",align:"right",cellComponent:pt}],q={entityType:"enterprise",primaryText:{field:"name",isClickable:!0,href:"/enterprises/{id}"},secondaryText:{field:"credentials_name"},badges:[{type:"custom",value:t=>ye(t)}],actions:[{type:"edit",handler:t=>f(t)},{type:"delete",handler:t=>v(t)}]};function L(t){r(a,t.detail.term),r(x,1)}function F(t){r(x,t.detail.page)}function me(t){r(P,t.detail.perPage),r(x,1)}function ge(t){f(t.detail.item)}function fe(t){v(t.detail.item)}w(()=>(e(E),p()),()=>{(!e(E).length||p().loaded.enterprises)&&r(E,p().enterprises)}),w(()=>p(),()=>{r(_,p().loading.enterprises)}),w(()=>p(),()=>{r(G,p().errorMessages.enterprises)}),w(()=>(e(E),e(a)),()=>{r(y,ot(e(E),e(a)))}),w(()=>(e(y),e(P)),()=>{r(m,Math.ceil(e(y).length/e(P)))}),w(()=>(e(x),e(m)),()=>{e(x)>e(m)&&e(m)>0&&r(x,e(m))}),w(()=>(e(y),e(x),e(P)),()=>{r(H,e(y).slice((e(x)-1)*e(P),e(x)*e(P)))}),He(),Se();var Z=kt();Ve(t=>{Ke.title="Enterprises - GARM"});var S=Le(Z),N=n(S);Qe(N,{title:"Enterprises",description:"Manage GitHub enterprises",actionLabel:"Add Enterprise",$$events:{action:pe}});var I=o(N,2);{let t=re(()=>e(G)||e(h)),u=re(()=>!!e(G));it(I,{get columns(){return U},get data(){return e(H)},get loading(){return e(_)},get error(){return e(t)},get searchTerm(){return e(a)},searchPlaceholder:"Search enterprises...",get currentPage(){return e(x)},get perPage(){return e(P)},get totalPages(){return e(m)},get totalItems(){return e(y),b(()=>e(y).length)},itemName:"enterprises",emptyIconType:"building",get showRetry(){return e(u)},get mobileCardConfig(){return q},$$events:{search:L,pageChange:F,perPageChange:me,retry:T,edit:ge,delete:fe},$$slots:{"mobile-card":(K,ve)=>{const s=re(()=>ve.item),c=re(()=>(A(ye),A(e(s)),b(()=>ye(e(s)))));var k=_t(),R=n(k),$=n(R),O=n($),qe=n(O,!0);i(O);var _e=o(O,2),Fe=n(_e,!0);i(_e),i($),i(R);var ke=o(R,2),we=n(ke);nt(we,{get variant(){return A(e(c)),b(()=>e(c).variant)},get text(){return A(e(c)),b(()=>e(c).text)}});var Ee=o(we,2),$e=n(Ee);Ge($e,{action:"edit",size:"sm",title:"Edit enterprise",ariaLabel:"Edit enterprise",$$events:{click:()=>f(e(s))}});var Ie=o($e,2);Ge(Ie,{action:"delete",size:"sm",title:"Delete enterprise",ariaLabel:"Delete enterprise",$$events:{click:()=>v(e(s))}}),i(Ee),i(ke),i(k),z(Je=>{Oe($,"href",Je),X(qe,(A(e(s)),b(()=>e(s).name))),X(Fe,(A(e(s)),b(()=>e(s).credentials_name)))},[()=>(A(Te),A(e(s)),b(()=>Te(`/enterprises/${e(s).id}`)))]),C(K,k)}}})}i(S);var J=o(S,2);{var W=t=>{xt(t,{$$events:{close:()=>r(g,!1),submit:u=>de(u.detail)}})};B(J,t=>{e(g)&&t(W)})}var V=o(J,2);{var ee=t=>{at(t,{get entity(){return e(d)},entityType:"enterprise",$$events:{close:()=>{r(j,!1),r(d,null)},submit:u=>ce(u.detail)}})};B(V,t=>{e(j)&&e(d)&&t(ee)})}var Y=o(V,2);{var te=t=>{st(t,{title:"Delete Enterprise",message:"Are you sure you want to delete this enterprise? This action cannot be undone.",get itemName(){return e(d),b(()=>e(d).name)},$$events:{close:()=>{r(D,!1),r(d,null)},confirm:ue}})};B(Y,t=>{e(D)&&e(d)&&t(te)})}C(oe,Z),Ue(),le()}export{Wt as component}; diff --git a/webapp/assets/_app/immutable/nodes/6.DzEKB4QD.js b/webapp/assets/_app/immutable/nodes/6.C_k9lHXG.js similarity index 94% rename from webapp/assets/_app/immutable/nodes/6.DzEKB4QD.js rename to webapp/assets/_app/immutable/nodes/6.C_k9lHXG.js index 4b7f281c..e49fdf57 100644 --- a/webapp/assets/_app/immutable/nodes/6.DzEKB4QD.js +++ b/webapp/assets/_app/immutable/nodes/6.C_k9lHXG.js @@ -1 +1 @@ -import{f as U,h as qe,a as E,s as le,c as de}from"../chunks/ZGz3X54u.js";import{i as ze}from"../chunks/CY7Wcm-1.js";import{p as Ge,o as je,q as Re,l as Ve,b as We,f as F,t as j,a as Je,u as i,h as ce,g as e,m as l,c as u,s as d,d as s,$ as Ke,r as f,j as Oe,i as v}from"../chunks/kDtaAWAK.js";import{i as g,s as Qe,a as Xe}from"../chunks/Cun6jNAp.js";import{d as S,c as Ye,g as y}from"../chunks/Cvcp5xHB.js";import{p as Ze}from"../chunks/D3FdGlax.js";import{g as pe}from"../chunks/BU_V7FOQ.js";import{U as et}from"../chunks/io-Ugua7.js";import{D as ue}from"../chunks/lQWw1Z23.js";import{E as tt,P as rt,a as at}from"../chunks/DOA3alhD.js";import{D as st}from"../chunks/CRSOHHg7.js";import{I as nt}from"../chunks/vYI-AT_7.js";import{g as fe}from"../chunks/DNHT2U_W.js";import{w as R}from"../chunks/KU08Mex1.js";import{t as x}from"../chunks/BVGCMSWJ.js";import{C as ot}from"../chunks/B87zT258.js";import{e as V}from"../chunks/BZiHL9L3.js";var it=U('

Loading enterprise...

'),lt=U('

'),dt=U(" ",1),ct=U(' ',1);function Tt(me,ve){Ge(ve,!1);const[ge,ye]=Qe(),W=()=>Xe(Ze,"$page",ge),$=l();let r=l(null),c=l([]),m=l([]),B=l(!0),P=l(""),T=l(!1),M=l(!1),I=l(!1),C=l(!1),p=l(null),k=null,h=l();async function J(){if(e($))try{s(B,!0),s(P,"");const[t,a,n]=await Promise.all([y.getEnterprise(e($)),y.listEnterprisePools(e($)).catch(()=>[]),y.listEnterpriseInstances(e($)).catch(()=>[])]);s(r,t),s(c,a),s(m,n)}catch(t){s(P,t instanceof Error?t.message:"Failed to load enterprise")}finally{s(B,!1)}}function he(t,a){const{events:n}=t;return{...a,events:n}}async function _e(t){if(e(r))try{await y.updateEnterprise(e(r).id,t),await J(),x.success("Enterprise Updated",`Enterprise ${e(r).name} has been updated successfully.`),s(T,!1)}catch(a){throw a}}async function be(){if(e(r)){try{await y.deleteEnterprise(e(r).id),pe(S("/enterprises"))}catch(t){const a=V(t);x.error("Delete Failed",a)}s(M,!1)}}async function Ee(){if(e(p))try{await y.deleteInstance(e(p).name),x.success("Instance Deleted",`Instance ${e(p).name} has been deleted successfully.`),s(I,!1),s(p,null)}catch(t){const a=V(t);x.error("Delete Failed",a),s(I,!1),s(p,null)}}function xe(t){s(p,t),s(I,!0)}function $e(){s(C,!0)}async function Ie(t){try{if(!e(r))return;await y.createEnterprisePool(e(r).id,t.detail),x.success("Pool Created",`Pool has been created successfully for enterprise ${e(r).name}.`),s(C,!1)}catch(a){const n=V(a);x.error("Pool Creation Failed",n)}}function K(){e(h)&&Oe(h,e(h).scrollTop=e(h).scrollHeight)}function we(t){if(t.operation==="update"){const a=t.payload;if(e(r)&&a.id===e(r).id){const n=e(r).events?.length||0,o=a.events?.length||0;s(r,he(e(r),a)),o>n&&setTimeout(()=>{K()},100)}}else if(t.operation==="delete"){const a=t.payload.id||t.payload;e(r)&&e(r).id===a&&pe(S("/enterprises"))}}function De(t){if(!e(r))return;const a=t.payload;if(a.enterprise_id===e(r).id){if(t.operation==="create")s(c,[...e(c),a]);else if(t.operation==="update")s(c,e(c).map(n=>n.id===a.id?a:n));else if(t.operation==="delete"){const n=a.id||a;s(c,e(c).filter(o=>o.id!==n))}}}function Pe(t){if(!e(r)||!e(c))return;const a=t.payload;if(e(c).some(o=>o.id===a.pool_id)){if(t.operation==="create")s(m,[...e(m),a]);else if(t.operation==="update")s(m,e(m).map(o=>o.id===a.id?a:o));else if(t.operation==="delete"){const o=a.id||a;s(m,e(m).filter(q=>q.id!==o))}}}je(()=>{J().then(()=>{e(r)?.events?.length&&setTimeout(()=>{K()},100)});const t=R.subscribeToEntity("enterprise",["update","delete"],we),a=R.subscribeToEntity("pool",["create","update","delete"],De),n=R.subscribeToEntity("instance",["create","update","delete"],Pe);k=()=>{t(),a(),n()}}),Re(()=>{k&&(k(),k=null)}),Ve(()=>W(),()=>{s($,W().params.id)}),We(),ze();var O=ct();qe(t=>{j(()=>Ke.title=`${e(r),i(()=>e(r)?`${e(r).name} - Enterprise Details`:"Enterprise Details")??""} - GARM`)});var L=F(O),H=u(L),Q=u(H),N=u(Q),Te=u(N);f(N);var X=d(N,2),Y=u(X),Z=d(u(Y),2),Me=u(Z,!0);f(Z),f(Y),f(X),f(Q),f(H);var Ce=d(H,2);{var ke=t=>{var a=it();E(t,a)},Ae=t=>{var a=de(),n=F(a);{var o=_=>{var b=lt(),A=u(b),z=u(A,!0);f(A),f(b),j(()=>le(z,e(P))),E(_,b)},q=_=>{var b=de(),A=F(b);{var z=G=>{var ae=dt(),se=F(ae);{let w=v(()=>(e(r),i(()=>e(r).name||"Enterprise"))),D=v(()=>(e(r),i(()=>e(r).endpoint?.name))),Ne=v(()=>(ce(fe),i(()=>fe("github"))));st(se,{get title(){return e(w)},get subtitle(){return`Endpoint: ${e(D)??""} • GitHub Enterprise`},get forgeIcon(){return e(Ne)},onEdit:()=>s(T,!0),onDelete:()=>s(M,!0)})}var ne=d(se,2);tt(ne,{get entity(){return e(r)},entityType:"enterprise"});var oe=d(ne,2);{let w=v(()=>(e(r),i(()=>e(r).id||""))),D=v(()=>(e(r),i(()=>e(r).name||"")));rt(oe,{get pools(){return e(c)},entityType:"enterprise",get entityId(){return e(w)},get entityName(){return e(D)},$$events:{addPool:$e}})}var ie=d(oe,2);nt(ie,{get instances(){return e(m)},entityType:"enterprise",onDeleteInstance:xe});var He=d(ie,2);{let w=v(()=>(e(r),i(()=>e(r)?.events)));at(He,{get events(){return e(w)},get eventsContainer(){return e(h)},set eventsContainer(D){s(h,D)},$$legacy:!0})}E(G,ae)};g(A,G=>{e(r)&&G(z)},!0)}E(_,b)};g(n,_=>{e(P)?_(o):_(q,!1)},!0)}E(t,a)};g(Ce,t=>{e(B)?t(ke):t(Ae,!1)})}f(L);var ee=d(L,2);{var Fe=t=>{et(t,{get entity(){return e(r)},entityType:"enterprise",$$events:{close:()=>s(T,!1),submit:a=>_e(a.detail)}})};g(ee,t=>{e(T)&&e(r)&&t(Fe)})}var te=d(ee,2);{var Se=t=>{ue(t,{title:"Delete Enterprise",message:"Are you sure you want to delete this enterprise? This action cannot be undone and will remove all associated pools and instances.",get itemName(){return e(r),i(()=>e(r).name)},$$events:{close:()=>s(M,!1),confirm:be}})};g(te,t=>{e(M)&&e(r)&&t(Se)})}var re=d(te,2);{var Ue=t=>{ue(t,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return e(p),i(()=>e(p).name)},$$events:{close:()=>{s(I,!1),s(p,null)},confirm:Ee}})};g(re,t=>{e(I)&&e(p)&&t(Ue)})}var Be=d(re,2);{var Le=t=>{{let a=v(()=>(e(r),i(()=>e(r).id||"")));ot(t,{initialEntityType:"enterprise",get initialEntityId(){return e(a)},$$events:{close:()=>s(C,!1),submit:Ie}})}};g(Be,t=>{e(C)&&e(r)&&t(Le)})}j(t=>{Ye(Te,"href",t),le(Me,(e(r),i(()=>e(r)?e(r).name:"Loading...")))},[()=>(ce(S),i(()=>S("/enterprises")))]),E(me,O),Je(),ye()}export{Tt as component}; +import{f as U,h as qe,a as E,s as le,c as de}from"../chunks/ZGz3X54u.js";import{i as ze}from"../chunks/CY7Wcm-1.js";import{p as Ge,o as je,q as Re,l as Ve,b as We,f as F,t as j,a as Je,u as i,h as ce,g as e,m as l,c as u,s as d,d as s,$ as Ke,r as f,j as Oe,i as v}from"../chunks/kDtaAWAK.js";import{i as g,s as Qe,a as Xe}from"../chunks/Cun6jNAp.js";import{d as S,c as Ye,g as y}from"../chunks/CYK-UalN.js";import{p as Ze}from"../chunks/DXEzcvud.js";import{g as pe}from"../chunks/C8dZhfFx.js";import{U as et}from"../chunks/6aKjRj0k.js";import{D as ue}from"../chunks/Dxx83T0m.js";import{E as tt,P as rt,a as at}from"../chunks/DQfnVUrv.js";import{D as st}from"../chunks/BrlhCerN.js";import{I as nt}from"../chunks/B9RC0dq5.js";import{g as fe}from"../chunks/ZelbukuJ.js";import{w as R}from"../chunks/KU08Mex1.js";import{t as x}from"../chunks/BVGCMSWJ.js";import{C as ot}from"../chunks/xMqsWuAL.js";import{e as V}from"../chunks/BZiHL9L3.js";var it=U('

Loading enterprise...

'),lt=U('

'),dt=U(" ",1),ct=U(' ',1);function Tt(me,ve){Ge(ve,!1);const[ge,ye]=Qe(),W=()=>Xe(Ze,"$page",ge),$=l();let r=l(null),c=l([]),m=l([]),B=l(!0),P=l(""),T=l(!1),M=l(!1),I=l(!1),C=l(!1),p=l(null),k=null,h=l();async function J(){if(e($))try{s(B,!0),s(P,"");const[t,a,n]=await Promise.all([y.getEnterprise(e($)),y.listEnterprisePools(e($)).catch(()=>[]),y.listEnterpriseInstances(e($)).catch(()=>[])]);s(r,t),s(c,a),s(m,n)}catch(t){s(P,t instanceof Error?t.message:"Failed to load enterprise")}finally{s(B,!1)}}function he(t,a){const{events:n}=t;return{...a,events:n}}async function _e(t){if(e(r))try{await y.updateEnterprise(e(r).id,t),await J(),x.success("Enterprise Updated",`Enterprise ${e(r).name} has been updated successfully.`),s(T,!1)}catch(a){throw a}}async function be(){if(e(r)){try{await y.deleteEnterprise(e(r).id),pe(S("/enterprises"))}catch(t){const a=V(t);x.error("Delete Failed",a)}s(M,!1)}}async function Ee(){if(e(p))try{await y.deleteInstance(e(p).name),x.success("Instance Deleted",`Instance ${e(p).name} has been deleted successfully.`),s(I,!1),s(p,null)}catch(t){const a=V(t);x.error("Delete Failed",a),s(I,!1),s(p,null)}}function xe(t){s(p,t),s(I,!0)}function $e(){s(C,!0)}async function Ie(t){try{if(!e(r))return;await y.createEnterprisePool(e(r).id,t.detail),x.success("Pool Created",`Pool has been created successfully for enterprise ${e(r).name}.`),s(C,!1)}catch(a){const n=V(a);x.error("Pool Creation Failed",n)}}function K(){e(h)&&Oe(h,e(h).scrollTop=e(h).scrollHeight)}function we(t){if(t.operation==="update"){const a=t.payload;if(e(r)&&a.id===e(r).id){const n=e(r).events?.length||0,o=a.events?.length||0;s(r,he(e(r),a)),o>n&&setTimeout(()=>{K()},100)}}else if(t.operation==="delete"){const a=t.payload.id||t.payload;e(r)&&e(r).id===a&&pe(S("/enterprises"))}}function De(t){if(!e(r))return;const a=t.payload;if(a.enterprise_id===e(r).id){if(t.operation==="create")s(c,[...e(c),a]);else if(t.operation==="update")s(c,e(c).map(n=>n.id===a.id?a:n));else if(t.operation==="delete"){const n=a.id||a;s(c,e(c).filter(o=>o.id!==n))}}}function Pe(t){if(!e(r)||!e(c))return;const a=t.payload;if(e(c).some(o=>o.id===a.pool_id)){if(t.operation==="create")s(m,[...e(m),a]);else if(t.operation==="update")s(m,e(m).map(o=>o.id===a.id?a:o));else if(t.operation==="delete"){const o=a.id||a;s(m,e(m).filter(q=>q.id!==o))}}}je(()=>{J().then(()=>{e(r)?.events?.length&&setTimeout(()=>{K()},100)});const t=R.subscribeToEntity("enterprise",["update","delete"],we),a=R.subscribeToEntity("pool",["create","update","delete"],De),n=R.subscribeToEntity("instance",["create","update","delete"],Pe);k=()=>{t(),a(),n()}}),Re(()=>{k&&(k(),k=null)}),Ve(()=>W(),()=>{s($,W().params.id)}),We(),ze();var O=ct();qe(t=>{j(()=>Ke.title=`${e(r),i(()=>e(r)?`${e(r).name} - Enterprise Details`:"Enterprise Details")??""} - GARM`)});var L=F(O),H=u(L),Q=u(H),N=u(Q),Te=u(N);f(N);var X=d(N,2),Y=u(X),Z=d(u(Y),2),Me=u(Z,!0);f(Z),f(Y),f(X),f(Q),f(H);var Ce=d(H,2);{var ke=t=>{var a=it();E(t,a)},Ae=t=>{var a=de(),n=F(a);{var o=_=>{var b=lt(),A=u(b),z=u(A,!0);f(A),f(b),j(()=>le(z,e(P))),E(_,b)},q=_=>{var b=de(),A=F(b);{var z=G=>{var ae=dt(),se=F(ae);{let w=v(()=>(e(r),i(()=>e(r).name||"Enterprise"))),D=v(()=>(e(r),i(()=>e(r).endpoint?.name))),Ne=v(()=>(ce(fe),i(()=>fe("github"))));st(se,{get title(){return e(w)},get subtitle(){return`Endpoint: ${e(D)??""} • GitHub Enterprise`},get forgeIcon(){return e(Ne)},onEdit:()=>s(T,!0),onDelete:()=>s(M,!0)})}var ne=d(se,2);tt(ne,{get entity(){return e(r)},entityType:"enterprise"});var oe=d(ne,2);{let w=v(()=>(e(r),i(()=>e(r).id||""))),D=v(()=>(e(r),i(()=>e(r).name||"")));rt(oe,{get pools(){return e(c)},entityType:"enterprise",get entityId(){return e(w)},get entityName(){return e(D)},$$events:{addPool:$e}})}var ie=d(oe,2);nt(ie,{get instances(){return e(m)},entityType:"enterprise",onDeleteInstance:xe});var He=d(ie,2);{let w=v(()=>(e(r),i(()=>e(r)?.events)));at(He,{get events(){return e(w)},get eventsContainer(){return e(h)},set eventsContainer(D){s(h,D)},$$legacy:!0})}E(G,ae)};g(A,G=>{e(r)&&G(z)},!0)}E(_,b)};g(n,_=>{e(P)?_(o):_(q,!1)},!0)}E(t,a)};g(Ce,t=>{e(B)?t(ke):t(Ae,!1)})}f(L);var ee=d(L,2);{var Fe=t=>{et(t,{get entity(){return e(r)},entityType:"enterprise",$$events:{close:()=>s(T,!1),submit:a=>_e(a.detail)}})};g(ee,t=>{e(T)&&e(r)&&t(Fe)})}var te=d(ee,2);{var Se=t=>{ue(t,{title:"Delete Enterprise",message:"Are you sure you want to delete this enterprise? This action cannot be undone and will remove all associated pools and instances.",get itemName(){return e(r),i(()=>e(r).name)},$$events:{close:()=>s(M,!1),confirm:be}})};g(te,t=>{e(M)&&e(r)&&t(Se)})}var re=d(te,2);{var Ue=t=>{ue(t,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return e(p),i(()=>e(p).name)},$$events:{close:()=>{s(I,!1),s(p,null)},confirm:Ee}})};g(re,t=>{e(I)&&e(p)&&t(Ue)})}var Be=d(re,2);{var Le=t=>{{let a=v(()=>(e(r),i(()=>e(r).id||"")));ot(t,{initialEntityType:"enterprise",get initialEntityId(){return e(a)},$$events:{close:()=>s(C,!1),submit:Ie}})}};g(Be,t=>{e(C)&&e(r)&&t(Le)})}j(t=>{Ye(Te,"href",t),le(Me,(e(r),i(()=>e(r)?e(r).name:"Loading...")))},[()=>(ce(S),i(()=>S("/enterprises")))]),E(me,O),Je(),ye()}export{Tt as component}; diff --git a/webapp/assets/_app/immutable/nodes/7.DLPvTRtH.js b/webapp/assets/_app/immutable/nodes/7.C88HESSe.js similarity index 98% rename from webapp/assets/_app/immutable/nodes/7.DLPvTRtH.js rename to webapp/assets/_app/immutable/nodes/7.C88HESSe.js index 75dcf989..67b4128d 100644 --- a/webapp/assets/_app/immutable/nodes/7.DLPvTRtH.js +++ b/webapp/assets/_app/immutable/nodes/7.C88HESSe.js @@ -1 +1 @@ -import{f as m,h as Ze,e as er,a as n,b as rr,t as ar,s as ze}from"../chunks/ZGz3X54u.js";import{i as tr}from"../chunks/CY7Wcm-1.js";import{p as dr,o as lr,l as L,b as sr,t as de,g as e,a as or,m as i,$ as ir,c as a,u,h as Ae,s as d,d as s,r as t,n as q,f as nr,i as cr}from"../chunks/kDtaAWAK.js";import{i as p,s as mr,a as vr}from"../chunks/Cun6jNAp.js";import{B as Pe,d as _,c as Le,s as F,r as w}from"../chunks/Cvcp5xHB.js";import{b as U}from"../chunks/CYnNqrHp.js";import{p as ur}from"../chunks/CdEA5IGF.js";import{g as le}from"../chunks/BU_V7FOQ.js";import{a as pr,b as gr}from"../chunks/CkcEJ1BA.js";import{t as br}from"../chunks/BVGCMSWJ.js";import{e as fr}from"../chunks/BZiHL9L3.js";var xr=m('

Username is required

'),hr=m('

Please enter a valid email address

'),yr=m('

Full name is required

'),kr=m('

Password must be at least 8 characters long

'),_r=m('

Passwords do not match

'),wr=rr(' Advanced Configuration (Optional)',1),Ur=m('

URL where runners can fetch metadata and setup information.

URL where runners send status updates and lifecycle events.

URL where GitHub/Gitea will send webhook events for job notifications.

URL where GARM agents will connect. Must allow websocket connections.

'),$r=m("
  • Enter a username
  • "),Mr=m("
  • Enter a valid email address
  • "),Rr=m("
  • Enter your full name
  • "),zr=m("
  • Enter a password with at least 8 characters
  • "),Ar=m("
  • Confirm your password
  • "),Pr=m('

    Please complete all required fields

    '),Lr=m('

    '),qr=m('
    GARM

    Welcome to GARM

    Complete the first-run setup to get started

    First-Run Initialization

    GARM needs to be initialized before first use. This will create the admin user and generate a unique controller ID for this installation.

    This will create the admin user, generate a unique controller ID, and configure the required URLs for your GARM installation.
    Make sure to remember these credentials as they cannot be recovered.

    ');function Dr(qe,Ce){dr(Ce,!1);const[Ge,Ie]=mr(),C=()=>vr(pr,"$authStore",Ge),$=i(),M=i(),R=i(),z=i(),A=i(),j=i();let f=i("admin"),g=i("admin@garm.local"),v=i(""),x=i(""),h=i("Administrator"),G=i(!1),O=i(""),J=i(!1),E=i(""),V=i(""),B=i(""),N=i("");async function Ee(){if(e(j))try{s(G,!0),s(O,""),await gr.initialize(e(f).trim(),e(g).trim(),e(v),e(h).trim(),{callbackUrl:e(E).trim()||void 0,metadataUrl:e(V).trim()||void 0,webhookUrl:e(B).trim()||void 0,agentUrl:e(N).trim()||void 0}),br.success("GARM Initialized","GARM has been successfully initialized. Welcome!")}catch(r){s(O,fr(r))}finally{s(G,!1)}}lr(()=>{if(C().isAuthenticated){le(_("/"));return}!C().needsInitialization&&!C().loading&&le(_("/login"))}),L(()=>(e(E),e(V),e(B),e(N)),()=>{if(typeof window<"u"){const r=window.location.origin;e(E)||s(E,`${r}/api/v1/callbacks`),e(V)||s(V,`${r}/api/v1/metadata`),e(B)||s(B,`${r}/webhooks`),e(N)||s(N,`${r}/agent`)}}),L(()=>e(g),()=>{s($,e(g).trim()!==""&&e(g).includes("@"))}),L(()=>e(v),()=>{s(M,e(v).length>=8)}),L(()=>(e(x),e(v)),()=>{s(R,e(x).length>0&&e(v)===e(x))}),L(()=>e(f),()=>{s(z,e(f).trim()!=="")}),L(()=>e(h),()=>{s(A,e(h).trim()!=="")}),L(()=>(e(z),e($),e(A),e(M),e(R)),()=>{s(j,e(z)&&e($)&&e(A)&&e(M)&&e(R))}),L(()=>(e(G),C(),_),()=>{e(G)||(C().isAuthenticated?le(_("/")):!C().needsInitialization&&!C().loading&&le(_("/login")))}),sr(),tr();var se=qr();Ze(r=>{ir.title="Initialize GARM - First Run Setup"});var oe=a(se),ge=a(oe),be=a(ge),Ve=d(be,2);t(ge),q(4),t(oe);var fe=d(oe,2),xe=d(a(fe),2),ie=a(xe),ne=a(ie),he=d(a(ne),2),K=a(he);w(K);var Be=d(K,2);{var Ne=r=>{var l=xr();n(r,l)};p(Be,r=>{e(z),e(f),u(()=>!e(z)&&e(f).length>0)&&r(Ne)})}t(he),t(ne);var ce=d(ne,2),ye=d(a(ce),2),Q=a(ye);w(Q);var Se=d(Q,2);{var Fe=r=>{var l=hr();n(r,l)};p(Se,r=>{e($),e(g),u(()=>!e($)&&e(g).length>0)&&r(Fe)})}t(ye),t(ce);var me=d(ce,2),ke=d(a(me),2),X=a(ke);w(X);var je=d(X,2);{var We=r=>{var l=yr();n(r,l)};p(je,r=>{e(A),e(h),u(()=>!e(A)&&e(h).length>0)&&r(We)})}t(ke),t(me);var ve=d(me,2),_e=d(a(ve),2),Y=a(_e);w(Y);var De=d(Y,2);{var He=r=>{var l=kr();n(r,l)};p(De,r=>{e(M),e(v),u(()=>!e(M)&&e(v).length>0)&&r(He)})}t(_e),t(ve);var ue=d(ve,2),we=d(a(ue),2),Z=a(we);w(Z);var Te=d(Z,2);{var Oe=r=>{var l=_r();n(r,l)};p(Te,r=>{e(R),e(x),u(()=>!e(R)&&e(x).length>0)&&r(Oe)})}t(we),t(ue);var pe=d(ue,2),Ue=a(pe);Pe(Ue,{type:"button",variant:"ghost",size:"sm",$$events:{click:()=>s(J,!e(J))},children:(r,l)=>{var b=wr(),c=nr(b);q(),de(()=>F(c,0,`w-4 h-4 mr-2 transition-transform ${e(J)?"rotate-90":""}`)),n(r,b)},$$slots:{default:!0}});var Je=d(Ue,2);{var Ke=r=>{var l=Ur(),b=a(l),c=a(b),P=d(a(c),2),I=a(P);w(I),q(2),t(P),t(c);var S=d(c,2),ee=d(a(S),2),W=a(ee);w(W),q(2),t(ee),t(S);var D=d(S,2),H=d(a(D),2),re=a(H);w(re),q(2),t(H),t(D);var T=d(D,2),ae=d(a(T),2),te=a(ae);w(te),q(2),t(ae),t(T),t(b),t(l),U(I,()=>e(V),y=>s(V,y)),U(W,()=>e(E),y=>s(E,y)),U(re,()=>e(B),y=>s(B,y)),U(te,()=>e(N),y=>s(N,y)),n(r,l)};p(Je,r=>{e(J)&&r(Ke)})}t(pe);var $e=d(pe,2);{var Qe=r=>{var l=Pr(),b=a(l),c=d(a(b),2),P=d(a(c),2),I=a(P),S=a(I);{var ee=o=>{var k=$r();n(o,k)};p(S,o=>{e(z)||o(ee)})}var W=d(S,2);{var D=o=>{var k=Mr();n(o,k)};p(W,o=>{e($)||o(D)})}var H=d(W,2);{var re=o=>{var k=Rr();n(o,k)};p(H,o=>{e(A)||o(re)})}var T=d(H,2);{var ae=o=>{var k=zr();n(o,k)};p(T,o=>{e(M)||o(ae)})}var te=d(T,2);{var y=o=>{var k=Ar();n(o,k)};p(te,o=>{e(R)||o(y)})}t(I),t(P),t(c),t(b),t(l),n(r,l)};p($e,r=>{e(j),e(f),e(g),e(h),e(v),e(x),u(()=>!e(j)&&(e(f).length>0||e(g).length>0||e(h).length>0||e(v).length>0||e(x).length>0))&&r(Qe)})}var Me=d($e,2);{var Xe=r=>{var l=Lr(),b=a(l),c=d(a(b),2),P=a(c),I=a(P,!0);t(P),t(c),t(b),t(l),de(()=>ze(I,e(O))),n(r,l)};p(Me,r=>{e(O)&&r(Xe)})}var Re=d(Me,2),Ye=a(Re);{let r=cr(()=>!e(j)||e(G));Pe(Ye,{type:"submit",variant:"primary",size:"lg",fullWidth:!0,get loading(){return e(G)},get disabled(){return e(r)},children:(l,b)=>{q();var c=ar();de(()=>ze(c,e(G)?"Initializing...":"Initialize GARM")),n(l,c)},$$slots:{default:!0}})}t(Re),t(ie),q(2),t(xe),t(fe),t(se),de((r,l)=>{Le(be,"src",r),Le(Ve,"src",l),F(K,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(z),e(f),u(()=>!e(z)&&e(f).length>0?"border-red-300 dark:border-red-600":"")??""}`),F(Q,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e($),e(g),u(()=>!e($)&&e(g).length>0?"border-red-300 dark:border-red-600":"")??""}`),F(X,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(A),e(h),u(()=>!e(A)&&e(h).length>0?"border-red-300 dark:border-red-600":"")??""}`),F(Y,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(M),e(v),u(()=>!e(M)&&e(v).length>0?"border-red-300 dark:border-red-600":"")??""}`),F(Z,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(R),e(x),u(()=>!e(R)&&e(x).length>0?"border-red-300 dark:border-red-600":"")??""}`)},[()=>(Ae(_),u(()=>_("/assets/garm-light.svg"))),()=>(Ae(_),u(()=>_("/assets/garm-dark.svg")))]),U(K,()=>e(f),r=>s(f,r)),U(Q,()=>e(g),r=>s(g,r)),U(X,()=>e(h),r=>s(h,r)),U(Y,()=>e(v),r=>s(v,r)),U(Z,()=>e(x),r=>s(x,r)),er("submit",ie,ur(Ee)),n(qe,se),or(),Ie()}export{Dr as component}; +import{f as m,h as Ze,e as er,a as n,b as rr,t as ar,s as ze}from"../chunks/ZGz3X54u.js";import{i as tr}from"../chunks/CY7Wcm-1.js";import{p as dr,o as lr,l as L,b as sr,t as de,g as e,a as or,m as i,$ as ir,c as a,u,h as Ae,s as d,d as s,r as t,n as q,f as nr,i as cr}from"../chunks/kDtaAWAK.js";import{i as p,s as mr,a as vr}from"../chunks/Cun6jNAp.js";import{B as Pe,d as _,c as Le,s as F,r as w}from"../chunks/CYK-UalN.js";import{b as U}from"../chunks/CYnNqrHp.js";import{p as ur}from"../chunks/CdEA5IGF.js";import{g as le}from"../chunks/C8dZhfFx.js";import{a as pr,b as gr}from"../chunks/OrLoP7JZ.js";import{t as br}from"../chunks/BVGCMSWJ.js";import{e as fr}from"../chunks/BZiHL9L3.js";var xr=m('

    Username is required

    '),hr=m('

    Please enter a valid email address

    '),yr=m('

    Full name is required

    '),kr=m('

    Password must be at least 8 characters long

    '),_r=m('

    Passwords do not match

    '),wr=rr(' Advanced Configuration (Optional)',1),Ur=m('

    URL where runners can fetch metadata and setup information.

    URL where runners send status updates and lifecycle events.

    URL where GitHub/Gitea will send webhook events for job notifications.

    URL where GARM agents will connect. Must allow websocket connections.

    '),$r=m("
  • Enter a username
  • "),Mr=m("
  • Enter a valid email address
  • "),Rr=m("
  • Enter your full name
  • "),zr=m("
  • Enter a password with at least 8 characters
  • "),Ar=m("
  • Confirm your password
  • "),Pr=m('

    Please complete all required fields

    '),Lr=m('

    '),qr=m('
    GARM

    Welcome to GARM

    Complete the first-run setup to get started

    First-Run Initialization

    GARM needs to be initialized before first use. This will create the admin user and generate a unique controller ID for this installation.

    This will create the admin user, generate a unique controller ID, and configure the required URLs for your GARM installation.
    Make sure to remember these credentials as they cannot be recovered.

    ');function Dr(qe,Ce){dr(Ce,!1);const[Ge,Ie]=mr(),C=()=>vr(pr,"$authStore",Ge),$=i(),M=i(),R=i(),z=i(),A=i(),j=i();let f=i("admin"),g=i("admin@garm.local"),v=i(""),x=i(""),h=i("Administrator"),G=i(!1),O=i(""),J=i(!1),E=i(""),V=i(""),B=i(""),N=i("");async function Ee(){if(e(j))try{s(G,!0),s(O,""),await gr.initialize(e(f).trim(),e(g).trim(),e(v),e(h).trim(),{callbackUrl:e(E).trim()||void 0,metadataUrl:e(V).trim()||void 0,webhookUrl:e(B).trim()||void 0,agentUrl:e(N).trim()||void 0}),br.success("GARM Initialized","GARM has been successfully initialized. Welcome!")}catch(r){s(O,fr(r))}finally{s(G,!1)}}lr(()=>{if(C().isAuthenticated){le(_("/"));return}!C().needsInitialization&&!C().loading&&le(_("/login"))}),L(()=>(e(E),e(V),e(B),e(N)),()=>{if(typeof window<"u"){const r=window.location.origin;e(E)||s(E,`${r}/api/v1/callbacks`),e(V)||s(V,`${r}/api/v1/metadata`),e(B)||s(B,`${r}/webhooks`),e(N)||s(N,`${r}/agent`)}}),L(()=>e(g),()=>{s($,e(g).trim()!==""&&e(g).includes("@"))}),L(()=>e(v),()=>{s(M,e(v).length>=8)}),L(()=>(e(x),e(v)),()=>{s(R,e(x).length>0&&e(v)===e(x))}),L(()=>e(f),()=>{s(z,e(f).trim()!=="")}),L(()=>e(h),()=>{s(A,e(h).trim()!=="")}),L(()=>(e(z),e($),e(A),e(M),e(R)),()=>{s(j,e(z)&&e($)&&e(A)&&e(M)&&e(R))}),L(()=>(e(G),C(),_),()=>{e(G)||(C().isAuthenticated?le(_("/")):!C().needsInitialization&&!C().loading&&le(_("/login")))}),sr(),tr();var se=qr();Ze(r=>{ir.title="Initialize GARM - First Run Setup"});var oe=a(se),ge=a(oe),be=a(ge),Ve=d(be,2);t(ge),q(4),t(oe);var fe=d(oe,2),xe=d(a(fe),2),ie=a(xe),ne=a(ie),he=d(a(ne),2),K=a(he);w(K);var Be=d(K,2);{var Ne=r=>{var l=xr();n(r,l)};p(Be,r=>{e(z),e(f),u(()=>!e(z)&&e(f).length>0)&&r(Ne)})}t(he),t(ne);var ce=d(ne,2),ye=d(a(ce),2),Q=a(ye);w(Q);var Se=d(Q,2);{var Fe=r=>{var l=hr();n(r,l)};p(Se,r=>{e($),e(g),u(()=>!e($)&&e(g).length>0)&&r(Fe)})}t(ye),t(ce);var me=d(ce,2),ke=d(a(me),2),X=a(ke);w(X);var je=d(X,2);{var We=r=>{var l=yr();n(r,l)};p(je,r=>{e(A),e(h),u(()=>!e(A)&&e(h).length>0)&&r(We)})}t(ke),t(me);var ve=d(me,2),_e=d(a(ve),2),Y=a(_e);w(Y);var De=d(Y,2);{var He=r=>{var l=kr();n(r,l)};p(De,r=>{e(M),e(v),u(()=>!e(M)&&e(v).length>0)&&r(He)})}t(_e),t(ve);var ue=d(ve,2),we=d(a(ue),2),Z=a(we);w(Z);var Te=d(Z,2);{var Oe=r=>{var l=_r();n(r,l)};p(Te,r=>{e(R),e(x),u(()=>!e(R)&&e(x).length>0)&&r(Oe)})}t(we),t(ue);var pe=d(ue,2),Ue=a(pe);Pe(Ue,{type:"button",variant:"ghost",size:"sm",$$events:{click:()=>s(J,!e(J))},children:(r,l)=>{var b=wr(),c=nr(b);q(),de(()=>F(c,0,`w-4 h-4 mr-2 transition-transform ${e(J)?"rotate-90":""}`)),n(r,b)},$$slots:{default:!0}});var Je=d(Ue,2);{var Ke=r=>{var l=Ur(),b=a(l),c=a(b),P=d(a(c),2),I=a(P);w(I),q(2),t(P),t(c);var S=d(c,2),ee=d(a(S),2),W=a(ee);w(W),q(2),t(ee),t(S);var D=d(S,2),H=d(a(D),2),re=a(H);w(re),q(2),t(H),t(D);var T=d(D,2),ae=d(a(T),2),te=a(ae);w(te),q(2),t(ae),t(T),t(b),t(l),U(I,()=>e(V),y=>s(V,y)),U(W,()=>e(E),y=>s(E,y)),U(re,()=>e(B),y=>s(B,y)),U(te,()=>e(N),y=>s(N,y)),n(r,l)};p(Je,r=>{e(J)&&r(Ke)})}t(pe);var $e=d(pe,2);{var Qe=r=>{var l=Pr(),b=a(l),c=d(a(b),2),P=d(a(c),2),I=a(P),S=a(I);{var ee=o=>{var k=$r();n(o,k)};p(S,o=>{e(z)||o(ee)})}var W=d(S,2);{var D=o=>{var k=Mr();n(o,k)};p(W,o=>{e($)||o(D)})}var H=d(W,2);{var re=o=>{var k=Rr();n(o,k)};p(H,o=>{e(A)||o(re)})}var T=d(H,2);{var ae=o=>{var k=zr();n(o,k)};p(T,o=>{e(M)||o(ae)})}var te=d(T,2);{var y=o=>{var k=Ar();n(o,k)};p(te,o=>{e(R)||o(y)})}t(I),t(P),t(c),t(b),t(l),n(r,l)};p($e,r=>{e(j),e(f),e(g),e(h),e(v),e(x),u(()=>!e(j)&&(e(f).length>0||e(g).length>0||e(h).length>0||e(v).length>0||e(x).length>0))&&r(Qe)})}var Me=d($e,2);{var Xe=r=>{var l=Lr(),b=a(l),c=d(a(b),2),P=a(c),I=a(P,!0);t(P),t(c),t(b),t(l),de(()=>ze(I,e(O))),n(r,l)};p(Me,r=>{e(O)&&r(Xe)})}var Re=d(Me,2),Ye=a(Re);{let r=cr(()=>!e(j)||e(G));Pe(Ye,{type:"submit",variant:"primary",size:"lg",fullWidth:!0,get loading(){return e(G)},get disabled(){return e(r)},children:(l,b)=>{q();var c=ar();de(()=>ze(c,e(G)?"Initializing...":"Initialize GARM")),n(l,c)},$$slots:{default:!0}})}t(Re),t(ie),q(2),t(xe),t(fe),t(se),de((r,l)=>{Le(be,"src",r),Le(Ve,"src",l),F(K,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(z),e(f),u(()=>!e(z)&&e(f).length>0?"border-red-300 dark:border-red-600":"")??""}`),F(Q,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e($),e(g),u(()=>!e($)&&e(g).length>0?"border-red-300 dark:border-red-600":"")??""}`),F(X,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(A),e(h),u(()=>!e(A)&&e(h).length>0?"border-red-300 dark:border-red-600":"")??""}`),F(Y,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(M),e(v),u(()=>!e(M)&&e(v).length>0?"border-red-300 dark:border-red-600":"")??""}`),F(Z,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(R),e(x),u(()=>!e(R)&&e(x).length>0?"border-red-300 dark:border-red-600":"")??""}`)},[()=>(Ae(_),u(()=>_("/assets/garm-light.svg"))),()=>(Ae(_),u(()=>_("/assets/garm-dark.svg")))]),U(K,()=>e(f),r=>s(f,r)),U(Q,()=>e(g),r=>s(g,r)),U(X,()=>e(h),r=>s(h,r)),U(Y,()=>e(v),r=>s(v,r)),U(Z,()=>e(x),r=>s(x,r)),er("submit",ie,ur(Ee)),n(qe,se),or(),Ie()}export{Dr as component}; diff --git a/webapp/assets/_app/immutable/nodes/8.CQSV4FuF.js b/webapp/assets/_app/immutable/nodes/8.DnJntumo.js similarity index 93% rename from webapp/assets/_app/immutable/nodes/8.CQSV4FuF.js rename to webapp/assets/_app/immutable/nodes/8.DnJntumo.js index 5131f172..892c0086 100644 --- a/webapp/assets/_app/immutable/nodes/8.CQSV4FuF.js +++ b/webapp/assets/_app/immutable/nodes/8.DnJntumo.js @@ -1 +1 @@ -import{f as S,a as b,s as O,c as _e,h as ye}from"../chunks/ZGz3X54u.js";import{i as X}from"../chunks/CY7Wcm-1.js";import{p as Y,a as Z,c as h,h as f,u as d,r as v,t as q,f as ee,o as be,q as xe,l as L,b as Se,g as t,m as c,$ as Ce,i as ke,s as w,d as a}from"../chunks/kDtaAWAK.js";import{p as Ie,i as T}from"../chunks/Cun6jNAp.js";import{d as M,c as F,g as V}from"../chunks/Cvcp5xHB.js";import{D as Pe}from"../chunks/lQWw1Z23.js";import{P as we}from"../chunks/CLZesvzF.js";import{S as Te}from"../chunks/-FPg0SOX.js";import{w as De}from"../chunks/KU08Mex1.js";import{t as $e}from"../chunks/BVGCMSWJ.js";import{D as Ae,G as Ee}from"../chunks/Cfdue6T6.js";import{e as Le}from"../chunks/BZiHL9L3.js";import{E as Me}from"../chunks/CEJvqnOn.js";import"../chunks/CkTG2UXI.js";import{S as H}from"../chunks/BTeTCgJA.js";import{A as Fe}from"../chunks/Cs0pYghy.js";var Ne=S(' '),Re=S(' '),Ge=S('-'),He=S('
    ');function Oe(N,D){Y(D,!1);let l=Ie(D,"item",8);X();var m=He(),$=h(m);{var u=o=>{var p=Ne(),_=h(p);v(p),q(C=>{F(p,"href",C),F(p,"title",`Pool: ${f(l()),d(()=>l().pool_id)??""}`),O(_,`Pool: ${f(l()),d(()=>l().pool_id)??""}`)},[()=>(f(M),f(l()),d(()=>M(`/pools/${l().pool_id}`)))]),b(o,p)},P=o=>{var p=_e(),_=ee(p);{var C=s=>{var n=Re(),y=h(n);v(n),q(I=>{F(n,"href",I),F(n,"title",`Scale Set: ${f(l()),d(()=>l().scale_set_id)??""}`),O(y,`Scale Set: ${f(l()),d(()=>l().scale_set_id)??""}`)},[()=>(f(M),f(l()),d(()=>M(`/scalesets/${l().scale_set_id}`)))]),b(s,n)},k=s=>{var n=Ge();b(s,n)};T(_,s=>{f(l()),d(()=>l()?.scale_set_id)?s(C):s(k,!1)},!0)}b(o,p)};T($,o=>{f(l()),d(()=>l()?.pool_id)?o(u):o(P,!1)})}v(m),b(N,m),Z()}var qe=S('

    Error

    '),je=S('
    '),ze=S('
    ',1);function nt(N,D){Y(D,!1);const l=c(),m=c(),$=c();let u=c([]),P=c(!0),o=c(""),p="",_=null,C=Date.now(),k=null,s=c(1),n=c(25),y=c(""),I=c(!1),g=c(null),A=c(!1),x=c(null);async function j(){try{a(P,!0),a(o,""),a(u,await V.listInstances())}catch(e){a(o,e instanceof Error?e.message:"Failed to load instances")}finally{a(P,!1)}}function z(e){a(g,e),a(I,!0)}function W(e){a(x,e),a(A,!0)}function R(e){if(!e.agent_id||!e.capabilities?.has_shell||e.status==="stopped")return!0;const r=e.heartbeat;if(!r)return!0;const i=new Date(r);return C-i.getTime()>6e4}async function te(){if(t(g))try{await V.deleteInstance(t(g).name),$e.success("Instance Deleted",`Instance ${t(g).name} has been deleted successfully.`)}catch(e){a(o,Le(e))}finally{a(I,!1),a(g,null)}}const ae=[{key:"name",title:"Name",cellComponent:Me,cellProps:{entityType:"instance",showId:!0}},{key:"pool_scale_set",title:"Pool/Scale Set",flexible:!0,cellComponent:Oe},{key:"os_type",title:"OS Type",cellComponent:H,cellProps:{statusType:"os_type",statusField:"os_type"}},{key:"created",title:"Created",cellComponent:Ee,cellProps:{field:"created_at",type:"date"}},{key:"status",title:"Status",cellComponent:H,cellProps:{statusType:"instance",statusField:"status"}},{key:"runner_status",title:"Runner Status",cellComponent:H,cellProps:{statusType:"instance",statusField:"runner_status"}},{key:"actions",title:"Actions",align:"right",cellComponent:Fe,cellProps:{actions:[{type:"shell",title:"Shell",ariaLabel:"Open shell",action:"shell",isDisabled:e=>R(e),disabledTitle:e=>e.capabilities?.has_shell?e.status==="stopped"?"Shell unavailable - Instance is stopped":"Shell unavailable - Agent heartbeat is stale":"Shell unavailable - Agent does not support shell"},{type:"delete",title:"Delete",ariaLabel:"Delete instance",action:"delete"}]}}],le={entityType:"instance",primaryText:{field:"name",isClickable:!0,href:"/instances/{name}"},secondaryText:{field:"provider_id"},badges:[{type:"text",field:"os_type",label:"OS"},{type:"status",field:"status"},{type:"status",field:"runner_status"}],actions:[{type:"shell",title:"Shell",handler:e=>W(e),isDisabled:e=>R(e)},{type:"delete",handler:e=>z(e)}]};function re(e){a(y,e.detail.term),a(s,1)}function se(e){a(s,e.detail.page)}function ne(e){a(n,e.detail.perPage),a(s,1)}async function oe(){try{await j()}catch(e){console.error("Retry failed:",e)}}function ie(e){}function ce(e){z(e.detail.item)}function de(e){W(e.detail.item)}function ue(e){if(e.operation==="create"){const r=e.payload;a(u,[...t(u),r])}else if(e.operation==="update"){const r=e.payload;a(u,t(u).map(i=>i.name===r.name?r:i))}else if(e.operation==="delete"){const r=e.payload.name||e.payload;a(u,t(u).filter(i=>i.name!==r))}}be(()=>{j(),_=De.subscribeToEntity("instance",["create","update","delete"],ue),k=setInterval(()=>{C=Date.now()},1e3)}),xe(()=>{_&&(_(),_=null),k&&(clearInterval(k),k=null)}),L(()=>(t(u),t(y)),()=>{a(l,t(u).filter(e=>(t(y)===""||e.name?.toLowerCase().includes(t(y).toLowerCase())||e.provider_id?.toLowerCase().includes(t(y).toLowerCase()))&&p===""))}),L(()=>(t(l),t(n)),()=>{a(m,Math.ceil(t(l).length/t(n)))}),L(()=>(t(s),t(m)),()=>{t(s)>t(m)&&t(m)>0&&a(s,t(m))}),L(()=>(t(l),t(s),t(n)),()=>{a($,t(l).slice((t(s)-1)*t(n),t(s)*t(n)))}),Se(),X();var B=ze();ye(e=>{Ce.title="Instances - GARM"});var G=ee(B),J=h(G);we(J,{title:"Runner Instances",description:"Monitor your running instances",showAction:!1});var K=w(J,2);{var me=e=>{var r=qe(),i=h(r),E=h(i),U=w(h(E),2),ge=h(U,!0);v(U),v(E),v(i),v(r),q(()=>O(ge,t(o))),b(e,r)};T(K,e=>{t(o)&&e(me)})}var pe=w(K,2);{let e=ke(()=>!!t(o));Ae(pe,{get columns(){return ae},get data(){return t($)},get loading(){return t(P)},get error(){return t(o)},get searchTerm(){return t(y)},searchPlaceholder:"Search instances...",get currentPage(){return t(s)},get perPage(){return t(n)},get totalPages(){return t(m)},get totalItems(){return t(l),d(()=>t(l).length)},itemName:"instances",emptyIconType:"cog",get showRetry(){return t(e)},get mobileCardConfig(){return le},$$events:{search:re,pageChange:se,perPageChange:ne,retry:oe,edit:ie,delete:ce,shell:de}})}v(G);var Q=w(G,2);{var fe=e=>{var r=je(),i=h(r),E=h(i);Te(E,{get runnerName(){return t(x),d(()=>t(x).name)},onClose:()=>{a(A,!1),a(x,null)}}),v(i),v(r),b(e,r)};T(Q,e=>{t(A),t(x),d(()=>t(A)&&t(x)&&!R(t(x)))&&e(fe)})}var he=w(Q,2);{var ve=e=>{Pe(e,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return t(g),d(()=>t(g).name)},$$events:{close:()=>{a(I,!1),a(g,null)},confirm:te}})};T(he,e=>{t(I)&&t(g)&&e(ve)})}b(N,B),Z()}export{nt as component}; +import{f as S,a as b,s as O,c as _e,h as ye}from"../chunks/ZGz3X54u.js";import{i as X}from"../chunks/CY7Wcm-1.js";import{p as Y,a as Z,c as h,h as f,u as d,r as v,t as q,f as ee,o as be,q as xe,l as L,b as Se,g as t,m as c,$ as Ce,i as ke,s as w,d as a}from"../chunks/kDtaAWAK.js";import{p as Ie,i as T}from"../chunks/Cun6jNAp.js";import{d as M,c as F,g as V}from"../chunks/CYK-UalN.js";import{D as Pe}from"../chunks/Dxx83T0m.js";import{P as we}from"../chunks/DacI6VAP.js";import{S as Te}from"../chunks/DC7O3Apj.js";import{w as De}from"../chunks/KU08Mex1.js";import{t as $e}from"../chunks/BVGCMSWJ.js";import{D as Ae,G as Ee}from"../chunks/BKeluGSY.js";import{e as Le}from"../chunks/BZiHL9L3.js";import{E as Me}from"../chunks/Dd4NFVf9.js";import"../chunks/DWgB-t1g.js";import{S as H}from"../chunks/BStwtkX8.js";import{A as Fe}from"../chunks/rb89c4PS.js";var Ne=S(' '),Re=S(' '),Ge=S('-'),He=S('
    ');function Oe(N,D){Y(D,!1);let l=Ie(D,"item",8);X();var m=He(),$=h(m);{var u=o=>{var p=Ne(),_=h(p);v(p),q(C=>{F(p,"href",C),F(p,"title",`Pool: ${f(l()),d(()=>l().pool_id)??""}`),O(_,`Pool: ${f(l()),d(()=>l().pool_id)??""}`)},[()=>(f(M),f(l()),d(()=>M(`/pools/${l().pool_id}`)))]),b(o,p)},P=o=>{var p=_e(),_=ee(p);{var C=s=>{var n=Re(),y=h(n);v(n),q(I=>{F(n,"href",I),F(n,"title",`Scale Set: ${f(l()),d(()=>l().scale_set_id)??""}`),O(y,`Scale Set: ${f(l()),d(()=>l().scale_set_id)??""}`)},[()=>(f(M),f(l()),d(()=>M(`/scalesets/${l().scale_set_id}`)))]),b(s,n)},k=s=>{var n=Ge();b(s,n)};T(_,s=>{f(l()),d(()=>l()?.scale_set_id)?s(C):s(k,!1)},!0)}b(o,p)};T($,o=>{f(l()),d(()=>l()?.pool_id)?o(u):o(P,!1)})}v(m),b(N,m),Z()}var qe=S('

    Error

    '),je=S('
    '),ze=S('
    ',1);function nt(N,D){Y(D,!1);const l=c(),m=c(),$=c();let u=c([]),P=c(!0),o=c(""),p="",_=null,C=Date.now(),k=null,s=c(1),n=c(25),y=c(""),I=c(!1),g=c(null),A=c(!1),x=c(null);async function j(){try{a(P,!0),a(o,""),a(u,await V.listInstances())}catch(e){a(o,e instanceof Error?e.message:"Failed to load instances")}finally{a(P,!1)}}function z(e){a(g,e),a(I,!0)}function W(e){a(x,e),a(A,!0)}function R(e){if(!e.agent_id||!e.capabilities?.has_shell||e.status==="stopped")return!0;const r=e.heartbeat;if(!r)return!0;const i=new Date(r);return C-i.getTime()>6e4}async function te(){if(t(g))try{await V.deleteInstance(t(g).name),$e.success("Instance Deleted",`Instance ${t(g).name} has been deleted successfully.`)}catch(e){a(o,Le(e))}finally{a(I,!1),a(g,null)}}const ae=[{key:"name",title:"Name",cellComponent:Me,cellProps:{entityType:"instance",showId:!0}},{key:"pool_scale_set",title:"Pool/Scale Set",flexible:!0,cellComponent:Oe},{key:"os_type",title:"OS Type",cellComponent:H,cellProps:{statusType:"os_type",statusField:"os_type"}},{key:"created",title:"Created",cellComponent:Ee,cellProps:{field:"created_at",type:"date"}},{key:"status",title:"Status",cellComponent:H,cellProps:{statusType:"instance",statusField:"status"}},{key:"runner_status",title:"Runner Status",cellComponent:H,cellProps:{statusType:"instance",statusField:"runner_status"}},{key:"actions",title:"Actions",align:"right",cellComponent:Fe,cellProps:{actions:[{type:"shell",title:"Shell",ariaLabel:"Open shell",action:"shell",isDisabled:e=>R(e),disabledTitle:e=>e.capabilities?.has_shell?e.status==="stopped"?"Shell unavailable - Instance is stopped":"Shell unavailable - Agent heartbeat is stale":"Shell unavailable - Agent does not support shell"},{type:"delete",title:"Delete",ariaLabel:"Delete instance",action:"delete"}]}}],le={entityType:"instance",primaryText:{field:"name",isClickable:!0,href:"/instances/{name}"},secondaryText:{field:"provider_id"},badges:[{type:"text",field:"os_type",label:"OS"},{type:"status",field:"status"},{type:"status",field:"runner_status"}],actions:[{type:"shell",title:"Shell",handler:e=>W(e),isDisabled:e=>R(e)},{type:"delete",handler:e=>z(e)}]};function re(e){a(y,e.detail.term),a(s,1)}function se(e){a(s,e.detail.page)}function ne(e){a(n,e.detail.perPage),a(s,1)}async function oe(){try{await j()}catch(e){console.error("Retry failed:",e)}}function ie(e){}function ce(e){z(e.detail.item)}function de(e){W(e.detail.item)}function ue(e){if(e.operation==="create"){const r=e.payload;a(u,[...t(u),r])}else if(e.operation==="update"){const r=e.payload;a(u,t(u).map(i=>i.name===r.name?r:i))}else if(e.operation==="delete"){const r=e.payload.name||e.payload;a(u,t(u).filter(i=>i.name!==r))}}be(()=>{j(),_=De.subscribeToEntity("instance",["create","update","delete"],ue),k=setInterval(()=>{C=Date.now()},1e3)}),xe(()=>{_&&(_(),_=null),k&&(clearInterval(k),k=null)}),L(()=>(t(u),t(y)),()=>{a(l,t(u).filter(e=>(t(y)===""||e.name?.toLowerCase().includes(t(y).toLowerCase())||e.provider_id?.toLowerCase().includes(t(y).toLowerCase()))&&p===""))}),L(()=>(t(l),t(n)),()=>{a(m,Math.ceil(t(l).length/t(n)))}),L(()=>(t(s),t(m)),()=>{t(s)>t(m)&&t(m)>0&&a(s,t(m))}),L(()=>(t(l),t(s),t(n)),()=>{a($,t(l).slice((t(s)-1)*t(n),t(s)*t(n)))}),Se(),X();var B=ze();ye(e=>{Ce.title="Instances - GARM"});var G=ee(B),J=h(G);we(J,{title:"Runner Instances",description:"Monitor your running instances",showAction:!1});var K=w(J,2);{var me=e=>{var r=qe(),i=h(r),E=h(i),U=w(h(E),2),ge=h(U,!0);v(U),v(E),v(i),v(r),q(()=>O(ge,t(o))),b(e,r)};T(K,e=>{t(o)&&e(me)})}var pe=w(K,2);{let e=ke(()=>!!t(o));Ae(pe,{get columns(){return ae},get data(){return t($)},get loading(){return t(P)},get error(){return t(o)},get searchTerm(){return t(y)},searchPlaceholder:"Search instances...",get currentPage(){return t(s)},get perPage(){return t(n)},get totalPages(){return t(m)},get totalItems(){return t(l),d(()=>t(l).length)},itemName:"instances",emptyIconType:"cog",get showRetry(){return t(e)},get mobileCardConfig(){return le},$$events:{search:re,pageChange:se,perPageChange:ne,retry:oe,edit:ie,delete:ce,shell:de}})}v(G);var Q=w(G,2);{var fe=e=>{var r=je(),i=h(r),E=h(i);Te(E,{get runnerName(){return t(x),d(()=>t(x).name)},onClose:()=>{a(A,!1),a(x,null)}}),v(i),v(r),b(e,r)};T(Q,e=>{t(A),t(x),d(()=>t(A)&&t(x)&&!R(t(x)))&&e(fe)})}var he=w(Q,2);{var ve=e=>{Pe(e,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return t(g),d(()=>t(g).name)},$$events:{close:()=>{a(I,!1),a(g,null)},confirm:te}})};T(he,e=>{t(I)&&t(g)&&e(ve)})}b(N,B),Z()}export{nt as component}; diff --git a/webapp/assets/_app/immutable/nodes/9.DOPDjgGY.js b/webapp/assets/_app/immutable/nodes/9.DS05dI_2.js similarity index 97% rename from webapp/assets/_app/immutable/nodes/9.DOPDjgGY.js rename to webapp/assets/_app/immutable/nodes/9.DS05dI_2.js index 5d14bb6c..87896df0 100644 --- a/webapp/assets/_app/immutable/nodes/9.DOPDjgGY.js +++ b/webapp/assets/_app/immutable/nodes/9.DS05dI_2.js @@ -1 +1 @@ -import{f as m,h as qe,a as v,s as u,c as Lt,e as Pt,t as Rt}from"../chunks/ZGz3X54u.js";import{i as Fe}from"../chunks/CY7Wcm-1.js";import{p as Ge,o as We,q as Je,l as qt,b as Ke,f as P,t as h,a as Qe,g as t,m as S,u as s,h as b,c as r,s as d,d as f,$ as Xe,r as a,i as Ft}from"../chunks/kDtaAWAK.js";import{i as _,s as Ye,a as Ze}from"../chunks/Cun6jNAp.js";import{e as Gt,i as Wt}from"../chunks/DdT9Vz5Q.js";import{d as M,c as R,g as Jt,s as ut}from"../chunks/Cvcp5xHB.js";import{b as ta}from"../chunks/DochbgGJ.js";import{p as ea}from"../chunks/D3FdGlax.js";import{g as Kt}from"../chunks/BU_V7FOQ.js";import{D as aa}from"../chunks/lQWw1Z23.js";import{S as ra}from"../chunks/-FPg0SOX.js";import{w as sa}from"../chunks/KU08Mex1.js";import{g as q,f as F}from"../chunks/ow_oMtSd.js";import{s as Qt,b as B,d as Xt}from"../chunks/DNHT2U_W.js";import{e as da}from"../chunks/BZiHL9L3.js";import{B as Yt}from"../chunks/DovBLKjH.js";var ia=m('

    Error

    '),la=m('

    Loading instance details...

    '),na=m(' '),oa=m(' '),va=m('-'),ca=m('
    Updated At:
    '),xa=m('
    '),ua=m('
    Network Addresses:
    '),ma=m('
    Network Addresses:
    No addresses available
    '),ga=m('
    OS Type:
    '),fa=m('
    OS Name:
    '),_a=m('
    OS Version:
    '),pa=m('
    OS Architecture:
    '),ha=m('

    '),ya=m('

    Status Messages

    '),ba=m('

    Status Messages

    No status messages available

    '),ka=m('

    Instance Information

    ID:
    Name:
    Provider ID:
    Provider:
    Pool/Scale Set:
    Agent ID:
    Created At:

    Status & Network

    Instance Status:
    Runner Status:
    ',1),wa=m('
    Instance not found.
    '),Ia=m('
    '),Sa=m(' ',1);function Pa(Zt,te){Ge(te,!1);const[ee,ae]=Ye(),mt=()=>Ze(ea,"$page",ee),G=S(),C=S();let e=S(null),W=S(!0),N=S(""),$=S(!1),J=S(!1),z=null,O=S(),K=S(Date.now()),U=null;async function re(){if(t(G))try{f(W,!0),f(N,""),f(e,await Jt.getInstance(t(G)))}catch(n){f(N,n instanceof Error?n.message:"Failed to load instance")}finally{f(W,!1)}}async function se(){if(t(e)){try{await Jt.deleteInstance(t(e).name),Kt(M("/instances"))}catch(n){f(N,da(n))}f($,!1)}}function de(n){if(t(e))if(n.operation==="update"&&n.payload.id===t(e).id){const g=t(e).status_messages?.length||0,k={...t(e),...n.payload},j=k.status_messages?.length||0;f(e,k),j>g&&setTimeout(()=>{Qt(t(O))},100)}else n.operation==="delete"&&(n.payload.id||n.payload)===t(e).id&&Kt(M("/instances"))}We(()=>{re().then(()=>{t(e)?.status_messages?.length&&setTimeout(()=>{Qt(t(O))},100)}),z=sa.subscribeToEntity("instance",["update","delete"],de),U=setInterval(()=>{f(K,Date.now())},1e3)}),Je(()=>{z&&(z(),z=null),U&&(clearInterval(U),U=null)}),qt(()=>mt(),()=>{f(G,decodeURIComponent(mt().params.id||""))}),qt(()=>(t(e),t(K)),()=>{f(C,t(e)?.agent_id?(()=>{if(!t(e).capabilities?.has_shell||t(e).status==="stopped")return!0;const n=t(e).heartbeat;if(!n)return!0;const g=new Date(n);return t(K)-g.getTime()>6e4})():!0)}),Ke(),Fe();var gt=Sa();qe(n=>{h(()=>Xe.title=`${t(e),s(()=>t(e)?`${t(e).name} - Instance Details`:"Instance Details")??""} - GARM`)});var Q=P(gt),X=r(Q),ft=r(X),Y=r(ft),ie=r(Y);a(Y);var _t=d(Y,2),pt=r(_t),ht=d(r(pt),2),le=r(ht,!0);a(ht),a(pt),a(_t),a(ft),a(X);var yt=d(X,2);{var ne=n=>{var g=ia(),k=r(g),j=r(k),V=d(r(j),2),D=r(V,!0);a(V),a(j),a(k),a(g),h(()=>u(D,t(N))),v(n,g)};_(yt,n=>{t(N)&&n(ne)})}var oe=d(yt,2);{var ve=n=>{var g=la();v(n,g)},ce=n=>{var g=Lt(),k=P(g);{var j=D=>{var H=ka(),Z=P(H),tt=r(Z),et=r(tt),kt=d(r(et),2),T=r(kt),ge=d(T,2);a(kt),a(et);var wt=d(et,2),at=r(wt),It=d(r(at),2),fe=r(It,!0);a(It),a(at);var rt=d(at,2),St=d(r(rt),2),_e=r(St,!0);a(St),a(rt);var st=d(rt,2),jt=d(r(st),2),pe=r(jt,!0);a(jt),a(st);var dt=d(st,2),Dt=d(r(dt),2),he=r(Dt,!0);a(Dt),a(dt);var it=d(dt,2),Mt=d(r(it),2),ye=r(Mt);{var be=i=>{var l=na(),o=r(l,!0);a(l),h(c=>{R(l,"href",c),u(o,(t(e),s(()=>t(e).pool_id)))},[()=>(b(M),t(e),s(()=>M(`/pools/${t(e).pool_id}`)))]),v(i,l)},ke=i=>{var l=Lt(),o=P(l);{var c=p=>{var y=oa(),A=r(y,!0);a(y),h(E=>{R(y,"href",E),u(A,(t(e),s(()=>t(e).scale_set_id)))},[()=>(b(M),t(e),s(()=>M(`/scalesets/${t(e).scale_set_id}`)))]),v(p,y)},x=p=>{var y=va();v(p,y)};_(o,p=>{t(e),s(()=>t(e).scale_set_id)?p(c):p(x,!1)},!0)}v(i,l)};_(ye,i=>{t(e),s(()=>t(e).pool_id)?i(be):i(ke,!1)})}a(Mt),a(it);var lt=d(it,2),At=d(r(lt),2),we=r(At,!0);a(At),a(lt);var nt=d(lt,2),Ct=d(r(nt),2),Ie=r(Ct,!0);a(Ct),a(nt);var Se=d(nt,2);{var je=i=>{var l=ca(),o=d(r(l),2),c=r(o,!0);a(o),a(l),h(x=>u(c,x),[()=>(b(B),t(e),s(()=>B(t(e).updated_at)))]),v(i,l)};_(Se,i=>{t(e),s(()=>t(e).updated_at&&t(e).updated_at!==t(e).created_at)&&i(je)})}a(wt),a(tt);var Bt=d(tt,2),Nt=d(r(Bt),2),ot=r(Nt),Tt=d(r(ot),2),vt=r(Tt),De=r(vt,!0);a(vt),a(Tt),a(ot);var ct=d(ot,2),Et=d(r(ct),2),xt=r(Et),Me=r(xt,!0);a(xt),a(Et),a(ct);var $t=d(ct,2);{var Ae=i=>{var l=ua(),o=d(r(l),2);Gt(o,5,()=>(t(e),s(()=>t(e).addresses)),Wt,(c,x)=>{var p=xa(),y=r(p),A=r(y,!0);a(y);var E=d(y,2);{let L=Ft(()=>(t(x),s(()=>t(x).type||"Unknown")));Yt(E,{variant:"info",get text(){return t(L)}})}a(p),h(()=>u(A,(t(x),s(()=>t(x).address)))),v(c,p)}),a(o),a(l),v(i,l)},Ce=i=>{var l=ma();v(i,l)};_($t,i=>{t(e),s(()=>t(e).addresses&&t(e).addresses.length>0)?i(Ae):i(Ce,!1)})}var zt=d($t,2);{var Be=i=>{var l=ga(),o=d(r(l),2),c=r(o,!0);a(o),a(l),h(()=>u(c,(t(e),s(()=>t(e).os_type)))),v(i,l)};_(zt,i=>{t(e),s(()=>t(e).os_type)&&i(Be)})}var Ot=d(zt,2);{var Ne=i=>{var l=fa(),o=d(r(l),2),c=r(o,!0);a(o),a(l),h(()=>u(c,(t(e),s(()=>t(e).os_name)))),v(i,l)};_(Ot,i=>{t(e),s(()=>t(e).os_name)&&i(Ne)})}var Ut=d(Ot,2);{var Te=i=>{var l=_a(),o=d(r(l),2),c=r(o,!0);a(o),a(l),h(()=>u(c,(t(e),s(()=>t(e).os_version)))),v(i,l)};_(Ut,i=>{t(e),s(()=>t(e).os_version)&&i(Te)})}var Ee=d(Ut,2);{var $e=i=>{var l=pa(),o=d(r(l),2),c=r(o,!0);a(o),a(l),h(()=>u(c,(t(e),s(()=>t(e).os_arch)))),v(i,l)};_(Ee,i=>{t(e),s(()=>t(e).os_arch)&&i($e)})}a(Nt),a(Bt),a(Z);var ze=d(Z,2);{var Oe=i=>{var l=ya(),o=d(r(l),2);Gt(o,5,()=>(t(e),s(()=>t(e).status_messages)),Wt,(c,x)=>{var p=ha(),y=r(p),A=r(y),E=r(A,!0);a(A);var L=d(A,2),Vt=r(L);{var Ve=w=>{const I=Ft(()=>(b(Xt),t(x),s(()=>Xt(t(x).event_level))));Yt(w,{get variant(){return b(t(I)),s(()=>t(I).variant)},get text(){return b(t(I)),s(()=>t(I).text)}})};_(Vt,w=>{t(x),s(()=>t(x).event_level)&&w(Ve)})}var Ht=d(Vt,2),He=r(Ht);{var Le=w=>{var I=Rt();h(Re=>u(I,Re),[()=>(b(B),t(x),s(()=>B(t(x).created_at)))]),v(w,I)},Pe=w=>{var I=Rt("Unknown date");v(w,I)};_(He,w=>{t(x),s(()=>t(x).created_at)?w(Le):w(Pe,!1)})}a(Ht),a(L),a(y),a(p),h(()=>u(E,(t(x),s(()=>t(x).message)))),v(c,p)}),a(o),ta(o,c=>f(O,c),()=>t(O)),a(l),v(i,l)},Ue=i=>{var l=ba();v(i,l)};_(ze,i=>{t(e),s(()=>t(e).status_messages&&t(e).status_messages.length>0)?i(Oe):i(Ue,!1)})}h((i,l,o,c,x)=>{T.disabled=t(C),ut(T,1,`px-4 py-2 ${t(C)?"bg-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800 cursor-pointer"} text-white rounded-lg font-medium text-sm flex items-center space-x-2`),R(T,"title",(t(C),t(e),s(()=>t(C)?t(e)?.capabilities?.has_shell?t(e)?.status==="stopped"?"Shell unavailable - Instance is stopped":"Shell unavailable - Agent heartbeat is stale":"Shell unavailable - Agent does not support shell":"Open Shell"))),u(fe,(t(e),s(()=>t(e).id))),u(_e,(t(e),s(()=>t(e).name))),u(pe,(t(e),s(()=>t(e).provider_id))),u(he,(t(e),s(()=>t(e).provider_name||"Unknown"))),u(we,(t(e),s(()=>t(e).agent_id||"Not assigned"))),u(Ie,i),ut(vt,1,`inline-flex px-2 py-1 text-xs font-semibold rounded-full ring-1 ring-inset ${l??""}`),u(De,o),ut(xt,1,`inline-flex px-2 py-1 text-xs font-semibold rounded-full ring-1 ring-inset ${c??""}`),u(Me,x)},[()=>(b(B),t(e),s(()=>B(t(e).created_at))),()=>(b(q),t(e),s(()=>q(t(e).status||"unknown"))),()=>(b(F),t(e),s(()=>F(t(e).status||"unknown"))),()=>(b(q),t(e),s(()=>q(t(e).runner_status||"unknown"))),()=>(b(F),t(e),s(()=>F(t(e).runner_status||"unknown")))]),Pt("click",T,()=>f(J,!0)),Pt("click",ge,()=>f($,!0)),v(D,H)},V=D=>{var H=wa();v(D,H)};_(k,D=>{t(e)?D(j):D(V,!1)},!0)}v(n,g)};_(oe,n=>{t(W)?n(ve):n(ce,!1)})}a(Q);var bt=d(Q,2);{var xe=n=>{var g=Ia(),k=r(g),j=r(k);ra(j,{get runnerName(){return t(e),s(()=>t(e).name)},onClose:()=>f(J,!1)}),a(k),a(g),v(n,g)};_(bt,n=>{t(J)&&t(e)&&!t(C)&&n(xe)})}var ue=d(bt,2);{var me=n=>{aa(n,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return t(e),s(()=>t(e).name)},$$events:{close:()=>f($,!1),confirm:se}})};_(ue,n=>{t($)&&t(e)&&n(me)})}h(n=>{R(ie,"href",n),u(le,(t(e),s(()=>t(e)?t(e).name:"Instance Details")))},[()=>(b(M),s(()=>M("/instances")))]),v(Zt,gt),Qe(),ae()}export{Pa as component}; +import{f as m,h as qe,a as v,s as u,c as Lt,e as Pt,t as Rt}from"../chunks/ZGz3X54u.js";import{i as Fe}from"../chunks/CY7Wcm-1.js";import{p as Ge,o as We,q as Je,l as qt,b as Ke,f as P,t as h,a as Qe,g as t,m as S,u as s,h as b,c as r,s as d,d as f,$ as Xe,r as a,i as Ft}from"../chunks/kDtaAWAK.js";import{i as _,s as Ye,a as Ze}from"../chunks/Cun6jNAp.js";import{e as Gt,i as Wt}from"../chunks/DdT9Vz5Q.js";import{d as M,c as R,g as Jt,s as ut}from"../chunks/CYK-UalN.js";import{b as ta}from"../chunks/DochbgGJ.js";import{p as ea}from"../chunks/DXEzcvud.js";import{g as Kt}from"../chunks/C8dZhfFx.js";import{D as aa}from"../chunks/Dxx83T0m.js";import{S as ra}from"../chunks/DC7O3Apj.js";import{w as sa}from"../chunks/KU08Mex1.js";import{g as q,f as F}from"../chunks/ow_oMtSd.js";import{s as Qt,b as B,d as Xt}from"../chunks/ZelbukuJ.js";import{e as da}from"../chunks/BZiHL9L3.js";import{B as Yt}from"../chunks/DbE0zTOa.js";var ia=m('

    Error

    '),la=m('

    Loading instance details...

    '),na=m(' '),oa=m(' '),va=m('-'),ca=m('
    Updated At:
    '),xa=m('
    '),ua=m('
    Network Addresses:
    '),ma=m('
    Network Addresses:
    No addresses available
    '),ga=m('
    OS Type:
    '),fa=m('
    OS Name:
    '),_a=m('
    OS Version:
    '),pa=m('
    OS Architecture:
    '),ha=m('

    '),ya=m('

    Status Messages

    '),ba=m('

    Status Messages

    No status messages available

    '),ka=m('

    Instance Information

    ID:
    Name:
    Provider ID:
    Provider:
    Pool/Scale Set:
    Agent ID:
    Created At:

    Status & Network

    Instance Status:
    Runner Status:
    ',1),wa=m('
    Instance not found.
    '),Ia=m('
    '),Sa=m(' ',1);function Pa(Zt,te){Ge(te,!1);const[ee,ae]=Ye(),mt=()=>Ze(ea,"$page",ee),G=S(),C=S();let e=S(null),W=S(!0),N=S(""),$=S(!1),J=S(!1),z=null,O=S(),K=S(Date.now()),U=null;async function re(){if(t(G))try{f(W,!0),f(N,""),f(e,await Jt.getInstance(t(G)))}catch(n){f(N,n instanceof Error?n.message:"Failed to load instance")}finally{f(W,!1)}}async function se(){if(t(e)){try{await Jt.deleteInstance(t(e).name),Kt(M("/instances"))}catch(n){f(N,da(n))}f($,!1)}}function de(n){if(t(e))if(n.operation==="update"&&n.payload.id===t(e).id){const g=t(e).status_messages?.length||0,k={...t(e),...n.payload},j=k.status_messages?.length||0;f(e,k),j>g&&setTimeout(()=>{Qt(t(O))},100)}else n.operation==="delete"&&(n.payload.id||n.payload)===t(e).id&&Kt(M("/instances"))}We(()=>{re().then(()=>{t(e)?.status_messages?.length&&setTimeout(()=>{Qt(t(O))},100)}),z=sa.subscribeToEntity("instance",["update","delete"],de),U=setInterval(()=>{f(K,Date.now())},1e3)}),Je(()=>{z&&(z(),z=null),U&&(clearInterval(U),U=null)}),qt(()=>mt(),()=>{f(G,decodeURIComponent(mt().params.id||""))}),qt(()=>(t(e),t(K)),()=>{f(C,t(e)?.agent_id?(()=>{if(!t(e).capabilities?.has_shell||t(e).status==="stopped")return!0;const n=t(e).heartbeat;if(!n)return!0;const g=new Date(n);return t(K)-g.getTime()>6e4})():!0)}),Ke(),Fe();var gt=Sa();qe(n=>{h(()=>Xe.title=`${t(e),s(()=>t(e)?`${t(e).name} - Instance Details`:"Instance Details")??""} - GARM`)});var Q=P(gt),X=r(Q),ft=r(X),Y=r(ft),ie=r(Y);a(Y);var _t=d(Y,2),pt=r(_t),ht=d(r(pt),2),le=r(ht,!0);a(ht),a(pt),a(_t),a(ft),a(X);var yt=d(X,2);{var ne=n=>{var g=ia(),k=r(g),j=r(k),V=d(r(j),2),D=r(V,!0);a(V),a(j),a(k),a(g),h(()=>u(D,t(N))),v(n,g)};_(yt,n=>{t(N)&&n(ne)})}var oe=d(yt,2);{var ve=n=>{var g=la();v(n,g)},ce=n=>{var g=Lt(),k=P(g);{var j=D=>{var H=ka(),Z=P(H),tt=r(Z),et=r(tt),kt=d(r(et),2),T=r(kt),ge=d(T,2);a(kt),a(et);var wt=d(et,2),at=r(wt),It=d(r(at),2),fe=r(It,!0);a(It),a(at);var rt=d(at,2),St=d(r(rt),2),_e=r(St,!0);a(St),a(rt);var st=d(rt,2),jt=d(r(st),2),pe=r(jt,!0);a(jt),a(st);var dt=d(st,2),Dt=d(r(dt),2),he=r(Dt,!0);a(Dt),a(dt);var it=d(dt,2),Mt=d(r(it),2),ye=r(Mt);{var be=i=>{var l=na(),o=r(l,!0);a(l),h(c=>{R(l,"href",c),u(o,(t(e),s(()=>t(e).pool_id)))},[()=>(b(M),t(e),s(()=>M(`/pools/${t(e).pool_id}`)))]),v(i,l)},ke=i=>{var l=Lt(),o=P(l);{var c=p=>{var y=oa(),A=r(y,!0);a(y),h(E=>{R(y,"href",E),u(A,(t(e),s(()=>t(e).scale_set_id)))},[()=>(b(M),t(e),s(()=>M(`/scalesets/${t(e).scale_set_id}`)))]),v(p,y)},x=p=>{var y=va();v(p,y)};_(o,p=>{t(e),s(()=>t(e).scale_set_id)?p(c):p(x,!1)},!0)}v(i,l)};_(ye,i=>{t(e),s(()=>t(e).pool_id)?i(be):i(ke,!1)})}a(Mt),a(it);var lt=d(it,2),At=d(r(lt),2),we=r(At,!0);a(At),a(lt);var nt=d(lt,2),Ct=d(r(nt),2),Ie=r(Ct,!0);a(Ct),a(nt);var Se=d(nt,2);{var je=i=>{var l=ca(),o=d(r(l),2),c=r(o,!0);a(o),a(l),h(x=>u(c,x),[()=>(b(B),t(e),s(()=>B(t(e).updated_at)))]),v(i,l)};_(Se,i=>{t(e),s(()=>t(e).updated_at&&t(e).updated_at!==t(e).created_at)&&i(je)})}a(wt),a(tt);var Bt=d(tt,2),Nt=d(r(Bt),2),ot=r(Nt),Tt=d(r(ot),2),vt=r(Tt),De=r(vt,!0);a(vt),a(Tt),a(ot);var ct=d(ot,2),Et=d(r(ct),2),xt=r(Et),Me=r(xt,!0);a(xt),a(Et),a(ct);var $t=d(ct,2);{var Ae=i=>{var l=ua(),o=d(r(l),2);Gt(o,5,()=>(t(e),s(()=>t(e).addresses)),Wt,(c,x)=>{var p=xa(),y=r(p),A=r(y,!0);a(y);var E=d(y,2);{let L=Ft(()=>(t(x),s(()=>t(x).type||"Unknown")));Yt(E,{variant:"info",get text(){return t(L)}})}a(p),h(()=>u(A,(t(x),s(()=>t(x).address)))),v(c,p)}),a(o),a(l),v(i,l)},Ce=i=>{var l=ma();v(i,l)};_($t,i=>{t(e),s(()=>t(e).addresses&&t(e).addresses.length>0)?i(Ae):i(Ce,!1)})}var zt=d($t,2);{var Be=i=>{var l=ga(),o=d(r(l),2),c=r(o,!0);a(o),a(l),h(()=>u(c,(t(e),s(()=>t(e).os_type)))),v(i,l)};_(zt,i=>{t(e),s(()=>t(e).os_type)&&i(Be)})}var Ot=d(zt,2);{var Ne=i=>{var l=fa(),o=d(r(l),2),c=r(o,!0);a(o),a(l),h(()=>u(c,(t(e),s(()=>t(e).os_name)))),v(i,l)};_(Ot,i=>{t(e),s(()=>t(e).os_name)&&i(Ne)})}var Ut=d(Ot,2);{var Te=i=>{var l=_a(),o=d(r(l),2),c=r(o,!0);a(o),a(l),h(()=>u(c,(t(e),s(()=>t(e).os_version)))),v(i,l)};_(Ut,i=>{t(e),s(()=>t(e).os_version)&&i(Te)})}var Ee=d(Ut,2);{var $e=i=>{var l=pa(),o=d(r(l),2),c=r(o,!0);a(o),a(l),h(()=>u(c,(t(e),s(()=>t(e).os_arch)))),v(i,l)};_(Ee,i=>{t(e),s(()=>t(e).os_arch)&&i($e)})}a(Nt),a(Bt),a(Z);var ze=d(Z,2);{var Oe=i=>{var l=ya(),o=d(r(l),2);Gt(o,5,()=>(t(e),s(()=>t(e).status_messages)),Wt,(c,x)=>{var p=ha(),y=r(p),A=r(y),E=r(A,!0);a(A);var L=d(A,2),Vt=r(L);{var Ve=w=>{const I=Ft(()=>(b(Xt),t(x),s(()=>Xt(t(x).event_level))));Yt(w,{get variant(){return b(t(I)),s(()=>t(I).variant)},get text(){return b(t(I)),s(()=>t(I).text)}})};_(Vt,w=>{t(x),s(()=>t(x).event_level)&&w(Ve)})}var Ht=d(Vt,2),He=r(Ht);{var Le=w=>{var I=Rt();h(Re=>u(I,Re),[()=>(b(B),t(x),s(()=>B(t(x).created_at)))]),v(w,I)},Pe=w=>{var I=Rt("Unknown date");v(w,I)};_(He,w=>{t(x),s(()=>t(x).created_at)?w(Le):w(Pe,!1)})}a(Ht),a(L),a(y),a(p),h(()=>u(E,(t(x),s(()=>t(x).message)))),v(c,p)}),a(o),ta(o,c=>f(O,c),()=>t(O)),a(l),v(i,l)},Ue=i=>{var l=ba();v(i,l)};_(ze,i=>{t(e),s(()=>t(e).status_messages&&t(e).status_messages.length>0)?i(Oe):i(Ue,!1)})}h((i,l,o,c,x)=>{T.disabled=t(C),ut(T,1,`px-4 py-2 ${t(C)?"bg-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800 cursor-pointer"} text-white rounded-lg font-medium text-sm flex items-center space-x-2`),R(T,"title",(t(C),t(e),s(()=>t(C)?t(e)?.capabilities?.has_shell?t(e)?.status==="stopped"?"Shell unavailable - Instance is stopped":"Shell unavailable - Agent heartbeat is stale":"Shell unavailable - Agent does not support shell":"Open Shell"))),u(fe,(t(e),s(()=>t(e).id))),u(_e,(t(e),s(()=>t(e).name))),u(pe,(t(e),s(()=>t(e).provider_id))),u(he,(t(e),s(()=>t(e).provider_name||"Unknown"))),u(we,(t(e),s(()=>t(e).agent_id||"Not assigned"))),u(Ie,i),ut(vt,1,`inline-flex px-2 py-1 text-xs font-semibold rounded-full ring-1 ring-inset ${l??""}`),u(De,o),ut(xt,1,`inline-flex px-2 py-1 text-xs font-semibold rounded-full ring-1 ring-inset ${c??""}`),u(Me,x)},[()=>(b(B),t(e),s(()=>B(t(e).created_at))),()=>(b(q),t(e),s(()=>q(t(e).status||"unknown"))),()=>(b(F),t(e),s(()=>F(t(e).status||"unknown"))),()=>(b(q),t(e),s(()=>q(t(e).runner_status||"unknown"))),()=>(b(F),t(e),s(()=>F(t(e).runner_status||"unknown")))]),Pt("click",T,()=>f(J,!0)),Pt("click",ge,()=>f($,!0)),v(D,H)},V=D=>{var H=wa();v(D,H)};_(k,D=>{t(e)?D(j):D(V,!1)},!0)}v(n,g)};_(oe,n=>{t(W)?n(ve):n(ce,!1)})}a(Q);var bt=d(Q,2);{var xe=n=>{var g=Ia(),k=r(g),j=r(k);ra(j,{get runnerName(){return t(e),s(()=>t(e).name)},onClose:()=>f(J,!1)}),a(k),a(g),v(n,g)};_(bt,n=>{t(J)&&t(e)&&!t(C)&&n(xe)})}var ue=d(bt,2);{var me=n=>{aa(n,{title:"Delete Instance",message:"Are you sure you want to delete this instance? This action cannot be undone.",get itemName(){return t(e),s(()=>t(e).name)},$$events:{close:()=>f($,!1),confirm:se}})};_(ue,n=>{t($)&&t(e)&&n(me)})}h(n=>{R(ie,"href",n),u(le,(t(e),s(()=>t(e)?t(e).name:"Instance Details")))},[()=>(b(M),s(()=>M("/instances")))]),v(Zt,gt),Qe(),ae()}export{Pa as component}; diff --git a/webapp/assets/_app/version.json b/webapp/assets/_app/version.json index 5e1f5feb..12a1624a 100644 --- a/webapp/assets/_app/version.json +++ b/webapp/assets/_app/version.json @@ -1 +1 @@ -{"version":"1770632922070"} \ No newline at end of file +{"version":"1770633185714"} \ No newline at end of file diff --git a/webapp/assets/index.html b/webapp/assets/index.html index e22083f5..dca1eca9 100644 --- a/webapp/assets/index.html +++ b/webapp/assets/index.html @@ -71,12 +71,12 @@ })(); - - + + - - - + + + @@ -86,7 +86,7 @@