aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2024-06-01 09:41:02 -0400
committerXe Iaso <me@xeiaso.net>2024-06-01 09:41:02 -0400
commit05a922d8f3ae57e47426b81769fe168255cda03e (patch)
tree9dc4c1954e3419cf425d66cac08a33ef66f1c9bc /cmd
parent5aae4555be3facdc890aaabea1800fc916706257 (diff)
downloadx-05a922d8f3ae57e47426b81769fe168255cda03e.tar.xz
x-05a922d8f3ae57e47426b81769fe168255cda03e.zip
cmd: add azurda
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/azurda/main.go258
-rw-r--r--cmd/azurda/stablediffusion.go161
-rw-r--r--cmd/azurda/static/css/podkova.woff2bin0 -> 60580 bytes
-rw-r--r--cmd/azurda/static/css/xess.css83
-rw-r--r--cmd/azurda/static/img/azurda.pngbin0 -> 69760 bytes
-rw-r--r--cmd/azurda/static/index.html55
-rw-r--r--cmd/azurda/static/js/alpine.js9
-rw-r--r--cmd/azurda/static/js/md5.min.js2
8 files changed, 568 insertions, 0 deletions
diff --git a/cmd/azurda/main.go b/cmd/azurda/main.go
new file mode 100644
index 0000000..62cd43e
--- /dev/null
+++ b/cmd/azurda/main.go
@@ -0,0 +1,258 @@
+// Program azurda is a fake s3 server implementation. All objects are generated on the fly from Stable Diffusion.
+//
+// This is intended to be used as a "shadow bucket" endpoint with Tigris so that Tigris can "fall through" to Azurda if the object is not found in the real bucket.
+package main
+
+import (
+ "bytes"
+ "embed"
+ "flag"
+ "fmt"
+ "image"
+ "image/jpeg"
+ _ "image/png"
+ "log"
+ "log/slog"
+ "net/http"
+ "os"
+ "regexp"
+ "time"
+
+ "github.com/prometheus/client_golang/prometheus"
+ "github.com/prometheus/client_golang/prometheus/promauto"
+ "within.website/x/internal"
+ "within.website/x/web/stablediffusion"
+)
+
+var (
+ accessKey = flag.String("access-key", "", "Access key for the client to use")
+ secretKey = flag.String("secret-key", "", "Secret key for the client to use")
+ bucketName = flag.String("bucket-name", "fallthrough", "The bucket name to expect from Tigris")
+ bind = flag.String("bind", ":8085", "address to bind to")
+ internalBind = flag.String("internal-bind", ":8086", "address to bind internal services (metrics, etc) to")
+ sdServerURL = flag.String("stablediffusion-server-url", "http://xe-automatic1111.internal:8080", "URL for the Stable Diffusion API used with the default client")
+
+ isHexRegex = regexp.MustCompile(`[a-fA-F0-9]+$`)
+
+ authErrors = promauto.NewGaugeVec(prometheus.GaugeOpts{
+ Name: "azurda_auth_errors",
+ Help: "Number of auth errors encountered while serving requests.",
+ }, []string{"kind"})
+
+ requestDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
+ Name: "azurda_request_duration_seconds",
+ Help: "The duration of requests in seconds.",
+ Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10},
+ }, []string{"method"})
+
+ stableDiffusionHits = promauto.NewCounter(prometheus.CounterOpts{
+ Name: "azurda_stable_diffusion_hits",
+ Help: "Number of hits to the stable diffusion endpoint.",
+ })
+
+ stableDiffusionCreationErrors = promauto.NewGauge(prometheus.GaugeOpts{
+ Name: "azurda_stable_diffusion_creation_errors",
+ Help: "Number of errors encountered while creating a stable diffusion image.",
+ })
+
+ //go:embed static
+ static embed.FS
+)
+
+func main() {
+ internal.HandleStartup()
+
+ stablediffusion.Default.APIServer = *sdServerURL
+
+ slog.Info("starting azurda",
+ "bind", *bind,
+ "internalBind", *internalBind,
+ "bucket", *bucketName,
+ "accessKey", *accessKey,
+ "hasSecretKey", *secretKey != "",
+ "stableDiffusionURL", stablediffusion.Default.APIServer,
+ )
+
+ if *accessKey == "" {
+ fmt.Println("access-key is required")
+ os.Exit(2)
+ }
+
+ if *secretKey == "" {
+ fmt.Println("secret-key is required")
+ os.Exit(2)
+ }
+
+ mux := http.NewServeMux()
+
+ mux.HandleFunc("/{$}", func(w http.ResponseWriter, r *http.Request) {
+ http.ServeFileFS(w, r, static, "static/index.html")
+ })
+ mux.Handle("/static/", http.FileServerFS(static))
+ mux.HandleFunc("GET /fallthrough/{hash}", ServeStableDiffusion)
+
+ log.Fatal(http.ListenAndServe(*bind, mux))
+}
+
+func SpewMiddleware(next http.Handler) http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ r.Write(os.Stdout)
+ fmt.Println()
+ next.ServeHTTP(w, r)
+ })
+}
+
+func ServeStableDiffusion(w http.ResponseWriter, r *http.Request) {
+ hash := r.PathValue("hash")
+
+ if !isHexRegex.MatchString(hash) {
+ http.Error(w, "the input must be a hexadecimal string", http.StatusBadRequest)
+ return
+ }
+
+ prompt, seed := hallucinatePrompt(hash)
+
+ imgs, err := stablediffusion.Default.Generate(r.Context(), stablediffusion.SimpleImageRequest{
+ Prompt: "headshot, portrait, masterpiece, best quality, " + prompt,
+ NegativePrompt: "person in distance, worst quality, low quality, medium quality, deleted, lowres, comic, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, jpeg artifacts, signature, watermark, username, blurry",
+ Seed: seed,
+ SamplerName: "DPM++ 2M Karras",
+ BatchSize: 1,
+ NIter: 1,
+ Steps: 20,
+ CfgScale: 7,
+ Width: 256,
+ Height: 256,
+ SNoise: 1,
+
+ OverrideSettingsRestoreAfterwards: true,
+ })
+ if err != nil {
+ stableDiffusionCreationErrors.Add(1)
+ http.Error(w, "Not found", http.StatusNotFound)
+ slog.Error("can't fabricate image", "err", err)
+ return
+ }
+
+ stableDiffusionHits.Add(1)
+
+ img, _, err := image.Decode(bytes.NewBuffer(imgs.Images[0]))
+ if err != nil {
+ stableDiffusionCreationErrors.Add(1)
+ http.Error(w, "can't decode image", http.StatusInternalServerError)
+ slog.Error("can't decode image", "err", err)
+ return
+ }
+
+ buf := &bytes.Buffer{}
+
+ if err := jpeg.Encode(buf, img, &jpeg.Options{Quality: 75}); err != nil {
+ stableDiffusionCreationErrors.Add(1)
+ http.Error(w, "can't encode image", http.StatusInternalServerError)
+ slog.Error("can't encode image", "err", err)
+ return
+ }
+
+ imgs.Images[0] = buf.Bytes()
+
+ w.Header().Set("content-type", "image/jpeg")
+ w.Header().Set("content-length", fmt.Sprint(len(imgs.Images[0])))
+ w.Header().Set("expires", time.Now().Add(30*24*time.Hour).Format(http.TimeFormat))
+ w.Header().Set("Cache-Control", "max-age:2630000") // one month
+ w.WriteHeader(http.StatusOK)
+ w.Write(imgs.Images[0])
+}
+
+// func AWSValidationMiddleware(accessKey, secretKey string, next http.Handler) http.Handler {
+// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+// //slog.Debug("incoming request", "method", r.Method, "path", r.URL.Path, "headers", r.Header)
+// if r.Header.Get("Authorization") == "" {
+// http.Error(w, "missing Authorization header", http.StatusUnauthorized)
+// authErrors.WithLabelValues("missing").Inc()
+// return
+// }
+//
+// //slog.Debug("auth header", "header", r.Header.Get("Authorization"))
+//
+// sp := strings.SplitN(r.Header.Get("Authorization"), " ", 2)
+// if len(sp) != 2 {
+// http.Error(w, "malformed Authorization header", http.StatusUnauthorized)
+// slog.Error("malformed auth header")
+// authErrors.WithLabelValues("malformed").Inc()
+// return
+// }
+//
+// if sp[0] != "AWS4-HMAC-SHA256" {
+// http.Error(w, "unsupported authorization type", http.StatusUnauthorized)
+// slog.Error("unsupported auth type", "type", sp[0])
+// authErrors.WithLabelValues("unsupported").Inc()
+// return
+// }
+//
+// authPartSlice := strings.SplitN(sp[1], ", ", 3)
+// slog.Debug("auth parts", "parts", authPartSlice)
+// if len(authPartSlice) != 3 {
+// http.Error(w, "malformed Authorization header auth parts", http.StatusUnauthorized)
+// authErrors.WithLabelValues("malformed_authparts").Inc()
+// return
+// }
+//
+// authParts := map[string]string{}
+// for _, part := range authPartSlice {
+// sp := strings.SplitN(part, "=", 2)
+// if len(sp) != 2 {
+// http.Error(w, "malformed Authorization header auth part", http.StatusUnauthorized)
+// slog.Debug("malformed auth part", "part", part)
+// authErrors.WithLabelValues("malformed_authpart").Inc()
+// return
+// }
+//
+// authParts[strings.ToLower(sp[0])] = strings.Trim(sp[1], "\"")
+// }
+//
+// if authParts["credential"] == "" {
+// http.Error(w, "missing credential in Authorization header", http.StatusUnauthorized)
+// slog.Debug("missing credential in auth header")
+// authErrors.WithLabelValues("missing_credential").Inc()
+// return
+// }
+//
+// if authParts["signature"] == "" {
+// http.Error(w, "missing signature in Authorization header", http.StatusUnauthorized)
+// slog.Debug("missing signature in auth header")
+// authErrors.WithLabelValues("missing_signature").Inc()
+// return
+// }
+//
+// if authParts["signedheaders"] == "" {
+// http.Error(w, "missing signedheaders in Authorization header", http.StatusUnauthorized)
+// slog.Debug("missing signedheaders in auth header")
+// authErrors.WithLabelValues("missing_signedheaders").Inc()
+// return
+// }
+//
+// if !strings.Contains(authParts["credential"], accessKey) {
+// http.Error(w, "access key mismatch", http.StatusUnauthorized)
+// authErrors.WithLabelValues("access_key_mismatch").Inc()
+// return
+// }
+//
+// req := r.Clone(r.Context())
+// req.Header.Del("Authorization")
+//
+// req = awsauth.Sign4(req, awsauth.Credentials{
+// AccessKeyID: accessKey,
+// SecretAccessKey: secretKey,
+// })
+//
+// fmt.Println("Theirs: ", r.Header.Get("Authorization"))
+// fmt.Println("Ours: ", req.Header.Get("Authorization"))
+//
+// if req.Header.Get("Authorization") != r.Header.Get("Authorization") {
+// http.Error(w, "failed to sign request", http.StatusUnauthorized)
+// return
+// }
+//
+// next.ServeHTTP(w, r)
+// })
+// }
diff --git a/cmd/azurda/stablediffusion.go b/cmd/azurda/stablediffusion.go
new file mode 100644
index 0000000..0cc4e41
--- /dev/null
+++ b/cmd/azurda/stablediffusion.go
@@ -0,0 +1,161 @@
+package main
+
+import (
+ "fmt"
+ "math/rand"
+ "strconv"
+ "strings"
+)
+
+func hallucinatePrompt(hash string) (string, int) {
+ var sb strings.Builder
+ if hash[0] > '0' && hash[0] <= '5' {
+ fmt.Fprint(&sb, "1girl, ")
+ } else {
+ fmt.Fprint(&sb, "1guy, ")
+ }
+
+ switch hash[1] {
+ case '0', '1', '2', '3':
+ fmt.Fprint(&sb, "blonde, ")
+ case '4', '5', '6', '7':
+ fmt.Fprint(&sb, "brown hair, ")
+ case '8', '9', 'a', 'b':
+ fmt.Fprint(&sb, "red hair, ")
+ case 'c', 'd', 'e', 'f':
+ fmt.Fprint(&sb, "black hair, ")
+ default:
+ }
+
+ if hash[2] > '0' && hash[2] <= '5' {
+ fmt.Fprint(&sb, "coffee shop, ")
+ } else {
+ fmt.Fprint(&sb, "landscape, outdoors, ")
+ }
+
+ if hash[3] > '0' && hash[3] <= '5' {
+ fmt.Fprint(&sb, "hoodie, ")
+ } else {
+ fmt.Fprint(&sb, "sweatsuit, ")
+ }
+
+ switch hash[4] {
+ case '0', '1', '2', '3':
+ fmt.Fprint(&sb, "<lora:cdi:1>, ")
+ case '4', '5', '6', '7':
+ fmt.Fprint(&sb, "breath of the wild, ")
+ case '8', '9', 'a', 'b':
+ fmt.Fprint(&sb, "genshin impact, ")
+ case 'c', 'd', 'e', 'f':
+ fmt.Fprint(&sb, "arknights, ")
+ default:
+ }
+
+ if hash[5] > '0' && hash[5] <= '5' {
+ fmt.Fprint(&sb, "watercolor, ")
+ } else {
+ fmt.Fprint(&sb, "matte painting, ")
+ }
+
+ switch hash[6] {
+ case '0', '1', '2', '3':
+ fmt.Fprint(&sb, "highly detailed, ")
+ case '4', '5', '6', '7':
+ fmt.Fprint(&sb, "ornate, ")
+ case '8', '9', 'a', 'b':
+ fmt.Fprint(&sb, "thick lines, ")
+ case 'c', 'd', 'e', 'f':
+ fmt.Fprint(&sb, "3d render, ")
+ default:
+ }
+
+ switch hash[7] {
+ case '0', '1', '2', '3':
+ fmt.Fprint(&sb, "short hair, ")
+ case '4', '5', '6', '7':
+ fmt.Fprint(&sb, "long hair, ")
+ case '8', '9', 'a', 'b':
+ fmt.Fprint(&sb, "ponytail, ")
+ case 'c', 'd', 'e', 'f':
+ fmt.Fprint(&sb, "pigtails, ")
+ default:
+ }
+
+ switch hash[8] {
+ case '0', '1', '2', '3':
+ fmt.Fprint(&sb, "smile, ")
+ case '4', '5', '6', '7':
+ fmt.Fprint(&sb, "frown, ")
+ case '8', '9', 'a', 'b':
+ fmt.Fprint(&sb, "laughing, ")
+ case 'c', 'd', 'e', 'f':
+ fmt.Fprint(&sb, "angry, ")
+ default:
+ }
+
+ switch hash[9] {
+ case '0', '1', '2', '3':
+ fmt.Fprint(&sb, "sweater, ")
+ case '4', '5', '6', '7':
+ fmt.Fprint(&sb, "tshirt, ")
+ case '8', '9', 'a', 'b':
+ fmt.Fprint(&sb, "suitjacket, ")
+ case 'c', 'd', 'e', 'f':
+ fmt.Fprint(&sb, "armor, ")
+ default:
+ }
+
+ switch hash[10] {
+ case '0', '1', '2', '3':
+ fmt.Fprint(&sb, "blue eyes, ")
+ case '4', '5', '6', '7':
+ fmt.Fprint(&sb, "red eyes, ")
+ case '8', '9', 'a', 'b':
+ fmt.Fprint(&sb, "brown eyes, ")
+ case 'c', 'd', 'e', 'f':
+ fmt.Fprint(&sb, "hazel eyes, ")
+ default:
+ }
+
+ if hash[11] == '0' {
+ fmt.Fprint(&sb, "heterochromia, ")
+ }
+
+ switch hash[12] {
+ case '0', '1', '2', '3':
+ fmt.Fprint(&sb, "morning, ")
+ case '4', '5', '6', '7':
+ fmt.Fprint(&sb, "afternoon, ")
+ case '8', '9', 'a', 'b':
+ fmt.Fprint(&sb, "evening, ")
+ case 'c', 'd', 'e', 'f':
+ fmt.Fprint(&sb, "nighttime, ")
+ default:
+ }
+
+ if hash[13] == '0' {
+ fmt.Fprint(&sb, "<lora:genshin:1>, genshin, ")
+ }
+
+ switch hash[14] {
+ case '0', '1', '2', '3':
+ fmt.Fprint(&sb, "vtuber, ")
+ case '4', '5', '6', '7':
+ fmt.Fprint(&sb, "anime, ")
+ case '8', '9', 'a', 'b':
+ fmt.Fprint(&sb, "studio ghibli, ")
+ case 'c', 'd', 'e', 'f':
+ fmt.Fprint(&sb, "cloverworks, ")
+ default:
+ }
+
+ seedPortion := hash[len(hash)-9 : len(hash)-1]
+ seed, err := strconv.ParseInt(seedPortion, 16, 32)
+ if err != nil {
+ seed = int64(rand.Int())
+ }
+
+ fmt.Fprint(&sb, "pants")
+
+ return sb.String(), int(seed)
+}
diff --git a/cmd/azurda/static/css/podkova.woff2 b/cmd/azurda/static/css/podkova.woff2
new file mode 100644
index 0000000..508f97d
--- /dev/null
+++ b/cmd/azurda/static/css/podkova.woff2
Binary files differ
diff --git a/cmd/azurda/static/css/xess.css b/cmd/azurda/static/css/xess.css
new file mode 100644
index 0000000..fe9fee2
--- /dev/null
+++ b/cmd/azurda/static/css/xess.css
@@ -0,0 +1,83 @@
+@import url(https://cdn.xeiaso.net/static/css/iosevka/family.css);
+@font-face {
+ font-family: "Podkova";
+ font-style: normal;
+ font-weight: 400 800;
+ font-display: swap;
+ src: url("podkova.woff2") format("woff2");
+}
+main {
+ font-family: Iosevka Aile Iaso, sans-serif;
+ max-width: 50rem;
+ padding: 2rem;
+ margin: auto;
+}
+@media only screen and (max-device-width: 736px) {
+ main {
+ padding: 0;
+ }
+}
+::selection {
+ background: #d3869b;
+}
+body {
+ background: #1d2021;
+ color: #f9f5d7;
+}
+pre {
+ background-color: #3c3836;
+ padding: 1em;
+ border: 0;
+ font-family: Iosevka Curly Iaso, monospace;
+}
+a,
+a:active,
+a:visited {
+ color: #b16286;
+ background-color: #282828;
+}
+h1,
+h2,
+h3,
+h4,
+h5 {
+ margin-bottom: 0.1rem;
+ font-family: Podkova, serif;
+}
+blockquote {
+ border-left: 1px solid #bdae93;
+ margin: 0.5em 10px;
+ padding: 0.5em 10px;
+}
+footer {
+ align: center;
+}
+@media (prefers-color-scheme: light) {
+ body {
+ background: #f9f5d7;
+ color: #1d2021;
+ }
+ pre {
+ background-color: #ebdbb2;
+ padding: 1em;
+ border: 0;
+ }
+ a,
+ a:active,
+ a:visited {
+ color: #b16286;
+ background-color: #fbf1c7;
+ }
+ h1,
+ h2,
+ h3,
+ h4,
+ h5 {
+ margin-bottom: 0.1rem;
+ }
+ blockquote {
+ border-left: 1px solid #655c54;
+ margin: 0.5em 10px;
+ padding: 0.5em 10px;
+ }
+}
diff --git a/cmd/azurda/static/img/azurda.png b/cmd/azurda/static/img/azurda.png
new file mode 100644
index 0000000..d4bc881
--- /dev/null
+++ b/cmd/azurda/static/img/azurda.png
Binary files differ
diff --git a/cmd/azurda/static/index.html b/cmd/azurda/static/index.html
new file mode 100644
index 0000000..949a854
--- /dev/null
+++ b/cmd/azurda/static/index.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Azurda</title>
+ <link rel="stylesheet" href="/static/css/xess.css" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <script src="/static/js/alpine.js" defer></script>
+ <script src="/static/js/md5.min.js" defer></script>
+ <script>
+ document.addEventListener("alpine:init", () => {
+ Alpine.data("azurda", () => ({
+ str: "", // The input string
+ md5: "", // md5 hash of the string
+ url: "/static/img/azurda.png", // image for user
+ md5sum() {
+ return new Promise((resolve) => {
+ this.md5 = md5(this.str);
+ this.url = `https://cdn.xeiaso.net/avatar/${this.md5}`;
+ resolve(this.md5);
+ });
+ },
+ }));
+ });
+ </script>
+ </head>
+ <body id="top">
+ <main>
+ <h1>Azurda</h1>
+
+ <p>Type in some text and get a randomly generated avatar!</p>
+
+ <div x-data="azurda">
+ <input
+ @input.debounce.500ms="md5sum().then((hash) => console.log(hash))"
+ type="text"
+ x-model="str"
+ />
+ <br />
+ <img
+ style="margin-top: 2rem"
+ x-bind:src="url"
+ alt="Azurda"
+ width="256px"
+ />
+ </div>
+
+ <footer>
+ <p>
+ From <a href="https://within.website">Within</a> with ❤️ -
+ <a href="">Source code</a>
+ </p>
+ </footer>
+ </main>
+ </body>
+</html>
diff --git a/cmd/azurda/static/js/alpine.js b/cmd/azurda/static/js/alpine.js
new file mode 100644
index 0000000..9b98d0c
--- /dev/null
+++ b/cmd/azurda/static/js/alpine.js
@@ -0,0 +1,9 @@
+(() => {
+ var Ze = !1, Qe = !1, V = [], et = -1; function Kt(e) { bn(e) } function bn(e) { V.includes(e) || V.push(e), wn() } function we(e) { let t = V.indexOf(e); t !== -1 && t > et && V.splice(t, 1) } function wn() { !Qe && !Ze && (Ze = !0, queueMicrotask(En)) } function En() { Ze = !1, Qe = !0; for (let e = 0; e < V.length; e++)V[e](), et = e; V.length = 0, et = -1, Qe = !1 } var T, D, L, rt, tt = !0; function zt(e) { tt = !1, e(), tt = !0 } function Ht(e) { T = e.reactive, L = e.release, D = t => e.effect(t, { scheduler: r => { tt ? Kt(r) : r() } }), rt = e.raw } function nt(e) { D = e } function Vt(e) { let t = () => { }; return [n => { let i = D(n); return e._x_effects || (e._x_effects = new Set, e._x_runEffects = () => { e._x_effects.forEach(o => o()) }), e._x_effects.add(i), t = () => { i !== void 0 && (e._x_effects.delete(i), L(i)) }, i }, () => { t() }] } function q(e, t, r = {}) { e.dispatchEvent(new CustomEvent(t, { detail: r, bubbles: !0, composed: !0, cancelable: !0 })) } function O(e, t) { if (typeof ShadowRoot == "function" && e instanceof ShadowRoot) { Array.from(e.children).forEach(i => O(i, t)); return } let r = !1; if (t(e, () => r = !0), r) return; let n = e.firstElementChild; for (; n;)O(n, t, !1), n = n.nextElementSibling } function S(e, ...t) { console.warn(`Alpine Warning: ${e}`, ...t) } var qt = !1; function Ut() { qt && S("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."), qt = !0, document.body || S("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"), q(document, "alpine:init"), q(document, "alpine:initializing"), ce(), Qt(t => v(t, O)), Q(t => ae(t)), Se((t, r) => { le(t, r).forEach(n => n()) }); let e = t => !U(t.parentElement, !0); Array.from(document.querySelectorAll(Jt())).filter(e).forEach(t => { v(t) }), q(document, "alpine:initialized") } var it = [], Wt = []; function Gt() { return it.map(e => e()) } function Jt() { return it.concat(Wt).map(e => e()) } function Ee(e) { it.push(e) } function ve(e) { Wt.push(e) } function U(e, t = !1) { return Z(e, r => { if ((t ? Jt() : Gt()).some(i => r.matches(i))) return !0 }) } function Z(e, t) { if (e) { if (t(e)) return e; if (e._x_teleportBack && (e = e._x_teleportBack), !!e.parentElement) return Z(e.parentElement, t) } } function Yt(e) { return Gt().some(t => e.matches(t)) } var Xt = []; function Zt(e) { Xt.push(e) } function v(e, t = O, r = () => { }) { tr(() => { t(e, (n, i) => { r(n, i), Xt.forEach(o => o(n, i)), le(n, n.attributes).forEach(o => o()), n._x_ignore && i() }) }) } function ae(e) { O(e, t => { ot(t), er(t) }) } var rr = [], nr = [], ir = []; function Qt(e) { ir.push(e) } function Q(e, t) { typeof t == "function" ? (e._x_cleanups || (e._x_cleanups = []), e._x_cleanups.push(t)) : (t = e, nr.push(t)) } function Se(e) { rr.push(e) } function Oe(e, t, r) { e._x_attributeCleanups || (e._x_attributeCleanups = {}), e._x_attributeCleanups[t] || (e._x_attributeCleanups[t] = []), e._x_attributeCleanups[t].push(r) } function ot(e, t) { e._x_attributeCleanups && Object.entries(e._x_attributeCleanups).forEach(([r, n]) => { (t === void 0 || t.includes(r)) && (n.forEach(i => i()), delete e._x_attributeCleanups[r]) }) } function er(e) { if (e._x_cleanups) for (; e._x_cleanups.length;)e._x_cleanups.pop()() } var at = new MutationObserver(ft), ct = !1; function ce() { at.observe(document, { subtree: !0, childList: !0, attributes: !0, attributeOldValue: !0 }), ct = !0 } function lt() { vn(), at.disconnect(), ct = !1 } var ue = [], st = !1; function vn() { ue = ue.concat(at.takeRecords()), ue.length && !st && (st = !0, queueMicrotask(() => { Sn(), st = !1 })) } function Sn() { ft(ue), ue.length = 0 } function h(e) { if (!ct) return e(); lt(); let t = e(); return ce(), t } var ut = !1, Ae = []; function or() { ut = !0 } function sr() { ut = !1, ft(Ae), Ae = [] } function ft(e) { if (ut) { Ae = Ae.concat(e); return } let t = [], r = [], n = new Map, i = new Map; for (let o = 0; o < e.length; o++)if (!e[o].target._x_ignoreMutationObserver && (e[o].type === "childList" && (e[o].addedNodes.forEach(s => s.nodeType === 1 && t.push(s)), e[o].removedNodes.forEach(s => s.nodeType === 1 && r.push(s))), e[o].type === "attributes")) { let s = e[o].target, a = e[o].attributeName, c = e[o].oldValue, l = () => { n.has(s) || n.set(s, []), n.get(s).push({ name: a, value: s.getAttribute(a) }) }, u = () => { i.has(s) || i.set(s, []), i.get(s).push(a) }; s.hasAttribute(a) && c === null ? l() : s.hasAttribute(a) ? (u(), l()) : u() } i.forEach((o, s) => { ot(s, o) }), n.forEach((o, s) => { rr.forEach(a => a(s, o)) }); for (let o of r) t.includes(o) || (nr.forEach(s => s(o)), ae(o)); t.forEach(o => { o._x_ignoreSelf = !0, o._x_ignore = !0 }); for (let o of t) r.includes(o) || o.isConnected && (delete o._x_ignoreSelf, delete o._x_ignore, ir.forEach(s => s(o)), o._x_ignore = !0, o._x_ignoreSelf = !0); t.forEach(o => { delete o._x_ignoreSelf, delete o._x_ignore }), t = null, r = null, n = null, i = null } function Ce(e) { return F($(e)) } function N(e, t, r) { return e._x_dataStack = [t, ...$(r || e)], () => { e._x_dataStack = e._x_dataStack.filter(n => n !== t) } } function $(e) { return e._x_dataStack ? e._x_dataStack : typeof ShadowRoot == "function" && e instanceof ShadowRoot ? $(e.host) : e.parentNode ? $(e.parentNode) : [] } function F(e) { let t = new Proxy({}, { ownKeys: () => Array.from(new Set(e.flatMap(r => Object.keys(r)))), has: (r, n) => e.some(i => i.hasOwnProperty(n)), get: (r, n) => (e.find(i => { if (i.hasOwnProperty(n)) { let o = Object.getOwnPropertyDescriptor(i, n); if (o.get && o.get._x_alreadyBound || o.set && o.set._x_alreadyBound) return !0; if ((o.get || o.set) && o.enumerable) { let s = o.get, a = o.set, c = o; s = s && s.bind(t), a = a && a.bind(t), s && (s._x_alreadyBound = !0), a && (a._x_alreadyBound = !0), Object.defineProperty(i, n, { ...c, get: s, set: a }) } return !0 } return !1 }) || {})[n], set: (r, n, i) => { let o = e.find(s => s.hasOwnProperty(n)); return o ? o[n] = i : e[e.length - 1][n] = i, !0 } }); return t } function Te(e) { let t = n => typeof n == "object" && !Array.isArray(n) && n !== null, r = (n, i = "") => { Object.entries(Object.getOwnPropertyDescriptors(n)).forEach(([o, { value: s, enumerable: a }]) => { if (a === !1 || s === void 0) return; let c = i === "" ? o : `${i}.${o}`; typeof s == "object" && s !== null && s._x_interceptor ? n[o] = s.initialize(e, c, o) : t(s) && s !== n && !(s instanceof Element) && r(s, c) }) }; return r(e) } function Re(e, t = () => { }) { let r = { initialValue: void 0, _x_interceptor: !0, initialize(n, i, o) { return e(this.initialValue, () => An(n, i), s => dt(n, i, s), i, o) } }; return t(r), n => { if (typeof n == "object" && n !== null && n._x_interceptor) { let i = r.initialize.bind(r); r.initialize = (o, s, a) => { let c = n.initialize(o, s, a); return r.initialValue = c, i(o, s, a) } } else r.initialValue = n; return r } } function An(e, t) { return t.split(".").reduce((r, n) => r[n], e) } function dt(e, t, r) { if (typeof t == "string" && (t = t.split(".")), t.length === 1) e[t[0]] = r; else { if (t.length === 0) throw error; return e[t[0]] || (e[t[0]] = {}), dt(e[t[0]], t.slice(1), r) } } var ar = {}; function y(e, t) { ar[e] = t } function fe(e, t) { return Object.entries(ar).forEach(([r, n]) => { let i = null; function o() { if (i) return i; { let [s, a] = pt(t); return i = { interceptor: Re, ...s }, Q(t, a), i } } Object.defineProperty(e, `$${r}`, { get() { return n(t, o()) }, enumerable: !1 }) }), e } function cr(e, t, r, ...n) { try { return r(...n) } catch (i) { ee(i, e, t) } } function ee(e, t, r = void 0) {
+ Object.assign(e, { el: t, expression: r }), console.warn(`Alpine Expression Error: ${e.message}
+
+${r ? 'Expression: "' + r + `"
+
+`: ""}`, t), setTimeout(() => { throw e }, 0)
+ } var Me = !0; function Pe(e) { let t = Me; Me = !1; let r = e(); return Me = t, r } function R(e, t, r = {}) { let n; return x(e, t)(i => n = i, r), n } function x(...e) { return lr(...e) } var lr = ht; function ur(e) { lr = e } function ht(e, t) { let r = {}; fe(r, e); let n = [r, ...$(e)], i = typeof t == "function" ? On(n, t) : Tn(n, t, e); return cr.bind(null, e, t, i) } function On(e, t) { return (r = () => { }, { scope: n = {}, params: i = [] } = {}) => { let o = t.apply(F([n, ...e]), i); Ne(r, o) } } var mt = {}; function Cn(e, t) { if (mt[e]) return mt[e]; let r = Object.getPrototypeOf(async function () { }).constructor, n = /^[\n\s]*if.*\(.*\)/.test(e.trim()) || /^(let|const)\s/.test(e.trim()) ? `(async()=>{ ${e} })()` : e, o = (() => { try { return new r(["__self", "scope"], `with (scope) { __self.result = ${n} }; __self.finished = true; return __self.result;`) } catch (s) { return ee(s, t, e), Promise.resolve() } })(); return mt[e] = o, o } function Tn(e, t, r) { let n = Cn(t, r); return (i = () => { }, { scope: o = {}, params: s = [] } = {}) => { n.result = void 0, n.finished = !1; let a = F([o, ...e]); if (typeof n == "function") { let c = n(n, a).catch(l => ee(l, r, t)); n.finished ? (Ne(i, n.result, a, s, r), n.result = void 0) : c.then(l => { Ne(i, l, a, s, r) }).catch(l => ee(l, r, t)).finally(() => n.result = void 0) } } } function Ne(e, t, r, n, i) { if (Me && typeof t == "function") { let o = t.apply(r, n); o instanceof Promise ? o.then(s => Ne(e, s, r, n)).catch(s => ee(s, i, t)) : e(o) } else typeof t == "object" && t instanceof Promise ? t.then(o => e(o)) : e(t) } var yt = "x-"; function C(e = "") { return yt + e } function fr(e) { yt = e } var _t = {}; function p(e, t) { return _t[e] = t, { before(r) { if (!_t[r]) { console.warn("Cannot find directive `${directive}`. `${name}` will use the default order of execution"); return } let n = W.indexOf(r); W.splice(n >= 0 ? n : W.indexOf("DEFAULT"), 0, e) } } } function le(e, t, r) { if (t = Array.from(t), e._x_virtualDirectives) { let o = Object.entries(e._x_virtualDirectives).map(([a, c]) => ({ name: a, value: c })), s = bt(o); o = o.map(a => s.find(c => c.name === a.name) ? { name: `x-bind:${a.name}`, value: `"${a.value}"` } : a), t = t.concat(o) } let n = {}; return t.map(pr((o, s) => n[o] = s)).filter(hr).map(Mn(n, r)).sort(Nn).map(o => Rn(e, o)) } function bt(e) { return Array.from(e).map(pr()).filter(t => !hr(t)) } var gt = !1, de = new Map, dr = Symbol(); function tr(e) { gt = !0; let t = Symbol(); dr = t, de.set(t, []); let r = () => { for (; de.get(t).length;)de.get(t).shift()(); de.delete(t) }, n = () => { gt = !1, r() }; e(r), n() } function pt(e) { let t = [], r = a => t.push(a), [n, i] = Vt(e); return t.push(i), [{ Alpine: j, effect: n, cleanup: r, evaluateLater: x.bind(x, e), evaluate: R.bind(R, e) }, () => t.forEach(a => a())] } function Rn(e, t) { let r = () => { }, n = _t[t.type] || r, [i, o] = pt(e); Oe(e, t.original, o); let s = () => { e._x_ignore || e._x_ignoreSelf || (n.inline && n.inline(e, t, i), n = n.bind(n, e, t, i), gt ? de.get(dr).push(n) : n()) }; return s.runCleanups = o, s } var De = (e, t) => ({ name: r, value: n }) => (r.startsWith(e) && (r = r.replace(e, t)), { name: r, value: n }), Ie = e => e; function pr(e = () => { }) { return ({ name: t, value: r }) => { let { name: n, value: i } = mr.reduce((o, s) => s(o), { name: t, value: r }); return n !== t && e(n, t), { name: n, value: i } } } var mr = []; function te(e) { mr.push(e) } function hr({ name: e }) { return _r().test(e) } var _r = () => new RegExp(`^${yt}([^:^.]+)\\b`); function Mn(e, t) { return ({ name: r, value: n }) => { let i = r.match(_r()), o = r.match(/:([a-zA-Z0-9\-:]+)/), s = r.match(/\.[^.\]]+(?=[^\]]*$)/g) || [], a = t || e[r] || r; return { type: i ? i[1] : null, value: o ? o[1] : null, modifiers: s.map(c => c.replace(".", "")), expression: n, original: a } } } var xt = "DEFAULT", W = ["ignore", "ref", "data", "id", "bind", "init", "for", "model", "modelable", "transition", "show", "if", xt, "teleport"]; function Nn(e, t) { let r = W.indexOf(e.type) === -1 ? xt : e.type, n = W.indexOf(t.type) === -1 ? xt : t.type; return W.indexOf(r) - W.indexOf(n) } var wt = [], Et = !1; function re(e = () => { }) { return queueMicrotask(() => { Et || setTimeout(() => { ke() }) }), new Promise(t => { wt.push(() => { e(), t() }) }) } function ke() { for (Et = !1; wt.length;)wt.shift()() } function gr() { Et = !0 } function pe(e, t) { return Array.isArray(t) ? xr(e, t.join(" ")) : typeof t == "object" && t !== null ? Pn(e, t) : typeof t == "function" ? pe(e, t()) : xr(e, t) } function xr(e, t) { let r = o => o.split(" ").filter(Boolean), n = o => o.split(" ").filter(s => !e.classList.contains(s)).filter(Boolean), i = o => (e.classList.add(...o), () => { e.classList.remove(...o) }); return t = t === !0 ? t = "" : t || "", i(n(t)) } function Pn(e, t) { let r = a => a.split(" ").filter(Boolean), n = Object.entries(t).flatMap(([a, c]) => c ? r(a) : !1).filter(Boolean), i = Object.entries(t).flatMap(([a, c]) => c ? !1 : r(a)).filter(Boolean), o = [], s = []; return i.forEach(a => { e.classList.contains(a) && (e.classList.remove(a), s.push(a)) }), n.forEach(a => { e.classList.contains(a) || (e.classList.add(a), o.push(a)) }), () => { s.forEach(a => e.classList.add(a)), o.forEach(a => e.classList.remove(a)) } } function G(e, t) { return typeof t == "object" && t !== null ? Dn(e, t) : In(e, t) } function Dn(e, t) { let r = {}; return Object.entries(t).forEach(([n, i]) => { r[n] = e.style[n], n.startsWith("--") || (n = kn(n)), e.style.setProperty(n, i) }), setTimeout(() => { e.style.length === 0 && e.removeAttribute("style") }), () => { G(e, r) } } function In(e, t) { let r = e.getAttribute("style", t); return e.setAttribute("style", t), () => { e.setAttribute("style", r || "") } } function kn(e) { return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase() } function me(e, t = () => { }) { let r = !1; return function () { r ? t.apply(this, arguments) : (r = !0, e.apply(this, arguments)) } } p("transition", (e, { value: t, modifiers: r, expression: n }, { evaluate: i }) => { typeof n == "function" && (n = i(n)), n !== !1 && (!n || typeof n == "boolean" ? $n(e, r, t) : Ln(e, n, t)) }); function Ln(e, t, r) { yr(e, pe, ""), { enter: i => { e._x_transition.enter.during = i }, "enter-start": i => { e._x_transition.enter.start = i }, "enter-end": i => { e._x_transition.enter.end = i }, leave: i => { e._x_transition.leave.during = i }, "leave-start": i => { e._x_transition.leave.start = i }, "leave-end": i => { e._x_transition.leave.end = i } }[r](t) } function $n(e, t, r) { yr(e, G); let n = !t.includes("in") && !t.includes("out") && !r, i = n || t.includes("in") || ["enter"].includes(r), o = n || t.includes("out") || ["leave"].includes(r); t.includes("in") && !n && (t = t.filter((g, b) => b < t.indexOf("out"))), t.includes("out") && !n && (t = t.filter((g, b) => b > t.indexOf("out"))); let s = !t.includes("opacity") && !t.includes("scale"), a = s || t.includes("opacity"), c = s || t.includes("scale"), l = a ? 0 : 1, u = c ? he(t, "scale", 95) / 100 : 1, d = he(t, "delay", 0) / 1e3, m = he(t, "origin", "center"), w = "opacity, transform", k = he(t, "duration", 150) / 1e3, be = he(t, "duration", 75) / 1e3, f = "cubic-bezier(0.4, 0.0, 0.2, 1)"; i && (e._x_transition.enter.during = { transformOrigin: m, transitionDelay: `${d}s`, transitionProperty: w, transitionDuration: `${k}s`, transitionTimingFunction: f }, e._x_transition.enter.start = { opacity: l, transform: `scale(${u})` }, e._x_transition.enter.end = { opacity: 1, transform: "scale(1)" }), o && (e._x_transition.leave.during = { transformOrigin: m, transitionDelay: `${d}s`, transitionProperty: w, transitionDuration: `${be}s`, transitionTimingFunction: f }, e._x_transition.leave.start = { opacity: 1, transform: "scale(1)" }, e._x_transition.leave.end = { opacity: l, transform: `scale(${u})` }) } function yr(e, t, r = {}) { e._x_transition || (e._x_transition = { enter: { during: r, start: r, end: r }, leave: { during: r, start: r, end: r }, in(n = () => { }, i = () => { }) { Le(e, t, { during: this.enter.during, start: this.enter.start, end: this.enter.end }, n, i) }, out(n = () => { }, i = () => { }) { Le(e, t, { during: this.leave.during, start: this.leave.start, end: this.leave.end }, n, i) } }) } window.Element.prototype._x_toggleAndCascadeWithTransitions = function (e, t, r, n) { let i = document.visibilityState === "visible" ? requestAnimationFrame : setTimeout, o = () => i(r); if (t) { e._x_transition && (e._x_transition.enter || e._x_transition.leave) ? e._x_transition.enter && (Object.entries(e._x_transition.enter.during).length || Object.entries(e._x_transition.enter.start).length || Object.entries(e._x_transition.enter.end).length) ? e._x_transition.in(r) : o() : e._x_transition ? e._x_transition.in(r) : o(); return } e._x_hidePromise = e._x_transition ? new Promise((s, a) => { e._x_transition.out(() => { }, () => s(n)), e._x_transitioning.beforeCancel(() => a({ isFromCancelledTransition: !0 })) }) : Promise.resolve(n), queueMicrotask(() => { let s = br(e); s ? (s._x_hideChildren || (s._x_hideChildren = []), s._x_hideChildren.push(e)) : i(() => { let a = c => { let l = Promise.all([c._x_hidePromise, ...(c._x_hideChildren || []).map(a)]).then(([u]) => u()); return delete c._x_hidePromise, delete c._x_hideChildren, l }; a(e).catch(c => { if (!c.isFromCancelledTransition) throw c }) }) }) }; function br(e) { let t = e.parentNode; if (t) return t._x_hidePromise ? t : br(t) } function Le(e, t, { during: r, start: n, end: i } = {}, o = () => { }, s = () => { }) { if (e._x_transitioning && e._x_transitioning.cancel(), Object.keys(r).length === 0 && Object.keys(n).length === 0 && Object.keys(i).length === 0) { o(), s(); return } let a, c, l; Fn(e, { start() { a = t(e, n) }, during() { c = t(e, r) }, before: o, end() { a(), l = t(e, i) }, after: s, cleanup() { c(), l() } }) } function Fn(e, t) { let r, n, i, o = me(() => { h(() => { r = !0, n || t.before(), i || (t.end(), ke()), t.after(), e.isConnected && t.cleanup(), delete e._x_transitioning }) }); e._x_transitioning = { beforeCancels: [], beforeCancel(s) { this.beforeCancels.push(s) }, cancel: me(function () { for (; this.beforeCancels.length;)this.beforeCancels.shift()(); o() }), finish: o }, h(() => { t.start(), t.during() }), gr(), requestAnimationFrame(() => { if (r) return; let s = Number(getComputedStyle(e).transitionDuration.replace(/,.*/, "").replace("s", "")) * 1e3, a = Number(getComputedStyle(e).transitionDelay.replace(/,.*/, "").replace("s", "")) * 1e3; s === 0 && (s = Number(getComputedStyle(e).animationDuration.replace("s", "")) * 1e3), h(() => { t.before() }), n = !0, requestAnimationFrame(() => { r || (h(() => { t.end() }), ke(), setTimeout(e._x_transitioning.finish, s + a), i = !0) }) }) } function he(e, t, r) { if (e.indexOf(t) === -1) return r; let n = e[e.indexOf(t) + 1]; if (!n || t === "scale" && isNaN(n)) return r; if (t === "duration" || t === "delay") { let i = n.match(/([0-9]+)ms/); if (i) return i[1] } return t === "origin" && ["top", "right", "left", "center", "bottom"].includes(e[e.indexOf(t) + 2]) ? [n, e[e.indexOf(t) + 2]].join(" ") : n } var I = !1; function B(e, t = () => { }) { return (...r) => I ? t(...r) : e(...r) } function wr(e) { return (...t) => I && e(...t) } function Er(e, t) { e._x_dataStack && (t._x_dataStack = e._x_dataStack, t.setAttribute("data-has-alpine-state", !0)), I = !0, Sr(() => { v(t, (r, n) => { n(r, () => { }) }) }), I = !1 } var vt = !1; function vr(e, t) { t._x_dataStack || (t._x_dataStack = e._x_dataStack), I = !0, vt = !0, Sr(() => { jn(t) }), I = !1, vt = !1 } function jn(e) { let t = !1; v(e, (n, i) => { O(n, (o, s) => { if (t && Yt(o)) return s(); t = !0, i(o, s) }) }) } function Sr(e) { let t = D; nt((r, n) => { let i = t(r); return L(i), () => { } }), e(), nt(t) } function Ar(e) { return I ? vt ? !0 : e.hasAttribute("data-has-alpine-state") : !1 } function _e(e, t, r, n = []) { switch (e._x_bindings || (e._x_bindings = T({})), e._x_bindings[t] = r, t = n.includes("camel") ? Wn(t) : t, t) { case "value": Bn(e, r); break; case "style": zn(e, r); break; case "class": Kn(e, r); break; case "selected": case "checked": Hn(e, t, r); break; default: Cr(e, t, r); break } } function Bn(e, t) { if (e.type === "radio") e.attributes.value === void 0 && (e.value = t), window.fromModel && (e.checked = Or(e.value, t)); else if (e.type === "checkbox") Number.isInteger(t) ? e.value = t : !Array.isArray(t) && typeof t != "boolean" && ![null, void 0].includes(t) ? e.value = String(t) : Array.isArray(t) ? e.checked = t.some(r => Or(r, e.value)) : e.checked = !!t; else if (e.tagName === "SELECT") Un(e, t); else { if (e.value === t) return; e.value = t === void 0 ? "" : t } } function Kn(e, t) { e._x_undoAddedClasses && e._x_undoAddedClasses(), e._x_undoAddedClasses = pe(e, t) } function zn(e, t) { e._x_undoAddedStyles && e._x_undoAddedStyles(), e._x_undoAddedStyles = G(e, t) } function Hn(e, t, r) { Cr(e, t, r), qn(e, t, r) } function Cr(e, t, r) { [null, void 0, !1].includes(r) && Gn(t) ? e.removeAttribute(t) : (Tr(t) && (r = t), Vn(e, t, r)) } function Vn(e, t, r) { e.getAttribute(t) != r && e.setAttribute(t, r) } function qn(e, t, r) { e[t] !== r && (e[t] = r) } function Un(e, t) { let r = [].concat(t).map(n => n + ""); Array.from(e.options).forEach(n => { n.selected = r.includes(n.value) }) } function Wn(e) { return e.toLowerCase().replace(/-(\w)/g, (t, r) => r.toUpperCase()) } function Or(e, t) { return e == t } function Tr(e) { return ["disabled", "checked", "required", "readonly", "hidden", "open", "selected", "autofocus", "itemscope", "multiple", "novalidate", "allowfullscreen", "allowpaymentrequest", "formnovalidate", "autoplay", "controls", "loop", "muted", "playsinline", "default", "ismap", "reversed", "async", "defer", "nomodule"].includes(e) } function Gn(e) { return !["aria-pressed", "aria-checked", "aria-expanded", "aria-selected"].includes(e) } function Rr(e, t, r) { return e._x_bindings && e._x_bindings[t] !== void 0 ? e._x_bindings[t] : Nr(e, t, r) } function Mr(e, t, r, n = !0) { if (e._x_bindings && e._x_bindings[t] !== void 0) return e._x_bindings[t]; if (e._x_inlineBindings && e._x_inlineBindings[t] !== void 0) { let i = e._x_inlineBindings[t]; return i.extract = n, Pe(() => R(e, i.expression)) } return Nr(e, t, r) } function Nr(e, t, r) { let n = e.getAttribute(t); return n === null ? typeof r == "function" ? r() : r : n === "" ? !0 : Tr(t) ? !![t, "true"].includes(n) : n } function $e(e, t) { var r; return function () { var n = this, i = arguments, o = function () { r = null, e.apply(n, i) }; clearTimeout(r), r = setTimeout(o, t) } } function Fe(e, t) { let r; return function () { let n = this, i = arguments; r || (e.apply(n, i), r = !0, setTimeout(() => r = !1, t)) } } function je({ get: e, set: t }, { get: r, set: n }) { let i = !0, o, s, a, c, l = D(() => { let u, d; i ? (u = e(), n(JSON.parse(JSON.stringify(u))), d = r(), i = !1) : (u = e(), d = r(), a = JSON.stringify(u), c = JSON.stringify(d), a !== o ? (d = r(), n(u), d = u) : (t(JSON.parse(c ?? null)), u = d)), o = JSON.stringify(u), s = JSON.stringify(d) }); return () => { L(l) } } function Pr(e) { (Array.isArray(e) ? e : [e]).forEach(r => r(j)) } var J = {}, Dr = !1; function Ir(e, t) { if (Dr || (J = T(J), Dr = !0), t === void 0) return J[e]; J[e] = t, typeof t == "object" && t !== null && t.hasOwnProperty("init") && typeof t.init == "function" && J[e].init(), Te(J[e]) } function kr() { return J } var Lr = {}; function $r(e, t) { let r = typeof t != "function" ? () => t : t; return e instanceof Element ? St(e, r()) : (Lr[e] = r, () => { }) } function Fr(e) { return Object.entries(Lr).forEach(([t, r]) => { Object.defineProperty(e, t, { get() { return (...n) => r(...n) } }) }), e } function St(e, t, r) { let n = []; for (; n.length;)n.pop()(); let i = Object.entries(t).map(([s, a]) => ({ name: s, value: a })), o = bt(i); return i = i.map(s => o.find(a => a.name === s.name) ? { name: `x-bind:${s.name}`, value: `"${s.value}"` } : s), le(e, i, r).map(s => { n.push(s.runCleanups), s() }), () => { for (; n.length;)n.pop()() } } var jr = {}; function Br(e, t) { jr[e] = t } function Kr(e, t) { return Object.entries(jr).forEach(([r, n]) => { Object.defineProperty(e, r, { get() { return (...i) => n.bind(t)(...i) }, enumerable: !1 }) }), e } var Jn = { get reactive() { return T }, get release() { return L }, get effect() { return D }, get raw() { return rt }, version: "3.13.0", flushAndStopDeferringMutations: sr, dontAutoEvaluateFunctions: Pe, disableEffectScheduling: zt, startObservingMutations: ce, stopObservingMutations: lt, setReactivityEngine: Ht, onAttribu