From c11251f31358a268d5466f5c7dffa1f9c3ee053f Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 8 May 2026 09:11:41 +0100 Subject: [PATCH] feat: gate hosted app with GitHub org auth --- README.md | 2 + apps/api/cmd/clickclack/main.go | 10 +- apps/api/internal/config/config.go | 15 ++- apps/api/internal/config/config_test.go | 11 +- apps/api/internal/httpapi/github.go | 80 +++++++++++-- apps/api/internal/httpapi/github_test.go | 113 ++++++++++++++++++ apps/api/internal/httpapi/server.go | 26 ++-- apps/api/internal/httpapi/server_test.go | 55 +++++++++ .../webassets/dist/assets/index-BXsmUSij.js | 68 ----------- .../webassets/dist/assets/index-Bi0i2ETT.js | 68 +++++++++++ ...{index-CljoeKn6.css => index-D1YUowl3.css} | 2 +- apps/api/internal/webassets/dist/index.html | 4 +- apps/web/src/ChatApp.svelte | 27 ++++- apps/web/src/lib/api.ts | 11 +- apps/web/src/styles.css | 49 ++++++++ docs/configuration.md | 10 +- docs/deployment.md | 6 +- docs/features/auth.md | 10 +- packages/protocol/openapi.yaml | 2 + packages/sdk-ts/src/generated/openapi.d.ts | 7 ++ 20 files changed, 476 insertions(+), 100 deletions(-) delete mode 100644 apps/api/internal/webassets/dist/assets/index-BXsmUSij.js create mode 100644 apps/api/internal/webassets/dist/assets/index-Bi0i2ETT.js rename apps/api/internal/webassets/dist/assets/{index-CljoeKn6.css => index-D1YUowl3.css} (51%) diff --git a/README.md b/README.md index da16823..a9fe95e 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,8 @@ HTTP endpoint also exists. GitHub OAuth is opt-in via: CLICKCLACK_PUBLIC_URL=https://chat.example.com CLICKCLACK_GITHUB_CLIENT_ID=... CLICKCLACK_GITHUB_CLIENT_SECRET=... +CLICKCLACK_GITHUB_ALLOWED_ORG=openclaw +CLICKCLACK_DEV_BOOTSTRAP=false ``` Details and trade-offs in [docs/features/auth.md](docs/features/auth.md). diff --git a/apps/api/cmd/clickclack/main.go b/apps/api/cmd/clickclack/main.go index 55e1600..7eef087 100644 --- a/apps/api/cmd/clickclack/main.go +++ b/apps/api/cmd/clickclack/main.go @@ -59,7 +59,7 @@ func serve(args []string) error { flags.String("data", "./data", "data directory") flags.String("db", "", "database URL") configPath := flags.String("config", "", "config file") - devBootstrap := flags.Bool("dev-bootstrap", true, "create a local owner/workspace/channel if no user exists") + flags.Bool("dev-bootstrap", true, "create a local owner/workspace/channel if no user exists") if err := flags.Parse(args); err != nil { return err } @@ -82,7 +82,7 @@ func serve(args []string) error { if err := st.Migrate(ctx); err != nil { return err } - if *devBootstrap { + if cfg.DevBootstrap { user, err := st.EnsureBootstrap(ctx, "Local Captain", "local@clickclack.chat") if err != nil { return err @@ -91,11 +91,13 @@ func serve(args []string) error { } log.Printf("ClickClack listening on %s", displayURL(cfg.Addr)) server := httpapi.New(st, realtime.NewHub(), httpapi.Options{ - UploadDir: filepath.Join(cfg.Data, "uploads"), + UploadDir: filepath.Join(cfg.Data, "uploads"), + DisableDevAuth: !cfg.DevBootstrap, GitHubOAuth: httpapi.GitHubOAuthConfig{ ClientID: cfg.GitHubClientID, ClientSecret: cfg.GitHubClientSecret, PublicURL: cfg.PublicURL, + AllowedOrg: cfg.GitHubAllowedOrg, }, }) return httpapi.ListenAndServe(ctx, cfg.Addr, server.Handler()) @@ -309,6 +311,8 @@ func applyFlagOverrides(flags *flag.FlagSet, cfg *config.Config) { cfg.Data = f.Value.String() case "db": cfg.DB = f.Value.String() + case "dev-bootstrap": + cfg.DevBootstrap = f.Value.String() == "true" } }) } diff --git a/apps/api/internal/config/config.go b/apps/api/internal/config/config.go index d4dd3b0..b9b49a1 100644 --- a/apps/api/internal/config/config.go +++ b/apps/api/internal/config/config.go @@ -3,6 +3,7 @@ package config import ( "encoding/json" "os" + "strconv" ) type Config struct { @@ -10,12 +11,14 @@ type Config struct { Data string `json:"data"` DB string `json:"db"` PublicURL string `json:"public_url"` + DevBootstrap bool `json:"dev_bootstrap"` GitHubClientID string `json:"github_client_id"` GitHubClientSecret string `json:"github_client_secret"` + GitHubAllowedOrg string `json:"github_allowed_org"` } func Defaults() Config { - return Config{Addr: ":8080", Data: "./data"} + return Config{Addr: ":8080", Data: "./data", DevBootstrap: true} } func Load(path string) (Config, error) { @@ -32,12 +35,22 @@ func Load(path string) (Config, error) { if env := os.Getenv("CLICKCLACK_PUBLIC_URL"); env != "" { cfg.PublicURL = env } + if env := os.Getenv("CLICKCLACK_DEV_BOOTSTRAP"); env != "" { + value, err := strconv.ParseBool(env) + if err != nil { + return Config{}, err + } + cfg.DevBootstrap = value + } if env := os.Getenv("CLICKCLACK_GITHUB_CLIENT_ID"); env != "" { cfg.GitHubClientID = env } if env := os.Getenv("CLICKCLACK_GITHUB_CLIENT_SECRET"); env != "" { cfg.GitHubClientSecret = env } + if env := os.Getenv("CLICKCLACK_GITHUB_ALLOWED_ORG"); env != "" { + cfg.GitHubAllowedOrg = env + } if path == "" { return cfg, nil } diff --git a/apps/api/internal/config/config_test.go b/apps/api/internal/config/config_test.go index f34d7d2..64d83de 100644 --- a/apps/api/internal/config/config_test.go +++ b/apps/api/internal/config/config_test.go @@ -11,13 +11,15 @@ func TestLoadDefaultsEnvAndFile(t *testing.T) { t.Setenv("CLICKCLACK_DATA", "/tmp/clickclack") t.Setenv("CLICKCLACK_DB", "sqlite:///tmp/clickclack.db") t.Setenv("CLICKCLACK_PUBLIC_URL", "https://clickclack.test") + t.Setenv("CLICKCLACK_DEV_BOOTSTRAP", "false") t.Setenv("CLICKCLACK_GITHUB_CLIENT_ID", "client") t.Setenv("CLICKCLACK_GITHUB_CLIENT_SECRET", "secret") + t.Setenv("CLICKCLACK_GITHUB_ALLOWED_ORG", "openclaw") cfg, err := Load("") if err != nil { t.Fatal(err) } - if cfg.Addr != ":9000" || cfg.Data != "/tmp/clickclack" || cfg.DB != "sqlite:///tmp/clickclack.db" || cfg.PublicURL != "https://clickclack.test" || cfg.GitHubClientID != "client" || cfg.GitHubClientSecret != "secret" { + if cfg.Addr != ":9000" || cfg.Data != "/tmp/clickclack" || cfg.DB != "sqlite:///tmp/clickclack.db" || cfg.PublicURL != "https://clickclack.test" || cfg.DevBootstrap || cfg.GitHubClientID != "client" || cfg.GitHubClientSecret != "secret" || cfg.GitHubAllowedOrg != "openclaw" { t.Fatalf("unexpected env config: %#v", cfg) } @@ -37,8 +39,10 @@ func TestLoadDefaultsEnvAndFile(t *testing.T) { t.Setenv("CLICKCLACK_DATA", "") t.Setenv("CLICKCLACK_DB", "") t.Setenv("CLICKCLACK_PUBLIC_URL", "") + t.Setenv("CLICKCLACK_DEV_BOOTSTRAP", "") t.Setenv("CLICKCLACK_GITHUB_CLIENT_ID", "") t.Setenv("CLICKCLACK_GITHUB_CLIENT_SECRET", "") + t.Setenv("CLICKCLACK_GITHUB_ALLOWED_ORG", "") emptyPath := filepath.Join(t.TempDir(), "empty.json") if err := os.WriteFile(emptyPath, []byte(`{}`), 0o644); err != nil { t.Fatal(err) @@ -53,6 +57,11 @@ func TestLoadDefaultsEnvAndFile(t *testing.T) { if _, err := Load(filepath.Join(t.TempDir(), "missing.json")); err == nil { t.Fatal("expected missing config error") } + t.Setenv("CLICKCLACK_DEV_BOOTSTRAP", "not-bool") + if _, err := Load(""); err == nil { + t.Fatal("expected bad bool env error") + } + t.Setenv("CLICKCLACK_DEV_BOOTSTRAP", "") badPath := filepath.Join(t.TempDir(), "bad.json") if err := os.WriteFile(badPath, []byte(`{`), 0o644); err != nil { t.Fatal(err) diff --git a/apps/api/internal/httpapi/github.go b/apps/api/internal/httpapi/github.go index 0145e72..ab67d7e 100644 --- a/apps/api/internal/httpapi/github.go +++ b/apps/api/internal/httpapi/github.go @@ -6,6 +6,7 @@ import ( "encoding/hex" "encoding/json" "errors" + "fmt" "net/http" "net/url" "strconv" @@ -16,16 +17,20 @@ import ( ) type GitHubOAuthConfig struct { - ClientID string - ClientSecret string - PublicURL string - AuthURL string - TokenURL string - UserURL string - EmailsURL string - HTTPClient *http.Client + ClientID string + ClientSecret string + PublicURL string + AuthURL string + TokenURL string + UserURL string + EmailsURL string + MembershipURL string + AllowedOrg string + HTTPClient *http.Client } +var errGitHubOrgDenied = errors.New("github account is not a member of the allowed organization") + func (c GitHubOAuthConfig) withDefaults() GitHubOAuthConfig { if c.AuthURL == "" { c.AuthURL = "https://github.com/login/oauth/authorize" @@ -39,6 +44,9 @@ func (c GitHubOAuthConfig) withDefaults() GitHubOAuthConfig { if c.EmailsURL == "" { c.EmailsURL = "https://api.github.com/user/emails" } + if c.MembershipURL == "" { + c.MembershipURL = "https://api.github.com/user/memberships/orgs/" + } if c.HTTPClient == nil { c.HTTPClient = http.DefaultClient } @@ -59,7 +67,7 @@ func (s *Server) githubStart(w http.ResponseWriter, r *http.Request) { values := url.Values{ "client_id": {s.githubOAuth.ClientID}, "redirect_uri": {s.githubRedirectURL(r)}, - "scope": {"read:user user:email"}, + "scope": {s.githubScope()}, "state": {state}, } http.Redirect(w, r, s.githubOAuth.AuthURL+"?"+values.Encode(), http.StatusFound) @@ -86,6 +94,14 @@ func (s *Server) githubCallback(w http.ResponseWriter, r *http.Request) { writeError(w, http.StatusBadGateway, err) return } + if err := s.ensureGitHubOrgMembership(r.Context(), token); err != nil { + if errors.Is(err, errGitHubOrgDenied) { + writeError(w, http.StatusForbidden, err) + return + } + writeError(w, http.StatusBadGateway, err) + return + } user, err := s.store.UpsertIdentityUser(r.Context(), store.UpsertIdentityUserInput{ Provider: "github", ProviderSubject: strconv.FormatInt(profile.ID, 10), @@ -195,6 +211,52 @@ func (s *Server) githubGetJSON(ctx context.Context, endpoint, token string, out return json.NewDecoder(resp.Body).Decode(out) } +func (s *Server) ensureGitHubOrgMembership(ctx context.Context, token string) error { + org := strings.TrimSpace(s.githubOAuth.AllowedOrg) + if org == "" { + return nil + } + endpoint := strings.TrimRight(s.githubOAuth.MembershipURL, "/") + "/" + url.PathEscape(org) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil) + if err != nil { + return err + } + req.Header.Set("Accept", "application/json") + req.Header.Set("Authorization", "Bearer "+token) + resp, err := s.githubOAuth.HTTPClient.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode == http.StatusNotFound || resp.StatusCode == http.StatusForbidden { + return errGitHubOrgDenied + } + if resp.StatusCode >= 300 { + return fmt.Errorf("github organization membership check failed: %s", resp.Status) + } + var membership struct { + State string `json:"state"` + Organization struct { + Login string `json:"login"` + } `json:"organization"` + } + if err := json.NewDecoder(resp.Body).Decode(&membership); err != nil { + return err + } + if !strings.EqualFold(membership.State, "active") || !strings.EqualFold(membership.Organization.Login, org) { + return errGitHubOrgDenied + } + return nil +} + +func (s *Server) githubScope() string { + scope := "read:user user:email" + if strings.TrimSpace(s.githubOAuth.AllowedOrg) != "" { + scope += " read:org" + } + return scope +} + func (s *Server) githubRedirectURL(r *http.Request) string { base := strings.TrimRight(s.githubOAuth.PublicURL, "/") if base == "" { diff --git a/apps/api/internal/httpapi/github_test.go b/apps/api/internal/httpapi/github_test.go index 04ad4ce..ee86c08 100644 --- a/apps/api/internal/httpapi/github_test.go +++ b/apps/api/internal/httpapi/github_test.go @@ -6,6 +6,7 @@ import ( "encoding/json" "net/http" "net/http/httptest" + "net/url" "path/filepath" "strings" "testing" @@ -176,6 +177,109 @@ func TestGitHubOAuthFlow(t *testing.T) { } } +func TestGitHubOAuthAllowedOrg(t *testing.T) { + t.Parallel() + ctx := context.Background() + dataDir := t.TempDir() + st, err := sqlitestore.Open("sqlite://" + filepath.Join(dataDir, "clickclack.db")) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = st.Close() }) + if err := st.Migrate(ctx); err != nil { + t.Fatal(err) + } + + provider := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/token": + if err := r.ParseForm(); err != nil { + t.Fatal(err) + } + switch r.FormValue("code") { + case "member": + _ = json.NewEncoder(w).Encode(map[string]string{"access_token": "member-token"}) + case "denied": + _ = json.NewEncoder(w).Encode(map[string]string{"access_token": "denied-token"}) + default: + w.WriteHeader(http.StatusBadRequest) + } + case "/user": + _ = json.NewEncoder(w).Encode(map[string]any{"id": 42, "login": "octo", "email": "octo@example.com"}) + case "/memberships/orgs/openclaw": + if r.Header.Get("Authorization") == "Bearer denied-token" { + w.WriteHeader(http.StatusNotFound) + return + } + _ = json.NewEncoder(w).Encode(map[string]any{ + "state": "active", + "organization": map[string]any{"login": "OpenClaw"}, + }) + default: + w.WriteHeader(http.StatusNotFound) + } + })) + t.Cleanup(provider.Close) + + server := httptest.NewServer(New(st, realtime.NewHub(), Options{GitHubOAuth: GitHubOAuthConfig{ + ClientID: "client", + ClientSecret: "secret", + AuthURL: provider.URL + "/authorize", + TokenURL: provider.URL + "/token", + UserURL: provider.URL + "/user", + EmailsURL: provider.URL + "/emails", + MembershipURL: provider.URL + "/memberships/orgs/", + AllowedOrg: "openclaw", + }}).Handler()) + t.Cleanup(server.Close) + client := &http.Client{CheckRedirect: func(_ *http.Request, _ []*http.Request) error { return http.ErrUseLastResponse }} + + resp, err := client.Get(server.URL + "/api/auth/github/start") + if err != nil { + t.Fatal(err) + } + location, err := url.Parse(resp.Header.Get("Location")) + if err != nil { + t.Fatal(err) + } + if scope := location.Query().Get("scope"); scope != "read:user user:email read:org" { + t.Fatalf("unexpected scope %q", scope) + } + stateCookie := findCookie(resp.Cookies(), "cc_github_state") + resp.Body.Close() + if stateCookie == nil { + t.Fatal("expected state cookie") + } + + req, err := http.NewRequest(http.MethodGet, server.URL+"/api/auth/github/callback?code=member&state="+stateCookie.Value, nil) + if err != nil { + t.Fatal(err) + } + req.AddCookie(stateCookie) + resp, err = client.Do(req) + if err != nil { + t.Fatal(err) + } + if resp.StatusCode != http.StatusFound { + t.Fatalf("expected member callback redirect, got %s", resp.Status) + } + resp.Body.Close() + + req, err = http.NewRequest(http.MethodGet, server.URL+"/api/auth/github/callback?code=denied&state="+stateCookie.Value, nil) + if err != nil { + t.Fatal(err) + } + req.AddCookie(stateCookie) + resp, err = client.Do(req) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusForbidden { + t.Fatalf("expected org denied, got %s", resp.Status) + } +} + func TestGitHubOAuthErrors(t *testing.T) { t.Parallel() st := newEmptyHTTPStore(t) @@ -198,3 +302,12 @@ func TestGitHubOAuthErrors(t *testing.T) { t.Fatal("expected bad github api url error") } } + +func findCookie(cookies []*http.Cookie, name string) *http.Cookie { + for _, cookie := range cookies { + if cookie.Name == name { + return cookie + } + } + return nil +} diff --git a/apps/api/internal/httpapi/server.go b/apps/api/internal/httpapi/server.go index 5f2a68f..8f01398 100644 --- a/apps/api/internal/httpapi/server.go +++ b/apps/api/internal/httpapi/server.go @@ -20,19 +20,27 @@ import ( ) type Server struct { - store store.Store - hub *realtime.Hub - uploadDir string - githubOAuth GitHubOAuthConfig + store store.Store + hub *realtime.Hub + uploadDir string + githubOAuth GitHubOAuthConfig + disableDevAuth bool } type Options struct { - UploadDir string - GitHubOAuth GitHubOAuthConfig + UploadDir string + GitHubOAuth GitHubOAuthConfig + DisableDevAuth bool } func New(st store.Store, hub *realtime.Hub, options Options) *Server { - return &Server{store: st, hub: hub, uploadDir: options.UploadDir, githubOAuth: options.GitHubOAuth.withDefaults()} + return &Server{ + store: st, + hub: hub, + uploadDir: options.UploadDir, + githubOAuth: options.GitHubOAuth.withDefaults(), + disableDevAuth: options.DisableDevAuth, + } } func (s *Server) Handler() http.Handler { @@ -78,6 +86,7 @@ func (s *Server) Handler() http.Handler { }) r.NotFound(s.serveSPA) + r.Head("/*", s.serveSPA) r.Get("/*", s.serveSPA) return r } @@ -315,6 +324,9 @@ func (s *Server) currentUser(r *http.Request) (store.User, error) { if cookie, err := r.Cookie("cc_session"); err == nil && cookie.Value != "" { return s.store.GetSessionUser(r.Context(), cookie.Value) } + if s.disableDevAuth { + return store.User{}, errors.New("authentication required") + } if id := r.Header.Get("X-ClickClack-User"); id != "" { return s.store.GetUser(r.Context(), id) } diff --git a/apps/api/internal/httpapi/server_test.go b/apps/api/internal/httpapi/server_test.go index defb0e3..4d1cd60 100644 --- a/apps/api/internal/httpapi/server_test.go +++ b/apps/api/internal/httpapi/server_test.go @@ -45,6 +45,8 @@ func TestChatAPIVerticalSlice(t *testing.T) { server := httptest.NewServer(New(st, hub, Options{UploadDir: filepath.Join(dataDir, "uploads")}).Handler()) t.Cleanup(server.Close) + expectStatus(t, http.MethodHead, server.URL+"/", nil, http.StatusOK) + me := getJSON[struct { User store.User `json:"user"` }](t, server.URL+"/api/me") @@ -421,6 +423,59 @@ func getBody(t *testing.T, endpoint string) string { return string(body) } +func TestDisableDevAuthRequiresSession(t *testing.T) { + t.Parallel() + ctx := context.Background() + dataDir := t.TempDir() + st, err := sqlitestore.Open("sqlite://" + filepath.Join(dataDir, "clickclack.db")) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = st.Close() }) + if err := st.Migrate(ctx); err != nil { + t.Fatal(err) + } + owner, err := st.EnsureBootstrap(ctx, "Owner", "owner@example.com") + if err != nil { + t.Fatal(err) + } + server := httptest.NewServer(New(st, realtime.NewHub(), Options{DisableDevAuth: true}).Handler()) + t.Cleanup(server.Close) + + expectStatus(t, http.MethodGet, server.URL+"/api/me", nil, http.StatusUnauthorized) + req, err := http.NewRequest(http.MethodGet, server.URL+"/api/me", nil) + if err != nil { + t.Fatal(err) + } + req.Header.Set("X-ClickClack-User", owner.ID) + resp, err := http.DefaultClient.Do(req) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusUnauthorized { + t.Fatalf("expected dev user header to be ignored, got %s", resp.Status) + } + + session, err := st.CreateSession(ctx, owner.ID) + if err != nil { + t.Fatal(err) + } + req, err = http.NewRequest(http.MethodGet, server.URL+"/api/me", nil) + if err != nil { + t.Fatal(err) + } + req.AddCookie(&http.Cookie{Name: "cc_session", Value: session.Token}) + resp, err = http.DefaultClient.Do(req) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("expected session auth, got %s", resp.Status) + } +} + func readEventType(t *testing.T, conn *websocket.Conn, eventType string) store.Event { t.Helper() ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) diff --git a/apps/api/internal/webassets/dist/assets/index-BXsmUSij.js b/apps/api/internal/webassets/dist/assets/index-BXsmUSij.js deleted file mode 100644 index 1b80a05..0000000 --- a/apps/api/internal/webassets/dist/assets/index-BXsmUSij.js +++ /dev/null @@ -1,68 +0,0 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();const wa=!1;var ps=Array.isArray,ya=Array.prototype.indexOf,_n=Array.prototype.includes,Or=Array.from,xa=Object.defineProperty,Zn=Object.getOwnPropertyDescriptor,hs=Object.getOwnPropertyDescriptors,Ta=Object.prototype,Ea=Array.prototype,pi=Object.getPrototypeOf,Mi=Object.isExtensible;const Sa=()=>{};function Aa(e){return e()}function Qr(e){for(var t=0;t{e=i,t=r});return{promise:n,resolve:e,reject:t}}const de=2,vn=4,tr=8,gs=1<<24,rt=16,Ve=32,Tt=64,Kr=128,ze=512,ie=1024,fe=2048,Xe=4096,ke=8192,$e=16384,jt=32768,Pi=1<<25,bn=65536,Jr=1<<17,ms=1<<18,Yt=1<<19,_s=1<<20,nt=1<<25,Ht=65536,Sr=1<<21,Kn=1<<22,yt=1<<23,Vn=Symbol("$state"),Ra=Symbol(""),ut=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function vs(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Ia(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Ca(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Oa(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Da(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function La(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Na(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Ma(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Pa(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function za(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function $a(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Fa=1,Ua=2,bs=4,Ba=8,Ha=16,Ga=1,Wa=2,oe=Symbol(),ks="http://www.w3.org/1999/xhtml",qa="http://www.w3.org/2000/svg",ja="http://www.w3.org/1998/Math/MathML";function Ya(){console.warn("https://svelte.dev/e/derived_inert")}function Za(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function ws(e){return e===this.v}function Va(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function ys(e){return!Va(e,this.v)}let nr=!1,Xa=!1;function Qa(){nr=!0}let j=null;function kn(e){j=e}function hi(e,t=!1,n){j={p:j,i:!1,c:null,e:null,s:e,x:null,r:L,l:nr&&!t?{s:null,u:null,$:[]}:null}}function di(e){var t=j,n=t.e;if(n!==null){t.e=null;for(var i of n)qs(i)}return t.i=!0,j=t.p,{}}function rr(){return!nr||j!==null&&j.l===null}let zt=[];function xs(){var e=zt;zt=[],Qr(e)}function xt(e){if(zt.length===0&&!Xn){var t=zt;queueMicrotask(()=>{t===zt&&xs()})}zt.push(e)}function Ka(){for(;zt.length>0;)xs()}function Ts(e){var t=L;if(t===null)return P.f|=yt,e;if((t.f&jt)===0&&(t.f&vn)===0)throw e;kt(e,t)}function kt(e,t){for(;t!==null;){if((t.f&Kr)!==0){if((t.f&jt)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const Ja=-7169;function Q(e,t){e.f=e.f&Ja|t}function gi(e){(e.f&ze)!==0||e.deps===null?Q(e,ie):Q(e,Xe)}function Es(e){if(e!==null)for(const t of e)(t.f&de)===0||(t.f&Ht)===0||(t.f^=Ht,Es(t.deps))}function Ss(e,t,n){(e.f&fe)!==0?t.add(e):(e.f&Xe)!==0&&n.add(e),Es(e.deps),Q(e,ie)}const Nt=new Set;let O=null,Ye=null,ei=null,Xn=!1,Br=!1,mn=null,xr=null;var zi=0;let el=1;class Et{id=el++;current=new Map;previous=new Map;#n=new Set;#o=new Set;#e=new Set;#i=new Map;#r=new Map;#s=null;#t=[];#a=[];#c=new Set;#u=new Set;#l=new Map;#p=new Set;is_fork=!1;#d=!1;#h=new Set;#f(){return this.is_fork||this.#r.size>0}#_(){for(const i of this.#h)for(const r of i.#r.keys()){for(var t=!1,n=r;n.parent!==null;){if(this.#l.has(n)){t=!0;break}n=n.parent}if(!t)return!0}return!1}skip_effect(t){this.#l.has(t)||this.#l.set(t,{d:[],m:[]}),this.#p.delete(t)}unskip_effect(t,n=i=>this.schedule(i)){var i=this.#l.get(t);if(i){this.#l.delete(t);for(var r of i.d)Q(r,fe),n(r);for(r of i.m)Q(r,Xe),n(r)}this.#p.add(t)}#g(){if(zi++>1e3&&(Nt.delete(this),nl()),!this.#f()){for(const o of this.#c)this.#u.delete(o),Q(o,fe),this.schedule(o);for(const o of this.#u)Q(o,Xe),this.schedule(o)}const t=this.#t;this.#t=[],this.apply();var n=mn=[],i=[],r=xr=[];for(const o of t)try{this.#v(o,n,i)}catch(l){throw Is(o),l}if(O=null,r.length>0){var s=Et.ensure();for(const o of r)s.schedule(o)}if(mn=null,xr=null,this.#f()||this.#_()){this.#m(i),this.#m(n);for(const[o,l]of this.#l)Rs(o,l)}else{this.#i.size===0&&Nt.delete(this),this.#c.clear(),this.#u.clear();for(const o of this.#n)o(this);this.#n.clear(),$i(i),$i(n),this.#s?.resolve()}var a=O;if(this.#t.length>0){const o=a??=this;o.#t.push(...this.#t.filter(l=>!o.#t.includes(l)))}a!==null&&(Nt.add(a),a.#g())}#v(t,n,i){t.f^=ie;for(var r=t.first;r!==null;){var s=r.f,a=(s&(Ve|Tt))!==0,o=a&&(s&ie)!==0,l=o||(s&ke)!==0||this.#l.has(r);if(!l&&r.fn!==null){a?r.f^=ie:(s&vn)!==0?n.push(r):yn(r)&&((s&rt)!==0&&this.#u.add(r),Wt(r));var f=r.first;if(f!==null){r=f;continue}}for(;r!==null;){var u=r.next;if(u!==null){r=u;break}r=r.parent}}}#m(t){for(var n=0;n!this.current.has(h));if(r.length===0)t&&u.discard();else if(n.length>0){if(t)for(const h of this.#p)u.unskip_effect(h,d=>{(d.f&(rt|Kn))!==0?u.schedule(d):u.#m([d])});u.activate();var s=new Set,a=new Map;for(var o of n)As(o,r,s,a);a=new Map;var l=[...u.current.keys()].filter(h=>this.current.has(h)?this.current.get(h)[0]!==h:!0);for(const h of this.#a)(h.f&($e|ke|Jr))===0&&mi(h,l,a)&&((h.f&(Kn|rt))!==0?(Q(h,fe),u.schedule(h)):u.#c.add(h));if(u.#t.length>0){u.apply();for(var f of u.#t)u.#v(f,[],[]);u.#t=[]}u.deactivate()}}for(const u of Nt)u.#h.has(this)&&(u.#h.delete(this),u.#h.size===0&&!u.#f()&&(u.activate(),u.#g()))}increment(t,n){let i=this.#i.get(n)??0;if(this.#i.set(n,i+1),t){let r=this.#r.get(n)??0;this.#r.set(n,r+1)}}decrement(t,n,i){let r=this.#i.get(n)??0;if(r===1?this.#i.delete(n):this.#i.set(n,r-1),t){let s=this.#r.get(n)??0;s===1?this.#r.delete(n):this.#r.set(n,s-1)}this.#d||i||(this.#d=!0,xt(()=>{this.#d=!1,this.flush()}))}transfer_effects(t,n){for(const i of t)this.#c.add(i);for(const i of n)this.#u.add(i);t.clear(),n.clear()}oncommit(t){this.#n.add(t)}ondiscard(t){this.#o.add(t)}on_fork_commit(t){this.#e.add(t)}run_fork_commit_callbacks(){for(const t of this.#e)t(this);this.#e.clear()}settled(){return(this.#s??=ds()).promise}static ensure(){if(O===null){const t=O=new Et;Br||(Nt.add(O),Xn||xt(()=>{O===t&&t.flush()}))}return O}apply(){{Ye=null;return}}schedule(t){if(ei=t,t.b?.is_pending&&(t.f&(vn|tr|gs))!==0&&(t.f&jt)===0){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var i=n.f;if(mn!==null&&n===L&&(P===null||(P.f&de)===0))return;if((i&(Tt|Ve))!==0){if((i&ie)===0)return;n.f^=ie}}this.#t.push(n)}}function tl(e){var t=Xn;Xn=!0;try{for(var n;;){if(Ka(),O===null)return n;O.flush()}}finally{Xn=t}}function nl(){try{Na()}catch(e){kt(e,ei)}}let ct=null;function $i(e){var t=e.length;if(t!==0){for(var n=0;n0)){Ft.clear();for(const r of ct){if((r.f&($e|ke))!==0)continue;const s=[r];let a=r.parent;for(;a!==null;)ct.has(a)&&(ct.delete(a),s.push(a)),a=a.parent;for(let o=s.length-1;o>=0;o--){const l=s[o];(l.f&($e|ke))===0&&Wt(l)}}ct.clear()}}ct=null}}function As(e,t,n,i){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const r of e.reactions){const s=r.f;(s&de)!==0?As(r,t,n,i):(s&(Kn|rt))!==0&&(s&fe)===0&&mi(r,t,i)&&(Q(r,fe),_i(r))}}function mi(e,t,n){const i=n.get(e);if(i!==void 0)return i;if(e.deps!==null)for(const r of e.deps){if(_n.call(t,r))return!0;if((r.f&de)!==0&&mi(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function _i(e){O.schedule(e)}function Rs(e,t){if(!((e.f&Ve)!==0&&(e.f&ie)!==0)){(e.f&fe)!==0?t.d.push(e):(e.f&Xe)!==0&&t.m.push(e),Q(e,ie);for(var n=e.first;n!==null;)Rs(n,t),n=n.next}}function Is(e){Q(e,ie);for(var t=e.first;t!==null;)Is(t),t=t.next}function rl(e){let t=0,n=Gt(0),i;return()=>{ki()&&(p(n),Lr(()=>(t===0&&(i=$(()=>e(()=>Qn(n)))),t+=1,()=>{xt(()=>{t-=1,t===0&&(i?.(),i=void 0,Qn(n))})})))}}var il=bn|Yt;function sl(e,t,n,i){new al(e,t,n,i)}class al{parent;is_pending=!1;transform_error;#n;#o=null;#e;#i;#r;#s=null;#t=null;#a=null;#c=null;#u=0;#l=0;#p=!1;#d=new Set;#h=new Set;#f=null;#_=rl(()=>(this.#f=Gt(this.#u),()=>{this.#f=null}));constructor(t,n,i,r){this.#n=t,this.#e=n,this.#i=s=>{var a=L;a.b=this,a.f|=Kr,i(s)},this.parent=L.b,this.transform_error=r??this.parent?.transform_error??(s=>s),this.#r=Nr(()=>{this.#b()},il)}#g(){try{this.#s=Pe(()=>this.#i(this.#n))}catch(t){this.error(t)}}#v(t){const n=this.#e.failed;n&&(this.#a=Pe(()=>{n(this.#n,()=>t,()=>()=>{})}))}#m(){const t=this.#e.pending;t&&(this.is_pending=!0,this.#t=Pe(()=>t(this.#n)),xt(()=>{var n=this.#c=document.createDocumentFragment(),i=ft();n.append(i),this.#s=this.#w(()=>Pe(()=>this.#i(i))),this.#l===0&&(this.#n.before(n),this.#c=null,Ut(this.#t,()=>{this.#t=null}),this.#k(O))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#l=0,this.#u=0,this.#s=Pe(()=>{this.#i(this.#n)}),this.#l>0){var t=this.#c=document.createDocumentFragment();xi(this.#s,t);const n=this.#e.pending;this.#t=Pe(()=>n(this.#n))}else this.#k(O)}catch(n){this.error(n)}}#k(t){this.is_pending=!1,t.transfer_effects(this.#d,this.#h)}defer_effect(t){Ss(t,this.#d,this.#h)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#e.pending}#w(t){var n=L,i=P,r=j;Be(this.#r),Ue(this.#r),kn(this.#r.ctx);try{return Et.ensure(),t()}catch(s){return Ts(s),null}finally{Be(n),Ue(i),kn(r)}}#y(t,n){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(t,n);return}this.#l+=t,this.#l===0&&(this.#k(n),this.#t&&Ut(this.#t,()=>{this.#t=null}),this.#c&&(this.#n.before(this.#c),this.#c=null))}update_pending_count(t,n){this.#y(t,n),this.#u+=t,!(!this.#f||this.#p)&&(this.#p=!0,xt(()=>{this.#p=!1,this.#f&&wn(this.#f,this.#u)}))}get_effect_pending(){return this.#_(),p(this.#f)}error(t){if(!this.#e.onerror&&!this.#e.failed)throw t;O?.is_fork?(this.#s&&O.skip_effect(this.#s),this.#t&&O.skip_effect(this.#t),this.#a&&O.skip_effect(this.#a),O.on_fork_commit(()=>{this.#x(t)})):this.#x(t)}#x(t){this.#s&&(Ae(this.#s),this.#s=null),this.#t&&(Ae(this.#t),this.#t=null),this.#a&&(Ae(this.#a),this.#a=null);var n=this.#e.onerror;let i=this.#e.failed;var r=!1,s=!1;const a=()=>{if(r){Za();return}r=!0,s&&$a(),this.#a!==null&&Ut(this.#a,()=>{this.#a=null}),this.#w(()=>{this.#b()})},o=l=>{try{s=!0,n?.(l,a),s=!1}catch(f){kt(f,this.#r&&this.#r.parent)}i&&(this.#a=this.#w(()=>{try{return Pe(()=>{var f=L;f.b=this,f.f|=Kr,i(this.#n,()=>l,()=>a)})}catch(f){return kt(f,this.#r.parent),null}}))};xt(()=>{var l;try{l=this.transform_error(t)}catch(f){kt(f,this.#r&&this.#r.parent);return}l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(o,f=>kt(f,this.#r&&this.#r.parent)):o(l)})}}function ll(e,t,n,i){const r=rr()?vi:Os;var s=e.filter(d=>!d.settled);if(n.length===0&&s.length===0){i(t.map(r));return}var a=L,o=ol(),l=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(d=>d.promise)):null;function f(d){o();try{i(d)}catch(v){(a.f&$e)===0&&kt(v,a)}Ar()}if(n.length===0){l.then(()=>f(t.map(r)));return}var u=Cs();function h(){Promise.all(n.map(d=>cl(d))).then(d=>f([...t.map(r),...d])).catch(d=>kt(d,a)).finally(()=>u())}l?l.then(()=>{o(),h(),Ar()}):h()}function ol(){var e=L,t=P,n=j,i=O;return function(s=!0){Be(e),Ue(t),kn(n),s&&(e.f&$e)===0&&(i?.activate(),i?.apply())}}function Ar(e=!0){Be(null),Ue(null),kn(null),e&&O?.deactivate()}function Cs(){var e=L,t=e.b,n=O,i=t.is_rendered();return t.update_pending_count(1,n),n.increment(i,e),(r=!1)=>{t.update_pending_count(-1,n),n.decrement(i,e,r)}}function vi(e){var t=de|fe;return L!==null&&(L.f|=Yt),{ctx:j,deps:null,effects:null,equals:ws,f:t,fn:e,reactions:null,rv:0,v:oe,wv:0,parent:L,ac:null}}function cl(e,t,n){let i=L;i===null&&Ia();var r=void 0,s=Gt(oe),a=!P,o=new Map;return yl(()=>{var l=L,f=ds();r=f.promise;try{Promise.resolve(e()).then(f.resolve,f.reject).finally(Ar)}catch(v){f.reject(v),Ar()}var u=O;if(a){if((l.f&jt)!==0)var h=Cs();if(i.b.is_rendered())o.get(u)?.reject(ut),o.delete(u);else{for(const v of o.values())v.reject(ut);o.clear()}o.set(u,f)}const d=(v,_=void 0)=>{if(h){var S=_===ut;h(S)}if(!(_===ut||(l.f&$e)!==0)){if(u.activate(),_)s.f|=yt,wn(s,_);else{(s.f&yt)!==0&&(s.f^=yt),wn(s,v);for(const[b,A]of o){if(o.delete(b),b===u)break;A.reject(ut)}}u.deactivate()}};f.promise.then(d,v=>d(null,v||"unknown"))}),Ws(()=>{for(const l of o.values())l.reject(ut)}),new Promise(l=>{function f(u){function h(){u===r?l(s):f(r)}u.then(h,h)}f(r)})}function Os(e){const t=vi(e);return t.equals=ys,t}function ul(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n0&&!Ns&&pl()}return t}function pl(){Ns=!1;for(const e of ti)(e.f&ie)!==0&&Q(e,Xe),yn(e)&&Wt(e);ti.clear()}function Qn(e){y(e,e.v+1)}function Ms(e,t,n){var i=e.reactions;if(i!==null)for(var r=rr(),s=i.length,a=0;a{if(Bt===s)return o();var l=P,f=Bt;Ue(null),Hi(s);var u=o();return Ue(l),Hi(f),u};return i&&n.set("length",vt(e.length)),new Proxy(e,{defineProperty(o,l,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&Ma();var u=n.get(l);return u===void 0?a(()=>{var h=vt(f.value);return n.set(l,h),h}):y(u,f.value,!0),!0},deleteProperty(o,l){var f=n.get(l);if(f===void 0){if(l in o){const u=a(()=>vt(oe));n.set(l,u),Qn(r)}}else y(f,oe),Qn(r);return!0},get(o,l,f){if(l===Vn)return e;var u=n.get(l),h=l in o;if(u===void 0&&(!h||Zn(o,l)?.writable)&&(u=a(()=>{var v=Hn(h?o[l]:oe),_=vt(v);return _}),n.set(l,u)),u!==void 0){var d=p(u);return d===oe?void 0:d}return Reflect.get(o,l,f)},getOwnPropertyDescriptor(o,l){var f=Reflect.getOwnPropertyDescriptor(o,l);if(f&&"value"in f){var u=n.get(l);u&&(f.value=p(u))}else if(f===void 0){var h=n.get(l),d=h?.v;if(h!==void 0&&d!==oe)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return f},has(o,l){if(l===Vn)return!0;var f=n.get(l),u=f!==void 0&&f.v!==oe||Reflect.has(o,l);if(f!==void 0||L!==null&&(!u||Zn(o,l)?.writable)){f===void 0&&(f=a(()=>{var d=u?Hn(o[l]):oe,v=vt(d);return v}),n.set(l,f));var h=p(f);if(h===oe)return!1}return u},set(o,l,f,u){var h=n.get(l),d=l in o;if(i&&l==="length")for(var v=f;vvt(oe)),n.set(v+"",_))}if(h===void 0)(!d||Zn(o,l)?.writable)&&(h=a(()=>vt(void 0)),y(h,Hn(f)),n.set(l,h));else{d=h.v!==oe;var S=a(()=>Hn(f));y(h,S)}var b=Reflect.getOwnPropertyDescriptor(o,l);if(b?.set&&b.set.call(u,f),!d){if(i&&typeof l=="string"){var A=n.get("length"),U=Number(l);Number.isInteger(U)&&U>=A.v&&y(A,U+1)}Qn(r)}return!0},ownKeys(o){p(r);var l=Reflect.ownKeys(o).filter(h=>{var d=n.get(h);return d===void 0||d.v!==oe});for(var[f,u]of n)u.v!==oe&&!(f in o)&&l.push(f);return l},setPrototypeOf(){Pa()}})}var Fi,Ps,zs,$s,Fs;function hl(){if(Fi===void 0){Fi=window,Ps=document,zs=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;$s=Zn(t,"firstChild").get,Fs=Zn(t,"nextSibling").get,Mi(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Mi(n)&&(n.__t=void 0)}}function ft(e=""){return document.createTextNode(e)}function wt(e){return $s.call(e)}function ir(e){return Fs.call(e)}function x(e,t){return wt(e)}function Us(e,t=!1){{var n=wt(e);return n instanceof Comment&&n.data===""?ir(n):n}}function E(e,t=1,n=!1){let i=e;for(;t--;)i=ir(i);return i}function dl(e){e.textContent=""}function Bs(){return!1}function Hs(e,t,n){return document.createElementNS(t??ks,e,void 0)}let Ui=!1;function gl(){Ui||(Ui=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function Dr(e){var t=P,n=L;Ue(null),Be(null);try{return e()}finally{Ue(t),Be(n)}}function ml(e,t,n,i=n){e.addEventListener(t,()=>Dr(n));const r=e.__on_r;r?e.__on_r=()=>{r(),i(!0)}:e.__on_r=()=>i(!0),gl()}function Gs(e){L===null&&(P===null&&La(),Da()),St&&Oa()}function _l(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function it(e,t){var n=L;n!==null&&(n.f&ke)!==0&&(e|=ke);var i={ctx:j,deps:null,nodes:null,f:e|fe|ze,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};O?.register_created_effect(i);var r=i;if((e&vn)!==0)mn!==null?mn.push(i):Et.ensure().schedule(i);else if(t!==null){try{Wt(i)}catch(a){throw Ae(i),a}r.deps===null&&r.teardown===null&&r.nodes===null&&r.first===r.last&&(r.f&Yt)===0&&(r=r.first,(e&rt)!==0&&(e&bn)!==0&&r!==null&&(r.f|=bn))}if(r!==null&&(r.parent=n,n!==null&&_l(r,n),P!==null&&(P.f&de)!==0&&(e&Tt)===0)){var s=P;(s.effects??=[]).push(r)}return i}function ki(){return P!==null&&!Ze}function Ws(e){const t=it(tr,null);return Q(t,ie),t.teardown=e,t}function ni(e){Gs();var t=L.f,n=!P&&(t&Ve)!==0&&(t&jt)===0;if(n){var i=j;(i.e??=[]).push(e)}else return qs(e)}function qs(e){return it(vn|_s,e)}function vl(e){return Gs(),it(tr|_s,e)}function bl(e){Et.ensure();const t=it(Tt|Yt,e);return(n={})=>new Promise(i=>{n.outro?Ut(t,()=>{Ae(t),i(void 0)}):(Ae(t),i(void 0))})}function kl(e){return it(vn,e)}function Hr(e,t){var n=j,i={effect:null,ran:!1,deps:e};n.l.$.push(i),i.effect=Lr(()=>{if(e(),!i.ran){i.ran=!0;var r=L;try{Be(r.parent),$(t)}finally{Be(r)}}})}function wl(){var e=j;Lr(()=>{for(var t of e.l.$){t.deps();var n=t.effect;(n.f&ie)!==0&&n.deps!==null&&Q(n,Xe),yn(n)&&Wt(n),t.ran=!1}})}function yl(e){return it(Kn|Yt,e)}function Lr(e,t=0){return it(tr|t,e)}function Ne(e,t=[],n=[],i=[]){ll(i,t,n,r=>{it(tr,()=>e(...r.map(p)))})}function Nr(e,t=0){var n=it(rt|t,e);return n}function Pe(e){return it(Ve|Yt,e)}function js(e){var t=e.teardown;if(t!==null){const n=St,i=P;Bi(!0),Ue(null);try{t.call(null)}finally{Bi(n),Ue(i)}}}function wi(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const r=n.ac;r!==null&&Dr(()=>{r.abort(ut)});var i=n.next;(n.f&Tt)!==0?n.parent=null:Ae(n,t),n=i}}function xl(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&Ve)===0&&Ae(t),t=n}}function Ae(e,t=!0){var n=!1;(t||(e.f&ms)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(Ys(e.nodes.start,e.nodes.end),n=!0),Q(e,Pi),wi(e,t&&!n),Jn(e,0);var i=e.nodes&&e.nodes.t;if(i!==null)for(const s of i)s.stop();js(e),e.f^=Pi,e.f|=$e;var r=e.parent;r!==null&&r.first!==null&&Zs(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Ys(e,t){for(;e!==null;){var n=e===t?null:ir(e);e.remove(),e=n}}function Zs(e){var t=e.parent,n=e.prev,i=e.next;n!==null&&(n.next=i),i!==null&&(i.prev=n),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function Ut(e,t,n=!0){var i=[];Vs(e,i,!0);var r=()=>{n&&Ae(e),t&&t()},s=i.length;if(s>0){var a=()=>--s||r();for(var o of i)o.out(a)}else r()}function Vs(e,t,n){if((e.f&ke)===0){e.f^=ke;var i=e.nodes&&e.nodes.t;if(i!==null)for(const o of i)(o.is_global||n)&&t.push(o);for(var r=e.first;r!==null;){var s=r.next;if((r.f&Tt)===0){var a=(r.f&bn)!==0||(r.f&Ve)!==0&&(e.f&rt)!==0;Vs(r,t,a?n:!1)}r=s}}}function yi(e){Xs(e,!0)}function Xs(e,t){if((e.f&ke)!==0){e.f^=ke,(e.f&ie)===0&&(Q(e,fe),Et.ensure().schedule(e));for(var n=e.first;n!==null;){var i=n.next,r=(n.f&bn)!==0||(n.f&Ve)!==0;Xs(n,r?t:!1),n=i}var s=e.nodes&&e.nodes.t;if(s!==null)for(const a of s)(a.is_global||t)&&a.in()}}function xi(e,t){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end;n!==null;){var r=n===i?null:ir(n);t.append(n),n=r}}let Tr=!1,St=!1;function Bi(e){St=e}let P=null,Ze=!1;function Ue(e){P=e}let L=null;function Be(e){L=e}let Fe=null;function Tl(e){P!==null&&(Fe===null?Fe=[e]:Fe.push(e))}let Se=null,Oe=0,Me=null;function El(e){Me=e}let Qs=1,$t=0,Bt=$t;function Hi(e){Bt=e}function Ks(){return++Qs}function yn(e){var t=e.f;if((t&fe)!==0)return!0;if(t&de&&(e.f&=~Ht),(t&Xe)!==0){for(var n=e.deps,i=n.length,r=0;re.wv)return!0}(t&ze)!==0&&Ye===null&&Q(e,ie)}return!1}function Js(e,t,n=!0){var i=e.reactions;if(i!==null&&!(Fe!==null&&_n.call(Fe,e)))for(var r=0;r{e.ac.abort(ut)}),e.ac=null);try{e.f|=Sr;var u=e.fn,h=u();e.f|=jt;var d=e.deps,v=O?.is_fork;if(Se!==null){var _;if(v||Jn(e,Oe),d!==null&&Oe>0)for(d.length=Oe+Se.length,_=0;_n?.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?xt(()=>{t.addEventListener(e,r,i)}):t.addEventListener(e,r,i),r}function cn(e,t,n,i,r){var s={capture:i,passive:r},a=Cl(e,t,n,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Ws(()=>{t.removeEventListener(e,a,s)})}function ot(e,t,n){(t[Gn]??={})[e]=n}function Ol(e){for(var t=0;t{throw b});throw d}}finally{e[Gn]=t,delete e.currentTarget,Ue(u),Be(h)}}}const Dl=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Ll(e){return Dl?.createHTML(e)??e}function Nl(e){var t=Hs("template");return t.innerHTML=Ll(e.replaceAll("","")),t.content}function er(e,t){var n=L;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function ge(e,t){var n=(t&Ga)!==0,i=(t&Wa)!==0,r,s=!e.startsWith("");return()=>{r===void 0&&(r=Nl(s?e:""+e),n||(r=wt(r)));var a=i||zs?document.importNode(r,!0):r.cloneNode(!0);if(n){var o=wt(a),l=a.lastChild;er(o,l)}else er(a,a);return a}}function Ml(){var e=document.createDocumentFragment(),t=document.createComment(""),n=ft();return e.append(t,n),er(t,n),e}function ue(e,t){e!==null&&e.before(t)}function re(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=`${n}`)}function Pl(e,t){return zl(e,t)}const vr=new Map;function zl(e,{target:t,anchor:n,props:i={},events:r,context:s,intro:a=!0,transformError:o}){hl();var l=void 0,f=bl(()=>{var u=n??t.appendChild(ft());sl(u,{pending:()=>{}},v=>{hi({});var _=j;s&&(_.c=s),r&&(i.$$events=r),l=e(v,i)||{},di()},o);var h=new Set,d=v=>{for(var _=0;_{for(var v of h)for(const b of[t,document]){var _=vr.get(b),S=_.get(v);--S==0?(b.removeEventListener(v,si),_.delete(v),_.size===0&&vr.delete(b)):_.set(v,S)}ii.delete(d),u!==n&&u.parentNode?.removeChild(u)}});return $l.set(l,f),l}let $l=new WeakMap;class Fl{anchor;#n=new Map;#o=new Map;#e=new Map;#i=new Set;#r=!0;constructor(t,n=!0){this.anchor=t,this.#r=n}#s=t=>{if(this.#n.has(t)){var n=this.#n.get(t),i=this.#o.get(n);if(i)yi(i),this.#i.delete(n);else{var r=this.#e.get(n);r&&(this.#o.set(n,r.effect),this.#e.delete(n),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),i=r.effect)}for(const[s,a]of this.#n){if(this.#n.delete(s),s===t)break;const o=this.#e.get(a);o&&(Ae(o.effect),this.#e.delete(a))}for(const[s,a]of this.#o){if(s===n||this.#i.has(s))continue;const o=()=>{if(Array.from(this.#n.values()).includes(s)){var f=document.createDocumentFragment();xi(a,f),f.append(ft()),this.#e.set(s,{effect:a,fragment:f})}else Ae(a);this.#i.delete(s),this.#o.delete(s)};this.#r||!i?(this.#i.add(s),Ut(a,o,!1)):o()}}};#t=t=>{this.#n.delete(t);const n=Array.from(this.#n.values());for(const[i,r]of this.#e)n.includes(i)||(Ae(r.effect),this.#e.delete(i))};ensure(t,n){var i=O,r=Bs();if(n&&!this.#o.has(t)&&!this.#e.has(t))if(r){var s=document.createDocumentFragment(),a=ft();s.append(a),this.#e.set(t,{effect:Pe(()=>n(a)),fragment:s})}else this.#o.set(t,Pe(()=>n(this.anchor)));if(this.#n.set(i,t),r){for(const[o,l]of this.#o)o===t?i.unskip_effect(l):i.skip_effect(l);for(const[o,l]of this.#e)o===t?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit(this.#s),i.ondiscard(this.#t)}else this.#s(i)}}function Wn(e,t,n=!1){var i=new Fl(e),r=n?bn:0;function s(a,o){i.ensure(a,o)}Nr(()=>{var a=!1;t((o,l=0)=>{a=!0,s(l,o)}),a||s(-1,null)},r)}function Er(e,t){return t}function Ul(e,t,n){for(var i=[],r=t.length,s,a=t.length,o=0;o{if(s){if(s.pending.delete(h),s.done.add(h),s.pending.size===0){var d=e.outrogroups;ai(e,Or(s.done)),d.delete(s),d.size===0&&(e.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=i.length===0&&n!==null;if(l){var f=n,u=f.parentNode;dl(u),u.append(f),e.items.clear()}ai(e,t,!l)}else s={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(s)}function ai(e,t,n=!0){var i;if(e.pending.size>0){i=new Set;for(const a of e.pending.values())for(const o of a)i.add(e.items.get(o).e)}for(var r=0;r{var D=n();return ps(D)?D:D==null?[]:Or(D)}),d,v=new Map,_=!0;function S(D){(U.effect.f&$e)===0&&(U.pending.delete(D),U.fallback=u,Bl(U,d,a,t,i),u!==null&&(d.length===0?(u.f&nt)===0?yi(u):(u.f^=nt,qn(u,null,a)):Ut(u,()=>{u=null})))}function b(D){U.pending.delete(D)}var A=Nr(()=>{d=p(h);for(var D=d.length,C=new Set,B=O,H=Bs(),G=0;Gs(a)):(u=Pe(()=>s(Wi??=ft())),u.f|=nt)),D>C.size&&Ca(),!_)if(v.set(B,C),H){for(const[J,ye]of o)C.has(J)||B.skip_effect(ye.e);B.oncommit(S),B.ondiscard(b)}else S(B);p(h)}),U={effect:A,items:o,pending:v,outrogroups:null,fallback:u};_=!1}function Nn(e){for(;e!==null&&(e.f&Ve)===0;)e=e.next;return e}function Bl(e,t,n,i,r){var s=(i&Ba)!==0,a=t.length,o=e.items,l=Nn(e.effect.first),f,u=null,h,d=[],v=[],_,S,b,A;if(s)for(A=0;A0){var K=(i&bs)!==0&&a===0?n:null;if(s){for(A=0;A{if(h!==void 0)for(b of h)b.nodes?.a?.apply()})}function Hl(e,t,n,i,r,s,a,o){var l=(a&Fa)!==0?(a&Ha)===0?q(n,!1,!1):Gt(n):null,f=(a&Ua)!==0?Gt(r):null;return{v:l,i:f,e:Pe(()=>(s(t,l??n,f??r,o),()=>{e.delete(i)}))}}function qn(e,t,n){if(e.nodes)for(var i=e.nodes.start,r=e.nodes.end,s=t&&(t.f&nt)===0?t.nodes.start:n;i!==null;){var a=ir(i);if(s.before(i),i===r)return;i=a}}function bt(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Gr(e,t,n=!1,i=!1,r=!1,s=!1){var a=e,o="";if(n)var l=e;Ne(()=>{var f=L;if(o!==(o=t()??"")){if(n){f.nodes=null,l.innerHTML=o,o!==""&&er(wt(l),l.lastChild);return}if(f.nodes!==null&&(Ys(f.nodes.start,f.nodes.end),f.nodes=null),o!==""){var u=i?qa:r?ja:void 0,h=Hs(i?"svg":r?"math":"template",u);h.innerHTML=o;var d=i||r?h:h.content;if(er(wt(d),d.lastChild),i||r)for(;wt(d);)a.before(wt(d));else a.before(d)}}})}function ia(e,t){var n;n=document.head.appendChild(ft()),Nr(()=>t(n),ms|Yt)}const qi=[...` -\r\f \v\uFEFF`];function Gl(e,t,n){var i=e==null?"":""+e;if(n){for(var r of Object.keys(n))if(n[r])i=i?i+" "+r:r;else if(i.length)for(var s=r.length,a=0;(a=i.indexOf(r,a))>=0;){var o=a+s;(a===0||qi.includes(i[a-1]))&&(o===i.length||qi.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}function Mn(e,t,n,i,r,s){var a=e.__className;if(a!==n||a===void 0){var o=Gl(n,i,s);o==null?e.removeAttribute("class"):e.className=o,e.__className=n}else if(s&&r!==s)for(var l in s){var f=!!s[l];(r==null||f!==!!r[l])&&e.classList.toggle(l,f)}return s}const Wl=Symbol("is custom element"),ql=Symbol("is html");function et(e,t,n,i){var r=jl(e);r[t]!==(r[t]=n)&&(t==="loading"&&(e[Ra]=n),n==null?e.removeAttribute(t):typeof n!="string"&&Yl(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function jl(e){return e.__attributes??={[Wl]:e.nodeName.includes("-"),[ql]:e.namespaceURI===ks}}var ji=new Map;function Yl(e){var t=e.getAttribute("is")||e.nodeName,n=ji.get(t);if(n)return n;ji.set(t,n=[]);for(var i,r=e,s=Element.prototype;s!==r;){i=hs(r);for(var a in i)i[a].set&&n.push(a);r=pi(r)}return n}function un(e,t,n=t){var i=new WeakSet;ml(e,"input",async r=>{var s=r?e.defaultValue:e.value;if(s=Wr(e)?qr(s):s,n(s),O!==null&&i.add(O),await Al(),s!==(s=t())){var a=e.selectionStart,o=e.selectionEnd,l=e.value.length;if(e.value=s??"",o!==null){var f=e.value.length;a===o&&o===l&&f>l?(e.selectionStart=f,e.selectionEnd=f):(e.selectionStart=a,e.selectionEnd=Math.min(o,f))}}}),$(t)==null&&e.value&&(n(Wr(e)?qr(e.value):e.value),O!==null&&i.add(O)),Lr(()=>{var r=t();if(e===document.activeElement){var s=O;if(i.has(s))return}Wr(e)&&r===qr(e.value)||e.type==="date"&&!r&&!e.value||r!==e.value&&(e.value=r??"")})}function Wr(e){var t=e.type;return t==="number"||t==="range"}function qr(e){return e===""?null:+e}function sa(e=!1){const t=j,n=t.l.u;if(!n)return;let i=()=>hn(t.s);if(e){let r=0,s={};const a=vi(()=>{let o=!1;const l=t.s;for(const f in l)l[f]!==s[f]&&(s[f]=l[f],o=!0);return o&&r++,r});i=()=>p(a)}n.b.length&&vl(()=>{Yi(t,i),Qr(n.b)}),ni(()=>{const r=$(()=>n.m.map(Aa));return()=>{for(const s of r)typeof s=="function"&&s()}}),n.a.length&&ni(()=>{Yi(t,i),Qr(n.a)})}function Yi(e,t){if(e.l.s)for(const n of e.l.s)p(n);t()}function aa(e){j===null&&vs(),nr&&j.l!==null?Vl(j).m.push(e):ni(()=>{const t=$(e);if(typeof t=="function")return t})}function Zl(e){j===null&&vs(),aa(()=>()=>$(e))}function Vl(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}const Xl="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Xl);Qa();async function _e(e,t={}){const n=new Headers(t.headers);n.set("Accept","application/json"),t.body&&!(t.body instanceof FormData)&&n.set("Content-Type","application/json");const i=await fetch(e,{...t,headers:n});if(!i.ok)throw new Error(await i.text());return i.json()}const{entries:la,setPrototypeOf:Zi,isFrozen:Ql,getPrototypeOf:Kl,getOwnPropertyDescriptor:Jl}=Object;let{freeze:we,seal:He,create:dn}=Object,{apply:li,construct:oi}=typeof Reflect<"u"&&Reflect;we||(we=function(t){return t});He||(He=function(t){return t});li||(li=function(t,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),s=2;s1?n-1:0),r=1;r"u"?null:se(BigInt.prototype.toString),Ji=typeof Symbol>"u"?null:se(Symbol.prototype.toString),X=se(Object.prototype.hasOwnProperty),$n=se(Object.prototype.toString),ce=se(RegExp.prototype.test),br=so(TypeError);function se(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:jn;if(Zi&&Zi(e,null),!ve(t))return e;let i=t.length;for(;i--;){let r=t[i];if(typeof r=="string"){const s=n(r);s!==r&&(Ql(t)||(t[i]=s),r=s)}e[r]=!0}return e}function ao(e){for(let t=0;t/gm),ho=He(/\$\{[\w\W]*/gm),go=He(/^data-[\-\w.\u00B7-\uFFFF]+$/),mo=He(/^aria-[\-\w]+$/),oa=He(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_o=He(/^(?:\w+script|data):/i),vo=He(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ca=He(/^html$/i),bo=He(/^[a-z][.\w]*(-[.\w]+)+$/i);var is=Object.freeze({__proto__:null,ARIA_ATTR:mo,ATTR_WHITESPACE:vo,CUSTOM_ELEMENT:bo,DATA_ATTR:go,DOCTYPE_NAME:ca,ERB_EXPR:po,IS_ALLOWED_URI:oa,IS_SCRIPT_OR_DATA:_o,MUSTACHE_EXPR:fo,TMPLIT_EXPR:ho});const Fn={element:1,text:3,progressingInstruction:7,comment:8,document:9},ko=function(){return typeof window>"u"?null:window},wo=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(i=n.getAttribute(r));const s="dompurify"+(i?"#"+i:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},ss=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ua(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ko();const t=T=>ua(T);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Fn.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,r=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:o,Element:l,NodeFilter:f,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:h,DOMParser:d,trustedTypes:v}=e,_=l.prototype,S=gn(_,"cloneNode"),b=gn(_,"remove"),A=gn(_,"nextSibling"),U=gn(_,"childNodes"),D=gn(_,"parentNode");if(typeof a=="function"){const T=n.createElement("template");T.content&&T.content.ownerDocument&&(n=T.content.ownerDocument)}let C,B="";const{implementation:H,createNodeIterator:G,createDocumentFragment:pe,getElementsByTagName:K}=n,{importNode:W}=i;let J=ss();t.isSupported=typeof la=="function"&&typeof D=="function"&&H&&H.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ye,ERB_EXPR:Ge,TMPLIT_EXPR:De,DATA_ATTR:Vt,ARIA_ATTR:Le,IS_SCRIPT_OR_DATA:Xt,ATTR_WHITESPACE:At,CUSTOM_ELEMENT:ar}=is;let{IS_ALLOWED_URI:lr}=is,ee=null;const Tn=I({},[...es,...Yr,...Zr,...Vr,...ts]);let ae=null;const Rt=I({},[...ns,...Xr,...rs,...kr]);let Y=Object.seal(dn(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),pt=null,It=null;const We=Object.seal(dn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let or=!0,En=!0,cr=!1,Sn=!0,Qe=!1,ht=!0,st=!1,Qt=!1,Kt=!1,at=!1,Jt=!1,en=!1,An=!0,Rn=!1;const ur="user-content-";let tn=!0,dt=!1,lt={},Re=null;const In=I({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let fr=null;const pr=I({},["audio","video","img","source","image","track"]);let Ct=null;const hr=I({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ot="http://www.w3.org/1998/Math/MathML",nn="http://www.w3.org/2000/svg",Ie="http://www.w3.org/1999/xhtml";let gt=Ie,rn=!1,sn=null;const zr=I({},[Ot,nn,Ie],jr);let Cn=I({},["mi","mo","mn","ms","mtext"]),an=I({},["annotation-xml"]);const dr=I({},["title","style","font","a","script"]);let Dt=null;const gr=["application/xhtml+xml","text/html"],$r="text/html";let V=null,mt=null;const Fr=n.createElement("form"),On=function(c){return c instanceof RegExp||c instanceof Function},ln=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(mt&&mt===c)return;(!c||typeof c!="object")&&(c={}),c=Ee(c),Dt=gr.indexOf(c.PARSER_MEDIA_TYPE)===-1?$r:c.PARSER_MEDIA_TYPE,V=Dt==="application/xhtml+xml"?jr:jn,ee=X(c,"ALLOWED_TAGS")&&ve(c.ALLOWED_TAGS)?I({},c.ALLOWED_TAGS,V):Tn,ae=X(c,"ALLOWED_ATTR")&&ve(c.ALLOWED_ATTR)?I({},c.ALLOWED_ATTR,V):Rt,sn=X(c,"ALLOWED_NAMESPACES")&&ve(c.ALLOWED_NAMESPACES)?I({},c.ALLOWED_NAMESPACES,jr):zr,Ct=X(c,"ADD_URI_SAFE_ATTR")&&ve(c.ADD_URI_SAFE_ATTR)?I(Ee(hr),c.ADD_URI_SAFE_ATTR,V):hr,fr=X(c,"ADD_DATA_URI_TAGS")&&ve(c.ADD_DATA_URI_TAGS)?I(Ee(pr),c.ADD_DATA_URI_TAGS,V):pr,Re=X(c,"FORBID_CONTENTS")&&ve(c.FORBID_CONTENTS)?I({},c.FORBID_CONTENTS,V):In,pt=X(c,"FORBID_TAGS")&&ve(c.FORBID_TAGS)?I({},c.FORBID_TAGS,V):Ee({}),It=X(c,"FORBID_ATTR")&&ve(c.FORBID_ATTR)?I({},c.FORBID_ATTR,V):Ee({}),lt=X(c,"USE_PROFILES")?c.USE_PROFILES&&typeof c.USE_PROFILES=="object"?Ee(c.USE_PROFILES):c.USE_PROFILES:!1,or=c.ALLOW_ARIA_ATTR!==!1,En=c.ALLOW_DATA_ATTR!==!1,cr=c.ALLOW_UNKNOWN_PROTOCOLS||!1,Sn=c.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Qe=c.SAFE_FOR_TEMPLATES||!1,ht=c.SAFE_FOR_XML!==!1,st=c.WHOLE_DOCUMENT||!1,at=c.RETURN_DOM||!1,Jt=c.RETURN_DOM_FRAGMENT||!1,en=c.RETURN_TRUSTED_TYPE||!1,Kt=c.FORCE_BODY||!1,An=c.SANITIZE_DOM!==!1,Rn=c.SANITIZE_NAMED_PROPS||!1,tn=c.KEEP_CONTENT!==!1,dt=c.IN_PLACE||!1,lr=oo(c.ALLOWED_URI_REGEXP)?c.ALLOWED_URI_REGEXP:oa,gt=typeof c.NAMESPACE=="string"?c.NAMESPACE:Ie,Cn=X(c,"MATHML_TEXT_INTEGRATION_POINTS")&&c.MATHML_TEXT_INTEGRATION_POINTS&&typeof c.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ee(c.MATHML_TEXT_INTEGRATION_POINTS):I({},["mi","mo","mn","ms","mtext"]),an=X(c,"HTML_INTEGRATION_POINTS")&&c.HTML_INTEGRATION_POINTS&&typeof c.HTML_INTEGRATION_POINTS=="object"?Ee(c.HTML_INTEGRATION_POINTS):I({},["annotation-xml"]);const m=X(c,"CUSTOM_ELEMENT_HANDLING")&&c.CUSTOM_ELEMENT_HANDLING&&typeof c.CUSTOM_ELEMENT_HANDLING=="object"?Ee(c.CUSTOM_ELEMENT_HANDLING):dn(null);if(Y=dn(null),X(m,"tagNameCheck")&&On(m.tagNameCheck)&&(Y.tagNameCheck=m.tagNameCheck),X(m,"attributeNameCheck")&&On(m.attributeNameCheck)&&(Y.attributeNameCheck=m.attributeNameCheck),X(m,"allowCustomizedBuiltInElements")&&typeof m.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=m.allowCustomizedBuiltInElements),Qe&&(En=!1),Jt&&(at=!0),lt&&(ee=I({},ts),ae=dn(null),lt.html===!0&&(I(ee,es),I(ae,ns)),lt.svg===!0&&(I(ee,Yr),I(ae,Xr),I(ae,kr)),lt.svgFilters===!0&&(I(ee,Zr),I(ae,Xr),I(ae,kr)),lt.mathMl===!0&&(I(ee,Vr),I(ae,rs),I(ae,kr))),We.tagCheck=null,We.attributeCheck=null,X(c,"ADD_TAGS")&&(typeof c.ADD_TAGS=="function"?We.tagCheck=c.ADD_TAGS:ve(c.ADD_TAGS)&&(ee===Tn&&(ee=Ee(ee)),I(ee,c.ADD_TAGS,V))),X(c,"ADD_ATTR")&&(typeof c.ADD_ATTR=="function"?We.attributeCheck=c.ADD_ATTR:ve(c.ADD_ATTR)&&(ae===Rt&&(ae=Ee(ae)),I(ae,c.ADD_ATTR,V))),X(c,"ADD_URI_SAFE_ATTR")&&ve(c.ADD_URI_SAFE_ATTR)&&I(Ct,c.ADD_URI_SAFE_ATTR,V),X(c,"FORBID_CONTENTS")&&ve(c.FORBID_CONTENTS)&&(Re===In&&(Re=Ee(Re)),I(Re,c.FORBID_CONTENTS,V)),X(c,"ADD_FORBID_CONTENTS")&&ve(c.ADD_FORBID_CONTENTS)&&(Re===In&&(Re=Ee(Re)),I(Re,c.ADD_FORBID_CONTENTS,V)),tn&&(ee["#text"]=!0),st&&I(ee,["html","head","body"]),ee.table&&(I(ee,["tbody"]),delete pt.tbody),c.TRUSTED_TYPES_POLICY){if(typeof c.TRUSTED_TYPES_POLICY.createHTML!="function")throw br('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof c.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw br('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=c.TRUSTED_TYPES_POLICY,B=C.createHTML("")}else C===void 0&&(C=wo(v,r)),C!==null&&typeof B=="string"&&(B=C.createHTML(""));we&&we(c),mt=c},mr=I({},[...Yr,...Zr,...co]),_r=I({},[...Vr,...uo]),Ur=function(c){let m=D(c);(!m||!m.tagName)&&(m={namespaceURI:gt,tagName:"template"});const w=jn(c.tagName),z=jn(m.tagName);return sn[c.namespaceURI]?c.namespaceURI===nn?m.namespaceURI===Ie?w==="svg":m.namespaceURI===Ot?w==="svg"&&(z==="annotation-xml"||Cn[z]):!!mr[w]:c.namespaceURI===Ot?m.namespaceURI===Ie?w==="math":m.namespaceURI===nn?w==="math"&&an[z]:!!_r[w]:c.namespaceURI===Ie?m.namespaceURI===nn&&!an[z]||m.namespaceURI===Ot&&!Cn[z]?!1:!_r[w]&&(dr[w]||!mr[w]):!!(Dt==="application/xhtml+xml"&&sn[c.namespaceURI]):!1},g=function(c){zn(t.removed,{element:c});try{D(c).removeChild(c)}catch{b(c)}},k=function(c,m){try{zn(t.removed,{attribute:m.getAttributeNode(c),from:m})}catch{zn(t.removed,{attribute:null,from:m})}if(m.removeAttribute(c),c==="is")if(at||Jt)try{g(m)}catch{}else try{m.setAttribute(c,"")}catch{}},R=function(c){let m=null,w=null;if(Kt)c=""+c;else{const Z=Xi(c,/^[\r\n\t ]+/);w=Z&&Z[0]}Dt==="application/xhtml+xml"&>===Ie&&(c=''+c+"");const z=C?C.createHTML(c):c;if(gt===Ie)try{m=new d().parseFromString(z,Dt)}catch{}if(!m||!m.documentElement){m=H.createDocument(gt,"template",null);try{m.documentElement.innerHTML=rn?B:z}catch{}}const le=m.body||m.documentElement;return c&&w&&le.insertBefore(n.createTextNode(w),le.childNodes[0]||null),gt===Ie?K.call(m,st?"html":"body")[0]:st?m.documentElement:le},N=function(c){return G.call(c.ownerDocument||c,c,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},te=function(c){return c instanceof h&&(typeof c.nodeName!="string"||typeof c.textContent!="string"||typeof c.removeChild!="function"||!(c.attributes instanceof u)||typeof c.removeAttribute!="function"||typeof c.setAttribute!="function"||typeof c.namespaceURI!="string"||typeof c.insertBefore!="function"||typeof c.hasChildNodes!="function")},xe=function(c){return typeof o=="function"&&c instanceof o};function me(T,c,m){Pn(T,w=>{w.call(t,c,m,mt)})}const Ke=function(c){let m=null;if(me(J.beforeSanitizeElements,c,null),te(c))return g(c),!0;const w=V(c.nodeName);if(me(J.uponSanitizeElement,c,{tagName:w,allowedTags:ee}),ht&&c.hasChildNodes()&&!xe(c.firstElementChild)&&ce(/<[/\w!]/g,c.innerHTML)&&ce(/<[/\w!]/g,c.textContent)||ht&&c.namespaceURI===Ie&&w==="style"&&xe(c.firstElementChild)||c.nodeType===Fn.progressingInstruction||ht&&c.nodeType===Fn.comment&&ce(/<[/\w]/g,c.data))return g(c),!0;if(pt[w]||!(We.tagCheck instanceof Function&&We.tagCheck(w))&&!ee[w]){if(!pt[w]&&on(w)&&(Y.tagNameCheck instanceof RegExp&&ce(Y.tagNameCheck,w)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(w)))return!1;if(tn&&!Re[w]){const z=D(c)||c.parentNode,le=U(c)||c.childNodes;if(le&&z){const Z=le.length;for(let he=Z-1;he>=0;--he){const Te=S(le[he],!0);z.insertBefore(Te,A(c))}}}return g(c),!0}return c instanceof l&&!Ur(c)||(w==="noscript"||w==="noembed"||w==="noframes")&&ce(/<\/no(script|embed|frames)/i,c.innerHTML)?(g(c),!0):(Qe&&c.nodeType===Fn.text&&(m=c.textContent,Pn([ye,Ge,De],z=>{m=fn(m,z," ")}),c.textContent!==m&&(zn(t.removed,{element:c.cloneNode()}),c.textContent=m)),me(J.afterSanitizeElements,c,null),!1)},Je=function(c,m,w){if(It[m]||An&&(m==="id"||m==="name")&&(w in n||w in Fr))return!1;const z=ae[m]||We.attributeCheck instanceof Function&&We.attributeCheck(m,c);if(!(En&&!It[m]&&ce(Vt,m))){if(!(or&&ce(Le,m))){if(!z||It[m]){if(!(on(c)&&(Y.tagNameCheck instanceof RegExp&&ce(Y.tagNameCheck,c)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(c))&&(Y.attributeNameCheck instanceof RegExp&&ce(Y.attributeNameCheck,m)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(m,c))||m==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&ce(Y.tagNameCheck,w)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(w))))return!1}else if(!Ct[m]){if(!ce(lr,fn(w,At,""))){if(!((m==="src"||m==="xlink:href"||m==="href")&&c!=="script"&&Qi(w,"data:")===0&&fr[c])){if(!(cr&&!ce(Xt,fn(w,At,"")))){if(w)return!1}}}}}}return!0},Dn=I({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),on=function(c){return!Dn[jn(c)]&&ce(ar,c)},Lt=function(c){me(J.beforeSanitizeAttributes,c,null);const{attributes:m}=c;if(!m||te(c))return;const w={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae,forceKeepAttr:void 0};let z=m.length;for(;z--;){const le=m[z],{name:Z,namespaceURI:he,value:Te}=le,Ce=V(Z),Ln=Te;let ne=Z==="value"?Ln:no(Ln);if(w.attrName=Ce,w.attrValue=ne,w.keepAttr=!0,w.forceKeepAttr=void 0,me(J.uponSanitizeAttribute,c,w),ne=w.attrValue,Rn&&(Ce==="id"||Ce==="name")&&Qi(ne,ur)!==0&&(k(Z,c),ne=ur+ne),ht&&ce(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ne)){k(Z,c);continue}if(Ce==="attributename"&&Xi(ne,"href")){k(Z,c);continue}if(w.forceKeepAttr)continue;if(!w.keepAttr){k(Z,c);continue}if(!Sn&&ce(/\/>/i,ne)){k(Z,c);continue}Qe&&Pn([ye,Ge,De],Ni=>{ne=fn(ne,Ni," ")});const Li=V(c.nodeName);if(!Je(Li,Ce,ne)){k(Z,c);continue}if(C&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!he)switch(v.getAttributeType(Li,Ce)){case"TrustedHTML":{ne=C.createHTML(ne);break}case"TrustedScriptURL":{ne=C.createScriptURL(ne);break}}if(ne!==Ln)try{he?c.setAttributeNS(he,Z,ne):c.setAttribute(Z,ne),te(c)?g(c):Vi(t.removed)}catch{k(Z,c)}}me(J.afterSanitizeAttributes,c,null)},_t=function(c){let m=null;const w=N(c);for(me(J.beforeSanitizeShadowDOM,c,null);m=w.nextNode();)me(J.uponSanitizeShadowNode,m,null),Ke(m),Lt(m),m.content instanceof s&&_t(m.content);me(J.afterSanitizeShadowDOM,c,null)};return t.sanitize=function(T){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=null,w=null,z=null,le=null;if(rn=!T,rn&&(T=""),typeof T!="string"&&!xe(T)&&(T=lo(T),typeof T!="string"))throw br("dirty is not a string, aborting");if(!t.isSupported)return T;if(Qt||ln(c),t.removed=[],typeof T=="string"&&(dt=!1),dt){const Te=T.nodeName;if(typeof Te=="string"){const Ce=V(Te);if(!ee[Ce]||pt[Ce])throw br("root node is forbidden and cannot be sanitized in-place")}}else if(T instanceof o)m=R(""),w=m.ownerDocument.importNode(T,!0),w.nodeType===Fn.element&&w.nodeName==="BODY"||w.nodeName==="HTML"?m=w:m.appendChild(w);else{if(!at&&!Qe&&!st&&T.indexOf("<")===-1)return C&&en?C.createHTML(T):T;if(m=R(T),!m)return at?null:en?B:""}m&&Kt&&g(m.firstChild);const Z=N(dt?T:m);for(;z=Z.nextNode();)Ke(z),Lt(z),z.content instanceof s&&_t(z.content);if(dt)return T;if(at){if(Qe){m.normalize();let Te=m.innerHTML;Pn([ye,Ge,De],Ce=>{Te=fn(Te,Ce," ")}),m.innerHTML=Te}if(Jt)for(le=pe.call(m.ownerDocument);m.firstChild;)le.appendChild(m.firstChild);else le=m;return(ae.shadowroot||ae.shadowrootmode)&&(le=W.call(i,le,!0)),le}let he=st?m.outerHTML:m.innerHTML;return st&&ee["!doctype"]&&m.ownerDocument&&m.ownerDocument.doctype&&m.ownerDocument.doctype.name&&ce(ca,m.ownerDocument.doctype.name)&&(he=" -`+he),Qe&&Pn([ye,Ge,De],Te=>{he=fn(he,Te," ")}),C&&en?C.createHTML(he):he},t.setConfig=function(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ln(T),Qt=!0},t.clearConfig=function(){mt=null,Qt=!1},t.isValidAttribute=function(T,c,m){mt||ln({});const w=V(T),z=V(c);return Je(w,z,m)},t.addHook=function(T,c){typeof c=="function"&&zn(J[T],c)},t.removeHook=function(T,c){if(c!==void 0){const m=eo(J[T],c);return m===-1?void 0:to(J[T],m,1)[0]}return Vi(J[T])},t.removeHooks=function(T){J[T]=[]},t.removeAllHooks=function(){J=ss()},t}var yo=ua();function Ti(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Zt=Ti();function fa(e){Zt=e}var Pt={exec:()=>null};function M(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(r,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(be.caret,"$1"),n=n.replace(r,a),i},getRegex:()=>new RegExp(n,t)};return i}var xo=(()=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},To=/^(?:[ \t]*(?:\n|$))+/,Eo=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,So=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,sr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ao=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ei=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,pa=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ha=M(pa).replace(/bull/g,Ei).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ro=M(pa).replace(/bull/g,Ei).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Si=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Io=/^[^\n]+/,Ai=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Co=M(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ai).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Oo=M(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ei).getRegex(),Mr="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ri=/|$))/,Do=M("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ri).replace("tag",Mr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),da=M(Si).replace("hr",sr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Mr).getRegex(),Lo=M(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",da).getRegex(),Ii={blockquote:Lo,code:Eo,def:Co,fences:So,heading:Ao,hr:sr,html:Do,lheading:ha,list:Oo,newline:To,paragraph:da,table:Pt,text:Io},as=M("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",sr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Mr).getRegex(),No={...Ii,lheading:Ro,table:as,paragraph:M(Si).replace("hr",sr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",as).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Mr).getRegex()},Mo={...Ii,html:M(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ri).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Pt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:M(Si).replace("hr",sr).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",ha).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Po=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,zo=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ga=/^( {2,}|\\)\n(?!\s*$)/,$o=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",xo?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),_a=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Go=M(_a,"u").replace(/punct/g,xn).getRegex(),Wo=M(_a,"u").replace(/punct/g,ma).getRegex(),va="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",qo=M(va,"gu").replace(/notPunctSpace/g,Ci).replace(/punctSpace/g,Pr).replace(/punct/g,xn).getRegex(),jo=M(va,"gu").replace(/notPunctSpace/g,Bo).replace(/punctSpace/g,Uo).replace(/punct/g,ma).getRegex(),Yo=M("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ci).replace(/punctSpace/g,Pr).replace(/punct/g,xn).getRegex(),Zo=M(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,xn).getRegex(),Vo="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Xo=M(Vo,"gu").replace(/notPunctSpace/g,Ci).replace(/punctSpace/g,Pr).replace(/punct/g,xn).getRegex(),Qo=M(/\\(punct)/,"gu").replace(/punct/g,xn).getRegex(),Ko=M(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Jo=M(Ri).replace("(?:-->|$)","-->").getRegex(),ec=M("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",Jo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Rr=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,tc=M(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Rr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ba=M(/^!?\[(label)\]\[(ref)\]/).replace("label",Rr).replace("ref",Ai).getRegex(),ka=M(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ai).getRegex(),nc=M("reflink|nolink(?!\\()","g").replace("reflink",ba).replace("nolink",ka).getRegex(),ls=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Oi={_backpedal:Pt,anyPunctuation:Qo,autolink:Ko,blockSkip:Ho,br:ga,code:zo,del:Pt,delLDelim:Pt,delRDelim:Pt,emStrongLDelim:Go,emStrongRDelimAst:qo,emStrongRDelimUnd:Yo,escape:Po,link:tc,nolink:ka,punctuation:Fo,reflink:ba,reflinkSearch:nc,tag:ec,text:$o,url:Pt},rc={...Oi,link:M(/^!?\[(label)\]\((.*?)\)/).replace("label",Rr).getRegex(),reflink:M(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Rr).getRegex()},ci={...Oi,emStrongRDelimAst:jo,emStrongLDelim:Wo,delLDelim:Zo,delRDelim:Xo,url:M(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ls).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:M(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},os=e=>sc[e];function tt(e,t){if(t){if(be.escapeTest.test(e))return e.replace(be.escapeReplace,os)}else if(be.escapeTestNoEncode.test(e))return e.replace(be.escapeReplaceNoEncode,os);return e}function cs(e){try{e=encodeURI(e).replace(be.percentDecode,"%")}catch{return null}return e}function us(e,t){let n=e.replace(be.findPipe,(s,a,o)=>{let l=!1,f=a;for(;--f>=0&&o[f]==="\\";)l=!l;return l?"|":" |"}),i=n.split(be.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length0?-2:-1}function lc(e,t=0){let n=t,i="";for(let r of e)if(r===" "){let s=4-n%4;i+=" ".repeat(s),n+=s}else i+=r,n++;return i}function fs(e,t,n,i,r){let s=t.href,a=t.title||null,o=e[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:a,text:o,tokens:i.inlineTokens(o)};return i.state.inLink=!1,l}function oc(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let r=i[1];return t.split(` -`).map(s=>{let a=s.match(n.other.beginningSpace);if(a===null)return s;let[o]=a;return o.length>=r.length?s.slice(r.length):s}).join(` -`)}var Ir=class{options;rules;lexer;constructor(e){this.options=e||Zt}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Bn(n,` -`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=oc(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let i=Bn(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Bn(t[0],` -`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Bn(t[0],` -`).split(` -`),i="",r="",s=[];for(;n.length>0;){let a=!1,o=[],l;for(l=0;l1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let s=this.rules.other.listItemRegex(n),a=!1;for(;e;){let l=!1,f="",u="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let h=lc(t[2].split(` -`,1)[0],t[1].length),d=e.split(` -`,1)[0],v=!h.trim(),_=0;if(this.options.pedantic?(_=2,u=h.trimStart()):v?_=t[1].length+1:(_=h.search(this.rules.other.nonSpaceChar),_=_>4?1:_,u=h.slice(_),_+=t[1].length),v&&this.rules.other.blankLine.test(d)&&(f+=d+` -`,e=e.substring(d.length+1),l=!0),!l){let S=this.rules.other.nextBulletRegex(_),b=this.rules.other.hrRegex(_),A=this.rules.other.fencesBeginRegex(_),U=this.rules.other.headingBeginRegex(_),D=this.rules.other.htmlBeginRegex(_),C=this.rules.other.blockquoteBeginRegex(_);for(;e;){let B=e.split(` -`,1)[0],H;if(d=B,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),H=d):H=d.replace(this.rules.other.tabCharGlobal," "),A.test(d)||U.test(d)||D.test(d)||C.test(d)||S.test(d)||b.test(d))break;if(H.search(this.rules.other.nonSpaceChar)>=_||!d.trim())u+=` -`+H.slice(_);else{if(v||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||A.test(h)||U.test(h)||b.test(h))break;u+=` -`+d}v=!d.trim(),f+=B+` -`,e=e.substring(B.length+1),h=H.slice(_)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(a=!0)),r.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),r.raw+=f}let o=r.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let f=this.rules.other.listTaskCheckbox.exec(l.raw);if(f){let u={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};l.checked=u.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=u.raw+l.tokens[0].raw,l.tokens[0].text=u.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(u)):l.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):l.tokens.unshift(u)}}if(!r.loose){let f=l.tokens.filter(h=>h.type==="space"),u=f.length>0&&f.some(h=>this.rules.other.anyLine.test(h.raw));r.loose=u}}if(r.loose)for(let l of r.items){l.loose=!0;for(let f of l.tokens)f.type==="text"&&(f.type="paragraph")}return r}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=us(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(` -`):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a({text:o,tokens:this.lexer.inline(o),header:!1,align:s.align[l]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===` -`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=Bn(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=ac(t[2],"()");if(s===-2)return;if(s>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(i);s&&(i=s[1],r=s[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),fs(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[i.toLowerCase()];if(!r){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return fs(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!n||this.rules.inline.punctuation.exec(n))){let r=[...i[0]].length-1,s,a,o=r,l=0,f=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+r);(i=f.exec(t))!==null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s)continue;if(a=[...s].length,i[3]||i[4]){o+=a;continue}else if((i[5]||i[6])&&r%3&&!((r+a)%3)){l+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+l);let u=[...i[0]][0].length,h=e.slice(0,r+i.index+u+a);if(Math.min(r,a)%2){let v=h.slice(1,-1);return{type:"em",raw:h,text:v,tokens:this.lexer.inlineTokens(v)}}let d=h.slice(2,-2);return{type:"strong",raw:h,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let i=this.rules.inline.delLDelim.exec(e);if(i&&(!i[1]||!n||this.rules.inline.punctuation.exec(n))){let r=[...i[0]].length-1,s,a,o=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+r);(i=l.exec(t))!==null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s||(a=[...s].length,a!==r))continue;if(i[3]||i[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let f=[...i[0]][0].length,u=e.slice(0,r+i.index+f+a),h=u.slice(r,-r);return{type:"del",raw:u,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=t[1],i="mailto:"+n):(n=t[1],i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,i;if(t[2]==="@")n=t[0],i="mailto:"+n;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},qe=class ui{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Zt,this.options.tokenizer=this.options.tokenizer||new Ir,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:be,block:wr.normal,inline:Un.normal};this.options.pedantic?(n.block=wr.pedantic,n.inline=Un.pedantic):this.options.gfm&&(n.block=wr.gfm,this.options.breaks?n.inline=Un.breaks:n.inline=Un.gfm),this.tokenizer.rules=n}static get rules(){return{block:wr,inline:Un}}static lex(t,n){return new ui(n).lex(t)}static lexInline(t,n){return new ui(n).inlineTokens(t)}lex(t){t=t.replace(be.carriageReturn,` -`),this.blockTokens(t,this.tokens);for(let n=0;n(r=a.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);let a=n.at(-1);r.raw.length===1&&a!==void 0?a.raw+=` -`:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length);let a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(` -`)?"":` -`)+r.raw,a.text+=` -`+r.text,this.inlineQueue.at(-1).src=a.text):n.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.raw.length);let a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(` -`)?"":` -`)+r.raw,a.text+=` -`+r.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},n.push(r));continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),n.push(r);continue}let s=t;if(this.options.extensions?.startBlock){let a=1/0,o=t.slice(1),l;this.options.extensions.startBlock.forEach(f=>{l=f.call({lexer:this},o),typeof l=="number"&&l>=0&&(a=Math.min(a,l))}),a<1/0&&a>=0&&(s=t.substring(0,a+1))}if(this.state.top&&(r=this.tokenizer.paragraph(s))){let a=n.at(-1);i&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(` -`)?"":` -`)+r.raw,a.text+=` -`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(r),i=s.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length);let a=n.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(` -`)?"":` -`)+r.raw,a.text+=` -`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(r);continue}if(t){let a="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){this.tokenizer.lexer=this;let i=t,r=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(i))!==null;)l.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(i))!==null;)i=i.slice(0,r.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(i))!==null;)s=r[2]?r[2].length:0,i=i.slice(0,r.index+s)+"["+"a".repeat(r[0].length-s-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let a=!1,o="";for(;t;){a||(o=""),a=!1;let l;if(this.options.extensions?.inline?.some(u=>(l=u.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(l.raw.length);let u=n.at(-1);l.type==="text"&&u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(t,i,o)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(t,i,o)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(t)){t=t.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(t))){t=t.substring(l.raw.length),n.push(l);continue}let f=t;if(this.options.extensions?.startInline){let u=1/0,h=t.slice(1),d;this.options.extensions.startInline.forEach(v=>{d=v.call({lexer:this},h),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(f=t.substring(0,u+1))}if(l=this.tokenizer.inlineText(f)){t=t.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),a=!0;let u=n.at(-1);u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return n}},Cr=class{options;parser;constructor(e){this.options=e||Zt}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(be.notSpaceStart)?.[0],r=e.replace(be.endingNewline,"")+` -`;return i?'
'+(n?r:tt(r,!0))+`
-`:"
"+(n?r:tt(r,!0))+`
-`}blockquote({tokens:e}){return`
-${this.parser.parse(e)}
-`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)} -`}hr(e){return`
-`}list(e){let t=e.ordered,n=e.start,i="";for(let a=0;a -`+i+" -`}listitem(e){return`
  • ${this.parser.parse(e.tokens)}
  • -`}checkbox({checked:e}){return" '}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    -`}table(e){let t="",n="";for(let r=0;r${i}`),` - -`+t+` -`+i+`
    -`}tablerow({text:e}){return` -${e} -`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+` -`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${tt(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let i=this.parser.parseInline(n),r=cs(e);if(r===null)return i;e=r;let s='
    ",s}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let r=cs(e);if(r===null)return tt(n);e=r;let s=`${tt(n)}{let a=r[s].flat(1/0);n=n.concat(this.walkTokens(a,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let s=t.renderers[r.name];s?t.renderers[r.name]=function(...a){let o=r.renderer.apply(this,a);return o===!1&&(o=s.apply(this,a)),o}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[r.level];s?s.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),n.renderer){let r=this.defaults.renderer||new Cr(this.defaults);for(let s in n.renderer){if(!(s in r))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=n.renderer[a],l=r[a];r[a]=(...f)=>{let u=o.apply(r,f);return u===!1&&(u=l.apply(r,f)),u||""}}i.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new Ir(this.defaults);for(let s in n.tokenizer){if(!(s in r))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=n.tokenizer[a],l=r[a];r[a]=(...f)=>{let u=o.apply(r,f);return u===!1&&(u=l.apply(r,f)),u}}i.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new Yn;for(let s in n.hooks){if(!(s in r))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=n.hooks[a],l=r[a];Yn.passThroughHooks.has(s)?r[a]=f=>{if(this.defaults.async&&Yn.passThroughHooksRespectAsync.has(s))return(async()=>{let h=await o.call(r,f);return l.call(r,h)})();let u=o.call(r,f);return l.call(r,u)}:r[a]=(...f)=>{if(this.defaults.async)return(async()=>{let h=await o.apply(r,f);return h===!1&&(h=await l.apply(r,f)),h})();let u=o.apply(r,f);return u===!1&&(u=l.apply(r,f)),u}}i.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,s=n.walkTokens;i.walkTokens=function(a){let o=[];return o.push(s.call(this,a)),r&&(o=o.concat(r.call(this,a))),o}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return qe.lex(e,t??this.defaults)}parser(e,t){return je.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},r={...this.defaults,...i},s=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let a=r.hooks?await r.hooks.preprocess(t):t,o=await(r.hooks?await r.hooks.provideLexer(e):e?qe.lex:qe.lexInline)(a,r),l=r.hooks?await r.hooks.processAllTokens(o):o;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let f=await(r.hooks?await r.hooks.provideParser(e):e?je.parse:je.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(f):f})().catch(s);try{r.hooks&&(t=r.hooks.preprocess(t));let a=(r.hooks?r.hooks.provideLexer(e):e?qe.lex:qe.lexInline)(t,r);r.hooks&&(a=r.hooks.processAllTokens(a)),r.walkTokens&&this.walkTokens(a,r.walkTokens);let o=(r.hooks?r.hooks.provideParser(e):e?je.parse:je.parseInline)(a,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(a){return s(a)}}}onError(e,t){return n=>{if(n.message+=` -Please report this to https://github.com/markedjs/marked.`,e){let i="

    An error occurred:

    "+tt(n.message+"",!0)+"
    ";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},qt=new cc;function F(e,t){return qt.parse(e,t)}F.options=F.setOptions=function(e){return qt.setOptions(e),F.defaults=qt.defaults,fa(F.defaults),F};F.getDefaults=Ti;F.defaults=Zt;F.use=function(...e){return qt.use(...e),F.defaults=qt.defaults,fa(F.defaults),F};F.walkTokens=function(e,t){return qt.walkTokens(e,t)};F.parseInline=qt.parseInline;F.Parser=je;F.parser=je.parse;F.Renderer=Cr;F.TextRenderer=Di;F.Lexer=qe;F.lexer=qe.lex;F.Tokenizer=Ir;F.Hooks=Yn;F.parse=F;F.options;F.setOptions;F.use;F.walkTokens;F.parseInline;je.parse;qe.lex;function pn(e){return yo.sanitize(F.parse(e,{async:!1}))}function yr(e){return new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(new Date(e))}var uc=ge(''),fc=ge(""),pc=ge(""),hc=ge(""),dc=ge(""),gc=ge('
    '),mc=ge('
    Quiet tide. Start with Markdown. Threads open from any root message.
    '),_c=ge('
    '),vc=ge(' '),bc=ge('
    '),kc=ge('

    Thread

    ',1),wc=ge('
    No thread open Pick a message to keep the side conversation tidy.
    '),yc=ge('

    ');function xc(e,t){hi(t,!1);const n=q(),i=q(),r=q();let s=q(null),a=q([]),o=q([]),l=q([]),f=q([]),u=q([]),h=q(""),d=q(""),v=q(""),_=q(null),S=q(null),b=q(""),A=q(""),U=q(""),D=q(""),C=q(""),B=q(""),H=q([]),G=q(null),pe=q("loading"),K=q(null),W;aa(()=>{J()}),Zl(()=>{p(K)?.close(),W&&window.clearTimeout(W)});async function J(){try{const g=await _e("/api/me");y(s,g.user),await ye(),y(pe,"ready")}catch(g){y(pe,g instanceof Error?g.message:"Could not load ClickClack")}}async function ye(){const g=await _e("/api/workspaces");y(a,g.workspaces),y(h,p(h)||p(a)[0]?.id||""),await De(),await Tn(),Rt()}async function Ge(){if(!p(U).trim())return;const g=await _e("/api/workspaces",{method:"POST",body:JSON.stringify({name:p(U)})});y(U,""),y(a,[...p(a),g.workspace]),y(h,g.workspace.id),await De(),await Tn(),Rt()}async function De(){if(!p(h))return;const g=await _e(`/api/workspaces/${p(h)}/channels`);y(o,g.channels),y(d,p(o).find(k=>k.id===p(d))?.id||p(o)[0]?.id||""),y(_,null),y(u,[]),await Le()}async function Vt(){if(!p(h)||!p(D).trim())return;const g=await _e(`/api/workspaces/${p(h)}/channels`,{method:"POST",body:JSON.stringify({name:p(D),kind:"public"})});y(D,""),y(o,[...p(o),g.channel]),y(d,g.channel.id),await Le()}async function Le(){if(p(v)){const k=await _e(`/api/dms/${p(v)}/messages`);y(f,k.messages);return}if(!p(d)){y(f,[]);return}const g=await _e(`/api/channels/${p(d)}/messages`);y(f,g.messages)}async function Xt(){const g=p(b).trim();if(!g||!p(d)&&!p(v))return;y(b,"");const k=p(v)?`/api/dms/${p(v)}/messages`:`/api/channels/${p(d)}/messages`,R=await _e(k,{method:"POST",body:JSON.stringify({body:g})});p(G)&&(await _e(`/api/messages/${R.message.id}/attachments`,{method:"POST",body:JSON.stringify({upload_id:p(G).id})}),y(G,null)),p(f).some(N=>N.id===R.message.id)||y(f,[...p(f),R.message])}async function At(g){y(_,g);const k=await _e(`/api/messages/${g.id}/thread`);y(_,k.root),y(u,k.replies),y(S,k.thread_state)}async function ar(){const g=p(A).trim();if(!g||!p(_))return;y(A,"");const k=await _e(`/api/messages/${p(_).id}/thread/replies`,{method:"POST",body:JSON.stringify({body:g})});p(u).some(R=>R.id===k.message.id)||y(u,[...p(u),k.message]),y(S,k.thread_state)}async function lr(){if(!p(h)||!p(B).trim()){y(H,[]);return}const g=await _e(`/api/search?workspace_id=${encodeURIComponent(p(h))}&q=${encodeURIComponent(p(B).trim())}`);y(H,g.results)}async function ee(g){const k=g.currentTarget,R=k.files?.[0];if(!R||!p(h))return;const N=new FormData;N.set("workspace_id",p(h)),N.set("file",R);const te=await _e("/api/uploads",{method:"POST",body:N});y(G,te.upload),k.value=""}async function Tn(){if(!p(h))return;const g=await _e(`/api/dms?workspace_id=${p(h)}`);y(l,g.conversations)}async function ae(){if(!p(h)||!p(C).trim())return;const g=await _e("/api/dms",{method:"POST",body:JSON.stringify({workspace_id:p(h),member_ids:[p(C).trim()]})});y(C,""),y(l,[...p(l),g.conversation]),y(v,g.conversation.id),y(d,""),y(_,null),await Le()}function Rt(){if(p(K)?.close(),!p(h))return;const g=localStorage.getItem(`clickclack:${p(h)}:cursor`)||"",k=new URL("/api/realtime/ws",window.location.href);k.protocol=window.location.protocol==="https:"?"wss:":"ws:",k.searchParams.set("workspace_id",p(h)),g&&k.searchParams.set("after_cursor",g),y(K,new WebSocket(k)),p(K).addEventListener("message",R=>{const N=JSON.parse(String(R.data));N.cursor&&localStorage.setItem(`clickclack:${p(h)}:cursor`,N.cursor),Y(N)}),p(K).addEventListener("close",()=>{W=window.setTimeout(Rt,1200)})}async function Y(g){if((g.type==="channel.created"||g.type==="channel.updated")&&g.workspace_id===p(h)){await De();return}(g.channel_id===p(d)||g.payload.direct_conversation_id===p(v))&&(g.type==="message.created"||g.type==="message.updated"||g.type==="message.deleted")&&await Le();const k=g.payload.root_message_id||g.payload.message_id;p(_)&&k===p(_).id&&await At(p(_))}Hr(()=>(p(a),p(h)),()=>{y(n,p(a).find(g=>g.id===p(h)))}),Hr(()=>(p(o),p(d)),()=>{y(i,p(o).find(g=>g.id===p(d)))}),Hr(()=>(p(l),p(v)),()=>{y(r,p(l).find(g=>g.id===p(v)))}),wl(),sa();var pt=yc();ia("1oa2eo8",g=>{var k=uc();ue(g,k)});var It=x(pt),We=x(It),or=E(x(We),2),En=E(x(or),2),cr=x(En),Sn=E(We,2),Qe=E(x(Sn),2);Mt(Qe,5,()=>p(a),Er,(g,k)=>{var R=fc();let N;var te=x(R);Ne(()=>{N=Mn(R,1,"",null,N,{active:p(k).id===p(h)}),re(te,(p(k),$(()=>p(k).name)))}),ot("click",R,async()=>{y(h,p(k).id),await De(),Rt()}),ue(g,R)});var ht=E(Qe,2),st=x(ht),Qt=E(Sn,2),Kt=E(x(Qt),2);Mt(Kt,5,()=>p(o),Er,(g,k)=>{var R=pc();let N;var te=E(x(R),1,!0);Ne(()=>{N=Mn(R,1,"",null,N,{active:p(k).id===p(d)}),re(te,(p(k),$(()=>p(k).name)))}),ot("click",R,async()=>{y(d,p(k).id),y(_,null),await Le()}),ue(g,R)});var at=E(Kt,2),Jt=x(at),en=E(Qt,2),An=E(x(en),2);Mt(An,5,()=>p(l),Er,(g,k)=>{var R=hc();let N;var te=E(x(R),1,!0);Ne(xe=>{N=Mn(R,1,"",null,N,{active:p(k).id===p(v)}),re(te,xe)},[()=>(p(k),$(()=>p(k).members.map(xe=>xe.display_name).join(", ")))]),ot("click",R,async()=>{y(v,p(k).id),y(d,""),y(_,null),await Le()}),ue(g,R)});var Rn=E(An,2),ur=x(Rn),tn=E(It,2),dt=x(tn),lt=x(dt),Re=x(lt),In=x(Re),fr=E(Re,2),pr=x(fr),Ct=E(lt,2),hr=x(Ct),Ot=E(Ct,2),nn=x(Ot),Ie=E(dt,2);{var gt=g=>{var k=gc();Mt(k,5,()=>p(H),R=>R.message.id,(R,N)=>{var te=dc(),xe=x(te),me=x(xe),Ke=E(xe,2),Je=x(Ke);Ne(()=>{re(me,(p(N),$(()=>p(N).message.author?.display_name||"Local User"))),re(Je,(p(N),$(()=>p(N).message.body)))}),ot("click",te,async()=>{y(H,[]),p(N).message.channel_id&&(y(d,p(N).message.channel_id),y(v,""),await Le()),p(N).message.direct_conversation_id&&(y(v,p(N).message.direct_conversation_id),y(d,""),await Le())}),ue(R,te)}),ue(g,k)};Wn(Ie,g=>{p(H),$(()=>p(H).length>0)&&g(gt)})}var rn=E(Ie,2),sn=x(rn);{var zr=g=>{var k=mc();ue(g,k)};Wn(sn,g=>{p(f),$(()=>p(f).length===0)&&g(zr)})}var Cn=E(sn,2);Mt(Cn,1,()=>p(f),g=>g.id,(g,k)=>{var R=_c();let N;var te=x(R),xe=x(te),me=E(te,2),Ke=x(me),Je=x(Ke),Dn=x(Je),on=E(Je,2),Lt=x(on),_t=E(Ke,2);Gr(_t,()=>(hn(pn),p(k),$(()=>pn(p(k).body))),!0);var T=E(_t,2);Ne((c,m)=>{N=Mn(R,1,"message",null,N,{selected:p(_)?.id===p(k).id}),re(xe,c),re(Dn,(p(k),$(()=>p(k).author?.display_name||"Local User"))),re(Lt,m)},[()=>(p(k),$(()=>p(k).author?.display_name?.slice(0,1)||"c")),()=>(hn(yr),p(k),$(()=>yr(p(k).created_at)))]),ot("click",T,()=>At(p(k))),ue(g,R)});var an=E(rn,2),dr=x(an),Dt=E(dr,2),gr=x(Dt),$r=x(gr),V=E(gr,2);{var mt=g=>{var k=vc(),R=x(k);Ne(()=>re(R,(p(G),$(()=>p(G).filename)))),ue(g,k)};Wn(V,g=>{p(G)&&g(mt)})}var Fr=E(V,2),On=E(tn,2);let ln;var mr=x(On);{var _r=g=>{var k=kc(),R=Us(k),N=x(R),te=E(x(N),2),xe=x(te),me=E(N,2),Ke=E(R,2),Je=x(Ke),Dn=x(Je),on=E(Je,2);Gr(on,()=>(hn(pn),p(_),$(()=>pn(p(_).body))),!0);var Lt=E(Ke,2);Mt(Lt,5,()=>p(u),m=>m.id,(m,w)=>{var z=bc(),le=x(z),Z=x(le),he=x(Z),Te=E(Z,2),Ce=x(Te),Ln=E(le,2);Gr(Ln,()=>(hn(pn),p(w),$(()=>pn(p(w).body))),!0),Ne(ne=>{re(he,(p(w),$(()=>p(w).author?.display_name||"Local User"))),re(Ce,ne)},[()=>(hn(yr),p(w),$(()=>yr(p(w).created_at)))]),ue(m,z)});var _t=E(Lt,2),T=x(_t),c=E(T,2);Ne(()=>{re(xe,`${p(S),p(u),$(()=>p(S)?.reply_count||p(u).length)??""} replies`),re(Dn,(p(_),$(()=>p(_).author?.display_name||"Local User")))}),ot("click",me,()=>{y(_,null),y(u,[])}),cn("submit",_t,m=>{m.preventDefault(),ar()}),un(T,()=>p(A),m=>y(A,m)),ot("click",c,()=>{ar()}),ue(g,k)},Ur=g=>{var k=wc();ue(g,k)};Wn(mr,g=>{p(_)?g(_r):g(Ur,-1)})}Ne(g=>{re(cr,(p(s),$(()=>p(s)?.display_name||"local"))),re(In,(p(n),$(()=>p(n)?.name||"Workspace"))),re(pr,g),et(Ot,"data-state",(p(K),$(()=>p(K)?.readyState===WebSocket.OPEN?"live":"idle"))),re(nn,(p(K),p(pe),$(()=>p(K)?.readyState===WebSocket.OPEN?"live":p(pe)))),ln=Mn(On,1,"thread",null,ln,{open:p(_)})},[()=>(p(r),p(i),$(()=>p(r)?"@"+p(r).members.map(g=>g.display_name).join(", "):"#"+(p(i)?.name||"general")))]),cn("submit",ht,g=>{g.preventDefault(),Ge()}),un(st,()=>p(U),g=>y(U,g)),cn("submit",at,g=>{g.preventDefault(),Vt()}),un(Jt,()=>p(D),g=>y(D,g)),cn("submit",Rn,g=>{g.preventDefault(),ae()}),un(ur,()=>p(C),g=>y(C,g)),cn("submit",Ct,g=>{g.preventDefault(),lr()}),un(hr,()=>p(B),g=>y(B,g)),cn("submit",an,g=>{g.preventDefault(),Xt()}),un(dr,()=>p(b),g=>y(b,g)),ot("change",$r,ee),ot("click",Fr,()=>{Xt()}),ue(e,pt),di()}Ol(["click","change"]);var Tc=ge(' ',1),Ec=ge("

    "),Sc=ge(`

    Self-hostable chat. Serious tool. Mild brine.

    ClickClack

    A single-binary chat app for teams, communities, bots, and agents: - Slack-style threads, durable realtime, OpenAPI, SQLite, and a CLI that - can drive the whole thing from a shell.

    What it is

    Chat infrastructure that stays boring when the socket drops.

    WebSocket is the pipe. The database is the truth. Every durable message, - thread reply, reaction, and channel update can be recovered over HTTP with - a cursor, so clients and agents can reconnect without drama.

    Agent path

    A friendly CLI, no LLM baked in.

    External agents, CI jobs, and humans use the same public API as the web - app. Tokens and workspace defaults are scoped per server, so switching - hosts does not leak credentials or stale IDs.

     

    Destinations

    Product at the root. Docs and app where people expect them.

    `);function Ac(e,t){hi(t,!1);const n="https://docs.clickclack.chat",i=["localhost","127.0.0.1","::1"].includes(window.location.hostname)?"/app":"https://app.clickclack.chat",r="https://github.com/openclaw/clickclack",s=[["Single binary","Go server, embedded Svelte app, embedded migrations, local SQLite and uploads."],["Threads that recover","Slack-style one-level threads with durable event replay after reconnects."],["Agent-friendly","A CLI, OpenAPI contract, TypeScript SDK, webhooks, and slash-command shapes."],["Self-host first","SQLite is the default, not the demo. Postgres can arrive behind the store layer."]],a=["clickclack serve --data ./data","clickclack login --magic-token mgt_...",'clickclack send --channel general "deploy started"',"clickclack threads reply msg_... --stdin {var Ge=Tc();kl(()=>{Ps.title="ClickClack - Self-hostable chat with claws"}),ue(ye,Ge)});var l=x(o),f=E(x(l),2),u=E(x(f),2),h=x(u);et(h,"href",n);var d=E(h,2),v=E(d,2);et(v,"href",r);var _=E(f,2),S=E(x(_),6),b=x(S),A=E(b,2);et(A,"href",n);var U=E(A,2);et(U,"href",r);var D=E(l,4);Mt(D,5,()=>s,Er,(ye,Ge)=>{var De=Ec(),Vt=x(De),Le=x(Vt),Xt=E(Vt,2),At=x(Xt);Ne(()=>{re(Le,p(Ge)[0]),re(At,p(Ge)[1])}),ue(ye,De)});var C=E(D,2),B=E(x(C),2),H=x(B),G=E(C,2),pe=E(x(G),2),K=E(x(pe),2);et(K,"href",n);var W=E(K,2),J=E(W,2);et(J,"href",r),Ne(ye=>{et(d,"href",i),et(b,"href",i),re(H,ye),et(W,"href",i)},[()=>a.join(` -`)]),ue(e,o),di()}function Rc(e){const t=window.location.pathname,i=window.location.hostname.startsWith("app.")||t==="/app"||t.startsWith("/app/");var r=Ml(),s=Us(r);{var a=l=>{xc(l,{})},o=l=>{Ac(l,{})};Wn(s,l=>{i?l(a):l(o,-1)})}ue(e,r)}Pl(Rc,{target:document.getElementById("app")}); diff --git a/apps/api/internal/webassets/dist/assets/index-Bi0i2ETT.js b/apps/api/internal/webassets/dist/assets/index-Bi0i2ETT.js new file mode 100644 index 0000000..fd3ceb4 --- /dev/null +++ b/apps/api/internal/webassets/dist/assets/index-Bi0i2ETT.js @@ -0,0 +1,68 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();const Aa=!1;var hs=Array.isArray,Ra=Array.prototype.indexOf,dn=Array.prototype.includes,Nr=Array.from,Ia=Object.defineProperty,Xn=Object.getOwnPropertyDescriptor,ds=Object.getOwnPropertyDescriptors,Ca=Object.prototype,Oa=Array.prototype,gi=Object.getPrototypeOf,Pi=Object.isExtensible;const Da=()=>{};function La(e){return e()}function Jr(e){for(var t=0;t{e=i,t=r});return{promise:n,resolve:e,reject:t}}const ke=2,gn=4,rr=8,ms=1<<24,st=16,Ke=32,Et=64,ei=128,Ue=512,oe=1024,ve=2048,Je=4096,Te=8192,He=16384,Zt=32768,zi=1<<25,mn=65536,ti=1<<17,_s=1<<18,Vt=1<<19,vs=1<<20,it=1<<25,Wt=65536,Ir=1<<21,er=1<<22,xt=1<<23,Qn=Symbol("$state"),Na=Symbol(""),ht=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function bs(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Ma(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Pa(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function za(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function $a(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Fa(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Ua(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Ha(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Ba(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Ga(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Wa(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const qa=1,ja=2,ks=4,Ya=8,Za=16,Va=1,Xa=2,de=Symbol(),ws="http://www.w3.org/1999/xhtml",Qa="http://www.w3.org/2000/svg",Ka="http://www.w3.org/1998/Math/MathML";function Ja(){console.warn("https://svelte.dev/e/derived_inert")}function el(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function ys(e){return e===this.v}function tl(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function xs(e){return!tl(e,this.v)}let ir=!1,nl=!1;function rl(){ir=!0}let X=null;function _n(e){X=e}function mi(e,t=!1,n){X={p:X,i:!1,c:null,e:null,s:e,x:null,r:L,l:ir&&!t?{s:null,u:null,$:[]}:null}}function _i(e){var t=X,n=t.e;if(n!==null){t.e=null;for(var i of n)qs(i)}return t.i=!0,X=t.p,{}}function sr(){return!ir||X!==null&&X.l===null}let Ft=[];function Ts(){var e=Ft;Ft=[],Jr(e)}function Tt(e){if(Ft.length===0&&!Kn){var t=Ft;queueMicrotask(()=>{t===Ft&&Ts()})}Ft.push(e)}function il(){for(;Ft.length>0;)Ts()}function Es(e){var t=L;if(t===null)return P.f|=xt,e;if((t.f&Zt)===0&&(t.f&gn)===0)throw e;wt(e,t)}function wt(e,t){for(;t!==null;){if((t.f&ei)!==0){if((t.f&Zt)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const sl=-7169;function te(e,t){e.f=e.f&sl|t}function vi(e){(e.f&Ue)!==0||e.deps===null?te(e,oe):te(e,Je)}function Ss(e){if(e!==null)for(const t of e)(t.f&ke)===0||(t.f&Wt)===0||(t.f^=Wt,Ss(t.deps))}function As(e,t,n){(e.f&ve)!==0?t.add(e):(e.f&Je)!==0&&n.add(e),Ss(e.deps),te(e,oe)}const Pt=new Set;let O=null,Xe=null,ni=null,Kn=!1,Gr=!1,hn=null,Sr=null;var $i=0;let al=1;class St{id=al++;current=new Map;previous=new Map;#n=new Set;#o=new Set;#e=new Set;#i=new Map;#r=new Map;#s=null;#t=[];#a=[];#c=new Set;#u=new Set;#l=new Map;#p=new Set;is_fork=!1;#d=!1;#h=new Set;#f(){return this.is_fork||this.#r.size>0}#_(){for(const i of this.#h)for(const r of i.#r.keys()){for(var t=!1,n=r;n.parent!==null;){if(this.#l.has(n)){t=!0;break}n=n.parent}if(!t)return!0}return!1}skip_effect(t){this.#l.has(t)||this.#l.set(t,{d:[],m:[]}),this.#p.delete(t)}unskip_effect(t,n=i=>this.schedule(i)){var i=this.#l.get(t);if(i){this.#l.delete(t);for(var r of i.d)te(r,ve),n(r);for(r of i.m)te(r,Je),n(r)}this.#p.add(t)}#g(){if($i++>1e3&&(Pt.delete(this),ol()),!this.#f()){for(const o of this.#c)this.#u.delete(o),te(o,ve),this.schedule(o);for(const o of this.#u)te(o,Je),this.schedule(o)}const t=this.#t;this.#t=[],this.apply();var n=hn=[],i=[],r=Sr=[];for(const o of t)try{this.#v(o,n,i)}catch(l){throw Cs(o),l}if(O=null,r.length>0){var s=St.ensure();for(const o of r)s.schedule(o)}if(hn=null,Sr=null,this.#f()||this.#_()){this.#m(i),this.#m(n);for(const[o,l]of this.#l)Is(o,l)}else{this.#i.size===0&&Pt.delete(this),this.#c.clear(),this.#u.clear();for(const o of this.#n)o(this);this.#n.clear(),Fi(i),Fi(n),this.#s?.resolve()}var a=O;if(this.#t.length>0){const o=a??=this;o.#t.push(...this.#t.filter(l=>!o.#t.includes(l)))}a!==null&&(Pt.add(a),a.#g())}#v(t,n,i){t.f^=oe;for(var r=t.first;r!==null;){var s=r.f,a=(s&(Ke|Et))!==0,o=a&&(s&oe)!==0,l=o||(s&Te)!==0||this.#l.has(r);if(!l&&r.fn!==null){a?r.f^=oe:(s&gn)!==0?n.push(r):bn(r)&&((s&st)!==0&&this.#u.add(r),jt(r));var f=r.first;if(f!==null){r=f;continue}}for(;r!==null;){var u=r.next;if(u!==null){r=u;break}r=r.parent}}}#m(t){for(var n=0;n!this.current.has(h));if(r.length===0)t&&u.discard();else if(n.length>0){if(t)for(const h of this.#p)u.unskip_effect(h,d=>{(d.f&(st|er))!==0?u.schedule(d):u.#m([d])});u.activate();var s=new Set,a=new Map;for(var o of n)Rs(o,r,s,a);a=new Map;var l=[...u.current.keys()].filter(h=>this.current.has(h)?this.current.get(h)[0]!==h:!0);for(const h of this.#a)(h.f&(He|Te|ti))===0&&bi(h,l,a)&&((h.f&(er|st))!==0?(te(h,ve),u.schedule(h)):u.#c.add(h));if(u.#t.length>0){u.apply();for(var f of u.#t)u.#v(f,[],[]);u.#t=[]}u.deactivate()}}for(const u of Pt)u.#h.has(this)&&(u.#h.delete(this),u.#h.size===0&&!u.#f()&&(u.activate(),u.#g()))}increment(t,n){let i=this.#i.get(n)??0;if(this.#i.set(n,i+1),t){let r=this.#r.get(n)??0;this.#r.set(n,r+1)}}decrement(t,n,i){let r=this.#i.get(n)??0;if(r===1?this.#i.delete(n):this.#i.set(n,r-1),t){let s=this.#r.get(n)??0;s===1?this.#r.delete(n):this.#r.set(n,s-1)}this.#d||i||(this.#d=!0,Tt(()=>{this.#d=!1,this.flush()}))}transfer_effects(t,n){for(const i of t)this.#c.add(i);for(const i of n)this.#u.add(i);t.clear(),n.clear()}oncommit(t){this.#n.add(t)}ondiscard(t){this.#o.add(t)}on_fork_commit(t){this.#e.add(t)}run_fork_commit_callbacks(){for(const t of this.#e)t(this);this.#e.clear()}settled(){return(this.#s??=gs()).promise}static ensure(){if(O===null){const t=O=new St;Gr||(Pt.add(O),Kn||Tt(()=>{O===t&&t.flush()}))}return O}apply(){{Xe=null;return}}schedule(t){if(ni=t,t.b?.is_pending&&(t.f&(gn|rr|ms))!==0&&(t.f&Zt)===0){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var i=n.f;if(hn!==null&&n===L&&(P===null||(P.f&ke)===0))return;if((i&(Et|Ke))!==0){if((i&oe)===0)return;n.f^=oe}}this.#t.push(n)}}function ll(e){var t=Kn;Kn=!0;try{for(var n;;){if(il(),O===null)return n;O.flush()}}finally{Kn=t}}function ol(){try{Ua()}catch(e){wt(e,ni)}}let pt=null;function Fi(e){var t=e.length;if(t!==0){for(var n=0;n0)){Ht.clear();for(const r of pt){if((r.f&(He|Te))!==0)continue;const s=[r];let a=r.parent;for(;a!==null;)pt.has(a)&&(pt.delete(a),s.push(a)),a=a.parent;for(let o=s.length-1;o>=0;o--){const l=s[o];(l.f&(He|Te))===0&&jt(l)}}pt.clear()}}pt=null}}function Rs(e,t,n,i){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const r of e.reactions){const s=r.f;(s&ke)!==0?Rs(r,t,n,i):(s&(er|st))!==0&&(s&ve)===0&&bi(r,t,i)&&(te(r,ve),ki(r))}}function bi(e,t,n){const i=n.get(e);if(i!==void 0)return i;if(e.deps!==null)for(const r of e.deps){if(dn.call(t,r))return!0;if((r.f&ke)!==0&&bi(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function ki(e){O.schedule(e)}function Is(e,t){if(!((e.f&Ke)!==0&&(e.f&oe)!==0)){(e.f&ve)!==0?t.d.push(e):(e.f&Je)!==0&&t.m.push(e),te(e,oe);for(var n=e.first;n!==null;)Is(n,t),n=n.next}}function Cs(e){te(e,oe);for(var t=e.first;t!==null;)Cs(t),t=t.next}function cl(e){let t=0,n=qt(0),i;return()=>{xi()&&(p(n),Pr(()=>(t===0&&(i=U(()=>e(()=>Jn(n)))),t+=1,()=>{Tt(()=>{t-=1,t===0&&(i?.(),i=void 0,Jn(n))})})))}}var ul=mn|Vt;function fl(e,t,n,i){new pl(e,t,n,i)}class pl{parent;is_pending=!1;transform_error;#n;#o=null;#e;#i;#r;#s=null;#t=null;#a=null;#c=null;#u=0;#l=0;#p=!1;#d=new Set;#h=new Set;#f=null;#_=cl(()=>(this.#f=qt(this.#u),()=>{this.#f=null}));constructor(t,n,i,r){this.#n=t,this.#e=n,this.#i=s=>{var a=L;a.b=this,a.f|=ei,i(s)},this.parent=L.b,this.transform_error=r??this.parent?.transform_error??(s=>s),this.#r=zr(()=>{this.#b()},ul)}#g(){try{this.#s=Fe(()=>this.#i(this.#n))}catch(t){this.error(t)}}#v(t){const n=this.#e.failed;n&&(this.#a=Fe(()=>{n(this.#n,()=>t,()=>()=>{})}))}#m(){const t=this.#e.pending;t&&(this.is_pending=!0,this.#t=Fe(()=>t(this.#n)),Tt(()=>{var n=this.#c=document.createDocumentFragment(),i=dt();n.append(i),this.#s=this.#w(()=>Fe(()=>this.#i(i))),this.#l===0&&(this.#n.before(n),this.#c=null,Bt(this.#t,()=>{this.#t=null}),this.#k(O))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#l=0,this.#u=0,this.#s=Fe(()=>{this.#i(this.#n)}),this.#l>0){var t=this.#c=document.createDocumentFragment();Si(this.#s,t);const n=this.#e.pending;this.#t=Fe(()=>n(this.#n))}else this.#k(O)}catch(n){this.error(n)}}#k(t){this.is_pending=!1,t.transfer_effects(this.#d,this.#h)}defer_effect(t){As(t,this.#d,this.#h)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#e.pending}#w(t){var n=L,i=P,r=X;We(this.#r),Ge(this.#r),_n(this.#r.ctx);try{return St.ensure(),t()}catch(s){return Es(s),null}finally{We(n),Ge(i),_n(r)}}#y(t,n){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(t,n);return}this.#l+=t,this.#l===0&&(this.#k(n),this.#t&&Bt(this.#t,()=>{this.#t=null}),this.#c&&(this.#n.before(this.#c),this.#c=null))}update_pending_count(t,n){this.#y(t,n),this.#u+=t,!(!this.#f||this.#p)&&(this.#p=!0,Tt(()=>{this.#p=!1,this.#f&&vn(this.#f,this.#u)}))}get_effect_pending(){return this.#_(),p(this.#f)}error(t){if(!this.#e.onerror&&!this.#e.failed)throw t;O?.is_fork?(this.#s&&O.skip_effect(this.#s),this.#t&&O.skip_effect(this.#t),this.#a&&O.skip_effect(this.#a),O.on_fork_commit(()=>{this.#x(t)})):this.#x(t)}#x(t){this.#s&&(Ce(this.#s),this.#s=null),this.#t&&(Ce(this.#t),this.#t=null),this.#a&&(Ce(this.#a),this.#a=null);var n=this.#e.onerror;let i=this.#e.failed;var r=!1,s=!1;const a=()=>{if(r){el();return}r=!0,s&&Wa(),this.#a!==null&&Bt(this.#a,()=>{this.#a=null}),this.#w(()=>{this.#b()})},o=l=>{try{s=!0,n?.(l,a),s=!1}catch(f){wt(f,this.#r&&this.#r.parent)}i&&(this.#a=this.#w(()=>{try{return Fe(()=>{var f=L;f.b=this,f.f|=ei,i(this.#n,()=>l,()=>a)})}catch(f){return wt(f,this.#r.parent),null}}))};Tt(()=>{var l;try{l=this.transform_error(t)}catch(f){wt(f,this.#r&&this.#r.parent);return}l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(o,f=>wt(f,this.#r&&this.#r.parent)):o(l)})}}function hl(e,t,n,i){const r=sr()?wi:Ds;var s=e.filter(d=>!d.settled);if(n.length===0&&s.length===0){i(t.map(r));return}var a=L,o=dl(),l=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(d=>d.promise)):null;function f(d){o();try{i(d)}catch(_){(a.f&He)===0&&wt(_,a)}Cr()}if(n.length===0){l.then(()=>f(t.map(r)));return}var u=Os();function h(){Promise.all(n.map(d=>gl(d))).then(d=>f([...t.map(r),...d])).catch(d=>wt(d,a)).finally(()=>u())}l?l.then(()=>{o(),h(),Cr()}):h()}function dl(){var e=L,t=P,n=X,i=O;return function(s=!0){We(e),Ge(t),_n(n),s&&(e.f&He)===0&&(i?.activate(),i?.apply())}}function Cr(e=!0){We(null),Ge(null),_n(null),e&&O?.deactivate()}function Os(){var e=L,t=e.b,n=O,i=t.is_rendered();return t.update_pending_count(1,n),n.increment(i,e),(r=!1)=>{t.update_pending_count(-1,n),n.decrement(i,e,r)}}function wi(e){var t=ke|ve;return L!==null&&(L.f|=Vt),{ctx:X,deps:null,effects:null,equals:ys,f:t,fn:e,reactions:null,rv:0,v:de,wv:0,parent:L,ac:null}}function gl(e,t,n){let i=L;i===null&&Ma();var r=void 0,s=qt(de),a=!P,o=new Map;return Rl(()=>{var l=L,f=gs();r=f.promise;try{Promise.resolve(e()).then(f.resolve,f.reject).finally(Cr)}catch(_){f.reject(_),Cr()}var u=O;if(a){if((l.f&Zt)!==0)var h=Os();if(i.b.is_rendered())o.get(u)?.reject(ht),o.delete(u);else{for(const _ of o.values())_.reject(ht);o.clear()}o.set(u,f)}const d=(_,m=void 0)=>{if(h){var S=m===ht;h(S)}if(!(m===ht||(l.f&He)!==0)){if(u.activate(),m)s.f|=xt,vn(s,m);else{(s.f&xt)!==0&&(s.f^=xt),vn(s,_);for(const[v,A]of o){if(o.delete(v),v===u)break;A.reject(ht)}}u.deactivate()}};f.promise.then(d,_=>d(null,_||"unknown"))}),Ws(()=>{for(const l of o.values())l.reject(ht)}),new Promise(l=>{function f(u){function h(){u===r?l(s):f(r)}u.then(h,h)}f(r)})}function Ds(e){const t=wi(e);return t.equals=xs,t}function ml(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n0&&!Ms&&vl()}return t}function vl(){Ms=!1;for(const e of ri)(e.f&oe)!==0&&te(e,Je),bn(e)&&jt(e);ri.clear()}function Jn(e){k(e,e.v+1)}function Ps(e,t,n){var i=e.reactions;if(i!==null)for(var r=sr(),s=i.length,a=0;a{if(Gt===s)return o();var l=P,f=Gt;Ge(null),Gi(s);var u=o();return Ge(l),Gi(f),u};return i&&n.set("length",bt(e.length)),new Proxy(e,{defineProperty(o,l,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&Ha();var u=n.get(l);return u===void 0?a(()=>{var h=bt(f.value);return n.set(l,h),h}):k(u,f.value,!0),!0},deleteProperty(o,l){var f=n.get(l);if(f===void 0){if(l in o){const u=a(()=>bt(de));n.set(l,u),Jn(r)}}else k(f,de),Jn(r);return!0},get(o,l,f){if(l===Qn)return e;var u=n.get(l),h=l in o;if(u===void 0&&(!h||Xn(o,l)?.writable)&&(u=a(()=>{var _=qn(h?o[l]:de),m=bt(_);return m}),n.set(l,u)),u!==void 0){var d=p(u);return d===de?void 0:d}return Reflect.get(o,l,f)},getOwnPropertyDescriptor(o,l){var f=Reflect.getOwnPropertyDescriptor(o,l);if(f&&"value"in f){var u=n.get(l);u&&(f.value=p(u))}else if(f===void 0){var h=n.get(l),d=h?.v;if(h!==void 0&&d!==de)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return f},has(o,l){if(l===Qn)return!0;var f=n.get(l),u=f!==void 0&&f.v!==de||Reflect.has(o,l);if(f!==void 0||L!==null&&(!u||Xn(o,l)?.writable)){f===void 0&&(f=a(()=>{var d=u?qn(o[l]):de,_=bt(d);return _}),n.set(l,f));var h=p(f);if(h===de)return!1}return u},set(o,l,f,u){var h=n.get(l),d=l in o;if(i&&l==="length")for(var _=f;_bt(de)),n.set(_+"",m))}if(h===void 0)(!d||Xn(o,l)?.writable)&&(h=a(()=>bt(void 0)),k(h,qn(f)),n.set(l,h));else{d=h.v!==de;var S=a(()=>qn(f));k(h,S)}var v=Reflect.getOwnPropertyDescriptor(o,l);if(v?.set&&v.set.call(u,f),!d){if(i&&typeof l=="string"){var A=n.get("length"),B=Number(l);Number.isInteger(B)&&B>=A.v&&k(A,B+1)}Jn(r)}return!0},ownKeys(o){p(r);var l=Reflect.ownKeys(o).filter(h=>{var d=n.get(h);return d===void 0||d.v!==de});for(var[f,u]of n)u.v!==de&&!(f in o)&&l.push(f);return l},setPrototypeOf(){Ba()}})}var Ui,zs,$s,Fs,Us;function bl(){if(Ui===void 0){Ui=window,zs=document,$s=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Fs=Xn(t,"firstChild").get,Us=Xn(t,"nextSibling").get,Pi(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Pi(n)&&(n.__t=void 0)}}function dt(e=""){return document.createTextNode(e)}function yt(e){return Fs.call(e)}function ar(e){return Us.call(e)}function T(e,t){return yt(e)}function ii(e,t=!1){{var n=yt(e);return n instanceof Comment&&n.data===""?ar(n):n}}function E(e,t=1,n=!1){let i=e;for(;t--;)i=ar(i);return i}function kl(e){e.textContent=""}function Hs(){return!1}function Bs(e,t,n){return document.createElementNS(t??ws,e,void 0)}let Hi=!1;function wl(){Hi||(Hi=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function Mr(e){var t=P,n=L;Ge(null),We(null);try{return e()}finally{Ge(t),We(n)}}function yl(e,t,n,i=n){e.addEventListener(t,()=>Mr(n));const r=e.__on_r;r?e.__on_r=()=>{r(),i(!0)}:e.__on_r=()=>i(!0),wl()}function Gs(e){L===null&&(P===null&&Fa(),$a()),At&&za()}function xl(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function at(e,t){var n=L;n!==null&&(n.f&Te)!==0&&(e|=Te);var i={ctx:X,deps:null,nodes:null,f:e|ve|Ue,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};O?.register_created_effect(i);var r=i;if((e&gn)!==0)hn!==null?hn.push(i):St.ensure().schedule(i);else if(t!==null){try{jt(i)}catch(a){throw Ce(i),a}r.deps===null&&r.teardown===null&&r.nodes===null&&r.first===r.last&&(r.f&Vt)===0&&(r=r.first,(e&st)!==0&&(e&mn)!==0&&r!==null&&(r.f|=mn))}if(r!==null&&(r.parent=n,n!==null&&xl(r,n),P!==null&&(P.f&ke)!==0&&(e&Et)===0)){var s=P;(s.effects??=[]).push(r)}return i}function xi(){return P!==null&&!Qe}function Ws(e){const t=at(rr,null);return te(t,oe),t.teardown=e,t}function si(e){Gs();var t=L.f,n=!P&&(t&Ke)!==0&&(t&Zt)===0;if(n){var i=X;(i.e??=[]).push(e)}else return qs(e)}function qs(e){return at(gn|vs,e)}function Tl(e){return Gs(),at(rr|vs,e)}function El(e){St.ensure();const t=at(Et|Vt,e);return(n={})=>new Promise(i=>{n.outro?Bt(t,()=>{Ce(t),i(void 0)}):(Ce(t),i(void 0))})}function Sl(e){return at(gn,e)}function Wr(e,t){var n=X,i={effect:null,ran:!1,deps:e};n.l.$.push(i),i.effect=Pr(()=>{if(e(),!i.ran){i.ran=!0;var r=L;try{We(r.parent),U(t)}finally{We(r)}}})}function Al(){var e=X;Pr(()=>{for(var t of e.l.$){t.deps();var n=t.effect;(n.f&oe)!==0&&n.deps!==null&&te(n,Je),bn(n)&&jt(n),t.ran=!1}})}function Rl(e){return at(er|Vt,e)}function Pr(e,t=0){return at(rr|t,e)}function ze(e,t=[],n=[],i=[]){hl(i,t,n,r=>{at(rr,()=>e(...r.map(p)))})}function zr(e,t=0){var n=at(st|t,e);return n}function Fe(e){return at(Ke|Vt,e)}function js(e){var t=e.teardown;if(t!==null){const n=At,i=P;Bi(!0),Ge(null);try{t.call(null)}finally{Bi(n),Ge(i)}}}function Ti(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const r=n.ac;r!==null&&Mr(()=>{r.abort(ht)});var i=n.next;(n.f&Et)!==0?n.parent=null:Ce(n,t),n=i}}function Il(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&Ke)===0&&Ce(t),t=n}}function Ce(e,t=!0){var n=!1;(t||(e.f&_s)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(Ys(e.nodes.start,e.nodes.end),n=!0),te(e,zi),Ti(e,t&&!n),tr(e,0);var i=e.nodes&&e.nodes.t;if(i!==null)for(const s of i)s.stop();js(e),e.f^=zi,e.f|=He;var r=e.parent;r!==null&&r.first!==null&&Zs(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Ys(e,t){for(;e!==null;){var n=e===t?null:ar(e);e.remove(),e=n}}function Zs(e){var t=e.parent,n=e.prev,i=e.next;n!==null&&(n.next=i),i!==null&&(i.prev=n),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function Bt(e,t,n=!0){var i=[];Vs(e,i,!0);var r=()=>{n&&Ce(e),t&&t()},s=i.length;if(s>0){var a=()=>--s||r();for(var o of i)o.out(a)}else r()}function Vs(e,t,n){if((e.f&Te)===0){e.f^=Te;var i=e.nodes&&e.nodes.t;if(i!==null)for(const o of i)(o.is_global||n)&&t.push(o);for(var r=e.first;r!==null;){var s=r.next;if((r.f&Et)===0){var a=(r.f&mn)!==0||(r.f&Ke)!==0&&(e.f&st)!==0;Vs(r,t,a?n:!1)}r=s}}}function Ei(e){Xs(e,!0)}function Xs(e,t){if((e.f&Te)!==0){e.f^=Te,(e.f&oe)===0&&(te(e,ve),St.ensure().schedule(e));for(var n=e.first;n!==null;){var i=n.next,r=(n.f&mn)!==0||(n.f&Ke)!==0;Xs(n,r?t:!1),n=i}var s=e.nodes&&e.nodes.t;if(s!==null)for(const a of s)(a.is_global||t)&&a.in()}}function Si(e,t){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end;n!==null;){var r=n===i?null:ar(n);t.append(n),n=r}}let Ar=!1,At=!1;function Bi(e){At=e}let P=null,Qe=!1;function Ge(e){P=e}let L=null;function We(e){L=e}let Be=null;function Cl(e){P!==null&&(Be===null?Be=[e]:Be.push(e))}let Ie=null,Ne=0,$e=null;function Ol(e){$e=e}let Qs=1,Ut=0,Gt=Ut;function Gi(e){Gt=e}function Ks(){return++Qs}function bn(e){var t=e.f;if((t&ve)!==0)return!0;if(t&ke&&(e.f&=~Wt),(t&Je)!==0){for(var n=e.deps,i=n.length,r=0;re.wv)return!0}(t&Ue)!==0&&Xe===null&&te(e,oe)}return!1}function Js(e,t,n=!0){var i=e.reactions;if(i!==null&&!(Be!==null&&dn.call(Be,e)))for(var r=0;r{e.ac.abort(ht)}),e.ac=null);try{e.f|=Ir;var u=e.fn,h=u();e.f|=Zt;var d=e.deps,_=O?.is_fork;if(Ie!==null){var m;if(_||tr(e,Ne),d!==null&&Ne>0)for(d.length=Ne+Ie.length,m=0;mn?.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Tt(()=>{t.addEventListener(e,r,i)}):t.addEventListener(e,r,i),r}function sn(e,t,n,i,r){var s={capture:i,passive:r},a=Pl(e,t,n,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Ws(()=>{t.removeEventListener(e,a,s)})}function ft(e,t,n){(t[jn]??={})[e]=n}function zl(e){for(var t=0;t{throw v});throw d}}finally{e[jn]=t,delete e.currentTarget,Ge(u),We(h)}}}const $l=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Fl(e){return $l?.createHTML(e)??e}function Ul(e){var t=Bs("template");return t.innerHTML=Fl(e.replaceAll("","")),t.content}function nr(e,t){var n=L;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function be(e,t){var n=(t&Va)!==0,i=(t&Xa)!==0,r,s=!e.startsWith("");return()=>{r===void 0&&(r=Ul(s?e:""+e),n||(r=yt(r)));var a=i||$s?document.importNode(r,!0):r.cloneNode(!0);if(n){var o=yt(a),l=a.lastChild;nr(o,l)}else nr(a,a);return a}}function ia(){var e=document.createDocumentFragment(),t=document.createComment(""),n=dt();return e.append(t,n),nr(t,n),e}function ue(e,t){e!==null&&e.before(t)}function le(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=`${n}`)}function Hl(e,t){return Bl(e,t)}const wr=new Map;function Bl(e,{target:t,anchor:n,props:i={},events:r,context:s,intro:a=!0,transformError:o}){bl();var l=void 0,f=El(()=>{var u=n??t.appendChild(dt());fl(u,{pending:()=>{}},_=>{mi({});var m=X;s&&(m.c=s),r&&(i.$$events=r),l=e(_,i)||{},_i()},o);var h=new Set,d=_=>{for(var m=0;m<_.length;m++){var S=_[m];if(!h.has(S)){h.add(S);var v=Ml(S);for(const D of[t,document]){var A=wr.get(D);A===void 0&&(A=new Map,wr.set(D,A));var B=A.get(S);B===void 0?(D.addEventListener(S,oi,{passive:v}),A.set(S,1)):A.set(S,B+1)}}}};return d(Nr(ra)),li.add(d),()=>{for(var _ of h)for(const v of[t,document]){var m=wr.get(v),S=m.get(_);--S==0?(v.removeEventListener(_,oi),m.delete(_),m.size===0&&wr.delete(v)):m.set(_,S)}li.delete(d),u!==n&&u.parentNode?.removeChild(u)}});return Gl.set(l,f),l}let Gl=new WeakMap;class Wl{anchor;#n=new Map;#o=new Map;#e=new Map;#i=new Set;#r=!0;constructor(t,n=!0){this.anchor=t,this.#r=n}#s=t=>{if(this.#n.has(t)){var n=this.#n.get(t),i=this.#o.get(n);if(i)Ei(i),this.#i.delete(n);else{var r=this.#e.get(n);r&&(this.#o.set(n,r.effect),this.#e.delete(n),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),i=r.effect)}for(const[s,a]of this.#n){if(this.#n.delete(s),s===t)break;const o=this.#e.get(a);o&&(Ce(o.effect),this.#e.delete(a))}for(const[s,a]of this.#o){if(s===n||this.#i.has(s))continue;const o=()=>{if(Array.from(this.#n.values()).includes(s)){var f=document.createDocumentFragment();Si(a,f),f.append(dt()),this.#e.set(s,{effect:a,fragment:f})}else Ce(a);this.#i.delete(s),this.#o.delete(s)};this.#r||!i?(this.#i.add(s),Bt(a,o,!1)):o()}}};#t=t=>{this.#n.delete(t);const n=Array.from(this.#n.values());for(const[i,r]of this.#e)n.includes(i)||(Ce(r.effect),this.#e.delete(i))};ensure(t,n){var i=O,r=Hs();if(n&&!this.#o.has(t)&&!this.#e.has(t))if(r){var s=document.createDocumentFragment(),a=dt();s.append(a),this.#e.set(t,{effect:Fe(()=>n(a)),fragment:s})}else this.#o.set(t,Fe(()=>n(this.anchor)));if(this.#n.set(i,t),r){for(const[o,l]of this.#o)o===t?i.unskip_effect(l):i.skip_effect(l);for(const[o,l]of this.#e)o===t?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit(this.#s),i.ondiscard(this.#t)}else this.#s(i)}}function un(e,t,n=!1){var i=new Wl(e),r=n?mn:0;function s(a,o){i.ensure(a,o)}zr(()=>{var a=!1;t((o,l=0)=>{a=!0,s(l,o)}),a||s(-1,null)},r)}function Rr(e,t){return t}function ql(e,t,n){for(var i=[],r=t.length,s,a=t.length,o=0;o{if(s){if(s.pending.delete(h),s.done.add(h),s.pending.size===0){var d=e.outrogroups;ci(e,Nr(s.done)),d.delete(s),d.size===0&&(e.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=i.length===0&&n!==null;if(l){var f=n,u=f.parentNode;kl(u),u.append(f),e.items.clear()}ci(e,t,!l)}else s={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(s)}function ci(e,t,n=!0){var i;if(e.pending.size>0){i=new Set;for(const a of e.pending.values())for(const o of a)i.add(e.items.get(o).e)}for(var r=0;r{var D=n();return hs(D)?D:D==null?[]:Nr(D)}),d,_=new Map,m=!0;function S(D){(B.effect.f&He)===0&&(B.pending.delete(D),B.fallback=u,jl(B,d,a,t,i),u!==null&&(d.length===0?(u.f&it)===0?Ei(u):(u.f^=it,Yn(u,null,a)):Bt(u,()=>{u=null})))}function v(D){B.pending.delete(D)}var A=zr(()=>{d=p(h);for(var D=d.length,C=new Set,G=O,j=Hs(),Y=0;Ys(a)):(u=Fe(()=>s(qi??=dt())),u.f|=it)),D>C.size&&Pa(),!m)if(_.set(G,C),j){for(const[Q,Ae]of o)C.has(Q)||G.skip_effect(Ae.e);G.oncommit(S),G.ondiscard(v)}else S(G);p(h)}),B={effect:A,items:o,pending:_,outrogroups:null,fallback:u};m=!1}function zn(e){for(;e!==null&&(e.f&Ke)===0;)e=e.next;return e}function jl(e,t,n,i,r){var s=(i&Ya)!==0,a=t.length,o=e.items,l=zn(e.effect.first),f,u=null,h,d=[],_=[],m,S,v,A;if(s)for(A=0;A0){var Se=(i&ks)!==0&&a===0?n:null;if(s){for(A=0;A{if(h!==void 0)for(v of h)v.nodes?.a?.apply()})}function Yl(e,t,n,i,r,s,a,o){var l=(a&qa)!==0?(a&Za)===0?q(n,!1,!1):qt(n):null,f=(a&ja)!==0?qt(r):null;return{v:l,i:f,e:Fe(()=>(s(t,l??n,f??r,o),()=>{e.delete(i)}))}}function Yn(e,t,n){if(e.nodes)for(var i=e.nodes.start,r=e.nodes.end,s=t&&(t.f&it)===0?t.nodes.start:n;i!==null;){var a=ar(i);if(s.before(i),i===r)return;i=a}}function kt(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function qr(e,t,n=!1,i=!1,r=!1,s=!1){var a=e,o="";if(n)var l=e;ze(()=>{var f=L;if(o!==(o=t()??"")){if(n){f.nodes=null,l.innerHTML=o,o!==""&&nr(yt(l),l.lastChild);return}if(f.nodes!==null&&(Ys(f.nodes.start,f.nodes.end),f.nodes=null),o!==""){var u=i?Qa:r?Ka:void 0,h=Bs(i?"svg":r?"math":"template",u);h.innerHTML=o;var d=i||r?h:h.content;if(nr(yt(d),d.lastChild),i||r)for(;yt(d);)a.before(yt(d));else a.before(d)}}})}function sa(e,t){var n;n=document.head.appendChild(dt()),zr(()=>t(n),_s|Vt)}const ji=[...` +\r\f \v\uFEFF`];function Zl(e,t,n){var i=e==null?"":""+e;if(n){for(var r of Object.keys(n))if(n[r])i=i?i+" "+r:r;else if(i.length)for(var s=r.length,a=0;(a=i.indexOf(r,a))>=0;){var o=a+s;(a===0||ji.includes(i[a-1]))&&(o===i.length||ji.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}function $n(e,t,n,i,r,s){var a=e.__className;if(a!==n||a===void 0){var o=Zl(n,i,s);o==null?e.removeAttribute("class"):e.className=o,e.__className=n}else if(s&&r!==s)for(var l in s){var f=!!s[l];(r==null||f!==!!r[l])&&e.classList.toggle(l,f)}return s}const Vl=Symbol("is custom element"),Xl=Symbol("is html");function nt(e,t,n,i){var r=Ql(e);r[t]!==(r[t]=n)&&(t==="loading"&&(e[Na]=n),n==null?e.removeAttribute(t):typeof n!="string"&&Kl(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Ql(e){return e.__attributes??={[Vl]:e.nodeName.includes("-"),[Xl]:e.namespaceURI===ws}}var Yi=new Map;function Kl(e){var t=e.getAttribute("is")||e.nodeName,n=Yi.get(t);if(n)return n;Yi.set(t,n=[]);for(var i,r=e,s=Element.prototype;s!==r;){i=ds(r);for(var a in i)i[a].set&&n.push(a);r=gi(r)}return n}function an(e,t,n=t){var i=new WeakSet;yl(e,"input",async r=>{var s=r?e.defaultValue:e.value;if(s=jr(e)?Yr(s):s,n(s),O!==null&&i.add(O),await Ll(),s!==(s=t())){var a=e.selectionStart,o=e.selectionEnd,l=e.value.length;if(e.value=s??"",o!==null){var f=e.value.length;a===o&&o===l&&f>l?(e.selectionStart=f,e.selectionEnd=f):(e.selectionStart=a,e.selectionEnd=Math.min(o,f))}}}),U(t)==null&&e.value&&(n(jr(e)?Yr(e.value):e.value),O!==null&&i.add(O)),Pr(()=>{var r=t();if(e===document.activeElement){var s=O;if(i.has(s))return}jr(e)&&r===Yr(e.value)||e.type==="date"&&!r&&!e.value||r!==e.value&&(e.value=r??"")})}function jr(e){var t=e.type;return t==="number"||t==="range"}function Yr(e){return e===""?null:+e}function aa(e=!1){const t=X,n=t.l.u;if(!n)return;let i=()=>cn(t.s);if(e){let r=0,s={};const a=wi(()=>{let o=!1;const l=t.s;for(const f in l)l[f]!==s[f]&&(s[f]=l[f],o=!0);return o&&r++,r});i=()=>p(a)}n.b.length&&Tl(()=>{Zi(t,i),Jr(n.b)}),si(()=>{const r=U(()=>n.m.map(La));return()=>{for(const s of r)typeof s=="function"&&s()}}),n.a.length&&si(()=>{Zi(t,i),Jr(n.a)})}function Zi(e,t){if(e.l.s)for(const n of e.l.s)p(n);t()}function la(e){X===null&&bs(),ir&&X.l!==null?eo(X).m.push(e):si(()=>{const t=U(e);if(typeof t=="function")return t})}function Jl(e){X===null&&bs(),la(()=>()=>U(e))}function eo(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}const to="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(to);rl();class oa extends Error{constructor(t,n){super(n),this.status=t}status}async function we(e,t={}){const n=new Headers(t.headers);n.set("Accept","application/json"),t.body&&!(t.body instanceof FormData)&&n.set("Content-Type","application/json");const i=await fetch(e,{...t,headers:n});if(!i.ok)throw new oa(i.status,await i.text());return i.json()}const{entries:ca,setPrototypeOf:Vi,isFrozen:no,getPrototypeOf:ro,getOwnPropertyDescriptor:io}=Object;let{freeze:Ee,seal:qe,create:fn}=Object,{apply:ui,construct:fi}=typeof Reflect<"u"&&Reflect;Ee||(Ee=function(t){return t});qe||(qe=function(t){return t});ui||(ui=function(t,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),s=2;s1?n-1:0),r=1;r"u"?null:ce(BigInt.prototype.toString),es=typeof Symbol>"u"?null:ce(Symbol.prototype.toString),ee=ce(Object.prototype.hasOwnProperty),Hn=ce(Object.prototype.toString),_e=ce(RegExp.prototype.test),yr=uo(TypeError);function ce(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:Zn;if(Vi&&Vi(e,null),!ye(t))return e;let i=t.length;for(;i--;){let r=t[i];if(typeof r=="string"){const s=n(r);s!==r&&(no(t)||(t[i]=s),r=s)}e[r]=!0}return e}function fo(e){for(let t=0;t/gm),bo=qe(/\$\{[\w\W]*/gm),ko=qe(/^data-[\-\w.\u00B7-\uFFFF]+$/),wo=qe(/^aria-[\-\w]+$/),ua=qe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yo=qe(/^(?:\w+script|data):/i),xo=qe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fa=qe(/^html$/i),To=qe(/^[a-z][.\w]*(-[.\w]+)+$/i);var ss=Object.freeze({__proto__:null,ARIA_ATTR:wo,ATTR_WHITESPACE:xo,CUSTOM_ELEMENT:To,DATA_ATTR:ko,DOCTYPE_NAME:fa,ERB_EXPR:vo,IS_ALLOWED_URI:ua,IS_SCRIPT_OR_DATA:yo,MUSTACHE_EXPR:_o,TMPLIT_EXPR:bo});const Bn={element:1,text:3,progressingInstruction:7,comment:8,document:9},Eo=function(){return typeof window>"u"?null:window},So=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(i=n.getAttribute(r));const s="dompurify"+(i?"#"+i:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},as=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function pa(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Eo();const t=x=>pa(x);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Bn.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,r=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:o,Element:l,NodeFilter:f,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:h,DOMParser:d,trustedTypes:_}=e,m=l.prototype,S=pn(m,"cloneNode"),v=pn(m,"remove"),A=pn(m,"nextSibling"),B=pn(m,"childNodes"),D=pn(m,"parentNode");if(typeof a=="function"){const x=n.createElement("template");x.content&&x.content.ownerDocument&&(n=x.content.ownerDocument)}let C,G="";const{implementation:j,createNodeIterator:Y,createDocumentFragment:ge,getElementsByTagName:Se}=n,{importNode:z}=i;let Q=as();t.isSupported=typeof ca=="function"&&typeof D=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ae,ERB_EXPR:je,TMPLIT_EXPR:lt,DATA_ATTR:ot,ARIA_ATTR:wn,IS_SCRIPT_OR_DATA:Me,ATTR_WHITESPACE:Rt,CUSTOM_ELEMENT:or}=ss;let{IS_ALLOWED_URI:yn}=ss,se=null;const cr=I({},[...ts,...Vr,...Xr,...Qr,...ns]);let ae=null;const ur=I({},[...rs,...Kr,...is,...xr]);let W=Object.seal(fn(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),It=null,Ct=null;const et=Object.seal(fn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let fr=!0,xn=!0,b=!1,M=!0,ne=!1,fe=!0,Ye=!1,Tn=!1,En=!1,ct=!1,Ot=!1,Dt=!1,pr=!0,Sn=!1;const An="user-content-";let Qt=!0,Lt=!1,gt={},Oe=null;const Kt=I({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let hr=null;const Rn=I({},["audio","video","img","source","image","track"]);let Jt=null;const In=I({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Nt="http://www.w3.org/1998/Math/MathML",en="http://www.w3.org/2000/svg",Pe="http://www.w3.org/1999/xhtml";let mt=Pe,Mt=!1,Cn=null;const dr=I({},[Nt,en,Pe],Zr);let On=I({},["mi","mo","mn","ms","mtext"]),tn=I({},["annotation-xml"]);const Ur=I({},["title","style","font","a","script"]);let _t=null;const gr=["application/xhtml+xml","text/html"],Hr="text/html";let re=null,ut=null;const mr=n.createElement("form"),_r=function(c){return c instanceof RegExp||c instanceof Function},nn=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ut&&ut===c)return;(!c||typeof c!="object")&&(c={}),c=Re(c),_t=gr.indexOf(c.PARSER_MEDIA_TYPE)===-1?Hr:c.PARSER_MEDIA_TYPE,re=_t==="application/xhtml+xml"?Zr:Zn,se=ee(c,"ALLOWED_TAGS")&&ye(c.ALLOWED_TAGS)?I({},c.ALLOWED_TAGS,re):cr,ae=ee(c,"ALLOWED_ATTR")&&ye(c.ALLOWED_ATTR)?I({},c.ALLOWED_ATTR,re):ur,Cn=ee(c,"ALLOWED_NAMESPACES")&&ye(c.ALLOWED_NAMESPACES)?I({},c.ALLOWED_NAMESPACES,Zr):dr,Jt=ee(c,"ADD_URI_SAFE_ATTR")&&ye(c.ADD_URI_SAFE_ATTR)?I(Re(In),c.ADD_URI_SAFE_ATTR,re):In,hr=ee(c,"ADD_DATA_URI_TAGS")&&ye(c.ADD_DATA_URI_TAGS)?I(Re(Rn),c.ADD_DATA_URI_TAGS,re):Rn,Oe=ee(c,"FORBID_CONTENTS")&&ye(c.FORBID_CONTENTS)?I({},c.FORBID_CONTENTS,re):Kt,It=ee(c,"FORBID_TAGS")&&ye(c.FORBID_TAGS)?I({},c.FORBID_TAGS,re):Re({}),Ct=ee(c,"FORBID_ATTR")&&ye(c.FORBID_ATTR)?I({},c.FORBID_ATTR,re):Re({}),gt=ee(c,"USE_PROFILES")?c.USE_PROFILES&&typeof c.USE_PROFILES=="object"?Re(c.USE_PROFILES):c.USE_PROFILES:!1,fr=c.ALLOW_ARIA_ATTR!==!1,xn=c.ALLOW_DATA_ATTR!==!1,b=c.ALLOW_UNKNOWN_PROTOCOLS||!1,M=c.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ne=c.SAFE_FOR_TEMPLATES||!1,fe=c.SAFE_FOR_XML!==!1,Ye=c.WHOLE_DOCUMENT||!1,ct=c.RETURN_DOM||!1,Ot=c.RETURN_DOM_FRAGMENT||!1,Dt=c.RETURN_TRUSTED_TYPE||!1,En=c.FORCE_BODY||!1,pr=c.SANITIZE_DOM!==!1,Sn=c.SANITIZE_NAMED_PROPS||!1,Qt=c.KEEP_CONTENT!==!1,Lt=c.IN_PLACE||!1,yn=ho(c.ALLOWED_URI_REGEXP)?c.ALLOWED_URI_REGEXP:ua,mt=typeof c.NAMESPACE=="string"?c.NAMESPACE:Pe,On=ee(c,"MATHML_TEXT_INTEGRATION_POINTS")&&c.MATHML_TEXT_INTEGRATION_POINTS&&typeof c.MATHML_TEXT_INTEGRATION_POINTS=="object"?Re(c.MATHML_TEXT_INTEGRATION_POINTS):I({},["mi","mo","mn","ms","mtext"]),tn=ee(c,"HTML_INTEGRATION_POINTS")&&c.HTML_INTEGRATION_POINTS&&typeof c.HTML_INTEGRATION_POINTS=="object"?Re(c.HTML_INTEGRATION_POINTS):I({},["annotation-xml"]);const g=ee(c,"CUSTOM_ELEMENT_HANDLING")&&c.CUSTOM_ELEMENT_HANDLING&&typeof c.CUSTOM_ELEMENT_HANDLING=="object"?Re(c.CUSTOM_ELEMENT_HANDLING):fn(null);if(W=fn(null),ee(g,"tagNameCheck")&&_r(g.tagNameCheck)&&(W.tagNameCheck=g.tagNameCheck),ee(g,"attributeNameCheck")&&_r(g.attributeNameCheck)&&(W.attributeNameCheck=g.attributeNameCheck),ee(g,"allowCustomizedBuiltInElements")&&typeof g.allowCustomizedBuiltInElements=="boolean"&&(W.allowCustomizedBuiltInElements=g.allowCustomizedBuiltInElements),ne&&(xn=!1),Ot&&(ct=!0),gt&&(se=I({},ns),ae=fn(null),gt.html===!0&&(I(se,ts),I(ae,rs)),gt.svg===!0&&(I(se,Vr),I(ae,Kr),I(ae,xr)),gt.svgFilters===!0&&(I(se,Xr),I(ae,Kr),I(ae,xr)),gt.mathMl===!0&&(I(se,Qr),I(ae,is),I(ae,xr))),et.tagCheck=null,et.attributeCheck=null,ee(c,"ADD_TAGS")&&(typeof c.ADD_TAGS=="function"?et.tagCheck=c.ADD_TAGS:ye(c.ADD_TAGS)&&(se===cr&&(se=Re(se)),I(se,c.ADD_TAGS,re))),ee(c,"ADD_ATTR")&&(typeof c.ADD_ATTR=="function"?et.attributeCheck=c.ADD_ATTR:ye(c.ADD_ATTR)&&(ae===ur&&(ae=Re(ae)),I(ae,c.ADD_ATTR,re))),ee(c,"ADD_URI_SAFE_ATTR")&&ye(c.ADD_URI_SAFE_ATTR)&&I(Jt,c.ADD_URI_SAFE_ATTR,re),ee(c,"FORBID_CONTENTS")&&ye(c.FORBID_CONTENTS)&&(Oe===Kt&&(Oe=Re(Oe)),I(Oe,c.FORBID_CONTENTS,re)),ee(c,"ADD_FORBID_CONTENTS")&&ye(c.ADD_FORBID_CONTENTS)&&(Oe===Kt&&(Oe=Re(Oe)),I(Oe,c.ADD_FORBID_CONTENTS,re)),Qt&&(se["#text"]=!0),Ye&&I(se,["html","head","body"]),se.table&&(I(se,["tbody"]),delete It.tbody),c.TRUSTED_TYPES_POLICY){if(typeof c.TRUSTED_TYPES_POLICY.createHTML!="function")throw yr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof c.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw yr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=c.TRUSTED_TYPES_POLICY,G=C.createHTML("")}else C===void 0&&(C=So(_,r)),C!==null&&typeof G=="string"&&(G=C.createHTML(""));Ee&&Ee(c),ut=c},vr=I({},[...Vr,...Xr,...go]),Dn=I({},[...Qr,...mo]),Br=function(c){let g=D(c);(!g||!g.tagName)&&(g={namespaceURI:mt,tagName:"template"});const w=Zn(c.tagName),$=Zn(g.tagName);return Cn[c.namespaceURI]?c.namespaceURI===en?g.namespaceURI===Pe?w==="svg":g.namespaceURI===Nt?w==="svg"&&($==="annotation-xml"||On[$]):!!vr[w]:c.namespaceURI===Nt?g.namespaceURI===Pe?w==="math":g.namespaceURI===en?w==="math"&&tn[$]:!!Dn[w]:c.namespaceURI===Pe?g.namespaceURI===en&&!tn[$]||g.namespaceURI===Nt&&!On[$]?!1:!Dn[w]&&(Ur[w]||!vr[w]):!!(_t==="application/xhtml+xml"&&Cn[c.namespaceURI]):!1},De=function(c){Un(t.removed,{element:c});try{D(c).removeChild(c)}catch{v(c)}},tt=function(c,g){try{Un(t.removed,{attribute:g.getAttributeNode(c),from:g})}catch{Un(t.removed,{attribute:null,from:g})}if(g.removeAttribute(c),c==="is")if(ct||Ot)try{De(g)}catch{}else try{g.setAttribute(c,"")}catch{}},Ln=function(c){let g=null,w=null;if(En)c=""+c;else{const V=Qi(c,/^[\r\n\t ]+/);w=V&&V[0]}_t==="application/xhtml+xml"&&mt===Pe&&(c=''+c+"");const $=C?C.createHTML(c):c;if(mt===Pe)try{g=new d().parseFromString($,_t)}catch{}if(!g||!g.documentElement){g=j.createDocument(mt,"template",null);try{g.documentElement.innerHTML=Mt?G:$}catch{}}const K=g.body||g.documentElement;return c&&w&&K.insertBefore(n.createTextNode(w),K.childNodes[0]||null),mt===Pe?Se.call(g,Ye?"html":"body")[0]:Ye?g.documentElement:K},br=function(c){return Y.call(c.ownerDocument||c,c,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},Nn=function(c){return c instanceof h&&(typeof c.nodeName!="string"||typeof c.textContent!="string"||typeof c.removeChild!="function"||!(c.attributes instanceof u)||typeof c.removeAttribute!="function"||typeof c.setAttribute!="function"||typeof c.namespaceURI!="string"||typeof c.insertBefore!="function"||typeof c.hasChildNodes!="function")},Mn=function(c){return typeof o=="function"&&c instanceof o};function y(x,c,g){Fn(x,w=>{w.call(t,c,g,ut)})}const R=function(c){let g=null;if(y(Q.beforeSanitizeElements,c,null),Nn(c))return De(c),!0;const w=re(c.nodeName);if(y(Q.uponSanitizeElement,c,{tagName:w,allowedTags:se}),fe&&c.hasChildNodes()&&!Mn(c.firstElementChild)&&_e(/<[/\w!]/g,c.innerHTML)&&_e(/<[/\w!]/g,c.textContent)||fe&&c.namespaceURI===Pe&&w==="style"&&Mn(c.firstElementChild)||c.nodeType===Bn.progressingInstruction||fe&&c.nodeType===Bn.comment&&_e(/<[/\w]/g,c.data))return De(c),!0;if(It[w]||!(et.tagCheck instanceof Function&&et.tagCheck(w))&&!se[w]){if(!It[w]&&me(w)&&(W.tagNameCheck instanceof RegExp&&_e(W.tagNameCheck,w)||W.tagNameCheck instanceof Function&&W.tagNameCheck(w)))return!1;if(Qt&&!Oe[w]){const $=D(c)||c.parentNode,K=B(c)||c.childNodes;if(K&&$){const V=K.length;for(let pe=V-1;pe>=0;--pe){const J=S(K[pe],!0);$.insertBefore(J,A(c))}}}return De(c),!0}return c instanceof l&&!Br(c)||(w==="noscript"||w==="noembed"||w==="noframes")&&_e(/<\/no(script|embed|frames)/i,c.innerHTML)?(De(c),!0):(ne&&c.nodeType===Bn.text&&(g=c.textContent,Fn([Ae,je,lt],$=>{g=ln(g,$," ")}),c.textContent!==g&&(Un(t.removed,{element:c.cloneNode()}),c.textContent=g)),y(Q.afterSanitizeElements,c,null),!1)},F=function(c,g,w){if(Ct[g]||pr&&(g==="id"||g==="name")&&(w in n||w in mr))return!1;const $=ae[g]||et.attributeCheck instanceof Function&&et.attributeCheck(g,c);if(!(xn&&!Ct[g]&&_e(ot,g))){if(!(fr&&_e(wn,g))){if(!$||Ct[g]){if(!(me(c)&&(W.tagNameCheck instanceof RegExp&&_e(W.tagNameCheck,c)||W.tagNameCheck instanceof Function&&W.tagNameCheck(c))&&(W.attributeNameCheck instanceof RegExp&&_e(W.attributeNameCheck,g)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(g,c))||g==="is"&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&_e(W.tagNameCheck,w)||W.tagNameCheck instanceof Function&&W.tagNameCheck(w))))return!1}else if(!Jt[g]){if(!_e(yn,ln(w,Rt,""))){if(!((g==="src"||g==="xlink:href"||g==="href")&&c!=="script"&&Ki(w,"data:")===0&&hr[c])){if(!(b&&!_e(Me,ln(w,Rt,"")))){if(w)return!1}}}}}}return!0},Z=I({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),me=function(c){return!Z[Zn(c)]&&_e(or,c)},Le=function(c){y(Q.beforeSanitizeAttributes,c,null);const{attributes:g}=c;if(!g||Nn(c))return;const w={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae,forceKeepAttr:void 0};let $=g.length;for(;$--;){const K=g[$],{name:V,namespaceURI:pe,value:J}=K,he=re(V),rn=J;let ie=V==="value"?rn:lo(rn);if(w.attrName=he,w.attrValue=ie,w.keepAttr=!0,w.forceKeepAttr=void 0,y(Q.uponSanitizeAttribute,c,w),ie=w.attrValue,Sn&&(he==="id"||he==="name")&&Ki(ie,An)!==0&&(tt(V,c),ie=An+ie),fe&&_e(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ie)){tt(V,c);continue}if(he==="attributename"&&Qi(ie,"href")){tt(V,c);continue}if(w.forceKeepAttr)continue;if(!w.keepAttr){tt(V,c);continue}if(!M&&_e(/\/>/i,ie)){tt(V,c);continue}ne&&Fn([Ae,je,lt],kr=>{ie=ln(ie,kr," ")});const Pn=re(c.nodeName);if(!F(Pn,he,ie)){tt(V,c);continue}if(C&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!pe)switch(_.getAttributeType(Pn,he)){case"TrustedHTML":{ie=C.createHTML(ie);break}case"TrustedScriptURL":{ie=C.createScriptURL(ie);break}}if(ie!==rn)try{pe?c.setAttributeNS(pe,V,ie):c.setAttribute(V,ie),Nn(c)?De(c):Xi(t.removed)}catch{tt(V,c)}}y(Q.afterSanitizeAttributes,c,null)},vt=function(c){let g=null;const w=br(c);for(y(Q.beforeSanitizeShadowDOM,c,null);g=w.nextNode();)y(Q.uponSanitizeShadowNode,g,null),R(g),Le(g),g.content instanceof s&&vt(g.content);y(Q.afterSanitizeShadowDOM,c,null)};return t.sanitize=function(x){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=null,w=null,$=null,K=null;if(Mt=!x,Mt&&(x=""),typeof x!="string"&&!Mn(x)&&(x=po(x),typeof x!="string"))throw yr("dirty is not a string, aborting");if(!t.isSupported)return x;if(Tn||nn(c),t.removed=[],typeof x=="string"&&(Lt=!1),Lt){const J=x.nodeName;if(typeof J=="string"){const he=re(J);if(!se[he]||It[he])throw yr("root node is forbidden and cannot be sanitized in-place")}}else if(x instanceof o)g=Ln(""),w=g.ownerDocument.importNode(x,!0),w.nodeType===Bn.element&&w.nodeName==="BODY"||w.nodeName==="HTML"?g=w:g.appendChild(w);else{if(!ct&&!ne&&!Ye&&x.indexOf("<")===-1)return C&&Dt?C.createHTML(x):x;if(g=Ln(x),!g)return ct?null:Dt?G:""}g&&En&&De(g.firstChild);const V=br(Lt?x:g);for(;$=V.nextNode();)R($),Le($),$.content instanceof s&&vt($.content);if(Lt)return x;if(ct){if(ne){g.normalize();let J=g.innerHTML;Fn([Ae,je,lt],he=>{J=ln(J,he," ")}),g.innerHTML=J}if(Ot)for(K=ge.call(g.ownerDocument);g.firstChild;)K.appendChild(g.firstChild);else K=g;return(ae.shadowroot||ae.shadowrootmode)&&(K=z.call(i,K,!0)),K}let pe=Ye?g.outerHTML:g.innerHTML;return Ye&&se["!doctype"]&&g.ownerDocument&&g.ownerDocument.doctype&&g.ownerDocument.doctype.name&&_e(fa,g.ownerDocument.doctype.name)&&(pe=" +`+pe),ne&&Fn([Ae,je,lt],J=>{pe=ln(pe,J," ")}),C&&Dt?C.createHTML(pe):pe},t.setConfig=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nn(x),Tn=!0},t.clearConfig=function(){ut=null,Tn=!1},t.isValidAttribute=function(x,c,g){ut||nn({});const w=re(x),$=re(c);return F(w,$,g)},t.addHook=function(x,c){typeof c=="function"&&Un(Q[x],c)},t.removeHook=function(x,c){if(c!==void 0){const g=so(Q[x],c);return g===-1?void 0:ao(Q[x],g,1)[0]}return Xi(Q[x])},t.removeHooks=function(x){Q[x]=[]},t.removeAllHooks=function(){Q=as()},t}var Ao=pa();function Ai(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Xt=Ai();function ha(e){Xt=e}var $t={exec:()=>null};function N(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(r,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(xe.caret,"$1"),n=n.replace(r,a),i},getRegex:()=>new RegExp(n,t)};return i}var Ro=(()=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},Io=/^(?:[ \t]*(?:\n|$))+/,Co=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Oo=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,lr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Do=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ri=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,da=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ga=N(da).replace(/bull/g,Ri).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Lo=N(da).replace(/bull/g,Ri).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ii=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,No=/^[^\n]+/,Ci=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Mo=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ci).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Po=N(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ri).getRegex(),$r="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Oi=/|$))/,zo=N("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Oi).replace("tag",$r).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ma=N(Ii).replace("hr",lr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",$r).getRegex(),$o=N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ma).getRegex(),Di={blockquote:$o,code:Co,def:Mo,fences:Oo,heading:Do,hr:lr,html:zo,lheading:ga,list:Po,newline:Io,paragraph:ma,table:$t,text:No},ls=N("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",lr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",$r).getRegex(),Fo={...Di,lheading:Lo,table:ls,paragraph:N(Ii).replace("hr",lr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ls).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",$r).getRegex()},Uo={...Di,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Oi).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:$t,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(Ii).replace("hr",lr).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",ga).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ho=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Bo=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_a=/^( {2,}|\\)\n(?!\s*$)/,Go=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ro?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ba=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Zo=N(ba,"u").replace(/punct/g,kn).getRegex(),Vo=N(ba,"u").replace(/punct/g,va).getRegex(),ka="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Xo=N(ka,"gu").replace(/notPunctSpace/g,Li).replace(/punctSpace/g,Fr).replace(/punct/g,kn).getRegex(),Qo=N(ka,"gu").replace(/notPunctSpace/g,jo).replace(/punctSpace/g,qo).replace(/punct/g,va).getRegex(),Ko=N("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Li).replace(/punctSpace/g,Fr).replace(/punct/g,kn).getRegex(),Jo=N(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,kn).getRegex(),ec="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",tc=N(ec,"gu").replace(/notPunctSpace/g,Li).replace(/punctSpace/g,Fr).replace(/punct/g,kn).getRegex(),nc=N(/\\(punct)/,"gu").replace(/punct/g,kn).getRegex(),rc=N(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ic=N(Oi).replace("(?:-->|$)","-->").getRegex(),sc=N("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",ic).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Or=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ac=N(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Or).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),wa=N(/^!?\[(label)\]\[(ref)\]/).replace("label",Or).replace("ref",Ci).getRegex(),ya=N(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ci).getRegex(),lc=N("reflink|nolink(?!\\()","g").replace("reflink",wa).replace("nolink",ya).getRegex(),os=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ni={_backpedal:$t,anyPunctuation:nc,autolink:rc,blockSkip:Yo,br:_a,code:Bo,del:$t,delLDelim:$t,delRDelim:$t,emStrongLDelim:Zo,emStrongRDelimAst:Xo,emStrongRDelimUnd:Ko,escape:Ho,link:ac,nolink:ya,punctuation:Wo,reflink:wa,reflinkSearch:lc,tag:sc,text:Go,url:$t},oc={...Ni,link:N(/^!?\[(label)\]\((.*?)\)/).replace("label",Or).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Or).getRegex()},pi={...Ni,emStrongRDelimAst:Qo,emStrongLDelim:Vo,delLDelim:Jo,delRDelim:tc,url:N(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",os).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:N(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},cs=e=>uc[e];function rt(e,t){if(t){if(xe.escapeTest.test(e))return e.replace(xe.escapeReplace,cs)}else if(xe.escapeTestNoEncode.test(e))return e.replace(xe.escapeReplaceNoEncode,cs);return e}function us(e){try{e=encodeURI(e).replace(xe.percentDecode,"%")}catch{return null}return e}function fs(e,t){let n=e.replace(xe.findPipe,(s,a,o)=>{let l=!1,f=a;for(;--f>=0&&o[f]==="\\";)l=!l;return l?"|":" |"}),i=n.split(xe.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length0?-2:-1}function pc(e,t=0){let n=t,i="";for(let r of e)if(r===" "){let s=4-n%4;i+=" ".repeat(s),n+=s}else i+=r,n++;return i}function ps(e,t,n,i,r){let s=t.href,a=t.title||null,o=e[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:a,text:o,tokens:i.inlineTokens(o)};return i.state.inLink=!1,l}function hc(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let r=i[1];return t.split(` +`).map(s=>{let a=s.match(n.other.beginningSpace);if(a===null)return s;let[o]=a;return o.length>=r.length?s.slice(r.length):s}).join(` +`)}var Dr=class{options;rules;lexer;constructor(e){this.options=e||Xt}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Wn(n,` +`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=hc(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let i=Wn(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Wn(t[0],` +`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Wn(t[0],` +`).split(` +`),i="",r="",s=[];for(;n.length>0;){let a=!1,o=[],l;for(l=0;l1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let s=this.rules.other.listItemRegex(n),a=!1;for(;e;){let l=!1,f="",u="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let h=pc(t[2].split(` +`,1)[0],t[1].length),d=e.split(` +`,1)[0],_=!h.trim(),m=0;if(this.options.pedantic?(m=2,u=h.trimStart()):_?m=t[1].length+1:(m=h.search(this.rules.other.nonSpaceChar),m=m>4?1:m,u=h.slice(m),m+=t[1].length),_&&this.rules.other.blankLine.test(d)&&(f+=d+` +`,e=e.substring(d.length+1),l=!0),!l){let S=this.rules.other.nextBulletRegex(m),v=this.rules.other.hrRegex(m),A=this.rules.other.fencesBeginRegex(m),B=this.rules.other.headingBeginRegex(m),D=this.rules.other.htmlBeginRegex(m),C=this.rules.other.blockquoteBeginRegex(m);for(;e;){let G=e.split(` +`,1)[0],j;if(d=G,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),j=d):j=d.replace(this.rules.other.tabCharGlobal," "),A.test(d)||B.test(d)||D.test(d)||C.test(d)||S.test(d)||v.test(d))break;if(j.search(this.rules.other.nonSpaceChar)>=m||!d.trim())u+=` +`+j.slice(m);else{if(_||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||A.test(h)||B.test(h)||v.test(h))break;u+=` +`+d}_=!d.trim(),f+=G+` +`,e=e.substring(G.length+1),h=j.slice(m)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(a=!0)),r.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),r.raw+=f}let o=r.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let f=this.rules.other.listTaskCheckbox.exec(l.raw);if(f){let u={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};l.checked=u.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=u.raw+l.tokens[0].raw,l.tokens[0].text=u.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(u)):l.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):l.tokens.unshift(u)}}if(!r.loose){let f=l.tokens.filter(h=>h.type==="space"),u=f.length>0&&f.some(h=>this.rules.other.anyLine.test(h.raw));r.loose=u}}if(r.loose)for(let l of r.items){l.loose=!0;for(let f of l.tokens)f.type==="text"&&(f.type="paragraph")}return r}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=fs(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(` +`):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a({text:o,tokens:this.lexer.inline(o),header:!1,align:s.align[l]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===` +`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=Wn(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=fc(t[2],"()");if(s===-2)return;if(s>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(i);s&&(i=s[1],r=s[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),ps(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[i.toLowerCase()];if(!r){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return ps(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!n||this.rules.inline.punctuation.exec(n))){let r=[...i[0]].length-1,s,a,o=r,l=0,f=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+r);(i=f.exec(t))!==null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s)continue;if(a=[...s].length,i[3]||i[4]){o+=a;continue}else if((i[5]||i[6])&&r%3&&!((r+a)%3)){l+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+l);let u=[...i[0]][0].length,h=e.slice(0,r+i.index+u+a);if(Math.min(r,a)%2){let _=h.slice(1,-1);return{type:"em",raw:h,text:_,tokens:this.lexer.inlineTokens(_)}}let d=h.slice(2,-2);return{type:"strong",raw:h,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let i=this.rules.inline.delLDelim.exec(e);if(i&&(!i[1]||!n||this.rules.inline.punctuation.exec(n))){let r=[...i[0]].length-1,s,a,o=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+r);(i=l.exec(t))!==null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s||(a=[...s].length,a!==r))continue;if(i[3]||i[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let f=[...i[0]][0].length,u=e.slice(0,r+i.index+f+a),h=u.slice(r,-r);return{type:"del",raw:u,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=t[1],i="mailto:"+n):(n=t[1],i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,i;if(t[2]==="@")n=t[0],i="mailto:"+n;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Ze=class hi{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Xt,this.options.tokenizer=this.options.tokenizer||new Dr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:xe,block:Tr.normal,inline:Gn.normal};this.options.pedantic?(n.block=Tr.pedantic,n.inline=Gn.pedantic):this.options.gfm&&(n.block=Tr.gfm,this.options.breaks?n.inline=Gn.breaks:n.inline=Gn.gfm),this.tokenizer.rules=n}static get rules(){return{block:Tr,inline:Gn}}static lex(t,n){return new hi(n).lex(t)}static lexInline(t,n){return new hi(n).inlineTokens(t)}lex(t){t=t.replace(xe.carriageReturn,` +`),this.blockTokens(t,this.tokens);for(let n=0;n(r=a.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);let a=n.at(-1);r.raw.length===1&&a!==void 0?a.raw+=` +`:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length);let a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(` +`)?"":` +`)+r.raw,a.text+=` +`+r.text,this.inlineQueue.at(-1).src=a.text):n.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.raw.length);let a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(` +`)?"":` +`)+r.raw,a.text+=` +`+r.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},n.push(r));continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),n.push(r);continue}let s=t;if(this.options.extensions?.startBlock){let a=1/0,o=t.slice(1),l;this.options.extensions.startBlock.forEach(f=>{l=f.call({lexer:this},o),typeof l=="number"&&l>=0&&(a=Math.min(a,l))}),a<1/0&&a>=0&&(s=t.substring(0,a+1))}if(this.state.top&&(r=this.tokenizer.paragraph(s))){let a=n.at(-1);i&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(` +`)?"":` +`)+r.raw,a.text+=` +`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(r),i=s.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length);let a=n.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(` +`)?"":` +`)+r.raw,a.text+=` +`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(r);continue}if(t){let a="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){this.tokenizer.lexer=this;let i=t,r=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(i))!==null;)l.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(i))!==null;)i=i.slice(0,r.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(i))!==null;)s=r[2]?r[2].length:0,i=i.slice(0,r.index+s)+"["+"a".repeat(r[0].length-s-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let a=!1,o="";for(;t;){a||(o=""),a=!1;let l;if(this.options.extensions?.inline?.some(u=>(l=u.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(l.raw.length);let u=n.at(-1);l.type==="text"&&u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(t,i,o)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(t,i,o)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(t)){t=t.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(t))){t=t.substring(l.raw.length),n.push(l);continue}let f=t;if(this.options.extensions?.startInline){let u=1/0,h=t.slice(1),d;this.options.extensions.startInline.forEach(_=>{d=_.call({lexer:this},h),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(f=t.substring(0,u+1))}if(l=this.tokenizer.inlineText(f)){t=t.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),a=!0;let u=n.at(-1);u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return n}},Lr=class{options;parser;constructor(e){this.options=e||Xt}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(xe.notSpaceStart)?.[0],r=e.replace(xe.endingNewline,"")+` +`;return i?'
    '+(n?r:rt(r,!0))+`
    +`:"
    "+(n?r:rt(r,!0))+`
    +`}blockquote({tokens:e}){return`
    +${this.parser.parse(e)}
    +`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)} +`}hr(e){return`
    +`}list(e){let t=e.ordered,n=e.start,i="";for(let a=0;a +`+i+" +`}listitem(e){return`
  • ${this.parser.parse(e.tokens)}
  • +`}checkbox({checked:e}){return" '}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    +`}table(e){let t="",n="";for(let r=0;r${i}`),` + +`+t+` +`+i+`
    +`}tablerow({text:e}){return` +${e} +`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+` +`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${rt(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let i=this.parser.parseInline(n),r=us(e);if(r===null)return i;e=r;let s='
    ",s}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let r=us(e);if(r===null)return rt(n);e=r;let s=`${rt(n)}{let a=r[s].flat(1/0);n=n.concat(this.walkTokens(a,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let s=t.renderers[r.name];s?t.renderers[r.name]=function(...a){let o=r.renderer.apply(this,a);return o===!1&&(o=s.apply(this,a)),o}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[r.level];s?s.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),n.renderer){let r=this.defaults.renderer||new Lr(this.defaults);for(let s in n.renderer){if(!(s in r))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=n.renderer[a],l=r[a];r[a]=(...f)=>{let u=o.apply(r,f);return u===!1&&(u=l.apply(r,f)),u||""}}i.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new Dr(this.defaults);for(let s in n.tokenizer){if(!(s in r))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=n.tokenizer[a],l=r[a];r[a]=(...f)=>{let u=o.apply(r,f);return u===!1&&(u=l.apply(r,f)),u}}i.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new Vn;for(let s in n.hooks){if(!(s in r))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=n.hooks[a],l=r[a];Vn.passThroughHooks.has(s)?r[a]=f=>{if(this.defaults.async&&Vn.passThroughHooksRespectAsync.has(s))return(async()=>{let h=await o.call(r,f);return l.call(r,h)})();let u=o.call(r,f);return l.call(r,u)}:r[a]=(...f)=>{if(this.defaults.async)return(async()=>{let h=await o.apply(r,f);return h===!1&&(h=await l.apply(r,f)),h})();let u=o.apply(r,f);return u===!1&&(u=l.apply(r,f)),u}}i.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,s=n.walkTokens;i.walkTokens=function(a){let o=[];return o.push(s.call(this,a)),r&&(o=o.concat(r.call(this,a))),o}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ze.lex(e,t??this.defaults)}parser(e,t){return Ve.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},r={...this.defaults,...i},s=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let a=r.hooks?await r.hooks.preprocess(t):t,o=await(r.hooks?await r.hooks.provideLexer(e):e?Ze.lex:Ze.lexInline)(a,r),l=r.hooks?await r.hooks.processAllTokens(o):o;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let f=await(r.hooks?await r.hooks.provideParser(e):e?Ve.parse:Ve.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(f):f})().catch(s);try{r.hooks&&(t=r.hooks.preprocess(t));let a=(r.hooks?r.hooks.provideLexer(e):e?Ze.lex:Ze.lexInline)(t,r);r.hooks&&(a=r.hooks.processAllTokens(a)),r.walkTokens&&this.walkTokens(a,r.walkTokens);let o=(r.hooks?r.hooks.provideParser(e):e?Ve.parse:Ve.parseInline)(a,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(a){return s(a)}}}onError(e,t){return n=>{if(n.message+=` +Please report this to https://github.com/markedjs/marked.`,e){let i="

    An error occurred:

    "+rt(n.message+"",!0)+"
    ";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},Yt=new dc;function H(e,t){return Yt.parse(e,t)}H.options=H.setOptions=function(e){return Yt.setOptions(e),H.defaults=Yt.defaults,ha(H.defaults),H};H.getDefaults=Ai;H.defaults=Xt;H.use=function(...e){return Yt.use(...e),H.defaults=Yt.defaults,ha(H.defaults),H};H.walkTokens=function(e,t){return Yt.walkTokens(e,t)};H.parseInline=Yt.parseInline;H.Parser=Ve;H.parser=Ve.parse;H.Renderer=Lr;H.TextRenderer=Mi;H.Lexer=Ze;H.lexer=Ze.lex;H.Tokenizer=Dr;H.Hooks=Vn;H.parse=H;H.options;H.setOptions;H.use;H.walkTokens;H.parseInline;Ve.parse;Ze.lex;function on(e){return Ao.sanitize(H.parse(e,{async:!1}))}function Er(e){return new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(new Date(e))}var gc=be(''),mc=be('
    cc
    ClickClack OpenClaw workspace chat

    Sign in to ClickClack

    GitHub access is limited to active members of the OpenClaw organization.

    '),_c=be(""),vc=be(""),bc=be(""),kc=be(""),wc=be('
    '),yc=be('
    Quiet tide. Start with Markdown. Threads open from any root message.
    '),xc=be('
    '),Tc=be(' '),Ec=be('
    '),Sc=be('

    Thread

    ',1),Ac=be('
    No thread open Pick a message to keep the side conversation tidy.
    '),Rc=be('

    ');function Ic(e,t){mi(t,!1);const n=q(),i=q(),r=q();let s=q(null),a=q([]),o=q([]),l=q([]),f=q([]),u=q([]),h=q(""),d=q(""),_=q(""),m=q(null),S=q(null),v=q(""),A=q(""),B=q(""),D=q(""),C=q(""),G=q(""),j=q([]),Y=q(null),ge=q("loading"),Se=q(!1),z=q(null),Q;la(()=>{Ae()}),Jl(()=>{p(z)?.close(),Q&&window.clearTimeout(Q)});async function Ae(){try{const b=await we("/api/me");k(s,b.user),await je(),k(ge,"ready")}catch(b){if(b instanceof oa&&(b.status===401||b.status===403)){k(Se,!0),k(ge,"auth");return}k(ge,b instanceof Error?b.message:"Could not load ClickClack")}}async function je(){const b=await we("/api/workspaces");k(a,b.workspaces),k(h,p(h)||p(a)[0]?.id||""),await ot(),await ae(),W()}async function lt(){if(!p(B).trim())return;const b=await we("/api/workspaces",{method:"POST",body:JSON.stringify({name:p(B)})});k(B,""),k(a,[...p(a),b.workspace]),k(h,b.workspace.id),await ot(),await ae(),W()}async function ot(){if(!p(h))return;const b=await we(`/api/workspaces/${p(h)}/channels`);k(o,b.channels),k(d,p(o).find(M=>M.id===p(d))?.id||p(o)[0]?.id||""),k(m,null),k(u,[]),await Me()}async function wn(){if(!p(h)||!p(D).trim())return;const b=await we(`/api/workspaces/${p(h)}/channels`,{method:"POST",body:JSON.stringify({name:p(D),kind:"public"})});k(D,""),k(o,[...p(o),b.channel]),k(d,b.channel.id),await Me()}async function Me(){if(p(_)){const M=await we(`/api/dms/${p(_)}/messages`);k(f,M.messages);return}if(!p(d)){k(f,[]);return}const b=await we(`/api/channels/${p(d)}/messages`);k(f,b.messages)}async function Rt(){const b=p(v).trim();if(!b||!p(d)&&!p(_))return;k(v,"");const M=p(_)?`/api/dms/${p(_)}/messages`:`/api/channels/${p(d)}/messages`,ne=await we(M,{method:"POST",body:JSON.stringify({body:b})});p(Y)&&(await we(`/api/messages/${ne.message.id}/attachments`,{method:"POST",body:JSON.stringify({upload_id:p(Y).id})}),k(Y,null)),p(f).some(fe=>fe.id===ne.message.id)||k(f,[...p(f),ne.message])}async function or(b){k(m,b);const M=await we(`/api/messages/${b.id}/thread`);k(m,M.root),k(u,M.replies),k(S,M.thread_state)}async function yn(){const b=p(A).trim();if(!b||!p(m))return;k(A,"");const M=await we(`/api/messages/${p(m).id}/thread/replies`,{method:"POST",body:JSON.stringify({body:b})});p(u).some(ne=>ne.id===M.message.id)||k(u,[...p(u),M.message]),k(S,M.thread_state)}async function se(){if(!p(h)||!p(G).trim()){k(j,[]);return}const b=await we(`/api/search?workspace_id=${encodeURIComponent(p(h))}&q=${encodeURIComponent(p(G).trim())}`);k(j,b.results)}async function cr(b){const M=b.currentTarget,ne=M.files?.[0];if(!ne||!p(h))return;const fe=new FormData;fe.set("workspace_id",p(h)),fe.set("file",ne);const Ye=await we("/api/uploads",{method:"POST",body:fe});k(Y,Ye.upload),M.value=""}async function ae(){if(!p(h))return;const b=await we(`/api/dms?workspace_id=${p(h)}`);k(l,b.conversations)}async function ur(){if(!p(h)||!p(C).trim())return;const b=await we("/api/dms",{method:"POST",body:JSON.stringify({workspace_id:p(h),member_ids:[p(C).trim()]})});k(C,""),k(l,[...p(l),b.conversation]),k(_,b.conversation.id),k(d,""),k(m,null),await Me()}function W(){if(p(z)?.close(),!p(h))return;const b=localStorage.getItem(`clickclack:${p(h)}:cursor`)||"",M=new URL("/api/realtime/ws",window.location.href);M.protocol=window.location.protocol==="https:"?"wss:":"ws:",M.searchParams.set("workspace_id",p(h)),b&&M.searchParams.set("after_cursor",b),k(z,new WebSocket(M)),p(z).addEventListener("message",ne=>{const fe=JSON.parse(String(ne.data));fe.cursor&&localStorage.setItem(`clickclack:${p(h)}:cursor`,fe.cursor),It(fe)}),p(z).addEventListener("close",()=>{Q=window.setTimeout(W,1200)})}async function It(b){if((b.type==="channel.created"||b.type==="channel.updated")&&b.workspace_id===p(h)){await ot();return}(b.channel_id===p(d)||b.payload.direct_conversation_id===p(_))&&(b.type==="message.created"||b.type==="message.updated"||b.type==="message.deleted")&&await Me();const M=b.payload.root_message_id||b.payload.message_id;p(m)&&M===p(m).id&&await or(p(m))}Wr(()=>(p(a),p(h)),()=>{k(n,p(a).find(b=>b.id===p(h)))}),Wr(()=>(p(o),p(d)),()=>{k(i,p(o).find(b=>b.id===p(d)))}),Wr(()=>(p(l),p(_)),()=>{k(r,p(l).find(b=>b.id===p(_)))}),Al(),aa();var Ct=ia();sa("1oa2eo8",b=>{var M=gc();ue(b,M)});var et=ii(Ct);{var fr=b=>{var M=mc();ue(b,M)},xn=b=>{var M=Rc(),ne=T(M),fe=T(ne),Ye=E(T(fe),2),Tn=E(T(Ye),2),En=T(Tn),ct=E(fe,2),Ot=E(T(ct),2);zt(Ot,5,()=>p(a),Rr,(y,R)=>{var F=_c();let Z;var me=T(F);ze(()=>{Z=$n(F,1,"",null,Z,{active:p(R).id===p(h)}),le(me,(p(R),U(()=>p(R).name)))}),ft("click",F,async()=>{k(h,p(R).id),await ot(),W()}),ue(y,F)});var Dt=E(Ot,2),pr=T(Dt),Sn=E(ct,2),An=E(T(Sn),2);zt(An,5,()=>p(o),Rr,(y,R)=>{var F=vc();let Z;var me=E(T(F),1,!0);ze(()=>{Z=$n(F,1,"",null,Z,{active:p(R).id===p(d)}),le(me,(p(R),U(()=>p(R).name)))}),ft("click",F,async()=>{k(d,p(R).id),k(m,null),await Me()}),ue(y,F)});var Qt=E(An,2),Lt=T(Qt),gt=E(Sn,2),Oe=E(T(gt),2);zt(Oe,5,()=>p(l),Rr,(y,R)=>{var F=bc();let Z;var me=E(T(F),1,!0);ze(Le=>{Z=$n(F,1,"",null,Z,{active:p(R).id===p(_)}),le(me,Le)},[()=>(p(R),U(()=>p(R).members.map(Le=>Le.display_name).join(", ")))]),ft("click",F,async()=>{k(_,p(R).id),k(d,""),k(m,null),await Me()}),ue(y,F)});var Kt=E(Oe,2),hr=T(Kt),Rn=E(ne,2),Jt=T(Rn),In=T(Jt),Nt=T(In),en=T(Nt),Pe=E(Nt,2),mt=T(Pe),Mt=E(In,2),Cn=T(Mt),dr=E(Mt,2),On=T(dr),tn=E(Jt,2);{var Ur=y=>{var R=wc();zt(R,5,()=>p(j),F=>F.message.id,(F,Z)=>{var me=kc(),Le=T(me),vt=T(Le),x=E(Le,2),c=T(x);ze(()=>{le(vt,(p(Z),U(()=>p(Z).message.author?.display_name||"Local User"))),le(c,(p(Z),U(()=>p(Z).message.body)))}),ft("click",me,async()=>{k(j,[]),p(Z).message.channel_id&&(k(d,p(Z).message.channel_id),k(_,""),await Me()),p(Z).message.direct_conversation_id&&(k(_,p(Z).message.direct_conversation_id),k(d,""),await Me())}),ue(F,me)}),ue(y,R)};un(tn,y=>{p(j),U(()=>p(j).length>0)&&y(Ur)})}var _t=E(tn,2),gr=T(_t);{var Hr=y=>{var R=yc();ue(y,R)};un(gr,y=>{p(f),U(()=>p(f).length===0)&&y(Hr)})}var re=E(gr,2);zt(re,1,()=>p(f),y=>y.id,(y,R)=>{var F=xc();let Z;var me=T(F),Le=T(me),vt=E(me,2),x=T(vt),c=T(x),g=T(c),w=E(c,2),$=T(w),K=E(x,2);qr(K,()=>(cn(on),p(R),U(()=>on(p(R).body))),!0);var V=E(K,2);ze((pe,J)=>{Z=$n(F,1,"message",null,Z,{selected:p(m)?.id===p(R).id}),le(Le,pe),le(g,(p(R),U(()=>p(R).author?.display_name||"Local User"))),le($,J)},[()=>(p(R),U(()=>p(R).author?.display_name?.slice(0,1)||"c")),()=>(cn(Er),p(R),U(()=>Er(p(R).created_at)))]),ft("click",V,()=>or(p(R))),ue(y,F)});var ut=E(_t,2),mr=T(ut),_r=E(mr,2),nn=T(_r),vr=T(nn),Dn=E(nn,2);{var Br=y=>{var R=Tc(),F=T(R);ze(()=>le(F,(p(Y),U(()=>p(Y).filename)))),ue(y,R)};un(Dn,y=>{p(Y)&&y(Br)})}var De=E(Dn,2),tt=E(Rn,2);let Ln;var br=T(tt);{var Nn=y=>{var R=Sc(),F=ii(R),Z=T(F),me=E(T(Z),2),Le=T(me),vt=E(Z,2),x=E(F,2),c=T(x),g=T(c),w=E(c,2);qr(w,()=>(cn(on),p(m),U(()=>on(p(m).body))),!0);var $=E(x,2);zt($,5,()=>p(u),J=>J.id,(J,he)=>{var rn=Ec(),ie=T(rn),Pn=T(ie),kr=T(Pn),xa=E(Pn,2),Ta=T(xa),Ea=E(ie,2);qr(Ea,()=>(cn(on),p(he),U(()=>on(p(he).body))),!0),ze(Sa=>{le(kr,(p(he),U(()=>p(he).author?.display_name||"Local User"))),le(Ta,Sa)},[()=>(cn(Er),p(he),U(()=>Er(p(he).created_at)))]),ue(J,rn)});var K=E($,2),V=T(K),pe=E(V,2);ze(()=>{le(Le,`${p(S),p(u),U(()=>p(S)?.reply_count||p(u).length)??""} replies`),le(g,(p(m),U(()=>p(m).author?.display_name||"Local User")))}),ft("click",vt,()=>{k(m,null),k(u,[])}),sn("submit",K,J=>{J.preventDefault(),yn()}),an(V,()=>p(A),J=>k(A,J)),ft("click",pe,()=>{yn()}),ue(y,R)},Mn=y=>{var R=Ac();ue(y,R)};un(br,y=>{p(m)?y(Nn):y(Mn,-1)})}ze(y=>{le(En,(p(s),U(()=>p(s)?.display_name||"local"))),le(en,(p(n),U(()=>p(n)?.name||"Workspace"))),le(mt,y),nt(dr,"data-state",(p(z),U(()=>p(z)?.readyState===WebSocket.OPEN?"live":"idle"))),le(On,(p(z),p(ge),U(()=>p(z)?.readyState===WebSocket.OPEN?"live":p(ge)))),Ln=$n(tt,1,"thread",null,Ln,{open:p(m)})},[()=>(p(r),p(i),U(()=>p(r)?"@"+p(r).members.map(y=>y.display_name).join(", "):"#"+(p(i)?.name||"general")))]),sn("submit",Dt,y=>{y.preventDefault(),lt()}),an(pr,()=>p(B),y=>k(B,y)),sn("submit",Qt,y=>{y.preventDefault(),wn()}),an(Lt,()=>p(D),y=>k(D,y)),sn("submit",Kt,y=>{y.preventDefault(),ur()}),an(hr,()=>p(C),y=>k(C,y)),sn("submit",Mt,y=>{y.preventDefault(),se()}),an(Cn,()=>p(G),y=>k(G,y)),sn("submit",ut,y=>{y.preventDefault(),Rt()}),an(mr,()=>p(v),y=>k(v,y)),ft("change",vr,cr),ft("click",De,()=>{Rt()}),ue(b,M)};un(et,b=>{p(Se)?b(fr):b(xn,-1)})}ue(e,Ct),_i()}zl(["click","change"]);var Cc=be(' ',1),Oc=be("

    "),Dc=be(`

    Self-hostable chat. Serious tool. Mild brine.

    ClickClack

    A single-binary chat app for teams, communities, bots, and agents: + Slack-style threads, durable realtime, OpenAPI, SQLite, and a CLI that + can drive the whole thing from a shell.

    What it is

    Chat infrastructure that stays boring when the socket drops.

    WebSocket is the pipe. The database is the truth. Every durable message, + thread reply, reaction, and channel update can be recovered over HTTP with + a cursor, so clients and agents can reconnect without drama.

    Agent path

    A friendly CLI, no LLM baked in.

    External agents, CI jobs, and humans use the same public API as the web + app. Tokens and workspace defaults are scoped per server, so switching + hosts does not leak credentials or stale IDs.

     

    Destinations

    Product at the root. Docs and app where people expect them.

    `);function Lc(e,t){mi(t,!1);const n="https://docs.clickclack.chat",i=["localhost","127.0.0.1","::1"].includes(window.location.hostname)?"/app":"https://app.clickclack.chat",r="https://github.com/openclaw/clickclack",s=[["Single binary","Go server, embedded Svelte app, embedded migrations, local SQLite and uploads."],["Threads that recover","Slack-style one-level threads with durable event replay after reconnects."],["Agent-friendly","A CLI, OpenAPI contract, TypeScript SDK, webhooks, and slash-command shapes."],["Self-host first","SQLite is the default, not the demo. Postgres can arrive behind the store layer."]],a=["clickclack serve --data ./data","clickclack login --magic-token mgt_...",'clickclack send --channel general "deploy started"',"clickclack threads reply msg_... --stdin {var je=Cc();Sl(()=>{zs.title="ClickClack - Self-hostable chat with claws"}),ue(Ae,je)});var l=T(o),f=E(T(l),2),u=E(T(f),2),h=T(u);nt(h,"href",n);var d=E(h,2),_=E(d,2);nt(_,"href",r);var m=E(f,2),S=E(T(m),6),v=T(S),A=E(v,2);nt(A,"href",n);var B=E(A,2);nt(B,"href",r);var D=E(l,4);zt(D,5,()=>s,Rr,(Ae,je)=>{var lt=Oc(),ot=T(lt),wn=T(ot),Me=E(ot,2),Rt=T(Me);ze(()=>{le(wn,p(je)[0]),le(Rt,p(je)[1])}),ue(Ae,lt)});var C=E(D,2),G=E(T(C),2),j=T(G),Y=E(C,2),ge=E(T(Y),2),Se=E(T(ge),2);nt(Se,"href",n);var z=E(Se,2),Q=E(z,2);nt(Q,"href",r),ze(Ae=>{nt(d,"href",i),nt(v,"href",i),le(j,Ae),nt(z,"href",i)},[()=>a.join(` +`)]),ue(e,o),_i()}function Nc(e){const t=window.location.pathname,i=window.location.hostname.startsWith("app.")||t==="/app"||t.startsWith("/app/");var r=ia(),s=ii(r);{var a=l=>{Ic(l,{})},o=l=>{Lc(l,{})};un(s,l=>{i?l(a):l(o,-1)})}ue(e,r)}Hl(Nc,{target:document.getElementById("app")}); diff --git a/apps/api/internal/webassets/dist/assets/index-CljoeKn6.css b/apps/api/internal/webassets/dist/assets/index-D1YUowl3.css similarity index 51% rename from apps/api/internal/webassets/dist/assets/index-CljoeKn6.css rename to apps/api/internal/webassets/dist/assets/index-D1YUowl3.css index 06b1f00..5937bbe 100644 --- a/apps/api/internal/webassets/dist/assets/index-CljoeKn6.css +++ b/apps/api/internal/webassets/dist/assets/index-D1YUowl3.css @@ -1 +1 @@ -.product-site{min-height:100vh;background:#f7f3ea;color:#151716;font-family:Avenir Next,Segoe UI,ui-sans-serif,system-ui,sans-serif}.product-site a{color:inherit;text-decoration:none}.hero{position:relative;display:grid;min-height:clamp(680px,92vh,920px);overflow:hidden;isolation:isolate;background:linear-gradient(90deg,#0c1f23c7,#0c1f232e 62%,#0c1f23b3),#103033;color:#fff8ee}.hero:after{position:absolute;inset:auto 0 0;height:22vh;min-height:130px;background:linear-gradient(0deg,#f7f3ea 8%,#f7f3ea00);content:"";z-index:-1}.hero:before{position:absolute;inset:0 38% 0 0;background:linear-gradient(90deg,#081c1efa,#081c1e00);content:"";z-index:-1}.hero-bg{position:absolute;inset:0 0 0 clamp(260px,28vw,460px);display:grid;grid-template-columns:92px minmax(360px,1fr) minmax(260px,28vw);gap:18px;padding:102px clamp(18px,5vw,70px) 80px;opacity:.36;z-index:-2}.workspace-rail,.timeline-preview,.thread-preview{border:1px solid rgba(255,248,238,.24);background:#fff8ee1f;box-shadow:0 28px 90px #0000003d;-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px)}.workspace-rail{display:grid;align-content:start;gap:14px;padding:16px}.workspace-rail span{display:grid;place-items:center;min-height:54px;border-radius:8px;background:#fff8ee2e;color:#fff8ee;font-weight:900;text-transform:uppercase}.timeline-preview{align-self:stretch;padding:clamp(18px,3vw,34px)}.preview-top{display:flex;justify-content:space-between;margin-bottom:48px;color:#b9ddd9;font-weight:800}.preview-top strong{color:#7ce0b5}.timeline-preview article,.thread-preview{max-width:720px;margin:0 0 18px;border-radius:8px;background:#fff8ee29;padding:18px}.timeline-preview b,.thread-preview span{color:#ff8a70}.timeline-preview p,.thread-preview p{margin:6px 0 0;color:#fff8ee;font-size:clamp(17px,1.8vw,24px)}.timeline-preview code{border-radius:5px;background:#0c1f2394;padding:2px 5px}.thread-line{margin-left:clamp(0px,8vw,130px)}.thread-preview{align-self:center;min-height:260px}.product-nav{position:relative;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:20px;padding:24px clamp(18px,5vw,70px);font-weight:800}.product-nav>div{display:flex;gap:clamp(14px,3vw,34px)}.brand-lockup{display:inline-flex;align-items:center;gap:10px}.brand-mark{display:grid;place-items:center;width:40px;height:40px;border-radius:8px;background:#ff6f55;color:#151716;font-weight:950;text-transform:uppercase}.hero-copy{position:relative;z-index:2;align-self:center;width:min(780px,calc(100vw - 36px));padding:0 clamp(18px,5vw,70px) 16vh}.eyebrow,.section-kicker{margin:0 0 14px;color:#ffb09f;font-size:13px;font-weight:950;letter-spacing:.08em;text-transform:uppercase}.hero h1,.product-band h2{margin:0;letter-spacing:0}.hero h1{font-family:Georgia,Times New Roman,serif;font-size:clamp(66px,13vw,152px);font-weight:900;line-height:.9}.lede{width:min(680px,100%);margin:26px 0 0;color:#fff3df;font-size:clamp(20px,2.2vw,31px);line-height:1.18}.hero-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:32px}.primary-action,.secondary-action{display:inline-flex;align-items:center;justify-content:center;min-height:48px;border-radius:8px;padding:0 18px;font-weight:950}.primary-action{background:#ff6f55;color:#151716}.secondary-action{border:1px solid rgba(255,248,238,.42);color:#fff8ee}.product-band{display:grid;grid-template-columns:minmax(260px,.9fr) minmax(280px,1.1fr);gap:clamp(28px,6vw,90px);padding:clamp(58px,8vw,112px) clamp(18px,5vw,70px)}.product-band h2{max-width:720px;font-size:clamp(34px,5vw,74px);line-height:.96}.product-band p{margin:0;color:#3f4743;font-size:clamp(18px,2.1vw,27px);line-height:1.34}.intro-band{padding-top:0}.intro-band .section-kicker,.cli-band .section-kicker,.docs-band .section-kicker{color:#b84632}.feature-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));border-block:1px solid #c8c0b2}.feature-grid article{min-height:250px;border-right:1px solid #c8c0b2;padding:clamp(22px,3vw,40px)}.feature-grid article:nth-child(2n){background:#e8f0e9}.feature-grid article:last-child{border-right:0}.feature-grid h3{margin:0 0 44px;font-size:24px}.feature-grid p{margin:0;color:#48504c;line-height:1.45}.cli-band{background:#162a2d;color:#fff8ee}.cli-band p{color:#c9d8d4}.cli-band pre{overflow:auto;align-self:start;margin:0;border:1px solid rgba(255,248,238,.18);border-radius:8px;background:#071314;color:#bdf1dc;padding:clamp(18px,3vw,32px);line-height:1.7}.docs-band{background:#fffaf0}.destination-list{display:grid;gap:12px}.destination-list a{display:flex;justify-content:space-between;gap:20px;border-top:1px solid #cbc2b3;padding:18px 0;font-size:clamp(21px,3vw,40px);font-weight:900}.destination-list span{color:#6f7772;font-size:15px;font-weight:700;text-align:right}@media(prefers-color-scheme:dark){.product-site{background:#101616;color:#fff8ee}.hero:after{background:linear-gradient(0deg,#101616 8%,#10161600)}.product-band p,.feature-grid p,.destination-list span{color:#bac7c3}.feature-grid{border-color:#34413e}.feature-grid article{border-color:#34413e}.feature-grid article:nth-child(2n),.docs-band{background:#182221}}@media(max-width:900px){.hero:before{inset-right:0}.hero-bg{inset:0;grid-template-columns:58px minmax(0,1fr);padding-top:90px;opacity:.38}.thread-preview{display:none}.product-band,.feature-grid{grid-template-columns:1fr}.feature-grid article,.feature-grid article:last-child{min-height:0;border-right:0;border-bottom:1px solid #c8c0b2}}@media(max-width:620px){.product-nav{align-items:flex-start;flex-direction:column}.hero{min-height:760px}.hero-bg{grid-template-columns:1fr;opacity:.42}.workspace-rail{display:none}.hero-copy{padding-bottom:90px}.destination-list a{flex-direction:column}.destination-list span{text-align:left}}:root{color-scheme:light dark;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;background:#f5f1ec;color:#171717;--bg: #f5f1ec;--panel: #fffaf2;--panel-2: #ece4d8;--text: #171717;--muted: #6d655d;--line: #d8cdbf;--accent: #dd5d45;--accent-2: #006d77;--ink: #102027;--shadow: 0 18px 60px rgba(16, 32, 39, .12)}@media(prefers-color-scheme:dark){:root{background:#121416;color:#f5efe7;--bg: #121416;--panel: #1c2022;--panel-2: #242a2c;--text: #f5efe7;--muted: #a59d93;--line: #343b3e;--accent: #ff735c;--accent-2: #6fc7cf;--ink: #f5efe7;--shadow: 0 18px 60px rgba(0, 0, 0, .35)}}*{box-sizing:border-box}body{margin:0;background:linear-gradient(135deg,rgba(221,93,69,.12),transparent 34%),linear-gradient(315deg,rgba(0,109,119,.12),transparent 32%),var(--bg)}button,input,textarea{font:inherit}button{cursor:pointer}.shell{display:grid;grid-template-columns:260px minmax(0,1fr) minmax(320px,28vw);height:100vh;min-height:620px}.sidebar,.thread{background:color-mix(in srgb,var(--panel) 88%,transparent);border-color:var(--line);border-style:solid;-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px)}.sidebar{border-width:0 1px 0 0;padding:18px 14px;overflow:auto}.brand{display:flex;align-items:center;gap:10px;margin-bottom:28px}.mark{display:grid;place-items:center;width:42px;height:42px;border-radius:8px;background:var(--ink);color:var(--panel);font-weight:900;letter-spacing:0;text-transform:uppercase}.brand strong,.brand span{display:block}.brand span,.section-title,.topbar p,.thread header p,time,.empty span,.thread-empty span{color:var(--muted);font-size:12px}.section-title{margin:18px 8px 8px;text-transform:uppercase;font-weight:800}.nav-list{display:grid;gap:4px}.nav-list button{width:100%;min-height:36px;border:0;border-radius:8px;background:transparent;color:var(--text);text-align:left;padding:8px 10px}.nav-list button:hover,.nav-list button.active{background:var(--panel-2)}.channels button{display:flex;gap:7px}.channels span{color:var(--accent);font-weight:900}.inline-create{margin:10px 0}.inline-create input,textarea{width:100%;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--text);outline:0}.inline-create input{height:36px;padding:0 10px}.timeline{display:grid;grid-template-rows:auto minmax(0,1fr) auto;min-width:0}.topbar{display:flex;align-items:center;justify-content:space-between;gap:14px;min-height:78px;padding:14px 22px;border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--bg) 82%,transparent)}.topbar h1,.topbar p{margin:0}.topbar h1{font-size:22px}.search{display:flex;align-items:center;gap:8px;min-width:min(360px,42vw)}.search input{width:100%;min-width:120px;height:34px;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--text);padding:0 10px}.search button{height:34px;border:0;border-radius:8px;background:var(--accent-2);color:var(--panel);font-weight:800;padding:0 12px}.connection{border:1px solid var(--line);border-radius:999px;color:var(--muted);padding:5px 10px;font-size:12px}.connection[data-state=live]{border-color:color-mix(in srgb,var(--accent-2) 50%,var(--line));color:var(--accent-2)}.search-results{display:grid;gap:4px;padding:8px 22px;border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--panel) 86%,transparent)}.search-results button{display:grid;gap:2px;border:0;border-radius:8px;background:transparent;color:var(--text);padding:8px;text-align:left}.search-results button:hover{background:var(--panel-2)}.search-results span{color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.messages{overflow:auto;padding:18px 22px 28px}.empty,.thread-empty{display:grid;place-items:center;align-content:center;min-height:220px;text-align:center;gap:6px}.message{display:grid;grid-template-columns:38px minmax(0,1fr);gap:10px;padding:12px 8px;border-radius:8px}.message:hover,.message.selected{background:color-mix(in srgb,var(--panel-2) 62%,transparent)}.avatar{display:grid;place-items:center;width:34px;height:34px;border-radius:8px;background:var(--accent);color:#fff;font-weight:900;text-transform:uppercase}.message header,.reply header{display:flex;align-items:baseline;gap:8px}.markdown{line-height:1.45;overflow-wrap:anywhere}.markdown p{margin:4px 0 0}.markdown code{border-radius:5px;background:var(--panel-2);padding:1px 4px}.thread-button{border:0;background:transparent;color:var(--accent-2);margin-top:5px;padding:0;font-size:12px;font-weight:800}.composer,.reply-composer{display:grid;gap:10px;padding:14px;border-top:1px solid var(--line);background:color-mix(in srgb,var(--panel) 72%,transparent)}.composer{grid-template-columns:minmax(0,1fr) minmax(104px,auto);align-items:end}textarea{resize:vertical;min-height:70px;max-height:190px;padding:11px 12px}.composer button,.reply-composer button{min-height:42px;border:0;border-radius:8px;background:var(--ink);color:var(--panel);font-weight:900}.composer-actions{display:grid;gap:8px;min-width:104px}.upload-button{display:grid;place-items:center;min-height:36px;border:1px solid var(--line);border-radius:8px;color:var(--accent-2);font-size:12px;font-weight:900}.upload-button input{position:absolute;inline-size:1px;block-size:1px;opacity:0}.pending-upload{color:var(--muted);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.thread{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;border-width:0 0 0 1px;min-width:0}.thread>header{display:flex;align-items:center;justify-content:space-between;min-height:72px;padding:14px;border-bottom:1px solid var(--line)}.thread>header p,.thread>header strong{margin:0}.thread>header button{width:32px;height:32px;border:1px solid var(--line);border-radius:8px;background:transparent;color:var(--text)}.thread-root{padding:14px;border-bottom:1px solid var(--line)}.reply-list{overflow:auto;padding:8px 14px}.reply{padding:10px 0;border-bottom:1px solid color-mix(in srgb,var(--line) 65%,transparent)}@media(max-width:980px){.shell{grid-template-columns:220px minmax(0,1fr)}.thread{position:fixed;inset:0 0 0 auto;width:min(420px,100vw);box-shadow:var(--shadow);transform:translate(100%);transition:transform .16s ease;z-index:4}.thread.open{transform:translate(0)}}@media(max-width:720px){.shell{grid-template-columns:1fr;min-height:100vh}.sidebar{display:none}.composer{grid-template-columns:1fr}.topbar{align-items:stretch;flex-direction:column}.search{min-width:0;width:100%}} +.product-site{min-height:100vh;background:#f7f3ea;color:#151716;font-family:Avenir Next,Segoe UI,ui-sans-serif,system-ui,sans-serif}.product-site a{color:inherit;text-decoration:none}.hero{position:relative;display:grid;min-height:clamp(680px,92vh,920px);overflow:hidden;isolation:isolate;background:linear-gradient(90deg,#0c1f23c7,#0c1f232e 62%,#0c1f23b3),#103033;color:#fff8ee}.hero:after{position:absolute;inset:auto 0 0;height:22vh;min-height:130px;background:linear-gradient(0deg,#f7f3ea 8%,#f7f3ea00);content:"";z-index:-1}.hero:before{position:absolute;inset:0 38% 0 0;background:linear-gradient(90deg,#081c1efa,#081c1e00);content:"";z-index:-1}.hero-bg{position:absolute;inset:0 0 0 clamp(260px,28vw,460px);display:grid;grid-template-columns:92px minmax(360px,1fr) minmax(260px,28vw);gap:18px;padding:102px clamp(18px,5vw,70px) 80px;opacity:.36;z-index:-2}.workspace-rail,.timeline-preview,.thread-preview{border:1px solid rgba(255,248,238,.24);background:#fff8ee1f;box-shadow:0 28px 90px #0000003d;-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px)}.workspace-rail{display:grid;align-content:start;gap:14px;padding:16px}.workspace-rail span{display:grid;place-items:center;min-height:54px;border-radius:8px;background:#fff8ee2e;color:#fff8ee;font-weight:900;text-transform:uppercase}.timeline-preview{align-self:stretch;padding:clamp(18px,3vw,34px)}.preview-top{display:flex;justify-content:space-between;margin-bottom:48px;color:#b9ddd9;font-weight:800}.preview-top strong{color:#7ce0b5}.timeline-preview article,.thread-preview{max-width:720px;margin:0 0 18px;border-radius:8px;background:#fff8ee29;padding:18px}.timeline-preview b,.thread-preview span{color:#ff8a70}.timeline-preview p,.thread-preview p{margin:6px 0 0;color:#fff8ee;font-size:clamp(17px,1.8vw,24px)}.timeline-preview code{border-radius:5px;background:#0c1f2394;padding:2px 5px}.thread-line{margin-left:clamp(0px,8vw,130px)}.thread-preview{align-self:center;min-height:260px}.product-nav{position:relative;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:20px;padding:24px clamp(18px,5vw,70px);font-weight:800}.product-nav>div{display:flex;gap:clamp(14px,3vw,34px)}.brand-lockup{display:inline-flex;align-items:center;gap:10px}.brand-mark{display:grid;place-items:center;width:40px;height:40px;border-radius:8px;background:#ff6f55;color:#151716;font-weight:950;text-transform:uppercase}.hero-copy{position:relative;z-index:2;align-self:center;width:min(780px,calc(100vw - 36px));padding:0 clamp(18px,5vw,70px) 16vh}.eyebrow,.section-kicker{margin:0 0 14px;color:#ffb09f;font-size:13px;font-weight:950;letter-spacing:.08em;text-transform:uppercase}.hero h1,.product-band h2{margin:0;letter-spacing:0}.hero h1{font-family:Georgia,Times New Roman,serif;font-size:clamp(66px,13vw,152px);font-weight:900;line-height:.9}.lede{width:min(680px,100%);margin:26px 0 0;color:#fff3df;font-size:clamp(20px,2.2vw,31px);line-height:1.18}.hero-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:32px}.primary-action,.secondary-action{display:inline-flex;align-items:center;justify-content:center;min-height:48px;border-radius:8px;padding:0 18px;font-weight:950}.primary-action{background:#ff6f55;color:#151716}.secondary-action{border:1px solid rgba(255,248,238,.42);color:#fff8ee}.product-band{display:grid;grid-template-columns:minmax(260px,.9fr) minmax(280px,1.1fr);gap:clamp(28px,6vw,90px);padding:clamp(58px,8vw,112px) clamp(18px,5vw,70px)}.product-band h2{max-width:720px;font-size:clamp(34px,5vw,74px);line-height:.96}.product-band p{margin:0;color:#3f4743;font-size:clamp(18px,2.1vw,27px);line-height:1.34}.intro-band{padding-top:0}.intro-band .section-kicker,.cli-band .section-kicker,.docs-band .section-kicker{color:#b84632}.feature-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));border-block:1px solid #c8c0b2}.feature-grid article{min-height:250px;border-right:1px solid #c8c0b2;padding:clamp(22px,3vw,40px)}.feature-grid article:nth-child(2n){background:#e8f0e9}.feature-grid article:last-child{border-right:0}.feature-grid h3{margin:0 0 44px;font-size:24px}.feature-grid p{margin:0;color:#48504c;line-height:1.45}.cli-band{background:#162a2d;color:#fff8ee}.cli-band p{color:#c9d8d4}.cli-band pre{overflow:auto;align-self:start;margin:0;border:1px solid rgba(255,248,238,.18);border-radius:8px;background:#071314;color:#bdf1dc;padding:clamp(18px,3vw,32px);line-height:1.7}.docs-band{background:#fffaf0}.destination-list{display:grid;gap:12px}.destination-list a{display:flex;justify-content:space-between;gap:20px;border-top:1px solid #cbc2b3;padding:18px 0;font-size:clamp(21px,3vw,40px);font-weight:900}.destination-list span{color:#6f7772;font-size:15px;font-weight:700;text-align:right}@media(prefers-color-scheme:dark){.product-site{background:#101616;color:#fff8ee}.hero:after{background:linear-gradient(0deg,#101616 8%,#10161600)}.product-band p,.feature-grid p,.destination-list span{color:#bac7c3}.feature-grid{border-color:#34413e}.feature-grid article{border-color:#34413e}.feature-grid article:nth-child(2n),.docs-band{background:#182221}}@media(max-width:900px){.hero:before{inset-right:0}.hero-bg{inset:0;grid-template-columns:58px minmax(0,1fr);padding-top:90px;opacity:.38}.thread-preview{display:none}.product-band,.feature-grid{grid-template-columns:1fr}.feature-grid article,.feature-grid article:last-child{min-height:0;border-right:0;border-bottom:1px solid #c8c0b2}}@media(max-width:620px){.product-nav{align-items:flex-start;flex-direction:column}.hero{min-height:760px}.hero-bg{grid-template-columns:1fr;opacity:.42}.workspace-rail{display:none}.hero-copy{padding-bottom:90px}.destination-list a{flex-direction:column}.destination-list span{text-align:left}}:root{color-scheme:light dark;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;background:#f5f1ec;color:#171717;--bg: #f5f1ec;--panel: #fffaf2;--panel-2: #ece4d8;--text: #171717;--muted: #6d655d;--line: #d8cdbf;--accent: #dd5d45;--accent-2: #006d77;--ink: #102027;--shadow: 0 18px 60px rgba(16, 32, 39, .12)}@media(prefers-color-scheme:dark){:root{background:#121416;color:#f5efe7;--bg: #121416;--panel: #1c2022;--panel-2: #242a2c;--text: #f5efe7;--muted: #a59d93;--line: #343b3e;--accent: #ff735c;--accent-2: #6fc7cf;--ink: #f5efe7;--shadow: 0 18px 60px rgba(0, 0, 0, .35)}}*{box-sizing:border-box}body{margin:0;background:linear-gradient(135deg,rgba(221,93,69,.12),transparent 34%),linear-gradient(315deg,rgba(0,109,119,.12),transparent 32%),var(--bg)}button,input,textarea{font:inherit}button{cursor:pointer}.auth-shell{display:grid;min-height:100vh;place-items:center;padding:24px}.auth-panel{display:grid;gap:24px;width:min(100%,420px);border:1px solid var(--line);border-radius:8px;background:color-mix(in srgb,var(--panel) 92%,transparent);box-shadow:var(--shadow);padding:28px}.auth-copy{display:grid;gap:8px}.auth-copy h1,.auth-copy p{margin:0}.auth-copy h1{font-size:28px;line-height:1.1}.auth-copy p{color:var(--muted);line-height:1.5}.github-login{display:grid;min-height:44px;place-items:center;border-radius:8px;background:var(--ink);color:var(--panel);font-weight:900;text-decoration:none}.shell{display:grid;grid-template-columns:260px minmax(0,1fr) minmax(320px,28vw);height:100vh;min-height:620px}.sidebar,.thread{background:color-mix(in srgb,var(--panel) 88%,transparent);border-color:var(--line);border-style:solid;-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px)}.sidebar{border-width:0 1px 0 0;padding:18px 14px;overflow:auto}.brand{display:flex;align-items:center;gap:10px;margin-bottom:28px}.mark{display:grid;place-items:center;width:42px;height:42px;border-radius:8px;background:var(--ink);color:var(--panel);font-weight:900;letter-spacing:0;text-transform:uppercase}.brand strong,.brand span{display:block}.brand span,.section-title,.topbar p,.thread header p,time,.empty span,.thread-empty span{color:var(--muted);font-size:12px}.section-title{margin:18px 8px 8px;text-transform:uppercase;font-weight:800}.nav-list{display:grid;gap:4px}.nav-list button{width:100%;min-height:36px;border:0;border-radius:8px;background:transparent;color:var(--text);text-align:left;padding:8px 10px}.nav-list button:hover,.nav-list button.active{background:var(--panel-2)}.channels button{display:flex;gap:7px}.channels span{color:var(--accent);font-weight:900}.inline-create{margin:10px 0}.inline-create input,textarea{width:100%;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--text);outline:0}.inline-create input{height:36px;padding:0 10px}.timeline{display:grid;grid-template-rows:auto minmax(0,1fr) auto;min-width:0}.topbar{display:flex;align-items:center;justify-content:space-between;gap:14px;min-height:78px;padding:14px 22px;border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--bg) 82%,transparent)}.topbar h1,.topbar p{margin:0}.topbar h1{font-size:22px}.search{display:flex;align-items:center;gap:8px;min-width:min(360px,42vw)}.search input{width:100%;min-width:120px;height:34px;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--text);padding:0 10px}.search button{height:34px;border:0;border-radius:8px;background:var(--accent-2);color:var(--panel);font-weight:800;padding:0 12px}.connection{border:1px solid var(--line);border-radius:999px;color:var(--muted);padding:5px 10px;font-size:12px}.connection[data-state=live]{border-color:color-mix(in srgb,var(--accent-2) 50%,var(--line));color:var(--accent-2)}.search-results{display:grid;gap:4px;padding:8px 22px;border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--panel) 86%,transparent)}.search-results button{display:grid;gap:2px;border:0;border-radius:8px;background:transparent;color:var(--text);padding:8px;text-align:left}.search-results button:hover{background:var(--panel-2)}.search-results span{color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.messages{overflow:auto;padding:18px 22px 28px}.empty,.thread-empty{display:grid;place-items:center;align-content:center;min-height:220px;text-align:center;gap:6px}.message{display:grid;grid-template-columns:38px minmax(0,1fr);gap:10px;padding:12px 8px;border-radius:8px}.message:hover,.message.selected{background:color-mix(in srgb,var(--panel-2) 62%,transparent)}.avatar{display:grid;place-items:center;width:34px;height:34px;border-radius:8px;background:var(--accent);color:#fff;font-weight:900;text-transform:uppercase}.message header,.reply header{display:flex;align-items:baseline;gap:8px}.markdown{line-height:1.45;overflow-wrap:anywhere}.markdown p{margin:4px 0 0}.markdown code{border-radius:5px;background:var(--panel-2);padding:1px 4px}.thread-button{border:0;background:transparent;color:var(--accent-2);margin-top:5px;padding:0;font-size:12px;font-weight:800}.composer,.reply-composer{display:grid;gap:10px;padding:14px;border-top:1px solid var(--line);background:color-mix(in srgb,var(--panel) 72%,transparent)}.composer{grid-template-columns:minmax(0,1fr) minmax(104px,auto);align-items:end}textarea{resize:vertical;min-height:70px;max-height:190px;padding:11px 12px}.composer button,.reply-composer button{min-height:42px;border:0;border-radius:8px;background:var(--ink);color:var(--panel);font-weight:900}.composer-actions{display:grid;gap:8px;min-width:104px}.upload-button{display:grid;place-items:center;min-height:36px;border:1px solid var(--line);border-radius:8px;color:var(--accent-2);font-size:12px;font-weight:900}.upload-button input{position:absolute;inline-size:1px;block-size:1px;opacity:0}.pending-upload{color:var(--muted);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.thread{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;border-width:0 0 0 1px;min-width:0}.thread>header{display:flex;align-items:center;justify-content:space-between;min-height:72px;padding:14px;border-bottom:1px solid var(--line)}.thread>header p,.thread>header strong{margin:0}.thread>header button{width:32px;height:32px;border:1px solid var(--line);border-radius:8px;background:transparent;color:var(--text)}.thread-root{padding:14px;border-bottom:1px solid var(--line)}.reply-list{overflow:auto;padding:8px 14px}.reply{padding:10px 0;border-bottom:1px solid color-mix(in srgb,var(--line) 65%,transparent)}@media(max-width:980px){.shell{grid-template-columns:220px minmax(0,1fr)}.thread{position:fixed;inset:0 0 0 auto;width:min(420px,100vw);box-shadow:var(--shadow);transform:translate(100%);transition:transform .16s ease;z-index:4}.thread.open{transform:translate(0)}}@media(max-width:720px){.shell{grid-template-columns:1fr;min-height:100vh}.sidebar{display:none}.composer{grid-template-columns:1fr}.topbar{align-items:stretch;flex-direction:column}.search{min-width:0;width:100%}} diff --git a/apps/api/internal/webassets/dist/index.html b/apps/api/internal/webassets/dist/index.html index 08fedd0..9084f8b 100644 --- a/apps/api/internal/webassets/dist/index.html +++ b/apps/api/internal/webassets/dist/index.html @@ -4,8 +4,8 @@ ClickClack - - + +
    diff --git a/apps/web/src/ChatApp.svelte b/apps/web/src/ChatApp.svelte index 5ea06de..aa9eeaf 100644 --- a/apps/web/src/ChatApp.svelte +++ b/apps/web/src/ChatApp.svelte @@ -1,6 +1,6 @@