diff --git a/api/.dev.vars.example b/api/.dev.vars.example index c263ab5..5a0f198 100644 --- a/api/.dev.vars.example +++ b/api/.dev.vars.example @@ -6,8 +6,11 @@ RESEND_API_KEY=re_... # At least 32 random characters, e.g. from `openssl rand -base64 32`. AUTH_SECRET= -# The site's dev server, so it can call the local service. -ALLOWED_ORIGINS=http://127.0.0.1:5173,http://localhost:5173 +# The site's dev server, so it can call the local service. Open it at +# 127.0.0.1, not localhost: the session cookie is SameSite=Strict on the +# service's host, 127.0.0.1, and a page on localhost is another site to it, +# so the cookie would never come back and sign-in would seem to fail. +ALLOWED_ORIGINS=http://127.0.0.1:5173 # Who can approve the waitlist at /app/admin, comma-separated. ADMIN_EMAILS=you@example.com diff --git a/api/README.md b/api/README.md index 4c14500..fcb8a37 100644 --- a/api/README.md +++ b/api/README.md @@ -127,6 +127,10 @@ echo VITE_AUTH_API_URL=http://127.0.0.1:8787 > site/.env.development.local npm --prefix site run dev # http://127.0.0.1:5173/login ``` +Open the site at `127.0.0.1`, not `localhost`. The session cookie is +`SameSite=Strict` on the service's host, `127.0.0.1`, and browsers count +`localhost` as another site, so the cookie would never be sent back. + The codes are real emails, so use an address you can read. Resend only sends from a domain that's verified in the account the key belongs to. diff --git a/api/src/admin.ts b/api/src/admin.ts index d2156bd..bec63cc 100644 --- a/api/src/admin.ts +++ b/api/src/admin.ts @@ -45,10 +45,13 @@ export async function listUsers(request: Request, env: Env, now: number) { ) .bind(LIST_LIMIT) .all(); + const open = isOpen(env); const users = results.map((row) => ({ email: row.email, - // An admin never waits, even one added to ADMIN_EMAILS after joining the waitlist. - status: admins.has(row.email) ? "approved" : row.status, + // The status the account has now: an admin never waits, even one added to + // ADMIN_EMAILS after joining the waitlist, and nobody waits while sign-up + // is open. A row stored as waiting waits again if the waitlist comes back. + status: open || admins.has(row.email) ? "approved" : row.status, admin: admins.has(row.email), createdAt: row.created_at, lastSignInAt: row.last_sign_in_at, @@ -57,7 +60,7 @@ export async function listUsers(request: Request, env: Env, now: number) { })); // Sorting is stable, so each group stays newest first. users.sort((a, b) => Number(b.status === "waiting") - Number(a.status === "waiting")); - return json({ signup: isOpen(env) ? "open" : "waitlist", users }); + return json({ signup: open ? "open" : "waitlist", users }); } /** Approves a waiting account and tells its owner. `origin` is the site the admin is on. */ @@ -73,8 +76,9 @@ export async function approveUser(request: Request, env: Env, now: number, origi if (!approved) { const exists = await env.DB.prepare("SELECT 1 FROM users WHERE email = ?").bind(email).first(); if (!exists) throw new HttpError(404, MESSAGES.noSuchUser); - // Already approved, by another admin or an earlier click: nothing to send. - return json({ approved: true, emailed: false }); + // Already approved, by another admin or an earlier click: nothing to send, + // and nothing failed. + return json({ approved: true, emailed: false, alreadyApproved: true }); } // The approval stands even if the email doesn't go: the account works the // next time its owner opens the site, and the admin is told. diff --git a/api/src/auth.ts b/api/src/auth.ts index 2528e88..63e28ce 100644 --- a/api/src/auth.ts +++ b/api/src/auth.ts @@ -10,7 +10,7 @@ import type { Env } from "./env"; import { HttpError, json, readJson, readSessionCookie, sessionCookie } from "./http"; -import { countRequest } from "./limits"; +import { countRequest, uncountRequests } from "./limits"; import { sendCodeEmail } from "./mail"; import { CODE_LENGTH, @@ -52,9 +52,24 @@ export function normalizeEmail(value: unknown) { return email.length <= 254 && /^[^\s@\x00-\x1f]+@[^\s@\x00-\x1f]+\.[^\s@\x00-\x1f]+$/.test(email) ? email : null; } -// Cloudflare sets this from the connection, so callers can't choose it. +// Cloudflare sets this from the connection, so callers can't choose it. An +// IPv6 host is usually given a whole /64, so the limits per network count an +// IPv6 address by its /64: otherwise each new address would get fresh limits. function network(request: Request) { - return request.headers.get("CF-Connecting-IP") ?? "unknown"; + const ip = request.headers.get("CF-Connecting-IP") ?? "unknown"; + return ip.includes(":") ? ipv6Network(ip) : ip; +} + +/** "2001:db8:1:2::/64" for any address in that /64; the address itself if it can't be read. */ +function ipv6Network(ip: string) { + // An IPv4 address written as IPv6 (::ffff:192.0.2.1) is its own network. + if (ip.includes(".")) return ip; + const halves = ip.split("::"); + if (halves.length > 2) return ip; + const [head, tail] = halves.map((half) => (half ? half.split(":") : [])); + const groups = tail ? [...head, ...Array(8 - head.length - tail.length).fill("0"), ...tail] : head; + if (groups.length !== 8 || !groups.every((g) => /^[0-9a-f]{1,4}$/i.test(g))) return ip; + return `${groups.slice(0, 4).map((g) => parseInt(g, 16).toString(16)).join(":")}::/64`; } function cooldown(waitMs: number) { @@ -82,6 +97,17 @@ export async function sendCode(request: Request, env: Env, now: number) { if (last && now < last.sent_at + RESEND_COOLDOWN_MS) throw cooldown(last.sent_at + RESEND_COOLDOWN_MS - now); await countRequest(db, `code:address:${email}`, LIMITS.codesPerAddressHour, now, MESSAGES.tooManyForAddress); await countRequest(db, `code:address-day:${email}`, LIMITS.codesPerAddressDay, now, MESSAGES.tooManyForAddress); + // The address's limits count codes sent, so a request that ends up sending + // none (another one won the minute, or the email failed) gives its count back. + const uncount = () => + uncountRequests( + db, + [ + [`code:address:${email}`, LIMITS.codesPerAddressHour], + [`code:address-day:${email}`, LIMITS.codesPerAddressDay], + ], + now, + ); // The new code replaces the last one, unless another request sent one in // the last minute: the condition makes that check and the write one step. @@ -97,13 +123,17 @@ export async function sendCode(request: Request, env: Env, now: number) { ) .bind(email, hash, now, now + CODE_TTL_MS, now - RESEND_COOLDOWN_MS) .first(); - if (!saved) throw cooldown(RESEND_COOLDOWN_MS); + if (!saved) { + await uncount(); + throw cooldown(RESEND_COOLDOWN_MS); + } try { await sendCodeEmail(env, email, code); } catch (error) { // A code nobody received shouldn't hold the address to the minute's wait. await db.prepare("DELETE FROM sign_in_codes WHERE email = ? AND code_hash = ?").bind(email, hash).run(); + await uncount(); throw error; } return json({ sent: true }); diff --git a/api/src/http.ts b/api/src/http.ts index 99c08cf..ef4e2e0 100644 --- a/api/src/http.ts +++ b/api/src/http.ts @@ -30,14 +30,35 @@ export function json(body: unknown, status = 200, headers: Record MAX_BODY_LENGTH) throw new HttpError(413, MESSAGES.badRequest); + if (!request.body) return ""; + const reader = request.body.getReader(); + const bytes = new Uint8Array(MAX_BODY_LENGTH); + let length = 0; + for (;;) { + const { done, value } = await reader.read(); + if (done) break; + if (length + value.byteLength > MAX_BODY_LENGTH) { + await reader.cancel(); + throw new HttpError(413, MESSAGES.badRequest); + } + bytes.set(value, length); + length += value.byteLength; + } + return new TextDecoder().decode(bytes.subarray(0, length)); +} + /** The request's JSON object. Anything else is refused. */ export async function readJson(request: Request): Promise> { if (!request.headers.get("Content-Type")?.startsWith("application/json")) { throw new HttpError(415, MESSAGES.badRequest); } - if (Number(request.headers.get("Content-Length")) > MAX_BODY_LENGTH) throw new HttpError(413, MESSAGES.badRequest); - const text = await request.text(); - if (text.length > MAX_BODY_LENGTH) throw new HttpError(413, MESSAGES.badRequest); + const text = await readBody(request); try { const body: unknown = JSON.parse(text); if (body && typeof body === "object" && !Array.isArray(body)) return body as Record; diff --git a/api/src/limits.ts b/api/src/limits.ts index 24bfded..b2cc94c 100644 --- a/api/src/limits.ts +++ b/api/src/limits.ts @@ -29,3 +29,14 @@ export async function countRequest( throw new HttpError(429, message(waitText(wait)), { "Retry-After": String(Math.ceil(wait / 1000)) }); } } + +/** Takes back requests countRequest counted at `now`, one under each key, in its limit's window. */ +export async function uncountRequests(db: D1Database, keys: [string, Limit][], now: number) { + await db.batch( + keys.map(([key, { windowMs }]) => + db + .prepare("UPDATE rate_limits SET count = count - 1 WHERE key = ? AND window_start = ? AND count > 0") + .bind(key, now - (now % windowMs)), + ), + ); +} diff --git a/api/test/auth.test.mjs b/api/test/auth.test.mjs index 00cb036..f4677fd 100644 --- a/api/test/auth.test.mjs +++ b/api/test/auth.test.mjs @@ -1,9 +1,11 @@ import assert from "node:assert/strict"; import { after, before, beforeEach, describe, test } from "node:test"; -import { API, KEY, SECRET, SITE, start } from "./harness.mjs"; +import { API, KEY, SECRET, SITE, clearOfWindowEnd, start } from "./harness.mjs"; const WRONG = "That code is wrong or has expired. Check the newest code, or ask for a new one."; const MINUTE = 60_000; +const HOUR = 60 * MINUTE; +const DAY = 24 * HOUR; // A new account, as the service describes it while sign-up is on the waitlist. const ADA = { user: { email: "ada@example.com", waiting: true, admin: false } }; @@ -14,6 +16,16 @@ before(async () => { after(() => w.stop()); beforeEach(() => w.reset()); +/** How many requests are counted under `key` in the current `windowMs` window. */ +async function counted(key, windowMs) { + const now = Date.now(); + const row = await w.db + .prepare("SELECT count FROM rate_limits WHERE key = ? AND window_start = ?") + .bind(key, now - (now % windowMs)) + .first(); + return row?.count ?? 0; +} + /** The other of two six-digit codes. */ const other = (code) => String((Number(code) + 1) % 1_000_000).padStart(6, "0"); @@ -235,6 +247,7 @@ describe("asking for codes", () => { }); test("of several asks at once, one sends a code", async () => { + await clearOfWindowEnd(HOUR); const asks = await Promise.all( Array.from({ length: 5 }, () => w.call("/auth/code", { body: { email: "ada@example.com" } })), ); @@ -243,9 +256,13 @@ describe("asking for codes", () => { // The one code saved is the one emailed. const code = w.lastCode("ada@example.com"); assert.equal((await w.call("/auth/verify", { body: { email: "ada@example.com", code } })).status, 200); + // Only the code sent counts against the address. + assert.equal(await counted("code:address:ada@example.com", HOUR), 1); + assert.equal(await counted("code:address-day:ada@example.com", DAY), 1); }); test("five codes an hour per address", async () => { + await clearOfWindowEnd(HOUR); for (let i = 0; i < 5; i++) { await w.codeFor("ada@example.com"); await w.age("ada@example.com", MINUTE); @@ -259,6 +276,7 @@ describe("asking for codes", () => { }); test("twenty codes a day per address", async () => { + await clearOfWindowEnd(DAY); const day = 24 * 60 * MINUTE; const start = Date.now() - (Date.now() % day); await w.db @@ -272,6 +290,7 @@ describe("asking for codes", () => { }); test("thirty codes an hour per network", async () => { + await clearOfWindowEnd(HOUR); for (let i = 0; i < 30; i++) await w.codeFor(`user${i}@example.com`); const asked = await w.call("/auth/code", { body: { email: "ada@example.com" } }); assert.equal(asked.status, 429); @@ -281,7 +300,21 @@ describe("asking for codes", () => { await w.codeFor("ada@example.com", { ip: "198.51.100.1" }); }); + test("an IPv6 network is its /64, however its addresses are written", async () => { + await clearOfWindowEnd(HOUR); + for (let i = 0; i < 30; i++) await w.codeFor(`user${i}@example.com`, { ip: `2001:db8:1:2::${(i + 1).toString(16)}` }); + for (const ip of ["2001:db8:1:2:ffff:ffff:ffff:ffff", "2001:0db8:0001:0002::1", "2001:db8:1:2:0:0:0:abc"]) { + const asked = await w.call("/auth/code", { body: { email: "ada@example.com" }, ip }); + assert.equal(asked.status, 429, ip); + assert.match(asked.body.error, /^Too many sign-in attempts from this network./); + } + // The next /64, and IPv4, are other networks. + await w.codeFor("ada@example.com", { ip: "2001:db8:1:3::1" }); + await w.codeFor("bob@example.com", { ip: "198.51.100.1" }); + }); + test("sixty checks an hour per network", async () => { + await clearOfWindowEnd(HOUR); const code = await w.codeFor("ada@example.com"); const wrong = other(code); for (let i = 0; i < 60; i++) await w.call("/auth/verify", { body: { email: `user${i}@example.com`, code: wrong } }); @@ -302,6 +335,13 @@ describe("asking for codes", () => { assert.equal(sent.status, 502); assert.deepEqual(sent.body, { error: "We could not send the email. Please try again in a moment." }); assert.equal((await failing.db.prepare("SELECT COUNT(*) AS n FROM sign_in_codes").first()).n, 0); + // No code went out, so none counts against the address. + const now = Date.now(); + const left = await failing.db + .prepare("SELECT COALESCE(SUM(count), 0) AS n FROM rate_limits WHERE key LIKE 'code:address%' AND window_start >= ?") + .bind(now - (now % DAY)) + .first(); + assert.equal(left.n, 0); refuse = false; const code = await failing.codeFor("ada@example.com"); diff --git a/api/test/harness.mjs b/api/test/harness.mjs index b371ef5..010b8d4 100644 --- a/api/test/harness.mjs +++ b/api/test/harness.mjs @@ -16,6 +16,16 @@ export const SITE = "https://preview.floodwall.ai"; export const SECRET = "test-secret-that-is-at-least-32-characters"; export const KEY = "re_test_key"; +/** + * The service counts requests in fixed windows on the real clock (limits.ts). A test that makes + * many requests calls this first: if the current window ends within `marginMs`, it waits for the + * next one, so the test's requests all land in one window. + */ +export async function clearOfWindowEnd(windowMs, marginMs = 30_000) { + const left = windowMs - (Date.now() % windowMs); + if (left < marginMs) await new Promise((resolve) => setTimeout(resolve, left + 1_000)); +} + /** Starts the Worker. `resend(request)` can stand in for Resend's answer. */ export async function start({ bindings = {}, resend } = {}) { const outbox = []; diff --git a/api/test/waitlist.test.mjs b/api/test/waitlist.test.mjs index 5fe35e1..c2be4db 100644 --- a/api/test/waitlist.test.mjs +++ b/api/test/waitlist.test.mjs @@ -130,7 +130,8 @@ describe("while sign-up is on the waitlist", () => { w.outbox.length = 0; await w.call("/admin/approve", { body: { email: "ada@example.com" }, cookie: admin }); const again = await w.call("/admin/approve", { body: { email: "ada@example.com" }, cookie: admin }); - assert.deepEqual(again.body, { approved: true, emailed: false }); + // Not a failed email: there was nothing to send. + assert.deepEqual(again.body, { approved: true, emailed: false, alreadyApproved: true }); assert.equal(w.outbox.length, 1); }); @@ -215,7 +216,13 @@ describe("the SIGNUP_MODE flag", () => { assert.equal(await status(w, "ada@example.com"), "approved"); const admin = await w.signIn(GRACE); - assert.equal((await w.call("/admin/users", { method: "GET", cookie: admin })).body.signup, "open"); + const listed = (await w.call("/admin/users", { method: "GET", cookie: admin })).body; + assert.equal(listed.signup, "open"); + // The list shows nobody waiting, as the console lets them all in. + assert.equal(listed.users.find((u) => u.email === "old@example.com").status, "approved"); + assert.ok(listed.users.every((u) => u.status === "approved")); + // Stored as waiting still, so the waitlist would hold them again if it came back. + assert.equal(await status(w, "old@example.com"), "waiting"); } finally { await w.stop(); } diff --git a/docs/404.html b/docs/404.html index 5a2d9fa..94f1b2e 100644 --- a/docs/404.html +++ b/docs/404.html @@ -33,7 +33,7 @@ - + diff --git a/docs/assets/index-B-aGcOTH.js b/docs/assets/index-B-aGcOTH.js deleted file mode 100644 index be14cce..0000000 --- a/docs/assets/index-B-aGcOTH.js +++ /dev/null @@ -1,67 +0,0 @@ -function pM(e,t){for(var i=0;ia[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function i(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(o){if(o.ep)return;o.ep=!0;const c=i(o);fetch(o.href,c)}})();function gM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cp={exports:{}},ic={};var Yb;function yM(){if(Yb)return ic;Yb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(a,o,c){var u=null;if(c!==void 0&&(u=""+c),o.key!==void 0&&(u=""+o.key),"key"in o){c={};for(var f in o)f!=="key"&&(c[f]=o[f])}else c=o;return o=c.ref,{$$typeof:e,type:a,key:u,ref:o!==void 0?o:null,props:c}}return ic.Fragment=t,ic.jsx=i,ic.jsxs=i,ic}var qb;function vM(){return qb||(qb=1,Cp.exports=yM()),Cp.exports}var y=vM(),Tp={exports:{}},it={};var Gb;function bM(){if(Gb)return it;Gb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),S=Symbol.iterator;function x(M){return M===null||typeof M!="object"?null:(M=S&&M[S]||M["@@iterator"],typeof M=="function"?M:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,R={};function T(M,z,B){this.props=M,this.context=z,this.refs=R,this.updater=B||E}T.prototype.isReactComponent={},T.prototype.setState=function(M,z){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,z,"setState")},T.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function O(){}O.prototype=T.prototype;function N(M,z,B){this.props=M,this.context=z,this.refs=R,this.updater=B||E}var j=N.prototype=new O;j.constructor=N,w(j,T.prototype),j.isPureReactComponent=!0;var L=Array.isArray;function P(){}var D={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function F(M,z,B){var I=B.ref;return{$$typeof:e,type:M,key:z,ref:I!==void 0?I:null,props:B}}function H(M,z){return F(M.type,z,M.props)}function X(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function J(M){var z={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(B){return z[B]})}var $=/\/+/g;function ee(M,z){return typeof M=="object"&&M!==null&&M.key!=null?J(""+M.key):z.toString(36)}function re(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(P,P):(M.status="pending",M.then(function(z){M.status==="pending"&&(M.status="fulfilled",M.value=z)},function(z){M.status==="pending"&&(M.status="rejected",M.reason=z)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function V(M,z,B,I,W){var ie=typeof M;(ie==="undefined"||ie==="boolean")&&(M=null);var fe=!1;if(M===null)fe=!0;else switch(ie){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(M.$$typeof){case e:case t:fe=!0;break;case g:return fe=M._init,V(fe(M._payload),z,B,I,W)}}if(fe)return W=W(M),fe=I===""?"."+ee(M,0):I,L(W)?(B="",fe!=null&&(B=fe.replace($,"$&/")+"/"),V(W,z,B,"",function(Ae){return Ae})):W!=null&&(X(W)&&(W=H(W,B+(W.key==null||M&&M.key===W.key?"":(""+W.key).replace($,"$&/")+"/")+fe)),z.push(W)),1;fe=0;var pe=I===""?".":I+":";if(L(M))for(var ce=0;ce>>1,_=V[Y];if(0>>1;Yo(B,Z))I<_&&0>o(W,B)?(V[Y]=W,V[I]=Z,Y=I):(V[Y]=B,V[z]=Z,Y=z);else if(I<_&&0>o(W,Z))V[Y]=W,V[I]=Z,Y=I;else break e}}return K}function o(V,K){var Z=V.sortIndex-K.sortIndex;return Z!==0?Z:V.id-K.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],m=[],g=1,v=null,S=3,x=!1,E=!1,w=!1,R=!1,T=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function j(V){for(var K=i(m);K!==null;){if(K.callback===null)a(m);else if(K.startTime<=V)a(m),K.sortIndex=K.expirationTime,t(h,K);else break;K=i(m)}}function L(V){if(w=!1,j(V),!E)if(i(h)!==null)E=!0,P||(P=!0,J());else{var K=i(m);K!==null&&re(L,K.startTime-V)}}var P=!1,D=-1,A=5,F=-1;function H(){return R?!0:!(e.unstable_now()-FV&&H());){var Y=v.callback;if(typeof Y=="function"){v.callback=null,S=v.priorityLevel;var _=Y(v.expirationTime<=V);if(V=e.unstable_now(),typeof _=="function"){v.callback=_,j(V),K=!0;break t}v===i(h)&&a(h),j(V)}else a(h);v=i(h)}if(v!==null)K=!0;else{var M=i(m);M!==null&&re(L,M.startTime-V),K=!1}}break e}finally{v=null,S=Z,x=!1}K=void 0}}finally{K?J():P=!1}}}var J;if(typeof N=="function")J=function(){N(X)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,ee=$.port2;$.port1.onmessage=X,J=function(){ee.postMessage(null)}}else J=function(){T(X,0)};function re(V,K){D=T(function(){V(e.unstable_now())},K)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125Y?(V.sortIndex=Z,t(m,V),i(h)===null&&V===i(m)&&(w?(O(D),D=-1):w=!0,re(L,Z-Y))):(V.sortIndex=_,t(h,V),E||x||(E=!0,P||(P=!0,J()))),V},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(V){var K=S;return function(){var Z=S;S=K;try{return V.apply(this,arguments)}finally{S=Z}}}})(jp)),jp}var $b;function wM(){return $b||($b=1,Mp.exports=SM()),Mp.exports}var Op={exports:{}},ir={};var Wb;function EM(){if(Wb)return ir;Wb=1;var e=su();function t(h){var m="https://react.dev/errors/"+h;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Op.exports=EM(),Op.exports}var Qb;function RM(){if(Qb)return ac;Qb=1;var e=wM(),t=su(),i=qE();function a(n){var r="https://react.dev/errors/"+n;if(1_||(n.current=Y[_],Y[_]=null,_--)}function B(n,r){_++,Y[_]=n.current,n.current=r}var I=M(null),W=M(null),ie=M(null),fe=M(null);function pe(n,r){switch(B(ie,r),B(W,n),B(I,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?hb(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=hb(r),n=mb(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}z(I),B(I,n)}function ce(){z(I),z(W),z(ie)}function Ae(n){n.memoizedState!==null&&B(fe,n);var r=I.current,s=mb(r,n.type);r!==s&&(B(W,n),B(I,s))}function ke(n){W.current===n&&(z(I),z(W)),fe.current===n&&(z(fe),ec._currentValue=Z)}var we,Re;function ye(n){if(we===void 0)try{throw Error()}catch(s){var r=s.stack.trim().match(/\n( *(at )?)/);we=r&&r[1]||"",Re=-1)":-1d||q[l]!==se[d]){var me=` -`+q[l].replace(" at new "," at ");return n.displayName&&me.includes("")&&(me=me.replace("",n.displayName)),me}while(1<=l&&0<=d);break}}}finally{ze=!1,Error.prepareStackTrace=s}return(s=n?n.displayName||n.name:"")?ye(s):""}function Qe(n,r){switch(n.tag){case 26:case 27:case 5:return ye(n.type);case 16:return ye("Lazy");case 13:return n.child!==r&&r!==null?ye("Suspense Fallback"):ye("Suspense");case 19:return ye("SuspenseList");case 0:case 15:return Ye(n.type,!1);case 11:return Ye(n.type.render,!1);case 1:return Ye(n.type,!0);case 31:return ye("Activity");default:return""}}function nt(n){try{var r="",s=null;do r+=Qe(n,s),s=n,n=n.return;while(n);return r}catch(l){return` -Error generating stack: `+l.message+` -`+l.stack}}var Ne=Object.prototype.hasOwnProperty,Xe=e.unstable_scheduleCallback,Me=e.unstable_cancelCallback,et=e.unstable_shouldYield,Et=e.unstable_requestPaint,at=e.unstable_now,ue=e.unstable_getCurrentPriorityLevel,be=e.unstable_ImmediatePriority,$e=e.unstable_UserBlockingPriority,Te=e.unstable_NormalPriority,Oe=e.unstable_LowPriority,bt=e.unstable_IdlePriority,Nt=e.log,xt=e.unstable_setDisableYieldValue,Ot=null,Lt=null;function Ht(n){if(typeof Nt=="function"&&xt(n),Lt&&typeof Lt.setStrictMode=="function")try{Lt.setStrictMode(Ot,n)}catch{}}var Ft=Math.clz32?Math.clz32:Yn,mn=Math.log,Fn=Math.LN2;function Yn(n){return n>>>=0,n===0?32:31-(mn(n)/Fn|0)|0}var vn=256,Rt=262144,un=4194304;function kt(n){var r=n&42;if(r!==0)return r;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Mn(n,r,s){var l=n.pendingLanes;if(l===0)return 0;var d=0,p=n.suspendedLanes,C=n.pingedLanes;n=n.warmLanes;var k=l&134217727;return k!==0?(l=k&~p,l!==0?d=kt(l):(C&=k,C!==0?d=kt(C):s||(s=k&~n,s!==0&&(d=kt(s))))):(k=l&~p,k!==0?d=kt(k):C!==0?d=kt(C):s||(s=l&~n,s!==0&&(d=kt(s)))),d===0?0:r!==0&&r!==d&&(r&p)===0&&(p=d&-d,s=r&-r,p>=s||p===32&&(s&4194048)!==0)?r:d}function zn(n,r){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&r)===0}function ct(n,r){switch(n){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function sn(){var n=un;return un<<=1,(un&62914560)===0&&(un=4194304),n}function Jt(n){for(var r=[],s=0;31>s;s++)r.push(n);return r}function _t(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function en(n,r,s,l,d,p){var C=n.pendingLanes;n.pendingLanes=s,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=s,n.entangledLanes&=s,n.errorRecoveryDisabledLanes&=s,n.shellSuspendCounter=0;var k=n.entanglements,q=n.expirationTimes,se=n.hiddenUpdates;for(s=C&~s;0"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Ue=/[\n"\\]/g;function qe(n){return n.replace(Ue,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Je(n,r,s,l,d,p,C,k){n.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?n.type=C:n.removeAttribute("type"),r!=null?C==="number"?(r===0&&n.value===""||n.value!=r)&&(n.value=""+Yt(r)):n.value!==""+Yt(r)&&(n.value=""+Yt(r)):C!=="submit"&&C!=="reset"||n.removeAttribute("value"),r!=null?on(n,C,Yt(r)):s!=null?on(n,C,Yt(s)):l!=null&&n.removeAttribute("value"),d==null&&p!=null&&(n.defaultChecked=!!p),d!=null&&(n.checked=d&&typeof d!="function"&&typeof d!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?n.name=""+Yt(k):n.removeAttribute("name")}function At(n,r,s,l,d,p,C,k){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(n.type=p),r!=null||s!=null){if(!(p!=="submit"&&p!=="reset"||r!=null)){oe(n);return}s=s!=null?""+Yt(s):"",r=r!=null?""+Yt(r):s,k||r===n.value||(n.value=r),n.defaultValue=r}l=l??d,l=typeof l!="function"&&typeof l!="symbol"&&!!l,n.checked=k?n.checked:!!l,n.defaultChecked=!!l,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(n.name=C),oe(n)}function on(n,r,s){r==="number"&&xe(n.ownerDocument)===n||n.defaultValue===""+s||(n.defaultValue=""+s)}function Mt(n,r,s,l){if(n=n.options,r){r={};for(var d=0;d"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wr=!1;if(Lr)try{var Er={};Object.defineProperty(Er,"passive",{get:function(){wr=!0}}),window.addEventListener("test",Er,Er),window.removeEventListener("test",Er,Er)}catch{wr=!1}var hr=null,ao=null,mr=null;function so(){if(mr)return mr;var n,r=ao,s=r.length,l,d="value"in hr?hr.value:hr.textContent,p=d.length;for(n=0;n=Sl),xv=" ",Sv=!1;function wv(n,r){switch(n){case"keyup":return _5.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ev(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var oo=!1;function U5(n,r){switch(n){case"compositionend":return Ev(r);case"keypress":return r.which!==32?null:(Sv=!0,xv);case"textInput":return n=r.data,n===xv&&Sv?null:n;default:return null}}function B5(n,r){if(oo)return n==="compositionend"||!Dh&&wv(n,r)?(n=so(),mr=ao=hr=null,oo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1=r)return{node:s,offset:r-n};n=l}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Dv(s)}}function Lv(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?Lv(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function kv(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=xe(n.document);r instanceof n.HTMLIFrameElement;){try{var s=typeof r.contentWindow.location.href=="string"}catch{s=!1}if(s)n=r.contentWindow;else break;r=xe(n.document)}return r}function kh(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}var X5=Lr&&"documentMode"in document&&11>=document.documentMode,lo=null,zh=null,Cl=null,Ph=!1;function zv(n,r,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Ph||lo==null||lo!==xe(l)||(l=lo,"selectionStart"in l&&kh(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Cl&&Rl(Cl,l)||(Cl=l,l=ff(zh,"onSelect"),0>=C,d-=C,Vi=1<<32-Ft(r)+d|s<ht?(Tt=Be,Be=null):Tt=Be.sibling;var Pt=le(ne,Be,ae[ht],ve);if(Pt===null){Be===null&&(Be=Tt);break}n&&Be&&Pt.alternate===null&&r(ne,Be),Q=p(Pt,Q,ht),zt===null?Ge=Pt:zt.sibling=Pt,zt=Pt,Be=Tt}if(ht===ae.length)return s(ne,Be),jt&&aa(ne,ht),Ge;if(Be===null){for(;htht?(Tt=Be,Be=null):Tt=Be.sibling;var ns=le(ne,Be,Pt.value,ve);if(ns===null){Be===null&&(Be=Tt);break}n&&Be&&ns.alternate===null&&r(ne,Be),Q=p(ns,Q,ht),zt===null?Ge=ns:zt.sibling=ns,zt=ns,Be=Tt}if(Pt.done)return s(ne,Be),jt&&aa(ne,ht),Ge;if(Be===null){for(;!Pt.done;ht++,Pt=ae.next())Pt=Se(ne,Pt.value,ve),Pt!==null&&(Q=p(Pt,Q,ht),zt===null?Ge=Pt:zt.sibling=Pt,zt=Pt);return jt&&aa(ne,ht),Ge}for(Be=l(Be);!Pt.done;ht++,Pt=ae.next())Pt=de(Be,ne,ht,Pt.value,ve),Pt!==null&&(n&&Pt.alternate!==null&&Be.delete(Pt.key===null?ht:Pt.key),Q=p(Pt,Q,ht),zt===null?Ge=Pt:zt.sibling=Pt,zt=Pt);return n&&Be.forEach(function(mM){return r(ne,mM)}),jt&&aa(ne,ht),Ge}function Zt(ne,Q,ae,ve){if(typeof ae=="object"&&ae!==null&&ae.type===w&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case x:e:{for(var Ge=ae.key;Q!==null;){if(Q.key===Ge){if(Ge=ae.type,Ge===w){if(Q.tag===7){s(ne,Q.sibling),ve=d(Q,ae.props.children),ve.return=ne,ne=ve;break e}}else if(Q.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===A&&Os(Ge)===Q.type){s(ne,Q.sibling),ve=d(Q,ae.props),Dl(ve,ae),ve.return=ne,ne=ve;break e}s(ne,Q);break}else r(ne,Q);Q=Q.sibling}ae.type===w?(ve=Cs(ae.props.children,ne.mode,ve,ae.key),ve.return=ne,ne=ve):(ve=Au(ae.type,ae.key,ae.props,null,ne.mode,ve),Dl(ve,ae),ve.return=ne,ne=ve)}return C(ne);case E:e:{for(Ge=ae.key;Q!==null;){if(Q.key===Ge)if(Q.tag===4&&Q.stateNode.containerInfo===ae.containerInfo&&Q.stateNode.implementation===ae.implementation){s(ne,Q.sibling),ve=d(Q,ae.children||[]),ve.return=ne,ne=ve;break e}else{s(ne,Q);break}else r(ne,Q);Q=Q.sibling}ve=Fh(ae,ne.mode,ve),ve.return=ne,ne=ve}return C(ne);case A:return ae=Os(ae),Zt(ne,Q,ae,ve)}if(re(ae))return _e(ne,Q,ae,ve);if(J(ae)){if(Ge=J(ae),typeof Ge!="function")throw Error(a(150));return ae=Ge.call(ae),Ze(ne,Q,ae,ve)}if(typeof ae.then=="function")return Zt(ne,Q,ku(ae),ve);if(ae.$$typeof===N)return Zt(ne,Q,Ou(ne,ae),ve);zu(ne,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,Q!==null&&Q.tag===6?(s(ne,Q.sibling),ve=d(Q,ae),ve.return=ne,ne=ve):(s(ne,Q),ve=Hh(ae,ne.mode,ve),ve.return=ne,ne=ve),C(ne)):s(ne,Q)}return function(ne,Q,ae,ve){try{Ol=0;var Ge=Zt(ne,Q,ae,ve);return xo=null,Ge}catch(Be){if(Be===bo||Be===Nu)throw Be;var zt=Vr(29,Be,null,ne.mode);return zt.lanes=ve,zt.return=ne,zt}}}var Ns=i1(!0),a1=i1(!1),Ua=!1;function tm(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nm(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Ba(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Ia(n,r,s){var l=n.updateQueue;if(l===null)return null;if(l=l.shared,(Vt&2)!==0){var d=l.pending;return d===null?r.next=r:(r.next=d.next,d.next=r),l.pending=r,r=Tu(n),Hv(n,null,s),r}return Cu(n,l,r,s),Tu(n)}function Nl(n,r,s){if(r=r.updateQueue,r!==null&&(r=r.shared,(s&4194048)!==0)){var l=r.lanes;l&=n.pendingLanes,s|=l,r.lanes=s,qn(n,s)}}function rm(n,r){var s=n.updateQueue,l=n.alternate;if(l!==null&&(l=l.updateQueue,s===l)){var d=null,p=null;if(s=s.firstBaseUpdate,s!==null){do{var C={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};p===null?d=p=C:p=p.next=C,s=s.next}while(s!==null);p===null?d=p=r:p=p.next=r}else d=p=r;s={baseState:l.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:l.shared,callbacks:l.callbacks},n.updateQueue=s;return}n=s.lastBaseUpdate,n===null?s.firstBaseUpdate=r:n.next=r,s.lastBaseUpdate=r}var im=!1;function Ll(){if(im){var n=vo;if(n!==null)throw n}}function kl(n,r,s,l){im=!1;var d=n.updateQueue;Ua=!1;var p=d.firstBaseUpdate,C=d.lastBaseUpdate,k=d.shared.pending;if(k!==null){d.shared.pending=null;var q=k,se=q.next;q.next=null,C===null?p=se:C.next=se,C=q;var me=n.alternate;me!==null&&(me=me.updateQueue,k=me.lastBaseUpdate,k!==C&&(k===null?me.firstBaseUpdate=se:k.next=se,me.lastBaseUpdate=q))}if(p!==null){var Se=d.baseState;C=0,me=se=q=null,k=p;do{var le=k.lane&-536870913,de=le!==k.lane;if(de?(Ct&le)===le:(l&le)===le){le!==0&&le===yo&&(im=!0),me!==null&&(me=me.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var _e=n,Ze=k;le=r;var Zt=s;switch(Ze.tag){case 1:if(_e=Ze.payload,typeof _e=="function"){Se=_e.call(Zt,Se,le);break e}Se=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Ze.payload,le=typeof _e=="function"?_e.call(Zt,Se,le):_e,le==null)break e;Se=v({},Se,le);break e;case 2:Ua=!0}}le=k.callback,le!==null&&(n.flags|=64,de&&(n.flags|=8192),de=d.callbacks,de===null?d.callbacks=[le]:de.push(le))}else de={lane:le,tag:k.tag,payload:k.payload,callback:k.callback,next:null},me===null?(se=me=de,q=Se):me=me.next=de,C|=le;if(k=k.next,k===null){if(k=d.shared.pending,k===null)break;de=k,k=de.next,de.next=null,d.lastBaseUpdate=de,d.shared.pending=null}}while(!0);me===null&&(q=Se),d.baseState=q,d.firstBaseUpdate=se,d.lastBaseUpdate=me,p===null&&(d.shared.lanes=0),Ga|=C,n.lanes=C,n.memoizedState=Se}}function s1(n,r){if(typeof n!="function")throw Error(a(191,n));n.call(r)}function o1(n,r){var s=n.callbacks;if(s!==null)for(n.callbacks=null,n=0;np?p:8;var C=V.T,k={};V.T=k,Em(n,!1,r,s);try{var q=d(),se=V.S;if(se!==null&&se(k,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var me=r3(q,l);_l(n,r,me,Fr(n))}else _l(n,r,l,Fr(n))}catch(Se){_l(n,r,{then:function(){},status:"rejected",reason:Se},Fr())}finally{K.p=p,C!==null&&k.types!==null&&(C.types=k.types),V.T=C}}function c3(){}function Sm(n,r,s,l){if(n.tag!==5)throw Error(a(476));var d=U1(n).queue;V1(n,d,r,Z,s===null?c3:function(){return B1(n),s(l)})}function U1(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ca,lastRenderedState:Z},next:null};var s={};return r.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ca,lastRenderedState:s},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function B1(n){var r=U1(n);r.next===null&&(r=n.alternate.memoizedState),_l(n,r.next.queue,{},Fr())}function wm(){return Wn(ec)}function I1(){return Tn().memoizedState}function H1(){return Tn().memoizedState}function u3(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var s=Fr();n=Ba(s);var l=Ia(r,n,s);l!==null&&(Mr(l,r,s),Nl(l,r,s)),r={cache:Zh()},n.payload=r;return}r=r.return}}function f3(n,r,s){var l=Fr();s={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},qu(n)?Y1(r,s):(s=Bh(n,r,s,l),s!==null&&(Mr(s,n,l),q1(s,r,l)))}function F1(n,r,s){var l=Fr();_l(n,r,s,l)}function _l(n,r,s,l){var d={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(qu(n))Y1(r,d);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=r.lastRenderedReducer,p!==null))try{var C=r.lastRenderedState,k=p(C,s);if(d.hasEagerState=!0,d.eagerState=k,_r(k,C))return Cu(n,r,d,0),tn===null&&Ru(),!1}catch{}if(s=Bh(n,r,d,l),s!==null)return Mr(s,n,l),q1(s,r,l),!0}return!1}function Em(n,r,s,l){if(l={lane:2,revertLane:tp(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},qu(n)){if(r)throw Error(a(479))}else r=Bh(n,s,l,2),r!==null&&Mr(r,n,2)}function qu(n){var r=n.alternate;return n===lt||r!==null&&r===lt}function Y1(n,r){wo=Vu=!0;var s=n.pending;s===null?r.next=r:(r.next=s.next,s.next=r),n.pending=r}function q1(n,r,s){if((s&4194048)!==0){var l=r.lanes;l&=n.pendingLanes,s|=l,r.lanes=s,qn(n,s)}}var Vl={readContext:Wn,use:Iu,useCallback:bn,useContext:bn,useEffect:bn,useImperativeHandle:bn,useLayoutEffect:bn,useInsertionEffect:bn,useMemo:bn,useReducer:bn,useRef:bn,useState:bn,useDebugValue:bn,useDeferredValue:bn,useTransition:bn,useSyncExternalStore:bn,useId:bn,useHostTransitionStatus:bn,useFormState:bn,useActionState:bn,useOptimistic:bn,useMemoCache:bn,useCacheRefresh:bn};Vl.useEffectEvent=bn;var G1={readContext:Wn,use:Iu,useCallback:function(n,r){return gr().memoizedState=[n,r===void 0?null:r],n},useContext:Wn,useEffect:j1,useImperativeHandle:function(n,r,s){s=s!=null?s.concat([n]):null,Fu(4194308,4,L1.bind(null,r,n),s)},useLayoutEffect:function(n,r){return Fu(4194308,4,n,r)},useInsertionEffect:function(n,r){Fu(4,2,n,r)},useMemo:function(n,r){var s=gr();r=r===void 0?null:r;var l=n();if(Ls){Ht(!0);try{n()}finally{Ht(!1)}}return s.memoizedState=[l,r],l},useReducer:function(n,r,s){var l=gr();if(s!==void 0){var d=s(r);if(Ls){Ht(!0);try{s(r)}finally{Ht(!1)}}}else d=r;return l.memoizedState=l.baseState=d,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:d},l.queue=n,n=n.dispatch=f3.bind(null,lt,n),[l.memoizedState,n]},useRef:function(n){var r=gr();return n={current:n},r.memoizedState=n},useState:function(n){n=gm(n);var r=n.queue,s=F1.bind(null,lt,r);return r.dispatch=s,[n.memoizedState,s]},useDebugValue:bm,useDeferredValue:function(n,r){var s=gr();return xm(s,n,r)},useTransition:function(){var n=gm(!1);return n=V1.bind(null,lt,n.queue,!0,!1),gr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,s){var l=lt,d=gr();if(jt){if(s===void 0)throw Error(a(407));s=s()}else{if(s=r(),tn===null)throw Error(a(349));(Ct&127)!==0||h1(l,r,s)}d.memoizedState=s;var p={value:s,getSnapshot:r};return d.queue=p,j1(p1.bind(null,l,p,n),[n]),l.flags|=2048,Ro(9,{destroy:void 0},m1.bind(null,l,p,s,r),null),s},useId:function(){var n=gr(),r=tn.identifierPrefix;if(jt){var s=Ui,l=Vi;s=(l&~(1<<32-Ft(l)-1)).toString(32)+s,r="_"+r+"R_"+s,s=Uu++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof l.is=="string"?C.createElement("select",{is:l.is}):C.createElement("select"),l.multiple?p.multiple=!0:l.size&&(p.size=l.size);break;default:p=typeof l.is=="string"?C.createElement(d,{is:l.is}):C.createElement(d)}}p[Ce]=r,p[je]=l;e:for(C=r.child;C!==null;){if(C.tag===5||C.tag===6)p.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===r)break e;for(;C.sibling===null;){if(C.return===null||C.return===r)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}r.stateNode=p;e:switch(Qn(p,d,l),d){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&fa(r)}}return cn(r),_m(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,s),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==l&&fa(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(a(166));if(n=ie.current,po(r)){if(n=r.stateNode,s=r.memoizedProps,l=null,d=$n,d!==null)switch(d.tag){case 27:case 5:l=d.memoizedProps}n[Ce]=r,n=!!(n.nodeValue===s||l!==null&&l.suppressHydrationWarning===!0||fb(n.nodeValue,s)),n||_a(r,!0)}else n=df(n).createTextNode(l),n[Ce]=r,r.stateNode=n}return cn(r),null;case 31:if(s=r.memoizedState,n===null||n.memoizedState!==null){if(l=po(r),s!==null){if(n===null){if(!l)throw Error(a(318));if(n=r.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(557));n[Ce]=r}else Ts(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;cn(r),n=!1}else s=Kh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=s),n=!0;if(!n)return r.flags&256?(Br(r),r):(Br(r),null);if((r.flags&128)!==0)throw Error(a(558))}return cn(r),null;case 13:if(l=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(d=po(r),l!==null&&l.dehydrated!==null){if(n===null){if(!d)throw Error(a(318));if(d=r.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(a(317));d[Ce]=r}else Ts(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;cn(r),d=!1}else d=Kh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=d),d=!0;if(!d)return r.flags&256?(Br(r),r):(Br(r),null)}return Br(r),(r.flags&128)!==0?(r.lanes=s,r):(s=l!==null,n=n!==null&&n.memoizedState!==null,s&&(l=r.child,d=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(d=l.alternate.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==d&&(l.flags|=2048)),s!==n&&s&&(r.child.flags|=8192),Wu(r,r.updateQueue),cn(r),null);case 4:return ce(),n===null&&ap(r.stateNode.containerInfo),cn(r),null;case 10:return oa(r.type),cn(r),null;case 19:if(z(Cn),l=r.memoizedState,l===null)return cn(r),null;if(d=(r.flags&128)!==0,p=l.rendering,p===null)if(d)Bl(l,!1);else{if(xn!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(p=_u(n),p!==null){for(r.flags|=128,Bl(l,!1),n=p.updateQueue,r.updateQueue=n,Wu(r,n),r.subtreeFlags=0,n=s,s=r.child;s!==null;)Fv(s,n),s=s.sibling;return B(Cn,Cn.current&1|2),jt&&aa(r,l.treeForkCount),r.child}n=n.sibling}l.tail!==null&&at()>tf&&(r.flags|=128,d=!0,Bl(l,!1),r.lanes=4194304)}else{if(!d)if(n=_u(p),n!==null){if(r.flags|=128,d=!0,n=n.updateQueue,r.updateQueue=n,Wu(r,n),Bl(l,!0),l.tail===null&&l.tailMode==="hidden"&&!p.alternate&&!jt)return cn(r),null}else 2*at()-l.renderingStartTime>tf&&s!==536870912&&(r.flags|=128,d=!0,Bl(l,!1),r.lanes=4194304);l.isBackwards?(p.sibling=r.child,r.child=p):(n=l.last,n!==null?n.sibling=p:r.child=p,l.last=p)}return l.tail!==null?(n=l.tail,l.rendering=n,l.tail=n.sibling,l.renderingStartTime=at(),n.sibling=null,s=Cn.current,B(Cn,d?s&1|2:s&1),jt&&aa(r,l.treeForkCount),n):(cn(r),null);case 22:case 23:return Br(r),sm(),l=r.memoizedState!==null,n!==null?n.memoizedState!==null!==l&&(r.flags|=8192):l&&(r.flags|=8192),l?(s&536870912)!==0&&(r.flags&128)===0&&(cn(r),r.subtreeFlags&6&&(r.flags|=8192)):cn(r),s=r.updateQueue,s!==null&&Wu(r,s.retryQueue),s=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),l=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),l!==s&&(r.flags|=2048),n!==null&&z(js),null;case 24:return s=null,n!==null&&(s=n.memoizedState.cache),r.memoizedState.cache!==s&&(r.flags|=2048),oa(On),cn(r),null;case 25:return null;case 30:return null}throw Error(a(156,r.tag))}function g3(n,r){switch(qh(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return oa(On),ce(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return ke(r),null;case 31:if(r.memoizedState!==null){if(Br(r),r.alternate===null)throw Error(a(340));Ts()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(Br(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(a(340));Ts()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return z(Cn),null;case 4:return ce(),null;case 10:return oa(r.type),null;case 22:case 23:return Br(r),sm(),n!==null&&z(js),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return oa(On),null;case 25:return null;default:return null}}function g2(n,r){switch(qh(r),r.tag){case 3:oa(On),ce();break;case 26:case 27:case 5:ke(r);break;case 4:ce();break;case 31:r.memoizedState!==null&&Br(r);break;case 13:Br(r);break;case 19:z(Cn);break;case 10:oa(r.type);break;case 22:case 23:Br(r),sm(),n!==null&&z(js);break;case 24:oa(On)}}function Il(n,r){try{var s=r.updateQueue,l=s!==null?s.lastEffect:null;if(l!==null){var d=l.next;s=d;do{if((s.tag&n)===n){l=void 0;var p=s.create,C=s.inst;l=p(),C.destroy=l}s=s.next}while(s!==d)}}catch(k){Gt(r,r.return,k)}}function Ya(n,r,s){try{var l=r.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var p=d.next;l=p;do{if((l.tag&n)===n){var C=l.inst,k=C.destroy;if(k!==void 0){C.destroy=void 0,d=r;var q=s,se=k;try{se()}catch(me){Gt(d,q,me)}}}l=l.next}while(l!==p)}}catch(me){Gt(r,r.return,me)}}function y2(n){var r=n.updateQueue;if(r!==null){var s=n.stateNode;try{o1(r,s)}catch(l){Gt(n,n.return,l)}}}function v2(n,r,s){s.props=ks(n.type,n.memoizedProps),s.state=n.memoizedState;try{s.componentWillUnmount()}catch(l){Gt(n,r,l)}}function Hl(n,r){try{var s=n.ref;if(s!==null){switch(n.tag){case 26:case 27:case 5:var l=n.stateNode;break;case 30:l=n.stateNode;break;default:l=n.stateNode}typeof s=="function"?n.refCleanup=s(l):s.current=l}}catch(d){Gt(n,r,d)}}function Bi(n,r){var s=n.ref,l=n.refCleanup;if(s!==null)if(typeof l=="function")try{l()}catch(d){Gt(n,r,d)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(d){Gt(n,r,d)}else s.current=null}function b2(n){var r=n.type,s=n.memoizedProps,l=n.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":s.autoFocus&&l.focus();break e;case"img":s.src?l.src=s.src:s.srcSet&&(l.srcset=s.srcSet)}}catch(d){Gt(n,n.return,d)}}function Vm(n,r,s){try{var l=n.stateNode;V3(l,n.type,s,r),l[je]=r}catch(d){Gt(n,n.return,d)}}function x2(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Za(n.type)||n.tag===4}function Um(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||x2(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Za(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Bm(n,r,s){var l=n.tag;if(l===5||l===6)n=n.stateNode,r?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(n,r):(r=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,r.appendChild(n),s=s._reactRootContainer,s!=null||r.onclick!==null||(r.onclick=Dr));else if(l!==4&&(l===27&&Za(n.type)&&(s=n.stateNode,r=null),n=n.child,n!==null))for(Bm(n,r,s),n=n.sibling;n!==null;)Bm(n,r,s),n=n.sibling}function Zu(n,r,s){var l=n.tag;if(l===5||l===6)n=n.stateNode,r?s.insertBefore(n,r):s.appendChild(n);else if(l!==4&&(l===27&&Za(n.type)&&(s=n.stateNode),n=n.child,n!==null))for(Zu(n,r,s),n=n.sibling;n!==null;)Zu(n,r,s),n=n.sibling}function S2(n){var r=n.stateNode,s=n.memoizedProps;try{for(var l=n.type,d=r.attributes;d.length;)r.removeAttributeNode(d[0]);Qn(r,l,s),r[Ce]=n,r[je]=s}catch(p){Gt(n,n.return,p)}}var da=!1,Ln=!1,Im=!1,w2=typeof WeakSet=="function"?WeakSet:Set,Kn=null;function y3(n,r){if(n=n.containerInfo,lp=bf,n=kv(n),kh(n)){if("selectionStart"in n)var s={start:n.selectionStart,end:n.selectionEnd};else e:{s=(s=n.ownerDocument)&&s.defaultView||window;var l=s.getSelection&&s.getSelection();if(l&&l.rangeCount!==0){s=l.anchorNode;var d=l.anchorOffset,p=l.focusNode;l=l.focusOffset;try{s.nodeType,p.nodeType}catch{s=null;break e}var C=0,k=-1,q=-1,se=0,me=0,Se=n,le=null;t:for(;;){for(var de;Se!==s||d!==0&&Se.nodeType!==3||(k=C+d),Se!==p||l!==0&&Se.nodeType!==3||(q=C+l),Se.nodeType===3&&(C+=Se.nodeValue.length),(de=Se.firstChild)!==null;)le=Se,Se=de;for(;;){if(Se===n)break t;if(le===s&&++se===d&&(k=C),le===p&&++me===l&&(q=C),(de=Se.nextSibling)!==null)break;Se=le,le=Se.parentNode}Se=de}s=k===-1||q===-1?null:{start:k,end:q}}else s=null}s=s||{start:0,end:0}}else s=null;for(cp={focusedElem:n,selectionRange:s},bf=!1,Kn=r;Kn!==null;)if(r=Kn,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,Kn=n;else for(;Kn!==null;){switch(r=Kn,p=r.alternate,n=r.flags,r.tag){case 0:if((n&4)!==0&&(n=r.updateQueue,n=n!==null?n.events:null,n!==null))for(s=0;s title"))),Qn(p,l,s),p[Ce]=n,st(p),l=p;break e;case"link":var C=Mb("link","href",d).get(l+(s.href||""));if(C){for(var k=0;kZt&&(C=Zt,Zt=Ze,Ze=C);var ne=Nv(k,Ze),Q=Nv(k,Zt);if(ne&&Q&&(de.rangeCount!==1||de.anchorNode!==ne.node||de.anchorOffset!==ne.offset||de.focusNode!==Q.node||de.focusOffset!==Q.offset)){var ae=Se.createRange();ae.setStart(ne.node,ne.offset),de.removeAllRanges(),Ze>Zt?(de.addRange(ae),de.extend(Q.node,Q.offset)):(ae.setEnd(Q.node,Q.offset),de.addRange(ae))}}}}for(Se=[],de=k;de=de.parentNode;)de.nodeType===1&&Se.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;ks?32:s,V.T=null,s=Xm,Xm=null;var p=Xa,C=ya;if(Bn=0,jo=Xa=null,ya=0,(Vt&6)!==0)throw Error(a(331));var k=Vt;if(Vt|=4,L2(p.current),O2(p,p.current,C,s),Vt=k,Xl(0,!1),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(Ot,p)}catch{}return!0}finally{K.p=d,V.T=l,Z2(n,r)}}function J2(n,r,s){r=ni(s,r),r=Am(n.stateNode,r,2),n=Ia(n,r,2),n!==null&&(_t(n,2),Ii(n))}function Gt(n,r,s){if(n.tag===3)J2(n,n,s);else for(;r!==null;){if(r.tag===3){J2(r,n,s);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ka===null||!Ka.has(l))){n=ni(s,n),s=e2(2),l=Ia(r,s,2),l!==null&&(t2(s,l,r,n),_t(l,2),Ii(l));break}}r=r.return}}function Qm(n,r,s){var l=n.pingCache;if(l===null){l=n.pingCache=new x3;var d=new Set;l.set(r,d)}else d=l.get(r),d===void 0&&(d=new Set,l.set(r,d));d.has(s)||(Ym=!0,d.add(s),n=C3.bind(null,n,r,s),r.then(n,n))}function C3(n,r,s){var l=n.pingCache;l!==null&&l.delete(r),n.pingedLanes|=n.suspendedLanes&s,n.warmLanes&=~s,tn===n&&(Ct&s)===s&&(xn===4||xn===3&&(Ct&62914560)===Ct&&300>at()-ef?(Vt&2)===0&&Oo(n,0):qm|=s,Mo===Ct&&(Mo=0)),Ii(n)}function eb(n,r){r===0&&(r=sn()),n=Rs(n,r),n!==null&&(_t(n,r),Ii(n))}function T3(n){var r=n.memoizedState,s=0;r!==null&&(s=r.retryLane),eb(n,s)}function A3(n,r){var s=0;switch(n.tag){case 31:case 13:var l=n.stateNode,d=n.memoizedState;d!==null&&(s=d.retryLane);break;case 19:l=n.stateNode;break;case 22:l=n.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(r),eb(n,s)}function M3(n,r){return Xe(n,r)}var lf=null,No=null,Jm=!1,cf=!1,ep=!1,Wa=0;function Ii(n){n!==No&&n.next===null&&(No===null?lf=No=n:No=No.next=n),cf=!0,Jm||(Jm=!0,O3())}function Xl(n,r){if(!ep&&cf){ep=!0;do for(var s=!1,l=lf;l!==null;){if(n!==0){var d=l.pendingLanes;if(d===0)var p=0;else{var C=l.suspendedLanes,k=l.pingedLanes;p=(1<<31-Ft(42|n)+1)-1,p&=d&~(C&~k),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(s=!0,ib(l,p))}else p=Ct,p=Mn(l,l===tn?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(p&3)===0||zn(l,p)||(s=!0,ib(l,p));l=l.next}while(s);ep=!1}}function j3(){tb()}function tb(){cf=Jm=!1;var n=0;Wa!==0&&B3()&&(n=Wa);for(var r=at(),s=null,l=lf;l!==null;){var d=l.next,p=nb(l,r);p===0?(l.next=null,s===null?lf=d:s.next=d,d===null&&(No=s)):(s=l,(n!==0||(p&3)!==0)&&(cf=!0)),l=d}Bn!==0&&Bn!==5||Xl(n),Wa!==0&&(Wa=0)}function nb(n,r){for(var s=n.suspendedLanes,l=n.pingedLanes,d=n.expirationTimes,p=n.pendingLanes&-62914561;0k)break;var me=q.transferSize,Se=q.initiatorType;me&&db(Se)&&(q=q.responseEnd,C+=me*(q"u"?null:document;function Rb(n,r,s){var l=Lo;if(l&&typeof r=="string"&&r){var d=qe(r);d='link[rel="'+n+'"][href="'+d+'"]',typeof s=="string"&&(d+='[crossorigin="'+s+'"]'),Eb.has(d)||(Eb.add(d),n={rel:n,crossOrigin:s,href:r},l.querySelector(d)===null&&(r=l.createElement("link"),Qn(r,"link",n),st(r),l.head.appendChild(r)))}}function $3(n){va.D(n),Rb("dns-prefetch",n,null)}function W3(n,r){va.C(n,r),Rb("preconnect",n,r)}function Z3(n,r,s){va.L(n,r,s);var l=Lo;if(l&&n&&r){var d='link[rel="preload"][as="'+qe(r)+'"]';r==="image"&&s&&s.imageSrcSet?(d+='[imagesrcset="'+qe(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(d+='[imagesizes="'+qe(s.imageSizes)+'"]')):d+='[href="'+qe(n)+'"]';var p=d;switch(r){case"style":p=ko(n);break;case"script":p=zo(n)}li.has(p)||(n=v({rel:"preload",href:r==="image"&&s&&s.imageSrcSet?void 0:n,as:r},s),li.set(p,n),l.querySelector(d)!==null||r==="style"&&l.querySelector(Ql(p))||r==="script"&&l.querySelector(Jl(p))||(r=l.createElement("link"),Qn(r,"link",n),st(r),l.head.appendChild(r)))}}function Q3(n,r){va.m(n,r);var s=Lo;if(s&&n){var l=r&&typeof r.as=="string"?r.as:"script",d='link[rel="modulepreload"][as="'+qe(l)+'"][href="'+qe(n)+'"]',p=d;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=zo(n)}if(!li.has(p)&&(n=v({rel:"modulepreload",href:n},r),li.set(p,n),s.querySelector(d)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Jl(p)))return}l=s.createElement("link"),Qn(l,"link",n),st(l),s.head.appendChild(l)}}}function J3(n,r,s){va.S(n,r,s);var l=Lo;if(l&&n){var d=It(l).hoistableStyles,p=ko(n);r=r||"default";var C=d.get(p);if(!C){var k={loading:0,preload:null};if(C=l.querySelector(Ql(p)))k.loading=5;else{n=v({rel:"stylesheet",href:n,"data-precedence":r},s),(s=li.get(p))&&gp(n,s);var q=C=l.createElement("link");st(q),Qn(q,"link",n),q._p=new Promise(function(se,me){q.onload=se,q.onerror=me}),q.addEventListener("load",function(){k.loading|=1}),q.addEventListener("error",function(){k.loading|=2}),k.loading|=4,mf(C,r,l)}C={type:"stylesheet",instance:C,count:1,state:k},d.set(p,C)}}}function eM(n,r){va.X(n,r);var s=Lo;if(s&&n){var l=It(s).hoistableScripts,d=zo(n),p=l.get(d);p||(p=s.querySelector(Jl(d)),p||(n=v({src:n,async:!0},r),(r=li.get(d))&&yp(n,r),p=s.createElement("script"),st(p),Qn(p,"link",n),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(d,p))}}function tM(n,r){va.M(n,r);var s=Lo;if(s&&n){var l=It(s).hoistableScripts,d=zo(n),p=l.get(d);p||(p=s.querySelector(Jl(d)),p||(n=v({src:n,async:!0,type:"module"},r),(r=li.get(d))&&yp(n,r),p=s.createElement("script"),st(p),Qn(p,"link",n),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(d,p))}}function Cb(n,r,s,l){var d=(d=ie.current)?hf(d):null;if(!d)throw Error(a(446));switch(n){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(r=ko(s.href),s=It(d).hoistableStyles,l=s.get(r),l||(l={type:"style",instance:null,count:0,state:null},s.set(r,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){n=ko(s.href);var p=It(d).hoistableStyles,C=p.get(n);if(C||(d=d.ownerDocument||d,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,C),(p=d.querySelector(Ql(n)))&&!p._p&&(C.instance=p,C.state.loading=5),li.has(n)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},li.set(n,s),p||nM(d,n,s,C.state))),r&&l===null)throw Error(a(528,""));return C}if(r&&l!==null)throw Error(a(529,""));return null;case"script":return r=s.async,s=s.src,typeof s=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=zo(s),s=It(d).hoistableScripts,l=s.get(r),l||(l={type:"script",instance:null,count:0,state:null},s.set(r,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,n))}}function ko(n){return'href="'+qe(n)+'"'}function Ql(n){return'link[rel="stylesheet"]['+n+"]"}function Tb(n){return v({},n,{"data-precedence":n.precedence,precedence:null})}function nM(n,r,s,l){n.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=n.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),Qn(r,"link",s),st(r),n.head.appendChild(r))}function zo(n){return'[src="'+qe(n)+'"]'}function Jl(n){return"script[async]"+n}function Ab(n,r,s){if(r.count++,r.instance===null)switch(r.type){case"style":var l=n.querySelector('style[data-href~="'+qe(s.href)+'"]');if(l)return r.instance=l,st(l),l;var d=v({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return l=(n.ownerDocument||n).createElement("style"),st(l),Qn(l,"style",d),mf(l,s.precedence,n),r.instance=l;case"stylesheet":d=ko(s.href);var p=n.querySelector(Ql(d));if(p)return r.state.loading|=4,r.instance=p,st(p),p;l=Tb(s),(d=li.get(d))&&gp(l,d),p=(n.ownerDocument||n).createElement("link"),st(p);var C=p;return C._p=new Promise(function(k,q){C.onload=k,C.onerror=q}),Qn(p,"link",l),r.state.loading|=4,mf(p,s.precedence,n),r.instance=p;case"script":return p=zo(s.src),(d=n.querySelector(Jl(p)))?(r.instance=d,st(d),d):(l=s,(d=li.get(p))&&(l=v({},s),yp(l,d)),n=n.ownerDocument||n,d=n.createElement("script"),st(d),Qn(d,"link",l),n.head.appendChild(d),r.instance=d);case"void":return null;default:throw Error(a(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(l=r.instance,r.state.loading|=4,mf(l,s.precedence,n));return r.instance}function mf(n,r,s){for(var l=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=l.length?l[l.length-1]:null,p=d,C=0;C title"):null)}function rM(n,r,s){if(s===1||r.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(n=r.disabled,typeof r.precedence=="string"&&n==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Ob(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function iM(n,r,s,l){if(s.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var d=ko(l.href),p=r.querySelector(Ql(d));if(p){r=p._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=gf.bind(n),r.then(n,n)),s.state.loading|=4,s.instance=p,st(p);return}p=r.ownerDocument||r,l=Tb(l),(d=li.get(d))&&gp(l,d),p=p.createElement("link"),st(p);var C=p;C._p=new Promise(function(k,q){C.onload=k,C.onerror=q}),Qn(p,"link",l),s.instance=p}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(s,r),(r=s.state.preload)&&(s.state.loading&3)===0&&(n.count++,s=gf.bind(n),r.addEventListener("load",s),r.addEventListener("error",s))}}var vp=0;function aM(n,r){return n.stylesheets&&n.count===0&&vf(n,n.stylesheets),0vp?50:800)+r);return n.unsuspend=s,function(){n.unsuspend=null,clearTimeout(l),clearTimeout(d)}}:null}function gf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vf(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var yf=null;function vf(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,yf=new Map,r.forEach(sM,n),yf=null,gf.call(n))}function sM(n,r){if(!(r.state.loading&4)){var s=yf.get(n);if(s)var l=s.get(null);else{s=new Map,yf.set(n,s);for(var d=n.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ap.exports=RM(),Ap.exports}var ex=CM();const z0=b.createContext({});function ou(e){const t=b.useRef(null);return t.current===null&&(t.current=e()),t.current}const TM=typeof window<"u",Pc=TM?b.useLayoutEffect:b.useEffect,Kd=b.createContext(null);function P0(e,t){e.indexOf(t)===-1&&e.push(t)}function gd(e,t){const i=e.indexOf(t);i>-1&&e.splice(i,1)}const Aa=(e,t,i)=>i>t?t:i/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),GE=e=>typeof e=="object"&&e!==null,V0=e=>/^0[^.\s]+$/u.test(e);function AM(e){let t;return()=>(t===void 0&&(t=e()),t)}const Di=e=>e,nl=(...e)=>e.reduce((t,i)=>a=>i(t(a))),Zs=(e,t,i)=>{const a=t-e;return a?(i-e)/a:1};class yd{constructor(){this.subscriptions=[]}add(t){return P0(this.subscriptions,t),()=>this.remove(t)}remove(t){gd(this.subscriptions,t)}notify(t,i,a){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,i,a);else for(let c=0;ce*1e3,Kr=e=>e/1e3,KE=(e,t)=>t?e*(1e3/t):0,Dp=(e,t,i)=>e*(3*(1-e)*((1-e)*t+e*i)+e*e);function lu(e,t,i,a){return e===t&&i===a?Di:o=>{let c=0,u=1,f=o;for(let h=0;;h++){f>=c&&f<=u||(f=(c+u)/2);const m=Dp(f,e,i)-o;if(m*m<1e-28||h===40)break;m>0?u=f:c=f,f-=m*1e-7/(Dp(f+1e-7,e,i)-o-m)}return Dp(f,t,a)}}const XE=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$E=e=>t=>1-e(1-t),WE=lu(.33,1.53,.69,.99),U0=$E(WE),ZE=XE(U0),QE=e=>e>=1?1:(e*=2)<1?.5*U0(e):.5*(2-Math.pow(2,-10*(e-1))),B0=e=>1-Math.sin(Math.acos(e)),JE=$E(B0),eR=XE(B0),MM=lu(.42,0,1,1),jM=lu(0,0,.58,1),I0=lu(.42,0,.58,1),tR=e=>Array.isArray(e)&&typeof e[0]!="number",H0=e=>Array.isArray(e)&&typeof e[0]=="number",OM={linear:Di,easeIn:MM,easeInOut:I0,easeOut:jM,circIn:B0,circInOut:eR,circOut:JE,backIn:U0,backInOut:ZE,backOut:WE,anticipate:QE},DM=e=>typeof e=="string",Dg=e=>{if(H0(e)){const[t,i,a,o]=e;return lu(t,i,a,o)}else if(DM(e))return OM[e];return e},An={delta:0,timestamp:0,isProcessing:!1};let Wf;function NM(){Wf=void 0}const Ut={now:()=>(Wf===void 0&&Ut.set(An.isProcessing||ki.useManualTiming?An.timestamp:performance.now()),Wf),set:e=>{Wf=e,queueMicrotask(NM)}},Xo=e=>Math.round(e*1e5)/1e5,nR=e=>t=>typeof t=="string"&&t.startsWith(e),rR=nR("--"),LM=nR("var(--"),Xd=e=>LM(e)?kM.test(e.split("/*")[0].trim()):!1,kM=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Np(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const gl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},_c={...gl,transform:e=>Aa(0,1,e)},Tf={...gl,default:1},F0=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function zM(e){return e==null}const PM=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Y0=(e,t)=>i=>!!(typeof i=="string"&&PM.test(i)&&i.startsWith(e)||t&&!zM(i)&&Object.prototype.hasOwnProperty.call(i,t)),iR=(e,t,i)=>a=>{if(typeof a!="string")return a;const[o,c,u,f]=a.match(F0);return{[e]:parseFloat(o),[t]:parseFloat(c),[i]:parseFloat(u),alpha:f!==void 0?parseFloat(f):1}},_M=e=>Aa(0,255,e),Lp={...gl,transform:e=>Math.round(_M(e))},Ys={test:Y0("rgb","red"),parse:iR("red","green","blue"),transform:({red:e,green:t,blue:i,alpha:a=1})=>"rgba("+Lp.transform(e)+", "+Lp.transform(t)+", "+Lp.transform(i)+", "+Xo(_c.transform(a))+")"},Af=(e,t,i)=>{const a=e.substring(1+t*i,1+(t+1)*i);return i>1?a:a+a};function VM(e){const t=e.length>5?2:1,i=Af(e,3,t);return{red:parseInt(Af(e,0,t),16),green:parseInt(Af(e,1,t),16),blue:parseInt(Af(e,2,t),16),alpha:i?parseInt(i,16)/255:1}}const Ng={test:Y0("#"),parse:VM,transform:Ys.transform},cu=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ba=cu("deg"),Xi=cu("%"),Ve=cu("px"),UM=cu("vh"),BM=cu("vw"),tx={...Xi,parse:e=>Xi.parse(e)/100,transform:e=>Xi.transform(e*100)},Ho={test:Y0("hsl","hue"),parse:iR("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:i,alpha:a=1})=>"hsla("+Math.round(e)+", "+Xi.transform(Xo(t))+", "+Xi.transform(Xo(i))+", "+Xo(_c.transform(a))+")"},Hn={test:e=>Ys.test(e)||Ng.test(e)||Ho.test(e),parse:e=>Ys.test(e)?Ys.parse(e):Ho.test(e)?Ho.parse(e):Ng.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ys.transform(e):Ho.transform(e),getAnimatableNone:e=>{const t=Hn.parse(e);return t.alpha=0,Hn.transform(t)}},IM=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,aR=new RegExp(F0.source),sR=new RegExp(IM.source,"i");function HM(e){return isNaN(e)&&typeof e=="string"&&(aR.test(e)||sR.test(e))}const oR="number",lR="color",FM="var",YM="var(",nx="${}",qM=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)(?![a-z]*\()/giu;function GM(e){const t=e.toString();return aR.test(t)||sR.test(t)}function Vc(e){const t=e.toString(),i=[],a={color:[],number:[],var:[]},o=[];let c=0;const f=t.replace(qM,h=>(Hn.test(h)?(a.color.push(c),o.push(lR),i.push(Hn.parse(h))):h.startsWith(YM)?(a.var.push(c),o.push(FM),i.push(h)):(a.number.push(c),o.push(oR),i.push(parseFloat(h))),++c,nx)).split(nx);return{values:i,split:f,indexes:a,types:o}}function KM(e){return Vc(e).values}function q0({split:e,types:t}){const i=e.length;return a=>{let o="";for(let c=0;ctypeof e=="number"?0:Hn.test(e)?Hn.getAnimatableNone(e):e,WM=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:$M(e);function ZM(e){const t=Vc(e);return q0(t)(t.values.map((a,o)=>WM(a,t.split[o])))}const di={test:HM,parse:KM,createTransformer:XM,getAnimatableNone:ZM};function kp(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+(t-e)*6*i:i<1/2?t:i<2/3?e+(t-e)*(2/3-i)*6:e}function QM({hue:e,saturation:t,lightness:i,alpha:a}){e/=360,t/=100,i/=100;let o=0,c=0,u=0;if(!t)o=c=u=i;else{const f=i<.5?i*(1+t):i+t-i*t,h=2*i-f;o=kp(h,f,e+1/3),c=kp(h,f,e),u=kp(h,f,e-1/3)}return{red:Math.round(o*255),green:Math.round(c*255),blue:Math.round(u*255),alpha:a}}function vd(e,t){return i=>i>0?t:e}const rn=(e,t,i)=>e+(t-e)*i,zp=(e,t,i)=>{const a=e*e,o=i*(t*t-a)+a;return o<0?0:Math.sqrt(o)},JM=[Ng,Ys,Ho],e4=e=>JM.find(t=>t.test(e));function rx(e){const t=e4(e);if(!t)return!1;let i=t.parse(e);return t===Ho&&(i=QM(i)),i}const ix=(e,t)=>{const i=rx(e),a=rx(t);if(!i||!a)return vd(e,t);const o={...i};return c=>(o.red=zp(i.red,a.red,c),o.green=zp(i.green,a.green,c),o.blue=zp(i.blue,a.blue,c),o.alpha=rn(i.alpha,a.alpha,c),Ys.transform(o))},Lg=new Set(["none","hidden"]);function t4(e,t){return Lg.has(e)?i=>i<=0?e:t:i=>i>=1?t:e}function n4(e,t){return i=>rn(e,t,i)}function G0(e){return typeof e=="number"?n4:typeof e=="string"?Xd(e)?vd:Hn.test(e)?ix:a4:Array.isArray(e)?cR:typeof e=="object"?Hn.test(e)?ix:r4:vd}function cR(e,t){const i=[...e],a=i.length,o=e.map((c,u)=>G0(c)(c,t[u]));return c=>{for(let u=0;u{for(const c in a)i[c]=a[c](o);return i}}function i4(e,t){const i=[],a={color:0,var:0,number:0};for(let o=0;o{const i=Vc(e),a=Vc(t);return i.indexes.var.length===a.indexes.var.length&&i.indexes.color.length===a.indexes.color.length&&i.indexes.number.length>=a.indexes.number.length?Lg.has(e)&&!a.values.length||Lg.has(t)&&!i.values.length?t4(e,t):nl(cR(i4(i,a),a.values),q0(a)):vd(e,t)},ax=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function s4(e,t){const i=ax.exec(e);if(!i)return;const a=ax.exec(t);if(!a||i[2]!==a[2])return;const o=i[2],c=parseFloat(i[1]),u=parseFloat(a[1]);return f=>Xo(rn(c,u,f))+o}function K0(e,t,i){if(typeof e=="number"&&typeof t=="number"&&typeof i=="number")return rn(e,t,i);if(typeof e=="string"&&typeof t=="string"){const o=s4(e,t);if(o)return o}return G0(e)(e,t)}const Mf=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function o4(e){let t=new Set,i=new Set,a=!1,o=!1,c;const u=new Set;let f={delta:0,timestamp:0,isProcessing:!1};function h(g){u.has(g)&&(i.add(g),e()),(c=g)(f)}const m={schedule:(g,v=!1,S=!1)=>{const x=S&&a,E=x?t:i;return v&&u.add(g),x&&g!==c&&E.delete(g),E.add(g),g},cancel:g=>{i.delete(g),u.delete(g)},process:g=>{if(f=g,a){o=!0;return}a=!0;const v=t;t=i,i=v,t.forEach(h),t.clear(),c=void 0,a=!1,o&&(o=!1,m.process(g))}};return m}const l4=40;function uR(e,t,i={delta:0,timestamp:0,isProcessing:!1}){let a=!1,o=!0;const c=()=>a=!0,u=Mf.reduce((N,j)=>(N[j]=o4(c),N),{}),{setup:f,read:h,resolveKeyframes:m,preUpdate:g,update:v,preRender:S,render:x,postRender:E}=u,w=()=>{const N=ki.useManualTiming,j=N?i.timestamp:performance.now();a=!1,N||(i.delta=o?1e3/60:Math.max(Math.min(j-i.timestamp,l4),1)),i.timestamp=j,i.isProcessing=!0,f.process(i),h.process(i),m.process(i),g.process(i),v.process(i),S.process(i),x.process(i),E.process(i),i.isProcessing=!1,a&&t&&(o=!1,e(w))},R=()=>{a=!0,o=!0,i.isProcessing||e(w)};return{schedule:Mf.reduce((N,j)=>{const L=u[j];return N[j]=(P,D=!1,A=!1)=>(a||R(),L.schedule(P,D,A)),N},{}),cancel:N=>{for(let j=0;j{const t=({timestamp:i})=>e(i);return{start:(i=!0)=>Kt.update(t,i),stop:()=>Gr(t),now:()=>An.isProcessing?An.timestamp:Ut.now()}},fR=(e,t,i=10)=>{let a="";const o=Math.max(Math.round(t/i),2);for(let c=0;c=i?1/0:o}function c4(e,t=100,i){const{keyframes:a,velocity:o}=e,c=a&&a[a.length-1]-a[0],u=i({...e,velocity:o&&c?o*t/c:o,keyframes:[0,t]}),f=Math.min(W0(u),$0);return{type:"keyframes",ease:h=>u.next(f*h).value/t,duration:Kr(f)}}const sx=100,ox=10,u4=1,f4=800,dR=.3,d4=.3,h4=.01,m4=2,p4=.005,g4=.5,y4=.01,v4=10,lx=.05,hR=e=>e<0?1/Math.max(1+e,lx):Math.max(1-e,lx);function mR(e,t){if(!(e>1))return 1;const i=Math.sqrt(e*e-1),a=e-i,o=e+i,c=2*i*Math.exp(-t)*(1+t);return pR(u=>o*Math.exp(-a*u)-a*Math.exp(-o*u)-c,u=>Math.exp(-o*u)-Math.exp(-a*u),t)/t}function kg(e,t){return e*Math.sqrt(1-t*t)}const b4=12;function pR(e,t,i){let a=i;for(let o=1;o{const g=m*o,v=g*e,S=kg(m,o),x=Math.exp(-v);return _p-g/S*x},a=m=>{const v=m*o*e,S=o*o*m*m*e,x=Math.exp(-v),E=kg(m*m,o);return(-i(m)+_p>0?-1:1)*-S*x/E}):(i=m=>{const g=Math.exp(-m*e),v=m*e+1;return-_p+g*v},a=m=>{const g=Math.exp(-m*e),v=-m*(e*e);return g*v});const c=5/e,u=pR(i,a,c),f=u*mR(o,u*e),h=f*f;return{stiffness:h,damping:o*2*Math.sqrt(h),duration:br(e)}}const zg=(e,t)=>(t?e>=0:e>0)&&e<1/0;function Vp(e,t){if(zg(e,t))return e}function S4(e){const t=Vp(e.stiffness),i=Vp(e.damping,!0),a=Vp(e.mass),o={...e,stiffness:t??sx,damping:i??ox,mass:a??u4,isResolvedFromDuration:!1,isTimeDefined:(t??i??a)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(o.isTimeDefined){if(e.visualDuration){const c=hR(e.bounce||0),u=2*Math.PI/(e.visualDuration*1.2)*mR(c,2*Math.PI/1.2);o.stiffness=u*u,o.damping=2*c*Math.sqrt(o.stiffness)}else Object.assign(o,x4(o)),o.isResolvedFromDuration=!0;(!zg(o.stiffness)||!zg(o.damping,!0))&&(o.stiffness=sx,o.damping=ox)}return o}function cx(e=d4,t=dR){const i=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e,a=i.keyframes[0],o=i.keyframes[i.keyframes.length-1],c={done:!1,value:a},{stiffness:u,damping:f,mass:h,duration:m,isResolvedFromDuration:g,isTimeDefined:v}=S4({...i}),S=D=>v?0:-Kr(D),x=f/(2*Math.sqrt(u*h)),E=Kr(Math.sqrt(u/h)),w=x*E,R={target:o,delta:o-a,velocity:S(i.velocity||0)||0,restSpeed:0,restDelta:0},T=()=>{const D=Math.abs(R.delta)<5;R.restSpeed=i.restSpeed||(D?h4:m4),R.restDelta=i.restDelta||(D?p4:g4)};T();let O,N,j;if(x<1){const D=kg(E,x),A={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};j=()=>{A.A=(R.velocity+w*R.delta)/D,A.sinC=w*A.A+R.delta*D,A.cosC=w*R.delta-A.A*D};const F=H=>{H!==A.t&&(A.t=H,A.env=Math.exp(-w*H),A.sin=Math.sin(D*H),A.cos=Math.cos(D*H))};O=H=>(F(H),R.target-A.env*(A.A*A.sin+R.delta*A.cos)),N=H=>(F(H),A.env*(A.sinC*A.sin+A.cosC*A.cos))}else if(x===1){O=A=>R.target-Math.exp(-E*A)*(R.delta+(R.velocity+E*R.delta)*A);const D={C:0};j=()=>{D.C=R.velocity+E*R.delta},N=A=>Math.exp(-E*A)*(E*D.C*A-R.velocity)}else{const D=E*Math.sqrt(x*x-1),A=w-D,F=w+D,H=D<1||v?1/0:300/D,X=($,ee)=>Math.exp(ee>H?(w-$)*H-w*ee:-$*ee),J={S:0,F:0};j=()=>{const $=(R.velocity+w*R.delta)/D;J.S=(R.delta+$)/2,J.F=(R.delta-$)/2},O=$=>R.target-J.S*X(A,$)-J.F*X(F,$),N=$=>A*J.S*X(A,$)+F*J.F*X(F,$)}j();const L=g&&m||null,P={calculatedDuration:L,retarget:(D,A)=>{R.target=D[D.length-1],R.delta=R.target-D[0],R.velocity=S(A),i.restSpeed&&i.restDelta||T(),P.calculatedDuration=L,c.done=!1,j()},velocity:D=>br(N(D)),next:D=>{const A=O(D);if(g)c.done=D>=m;else{const F=br(N(D));c.done=Math.abs(F)<=R.restSpeed&&Math.abs(R.target-A)<=R.restDelta}return c.value=c.done?R.target:A,c},toString:()=>{const D=Math.min(W0(P),$0),A=fR(F=>P.next(D*F).value,D,30);return D+"ms "+A},toTransition:()=>{}};return P}const gR=Object.assign(cx,{applyToOptions:e=>{const t=c4(e,100,cx);return e.ease=t.ease,e.duration=br(t.duration),e.type="keyframes",e}});function bd({keyframes:e,velocity:t=0,power:i=.8,timeConstant:a=325,bounceDamping:o=10,bounceStiffness:c=500,modifyTarget:u,min:f,max:h,restDelta:m=.5,restSpeed:g}){const v=e[0],S={done:!1,value:v},x=D=>Dh,E=D=>f===void 0?h:h===void 0||Math.abs(f-D)-w*Math.exp(-D/a),N=D=>{const A=O(D);S.done=Math.abs(A)<=m,S.value=S.done?T:D?T+A:v};let j,L;const P=D=>{x(S.value)&&(j=D,L=gR({keyframes:[S.value,E(S.value)],velocity:-O(D)/a*1e3,damping:o,stiffness:c,restDelta:m,restSpeed:g}))};return P(0),{calculatedDuration:null,next:D=>{let A=!1;return!L&&j===void 0&&(A=!0,N(D),P(D)),j!==void 0&&D>=j?L.next(D-j):(!A&&N(D),S)}}}function w4(e,t,i){const a=[],o=ki.mix||K0,c=e.length-1;for(let u=0;ut[0];if(c===2&&t[0]===t[1])return()=>t[1];const u=e[0]===e[1];e[0]>e[c-1]&&(e=[...e].reverse(),t=[...t].reverse());const f=w4(t,a,o),h=f.length,m=g=>{if(u&&g1)for(;vm(Aa(e[0],e[c-1],g)):m}function R4(e,t){const i=e[e.length-1];for(let a=1;a<=t;a++){const o=Zs(0,t,a);e.push(rn(i,1,o))}}function Uc(e){const t=[0];return R4(t,e.length-1),t}function C4(e,t){return e.map(i=>i*t)}function T4(e,t){return e.map(()=>t||I0).splice(0,e.length-1)}function ls({duration:e=300,keyframes:t,times:i,ease:a="easeInOut",mixer:o}){const c=typeof t[0]=="number"?void 0:o,u=tR(a)?a.map(Dg):Dg(a)||I0,f={done:!1,value:t[0]};let h=-1;if(!c){for(let v=1;v=0){h=-2;break}h=v-1}}if(h>=0){const v=i&&i.length===t.length?i:Uc(t),S=v[h]*e,x=v[h+1]*e,E=t[h],w=t[h+1],R=Array.isArray(u)?u[h]:u,T=(ki.mix||K0)(E,w),O=t.length-2;return{calculatedDuration:e,next:N=>(f.value=h&&N=x||!e)?typeof w=="number"?w:T(1):T(R(N>=x||!e?1:N<=S?0:(N-S)/(x-S))),f.done=N>=e,f)}}const m=C4(i&&i.length===t.length?i:Uc(t),e),g=E4(m,t,{ease:Array.isArray(u)?u:T4(t,u),mixer:c});return{calculatedDuration:e,next:v=>(f.value=g(v),f.done=v>=e,f)}}const A4=5;function M4(e,t,i){const a=Math.max(t-A4,0);return KE(i-e(a),t-a)}function j4(e,t,i=0){return t<=0?i:e.velocity?e.velocity(t):M4(a=>e.next(a).value,t,e.next(t).value)}function Bc(e,{repeat:t,repeatType:i="loop"},a,o=1){let c,u,f=0;for(let g=0;gt-e>D4&&!ki.useManualTiming?t:e;function bR(e,t){return{kind:e,animation:t,timestamp:Ut.now(),frameTimestamp:An.timestamp,frameIsProcessing:An.isProcessing}}function xR(e,t,i){const a=globalThis.__MOTION_INSPECT__;if(a)try{a({...bR("animation-start",e),options:i?{...t,...i}:t})}catch{}}function N4(e,t){const i=globalThis.__MOTION_INSPECT__;if(i)try{i({...bR("layout-animation-start",e),node:t})}catch{}}class Z0{constructor(){this.isResolved=!1}get finished(){return this._finished||(this._finished=this.isResolved?Promise.resolve():new Promise(t=>{this._resolve=t})),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(t,i){return this.finished.then(t,i)}}const L4=e=>e/100,Ic=e=>Math.round(e*1e4)/1e4;class rl extends Z0{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:i}=this.options;i&&i.updatedAt!==Ut.now()&&this.tick(Ut.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause(),xR(this,this.options)}initAnimation(){const{options:t}=this;yR(t);const{type:i=ls,repeat:a=0,repeatDelay:o=0,repeatType:c,velocity:u=0}=t;let{keyframes:f}=t;const h=i||ls;this.mixKeyframes=void 0,h!==ls&&typeof f[0]!="number"&&(this.mixKeyframes=nl(L4,t.mixer?.(f[0],f[1])||K0(f[0],f[1])),f=[0,100]);const m=h(f===t.keyframes?t:{...t,keyframes:f});c==="mirror"&&(this.mirroredGenerator=h({...t,keyframes:[...f].reverse(),velocity:-u})),m.calculatedDuration===null&&(m.calculatedDuration=W0(m));const{calculatedDuration:g}=m;this.calculatedDuration=g,this.resolvedDuration=g+o,this.totalDuration=this.resolvedDuration*(a+1)-o,this.generator=m}updateTime(t){this.currentTime=this.holdTime??Math.round(t-this.startTime)*this.playbackSpeed}tick(t,i=!1){const{generator:a,totalDuration:o,calculatedDuration:c}=this;if(this.startTime===null)return a.next(0);const{delay:u=0,keyframes:f,type:h,onUpdate:m,finalKeyframe:g}=this.options;this.startTime===this.pendingStartTime&&(this.startTime=vR(this.startTime,t)),this.pendingStartTime=void 0,this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),i?this.currentTime=t:this.updateTime(t);const v=this.currentTime-u*(this.playbackSpeed>=0?1:-1),S=this.playbackSpeed>=0?v<0:v>o;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);const x=this.generate(this.currentTime,S);let{done:E}=x;S||(E=this.playbackSpeed>=0?c<1/0?this.currentTime>=o:E:this.currentTime<=0);const w=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return w&&h!==bd&&(x.value=Bc(f,this.options,g,this.speed)),m&&m(x.value),w&&this.finish(),x}at(t){return this.holdTime??Ic((t-this.startTime)*this.playbackSpeed)}sampleAt(t,i){const{options:a,totalDuration:o}=this,c=this.at(t)-(a.delay||0);return c>=o&&a.type!==bd?Bc(a.keyframes,a,i?void 0:a.finalKeyframe):this.generate(Math.max(c,0),c<0).value}generate(t,i){const{generator:a,totalDuration:o,mixKeyframes:c,mirroredGenerator:u,resolvedDuration:f}=this,{keyframes:h,repeat:m,repeatType:g,repeatDelay:v}=this.options;let S=t,x=a;if(m){const w=Math.min(t,o)/f;let R=Math.floor(w),T=w%1;!T&&w>=1&&(T=1),T===1&&R--,R=Math.min(R,m+1),R%2&&(g==="reverse"?(T=1-T,v&&(T-=v/f)):g==="mirror"&&(x=u)),S=Aa(0,1,T)*f}let E;return i?(this.delayState.value=h[0],E=this.delayState):E=x.next(S),c&&!i&&(E.value=c(E.value)),E}get duration(){return Kr(this.calculatedDuration)}get iterationDuration(){return this.duration+Kr(this.options.delay??0)}get time(){return Kr(this.currentTime)}set time(t){this.state==="finished"&&this.updateFinished(),t=br(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){return j4(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(t){const i=this.playbackSpeed!==t;i&&this.driver&&this.updateTime(Ut.now()),this.playbackSpeed=t,i&&this.driver&&(this.time=Kr(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=X0,startTime:i}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),this.options.onPlay?.();const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime/(this.playbackSpeed||1):this.startTime||(this.startTime=i??(this.pendingStartTime=a)),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ut.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.driver?.stop(),this.driver=void 0,this.startTime=this.holdTime=null}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}const k4=new Set(["brightness","contrast","saturate","opacity"]);function z4(e){const[t,i]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=i.match(F0)||[];if(!a)return e;const o=i.replace(a,"");let c=k4.has(t)?1:0;return a!==i&&(c*=100),t+"("+c+o+")"}const P4=/\b([a-z-]*)\(.*?\)/gu,Pg={...di,getAnimatableNone:e=>{const t=e.match(P4);return t?t.map(z4).join(" "):e}},_g={...di,getAnimatableNone:e=>{const t=di.parse(e);return di.createTransformer(e)(t.map(a=>typeof a=="number"?0:typeof a=="object"?{...a,alpha:1}:a))}},ux={...gl,transform:Math.round},SR={rotate:ba,pathRotation:ba,rotateX:ba,rotateY:ba,rotateZ:ba,scale:Tf,scaleX:Tf,scaleY:Tf,scaleZ:Tf,skew:ba,skewX:ba,skewY:ba,distance:Ve,translateX:Ve,translateY:Ve,translateZ:Ve,x:Ve,y:Ve,z:Ve,perspective:Ve,transformPerspective:Ve,opacity:_c,originX:tx,originY:tx,originZ:Ve},Q0={borderWidth:Ve,borderTopWidth:Ve,borderRightWidth:Ve,borderBottomWidth:Ve,borderLeftWidth:Ve,borderRadius:Ve,borderTopLeftRadius:Ve,borderTopRightRadius:Ve,borderBottomRightRadius:Ve,borderBottomLeftRadius:Ve,width:Ve,maxWidth:Ve,height:Ve,maxHeight:Ve,top:Ve,right:Ve,bottom:Ve,left:Ve,inset:Ve,insetBlock:Ve,insetBlockStart:Ve,insetBlockEnd:Ve,insetInline:Ve,insetInlineStart:Ve,insetInlineEnd:Ve,padding:Ve,paddingTop:Ve,paddingRight:Ve,paddingBottom:Ve,paddingLeft:Ve,paddingBlock:Ve,paddingBlockStart:Ve,paddingBlockEnd:Ve,paddingInline:Ve,paddingInlineStart:Ve,paddingInlineEnd:Ve,margin:Ve,marginTop:Ve,marginRight:Ve,marginBottom:Ve,marginLeft:Ve,marginBlock:Ve,marginBlockStart:Ve,marginBlockEnd:Ve,marginInline:Ve,marginInlineStart:Ve,marginInlineEnd:Ve,fontSize:Ve,backgroundPositionX:Ve,backgroundPositionY:Ve,...SR,zIndex:ux,fillOpacity:_c,strokeOpacity:_c,numOctaves:ux},_4={...Q0,color:Hn,backgroundColor:Hn,outlineColor:Hn,fill:Hn,stroke:Hn,borderColor:Hn,borderTopColor:Hn,borderRightColor:Hn,borderBottomColor:Hn,borderLeftColor:Hn,filter:Pg,WebkitFilter:Pg,mask:_g,WebkitMask:_g},wR=e=>_4[e],V4=new Set([Pg,_g]);let fx,dx,Up;function J0(e,t){if(e===fx&&t===dx)return Up;let i=wR(e);return V4.has(i)||(i=di),Up=i.getAnimatableNone?i.getAnimatableNone(t):void 0,fx=e,dx=t,Up}function U4(e){for(let t=1;te*180/Math.PI,Vg=e=>{const t=qs(Math.atan2(e[1],e[0]));return Ug(t)},B4={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scaleZ:()=>1,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Vg,rotateZ:Vg,skewX:e=>qs(Math.atan(e[1])),skewY:e=>qs(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Ug=e=>(e=e%360,e<0&&(e+=360),e),hx=Vg,mx=e=>Math.hypot(e[0],e[1]),px=e=>Math.hypot(e[4],e[5]),I4={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:mx,scaleY:px,scaleZ:e=>Math.hypot(e[8],e[9],e[10]),scale:e=>(mx(e)+px(e))/2,rotateX:e=>Ug(qs(Math.atan2(e[6],e[5]))),rotateY:e=>Ug(qs(Math.atan2(-e[2],e[0]))),rotateZ:hx,rotate:hx,skewX:e=>qs(Math.atan(e[4])),skewY:e=>qs(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Hc(e){return e.includes("scale")?1:0}function ey(e,t){if(!e||e==="none")return Hc(t);const i=e.match(/^matrix(3d)?\(([-\d.e\s,]+)\)$/u);if(!i)return Hc(t);const a=(i[1]?I4:B4)[t],o=i[2].split(",").map(c=>parseFloat(c));return typeof a=="function"?a(o):o[a]}const H4=(e,t)=>{const{transform:i="none"}=getComputedStyle(e);return ey(i,t)},Ra=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","scaleZ","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],cs=new Set([...Ra,"pathRotation"]),gx=e=>e===gl||e===Ve,F4=new Set(["x","y","z"]),Y4=Ra.filter(e=>!F4.has(e));function q4(e){const t=[];return Y4.forEach(i=>{const a=e.getValue(i);if(a!==void 0){const o=a.get(),c=i.startsWith("scale")?1:0;if(o===c)return;t.push([i,o]),a.set(c)}}),t}const G4=new Set(["bottom","right"]);function yx(e,t,i,a,o,c){const u=parseFloat(e);if(!isNaN(u))return u;const{min:f,max:h}=t()[i],m=h-f;return c==="border-box"?m:m-parseFloat(a)-parseFloat(o)}const vx=({transform:e})=>ey(e,"x"),bx=({transform:e})=>ey(e,"y"),Bp={width:({width:e,paddingLeft:t="0",paddingRight:i="0",boxSizing:a},o)=>yx(e,o,"x",t,i,a),height:({height:e,paddingTop:t="0",paddingBottom:i="0",boxSizing:a},o)=>yx(e,o,"y",t,i,a),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{const{y:i}=t();return parseFloat(e)+(i.max-i.min)},right:({left:e},t)=>{const{x:i}=t();return parseFloat(e)+(i.max-i.min)},x:vx,y:bx,translateX:vx,translateY:bx},Xs=new Set;let Bg=!1,Ig=!1,Hg=!1;function ER(){if(Ig){const e=[],t=new Set,i=new Set;Xs.forEach(o=>{o.needsMeasurement&&(e.push(o),t.add(o.element),G4.has(o.name)&&i.add(o.element))});const a=new Map;i.forEach(o=>{const c=q4(o);c.length&&(a.set(o,c),o.render())}),e.forEach(o=>o.measureInitialState()),t.forEach(o=>{o.render();const c=a.get(o);c&&c.forEach(([u,f])=>{o.getValue(u)?.set(f)})}),e.forEach(o=>o.measureEndState()),e.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}Ig=!1,Bg=!1,Xs.forEach(e=>e.complete(Hg)),Xs.clear()}function RR(){Xs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ig=!0)})}function K4(){Hg=!0,RR(),ER(),Hg=!1}function X4(e,t,i){if(typeof e=="string"){if(_0(e)||V0(e))return parseFloat(e);if(!di.test(e)&&di.test(i))return J0(t,i)}return e??void 0}class ty{constructor(t,i,a,o,c,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=i,this.name=a,this.motionValue=o,this.element=c,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(Xs.add(this),Bg||(Bg=!0,Kt.read(RR),Kt.resolveKeyframes(ER))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:i,element:a,motionValue:o}=this;if(t[0]===null){const c=o?.get(),u=t[t.length-1];if(c!==void 0)t[0]=c;else if(a&&i){const f=X4(a.readValue(i,u),i,u);f!==void 0&&(t[0]=f)}t[0]===void 0&&(t[0]=u),o&&c===void 0&&o.set(t[0])}U4(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Xs.delete(this)}cancel(){this.state==="scheduled"&&(Xs.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const $4=e=>e.startsWith("--");function CR(e,t,i){$4(t)?e.style.setProperty(t,i):e.style[t]=i}const W4={};function TR(e,t){const i=AM(e);return()=>W4[t]??i()}const Z4=TR(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),ny=TR(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Fo=([e,t,i,a])=>`cubic-bezier(${e}, ${t}, ${i}, ${a})`,Fg={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Fo([0,.65,.55,1]),circOut:Fo([.55,0,1,.45]),backIn:Fo([.31,.01,.66,-.59]),backOut:Fo([.33,1.53,.69,.99])};function AR(e,t){if(e)return typeof e=="function"?ny()?fR(e,t):"ease-out":H0(e)?Fo(e):Array.isArray(e)?e.map(i=>AR(i,t)||Fg.easeOut):Fg[e]}function Q4(e,t,i,{delay:a=0,duration:o=300,repeat:c=0,repeatType:u="loop",ease:f="easeOut",times:h}={},m=void 0){const g={[t]:i};h&&(g.offset=h);const v=AR(f,o);Array.isArray(v)&&(g.easing=v);const S={delay:a,duration:o,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:c+1,direction:u==="reverse"?"alternate":"normal"};return m&&(S.pseudoElement=m),e.animate(g,S)}function MR(e){return typeof e=="function"&&"applyToOptions"in e}function J4({type:e,...t}){return MR(e)&&ny()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class jR extends Z0{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:i,name:a,keyframes:o,pseudoElement:c,allowFlatten:u=!1,finalKeyframe:f,onComplete:h}=t;this.isPseudoElement=!!c,this.allowFlatten=u,this.options=t;const m=J4(t);this.animation=Q4(i,a,o,m,c),m.autoplay===!1&&this.animation.pause(),this.animation.onfinish=this.onFinish=()=>{if(this.animation.onfinish=null,this.finishedTime=this.time,!c){const g=Bc(o,this.options,f,this.speed);this.updateMotionValue?.(g),CR(i,a,g),this.animation.cancel()}h?.(),this.notifyFinished()},xR(this,t,m)}play(){this.isStopped||(this.manualStartTime=null,this.animation.onfinish=this.onFinish,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.isStopped||(this.animation.onfinish=this.onFinish),this.animation.finish?.()}cancel(){this.animation.onfinish=null;try{this.animation.cancel()}catch{}}stop(){this.isStopped||(this.isStopped=!0,!(this.state==="idle"||this.finishedTime!==null)&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel()))}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Kr(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Kr(t)}get time(){return Kr(Number(this.animation.currentTime)||0)}set time(t){const i=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=br(t),i&&(this.animation.pause(),this.updateFinished())}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,onAttach:i,observe:a}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=this.onFinish=null,t&&Z4()?(this.animation.timeline=t,i?.(this.animation),Di):a(this)}}const OR={anticipate:QE,backInOut:ZE,circInOut:eR};function e6(e){return e in OR}function t6(e){typeof e.ease=="string"&&e6(e.ease)&&(e.ease=OR[e.ease])}const xd=10;class n6 extends jR{constructor(t){t6(t),yR(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}elapsed(){return this.state==="running"?(Ut.now()-this.startTime)*this.speed:this.time*1e3}sample(t){if(!this.sampler){const{motionValue:i,onUpdate:a,onComplete:o,onPlay:c,onStop:u,element:f,...h}=this.options;this.sampler=new rl({...h,autoplay:!1}),this.sampler.stop()}return this.sampler.sample(Math.max(0,t)).value}liveValue(){const{state:t}=this;if(t==="running"||t==="paused")return this.sample(this.elapsed())}updateMotionValue(t){const{motionValue:i,element:a,name:o}=this.options;if(!i)return;if(t!==void 0){i.set(t);return}const{speed:c}=this,u=this.elapsed(),f=this.state==="running"&&c?Aa(0,xd,u):0,h=this.sample(u);a&&o&&CR(a,o,h),i.setWithVelocity(this.sample(u-f*Math.sign(c)),h,f/Math.abs(c||1))}}const xx=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(di.test(e)||e==="0")&&!e.startsWith("url("));function r6(e){const t=e[0];if(e.length===1)return!0;for(let i=0;ie&&typeof t[0]!="number"&&t.some((i,a)=>a&&e(t[a-1],i)),Sx=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),NR=()=>!ki.useManualTiming&&Object.hasOwnProperty.call(Element.prototype,"animate");function o6(e){const{motionValue:t,name:i,repeatDelay:a,repeatType:o,damping:c,type:u,keyframes:f}=e;if(!i||!(qg.has(i)||Sx.has(i)))return!1;const h=t?.owner?.current;if(!(h instanceof HTMLElement)&&!(h instanceof SVGElement))return!1;const{onUpdate:m,transformTemplate:g}=t.owner.getProps();return NR()&&(qg.has(i)||Sx.has(i)&&s6(f))&&(i!=="transform"||!g)&&!m&&!a&&o!=="mirror"&&c!==0&&u!=="inertia"&&!DR(e)}const ry=(e,t)=>t&&typeof e=="number"?t.transform(e):e,l6={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},c6=Ra.length,wx={},Gg=(e,t,i=ry(t,SR[e]))=>(wx[e]||(wx[e]=(l6[e]||e)+"("))+i+")",Kg=(e,t)=>(typeof t=="number"?t:parseFloat(t))===(e.startsWith("scale")?1:0);function u6(e,t,i){let a="";for(let c=0;cp6.has(e),Rx=new WeakMap,y6=(e,t)=>{let i=Rx.get(e);return i?.[0]!==t&&(i=[t,"linear("+Uc(Array(t+1)).map(a=>Ic(e(a))+" "+Ic(a*100)+"%")+")"],Rx.set(e,i)),i[1]},Cx=(e,t)=>Math.min(f6,Math.max(2,Math.ceil((t-e)/xd))),Mc=(e,t)=>Math.abs(e-t)<=LR,Ip=(e,t)=>e-t,Tx=(e,t,i)=>Uc(Array(i+1)).map(a=>rn(e,t,a)),Zf=e=>e.motionValue.owner,Sd=e=>il.get(e),Ax=({state:e})=>e==="idle"||e==="finished",Yo=(e,t)=>e.latestValues?e.latestValues[t]:e.getValue(t)?.get(),v6=({name:e,motionValue:t})=>e&&Ra.includes(e)&&t?.owner?.current instanceof HTMLElement&&NR()&&ny();function b6(e){const t=Zf(e),{onUpdate:i,transformTemplate:a}=t.getProps();return!e.isHandoff&&!i&&!e.hasOnUpdate&&!a&&e.type!=="inertia"&&(Yo(t,"transform")||"none")==="none"&&!Yo(t,"pathRotation")&&!t.projection?.isProjecting()&&!DR(e)}class x6{constructor(t,i,a,o){this.element=t,this.update=i,this.makeDriver=a,this.animation=o}get js(){return this.driver||(this.driver=this.makeDriver(this.update))}now(){return this.driver||this.makeDriver!==X0?this.js.now():An.isProcessing?An.timestamp:Ut.now()}start(t=!0){const i=Sd(this.element);!i||i.isJS?this.js.start(t):i.schedule(!1,!t)}stopJS(){this.driver?.stop()}stop(){this.stopJS();const t=Sd(this.element);t&&!t.isFinishing&&t.release(this.animation)}}let Mx;class S6 extends rl{constructor(t){const i=Zf(t).current,{driver:a=X0}=t;let o;const c=b6(t);t.driver=h=>new x6(i,h,a,o),super(t),o=this;const u=this.driver;u&&(u.animation=this),this.canAccelerate=c;const{stop:f}=this;this.stop=()=>{this.isAccelerated()&&this.sync(),f()}}offsets(){const{keyframes:t,times:i}=this.options;return i||(this.offsetsOf!==t&&(this.offsetsOf=t,this.cachedOffsets=Uc(t)),this.cachedOffsets)}get group(){return Sd(Zf(this.options).current)}get js(){return this.driver?.js}stopJS(){this.driver?.stopJS()}get name(){return this.options.name}timing(){const{startTime:t,speed:i,totalDuration:a}=this,{delay:o=0,repeatType:c}=this.options;return this.holdTime!==null?[1/0,0]:a===1/0?[t+o/i,this.resolvedDuration*(c==="loop"?1:2)/i||1]:[t+(o+a)/i,0]}isAccelerated(){const{group:t,state:i}=this;return t?.tracks.has(this)&&!t.isJS&&this.canAccelerate&&(i==="running"||i==="paused")}liveValue(){return this.isAccelerated()?this.sampleAt(Ut.now()):void 0}tween(){const{keyframes:t,type:i,repeat:a,delay:o=0}=this.options;let c=-1;if(a||i!==ls||this.holdTime!==null)return;for(let m=1;m=0)return;c=m-1}let{ease:u}=this.options;tR(u)&&(u=u[c]);const f=this.offsets(),h=m=>this.startTime+(o+f[m]*this.totalDuration)/this.speed;if(c>=0){const m=H0(u)?Fo(u):g6(u)?Fg[u]:Dg(u);return[h(c),h(c+1),typeof m=="string"||Mc(m(0),0)&&Mc(m(1),1)?m:void 0]}}boundaries(t,i){const{startTime:a,speed:o,resolvedDuration:c,options:u}=this,{delay:f=0,repeat:h=0,repeatDelay:m=0,repeatType:g,type:v}=u,S=(v||ls)===ls?this.offsets():[0,1],x=a+f/o,E=[];if(this.holdTime!==null||!(c>0))return E;for(let w=Math.max(0,Math.floor((t-x)*o/c));w<=h;w++){const R=x+w*c/o;if(R>i)break;for(const T of S){const O=R+(w%2&&g&&g!=="loop"?1-T:T)*(c-m)/o;O>t&&O{sc||queueMicrotask(()=>{const t=sc;sc=void 0,t.forEach(i=>i())}),(sc||(sc=[])).push(e)};function E6(e){const t=e.current,i=new Set,a=new Map;let o={},c=[],u=new Map,f=[],h=!1,m=!1,g=!1,v=!1,S=-1/0,x,E=1/0,w;const R=_=>{for(const M of i)if(M.name===_)return!0},T=(_,M)=>{const z={};for(const B of _===void 0?Ra:c){const I=a.get(B),W=_===void 0?Yo(e,B):I?I.sampleAt(M>_&&!I.timing()[1]?M:_):o[B];W!==void 0&&(z[B]=W)}return z},O=(_,M)=>{let z="";for(const B in _){const I=_[B];(!M||!Kg(B,I))&&(z+=Gg(B,I)+" ")}return(M?z.trim():z)||"none"},N=(_,M)=>O(T(_,M)),j=(_=T())=>{t.style.transform=O(_,!0)},L=_=>{_.onfinish=_.oncancel=null,_.cancel()},P=(_=!0)=>{clearTimeout(x),E=1/0,w=void 0,_&&j(),f.forEach(({animation:M})=>L(M)),f=[]},D=(_,M)=>new Animation(new KeyframeEffect(t,_,M)),A=(_,M,z=1/0)=>{const B={animation:_,offset:M,end:z};_.startTime=Ut.now()+M,z<1/0&&(_.onfinish=()=>{B.isDone=!0,f.some(I=>I.end===1/0)&&(L(_),f=f.filter(I=>I!==B)),Y.schedule(!1)}),_.oncancel=()=>f.includes(B)&&Y.demote(),f.push(B)},F=(_,M,z)=>{const B=(W,ie)=>Math.abs(_(ie)-_(W)),I=B(M,z);for(;z-M>.01;){const W=(M+z)/2;B(M,W)>B(W,z)?z=W:M=W}return B(M,z)>I/2?[M,z]:[]},H=(_,M,z,B)=>{const I=Cx(M,z);if(B.length*4>I)return;let W;for(const we of _){const Re=we.numberAt(M),ye=(we.numberAt((M+z)/2)-Re)/(we.numberAt(z)-Re);if(ye===ye){if(W===void 0)W=ye;else if(!Mc(ye,W))return}}const ie=Tx(M,z,I).concat(B).sort(Ip),fe=we=>Zs(M,z,we);let pe,ce;for(const we of _){const Re=we.numberAt(M),ye=ie.map(nt=>we.numberAt(nt)-Re),ze=ye[ye.length-1],Ye=ye.some(nt=>Math.abs(nt)*LR>Math.abs(ze))?0:ze,Qe=ye.map(nt=>Ye?nt/Ye:nt);if(Ye&&!pe)pe=Qe,ce=nt=>(we.numberAt(nt)-Re)/Ye;else if(Qe.some((nt,Ne)=>!Mc(nt,Ye&&pe[Ne])))return}if(!pe||pe.every((we,Re)=>Mc(we,fe(ie[Re]))))return"linear";const Ae=[],ke=(we,Re=ce(we))=>Ae.push(Ic(Re)+" "+Ic(fe(we)*100)+"%");return pe.forEach((we,Re)=>{Re&&Math.abs(we-pe[Re-1])>.2&&F(ce,ie[Re-1],ie[Re]).forEach(ye=>ke(ye)),ke(ie[Re],we)}),"linear("+Ae+")"},X=(_,M,z,B)=>{const I=[M],W=[];let ie=z,fe=M;for(const we of _){const Re=we.tween();if(Re?.[2]!=="linear"){const[ye,ze]=we.timing(),[Ye,Qe]=Re||[M,ze?z:ye];ie=Math.min(ie,Ye),fe=Math.max(fe,Qe),W.push(we)}}ie=Math.max(M,ie),fe=Math.min(z,fe);const pe=(we,Re)=>W.every(ye=>!(Math.abs(ye.numberAt((we+Re)/2)-(ye.numberAt(we)+ye.numberAt(Re))/2)>(ye.name.startsWith("scale")?h6:d6))),ce=(we,Re,ye)=>{if(Re-we<1||pe(we,Re))I.push(Re);else if(ye<4)ce(we,(we+Re)/2,ye+1),ce((we+Re)/2,Re,ye+1);else{for(const ze of _)I.push(...F(Ye=>ze.numberAt(Ye),we,Re));I.push(Re)}},Ae=fe>ie?Tx(ie,fe,Math.ceil((fe-ie)/100)):[];Ae.push(z);for(const we of B)Ae.push(we,Math.min(we+.01,z));let ke=M;for(const we of Ae.sort(Ip))we>ke&&ce(ke,we,0),ke=we;return I.sort(Ip)},J=_=>{let M;for(const z of _){const B=z.tween();if(!B||M&&(Math.abs(B[0]-M[0])>1||Math.abs(B[1]-M[1])>1))return;M=[B[0],B[1],!M||B[2]===M[2]?B[2]:void 0]}return M},$=(_,M,z,B,I={fill:"both"},W)=>{const ie=B?[]:_.flatMap(ke=>ke.boundaries(M,z)),fe=B||H(_,M,z,ie),pe=fe?[M,z]:X(_,M,z,ie),ce=pe.map(ke=>N(ke,W));let Ae={transform:ce};return fe||(Ae.offset=pe.map(ke=>Zs(M,z,ke))),ce.every(ke=>ke===ce[0])&&(j(T(M,W)),Ae=null),D(Ae,{...I,duration:z-M,easing:fe||"linear"})},ee=_=>{const M=Ut.now()+_;M{E=1/0,Y.schedule(!1)},_))},re=_=>{let M=_,z=0,B=0;const I=[],W=[],ie=new Set;a.clear(),u=new Map;for(const pe of i){a.set(pe.name,pe);const[ce,Ae]=pe.timing(),ke=ce===1/0;if(u.set(pe,[pe.at(_),pe.speed,ke]),!ke){if(pe.speed<0)return;if(Ae){if(z){const we=(ce-B)/Ae;if(Math.abs(Ae-z)>1||Math.abs(we-Math.round(we))*z>1)return}else z=Ae,B=ce;W.push(pe)}else ie.add(ce);I.push(pe),M=Math.max(M,ce)}}o={},c=Ra.filter(pe=>{if(a.has(pe))return!0;const ce=o[pe]=Yo(e,pe);return ce!==void 0&&!Kg(pe,ce)}),P(!1);const fe=!z&&J(I);try{if(M>_){let pe;if(fe&&fe[1]>_){const[ce,Ae,ke]=fe;if(ce-_>Ex)return I.forEach(we=>we.sync()),ee(w=ce-_-Ex),!0;pe=typeof ke=="string"?ke:ke?y6(ke,Cx(ce,Ae)):H(I,ce,Ae,[]),pe&&A($(I,ce,Ae,pe,{fill:"both",endDelay:M-Ae}),ce-_,M-ce)}pe||A($(I,_,M),0,M-_),ie.forEach(ce=>ce{let z,B=0;for(const I of i){const W=u.get(I);if(!W)return!1;const[ie,fe,pe]=W,ce=I.at(_),Ae=I.timing()[0]===1/0;if(pe){if(Ae&&(ce===ie||!f.length))continue;return!1}const ke=(ce-ie)/fe,we=Ae?0:I.speed/fe;if(z===void 0)z=ke,B=we;else if(Math.abs(ke-z)>1||we!==B)return!1}if(z===void 0)return!0;if(!f.length){if(w===void 0||M&&B)return!1;if(B){const I=(w-z)/B;if(I<1)return!1;ee(I)}return!0}for(const{offset:I,end:W,isDone:ie}of f){const fe=z-I;if(W<1/0&&(ie?fe=W))return!1}for(const{animation:I,offset:W,isDone:ie}of f){if(ie)continue;const fe=z-W;B&&I.updatePlaybackRate&&I.playState==="running"&&Math.abs(Number(I.currentTime)-fe)<20?I.playbackRate!==B&&I.updatePlaybackRate(B):B?(I.playbackRate!==B&&(I.playbackRate=B),I.startTime=_-fe/B):(I.startTime=null,I.currentTime=fe)}return!0},K=()=>i.size?!1:(g=!0,Sd(t)===Y&&il.delete(t),Y.isJS||P(),!0),Z=()=>{const _=Ut.now();if(Y.isJS||(Y.isFinishing=!0,i.forEach(B=>{const[I,W]=B.timing();B.state==="running"&&B.speed>0&&!W&&I<=_+1&&(B.complete(),o[B.name]=Yo(e,B.name),u.has(B)||(h=!0))}),Y.isFinishing=!1),m=!1,g||(i.forEach(B=>Ax(B)&&i.delete(B)),K()))return;for(const B of i)if(!B.canAccelerate)return Y.demote(!0);Y.isJS&&(Y.isJS=!1,h=!0,i.forEach(B=>B.stopJS()));const M=h,z=v;if(h=v=!1,M||!V(_,z)){if(z){if(_-SB.timing()[0]===1/0&&B.sync())},Y={tracks:i,isJS:!1,isFinishing:!1,schedule(_,M){g||(h||(h=_),v||(v=!!M),m||(m=!0,An.isProcessing?Kt.render(Z,!1,!0):w6(Z)))},release(_){Ax(_)&&i.delete(_),K()||Y.schedule(!0)},check(){if(!Y.isJS){for(const _ in o)if(Yo(e,_)!==o[_]&&!R(_))return Y.schedule(!0,!0)}},demote(_){if(!(Y.isJS||g))return i.forEach(M=>{M.isAccelerated()&&M.sync(),_||(M.canAccelerate=!1)}),Y.isJS=!0,u=new Map,P(),i.forEach(M=>M.state==="running"&&M.js?.start()),!0}};return il.set(t,Y),Y}class R6 extends Z0{constructor(t){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Ut.now();const{keyframes:i,name:a,motionValue:o,element:c}=t,u=t;u.autoplay??(u.autoplay=!0),u.delay??(u.delay=0),u.type??(u.type="keyframes"),u.repeat??(u.repeat=0),u.repeatDelay??(u.repeatDelay=0),u.repeatType??(u.repeatType="loop");const f=c?.KeyframeResolver||ty;this.keyframeResolver=new f(i,(h,m,g)=>this.onKeyframesResolved(h,m,u,!g),a,o,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,i,a,o){this.keyframeResolver=void 0;const{name:c,type:u,velocity:f,delay:h,isHandoff:m,onUpdate:g}=a;this.resolvedAt=Ut.now();const v=i6(t,c,u,f);v||((ki.instantAnimations||!h)&&g?.(Bc(t,a,i)),t[0]=t[t.length-1],Yg(a),a.repeat=0);const{onComplete:S}=a;a.finalKeyframe=i,a.keyframes=t,a.onComplete=()=>{S?.(),this.notifyFinished()};const x=v&&!m&&o6(a),E=!x&&v6(a);o&&(x||E||this.resolvedAt!==this.createdAt)&&(a.startTime??(a.startTime=vR(this.createdAt,this.resolvedAt)));let w;if(x){a.element=a.motionValue?.owner?.current;try{w=new n6(a)}catch{w=new rl(a)}}else E?w=new S6(a):w=new rl(a);this.pendingTimeline&&(this.stopTimeline=w.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=w}get finished(){return this._animation?this._animation.finished:super.finished}then(t,i){return this.finished.finally(t).then(()=>{})}liveValue(){return this._animation?.liveValue?.()}get animation(){return this._animation||(this.keyframeResolver?.resume(),K4()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation?.cancel(),this.keyframeResolver?.cancel()}}function kR(e,t,i,a=0,o=1){const c=Array.from(e).sort((m,g)=>m.sortNodePosition(g)).indexOf(t),u=e.size,f=(u-1)*a;return typeof i=="function"?i(c,u):o===1?c*a:f-c*a}const jx=30,C6=e=>!isNaN(parseFloat(e));class T6{constructor(t,i={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{const o=Ut.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&(this.dirty(),this.dependents))for(const c of this.dependents)c.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=i.owner}setCurrent(t){this.current=t,this.updatedAt=Ut.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=C6(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,i){var a;return t==="change"?this.onChangeSubscribe(i):((a=this.events)[t]||(a[t]=new yd)).add(i)}onChangeSubscribe(t){const{events:i}=this;return!i.change&&!this.changeSubscriber?this.changeSubscriber=t:(i.change||(i.change=new yd,i.change.add(this.changeSubscriber),this.changeSubscriber=void 0),i.change.add(t)),()=>{this.changeSubscriber===t?this.changeSubscriber=void 0:i.change?.remove(t),this.stopIfUnobserved()}}stopIfUnobserved(){Kt.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(const t in this.events)this.events[t].clear()}attach(t,i){this.passiveEffect=t,this.stopPassiveEffect=i}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,i,a){this.set(i),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-a}jump(t,i=!0){i&&(this.updatedAt=Ut.now(),this.stop()),this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,this.stopPassiveEffect?.()}dirty(){const{current:t,changeSubscriber:i}=this;i?i(t):this.events.change?.notify(t)}addDependent(t){(this.dependents||(this.dependents=new Set)).add(t)}removeDependent(t){this.dependents?.delete(t)}get(){const t=this.animation?.liveValue?.();return t===void 0?this.current:t}getCurrent(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Ut.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>jx)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,jx);return KE(parseFloat(this.current)-parseFloat(this.prevFrameValue),i)}start(t){return new Promise(i=>this.run(t,i))}run(t,i){this.stop(),this.hasAnimated=!0;let a=!1,o;o=t(()=>{a=!0,this.events.animationComplete?.notify(),this.animation===o&&(this.animation=void 0),i?.()}),a||(this.animation=o),this.events.animationStart?.notify()}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel?.notify()),this.animation=void 0}isAnimating(){return!!this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect?.()}}function al(e,t){return new T6(e,t)}function iy(e,t){if(e?.inherit&&t){const{inherit:i,...a}=e;return{...t,...a}}return e}function ay(e,t){const i=e?.[t]??e?.default??e;return i!==e?iy(i,e):i}const A6={type:"spring",stiffness:500,damping:25,restSpeed:10},M6=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),j6={type:"keyframes",duration:.8},O6={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},D6=(e,{keyframes:t})=>t.length>2?j6:cs.has(e)?e.startsWith("scale")?M6(t[1]):A6:O6,N6=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed","out","mixer"]);function L6(e){for(const t in e)if(!N6.has(t))return!0;return!1}const sy=(e,t,i,a={},o,c)=>u=>{const f=ay(a,e)||{},h=f.delay||a.delay||0;let{elapsed:m=0}=a;m=m-br(h);const g={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:t.getVelocity(),...f,delay:-m,onUpdate:S=>{t.set(S),f.onUpdate&&f.onUpdate(S)},onComplete:()=>{u(),f.onComplete&&f.onComplete()},name:e,motionValue:t,element:c?void 0:o,hasOnUpdate:!!f.onUpdate};L6(f)||Object.assign(g,D6(e,g)),g.duration&&(g.duration=br(g.duration)),g.repeatDelay&&(g.repeatDelay=br(g.repeatDelay)),g.from!==void 0&&(g.keyframes[0]=g.from);let v=!1;if((g.type===!1||g.duration===0&&!g.repeatDelay)&&(Yg(g),g.delay===0&&(v=!0)),(ki.instantAnimations||ki.skipAnimations||o?.shouldSkipAnimations||f.skipAnimations)&&(v=!0,Yg(g),g.delay=0),g.allowFlatten=!f.type&&!f.ease,v&&!c&&t.get()!==void 0){const S=Bc(g.keyframes,f);if(S!==void 0){Kt.update(()=>{g.onUpdate(S),g.onComplete()});return}}return f.isSync?new rl(g):new R6(g)},k6=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function z6(e){const t=k6.exec(e);if(!t)return[,];const[,i,a,o]=t;return[`--${i??a}`,o]}function oy(e,t,i=1){const[a,o]=z6(e);if(!a)return;const c=window.getComputedStyle(t).getPropertyValue(a);if(c){const u=c.trim();return _0(u)?parseFloat(u):u}return Xd(o)?oy(o,t,i+1):o}function P6(e){const t=[{},{}];return e?.values.forEach((i,a)=>{t[0][a]=i.get(),t[1][a]=i.getVelocity()}),t}function zR(e,t,i,a){const o=c=>typeof c=="function"?c(i!==void 0?i:e.custom,...P6(a)):c;return t=o(t),typeof t=="string"&&(t=e.variants&&e.variants[t]),o(t)}function $s(e,t,i){return zR(e.getProps(),t,i,e)}const PR=(e,t)=>t==="exit"?e.presenceContext?.custom:void 0,_R=new Set(["width","height","top","left","right","bottom",...Ra]),_6=e=>Array.isArray(e);function V6(e,t,i){e.hasValue(t)?e.getValue(t).set(i):e.addValue(t,al(i))}function U6(e){return _6(e)?e[e.length-1]||0:e}function B6(e,t){const i=$s(e,t);let{transitionEnd:a={},transition:o={},...c}=i||{};c={...c,...a};for(const u in c){const f=U6(c[u]);V6(e,u,f)}}const tr=e=>!!(e&&e.getVelocity);function I6(e){return!!(tr(e)&&e.add)}function Xg(e,t){const i=e.getValue("willChange");if(I6(i))return i.add(t);if(!i&&ki.WillChange){const a=new ki.WillChange("auto");e.addValue("willChange",a),a.add(t)}}const VR="data-framer-appear-id";function UR(e){return e.props[VR]}const H6=typeof window<"u";function F6({protectedKeys:e,needsAnimating:t},i){const a=i in e&&!t[i];return t[i]=!1,a}function BR(e,t,{delay:i=0,transitionOverride:a,type:o}={}){let{transition:c,transitionEnd:u,...f}=t;const h=e.getDefaultTransition();c=c?iy(c,h):h;const m=c?.reduceMotion,g=c?.skipAnimations;a&&(c=a);const v=[],S=o&&e.animationState?.getState()[o],x=c?.path;x&&(x.animateValues?x.animateValues(E=>e.getValue(E,e.latestValues[E]??0),f,c,i,v):x.animateVisualElement?.(e,f,c,i,v));for(const E in f){const w=e.getValue(E,e.latestValues[E]??null),R=f[E];if(R===void 0||S&&F6(S,E))continue;const T={delay:i,...ay(S?.out[E]||c||{},E)};g&&(T.skipAnimations=!0);const O=w.get();if(O!==void 0&&!w.isAnimating()&&!Array.isArray(R)&&R===O&&!T.velocity){Kt.update(()=>w.set(R));continue}let N=!1;if(H6&&window.MotionHandoffAnimation){const P=UR(e);if(P){const D=window.MotionHandoffAnimation(P,E,Kt);D!==null&&(T.startTime=D,N=!0)}}Xg(e,E);const j=m??e.shouldReduceMotion;w.run(sy(E,w,R,j&&_R.has(E)?{type:!1}:T,e,N));const L=w.animation;L&&v.push(L)}if(u){const E=()=>Kt.update(()=>{u&&B6(e,u)});v.length?Promise.all(v).then(E):E()}return v}function $g(e,t,i={}){const a=$s(e,t,PR(e,i.type)),o=i.transitionOverride||(a?.transition??(e.getDefaultTransition()||{})),c=()=>Promise.all(a?BR(e,a,i):[]),u=(h=0)=>{const{variantChildren:m}=e,{delayChildren:g=0,staggerChildren:v,staggerDirection:S}=o,x=[];return m?.forEach(E=>{E.notify("AnimationStart",t),x.push($g(E,t,{...i,delay:h+(typeof g=="function"?0:g)+kR(m,E,g,v,S)}).then(()=>E.notify("AnimationComplete",t)))}),Promise.all(x)},{when:f}=o;return f?f==="beforeChildren"?c().then(()=>u()):u().then(c):Promise.all([c(),u(i.delay)])}function Y6(e,t,i={}){return e.notify("AnimationStart",t),(Array.isArray(t)?Promise.all(t.map(o=>$g(e,o,i))):typeof t=="string"?$g(e,t,i):Promise.all(BR(e,$s(e,t,i.custom),i))).then(()=>{e.notify("AnimationComplete",t)})}const q6={test:e=>e==="auto",parse:e=>e},G6=e=>t=>t.test(e),K6=[gl,Ve,Xi,ba,BM,UM,q6],Ox=e=>K6.find(G6(e));function X6(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||V0(e):!0}const $6=new Set(["auto","none","0"]);function W6(e,t,i){let a=0,o;for(;at.measureViewportBox())}measureInitialState(){const{element:t,unresolvedKeyframes:i,name:a}=this;if(!t?.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),i[0]=this.measuredOrigin;const o=i[i.length-1];o!==void 0&&this.motionValue?.jump(o,!1)}measureEndState(){const{element:t,unresolvedKeyframes:i}=this;if(!t?.current)return;this.motionValue?.jump(this.measuredOrigin,!1);const a=i.length-1,o=i[a];i[a]=this.measure(),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),this.resolveNoneKeyframes()}}const ly=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Qf(e){return GE(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function cy(e){return GE(e)&&"ownerSVGElement"in e}const wd={};function uy(e){return wd.current?.add(e),e}const fy=e=>wd.current?wd.current.bind(e):e;function IR(e,t,i){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){const a=t?t.current:wd.current?.root||document,o=i?.[e]??a.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e).filter(a=>a!=null)}function HR(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}function dy(e,t,i){const{style:a,vars:o,transformOrigin:c}=e;let u=!1,f=!1;for(const h in t){const m=t[h];if(cs.has(h)){u=!0;continue}else if(rR(h)){o[h]=m;continue}else{const g=ry(m,Q0[h]);h.startsWith("origin")?(f=!0,c[h]=g):a[h]=g}}if(t.transform||(u||i?a.transform=u6(t,e.transform,i):a.transform&&(a.transform="none")),f){const{originX:h="50%",originY:m="50%",originZ:g=0}=c;a.transformOrigin=`${h} ${m} ${g}`}}const Q6={offset:"stroke-dashoffset",array:"stroke-dasharray"},J6={offset:"strokeDashoffset",array:"strokeDasharray"};function e8(e,t,i=1,a=0,o=!0){e.pathLength=1;const c=o?Q6:J6;e[c.offset]=`${-a}`,e[c.array]=`${t} ${i}`}const FR=["transform","opacity","clipPath","filter","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function YR(e,{attrX:t,attrY:i,attrScale:a,pathLength:o,pathSpacing:c=1,pathOffset:u=0,...f},h,m,g){if(dy(e,f,m),h){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:v,style:S}=e;for(const x of FR)v[x]!==void 0&&(S[x]=v[x],delete v[x]);(S.transform||v.transformOrigin)&&(S.transformOrigin=v.transformOrigin??"50% 50%",delete v.transformOrigin),S.transform&&(S.transformBox=g?.transformBox??"fill-box",delete v.transformBox),t!==void 0&&(v.x=t),i!==void 0&&(v.y=i),a!==void 0&&(v.scale=a),o!==void 0&&e8(v,o,c,u,!1)}function qR({top:e,left:t,right:i,bottom:a}){return{x:{min:t,max:i},y:{min:e,max:a}}}function t8({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function n8(e,t){if(!t)return e;const i=t({x:e.left,y:e.top}),a=t({x:e.right,y:e.bottom});return{top:i.y,left:i.x,bottom:a.y,right:a.x}}function Hp(e){return e===void 0||e===1}function Wg({scale:e,scaleX:t,scaleY:i}){return!Hp(e)||!Hp(t)||!Hp(i)}const sl=["rotate","rotateX","rotateY","rotateZ","skewX","skewY"];function Is(e){return Wg(e)||KR(e)||GR(e)}function GR(e){return e.z||e.rotate||e.rotateX||e.rotateY||e.rotateZ||e.skewX||e.skewY}function KR(e){return Dx(e.x)||Dx(e.y)}function Dx(e){return e&&e!=="0%"}function Ed(e,t,i){const a=e-i,o=t*a;return i+o}function Nx(e,t,i,a,o){return o!==void 0&&(e=Ed(e,o,a)),Ed(e,i,a)+t}function Zg(e,t=0,i=1,a,o){e.min=Nx(e.min,t,i,a,o),e.max=Nx(e.max,t,i,a,o)}function XR(e,{x:t,y:i}){Zg(e.x,t.translate,t.scale,t.originPoint),Zg(e.y,i.translate,i.scale,i.originPoint)}const Lx=.999999999999,kx=1.0000000000001;function r8(e,t,i,a=!1){const o=i.length;if(!o)return;t.x=t.y=1;let c,u;for(let f=0;fLx&&(t.x=1),t.yLx&&(t.y=1)}function ji(e,t){e.min+=t,e.max+=t}function zx(e,t,i,a,o=.5){const c=rn(e.min,e.max,o);Zg(e,t,i,c,a)}function Px(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Jf(e,t,i){const a=i??e;zx(e.x,Px(t.x,a.x),t.scaleX,t.scale,t.originX),zx(e.y,Px(t.y,a.y),t.scaleY,t.scale,t.originY)}function $R(e,t){return qR(n8(e.getBoundingClientRect(),t))}function i8(e,t,i){const a=$R(e,i),{scroll:o}=t;return o&&(ji(a.x,o.offset.x),ji(a.y,o.offset.y)),a}const a8=()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),{schedule:Fc}=uR(queueMicrotask,!1);function s8(e,t,i){const a=tr(e)?e:al(e);return a.run(sy("",a,t,i)),a.animation}const wc={};function o8(e,t){const i=Ut.now();e=fy(e);const a=({timestamp:o})=>{const c=o-i;c>=t&&(Gr(a),e(c-t))};return Kt.setup(a,!0),uy(()=>Gr(a))}function l8(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function c8(e){return cy(e)&&e.tagName==="svg"}function ed(e){return tr(e)?e.get():e}const _x=e=>typeof e=="number"?e:parseFloat(e),u8=ly.length,Vx=e=>typeof e=="number"||Ve.test(e);function f8(e,t,i,a,o,c){o?(e.opacity=rn(0,i.opacity??1,d8(a)),e.opacityExit=rn(t.opacity??1,0,h8(a))):c&&(e.opacity=rn(t.opacity??1,i.opacity??1,a));for(let u=0;uat?1:i(Zs(e,t,a))}function Qg(e,t){e.min=t.min,e.max=t.max}function Ri(e,t){Qg(e.x,t.x),Qg(e.y,t.y)}function Bx(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const ZR=1e-4,m8=1-ZR,p8=1+ZR,QR=.01,g8=0-QR,y8=0+QR;function jr(e){return e.max-e.min}function v8(e,t,i){return Math.abs(e-t)<=i}function Ix(e,t,i,a=.5){e.origin=a,e.originPoint=rn(t.min,t.max,e.origin),e.scale=jr(i)/jr(t),e.translate=rn(i.min,i.max,e.origin)-e.originPoint,(e.scale>=m8&&e.scale<=p8||isNaN(e.scale))&&(e.scale=1),(e.translate>=g8&&e.translate<=y8||isNaN(e.translate))&&(e.translate=0)}function Rd(e,t,i,a){Ix(e.x,t.x,i.x,a?.originX),Ix(e.y,t.y,i.y,a?.originY)}function Hx(e,t,i,a=0){const o=a?rn(i.min,i.max,a):i.min;e.min=o+t.min,e.max=e.min+jr(t)}function b8(e,t,i,a){Hx(e.x,t.x,i.x,a?.x),Hx(e.y,t.y,i.y,a?.y)}function Fx(e,t,i,a=0){const o=a?rn(i.min,i.max,a):i.min;e.min=t.min-o,e.max=e.min+jr(t)}function Cd(e,t,i,a){Fx(e.x,t.x,i.x,a?.x),Fx(e.y,t.y,i.y,a?.y)}function Yx(e,t,i,a,o){return e-=t,e=Ed(e,1/i,a),o!==void 0&&(e=Ed(e,1/o,a)),e}function x8(e,t=0,i=1,a=.5,o,c=e,u=e){if(Xi.test(t)&&(t=parseFloat(t),t=rn(u.min,u.max,t/100)-u.min),typeof t!="number")return;let f=rn(c.min,c.max,a);e===c&&(f-=t),e.min=Yx(e.min,t,i,f,o),e.max=Yx(e.max,t,i,f,o)}function qx(e,t,[i,a,o],c,u){x8(e,t[i],t[a],t[o],t.scale,c,u)}const S8=["x","scaleX","originX"],w8=["y","scaleY","originY"];function Gx(e,t,i,a){qx(e.x,t,S8,i?.x,a?.x),qx(e.y,t,w8,i?.y,a?.y)}const Kx=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Xx=Kx("applewebkit/")&&!Kx("chrome/")?Math.round:Di;function $x(e){e.min=Xx(e.min),e.max=Xx(e.max)}function E8(e){$x(e.x),$x(e.y)}const Wx=()=>({translate:0,scale:1,origin:0,originPoint:0}),qo=()=>({x:Wx(),y:Wx()}),Zx=()=>({min:0,max:0}),In=()=>({x:Zx(),y:Zx()});function Qx(e){return e.translate===0&&e.scale===1}function JR(e){return Qx(e.x)&&Qx(e.y)}function Jx(e,t){return e.min===t.min&&e.max===t.max}function R8(e,t){return Jx(e.x,t.x)&&Jx(e.y,t.y)}function eS(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function eC(e,t){return eS(e.x,t.x)&&eS(e.y,t.y)}function tS(e){return jr(e.x)/jr(e.y)}function nS(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class C8{constructor(){this.members=[]}add(t){P0(this.members,t);for(let i=this.members.length-1;i>=0;i--){const a=this.members[i];if(a===t||a===this.lead||a===this.prevLead)continue;const o=a.instance;(!o||o.isConnected===!1)&&!a.snapshot&&(gd(this.members,a),a.unmount())}t.scheduleRender()}remove(t){if(gd(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(t){for(let i=this.members.indexOf(t)-1;i>=0;i--){const a=this.members[i];if(a.isPresent!==!1&&a.instance?.isConnected!==!1)return this.promote(a),!0}return!1}promote(t,i){const a=this.lead;if(t!==a&&(this.prevLead=a,this.lead=t,t.show(),a)){a.updateSnapshot(),t.scheduleRender();const{layoutDependency:o}=a.options,{layoutDependency:c}=t.options;(o===void 0||o!==c)&&(t.resumeFrom=a,i&&(a.preserveOpacity=!0),a.snapshot&&(t.snapshot=a.snapshot,t.snapshot.latestValues=a.animationValues||a.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}function rS(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const oc={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ve.test(e))e=parseFloat(e);else return e;const i=rS(e,t.target.x),a=rS(e,t.target.y);return`${i}% ${a}%`}},T8={correct:(e,{treeScale:t,projectionDelta:i})=>{const a=e,o=di.parse(e);if(o.length>5)return a;const c=di.createTransformer(e),u=typeof o[0]!="number"?1:0,f=i.x.scale*t.x,h=i.y.scale*t.y;o[0+u]/=f,o[1+u]/=h;const m=rn(f,h,.5);return typeof o[2+u]=="number"&&(o[2+u]/=m),typeof o[3+u]=="number"&&(o[3+u]/=m),c(o)}},A8={borderRadius:Object.assign({},oc,{applyTo:ly.slice()}),borderTopLeftRadius:oc,borderTopRightRadius:oc,borderBottomLeftRadius:oc,borderBottomRightRadius:oc,boxShadow:T8};function M8(e,t,i){let a="";const o=e.x.translate/t.x,c=e.y.translate/t.y,u=i?.z||0;(o||c||u)&&(a=`translate3d(${o}px, ${c}px, ${u}px) `);let f="";if(i){const{transformPerspective:h}=i;h&&(a=`perspective(${h}px) ${a}`);for(let m=0;me.depth-t.depth;class O8{constructor(){this.children=[],this.isDirty=!1}add(t){P0(this.children,t),this.isDirty=!0}remove(t){gd(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(j8),this.isDirty=!1,this.children.forEach(t)}}const td={hasAnimatedSinceResize:!0,hasEverUpdated:!1},iS=["z","skew","skewZ"],D8=1e3;let N8=0;function aS(e,t,i,a){const{latestValues:o}=t;o[e]&&(i[e]=o[e],t.setStaticValue(e,0),a&&(a[e]=0))}const Fp=e=>e.instance&&il.get(e.instance)?.demote()&&e.resetSkewAndRotation();function tC(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const i=UR(t);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:o,layoutId:c}=e.options;window.MotionCancelOptimisedAnimation(i,"transform",Kt,!(o||c))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&tC(a)}function nC(e){if(e)return e.options.allowProjection!==!1?e.projection:nC(e.parent)}function rC({attachResizeListener:e,defaultParent:t,measureScroll:i,checkIsScrollRoot:a,resetTransform:o}){return Object.assign(wc,{...A8,...wc}),class{static create(u,f,h){const{layoutId:m,layout:g,drag:v,dragConstraints:S,layoutScroll:x,layoutRoot:E,layoutAnchor:w,layoutCrossfade:R}=f,T=u.projection=new this(u.latestValues,f["data-framer-portal-id"]?void 0:nC(u.parent));T.setOptions({layoutId:m,layout:g,alwaysMeasureLayout:!!v||S&&l8(S),visualElement:u,animationType:typeof g=="string"?g:"both",initialPromotionConfig:h,crossfade:R,layoutScroll:x,layoutRoot:E,layoutAnchor:w});const O=T.getStack()?.lead;O&&!T.root.isUpdateBlocked()&&(O.willUpdate(),O.scheduleCheckAfterUnmount())}constructor(u={},f=t?.()){this.id=N8++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(z8),this.nodes.forEach(F8),this.nodes.forEach(Y8),this.nodes.forEach(P8)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let h=0;hthis.root.updateBlockedByResize=!1;Kt.read(()=>{v=window.innerWidth}),e(u,()=>{const x=window.innerWidth;x!==v&&(v=x,this.root.updateBlockedByResize=!0,g?.(),g=o8(S,250),td.hasAnimatedSinceResize&&(td.hasAnimatedSinceResize=!1,this.nodes.forEach(lS)))})}f&&this.root.registerSharedNode(f,this),this.addLayoutListener()}addLayoutListener(){const{layoutId:u,layout:f,visualElement:h,animate:m}=this.options;!this.instance||this.hasLayoutListener||m===!1||!h||!(u||f)||(this.hasLayoutListener=!0,this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:v,hasRelativeLayoutChanged:S,layout:x})=>{if(this.isAnimationBlocked){this.target=void 0,this.relativeTarget=void 0;return}const E=this.options.transition||h.getDefaultTransition()||X8,{onLayoutAnimationStart:w,onLayoutAnimationComplete:R}=h.getProps(),T=!this.targetLayout||!eC(this.targetLayout,x),O=!v&&S;if(this.options.layoutRoot||this.resumeFrom||O||v&&(T||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const N={...ay(E,"layout"),onPlay:w,onComplete:R};(h.shouldReduceMotion||this.options.layoutRoot)&&(N.delay=0,N.type=!1),this.startAnimation(N),this.setAnimationOrigin(g,O,N.path)}else v||lS(this),this.isLead()&&this.options.onExitComplete?.();this.targetLayout=x}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this),this.getStack()?.remove(this),this.parent?.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),this.hasLayoutListener=!1,Gr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes?.forEach(q8),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete?.();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&tC(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;Fp(this),this.isLayoutDirty=!0;for(let g=0;gu.members.length?u.removeLeadSnapshot():this.sharedNodes.delete(f))}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Kt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Kt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!jr(this.snapshot.measuredBox.x)&&!jr(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h{const L=j/1e3,P=N?.(L);cS(S.x,u.x,L),cS(S.y,u.y,L),P&&(S.x.translate=P.x,S.y.translate=P.y),this.setTargetDelta(S),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Cd(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),G8(this.relativeTarget,this.relativeTargetOrigin,x,L),O&&R8(this.relativeTarget,O)&&(this.isProjectionDirty=!1),O||(O=In()),Ri(O,this.relativeTarget)),E&&(this.animationValues=v,f8(v,g,this.latestValues,L,T,R)),P?.rotate!==void 0&&(this.animationValues||(this.animationValues=v),this.animationValues.pathRotation=P.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=L},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Gr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Kt.update(()=>{td.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=al(0)),this.motionValue.jump(0,!1),this.currentAnimation=s8(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),u.onUpdate&&u.onUpdate(f)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),N4(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta?.(D8),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead(),{targetWithTransforms:f,layout:h,latestValues:m}=u;let{target:g}=u;if(!(!f||!g||!h)){if(this!==u&&this.layout&&h&&iC(this.options.animationType,this.layout.layoutBox,h.layoutBox)){const{layoutBox:v}=this.layout,S=g;g=this.target||In(),fS(g.x,S.x,v.x),fS(g.y,S.y,v.y)}Ri(f,g),Jf(f,m),Rd(this.projectionDeltaWithTransform,this.layoutCorrected,f,m)}}registerSharedNode(u,f){this.sharedNodes.has(u)||this.sharedNodes.set(u,new C8),this.sharedNodes.get(u).add(f);const m=f.options.initialPromotionConfig;f.promote({transition:m?.transition,preserveFollowOpacity:m?.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(f):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:f,preserveFollowOpacity:h}={}){this.getStack()?.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){return this.getStack()?.relegate(this)||!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;const{latestValues:f}=u;if(!GR(f))return;const h={};for(let m=0;mu.currentAnimation?.stop()),this.root.nodes.forEach(sS),this.root.sharedNodes.clear()}}}function L8(e){e.updateLayout(),U8(e)}function k8(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:a}=e.layout,{animationType:o}=e.options,c=t.source!==e.layout.source,u=(x,E)=>{if(o==="size")Ai(w=>{const R=jr(x[w]);x[w].min=E[w].min,x[w].max=x[w].min+R});else if(o==="x"||o==="y"){const w=o==="x"?"y":"x";Qg(x[w],E[w])}else iC(o,t.layoutBox,i)&&Ai(w=>{const R=jr(E[w]);x[w].max=x[w].min+R,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[w].max=e.relativeTarget[w].min+R)})},f=c?t.measuredBox:t.layoutBox;u(f,i);const h=qo();Rd(h,i,t.layoutBox);const m=qo();Rd(m,c?e.applyTransform(a,!0):i,f);const g=!JR(h);let v=!1;const S=e.getClosestProjectingParent();if((!c||S?.options.layoutRoot&&e.resumeFrom?.path.includes(S))&&S&&!S.resumeFrom){const{snapshot:x,layout:E}=S;if(x&&E){const w=e.options.layoutAnchor||void 0,R=In();Cd(R,c?e.resumeFrom.applyTransform(t.layoutBox,!0,void 0,!0,S.depth+1):t.layoutBox,x.layoutBox,w);const T=In();Cd(T,i,E.layoutBox,w),c&&u(R,T),eC(R,T)||(v=!0),S.options.layoutRoot&&(e.relativeTarget=T,e.relativeTargetOrigin=R,e.relativeParent=S)}}e.notifyListeners("didUpdate",{layout:i,snapshot:t,delta:m,layoutDelta:h,hasLayoutChanged:g,hasRelativeLayoutChanged:v})}else e.isLead()&&e.options.onExitComplete?.();e.options.transition=void 0}function z8(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function P8(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function _8(e){e.clearSnapshot()}function sS(e){e.clearMeasurements()}function V8(e){e.isLayoutDirty=!0,e.updateLayout()}function oS(e){e.isLayoutDirty=!1}function U8(e){const{snapshot:t,dragAncestor:i}=e,a=i?.isAnimationBlocked&&i.layout;if(!t||!a||e.resumeFrom||e.isAnimationBlocked)return;const o=i.dragSnapshot;Ai(c=>ji(t.layoutBox[c],a.layoutBox[c].min-o.layoutBox[c].min))}function B8(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.dragSnapshot||e.layout,e.isLayoutDirty=!0)}function I8(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function H8(e){const{visualElement:t}=e.options;t?.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function lS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function F8(e){e.resolveTargetDelta()}function Y8(e){e.calcProjection()}function q8(e){e.resetSkewAndRotation()}function cS(e,t,i){e.translate=rn(t.translate,0,i),e.scale=rn(t.scale,1,i),e.origin=t.origin,e.originPoint=t.originPoint}function uS(e,t,i,a){e.min=rn(t.min,i.min,a),e.max=rn(t.max,i.max,a)}function G8(e,t,i,a){uS(e.x,t.x,i.x,a),uS(e.y,t.y,i.y,a)}function K8(e){return e.animationValues?.opacityExit!==void 0}const X8={duration:.45,ease:[.4,0,.1,1]};function fS(e,t,i){e.max=jr(i)+(e.min=t.min)}function iC(e,t,i){return e==="position"||e==="preserve-aspect"&&!v8(tS(t),tS(i),.2)}function $8(e){return e!==e.root&&e.scroll?.wasRoot}function Qs(e,t,i,a={passive:!0}){return e.addEventListener(t,i,a),()=>e.removeEventListener(t,i,a)}const W8=rC({attachResizeListener:(e,t)=>Qs(e,"resize",t),measureScroll:a8,checkIsScrollRoot:()=>!0}),nd={current:void 0},aC=rC({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!nd.current){const e=new W8({});e.mount(window),e.setOptions({layoutScroll:!0}),nd.current=e}return nd.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Z8=new WeakMap;function $d(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Yc(e){return typeof e=="string"||Array.isArray(e)}const Wd=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],dS=["initial"].concat(Wd);function Zd(e){if($d(e.animate))return!0;for(let t=0;tTd.current=e.matches;e.addEventListener("change",t),t()}else Td.current=!1}const hS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Ad={};function lC(e){Ad=e}function ej(){return Ad}class tj{scrapeMotionValuesFromProps(t,i,a){return{}}constructor({parent:t,props:i,presenceContext:a,reducedMotionConfig:o,skipAnimations:c,blockInitialAnimation:u,visualState:f},h={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=ty,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const x=Ut.now();this.renderScheduledAto.delete(this)}}this.values.forEach((a,o)=>this.bindToMotionValue(o,a)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(hy.current||oC(),this.shouldReduceMotion=Td.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection?.unmount(),Gr(this.notifyUpdate),Gr(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree?.(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const i=this.features[t];i&&(i.unmount(),i.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),(this.enteringChildren||(this.enteringChildren=new Set)).add(t)}removeChild(t){this.children.delete(t),this.enteringChildren?.delete(t)}bindToMotionValue(t,i){if(this.valueSubscriptions.get(t)?.(),i.accelerate&&qg.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:f,times:h,ease:m,duration:g}=i.accelerate,v=new jR({element:this.current,name:t,keyframes:f,times:h,ease:m,duration:br(g)}),S=u(v);this.valueSubscriptions.set(t,()=>{S(),v.cancel()});return}const a=cs.has(t);a&&this.onBindTransform&&this.onBindTransform();const o=i.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&Kt.preRender(this.notifyUpdate),a&&(this.projection&&(this.projection.isTransformDirty=!0),il.get(this.current)?.check()),this.scheduleRender()});let c;typeof window<"u"&&window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,t,i)),this.valueSubscriptions.set(t,()=>{o(),c?.()})}sortNodePosition(t){return!this.current||!t.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ad){const i=Ad[t];if(!i)continue;const{isEnabled:a,Feature:o}=i;if(!this.features[t]&&o&&a(this.props)&&(this.features[t]=new o(this)),this.features[t]){const c=this.features[t];c.isMounted?c.update():(c.mount(),c.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):In()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,i){this.latestValues[t]=i}update(t,i){const{transformTemplate:a,onUpdate:o}=this.props;(t.transformTemplate||a)&&this.scheduleRender(),(t.transformTemplate&&!a||t.onUpdate&&!o)&&il.get(this.current)?.demote(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let c=0;c{this.current&&(this.current.textContent=`${i}`)}))}}function uC(e,{style:t,vars:i},a,o){const c=e.style;let u;for(u in t)c[u]=t[u];o?.applyProjectionStyles(c,a);for(u in i)c.setProperty(u,i[u])}function fC(e,{layout:t,layoutId:i}){return cs.has(e)||e.startsWith("origin")||(t||i!==void 0)&&(!!wc[e]||e==="opacity")}function my(e,t,i){const a=e.style,o=t?.style,c={};if(!a)return c;for(const u in a)(tr(a[u])||o&&tr(o[u])||fC(u,e)||i?.getValue(u)?.liveStyle!==void 0)&&(c[u]=a[u]);return c}function nj(e){return window.getComputedStyle(e)}class rj extends cC{constructor(){super(...arguments),this.type="html",this.renderInstance=uC}mount(t){super.mount(t)}readValueFromInstance(t,i){if(cs.has(i))return this.projection?.isProjecting?Hc(i):H4(t,i);{const a=nj(t),o=(rR(i)?a.getPropertyValue(i):a[i])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:i}){return $R(t,i)}build(t,i,a){dy(t,i,a.transformTemplate)}scrapeMotionValuesFromProps(t,i,a){return my(t,i,a)}}const qc=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function py(e){return{point:{x:e.pageX,y:e.pageY}}}const ij=e=>t=>qc(t)&&e(t,py(t));function jc(e,t,i,a){return Qs(e,t,ij(i),a)}const rd=new WeakMap;let id;const dC=(e,t,i)=>(a,o)=>o&&o[0]?o[0][e+"Size"]:cy(a)&&"getBBox"in a?a.getBBox()[t]:a[i],aj=dC("inline","width","offsetWidth"),sj=dC("block","height","offsetHeight");function oj({target:e,borderBoxSize:t}){rd.get(e)?.forEach(i=>{i(e,{get width(){return aj(e,t)},get height(){return sj(e,t)}})})}function lj(e){e.forEach(oj)}function cj(){typeof ResizeObserver>"u"||(id=new ResizeObserver(lj))}function uj(e,t){id||cj();const i=IR(e);return i.forEach(a=>{let o=rd.get(a);o||(o=new Set,rd.set(a,o)),o.add(t),id?.observe(a)}),()=>{i.forEach(a=>{const o=rd.get(a);o?.delete(t),o?.size||id?.unobserve(a)})}}const ad=new Set;let Go;function fj(){Go=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};ad.forEach(t=>t(e))},window.addEventListener("resize",Go)}function dj(e){return ad.add(e),Go||fj(),()=>{ad.delete(e),!ad.size&&typeof Go=="function"&&(window.removeEventListener("resize",Go),Go=void 0)}}function mS(e,t){return uy(typeof e=="function"?dj(e):uj(e,t))}const pS=(e,t)=>Math.abs(e-t);function hj(e,t){const i=pS(e.x,t.x),a=pS(e.y,t.y);return Math.sqrt(i**2+a**2)}const gS=new Set(["auto","scroll"]);class hC{constructor(t,i,{transformPagePoint:a,contextWindow:o=window,dragSnapToOrigin:c=!1,distanceThreshold:u=3,element:f,immediate:h}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.onElementScroll=E=>{this.handleScroll(E.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=jf(this.lastRawMoveEventInfo,this.transformPagePoint));const E=qp(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,R=hj(E.offset,{x:0,y:0})>=this.distanceThreshold;if(!w&&!R)return;const{point:T}=E;this.history.push({...T,timestamp:Ut.now()});const{onStart:O,onMove:N}=this.handlers;w||(O?.(this.lastMoveEvent,E),this.startEvent=this.lastMoveEvent),N?.(this.lastMoveEvent,E)},this.handlePointerMove=(E,w)=>{this.handleScroll(window),this.lastMoveEvent=E,this.lastRawMoveEventInfo=w,this.lastMoveEventInfo=jf(w,this.transformPagePoint),this.hasPendingMove=!0,Kt.update(this.updatePoint,!0)},this.handlePointerUp=(E,w)=>{this.hasPendingMove&&this.updatePoint(),this.end();const{onEnd:R,onSessionEnd:T,resumeAnimation:O}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&O?.(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=qp(E.type==="pointercancel"?this.lastMoveEventInfo:jf(w,this.transformPagePoint),this.history);this.startEvent&&R?.(E,N),T?.(E,N)},!qc(t))return;this.dragSnapToOrigin=c,this.handlers=i,this.transformPagePoint=a,this.distanceThreshold=h?0:u,this.contextWindow=o||window;const m=py(t),g=jf(m,this.transformPagePoint),{point:v}=g;this.history=[{...v,timestamp:Ut.now()}];const{onSessionStart:S}=i;S&&S(t,qp(g,this.history));const x={passive:!0,capture:!0};this.removeListeners=nl(jc(this.contextWindow,"pointermove",this.handlePointerMove,x),jc(this.contextWindow,"pointerup",this.handlePointerUp,x),jc(this.contextWindow,"pointercancel",this.handlePointerUp,x)),f&&this.startScrollTracking(f),h&&(this.handlePointerMove(t,m),this.updatePoint())}startScrollTracking(t){let i=t.parentElement;for(;i;){const a=getComputedStyle(i);(gS.has(a.overflowX)||gS.has(a.overflowY))&&this.scrollPositions.set(i,Yp(i)),i=i.parentElement}this.scrollPositions.set(window,Yp(window)),this.removeScrollListeners=nl(Qs(window,"scroll",this.onElementScroll,{capture:!0}),Qs(window,"scroll",this.onWindowScroll,{}))}handleScroll(t){const i=this.scrollPositions.get(t);if(!i)return;const a=t===window,o=Yp(t),c={x:o.x-i.x,y:o.y-i.y};c.x===0&&c.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=c.x,this.lastMoveEventInfo.point.y+=c.y):this.history.length>0&&(this.history[0].x-=c.x,this.history[0].y-=c.y),this.scrollPositions.set(t,o),Kt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners?.(),this.removeScrollListeners?.(),this.scrollPositions.clear(),Gr(this.updatePoint)}}const Yp=e=>e===window?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop};function jf(e,t){return t?{point:t(e.point)}:e}function yS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function qp({point:e},t){return{point:e,delta:yS(e,mC(t)),offset:yS(e,mj(t)),velocity:pj(t,.1)}}function mj(e){return e[0]}function mC(e){return e[e.length-1]}function pj(e,t){if(e.length<2)return{x:0,y:0};let i=e.length-1,a=null;const o=mC(e);for(;i>=0&&(a=e[i],!(o.timestamp-a.timestamp>br(t)));)i--;if(!a)return{x:0,y:0};a===e[0]&&e.length>2&&o.timestamp-a.timestamp>br(t)*2&&(a=e[1]);const c=Kr(o.timestamp-a.timestamp);if(c===0)return{x:0,y:0};const u={x:(o.x-a.x)/c,y:(o.y-a.y)/c};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}const gj=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function yj(e){return gj.has(e.tagName)||e.isContentEditable===!0}const vj=new Set(["INPUT","SELECT","TEXTAREA"]);function bj(e){return vj.has(e.tagName)||e.isContentEditable===!0}const Ci={x:!1,y:!1};function Md(){return Ci.x||Ci.y}function xj(e){return e==="x"||e==="y"?Ci[e]?null:(Ci[e]=!0,()=>{Ci[e]=!1}):Ci.x||Ci.y?null:(Ci.x=Ci.y=!0,()=>{Ci.x=Ci.y=!1})}function Sj(e,{min:t,max:i},a){return t!==void 0&&ei&&(e=a?rn(i,e,a.max):Math.min(e,i)),e}function vS(e,t,i){return{min:t!==void 0?e.min+t:void 0,max:i!==void 0?e.max+i-(e.max-e.min):void 0}}function wj(e,{top:t,left:i,bottom:a,right:o}){return{x:vS(e.x,i,o),y:vS(e.y,t,a)}}function bS(e,t){let i=t.min-e.min,a=t.max-e.max;return t.max-t.mina?i=Zs(t.min,t.max-a,e.min):a>o&&(i=Zs(e.min,e.max-o,t.min)),Aa(0,1,i)}function Cj(e,t){const i={};return t.min!==void 0&&(i.min=t.min-e.min),t.max!==void 0&&(i.max=t.max-e.min),i}const Jg=.35;function Tj(e=Jg){return e===!1?e=0:e===!0&&(e=Jg),{x:xS(e,"left","right"),y:xS(e,"top","bottom")}}function xS(e,t,i){return{min:SS(e,t),max:SS(e,i)}}function SS(e,t){return typeof e=="number"?e:e[t]||0}function wS(e){let t="";for(const i of e.path){i.scroll=void 0,i.updateScroll();const{scroll:a}=i;i!==e.root&&a&&(t+=a.offset.x+","+a.offset.y+",")}return t}const Aj=new WeakMap;class Mj{constructor(t,i=()=>t.getProps()){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=In(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t,this.readProps=i}start(t,i={}){if(this.visualElement.presenceContext?.isPresent===!1)return;const a=m=>{i.snapToCursor&&this.snapToCursor(m),this.stopAnimation()},o=(m,g)=>{const{drag:v,dragConstraints:S,dragPropagation:x,onDragStart:E}=this.getProps();if(v&&!x&&(this.openDragLock?.(),this.openDragLock=xj(v),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=g,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints();const{projection:w}=this.visualElement;w&&(w.isAnimationBlocked=!0,w.target=void 0),Ai(R=>{let T=this.getAxisMotionValue(R).get()||0;if(Xd(T)&&(T=oy(T,this.visualElement.current)||0),Ve.test(T))T=parseFloat(T);else if(Xi.test(T)){const O=w?.layout?.layoutBox[R];O&&(T=jr(O)*(parseFloat(T)/100))}this.originPoint[R]=T}),this.point=typeof S=="function"&&S(this),E&&Kt.update(()=>E(m,g),!1,!0),Xg(this.visualElement,"transform"),this.visualElement.animationState?.setActive("whileDrag",!0)},c=(m,g)=>{this.latestPointerEvent=m,this.latestPanInfo=g;const{dragPropagation:v,dragDirectionLock:S,onDirectionLock:x,onDrag:E}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:w}=g;if(S&&this.currentDirection===null){if(this.currentDirection=Oj(w),this.currentDirection===null)return;x&&x(this.currentDirection)}this.updateAxis("x",w),this.updateAxis("y",w),this.point&&this.point.move(),this.visualElement.render(),E&&Kt.update(()=>E(m,g),!1,!0)},u=(m,g)=>{this.latestPointerEvent=m,this.latestPanInfo=g,this.stop(m,g),this.latestPointerEvent=null,this.latestPanInfo=null},f=()=>{const{dragSnapToOrigin:m}=this.getProps();(m||this.constraints||this.point)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:h}=this.getProps();this.panSession=new hC(t,{onSessionStart:a,onStart:o,onMove:c,onSessionEnd:u,resumeAnimation:f},{...i,transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,contextWindow:this.visualElement.current?.ownerDocument.defaultView,element:this.visualElement.current})}stop(t,i,a){const o=t||this.latestPointerEvent,c=i||this.latestPanInfo,u=this.isDragging;if(this.cancel(),!u||!c||!o)return;const{velocity:f}=c;this.startAnimation(f,a);const{onDragEnd:h}=this.getProps();h&&Kt.postRender(()=>h(o,c))}cancel(){this.isDragging=!1;const{projection:t,animationState:i}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession(),!this.getProps().dragPropagation&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),i?.setActive("whileDrag",!1)}endPanSession(){this.panSession?.end(),this.panSession=void 0}updateAxis(t,i){const{drag:a}=this.readProps();if(!i||!_o(t,a,this.currentDirection))return;const o=this.getAxisMotionValue(t);let c=this.originPoint[t]+i[t];const u=this.constraints&&this.constraints[t];u&&(c=Sj(c,u,this.elastic[t])),this.point?this.point[t]=c:o.set(c)}resolveConstraints(){const{dragConstraints:t,dragElastic:i}=this.getProps(),{projection:a}=this.visualElement,o=a&&(a.layout||a.measure(!1)),c=this.constraints;lc(t)?(!this.constraints||this.scroll!==wS(a))&&(this.constraints=this.resolveRefConstraints()):t&&o&&typeof t=="object"?this.constraints=wj(o.layoutBox,t):this.constraints=!1,this.elastic=Tj(i),c!==this.constraints&&!lc(t)&&o&&this.constraints&&!this.hasMutatedConstraints&&Ai(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=Cj(o.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:i}=this.getProps();if(!lc(t))return!1;const a=ES(t),{projection:o}=this.visualElement;if(!o||!o.layout)return!1;this.scroll=wS(o);const c=i8(a,o.root,this.visualElement.getTransformPagePoint());let u=Ej(o.layout.layoutBox,o.removeElementScroll(c));if(i){const f=i(t8(u));this.hasMutatedConstraints=!!f,f&&(u=qR(f))}return u}startAnimation(t,i){const{drag:a,dragMomentum:o,dragElastic:c,dragTransition:u,dragSnapToOrigin:f,onDragTransitionEnd:h}=this.getProps(),m={bounceStiffness:c?200:1e6,bounceDamping:c?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...u},g=x=>o&&!(this.point&&f)&&_o(x,i||a,this.currentDirection)?t[x]:0;if(this.point&&!f)return this.point.release({x:g("x"),y:g("y")},m).then(h);const v=this.constraints||{},S=Ai(x=>{if(!_o(x,i||a,this.currentDirection))return;let E=v[x]||{};(f===!0||f===x)&&(E={min:0,max:0});const w={type:"inertia",velocity:g(x),...m,...E};return this.startAxisValueAnimation(x,w)});return Promise.all(S).then(h)}startAxisValueAnimation(t,i){const a=this.getAxisMotionValue(t);return Xg(this.visualElement,t),a.start(sy(t,a,0,i,this.visualElement,!1))}stopAnimation(){Ai(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const i=`_drag${t.toUpperCase()}`,o=this.readProps()[i];return o||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor({clientX:t,clientY:i}){const{drag:a}=this.getProps(),o={x:t,y:i},c=this.visualElement.getTransformPagePoint()?.(o)||o,u=this.visualElement.measureViewportBox();Ai(f=>{if(!_o(f,a,this.currentDirection))return;const h=this.getAxisMotionValue(f),{min:m,max:g}=u[f];h.set((h.get()||0)+c[f]-rn(m,g,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:i}=this.getProps(),{projection:a}=this.visualElement;if(!lc(i)||!a||!this.constraints)return;this.stopAnimation();const o=this.constraints,c={x:0,y:0};Ai(f=>{const h=this.getAxisMotionValue(f).get();c[f]=Rj({min:h,max:h},o[f])});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",a.root?.updateScroll(),a.updateLayout(),this.constraints=!1,this.resolveConstraints(),Ai(f=>{const h=this.getAxisMotionValue(f);if(!_o(f,t,null)||!h.get())return;const{min:m,max:g}=this.constraints[f];h.set(rn(m,g,c[f]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Aj.set(this.visualElement,this);const t=this.visualElement.current,i=jc(t,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps(),S=m.target,x=S!==t&&bj(S);g&&v&&!x&&this.start(m)});let a;const o=()=>{const{dragConstraints:m}=this.getProps(),g=lc(m)&&ES(m);g&&(this.constraints=this.resolveRefConstraints(),a||(a=jj(t,g,()=>this.scalePositionWithinConstraints())))},{projection:c}=this.visualElement,u=c.addEventListener("measure",o);c.layout||(c.root?.updateScroll(),c.updateLayout()),Kt.read(o);const f=Qs(window,"resize",()=>this.scalePositionWithinConstraints()),h=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(Ai(v=>{if(!_o(v,this.getProps().drag,this.currentDirection))return;const S=this.getAxisMotionValue(v);this.originPoint[v]+=m[v].translate,S.set(S.get()+m[v].translate)}),this.visualElement.render())}));return()=>{f(),i(),u(),h(),a?.()}}getProps(){const t=this.readProps(),{dragElastic:i=Jg,dragMomentum:a=!0}=t;return{...t,dragElastic:i,dragMomentum:a}}}function lc(e){return!!e&&typeof e=="object"&&("current"in e||"nodeType"in e)}const ES=e=>"current"in e?e.current:e;function RS(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function jj(e,t,i){const a=mS(e,RS(i)),o=mS(t,RS(i));return()=>{a(),o()}}function _o(e,t,i){return(t===!0||t===e)&&(i===null||i===e)}function Oj(e,t=10){let i=null;return Math.abs(e.y)>t?i="y":Math.abs(e.x)>t&&(i="x"),i}function pC(e,t){const i=IR(e),a=new AbortController,o={passive:!0,...t,signal:a.signal},c=uy(()=>a.abort());return[i,o,c]}function Dj(e){return!(e.pointerType==="touch"||Md())}function Nj(e,t,i={}){t=fy(t);const[a,o,c]=pC(e,i);return a.forEach(u=>{let f=!1,h=!1,m;const g=()=>{u.removeEventListener("pointerleave",E)},v=R=>{m&&(m(R),m=void 0),g()},S=R=>{f=!1,window.removeEventListener("pointerup",S),window.removeEventListener("pointercancel",S),h&&(h=!1,v(R))},x=()=>{f=!0,window.addEventListener("pointerup",S,o),window.addEventListener("pointercancel",S,o)},E=R=>{if(R.pointerType!=="touch"){if(f){h=!0;return}v(R)}},w=R=>{if(!Dj(R))return;h=!1;const T=t(u,R);typeof T=="function"&&(m=T,u.addEventListener("pointerleave",E,o))};u.addEventListener("pointerenter",w,o),u.addEventListener("pointerdown",x,o)}),c}const gC=(e,t)=>t?e===t?!0:gC(e,t.parentElement):!1,e0=new WeakSet;function CS(e){return t=>{t.key==="Enter"&&e(t)}}function Gp(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Lj=(e,t)=>{let i=!1;const a=CS(()=>{i||e0.has(e)||(i=!0,Gp(e,"down"))}),o=CS(()=>{i&&(i=!1,Gp(e,"up"))});e.addEventListener("keydown",a,t),e.addEventListener("keyup",o,t),e.addEventListener("blur",()=>{e.removeEventListener("keydown",a),e.removeEventListener("keyup",o),i&&Gp(e,"cancel")},{...t,once:!0})};function kj(e){return qc(e)&&!Md()}const TS=new WeakSet,zj=100,Pj=8,AS=(e,t,i)=>Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)>i,MS=e=>e.preventDefault();function _j(e,t,i={}){t=fy(t);const[a,o,c]=pC(e,i),u=new WeakMap,f=h=>{const m=h.currentTarget;if(!kj(h)||TS.has(h))return;i.stopPropagation&&TS.add(h);const{count:g=1,countTimeout:v=.3,hold:S=0,repeat:x}=i,E=Ut.now(),w=br(S),R=br(v);let T=u.get(m);T?.expire(AS(T.event,h,zj))?T=void 0:T&&(Gr(T.expire),u.delete(m));const O=T?T.count+1:1,N=O>=g,j=N&&(S||x);let L=!S,P=0,D;if(e0.add(m),T)D=T.handlers;else{const Z=t(m,h);D=typeof Z=="function"?{onComplete:Z}:Z||{}}N&&L&&D.onActive?.();const A=br(x);let F=w||A,H=E+F,X=!0;const J=()=>{if(o.signal.aborted)return Gr(J);let Z=Math.min(1-(H-Ut.now())/F,1);X&&Z<1&&(Z=0),X=!1,D.onHold?.(Z),!(Z<1)&&(L?D.onRepeat?.(++P):(L=!0,D.onActive?.()),x?(X=!0,H+=F=A):Gr(J))},$={...o,capture:!0},ee=(Z,Y)=>{if(window.removeEventListener("pointerup",re,$),window.removeEventListener("pointercancel",V,$),window.removeEventListener("pointermove",K,$),m.removeEventListener("contextmenu",MS),Gr(J),e0.delete(m),!!qc(Z))if(Md()&&(Y=!1),Y&&!N){const _=Ut.now(),M=z=>{const B=o.signal.aborted;if(B||z===!0||Ut.now()-_>R)return Gr(M),u.delete(m),B||D.onComplete?.(Z,{success:!1}),!0};u.set(m,{count:O,event:h,handlers:D,expire:M}),Kt.update(M,!0)}else D.onComplete?.(Z,{success:Y&&L})},re=Z=>{ee(Z,m===window||m===document||i.useGlobalTarget||gC(m,Z.target))},V=Z=>{ee(Z,!1)},K=Z=>{qc(Z)&&((x||!L)&&AS(h,Z,Pj)||g>1&&Md())&&V(Z)};window.addEventListener("pointerup",re,$),window.addEventListener("pointercancel",V,$),(j||g>1)&&window.addEventListener("pointermove",K,$),j&&(Kt.update(J,!0),m.addEventListener("contextmenu",MS,{...o,passive:!1}))};return a.forEach(h=>{(i.useGlobalTarget?window:h).addEventListener("pointerdown",f,o),Qf(h)&&(h.addEventListener("focus",()=>Lj(h,o),o),!yj(h)&&!h.hasAttribute("tabindex")&&(h.tabIndex=0))}),c}class ys{constructor(t){this.isMounted=!1,this.node=t}update(){}}const yC=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),vC=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Vj(e,t,i,a){uC(e,t,void 0,a);for(const o in t.attrs)e.setAttribute(yC.has(o)?o:HR(o),t.attrs[o])}function bC(e,t,i){const a=my(e,t,i);for(const o in e)if(o!=="children"&&(tr(e[o])||tr(t[o]))){const c=Ra.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;a[c]=e[o]}return a}class Uj extends cC{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=In}getBaseTargetFromProps(t,i){return cs.has(i)?super.getBaseTargetFromProps(t,i)??Hc(i):t[i]}getDefaultValue(t){return cs.has(t)?this.latestValues[t]??Hc(t):void 0}readValueFromInstance(t,i){if(cs.has(i)){const a=wR(i);return a&&a.default||0}if(FR.includes(i)){const o=getComputedStyle(t)[i];if(typeof o=="string"&&o)return o.trim()}return i=yC.has(i)?i:HR(i),t.getAttribute(i)}scrapeMotionValuesFromProps(t,i,a){return bC(t,i,a)}build(t,i,a){YR(t,i,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,i,a,o){Vj(t,i,a,o)}mount(t){this.isSVGTag=vC(t.tagName),super.mount(t)}}function xC(e,t){if(!Array.isArray(t))return!1;const i=t.length;if(i!==e.length)return!1;for(let a=0;ae?.out===!0?e:e?.out;function Ij(e){let t=f=>Promise.all(f.map(({animation:h,options:m})=>Y6(e,h,m))),i=OS(),a=!0,o=!1;function c(f){const{props:h,parent:m,manuallyAnimateOnMount:g}=e,{initial:v}=h,S=a||o,x=[],E=(L=v)=>typeof L!="boolean"&&$s(e,Array.isArray(L)?L[0]:L,e.presenceContext?.custom)||void 0,w=new Map;let R={},T=1/0,O=e;do O=O.props.inherit!==!1&&O.parent;while(O&&!O.isControllingVariants);const N=S&&jS(E(v??(O&&O.props.initial))?.transition);if(Bj.forEach((L,P)=>{const D=i[L],A=h[L],F=O&&O.props[L],H=A!==void 0?A:Yc(F)||F===!1?F:void 0,X=Yc(H),J=L===f?D.isActive:null,$=X&&A===void 0&&!(S&&g);if(D.protectedKeys={...R},!D.isActive&&J===null||!H&&!D.prevProp||$d(H)||typeof H=="boolean")return;if(J===!1&&(T=P),L==="exit"&&D.isActive&&J!==!0){R={...R,...D.prevResolvedValues};return}const ee=Hj(D.prevProp,H);let re=ee||X&&(J&&!$||P>T),V=!1;const K=Array.isArray(H)?H:[H];let Z={},Y;if(J!==!1)for(const M of K){const{transition:z,transitionEnd:B,...I}=$s(e,M,PR(e,L))||{};Z={...Z,...I,...B},Y=jS(z)||Y}const{prevResolvedValues:_}=D;for(const M in{..._,...Z}){if(M in R)continue;const z=Z[M],B=_[M],I=Array.isArray(z)&&Array.isArray(B)?!xC(z,B)||ee:z!==B;let W;if(I&&z==null)w.has(M)||w.set(M,D.prevOut);else if(I||z!==void 0&&w.has(M)){re=!0,W=w.get(M)||N,w.delete(M)&&(V=!0),D.needsAnimating[M]=!0;const ie=e.getValue(M);ie&&(ie.liveStyle=!1)}else D.protectedKeys[M]=!0;D.out[M]=W}if(D.prevProp=H,D.prevResolvedValues=Z,D.prevOut=Y,D.isActive&&(R={...R,...Z}),re&&(!($&&ee)||V))for(const M of K){const z={type:L};if(typeof M=="string"&&S&&g&&m?.enteringChildren){const B=$s(m,M)?.transition?.delayChildren;z.delay=kR(m.enteringChildren,e,B)}x.push({animation:M,options:z})}}),w.size){const L={},P=E();let D=P?.transition;w.forEach((A,F)=>{A&&(D={...D||e.getDefaultTransition(),[F]:A});const H=e.getValue(F);H&&(H.liveStyle=!0);const X=P&&!Array.isArray(v)?P[F]:void 0,J=e.getBaseTargetFromProps(h,F);L[F]=(X!==void 0?X:J!==void 0&&!tr(J)?J:e.initialValues[F]===void 0?e.baseTarget[F]:void 0)??null}),D&&(L.transition=D),x.push({animation:L})}const j=S&&e.blockInitialAnimation||a&&!g&&(h.initial===!1||h.initial===h.animate);return a=o=!1,!j&&x.length?t(x):Promise.resolve()}function u(f,h){if(i[f].isActive===h)return Promise.resolve();e.variantChildren?.forEach(g=>g.animationState?.setActive(f,h)),i[f].isActive=h;const m=c(f);for(const g in i)i[g].protectedKeys={};return m}return{animateChanges:c,setActive:u,setAnimateFunction:f=>{t=f(e)},getState:()=>i,reset:()=>{i=OS(),o=!0}}}function Hj(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!xC(t,e):!1}function OS(){const e={};for(const t of Wd)e[t]={isActive:t==="animate",protectedKeys:{},needsAnimating:{},prevResolvedValues:{},out:{}};return e}const Gc=b.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function DS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Fj(...e){return t=>{let i=!1;const a=e.map(o=>{const c=DS(o,t);return!i&&typeof c=="function"&&(i=!0),c});if(i)return()=>{for(let o=0;o{const{width:t,height:i}=e?.getBoundingClientRect()||{};return[t/e?.offsetWidth||1,i/e?.offsetHeight||1]},SC=e=>{let{left:t,top:i}=e.getBoundingClientRect(),a=e;for(;a=a.parentElement||a.parentNode?.host;){const{scrollLeft:u,scrollTop:f}=a;if(u||f){const[h,m]=NS(a);t+=u*h,i+=f*m}if(getComputedStyle(a).position==="fixed")break}const[o,c]=NS(e.offsetParent);return[t/o,i/c]};class qj extends b.Component{getSnapshotBeforeUpdate(t){const i=this.props.getElement();if(Qf(i)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=i.offsetParent,o=Qf(a)&&a.offsetWidth||0,c=Qf(a)&&a.offsetHeight||0,u=getComputedStyle(i),f=this.props.sizeRef.current;f.height=parseFloat(u.height),f.width=parseFloat(u.width),f.top=i.offsetTop,f.left=i.offsetLeft,f.right=o-f.width-f.left,f.bottom=c-f.height-f.top,f.direction=u.direction,f.point=SC(i)}return null}componentDidUpdate(){}render(){return this.props.children}}function Gj({children:e,isPresent:t,anchorX:i,anchorY:a,root:o,pop:c,popNode:u}){const f=b.useId(),h=b.useRef(null),m=b.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:g}=b.useContext(Gc),v=c!==!1?e.props?.ref??e?.ref:void 0,S=Yj(h,v),x=()=>h.current||u?.current?.current,E=w=>{const{width:R,height:T,top:O,left:N,right:j,bottom:L,direction:P}=m.current,D=P==="rtl",A=i==="left"?D?`right:${j}`:`left:${N}`:D?`left:${N}`:`right:${j}`,F=a==="bottom"?`bottom:${L}`:`top:${O}`;w?.insertRule(`[data-motion-pop-id="${f}"]{position:absolute!important;width:${R}px!important;height:${T}px!important;${A}px!important;${F}px!important}`)};return b.useInsertionEffect(()=>{const{width:w,height:R}=m.current,T=x();if(t||c===!1||!T||!w||!R)return;T.dataset.motionPopId=f;const O=T.ownerDocument,N=O.createElement("style");g&&(N.nonce=g);const j=o??O.head;j.appendChild(N),E(N.sheet);let L=0,P=0;return Fc.setup(()=>{const[D,A]=SC(T);L=m.current.point[0]-D,P=m.current.point[1]-A}),Fc.read(()=>{const{sheet:D}=N;if(!D||!L&&!P)return;const A=m.current;A.left+=L,A.right-=L,A.top+=P,A.bottom-=P,D.deleteRule(0),E(D)}),()=>{T.removeAttribute("data-motion-pop-id"),j.contains(N)&&j.removeChild(N)}},[t]),y.jsx(qj,{isPresent:t,getElement:x,sizeRef:m,pop:c,children:c===!1?e:b.cloneElement(e,{ref:S})})}const Kj=({children:e,initial:t,isPresent:i,onExitComplete:a,custom:o,presenceAffectsLayout:c,mode:u,anchorX:f,anchorY:h,root:m})=>{const g=ou(Xj),v=b.useId(),S=b.useRef(),x=b.useRef(i),E=b.useRef(a);Pc(()=>{x.current=i,E.current=a});let w=!0,R=b.useMemo(()=>(w=!1,{id:v,initial:t,isPresent:i,custom:o,onExitComplete:T=>{g.set(T,!0);for(const O of g.values())if(!O)return;a&&a()},register:(T,O)=>(g.set(T,!1),O&&O.parent?.presenceContext?.id!==v&&(S.current=O),()=>{g.delete(T),!x.current&&!g.size&&E.current?.()})}),[i,g,a]);return c&&w&&(R={...R}),b.useMemo(()=>{g.forEach((T,O)=>g.set(O,!1))},[i]),b.useEffect(()=>{!i&&!g.size&&a&&a()},[i]),e=y.jsx(Gj,{pop:u==="popLayout",isPresent:i,anchorX:f,anchorY:h,root:m,popNode:S,children:e}),y.jsx(Kd.Provider,{value:R,children:e})};function Xj(){return new Map}function wC(e=!0){const t=b.useContext(Kd);if(t===null)return[!0,null];const{isPresent:i,onExitComplete:a,register:o}=t,c=b.useId();b.useEffect(()=>{if(e)return o(c)},[e]);const u=b.useCallback(()=>e&&a&&a(c),[c,a,e]);return!i&&a?[!1,u]:[!0]}const cc=e=>e.key||"";function LS(e){const t=[];return b.Children.forEach(e,i=>{b.isValidElement(i)&&t.push(i)}),t}const EC=({children:e,custom:t,initial:i=!0,onExitComplete:a,presenceAffectsLayout:o=!0,mode:c="sync",propagate:u=!1,anchorX:f="left",anchorY:h="top",root:m})=>{const[g,v]=wC(u),S=b.useMemo(()=>LS(e),[e]),x=u&&!g?[]:S.map(cc),E=b.useRef(!0),w=ou(()=>new Map),R=b.useRef(new Set),[T,O]=b.useState(S),[N,j]=b.useState(S);Pc(()=>{u&&!g&&!N.length&&v?.()},[g,u,N.length,v]);const L=b.useRef();b.useEffect(()=>()=>{const A=L.current;L.current=void 0,A?.()},[N]),Pc(()=>{E.current=!1;for(let A=0;Aw.get(cc(H)))?A=S:c==="wait"&&(A=P),j(LS(A)),O(S),null}const{forceRender:D}=b.useContext(z0);return y.jsx(y.Fragment,{children:N.map(A=>{const F=cc(A),H=u&&!g?!1:S===N||x.includes(F),X=()=>{if(R.current.has(F))return;if(w.has(F))R.current.add(F),w.set(F,!0);else return;let J=!0;w.forEach($=>{$||(J=!1)}),J&&(D?.(),O([]),u&&v?.(),L.current=a)};return y.jsx(Kj,{isPresent:H,initial:!E.current||i?void 0:!1,custom:t,presenceAffectsLayout:o,mode:c,root:m,onExitComplete:H?void 0:X,anchorX:f,anchorY:h,children:A},F)})})},RC=b.createContext({strict:!1}),kS={animation:["variants",...Wd],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let zS=!1;function $j(){if(zS)return;const e={};for(const t in kS)e[t]={isEnabled:i=>kS[t].some(a=>!!i[a])};lC(e),zS=!0}function CC(){return $j(),ej()}function Wj(e){const t=CC();for(const i in e)t[i]={...t[i],...e[i]};lC(t)}function Zj({children:e,...t}){const i=b.useContext(Gc);t={...i,...t},t.transition=iy(t.transition,i.transition),t.isStatic=ou(()=>t.isStatic);const a=b.useMemo(()=>t,[JSON.stringify(t.transition),t.transformPagePoint,t.reducedMotion,t.skipAnimations,t.isValidProp]);return y.jsx(Gc.Provider,{value:a,children:e})}const Qd=b.createContext({});function Qj(e,t){if(Zd(e)){const{initial:i,animate:a}=e;return{initial:i===!1||Yc(i)?i:void 0,animate:Yc(a)?a:void 0}}return e.inherit!==!1?t:{}}function Jj(e){const{initial:t,animate:i}=Qj(e,b.useContext(Qd));return b.useMemo(()=>({initial:t,animate:i}),[PS(t),PS(i)])}function PS(e){return Array.isArray(e)?e.join(" "):e}const gy=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function TC(e,t,i){for(const a in t)!tr(t[a])&&!fC(a,i)&&(e[a]=t[a])}function eO({transformTemplate:e},t){return b.useMemo(()=>{const i=gy();return dy(i,t,e),Object.assign({},i.vars,i.style)},[t])}function tO(e,t){const i=e.style||{},a={};return TC(a,i,e),Object.assign(a,eO(e,t)),a}function nO(e,t){const i={},a=tO(e,t);return e.drag&&e.dragListener!==!1&&(i.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(i.tabIndex=0),i.style=a,i}const AC=()=>({...gy(),attrs:{}});function rO(e,t,i,a){const o=b.useMemo(()=>{const c=AC();return YR(c,t,vC(a),e.transformTemplate,e.style),{...c.attrs,style:{...c.style}}},[t]);if(e.style){const c={};return TC(c,e.style,e),{...o,style:{...c,...o.style}}}return o}const iO=new Set(["animate","exit","variants","initial","style","values","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","tap","propagate","ignoreStrict","viewport"]);function jd(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||iO.has(e)}function aO(e,t){return e.startsWith("on")?!jd(e):t?.(e)??!jd(e)}function sO(e,t,i,a){const o={};for(const c in e)c==="values"&&typeof e.values=="object"||tr(e[c])||(aO(c,a)||i===!0&&jd(c)||!t&&!jd(c)||e.draggable&&c.startsWith("onDrag"))&&(o[c]=e[c]);return o}const oO=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function yy(e){return typeof e!="string"||e.includes("-")?!1:!!(oO.indexOf(e)>-1||/[A-Z]/u.test(e))}function lO(e,t,i,{latestValues:a},o,c=!1,u,f){const m=(u??yy(e)?rO:nO)(t,a,o,e),g=sO(t,typeof e=="string",c,f),v=e!==b.Fragment?{...g,...m,ref:i}:{},{children:S}=t,x=b.useMemo(()=>tr(S)?S.get():S,[S]);return b.createElement(e,{...v,children:x})}function cO({scrapeMotionValuesFromProps:e,createRenderState:t},i,a,o){return{latestValues:uO(i,a,o,e),renderState:t()}}function uO(e,t,i,a){const o={},c=a(e,{});for(const S in c)o[S]=ed(c[S]);let{initial:u,animate:f}=e;const h=Zd(e),m=sC(e);t&&m&&!h&&e.inherit!==!1&&(u===void 0&&(u=t.initial),f===void 0&&(f=t.animate));let g=i?i.initial===!1:!1;g=g||u===!1;const v=g?f:u;if(v&&typeof v!="boolean"&&!$d(v)){const S=Array.isArray(v)?v:[v];for(let x=0;x(t,i)=>{const a=b.useContext(Qd),o=b.useContext(Kd),c=()=>cO(e,t,a,o);return i?c():ou(c)},fO=MC({scrapeMotionValuesFromProps:my,createRenderState:gy}),dO=MC({scrapeMotionValuesFromProps:bC,createRenderState:AC}),hO=Symbol.for("motionComponentSymbol");function mO(e,t,i){const a=b.useRef(i);b.useInsertionEffect(()=>{a.current=i});const o=b.useRef(null);return b.useCallback(c=>{c&&e.onMount?.(c),t&&(c?t.mount(c):t.unmount());const u=a.current;if(typeof u=="function")if(c){const f=u(c);typeof f=="function"&&(o.current=f)}else o.current?(o.current(),o.current=null):u(c);else u&&(u.current=c)},[t])}const jC=b.createContext({});function pO(e,t,i,a,o,c){const{visualElement:u}=b.useContext(Qd),f=b.useContext(RC),h=b.useContext(Kd),m=b.useContext(Gc),g=m.reducedMotion,v=m.skipAnimations,S=b.useRef(null),x=b.useRef(!1);a=a||f.renderer,!S.current&&a&&(S.current=a(e,{visualState:t,parent:u,props:i,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:g,skipAnimations:v,isSVG:c}),x.current&&S.current&&(S.current.manuallyAnimateOnMount=!0));const E=S.current,w=b.useContext(jC);E&&!E.projection&&o&&(E.type==="html"||E.type==="svg")&&o.create(E,i,w),b.useInsertionEffect(()=>{E&&E.props!==i&&E.update(i,h)});const R=i[VR],T=b.useRef(!!R&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(R)&&window.MotionHasOptimisedAnimation?.(R));return Pc(()=>{!x.current||!E||(E.animationState?.animateChanges(),E.enteringChildren=void 0)},[]),Pc(()=>{x.current=!0,E&&(window.MotionIsMounted=!0,E.updateFeatures(),E.scheduleRenderMicrotask(),T.current&&E.animationState&&E.animationState.animateChanges())}),b.useEffect(()=>{E&&(!T.current&&E.animationState&&E.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(R)}),T.current=!1),E.enteringChildren=void 0)}),E}function Kp(e,{forwardMotionProps:t=!1,type:i}={},a,o){a&&Wj(a);const c=i?i==="svg":yy(e),u=c?dO:fO;function f(m,g){let v;const S=gO(m);ou(()=>!!nd.current?.sharedNodes.get(S)?.lead&&m.initial)&&(m={...m,initial:!1});const x={...b.useContext(Gc),...m,layoutId:S},{isStatic:E,isValidProp:w}=x,R=Jj(m),T=u(m,E);if(!E&&typeof window<"u"){yO();const O=vO(x);R.visualElement=pO(e,T,x,o,O.ProjectionNode,c),(O.isEnabled||R.visualElement?.projection?.options.layoutId)&&(v=O.MeasureLayout)}return y.jsxs(Qd.Provider,{value:R,children:[v&&R.visualElement?y.jsx(v,{visualElement:R.visualElement,...x}):null,lO(e,m,mO(T,R.visualElement,g),T,E,t,c,w)]})}f.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const h=b.forwardRef(f);return h[hO]=e,h}function gO({layoutId:e}){const t=b.useContext(z0).id;return t&&e!==void 0?t+"-"+e:e}function yO(e,t){b.useContext(RC).strict}function vO(e){const t=CC(),{drag:i,layout:a}=t;if(!i&&!a)return{};const o={...i,...a};return{MeasureLayout:o.MeasureLayout,isEnabled:i?.isEnabled(e)||a?.isEnabled(e),ProjectionNode:o.ProjectionNode}}function bO(e,t){if(typeof Proxy>"u")return Kp;const i=new Map,a=(c,u)=>Kp(c,u,e,t),o=(c,u)=>a(c,u);return new Proxy(o,{get:(c,u)=>u==="create"?a:(i.has(u)||i.set(u,Kp(u,void 0,e,t)),i.get(u))})}const xO=(e,t)=>t.isSVG??yy(e)?new Uj(t):new rj(t,{allowProjection:e!==b.Fragment});class SO extends ys{constructor(t){super(t),t.animationState||(t.animationState=Ij(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();$d(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){this.node.getProps().animate!==this.node.prevProps?.animate&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let wO=0;class EO extends ys{constructor(){super(...arguments),this.id=wO++}update(){const{presenceContext:t,animationState:i}=this.node;if(!t||!i)return;const{isPresent:a,onExitComplete:o}=t;if(a===!this.exit)return;if(a){if(this.exit===!0){const{initial:u}=this.node.getProps();if(u&&!Array.isArray(u)){const{transition:f,transitionEnd:h,...m}=$s(this.node,u)||{};for(const g in m)this.node.getValue(g)?.jump(m[g])}this.node.blockInitialAnimation=!1,i.reset(),i.animateChanges()}else i.setActive("exit",!1);this.exit=void 0;return}const c=this.exit=i.setActive("exit",!0);o&&c.then(()=>{this.exit===c&&(this.exit=!0,o(this.id))})}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id,this.node)),this.update()}unmount(){}}const RO={animation:{Feature:SO},exit:{Feature:EO}};class CO extends ys{constructor(t){super(t),this.removeGroupControls=Di,this.removeListeners=Di,this.controls=new Mj(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Di}update(){const{dragControls:t,drag:i}=this.node.getProps(),{dragControls:a,drag:o}=this.node.prevProps||{};t!==a&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls))),o&&!i&&this.controls.stop(void 0,void 0,o)}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Xp=e=>(t,i)=>{e&&Kt.update(()=>e(t,i),!1,!0)};class TO extends ys{constructor(){super(...arguments),this.removePointerDownListener=Di}onPointerDown(t){this.session=new hC(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:this.node.current?.ownerDocument.defaultView})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:i,onPan:a,onPanEnd:o}=this.node.getProps();return{onSessionStart:Xp(t),onStart:Xp(i),onMove:Xp(a),onEnd:(c,u)=>{delete this.session,o&&Kt.postRender(()=>o(c,u))}}}mount(){this.removePointerDownListener=jc(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session?.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session?.end()}}let $p=!1;const _S=({layout:e,layoutDependency:t,layoutAnchor:i})=>({layout:e,layoutDependency:t,layoutAnchor:i,animationType:typeof e=="string"?e:"both"}),VS=(e,t)=>{const{snapshot:i}=e,a=e.getStack();a?.remove(e);const o=a?.lead;if(a?.prevLead===e&&o.resumeFrom===e&&(o.resumeFrom=o.currentAnimation=e.resumingFrom=void 0),e.options.layoutId=t,!t){e.needsShow=!0;return}return e.root.registerSharedNode(t,e),()=>{const{resumeFrom:c}=e;c?.isPresent!==!1&&e.getStack().members.includes(c)&&(c.hide(),e.resumeFrom=void 0,e.snapshot=i)}};class AO extends b.Component{componentDidMount(){const{visualElement:t,layoutGroup:i,switchLayoutGroup:a,layoutId:o}=this.props,{projection:c}=t;c&&(i.group?.add(c),o&&a?.register?.(c),$p&&c.root.didUpdate(),c.options.layoutId!==o&&VS(c,o)?.(),c.addEventListener("animationComplete",()=>this.safeToRemove()),c.setOptions({...c.options,..._S(this.props),onExitComplete:()=>this.safeToRemove()})),td.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:i,layoutId:a,visualElement:o,drag:c,isPresent:u}=this.props,{projection:f}=o;return f&&(f.isPresent=u,this.takeOver=t.layoutId!==a?(f.willUpdate(),VS(f,a)):void 0,f.setOptions({...f.options,..._S(this.props)}),$p=!0,c||t.layoutDependency!==i||i===void 0||t.isPresent!==u?f.willUpdate():this.safeToRemove(),t.isPresent!==u&&(u?f.promote():f.relegate()||Kt.postRender(()=>{f.getStack()?.members.length||this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(this.takeOver?.(),t.root.didUpdate(),Fc.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:i,switchLayoutGroup:a}=this.props,{projection:o}=t;$p=!0,o&&(o.scheduleCheckAfterUnmount(),i.group?.remove(o),a?.deregister?.(o))}safeToRemove(){this.props.safeToRemove?.()}render(){return null}}function OC(e){const[t,i]=wC(),a=b.useContext(z0);return y.jsx(AO,{...e,layoutGroup:a,switchLayoutGroup:b.useContext(jC),isPresent:t,safeToRemove:i})}const MO={pan:{Feature:TO},drag:{Feature:CO,ProjectionNode:aC,MeasureLayout:OC}};function t0(e,t,i,a,o){const{props:c}=e,u="while"+i;!o&&e.animationState&&c[u]&&e.animationState.setActive(u,a==="Start");const f=c["on"+i+a];f&&Kt.postRender(()=>f(t,py(t)))}class jO extends ys{mount(){const{current:t}=this.node;t&&(this.unmount=Nj(t,(i,a)=>(t0(this.node,a,"Hover","Start"),o=>t0(this.node,o,"Hover","End"))))}unmount(){}}class OO extends ys{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=nl(Qs(this.node.current,"focus",()=>this.onFocus()),Qs(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Wp(e,t,i,a){e.current instanceof HTMLButtonElement&&e.current.disabled||t0(e,t,"Tap",i,a)}class DO extends ys{constructor(){super(...arguments),this.options={}}mount(){const{current:t}=this.node;t&&(this.update(),this.unmount=_j(t,(i,a)=>(Wp(this.node,a,"Start"),{onComplete:(o,{success:c})=>Wp(this.node,o,c?"":"Cancel"),onRepeat:()=>Wp(this.node,a,"",!0)}),this.options))}update(){const{options:t,node:i}=this,{globalTapTarget:a,propagate:o,tap:c}=i.props;for(const u in t)delete t[u];Object.assign(t,c,{useGlobalTarget:a,stopPropagation:o?.tap===!1})}unmount(){}}const n0=new WeakMap,Zp=new WeakMap,NO=e=>{const t=n0.get(e.target);t&&t(e)},LO=e=>{e.forEach(NO)};function kO({root:e,...t}){const i=e||document;Zp.has(i)||Zp.set(i,{});const a=Zp.get(i),o=JSON.stringify(t);return a[o]||(a[o]=new IntersectionObserver(LO,{root:e,...t})),a[o]}function zO(e,t,i){const a=kO(t);return n0.set(e,i),a.observe(e),()=>{n0.delete(e),a.unobserve(e)}}const PO={some:0,all:1};class _O extends ys{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:t={}}=this.node.getProps(),{root:i,margin:a,amount:o="some",once:c}=t,u={root:i?i.current:void 0,rootMargin:a,threshold:typeof o=="number"?o:PO[o]},f=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,c&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:g,onViewportLeave:v}=this.node.getProps(),S=m?g:v;S&&S(h)};this.stopObserver=zO(this.node.current,u,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:i}=this.node;["amount","margin","root"].some(VO(t,i))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function VO({viewport:e={}},{viewport:t={}}={}){return i=>e[i]!==t[i]}const UO={inView:{Feature:_O},tap:{Feature:DO},focus:{Feature:OO},hover:{Feature:jO}},BO={layout:{ProjectionNode:aC,MeasureLayout:OC}},IO=Object.assign({},RO,UO,MO,BO),HO=bO(IO,xO);function FO(){!hy.current&&oC();const[e]=b.useState(Td.current);return e}const Od=HO;var DC=e=>{throw TypeError(e)},NC=(e,t,i)=>t.has(e)||DC("Cannot "+i),ci=(e,t,i)=>(NC(e,t,"read from private field"),i?i.call(e):t.get(e)),Ec=(e,t,i)=>t.has(e)?DC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),Hi=(e,t,i,a)=>(NC(e,t,"write to private field"),t.set(e,i),i),Jd=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,eh=/^[\\/]{2}/;function LC(e,t){return t+e.replace(/\\/g,"/")}var US="popstate";function BS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function YO(e={}){function t(a,o){let c=o.state?.masked,{pathname:u,search:f,hash:h}=c||a.location;return Kc("",{pathname:u,search:f,hash:h},o.state&&o.state.usr||null,o.state&&o.state.key||"default",c?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function i(a,o){return typeof o=="string"?o:xr(o)}return GO(t,i,null,e)}function pt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Sn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function qO(){return Math.random().toString(36).substring(2,10)}function IS(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Kc(e,t,i=null,a,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Zi(t):t,state:i,key:t&&t.key||a||qO(),mask:o}}function xr({pathname:e="/",search:t="",hash:i=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function Zi(e){let t={};if(e){let i=e.indexOf("#");i>=0&&(t.hash=e.substring(i),e=e.substring(0,i));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function GO(e,t,i,a={}){let{window:o=document.defaultView,v5Compat:c=!1}=a,u=o.history,f="POP",h=null,m=g();m==null&&(m=0,u.replaceState({...u.state,idx:m},""));function g(){return(u.state||{idx:null}).idx}function v(){f="POP";let R=g(),T=R==null?null:R-m;m=R,h&&h({action:f,location:w.location,delta:T})}function S(R,T){f="PUSH";let O=BS(R)?R:Kc(w.location,R,T);m=g()+1;let N=IS(O,m),j=w.createHref(O.mask||O);try{u.pushState(N,"",j)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;o.location.assign(j)}c&&h&&h({action:f,location:w.location,delta:1})}function x(R,T){f="REPLACE";let O=BS(R)?R:Kc(w.location,R,T);m=g();let N=IS(O,m),j=w.createHref(O.mask||O);u.replaceState(N,"",j),c&&h&&h({action:f,location:w.location,delta:0})}function E(R){return kC(o,R)}let w={get action(){return f},get location(){return e(o,u)},listen(R){if(h)throw new Error("A history only accepts one active listener");return o.addEventListener(US,v),h=R,()=>{o.removeEventListener(US,v),h=null}},createHref(R){return t(o,R)},createURL:E,encodeLocation(R){let T=E(R);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:S,replace:x,go(R){return u.go(R)}};return w}function kC(e,t,i=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),pt(a,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:xr(t);return o=o.replace(/ $/,"%20"),!i&&eh.test(o)&&(o=a+o),new URL(o,a)}var Rc,HS=class{constructor(e){if(Ec(this,Rc,new Map),e)for(let[t,i]of e)this.set(t,i)}get(e){if(ci(this,Rc).has(e))return ci(this,Rc).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){ci(this,Rc).set(e,t)}};Rc=new WeakMap;var KO=new Set(["lazy","caseSensitive","path","id","index","children"]);function XO(e){return KO.has(e)}var $O=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function WO(e){return $O.has(e)}function ZO(e){return e.index===!0}function Xc(e,t,i=[],a={},o=!1){return e.map((c,u)=>{let f=[...i,String(u)],h=typeof c.id=="string"?c.id:f.join("-");if(pt(c.index!==!0||!c.children,"Cannot specify children on an index route"),pt(o||!a[h],`Found a route id collision on id "${h}". Route id's must be globally unique within Data Router usages`),ZO(c)){let m={...c,id:h};return a[h]=FS(m,t(m)),m}else{let m={...c,id:h,children:void 0};return a[h]=FS(m,t(m)),c.children&&(m.children=Xc(c.children,t,f,a,o)),m}})}function FS(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function zC(e,t,i="/"){return Ti(e,t,i,!1)}function Ti(e,t,i,a,o){let c=typeof t=="string"?Zi(t):t,u=pi(c.pathname||"/",i);if(u==null)return null;let f=o??sd(e),h=null,m=cD(u);for(let g=0;h==null&&g{let g={relativePath:m===void 0?u.path||"":m,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(a)&&h)return;pt(g.relativePath.startsWith(a),`Absolute route path "${g.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(a.length)}let v=hi([a,g.relativePath]),S=i.concat(g);u.children&&u.children.length>0&&(pt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),PC(u.children,t,S,v,h)),!(u.path==null&&!u.index)&&t.push({path:v,score:sD(v,u.index),routesMeta:S.map((x,E)=>{let[w,R]=UC(x.relativePath,x.caseSensitive,E===S.length-1);return{...x,matcher:w,compiledParams:R}})})};return e.forEach((u,f)=>{if(u.path===""||!u.path?.includes("?"))c(u,f);else for(let h of _C(u.path))c(u,f,!0,h)}),t}function _C(e){let t=e.split("/");if(t.length===0)return[];let[i,...a]=t,o=i.endsWith("?"),c=i.replace(/\?$/,"");if(a.length===0)return o?[c,""]:[c];let u=_C(a.join("/")),f=[];return f.push(...u.map(h=>h===""?c:[c,h].join("/"))),o&&f.push(...u),f.map(h=>e.startsWith("/")&&h===""?"/":h)}function JO(e){e.sort((t,i)=>t.score!==i.score?i.score-t.score:oD(t.routesMeta.map(a=>a.childrenIndex),i.routesMeta.map(a=>a.childrenIndex)))}var eD=/^:[\w-]+$/,tD=3,nD=2,rD=1,iD=10,aD=-2,YS=e=>e==="*";function sD(e,t){let i=e.split("/"),a=i.length;return i.some(YS)&&(a+=aD),t&&(a+=nD),i.filter(o=>!YS(o)).reduce((o,c)=>o+(eD.test(c)?tD:c===""?rD:iD),a)}function oD(e,t){return e.length===t.length&&e.slice(0,-1).every((a,o)=>a===t[o])?e[e.length-1]-t[t.length-1]:0}function lD(e,t,i=!1){let{routesMeta:a}=e,o={},c="/",u=[];for(let f=0;f{if(g==="*"){let E=f[S]||"";u=ol(c.slice(0,c.length-E.length),1)}const x=f[S];return v&&!x?m[g]=void 0:m[g]=(x||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:u,pattern:e}}function UC(e,t=!1,i=!0){Sn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,f,h,m,g)=>{if(a.push({paramName:f,isOptional:h!=null}),h){let v=g.charAt(m+u.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),a]}function cD(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Sn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function pi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let i=t.endsWith("/")?t.length-1:t.length,a=e.charAt(i);return a&&a!=="/"?null:e.slice(i)||"/"}function uD({basename:e,pathname:t}){return t==="/"?e:hi([e,t])}var vy=e=>Jd.test(e);function fD(e,t="/"){let{pathname:i,search:a="",hash:o=""}=typeof e=="string"?Zi(e):e,c;return i?(i=by(i),i.startsWith("/")||i.startsWith("\\")?c=qS(i.substring(1),"/"):c=qS(i,t)):c=t,{pathname:c,search:hD(a),hash:mD(o)}}function qS(e,t){let i=ol(t).split("/");return e.split("/").forEach(o=>{o===".."?i.length>1&&i.pop():o!=="."&&i.push(o)}),i.length>1?i.join("/"):"/"}function Qp(e,t,i,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function BC(e){return e.filter((t,i)=>i===0||t.route.path&&t.route.path.length>0)}function th(e){let t=BC(e);return t.map((i,a)=>a===t.length-1?i.pathname:i.pathnameBase)}function uu(e,t,i,a=!1){let o;typeof e=="string"?o=Zi(e):(o={...e},pt(!o.pathname||!o.pathname.includes("?"),Qp("?","pathname","search",o)),pt(!o.pathname||!o.pathname.includes("#"),Qp("#","pathname","hash",o)),pt(!o.search||!o.search.includes("#"),Qp("#","search","hash",o)));let c=e===""||o.pathname==="",u=c?"/":o.pathname,f;if(u==null)f=i;else{let v=t.length-1;if(!a&&u.startsWith("..")){let S=u.split("/");for(;S[0]==="..";)S.shift(),v-=1;o.pathname=S.join("/")}f=v>=0?t[v]:"/"}let h=fD(o,f),m=u&&u!=="/"&&u.endsWith("/"),g=(c||u===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(m||g)&&(h.pathname+="/"),h}var by=e=>e.replace(/[\\/]{2,}/g,"/"),hi=e=>by(e.join("/"));function ol(e,t=0){let i=e.length;for(;i>t&&e.charCodeAt(i-1)===47;)i--;return i===e.length?e:e.slice(0,i)}var dD=e=>ol(e).replace(/^\/*/,"/"),hD=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,mD=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,pD=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],fu=class{constructor(e,t,i,a=!1){this.status=e,this.statusText=t||"",this.internal=a,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function $c(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function du(e){let t=e.map(i=>i.route.path).filter(Boolean);return hi(t)||"/"}var IC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function HC(e,t){let i=e;if(typeof i!="string"||!Jd.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let a=i,o=!1;if(IC)try{let c=new URL(window.location.href),u=eh.test(i)?new URL(LC(i,c.protocol)):new URL(i),f=pi(u.pathname,t);u.origin===c.origin&&f!=null?i=f+u.search+u.hash:o=!0}catch{Sn(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:o,to:i}}var ss=Symbol("Uninstrumented");function gD(e,t){let i={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(o=>o({id:t.id,index:t.index,path:t.path,instrument(c){let u=Object.keys(i);for(let f of u)c[f]&&i[f].push(c[f])}}));let a={};if(typeof t.lazy=="function"&&i.lazy.length>0){let o=Ko(i.lazy,t.lazy,()=>{});o&&(a.lazy=o)}if(typeof t.lazy=="object"){let o=t.lazy;["middleware","loader","action"].forEach(c=>{let u=o[c],f=i[`lazy.${c}`];if(typeof u=="function"&&f.length>0){let h=Ko(f,u,()=>{});h&&(a.lazy=Object.assign(a.lazy||{},{[c]:h}))}})}return["loader","action"].forEach(o=>{let c=t[o];if(typeof c=="function"&&i[o].length>0){let u=c[ss]??c,f=Ko(i[o],u,(...h)=>GS(h[0]));f&&(o==="loader"&&u.hydrate===!0&&(f.hydrate=!0),f[ss]=u,a[o]=f)}}),t.middleware&&t.middleware.length>0&&i.middleware.length>0&&(a.middleware=t.middleware.map(o=>{let c=o[ss]??o,u=Ko(i.middleware,c,(...f)=>GS(f[0]));return u?(u[ss]=c,u):o})),a}function yD(e,t){let i={navigate:[],fetch:[]};if(t.forEach(a=>a({instrument(o){let c=Object.keys(o);for(let u of c)o[u]&&i[u].push(o[u])}})),i.navigate.length>0){let a=e.navigate[ss]??e.navigate,o=Ko(i.navigate,a,(...c)=>{let[u,f]=c;return{to:typeof u=="number"||typeof u=="string"?u:u?xr(u):".",...KS(e,f??{})}});o&&(o[ss]=a,e.navigate=o)}if(i.fetch.length>0){let a=e.fetch[ss]??e.fetch,o=Ko(i.fetch,a,(...c)=>{let[u,,f,h]=c;return{href:f??".",fetcherKey:u,...KS(e,h??{})}});o&&(o[ss]=a,e.fetch=o)}return e}function Ko(e,t,i){return e.length===0?null:async(...a)=>{let o=await FC(e,i(...a),()=>t(...a),e.length-1);if(o.type==="error")throw o.value;return o.value}}async function FC(e,t,i,a){let o=e[a],c;if(o){let u,f=async()=>(u?console.error("You cannot call instrumented handlers more than once"):u=FC(e,t,i,a-1),c=await u,pt(c,"Expected a result"),c.type==="error"&&c.value instanceof Error?{status:"error",error:c.value}:{status:"success",error:void 0});try{await o(f,t)}catch(h){console.error("An instrumentation function threw an error:",h)}u||await f(),await u}else try{c={type:"success",value:await i()}}catch(u){c={type:"error",value:u}}return c||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function GS(e){let{request:t,context:i,params:a,pattern:o}=e;return{request:vD(t),params:{...a},pattern:o,context:bD(i)}}function KS(e,t){return{currentUrl:xr(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function vD(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function bD(e){if(SD(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var xD=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function SD(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===xD}var XS=new URL("http://localhost");function xy(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),XS)}catch{return XS}}function Jp(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function wD(e,t){if(e.startsWith("//"))return!0;let i=t.protocol.toLowerCase();return e.toLowerCase().startsWith(i)?t.host===""||e.slice(i.length).startsWith("//"):!1}function $o(e,t,i,a){let o=null;try{o=e==null?null:new URL(e,i)}catch{}let c=new URL(t,i),u=o!=null&&!Jp(o,i),f=!Jp(c,i);if(a==="reject"){if(u||f)throw new Error("External navigation is not allowed")}else if(f&&(o==null||!wD(e,o)||!Jp(o,c)))throw new Error("External navigation is not allowed")}var YC=["POST","PUT","PATCH","DELETE"],ED=new Set(YC),RD=["GET",...YC],CD=new Set(RD),qC=new Set([301,302,303,307,308]),TD=new Set([307,308]),eg={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},AD={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},uc={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},MD=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),GC="remix-router-transitions",KC=Symbol("ResetLoaderData"),Hs,Vo,is,Uo,jD=class{constructor(e){Ec(this,Hs),Ec(this,Vo),Ec(this,is),Ec(this,Uo),Hi(this,Hs,e),Hi(this,Vo,sd(e))}get stableRoutes(){return ci(this,Hs)}get activeRoutes(){return ci(this,is)??ci(this,Hs)}get branches(){return ci(this,Uo)??ci(this,Vo)}get hasHMRRoutes(){return ci(this,is)!=null}setRoutes(e){Hi(this,Hs,e),Hi(this,Vo,sd(e))}setHmrRoutes(e){Hi(this,is,e),Hi(this,Uo,sd(e))}commitHmrRoutes(){ci(this,is)&&(Hi(this,Hs,ci(this,is)),Hi(this,Vo,ci(this,Uo)),Hi(this,is,void 0),Hi(this,Uo,void 0))}};Hs=new WeakMap;Vo=new WeakMap;is=new WeakMap;Uo=new WeakMap;function OD(e){const t=e.window?e.window:typeof window<"u"?window:void 0,i=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";pt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a=e.hydrationRouteProperties||[],o=e.mapRouteProperties||MD,c=o;if(e.instrumentations){let U=e.instrumentations;c=G=>({...o(G),...gD(U.map(te=>te.route).filter(Boolean),G)})}let u={},f=new jD(Xc(e.routes,c,void 0,u)),h=e.basename||"/";h.startsWith("/")||(h=`/${h}`);let m=e.dataStrategy||zD,g={...e.future},v=null,S=new Set,x=null,E=null,w=null,R=null,T=e.hydrationData!=null,O=Ti(f.activeRoutes,e.history.location,h,!1,f.branches),N=!1,j=null,L,P;if(O==null&&!e.patchRoutesOnNavigation){let U=ui(404,{pathname:e.history.location.pathname}),{matches:G,route:te}=Of(f.activeRoutes);L=!0,P=!L,O=G,j={[te.id]:U}}else if(O&&!e.hydrationData&&Jt(O,f.activeRoutes,e.history.location.pathname).active&&(O=null),O)if(O.some(U=>U.route.lazy))L=!1,P=!L;else if(!O.some(U=>Sy(U.route)))L=!0,P=!L;else{let U=e.hydrationData?e.hydrationData.loaderData:null,G=e.hydrationData?e.hydrationData.errors:null,te=O;if(G){let he=O.findIndex(ge=>G[ge.route.id]!==void 0);te=te.slice(0,he+1)}P=!1,L=!0,te.forEach(he=>{let ge=XC(he.route,U,G);P=P||ge.renderFallback,L=L&&!ge.shouldLoad})}else{L=!1,P=!L,O=[];let U=Jt(null,f.activeRoutes,e.history.location.pathname);U.active&&U.matches&&(N=!0,O=U.matches)}let D,A={historyAction:e.history.action,location:e.history.location,matches:O,initialized:L,renderFallback:P,navigation:eg,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||j,fetchers:new Map,blockers:new Map},F="POP",H=null,X=!1,J,$=!1,ee=new Map,re=null,V=!1,K=!1,Z=new Set,Y=new Map,_=0,M=-1,z=new Map,B=new Set,I=new Map,W=new Map,ie=new Set,fe=new Map,pe,ce=null;function Ae(){if(v=e.history.listen(({action:U,location:G,delta:te})=>{if(pe){pe(),pe=void 0;return}Sn(fe.size===0||te!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let he=un({currentLocation:A.location,nextLocation:G,historyAction:U});if(he&&te!=null){let ge=new Promise(Le=>{pe=Le});e.history.go(te*-1),Rt(he,{state:"blocked",location:G,proceed(){Rt(he,{state:"proceeding",proceed:void 0,reset:void 0,location:G}),ge.then(()=>e.history.go(te))},reset(){let Le=new Map(A.blockers);Le.set(he,uc),Re({blockers:Le})}}),H?.resolve(),H=null;return}return Qe(U,G)}),i){e9(t,ee);let U=()=>t9(t,ee);t.addEventListener("pagehide",U),re=()=>t.removeEventListener("pagehide",U)}return A.initialized||Qe("POP",A.location,{initialHydration:!0}),D}function ke(){v&&v(),re&&re(),S.clear(),J&&J.abort(),A.fetchers.forEach((U,G)=>Ot(A.fetchers,G)),A.blockers.forEach((U,G)=>vn(G))}function we(U){if(S.add(U),x){let{newErrors:G}=x;x=null,U(A,{deletedFetchers:[],newErrors:G,viewTransitionOpts:void 0,flushSync:!1})}return()=>S.delete(U)}function Re(U,G={}){U.matches&&(U.matches=U.matches.map(ge=>{let Le=u[ge.route.id],Ce=ge.route;return Ce.element!==Le.element||Ce.errorElement!==Le.errorElement||Ce.hydrateFallbackElement!==Le.hydrateFallbackElement?{...ge,route:Le}:ge})),A={...A,...U};let te=[],he=[];A.fetchers.forEach((ge,Le)=>{ge.state==="idle"&&(ie.has(Le)?te.push(Le):he.push(Le))}),ie.forEach(ge=>{!A.fetchers.has(ge)&&!Y.has(ge)&&te.push(ge)}),S.size===0&&(x={newErrors:U.errors??null}),[...S].forEach(ge=>ge(A,{deletedFetchers:te,newErrors:U.errors??null,viewTransitionOpts:G.viewTransitionOpts,flushSync:G.flushSync===!0})),te.forEach(ge=>Ot(A.fetchers,ge)),he.forEach(ge=>A.fetchers.delete(ge))}function ye(U,G,{flushSync:te}={}){let he=A.actionData!=null&&A.navigation.formMethod!=null&&sr(A.navigation.formMethod)&&A.navigation.state==="loading"&&U.state?._isRedirect!==!0,ge;G.actionData?Object.keys(G.actionData).length>0?ge=G.actionData:ge=null:he?ge=A.actionData:ge=null;let Le=G.loaderData?iw(A.loaderData,G.loaderData,G.matches||[],G.errors):A.loaderData,Ce=A.blockers;Ce.size>0&&(Ce=new Map(Ce),Ce.forEach((Pe,tt)=>Ce.set(tt,uc)));let je=V?!1:sn(U,G.matches||A.matches),De=X===!0||A.navigation.formMethod!=null&&sr(A.navigation.formMethod)&&U.state?._isRedirect!==!0;f.commitHmrRoutes(),V||F==="POP"||(F==="PUSH"?e.history.push(U,U.state):F==="REPLACE"&&e.history.replace(U,U.state));let Ie;if(F==="POP"&&!V&&U!==A.location){let Pe=ee.get(A.location.pathname);Pe&&Pe.has(U.pathname)?Ie={currentLocation:A.location,nextLocation:U}:ee.has(U.pathname)&&(Ie={currentLocation:U,nextLocation:A.location})}else if($){let Pe=ee.get(A.location.pathname);Pe?Pe.add(U.pathname):(Pe=new Set([U.pathname]),ee.set(A.location.pathname,Pe)),Ie={currentLocation:A.location,nextLocation:U}}Re({...G,actionData:ge,loaderData:Le,historyAction:F,location:U,initialized:!0,renderFallback:!1,navigation:eg,revalidation:"idle",restoreScrollPosition:je,preventScrollReset:De,blockers:Ce},{viewTransitionOpts:Ie,flushSync:te===!0}),F="POP",X=!1,$=!1,V=!1,K=!1,H?.resolve(),H=null,ce?.resolve(),ce=null}async function ze(U,G){if(H?.resolve(),H=null,typeof U=="number"){H||(H=lw());let mt=H.promise;return e.history.go(U),mt}let te=r0(A.location,A.matches,h,U,G?.fromRouteId,G?.relative),{path:he,submission:ge,error:Le}=$S(!1,te,G),Ce;if(G?.mask){let mt=typeof G.mask=="string"?Zi(G.mask):{...A.location.mask,...G.mask};if(Ce={pathname:mt.pathname??"",search:mt.search??"",hash:mt.hash??""},eh.test(Ce.pathname))throw new Error("External navigation is not allowed");Ce.pathname.startsWith("\\")&&(Ce.pathname=Ce.pathname.replace(/^\\+/,"/")),$o(typeof G.mask=="string"?G.mask:xr(G.mask),xr(Ce),e.history.createURL("/"),"reject")}let je=A.location,De=Kc(je,he,G&&G.state,void 0,Ce);De={...De,...e.history.encodeLocation(De)},$o(U==null?e.history.createHref(A.location):typeof U=="string"?U:xr(U),e.history.createHref(De.mask||De),e.history.createURL("/"),"reject");let Ie=G&&G.replace!=null?G.replace:void 0,Pe="PUSH";Ie===!0?Pe="REPLACE":Ie===!1||ge!=null&&sr(ge.formMethod)&&ge.formAction===A.location.pathname+A.location.search&&(Pe="REPLACE");let tt=G&&"preventScrollReset"in G?G.preventScrollReset===!0:void 0,Ke=(G&&G.flushSync)===!0,ut=un({currentLocation:je,nextLocation:De,historyAction:Pe});if(ut){Rt(ut,{state:"blocked",location:De,proceed(){Rt(ut,{state:"proceeding",proceed:void 0,reset:void 0,location:De}),ze(U,G)},reset(){let mt=new Map(A.blockers);mt.set(ut,uc),Re({blockers:mt})}});return}await Qe(Pe,De,{submission:ge,pendingError:Le,preventScrollReset:tt,replace:G&&G.replace,enableViewTransition:G&&G.viewTransition,flushSync:Ke,callSiteDefaultShouldRevalidate:G&&G.defaultShouldRevalidate})}function Ye(){ce||(ce=lw()),Te(),Re({revalidation:"loading"});let U=ce.promise;return A.navigation.state==="submitting"?U:A.navigation.state==="idle"?(Qe(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),U):(Qe(F||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:$===!0}),U)}async function Qe(U,G,te){J&&J.abort(),J=null,F=U,V=(te&&te.startUninterruptedRevalidation)===!0,ct(A.location,A.matches),X=(te&&te.preventScrollReset)===!0,$=(te&&te.enableViewTransition)===!0;let he=f.activeRoutes,ge=te?.initialHydration&&A.matches&&A.matches.length>0&&!N?A.matches:Ti(he,G,h,!1,f.branches),Le=(te&&te.flushSync)===!0;if(ge&&A.initialized&&!K&&YD(A.location,G)&&!(te&&te.submission&&sr(te.submission.formMethod))){ye(G,{matches:ge},{flushSync:Le});return}let Ce=Jt(ge,he,G.pathname);if(Ce.active&&Ce.matches&&(ge=Ce.matches),!ge){let{error:ft,notFoundMatches:dt,route:It}=kt(G.pathname);ye(G,{matches:dt,loaderData:{},errors:{[It.id]:ft}},{flushSync:Le});return}let je=te&&te.overrideNavigation?{...te.overrideNavigation,matches:ge,historyAction:U}:void 0;J=new AbortController;let De=Bo(e.history,G,J.signal,te&&te.submission),Ie=e.getContext?await e.getContext():new HS,Pe;if(te&&te.pendingError)Pe=[as(ge).route.id,{type:"error",error:te.pendingError}];else if(te&&te.submission&&sr(te.submission.formMethod)){let ft=await nt(De,G,te.submission,ge,U,Ie,Ce.active,te&&te.initialHydration===!0,{replace:te.replace,flushSync:Le});if(ft.shortCircuited)return;if(ft.pendingActionResult){let[dt,It]=ft.pendingActionResult;if(qr(It)&&$c(It.error)&&It.error.status===404){J=null,ye(G,{matches:ft.matches,loaderData:{},errors:{[dt]:It.error}});return}}ge=ft.matches||ge,Pe=ft.pendingActionResult,je=tg(G,ge,U,te.submission),Le=!1,Ce.active=!1,De=Bo(e.history,De.url,De.signal)}let{shortCircuited:tt,matches:Ke,loaderData:ut,errors:mt,workingFetchers:Bt}=await Ne(De,G,ge,U,Ie,Ce.active,je,te&&te.submission,te&&te.fetcherSubmission,te&&te.replace,te&&te.initialHydration===!0,Le,Pe,te&&te.callSiteDefaultShouldRevalidate);tt||(J=null,ye(G,{matches:Ke||ge,...aw(Pe),loaderData:ut,errors:mt,...Bt?{fetchers:Bt}:{}}))}async function nt(U,G,te,he,ge,Le,Ce,je,De={}){Te();let Ie=QD(G,he,ge,te);if(Re({navigation:Ie},{flushSync:De.flushSync===!0}),Ce){let Ke=await _t(he,G.pathname,U.signal);if(Ke.type==="aborted")return{shortCircuited:!0};if(Ke.type==="error"){if(Ke.partialMatches.length===0){let{matches:mt,route:Bt}=Of(f.activeRoutes);return{matches:mt,pendingActionResult:[Bt.id,{type:"error",error:Ke.error}]}}let ut=as(Ke.partialMatches).route.id;return{matches:Ke.partialMatches,pendingActionResult:[ut,{type:"error",error:Ke.error}]}}else if(Ke.matches)he=Ke.matches;else{let{notFoundMatches:ut,error:mt,route:Bt}=kt(G.pathname);return{matches:ut,pendingActionResult:[Bt.id,{type:"error",error:mt}]}}}let Pe,tt=od(he,G);if(!tt.route.action&&!tt.route.lazy)Pe={type:"error",error:ui(405,{method:U.method,pathname:G.pathname,routeId:tt.route.id})};else{let Ke=Wo(c,u,U,G,he,tt,je?[]:a,Le),ut=await be(U,G,Ke,Le,null);if(Pe=ut[tt.route.id],!Pe){for(let mt of he)if(ut[mt.route.id]){Pe=ut[mt.route.id];break}}if(U.signal.aborted)return{shortCircuited:!0}}if(Gs(Pe)){let Ke;return De&&De.replace!=null?Ke=De.replace:Ke=tw(Pe.response.headers.get("Location"),new URL(U.url),h,e.history)===A.location.pathname+A.location.search,await ue(U,Pe,!0,{submission:te,replace:Ke}),{shortCircuited:!0}}if(qr(Pe)){let Ke=as(he,tt.route.id);return(De&&De.replace)!==!0&&(F="PUSH"),{matches:he,pendingActionResult:[Ke.route.id,Pe,tt.route.id]}}return{matches:he,pendingActionResult:[tt.route.id,Pe]}}async function Ne(U,G,te,he,ge,Le,Ce,je,De,Ie,Pe,tt,Ke,ut){let mt=Ce||tg(G,te,he,je),Bt=je||De||ow(mt),ft=!V&&!Pe;if(Le){if(ft){let Yt=Xe(Ke);Re({navigation:mt,...Yt!==void 0?{actionData:Yt}:{}},{flushSync:tt})}let rt=await _t(te,G.pathname,U.signal);if(rt.type==="aborted")return{shortCircuited:!0};if(rt.type==="error"){if(rt.partialMatches.length===0){let{matches:Xn,route:Qr}=Of(f.activeRoutes);return{matches:Xn,loaderData:{},errors:{[Qr.id]:rt.error}}}let Yt=as(rt.partialMatches).route.id;return{matches:rt.partialMatches,loaderData:{},errors:{[Yt]:rt.error}}}else if(rt.matches)te=rt.matches;else{let{error:Yt,notFoundMatches:Xn,route:Qr}=kt(G.pathname);return{matches:Xn,loaderData:{},errors:{[Qr.id]:Yt}}}}let dt=f.activeRoutes,{dsMatches:It,revalidatingFetchers:st}=WS(U,ge,c,u,e.history,A,te,Bt,G,Pe?[]:a,Pe===!0,K,Z,ie,I,B,dt,h,e.patchRoutesOnNavigation!=null,f.branches,Ke,ut);if(M=++_,!e.dataStrategy&&!It.some(rt=>rt.shouldLoad)&&!It.some(rt=>rt.route.middleware&&rt.route.middleware.length>0)&&st.length===0){let rt=new Map(A.fetchers),Yt=mn(rt);return ye(G,{matches:te,loaderData:{},errors:Ke&&qr(Ke[1])?{[Ke[0]]:Ke[1].error}:null,...aw(Ke),...Yt?{fetchers:rt}:{}},{flushSync:tt}),{shortCircuited:!0}}if(ft){let rt={};if(!Le){rt.navigation=mt;let Yt=Xe(Ke);Yt!==void 0&&(rt.actionData=Yt)}st.length>0&&(rt.fetchers=Me(st)),Re(rt,{flushSync:tt})}st.forEach(rt=>{Ht(rt.key),rt.controller&&Y.set(rt.key,rt.controller)});let Or=()=>st.forEach(rt=>Ht(rt.key));J&&J.signal.addEventListener("abort",Or);let{loaderResults:pn,fetcherResults:jn}=await $e(It,st,U,G,ge);if(U.signal.aborted)return{shortCircuited:!0};J&&J.signal.removeEventListener("abort",Or),st.forEach(rt=>Y.delete(rt.key));let Gn=Df(pn);if(Gn)return await ue(U,Gn.result,!0,{replace:Ie}),{shortCircuited:!0};if(Gn=Df(jn),Gn)return B.add(Gn.key),await ue(U,Gn.result,!0,{replace:Ie}),{shortCircuited:!0};let Pn=new Map(A.fetchers),{loaderData:ea,errors:rr}=rw(A,te,pn,Ke,st,jn,Pn);Pe&&A.errors&&(rr={...A.errors,...rr});let vi=mn(Pn),fr=Fn(M,Pn),bi=vi||fr||st.length>0;return{matches:te,loaderData:ea,errors:rr,...bi?{workingFetchers:Pn}:{}}}function Xe(U){if(U&&!qr(U[1]))return{[U[0]]:U[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function Me(U){let G=new Map(A.fetchers);return U.forEach(te=>{let he=G.get(te.key),ge=fc(void 0,he?he.data:void 0);G.set(te.key,ge)}),G}async function et(U,G,te,he){Ht(U);let ge=(he&&he.flushSync)===!0,Le=f.activeRoutes,Ce=r0(A.location,A.matches,h,te,G,he?.relative),je=Ti(Le,Ce,h,!1,f.branches),De=Jt(je,Le,Ce);if(De.active&&De.matches&&(je=De.matches),!je){bt(U,G,ui(404,{pathname:Ce}),{flushSync:ge});return}let{path:Ie,submission:Pe,error:tt}=$S(!0,Ce,he);if(tt){bt(U,G,tt,{flushSync:ge});return}let Ke=e.getContext?await e.getContext():new HS,ut=(he&&he.preventScrollReset)===!0;if(Pe&&sr(Pe.formMethod)){await Et(U,G,Ie,je,Ke,De.active,ge,ut,Pe,he&&he.defaultShouldRevalidate);return}I.set(U,{routeId:G,path:Ie}),await at(U,G,Ie,je,Ke,De.active,ge,ut,Pe)}async function Et(U,G,te,he,ge,Le,Ce,je,De,Ie){Te(),I.delete(U);let Pe=A.fetchers.get(U);Oe(U,JD(De,Pe),{flushSync:Ce});let tt=new AbortController,Ke=Bo(e.history,te,tt.signal,De);if(Le){let xe=await _t(he,new URL(Ke.url).pathname,Ke.signal,U);if(xe.type==="aborted")return;if(xe.type==="error"){bt(U,G,xe.error,{flushSync:Ce});return}else if(xe.matches)he=xe.matches;else{bt(U,G,ui(404,{pathname:te}),{flushSync:Ce});return}}let ut=od(he,te);if(!ut.route.action&&!ut.route.lazy){let xe=ui(405,{method:De.formMethod,pathname:te,routeId:G});bt(U,G,xe,{flushSync:Ce});return}Y.set(U,tt);let mt=_,Bt=Wo(c,u,Ke,te,he,ut,a,ge),ft=await be(Ke,te,Bt,ge,U),dt=ft[ut.route.id];if(!dt){for(let xe of Bt)if(ft[xe.route.id]){dt=ft[xe.route.id];break}}if(Ke.signal.aborted){Y.get(U)===tt&&Y.delete(U);return}if(ie.has(U)){if(Gs(dt)||qr(dt)){Oe(U,Yi(void 0));return}}else{if(Gs(dt))if(Y.delete(U),M>mt){Oe(U,Yi(void 0));return}else return B.add(U),Oe(U,fc(De)),ue(Ke,dt,!1,{fetcherSubmission:De,preventScrollReset:je});if(qr(dt)){bt(U,G,dt.error);return}}let It=A.navigation.location||A.location,st=Bo(e.history,It,tt.signal),Or=f.activeRoutes,pn=A.navigation.state!=="idle"?Ti(Or,A.navigation.location,h,!1,f.branches):A.matches;pt(pn,"Didn't find any matches after fetcher action");let jn=++_;z.set(U,jn);let{dsMatches:Gn,revalidatingFetchers:Pn}=WS(st,ge,c,u,e.history,A,pn,De,It,a,!1,K,Z,ie,I,B,Or,h,e.patchRoutesOnNavigation!=null,f.branches,[ut.route.id,dt],Ie),ea=fc(De,dt.data),rr=new Map(A.fetchers);rr.set(U,ea),Pn.filter(xe=>xe.key!==U).forEach(xe=>{let Ue=xe.key,qe=rr.get(Ue),Je=fc(void 0,qe?qe.data:void 0);rr.set(Ue,Je),Ht(Ue),xe.controller&&Y.set(Ue,xe.controller)}),Re({fetchers:rr});let vi=()=>Pn.forEach(xe=>Ht(xe.key));tt.signal.addEventListener("abort",vi);let{loaderResults:fr,fetcherResults:bi}=await $e(Gn,Pn,st,It,ge);if(tt.signal.aborted)return;tt.signal.removeEventListener("abort",vi),z.delete(U),Y.delete(U),Pn.forEach(xe=>Y.delete(xe.key));let rt=A.fetchers.has(U),Yt=xe=>{if(!rt)return xe;let Ue=new Map(xe.fetchers);return Ue.set(U,Yi(dt.data)),{...xe,fetchers:Ue}},Xn=Df(fr);if(Xn)return A=Yt(A),ue(st,Xn.result,!1,{preventScrollReset:je});if(Xn=Df(bi),Xn)return B.add(Xn.key),A=Yt(A),ue(st,Xn.result,!1,{preventScrollReset:je});let Qr=new Map(A.fetchers);rt&&Qr.set(U,Yi(dt.data));let{loaderData:oe,errors:Ee}=rw(A,pn,fr,void 0,Pn,bi,Qr);Fn(jn,Qr),A.navigation.state==="loading"&&jn>M?(pt(F,"Expected pending action"),J&&J.abort(),ye(A.navigation.location,{matches:pn,loaderData:oe,errors:Ee,fetchers:Qr})):(Re({errors:Ee,loaderData:iw(A.loaderData,oe,pn,Ee),fetchers:Qr}),K=!1)}async function at(U,G,te,he,ge,Le,Ce,je,De){let Ie=A.fetchers.get(U);Oe(U,fc(De,Ie?Ie.data:void 0),{flushSync:Ce});let Pe=new AbortController,tt=Bo(e.history,te,Pe.signal);if(Le){let dt=await _t(he,new URL(tt.url).pathname,tt.signal,U);if(dt.type==="aborted")return;if(dt.type==="error"){bt(U,G,dt.error,{flushSync:Ce});return}else if(dt.matches)he=dt.matches;else{bt(U,G,ui(404,{pathname:te}),{flushSync:Ce});return}}let Ke=od(he,te);Y.set(U,Pe);let ut=_,mt=Wo(c,u,tt,te,he,Ke,a,ge),Bt=await be(tt,te,mt,ge,U),ft=Bt[Ke.route.id];if(!ft){for(let dt of he)if(Bt[dt.route.id]){ft=Bt[dt.route.id];break}}if(Y.get(U)===Pe&&Y.delete(U),!tt.signal.aborted){if(ie.has(U)){Oe(U,Yi(void 0));return}if(Gs(ft))if(M>ut){Oe(U,Yi(void 0));return}else{B.add(U),await ue(tt,ft,!1,{preventScrollReset:je});return}if(qr(ft)){bt(U,G,ft.error);return}Oe(U,Yi(ft.data))}}async function ue(U,G,te,{submission:he,fetcherSubmission:ge,preventScrollReset:Le,replace:Ce}={}){te||(H?.resolve(),H=null),G.response.headers.has("X-Remix-Revalidate")&&(K=!0);let je=G.response.headers.get("Location");pt(je,"Expected a Location header on the redirect Response");let De=je,Ie=new URL(U.url);je=tw(je,Ie,h,e.history),$o(De,je,Ie,"allow-explicit");let Pe=Kc(A.location,je,{_isRedirect:!0});if(i){let ft=!1;if(G.response.headers.has("X-Remix-Reload-Document"))ft=!0;else if(vy(je)){const dt=kC(t,je,!0);ft=dt.origin!==t.location.origin||pi(dt.pathname,h)==null}if(ft){Ce?t.location.replace(je):t.location.assign(je);return}}J=null;let tt=Ce===!0||G.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Ke,formAction:ut,formEncType:mt}=A.navigation;!he&&!ge&&Ke&&ut&&mt&&(he=ow(A.navigation));let Bt=he||ge;if(TD.has(G.response.status)&&Bt&&sr(Bt.formMethod))await Qe(tt,Pe,{submission:{...Bt,formAction:je},preventScrollReset:Le||X,enableViewTransition:te?$:void 0});else{let ft=tg(Pe,[],tt,he);await Qe(tt,Pe,{overrideNavigation:ft,fetcherSubmission:ge,preventScrollReset:Le||X,enableViewTransition:te?$:void 0})}}async function be(U,G,te,he,ge){let Le,Ce={};try{Le=await _D(m,U,G,te,ge,he,!1)}catch(je){return te.filter(De=>De.shouldLoad).forEach(De=>{Ce[De.route.id]={type:"error",error:je}}),Ce}if(U.signal.aborted)return Ce;if(!sr(U.method))for(let je of te){if(Le[je.route.id]?.type==="error")break;!Le.hasOwnProperty(je.route.id)&&!A.loaderData.hasOwnProperty(je.route.id)&&(!A.errors||!A.errors.hasOwnProperty(je.route.id))&&je.shouldCallHandler()&&(Le[je.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${je.route.id}`)})}for(let[je,De]of Object.entries(Le))if(XD(De)){let Ie=De.result;Ce[je]={type:"redirect",response:ID(Ie,U,je,te,h)}}else Ce[je]=await BD(De);return Ce}async function $e(U,G,te,he,ge){let Le=be(te,he,U,ge,null),Ce=Promise.all(G.map(async Ie=>{if(Ie.matches&&Ie.match&&Ie.request&&Ie.controller){let tt=(await be(Ie.request,Ie.path,Ie.matches,ge,Ie.key))[Ie.match.route.id];return{[Ie.key]:tt}}else return Promise.resolve({[Ie.key]:{type:"error",error:ui(404,{pathname:Ie.path})}})})),je=await Le,De=(await Ce).reduce((Ie,Pe)=>Object.assign(Ie,Pe),{});return{loaderResults:je,fetcherResults:De}}function Te(){K=!0,I.forEach((U,G)=>{Y.has(G)&&Z.add(G),Ht(G)})}function Oe(U,G,te={}){let he=new Map(A.fetchers);he.set(U,G),Re({fetchers:he},{flushSync:(te&&te.flushSync)===!0})}function bt(U,G,te,he={}){let ge=as(A.matches,G),Le=new Map(A.fetchers);Ot(Le,U),Re({errors:{[ge.route.id]:te},fetchers:Le},{flushSync:(he&&he.flushSync)===!0})}function Nt(U){return W.set(U,(W.get(U)||0)+1),ie.has(U)&&ie.delete(U),A.fetchers.get(U)||AD}function xt(U,G){Ht(U,G?.reason),Oe(U,Yi(null))}function Ot(U,G){let te=A.fetchers.get(G);Y.has(G)&&!(te&&te.state==="loading"&&z.has(G))&&Ht(G),I.delete(G),z.delete(G),B.delete(G),ie.delete(G),Z.delete(G),U.delete(G)}function Lt(U){let G=(W.get(U)||0)-1;G<=0?(W.delete(U),ie.add(U)):W.set(U,G),Re({fetchers:new Map(A.fetchers)})}function Ht(U,G){let te=Y.get(U);te&&(te.abort(G),Y.delete(U))}function Ft(U,G){for(let te of U){let he=G.get(te);pt(he,`Expected fetcher: ${te}`);let ge=Yi(he.data);G.set(te,ge)}}function mn(U){let G=[],te=!1;for(let he of B){let ge=U.get(he);pt(ge,`Expected fetcher: ${he}`),ge.state==="loading"&&(B.delete(he),G.push(he),te=!0)}return Ft(G,U),te}function Fn(U,G){let te=[];for(let[he,ge]of z)if(ge0}function Yn(U,G){let te=A.blockers.get(U)||uc;return fe.get(U)!==G&&fe.set(U,G),te}function vn(U){A.blockers.delete(U),fe.delete(U)}function Rt(U,G){let te=A.blockers.get(U)||uc;pt(te.state==="unblocked"&&G.state==="blocked"||te.state==="blocked"&&G.state==="blocked"||te.state==="blocked"&&G.state==="proceeding"||te.state==="blocked"&&G.state==="unblocked"||te.state==="proceeding"&&G.state==="unblocked",`Invalid blocker state transition: ${te.state} -> ${G.state}`);let he=new Map(A.blockers);he.set(U,G),Re({blockers:he})}function un({currentLocation:U,nextLocation:G,historyAction:te}){if(fe.size===0)return;fe.size>1&&Sn(!1,"A router only supports one blocker at a time");let he=Array.from(fe.entries()),[ge,Le]=he[he.length-1],Ce=A.blockers.get(ge);if(!(Ce&&Ce.state==="proceeding")&&Le({currentLocation:U,nextLocation:G,historyAction:te}))return ge}function kt(U){let G=ui(404,{pathname:U}),te=f.activeRoutes,{matches:he,route:ge}=Of(te);return{notFoundMatches:he,route:ge,error:G}}function Mn(U,G,te){if(E=U,R=G,w=te||null,!T&&A.navigation===eg){T=!0;let he=sn(A.location,A.matches);he!=null&&Re({restoreScrollPosition:he})}return()=>{E=null,R=null,w=null}}function zn(U,G){return w&&w(U,G.map(he=>QO(he,A.loaderData)))||U.key}function ct(U,G){if(E&&R){let te=zn(U,G);E[te]=R()}}function sn(U,G){if(E){let te=zn(U,G),he=E[te];if(typeof he=="number")return he}return null}function Jt(U,G,te){if(e.patchRoutesOnNavigation){let he=f.branches;if(U){if(Object.keys(U[0].params).length>0)return{active:!0,matches:Ti(G,te,h,!0,he)}}else return{active:!0,matches:Ti(G,te,h,!0,he)||[]}}return{active:!1,matches:null}}async function _t(U,G,te,he){if(!e.patchRoutesOnNavigation)return{type:"success",matches:U};let ge=U;for(;;){let Le=u;try{await e.patchRoutesOnNavigation({signal:te,path:G,matches:ge,fetcherKey:he,patch:(Ie,Pe)=>{te.aborted||ZS(Ie,Pe,f,Le,c,!1)}})}catch(Ie){return{type:"error",error:Ie,partialMatches:ge}}if(te.aborted)return{type:"aborted"};let Ce=f.branches,je=Ti(f.activeRoutes,G,h,!1,Ce),De=null;if(je){if(Object.keys(je[0].params).length===0)return{type:"success",matches:je};if(De=Ti(f.activeRoutes,G,h,!0,Ce),!(De&&ge.lengthte.route.id===G[he].route.id)}function fn(U){u={},f.setHmrRoutes(Xc(U,c,void 0,u))}function qn(U,G,te=!1){ZS(U,G,f,u,c,te),f.hasHMRRoutes||Re({})}return D={get basename(){return h},get future(){return g},get state(){return A},get routes(){return f.stableRoutes},get branches(){return f.branches},get manifest(){return u},get window(){return t},initialize:Ae,subscribe:we,enableScrollRestoration:Mn,navigate:ze,fetch:et,revalidate:Ye,createHref:U=>e.history.createHref(U),createURL:U=>e.history.createURL(U),encodeLocation:U=>e.history.encodeLocation(U),getFetcher:Nt,resetFetcher:xt,deleteFetcher:Lt,dispose:ke,getBlocker:Yn,deleteBlocker:vn,patchRoutes:qn,_internalFetchControllers:Y,_internalSetRoutes:fn,_internalSetStateDoNotUseOrYouWillBreakYourApp(U){Re(U)}},e.instrumentations&&(D=yD(D,e.instrumentations.map(U=>U.router).filter(Boolean))),D}function DD(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function r0(e,t,i,a,o,c){let u,f;if(o){u=[];for(let m of t)if(u.push(m),m.route.id===o){f=m;break}}else u=t,f=t[t.length-1];let h=uu(a||".",th(u),pi(e.pathname,i)||e.pathname,c==="path");if(a==null&&(h.search=e.search,h.hash=e.hash),(a==null||a===""||a===".")&&f){let m=Ey(h.search);if(f.route.index&&!m)h.search=h.search?h.search.replace(/^\?/,"?index&"):"?index";else if(!f.route.index&&m){let g=new URLSearchParams(h.search),v=g.getAll("index");g.delete("index"),v.filter(x=>x).forEach(x=>g.append("index",x));let S=g.toString();h.search=S?`?${S}`:""}}return i!=="/"&&(h.pathname=uD({basename:i,pathname:h.pathname})),xr(h)}function $S(e,t,i){if(!i||!DD(i))return{path:t};if(i.formMethod&&!ZD(i.formMethod))return{path:t,error:ui(405,{method:i.formMethod})};let a=()=>({path:t,error:ui(400,{type:"invalid-body"})}),c=(i.formMethod||"get").toUpperCase(),u=tT(t);if(i.body!==void 0){if(i.formEncType==="text/plain"){if(!sr(c))return a();let v=typeof i.body=="string"?i.body:i.body instanceof FormData||i.body instanceof URLSearchParams?Array.from(i.body.entries()).reduce((S,[x,E])=>`${S}${x}=${E} -`,""):String(i.body);return{path:t,submission:{formMethod:c,formAction:u,formEncType:i.formEncType,formData:void 0,json:void 0,text:v}}}else if(i.formEncType==="application/json"){if(!sr(c))return a();try{let v=typeof i.body=="string"?JSON.parse(i.body):i.body;return{path:t,submission:{formMethod:c,formAction:u,formEncType:i.formEncType,formData:void 0,json:v,text:void 0}}}catch{return a()}}}pt(typeof FormData=="function","FormData is not available in this environment");let f,h;if(i.formData)f=s0(i.formData),h=i.formData;else if(i.body instanceof FormData)f=s0(i.body),h=i.body;else if(i.body instanceof URLSearchParams)f=i.body,h=nw(f);else if(i.body==null)f=new URLSearchParams,h=new FormData;else try{f=new URLSearchParams(i.body),h=nw(f)}catch{return a()}let m={formMethod:c,formAction:u,formEncType:i&&i.formEncType||"application/x-www-form-urlencoded",formData:h,json:void 0,text:void 0};if(sr(m.formMethod))return{path:t,submission:m};let g=Zi(t);return e&&g.search&&Ey(g.search)&&f.append("index",""),g.search=`?${f}`,{path:xr(g),submission:m}}function WS(e,t,i,a,o,c,u,f,h,m,g,v,S,x,E,w,R,T,O,N,j,L){let P=j?qr(j[1])?j[1].error:j[1].data:void 0,D=o.createURL(c.location),A=o.createURL(h),F;if(g&&c.errors){let V=Object.keys(c.errors)[0];F=u.findIndex(K=>K.route.id===V)}else if(j&&qr(j[1])){let V=j[0];F=u.findIndex(K=>K.route.id===V)-1}let H=j?j[1].statusCode:void 0,X=H&&H>=400,J={currentUrl:D,currentParams:c.matches[0]?.params||{},nextUrl:A,nextParams:u[0].params,...f,actionResult:P,actionStatus:H},$=du(u),ee=u.map((V,K)=>{let{route:Z}=V,Y=null;if(F!=null&&K>F)Y=!1;else if(Z.lazy)Y=!0;else if(!Sy(Z))Y=!1;else if(g){let{shouldLoad:B}=XC(Z,c.loaderData,c.errors);Y=B}else ND(c.loaderData,c.matches[K],V)&&(Y=!0);if(Y!==null)return i0(i,a,e,h,$,V,m,t,Y);let _=!1;typeof L=="boolean"?_=L:X?_=!1:(v||D.pathname+D.search===A.pathname+A.search||D.search!==A.search||LD(c.matches[K],V))&&(_=!0);let M={...J,defaultShouldRevalidate:_},z=Oc(V,M);return i0(i,a,e,h,$,V,m,t,z,M,L)}),re=[];return E.forEach((V,K)=>{if(g||!u.some(W=>W.route.id===V.routeId)||x.has(K))return;let Z=c.fetchers.get(K),Y=Z&&Z.state!=="idle"&&Z.data===void 0,_=Ti(R,V.path,T??"/",!1,N);if(!_){if(O&&Y)return;re.push({key:K,routeId:V.routeId,path:V.path,matches:null,match:null,request:null,controller:null});return}if(w.has(K))return;let M=od(_,V.path),z=new AbortController,B=Bo(o,V.path,z.signal),I=null;if(S.has(K))S.delete(K),I=Wo(i,a,B,V.path,_,M,m,t);else if(Y)v&&(I=Wo(i,a,B,V.path,_,M,m,t));else{let W;typeof L=="boolean"?W=L:X?W=!1:W=v;let ie={...J,defaultShouldRevalidate:W};Oc(M,ie)&&(I=Wo(i,a,B,V.path,_,M,m,t,ie))}I&&re.push({key:K,routeId:V.routeId,path:V.path,matches:I,match:M,request:B,controller:z})}),{dsMatches:ee,revalidatingFetchers:re}}function Sy(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function XC(e,t,i){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Sy(e))return{shouldLoad:!1,renderFallback:!1};let a=t!=null&&e.id in t,o=i!=null&&i[e.id]!==void 0;if(!a&&o)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!a};let c=!a&&!o;return{shouldLoad:c,renderFallback:c}}function ND(e,t,i){let a=!t||i.route.id!==t.route.id,o=!e.hasOwnProperty(i.route.id);return a||o}function LD(e,t){let i=e.route.path;return e.pathname!==t.pathname||i!=null&&i.endsWith("*")&&e.params["*"]!==t.params["*"]}function Oc(e,t){if(e.route.shouldRevalidate){let i=e.route.shouldRevalidate(t);if(typeof i=="boolean")return i}return t.defaultShouldRevalidate}function ZS(e,t,i,a,o,c){let u;if(e){let m=a[e];pt(m,`No route found to patch children into: routeId = ${e}`),m.children||(m.children=[]),u=m.children}else u=i.activeRoutes;let f=[],h=[];if(t.forEach(m=>{let g=u.find(v=>$C(m,v));g?h.push({existingRoute:g,newRoute:m}):f.push(m)}),f.length>0){let m=Xc(f,o,[e||"_","patch",String(u?.length||"0")],a);u.push(...m)}if(c&&h.length>0)for(let m=0;mt.children?.some(o=>$C(i,o)))??!1:!1}var QS=new WeakMap,WC=({key:e,route:t,manifest:i,mapRouteProperties:a})=>{let o=i[t.id];if(pt(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let c=o.lazy[e];if(!c)return;let u=QS.get(o);u||(u={},QS.set(o,u));let f=u[e];if(f)return f;let h=(async()=>{let m=XO(e),v=o[e]!==void 0&&e!=="hasErrorBoundary";if(m)Sn(!m,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),u[e]=Promise.resolve();else if(v)Sn(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let S=await c();S!=null&&(Object.assign(o,{[e]:S}),Object.assign(o,a(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(S=>S===void 0)&&(o.lazy=void 0))})();return u[e]=h,h},JS=new WeakMap;function kD(e,t,i,a,o){let c=i[e.id];if(pt(c,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let g=JS.get(c);if(g)return{lazyRoutePromise:g,lazyHandlerPromise:g};let v=(async()=>{pt(typeof e.lazy=="function","No lazy route function found");let S=await e.lazy(),x={};for(let E in S){let w=S[E];if(w===void 0)continue;let R=WO(E),O=c[E]!==void 0&&E!=="hasErrorBoundary";R?Sn(!R,"Route property "+E+" is not a supported property to be returned from a lazy route function. This property will be ignored."):O?Sn(!O,`Route "${c.id}" has a static property "${E}" defined but its lazy function is also returning a value for this property. The lazy route property "${E}" will be ignored.`):x[E]=w}Object.assign(c,x),Object.assign(c,{...a(c),lazy:void 0})})();return JS.set(c,v),v.catch(()=>{}),{lazyRoutePromise:v,lazyHandlerPromise:v}}let u=Object.keys(e.lazy),f=[],h;for(let g of u){if(o&&o.includes(g))continue;let v=WC({key:g,route:e,manifest:i,mapRouteProperties:a});v&&(f.push(v),g===t&&(h=v))}let m=f.length>0?Promise.all(f).then(()=>{}):void 0;return m?.catch(()=>{}),h?.catch(()=>{}),{lazyRoutePromise:m,lazyHandlerPromise:h}}async function ew(e){let t=e.matches.filter(o=>o.shouldLoad),i={};return(await Promise.all(t.map(o=>o.resolve()))).forEach((o,c)=>{i[t[c].route.id]=o}),i}async function zD(e){return e.matches.some(t=>t.route.middleware)?ZC(e,()=>ew(e)):ew(e)}function ZC(e,t){return PD(e,t,a=>{if(WD(a))throw a;return a},GD,i);function i(a,o,c){if(c)return Promise.resolve(Object.assign(c.value,{[o]:{type:"error",result:a}}));{let{matches:u}=e,f=Math.min(Math.max(u.findIndex(m=>m.route.id===o),0),Math.max(u.findIndex(m=>m.shouldCallHandler()),0)),h=as(u,u[f].route.id).route.id;return Promise.resolve({[h]:{type:"error",result:a}})}}}async function PD(e,t,i,a,o){let{matches:c,...u}=e,f=c.flatMap(m=>m.route.middleware?m.route.middleware.map(g=>[m.route.id,g]):[]);return await QC(u,f,t,i,a,o)}async function QC(e,t,i,a,o,c,u=0){let{request:f}=e;if(f.signal.aborted)throw f.signal.reason??new Error(`Request aborted: ${f.method} ${f.url}`);let h=t[u];if(!h)return await i();let[m,g]=h,v,S=async()=>{if(v)throw new Error("You may only call `next()` once per middleware");try{return v={value:await QC(e,t,i,a,o,c,u+1)},v.value}catch(x){return v={value:await c(x,m,v)},v.value}};try{let x=await g(e,S),E=x!=null?a(x):void 0;return o(E)?E:v?E??v.value:(v={value:await S()},v.value)}catch(x){return await c(x,m,v)}}function JC(e,t,i,a,o){let c=WC({key:"middleware",route:a.route,manifest:t,mapRouteProperties:e}),u=kD(a.route,sr(i.method)?"action":"loader",t,e,o);return{middleware:c,route:u.lazyRoutePromise,handler:u.lazyHandlerPromise}}function i0(e,t,i,a,o,c,u,f,h,m=null,g){let v=!1,S=JC(e,t,i,c,u);return{...c,_lazyPromises:S,shouldLoad:h,shouldRevalidateArgs:m,shouldCallHandler(x){return v=!0,m?typeof g=="boolean"?Oc(c,{...m,defaultShouldRevalidate:g}):typeof x=="boolean"?Oc(c,{...m,defaultShouldRevalidate:x}):Oc(c,m):h},resolve(x){let{lazy:E,loader:w,middleware:R}=c.route,T=v||h||x&&!sr(i.method)&&(E||w),O=R&&R.length>0&&!w&&!E;return T&&(sr(i.method)||!O)?VD({request:i,path:a,pattern:o,match:c,lazyHandlerPromise:S?.handler,lazyRoutePromise:S?.route,handlerOverride:x,scopedContext:f}):Promise.resolve({type:"data",result:void 0})}}}function Wo(e,t,i,a,o,c,u,f,h=null){return o.map(m=>m.route.id!==c.route.id?{...m,shouldLoad:!1,shouldRevalidateArgs:h,shouldCallHandler:()=>!1,_lazyPromises:JC(e,t,i,m,u),resolve:()=>Promise.resolve({type:"data",result:void 0})}:i0(e,t,i,a,du(o),m,u,f,!0,h))}async function _D(e,t,i,a,o,c,u){a.some(g=>g._lazyPromises?.middleware)&&await Promise.all(a.map(g=>g._lazyPromises?.middleware));let f={request:t,url:eT(t,i),pattern:du(a),params:a[0].params,context:c,matches:a},m=await e({...f,fetcherKey:o,runClientMiddleware:g=>{let v=f;return ZC(v,()=>g({...v,fetcherKey:o,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(a.flatMap(g=>[g._lazyPromises?.handler,g._lazyPromises?.route]))}catch{}return m}async function VD({request:e,path:t,pattern:i,match:a,lazyHandlerPromise:o,lazyRoutePromise:c,handlerOverride:u,scopedContext:f}){let h,m,g=sr(e.method),v=g?"action":"loader",S=x=>{let E,w=new Promise((O,N)=>E=N);m=()=>E(),e.signal.addEventListener("abort",m);let R=O=>typeof x!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${v}" [routeId: ${a.route.id}]`)):x({request:e,url:eT(e,t),pattern:i,params:a.params,context:f},...O!==void 0?[O]:[]),T=(async()=>{try{return{type:"data",result:await(u?u(N=>R(N)):R())}}catch(O){return{type:"error",result:O}}})();return Promise.race([T,w])};try{let x=g?a.route.action:a.route.loader;if(o||c)if(x){let E,[w]=await Promise.all([S(x).catch(R=>{E=R}),o,c]);if(E!==void 0)throw E;h=w}else{await o;let E=g?a.route.action:a.route.loader;if(E)[h]=await Promise.all([S(E),c]);else if(v==="action"){let w=new URL(e.url),R=w.pathname+w.search;throw ui(405,{method:e.method,pathname:R,routeId:a.route.id})}else return{type:"data",result:void 0}}else if(x)h=await S(x);else{let E=new URL(e.url),w=E.pathname+E.search;throw ui(404,{pathname:w})}}catch(x){return{type:"error",result:x}}finally{m&&e.signal.removeEventListener("abort",m)}return h}async function UD(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function BD(e){let{result:t,type:i}=e;if(wy(t)){let a;try{a=await UD(t)}catch(o){return{type:"error",error:o}}return i==="error"?{type:"error",error:new fu(t.status,t.statusText,a),statusCode:t.status,headers:t.headers}:{type:"data",data:a,statusCode:t.status,headers:t.headers}}return i==="error"?sw(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:qD(t),statusCode:$c(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:$c(t)?t.status:void 0}:sw(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function ID(e,t,i,a,o){let c=e.headers.get("Location");if(pt(c,"Redirects returned/thrown from loaders/actions must have a Location header"),!vy(c)){let u=a.slice(0,a.findIndex(f=>f.route.id===i)+1);c=r0(new URL(t.url),u,o,c),e.headers.set("Location",c)}return e}var HD=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function a0(e){try{return HD.includes(new URL(e).protocol)}catch{return!1}}function tw(e,t,i,a){if(vy(e)){let o=e,c=eh.test(o)?new URL(LC(o,t.protocol)):new URL(o);if(a0(c.toString()))throw new Error("Invalid redirect location");let u=pi(c.pathname,i)!=null;if(c.origin===t.origin&&u)return by(c.pathname)+c.search+c.hash}try{let o=a.createURL(e);if(a0(o.toString()))throw new Error("Invalid redirect location")}catch{}return e}function Bo(e,t,i,a){let o=e.createURL(tT(t)).toString(),c={signal:i};if(a&&sr(a.formMethod)){let{formMethod:u,formEncType:f}=a;c.method=u.toUpperCase(),f==="application/json"?(c.headers=new Headers({"Content-Type":f}),c.body=JSON.stringify(a.json)):f==="text/plain"?c.body=a.text:f==="application/x-www-form-urlencoded"&&a.formData?c.body=s0(a.formData):c.body=a.formData}return new Request(o,c)}function eT(e,t){let i=new URL(e.url),a=typeof t=="string"?Zi(t):t;if(i.pathname=a.pathname||"/",a.search){let o=new URLSearchParams(a.search),c=o.getAll("index");o.delete("index");for(let u of c.filter(Boolean))o.append("index",u);i.search=o.size?`?${o.toString()}`:""}else i.search="";return i.hash=a.hash||"",i}function s0(e){let t=new URLSearchParams;for(let[i,a]of e.entries())t.append(i,typeof a=="string"?a:a.name);return t}function nw(e){let t=new FormData;for(let[i,a]of e.entries())t.append(i,a);return t}function FD(e,t,i,a=!1,o=!1){let c={},u=null,f,h=!1,m={},g=i&&qr(i[1])?i[1].error:void 0;return e.forEach(v=>{if(!(v.route.id in t))return;let S=v.route.id,x=t[S];if(pt(!Gs(x),"Cannot handle redirect results in processLoaderData"),qr(x)){let E=x.error;if(g!==void 0&&(E=g,g=void 0),u=u||{},o)u[S]=E;else{let w=as(e,S);u[w.route.id]==null&&(u[w.route.id]=E)}a||(c[S]=KC),h||(h=!0,f=$c(x.error)?x.error.status:500),x.headers&&(m[S]=x.headers)}else c[S]=x.data,x.statusCode&&x.statusCode!==200&&!h&&(f=x.statusCode),x.headers&&(m[S]=x.headers)}),g!==void 0&&i&&(u={[i[0]]:g},i[2]&&(c[i[2]]=void 0)),{loaderData:c,errors:u,statusCode:f||200,loaderHeaders:m}}function rw(e,t,i,a,o,c,u){let{loaderData:f,errors:h}=FD(t,i,a);return o.filter(m=>!m.matches||m.matches.some(g=>g.shouldLoad)).forEach(m=>{let{key:g,match:v,controller:S}=m;if(S&&S.signal.aborted)return;let x=c[g];if(pt(x,"Did not find corresponding fetcher result"),qr(x)){let E=as(e.matches,v?.route.id);h&&h[E.route.id]||(h={...h,[E.route.id]:x.error}),u.delete(g)}else if(Gs(x))pt(!1,"Unhandled fetcher revalidation redirect");else{let E=Yi(x.data);u.set(g,E)}}),{loaderData:f,errors:h}}function iw(e,t,i,a){let o=Object.entries(t).filter(([,c])=>c!==KC).reduce((c,[u,f])=>(c[u]=f,c),{});for(let c of i){let u=c.route.id;if(!t.hasOwnProperty(u)&&e.hasOwnProperty(u)&&c.route.loader&&(o[u]=e[u]),a&&a.hasOwnProperty(u))break}return o}function aw(e){return e?qr(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function as(e,t){return(t?e.slice(0,e.findIndex(a=>a.route.id===t)+1):[...e]).reverse().find(a=>a.route.hasErrorBoundary===!0)||e[0]}function Of(e){let t=e.length===1?e[0]:e.find(i=>i.index||!i.path||i.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ui(e,{pathname:t,routeId:i,method:a,type:o,message:c}={}){let u="Unknown Server Error",f="Unknown @remix-run/router error";return e===400?(u="Bad Request",a&&t&&i?f=`You made a ${a} request to "${t}" but did not provide a \`loader\` for route "${i}", so there is no way to handle the request.`:o==="invalid-body"&&(f="Unable to encode submission body")):e===403?(u="Forbidden",f=`Route "${i}" does not match URL "${t}"`):e===404?(u="Not Found",f=`No route matches URL "${t}"`):e===405&&(u="Method Not Allowed",a&&t&&i?f=`You made a ${a.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${i}", so there is no way to handle the request.`:a&&(f=`Invalid request method "${a.toUpperCase()}"`)),new fu(e||500,u,new Error(f),!0)}function Df(e){let t=Object.entries(e);for(let i=t.length-1;i>=0;i--){let[a,o]=t[i];if(Gs(o))return{key:a,result:o}}}function tT(e){let t=typeof e=="string"?Zi(e):e;return xr({...t,hash:""})}function YD(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function qD(e){return new fu(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function GD(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,i])=>typeof t=="string"&&KD(i))}function KD(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function XD(e){return wy(e.result)&&qC.has(e.result.status)}function qr(e){return e.type==="error"}function Gs(e){return(e&&e.type)==="redirect"}function sw(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function wy(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function $D(e){return qC.has(e)}function WD(e){return wy(e)&&$D(e.status)&&e.headers.has("Location")}function ZD(e){return CD.has(e.toUpperCase())}function sr(e){return ED.has(e.toUpperCase())}function Ey(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function od(e,t){let i=typeof t=="string"?Zi(t).search:t.search;if(e[e.length-1].route.index&&Ey(i||""))return e[e.length-1];let a=BC(e);return a[a.length-1]}function ow(e){let{formMethod:t,formAction:i,formEncType:a,text:o,formData:c,json:u}=e;if(!(!t||!i||!a)){if(o!=null)return{formMethod:t,formAction:i,formEncType:a,formData:void 0,json:void 0,text:o};if(c!=null)return{formMethod:t,formAction:i,formEncType:a,formData:c,json:void 0,text:void 0};if(u!==void 0)return{formMethod:t,formAction:i,formEncType:a,formData:void 0,json:u,text:void 0}}}function tg(e,t,i,a){return a?{state:"loading",location:e,matches:t,historyAction:i,formMethod:a.formMethod,formAction:a.formAction,formEncType:a.formEncType,formData:a.formData,json:a.json,text:a.text}:{state:"loading",location:e,matches:t,historyAction:i,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function QD(e,t,i,a){return{state:"submitting",location:e,matches:t,historyAction:i,formMethod:a.formMethod,formAction:a.formAction,formEncType:a.formEncType,formData:a.formData,json:a.json,text:a.text}}function fc(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function JD(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Yi(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function e9(e,t){try{let i=e.sessionStorage.getItem(GC);if(i){let a=JSON.parse(i);for(let[o,c]of Object.entries(a||{}))c&&Array.isArray(c)&&t.set(o,new Set(c||[]))}}catch{}}function t9(e,t){if(t.size>0){let i={};for(let[a,o]of t)i[a]=[...o];try{e.sessionStorage.setItem(GC,JSON.stringify(i))}catch(a){Sn(!1,`Failed to save applied view transitions in sessionStorage (${a}).`)}}}function lw(){let e,t,i=new Promise((a,o)=>{e=async c=>{a(c);try{await i}catch{}},t=async c=>{o(c);try{await i}catch{}}});return{promise:i,resolve:e,reject:t}}var ro=b.createContext(null);ro.displayName="DataRouter";var hu=b.createContext(null);hu.displayName="DataRouterState";var nT=b.createContext(!1);function rT(){return b.useContext(nT)}var Ry=b.createContext({isTransitioning:!1});Ry.displayName="ViewTransition";var iT=b.createContext(new Map);iT.displayName="Fetchers";var n9=b.createContext(null);n9.displayName="Await";var Wr=b.createContext(null);Wr.displayName="Navigation";var nh=b.createContext(null);nh.displayName="Location";var yi=b.createContext({outlet:null,matches:[],isDataRoute:!1});yi.displayName="Route";var Cy=b.createContext(null);Cy.displayName="RouteError";var aT="REACT_ROUTER_ERROR",r9="REDIRECT",i9="ROUTE_ERROR_RESPONSE";function a9(e){if(e.startsWith(`${aT}:${r9}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function s9(e){if(e.startsWith(`${aT}:${i9}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new fu(t.status,t.statusText,t.data)}catch{}}function o9(e,{relative:t}={}){pt(yl(),"useHref() may be used only in the context of a component.");let{basename:i,navigator:a}=b.useContext(Wr),{hash:o,pathname:c,search:u}=mu(e,{relative:t}),f=c;return i!=="/"&&(f=c==="/"?i:hi([i,c])),a.createHref({pathname:f,search:u,hash:o})}function yl(){return b.useContext(nh)!=null}function Zr(){return pt(yl(),"useLocation() may be used only in the context of a component."),b.useContext(nh).location}var sT="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function oT(e){b.useContext(Wr).static||b.useLayoutEffect(e)}function io(){let{isDataRoute:e}=b.useContext(yi);return e?E9():l9()}function l9(){pt(yl(),"useNavigate() may be used only in the context of a component.");let e=b.useContext(ro),{basename:t,navigator:i}=b.useContext(Wr),{matches:a}=b.useContext(yi),{pathname:o}=Zr(),c=JSON.stringify(th(a)),u=b.useRef(!1);return oT(()=>{u.current=!0}),b.useCallback((h,m={})=>{if(Sn(u.current,sT),!u.current)return;if(typeof h=="number"){i.go(h);return}let g=uu(h,JSON.parse(c),o,m.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:hi([t,g.pathname])),$o(typeof h=="string"?h:xr(h),i.createHref(g),xy(i),"reject"),(m.replace?i.replace:i.push)(g,m.state,m)},[t,i,c,o,e])}var c9=b.createContext(null);function u9(e){let t=b.useContext(yi).outlet;return b.useMemo(()=>t&&b.createElement(c9.Provider,{value:e},t),[t,e])}function f9(){let{matches:e}=b.useContext(yi);return e[e.length-1]?.params??{}}function mu(e,{relative:t}={}){let{matches:i}=b.useContext(yi),{pathname:a}=Zr(),o=JSON.stringify(th(i));return b.useMemo(()=>uu(e,JSON.parse(o),a,t==="path"),[e,o,a,t])}function d9(e,t,i){pt(yl(),"useRoutes() may be used only in the context of a component.");let{navigator:a}=b.useContext(Wr),{matches:o}=b.useContext(yi),c=o[o.length-1],u=c?c.params:{},f=c?c.pathname:"/",h=c?c.pathnameBase:"/",m=c&&c.route;{let R=m&&m.path||"";cT(f,!m||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${f}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. - -Please change the parent to .`)}let g=Zr(),v;v=g;let S=v.pathname||"/",x=S;if(h!=="/"){let R=h.replace(/^\//,"").split("/");x="/"+S.replace(/^\//,"").split("/").slice(R.length).join("/")}let E=i&&i.state.matches.length?i.state.matches.map(R=>Object.assign(R,{route:i.manifest[R.route.id]||R.route})):zC(e,{pathname:x});return Sn(m||E!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Sn(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`),y9(E&&E.map(R=>Object.assign({},R,{params:Object.assign({},u,R.params),pathname:hi([h,a.encodeLocation?a.encodeLocation(R.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?h:hi([h,a.encodeLocation?a.encodeLocation(R.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),o,i)}function h9(){let e=w9(),t=$c(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),i=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:a},c={padding:"2px 4px",backgroundColor:a},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:c},"ErrorBoundary")," or"," ",b.createElement("code",{style:c},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),i?b.createElement("pre",{style:o},i):null,u)}var m9=b.createElement(h9,null),lT=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const i=s9(e.digest);i&&(e=i)}let t=e!==void 0?b.createElement(yi.Provider,{value:this.props.routeContext},b.createElement(Cy.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(p9,{error:e},t):t}};lT.contextType=nT;var ng=new WeakMap;function p9({children:e,error:t}){let{basename:i,navigator:a}=b.useContext(Wr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=a9(t.digest);if(o){let c=ng.get(t);if(c)throw c;let u=HC(o.location,i),f=u.absoluteURL||u.to;if($o(o.location,f,xy(a),"allow-explicit"),a0(f))throw new Error("Invalid redirect location");if(IC&&!ng.get(t))if(u.isExternal||o.reloadDocument)window.location.href=f;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:o.replace}));throw ng.set(t,h),h}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f}`})}}return e}function g9({routeContext:e,match:t,children:i}){let a=b.useContext(ro);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(yi.Provider,{value:e},i)}function y9(e,t=[],i){let a=i?.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let o=e,c=a?.errors;if(c!=null){let g=o.findIndex(v=>v.route.id&&c?.[v.route.id]!==void 0);pt(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),o=o.slice(0,Math.min(o.length,g+1))}let u=!1,f=-1;if(i&&a){u=a.renderFallback;for(let g=0;g=0?o=o.slice(0,f+1):o=[o[0]];break}}}}let h=i?.onError,m=a&&h?(g,v)=>{h(g,{location:a.location,params:a.matches?.[0]?.params??{},pattern:du(a.matches),errorInfo:v})}:void 0;return o.reduceRight((g,v,S)=>{let x,E=!1,w=null,R=null;a&&(x=c&&v.route.id?c[v.route.id]:void 0,w=v.route.errorElement||m9,u&&(f<0&&S===0?(cT("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,R=null):f===S&&(E=!0,R=v.route.hydrateFallbackElement||null)));let T=t.concat(o.slice(0,S+1)),O=()=>{let N;return x?N=w:E?N=R:v.route.Component?N=b.createElement(v.route.Component,null):v.route.element?N=v.route.element:N=g,b.createElement(g9,{match:v,routeContext:{outlet:g,matches:T,isDataRoute:a!=null},children:N})};return a&&(v.route.ErrorBoundary||v.route.errorElement||S===0)?b.createElement(lT,{location:a.location,revalidation:a.revalidation,component:w,error:x,children:O(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:m}):O()},null)}function Ty(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function v9(e){let t=b.useContext(ro);return pt(t,Ty(e)),t}function b9(e){let t=b.useContext(hu);return pt(t,Ty(e)),t}function x9(e){let t=b.useContext(yi);return pt(t,Ty(e)),t}function Ay(e){let t=x9(e),i=t.matches[t.matches.length-1];return pt(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function S9(){return Ay("useRouteId")}function w9(){let e=b.useContext(Cy),t=b9("useRouteError"),i=Ay("useRouteError");return e!==void 0?e:t.errors?.[i]}function E9(){let{router:e}=v9("useNavigate"),t=Ay("useNavigate"),i=b.useRef(!1);return oT(()=>{i.current=!0}),b.useCallback(async(o,c={})=>{Sn(i.current,sT),i.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...c}))},[e,t])}var cw={};function cT(e,t,i){!t&&!cw[e]&&(cw[e]=!0,Sn(!1,i))}var uw={};function fw(e,t){!e&&!uw[t]&&(uw[t]=!0,console.warn(t))}var R9="useOptimistic",dw=YE[R9],C9=()=>{};function T9(e){return dw?dw(e):[e,C9]}function A9(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Sn(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:b.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&Sn(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:b.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&Sn(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:b.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var M9=["HydrateFallback","hydrateFallbackElement"],j9=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=i=>{this.status==="pending"&&(this.status="resolved",e(i))},this.reject=i=>{this.status==="pending"&&(this.status="rejected",t(i))}})}};function O9({router:e,flushSync:t,onError:i,useTransitions:a}){a=rT()||a;let[c,u]=b.useState(e.state),[f,h]=T9(c),[m,g]=b.useState(),[v,S]=b.useState({isTransitioning:!1}),[x,E]=b.useState(),[w,R]=b.useState(),[T,O]=b.useState(),N=b.useRef(new Map),j=b.useCallback((A,{deletedFetchers:F,newErrors:H,flushSync:X,viewTransitionOpts:J})=>{H&&i&&Object.values(H).forEach(ee=>i(ee,{location:A.location,params:A.matches[0]?.params??{},pattern:du(A.matches)})),A.fetchers.forEach((ee,re)=>{ee.data!==void 0&&N.current.set(re,ee.data)}),F.forEach(ee=>N.current.delete(ee)),fw(X===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let $=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(fw(J==null||$,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!J||!$){t&&X?t(()=>u(A)):a===!1?u(A):b.startTransition(()=>{a===!0&&h(ee=>hw(ee,A)),u(A)});return}if(t&&X){t(()=>{w&&(x?.resolve(),w.skipTransition()),S({isTransitioning:!0,flushSync:!0,currentLocation:J.currentLocation,nextLocation:J.nextLocation})});let ee=e.window.document.startViewTransition(()=>{t(()=>u(A))});ee.finished.finally(()=>{t(()=>{E(void 0),R(void 0),g(void 0),S({isTransitioning:!1})})}),t(()=>R(ee));return}w?(x?.resolve(),w.skipTransition(),O({state:A,currentLocation:J.currentLocation,nextLocation:J.nextLocation})):(g(A),S({isTransitioning:!0,flushSync:!1,currentLocation:J.currentLocation,nextLocation:J.nextLocation}))},[e.window,t,w,x,a,h,i]);b.useLayoutEffect(()=>e.subscribe(j),[e,j]),b.useEffect(()=>{v.isTransitioning&&!v.flushSync&&E(new j9)},[v]),b.useEffect(()=>{if(x&&m&&e.window){let A=m,F=x.promise,H=e.window.document.startViewTransition(async()=>{a===!1?u(A):b.startTransition(()=>{a===!0&&h(X=>hw(X,A)),u(A)}),await F});H.finished.finally(()=>{E(void 0),R(void 0),g(void 0),S({isTransitioning:!1})}),R(H)}},[m,x,e.window,a,h]),b.useEffect(()=>{x&&m&&f.location.key===m.location.key&&x.resolve()},[x,w,f.location,m]),b.useEffect(()=>{!v.isTransitioning&&T&&(g(T.state),S({isTransitioning:!0,flushSync:!1,currentLocation:T.currentLocation,nextLocation:T.nextLocation}),O(void 0))},[v.isTransitioning,T]);let L=b.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:A=>e.navigate(A),push:(A,F,H)=>e.navigate(A,{state:F,preventScrollReset:H?.preventScrollReset}),replace:(A,F,H)=>e.navigate(A,{replace:!0,state:F,preventScrollReset:H?.preventScrollReset})}),[e]),P=e.basename||"/",D=b.useMemo(()=>({router:e,navigator:L,static:!1,basename:P,onError:i}),[e,L,P,i]);return b.createElement(b.Fragment,null,b.createElement(ro.Provider,{value:D},b.createElement(hu.Provider,{value:f},b.createElement(iT.Provider,{value:N.current},b.createElement(Ry.Provider,{value:v},b.createElement(L9,{basename:P,location:f.location,navigationType:f.historyAction,navigator:L,useTransitions:a},b.createElement(D9,{routes:e.routes,manifest:e.manifest,future:e.future,state:f,isStatic:!1,onError:i})))))),null)}function hw(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var D9=b.memo(N9);function N9({routes:e,manifest:t,future:i,state:a,isStatic:o,onError:c}){return d9(e,void 0,{manifest:t,state:a,isStatic:o,onError:c})}function Ca({to:e,replace:t,state:i,relative:a}){pt(yl()," may be used only in the context of a component.");let{static:o,navigator:c}=b.useContext(Wr);Sn(!o," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:u}=b.useContext(yi),{pathname:f}=Zr(),h=io(),m=uu(e,th(u),f,a==="path");$o(typeof e=="string"?e:xr(e),c.createHref(m),xy(c),"reject");let g=JSON.stringify(m);return b.useEffect(()=>{h(JSON.parse(g),{replace:t,state:i,relative:a})},[h,g,a,t,i]),null}function uT(e){return u9(e.context)}function L9({basename:e="/",children:t=null,location:i,navigationType:a="POP",navigator:o,static:c=!1,useTransitions:u}){pt(!yl(),"You cannot render a inside another . You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:f,navigator:o,static:c,useTransitions:u,future:{}}),[f,o,c,u]);typeof i=="string"&&(i=Zi(i));let{pathname:m="/",search:g="",hash:v="",state:S=null,key:x="default",mask:E}=i,w=b.useMemo(()=>{let R=pi(m,f);return R==null?null:{location:{pathname:R,search:g,hash:v,state:S,key:x,mask:E},navigationType:a}},[f,m,g,v,S,x,a,E]);return Sn(w!=null,` is not able to match the URL "${m}${g}${v}" because it does not start with the basename, so the won't render anything.`),w==null?null:b.createElement(Wr.Provider,{value:h},b.createElement(nh.Provider,{children:t,value:w}))}var ld="get",cd="application/x-www-form-urlencoded";function rh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function k9(e){return rh(e)&&e.tagName.toLowerCase()==="button"}function z9(e){return rh(e)&&e.tagName.toLowerCase()==="form"}function P9(e){return rh(e)&&e.tagName.toLowerCase()==="input"}function _9(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function V9(e,t){return e.button===0&&(!t||t==="_self")&&!_9(e)}function o0(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,i)=>{let a=e[i];return t.concat(Array.isArray(a)?a.map(o=>[i,o]):[[i,a]])},[]))}function U9(e,t){let i=o0(e);return t&&t.forEach((a,o)=>{i.has(o)||t.getAll(o).forEach(c=>{i.append(o,c)})}),i}var Nf=null;function B9(){if(Nf===null)try{new FormData(document.createElement("form"),0),Nf=!1}catch{Nf=!0}return Nf}var I9=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function rg(e){return e!=null&&!I9.has(e)?(Sn(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${cd}"`),null):e}function H9(e,t){let i,a,o,c,u;if(z9(e)){let f=e.getAttribute("action");a=f?pi(f,t):null,i=e.getAttribute("method")||ld,o=rg(e.getAttribute("enctype"))||cd,c=new FormData(e)}else if(k9(e)||P9(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a + +

+ {status} +

+ + + ); +} diff --git a/site/src/components/console/ConsoleLayout.tsx b/site/src/components/console/ConsoleLayout.tsx index 8ff7188..357d46a 100644 --- a/site/src/components/console/ConsoleLayout.tsx +++ b/site/src/components/console/ConsoleLayout.tsx @@ -17,6 +17,7 @@ import { cx } from "../../helpers/cx"; import { useFluidHover, useRegisterFluidHoverItem } from "../../hooks/use-fluid-hover"; import { usePlane } from "../../hooks/usePlane"; import { useSession } from "../../hooks/useSession"; +import { SessionUnavailable } from "../auth/SessionUnavailable"; import { FluidHoverHighlight } from "../fluid-hover-highlight"; import { BrandMark } from "../shared/BrandMark"; import { Icon } from "../shared/Icon"; @@ -105,7 +106,7 @@ function ConsoleNav({ items }: { items: NavEntry[] }) { * as a full page load would. */ export function ConsoleLayout() { - const { session, signOut } = useSession(); + const { session, refresh, signOut } = useSession(); const location = useLocation(); const mainRef = useRef(null); const firstPath = useRef(true); @@ -120,6 +121,7 @@ export function ConsoleLayout() { }, [location.pathname]); if (session.status === "loading") return null; + if (session.status === "unavailable") return ; if (session.status === "signedOut") return ; if (session.user.waiting) return ; const nav = session.user.admin ? [...CONSOLE_NAV, ADMIN_NAV] : CONSOLE_NAV; diff --git a/site/src/constants/admin.ts b/site/src/constants/admin.ts index abaa547..15c895a 100644 --- a/site/src/constants/admin.ts +++ b/site/src/constants/admin.ts @@ -35,6 +35,7 @@ export const ADMIN_COPY = { approved: (email: string) => `Approved ${email}. We emailed them.`, approvedNoEmail: (email: string) => `Approved ${email}, but the email to them could not be sent. They can sign in now.`, + alreadyApproved: (email: string) => `${email} was already approved, so no email was sent.`, removed: (email: string) => `Removed ${email}.`, admin: "admin", /** Under an approved account: who approved it. */ diff --git a/site/src/constants/auth.ts b/site/src/constants/auth.ts index c6cfe32..1660f75 100644 --- a/site/src/constants/auth.ts +++ b/site/src/constants/auth.ts @@ -42,7 +42,7 @@ export const AUTH_COPY = { signup: { kicker: "Free · $0/month", title: "Gate your first agent change.", - lead: "Create your free account, then open the console with a plane of example intents. No credit card or API key is needed to try it.", + lead: "Create your free account with just your email. Floodwall is in beta, so new accounts join the waitlist, and we let people into the console a few at a time. No credit card or API key is needed.", note: "We will email you a six-digit sign-in code. There is no password. Your account starts on the Free plan.", terms: "Creating an account means you accept the terms. The privacy notice lists what we store.", switchPrompt: "Already have an account?", @@ -84,6 +84,13 @@ export const AUTH_COPY = { checking: "Checking…", stillWaiting: "Still waiting for approval. We'll email you when it's done.", }, + /** On a signed-in page, when the service couldn't say who is signed in. */ + unavailable: { + title: "We couldn't check your sign-in.", + lead: "The sign-in service didn't answer, so we can't tell yet whether you're signed in. Check your connection and try again.", + retry: "Try again", + retrying: "Checking…", + }, /** When the sign-in service can't be asked, or gives no reason of its own. */ service: { unreachable: "We could not reach the sign-in service. Check your connection and try again.", diff --git a/site/src/constants/links.ts b/site/src/constants/links.ts index aebcb8f..6a7d063 100644 --- a/site/src/constants/links.ts +++ b/site/src/constants/links.ts @@ -12,8 +12,8 @@ export const PRICING_PATH = "/pricing"; export const EARLY_ACCESS_URL = "/signup"; // Requests went to the team's form on Tally before the site had its own waitlist. To go back to it, -// restore this URL, and in index.html link the noscript note to it again (%EARLY_ACCESS_URL%, which -// vite.config.ts checks for and fills in). +// restore this URL, link index.html's noscript note to %EARLY_ACCESS_URL% again, and put back the +// check and fill-in for it in vite.config.ts's structured-data plugin (removed in c5ea719). // export const EARLY_ACCESS_URL = "https://tally.so/r/6DJeoP"; // A subdomain: www.proto.erp.ai only redirects back here. diff --git a/site/src/helpers/admin.ts b/site/src/helpers/admin.ts index 868aefb..3cbe141 100644 --- a/site/src/helpers/admin.ts +++ b/site/src/helpers/admin.ts @@ -6,6 +6,7 @@ import { callService } from "./auth"; export const adminClient = { list: () => callService<{ signup: SignupMode; users: AdminAccount[] }>("/admin/users"), - approve: (email: string) => callService<{ approved: true; emailed: boolean }>("/admin/approve", { email }), + approve: (email: string) => + callService<{ approved: true; emailed: boolean; alreadyApproved?: true }>("/admin/approve", { email }), remove: (email: string) => callService<{ removed: true }>("/admin/remove", { email }), }; diff --git a/site/src/helpers/auth.ts b/site/src/helpers/auth.ts index b08e331..a69b87f 100644 --- a/site/src/helpers/auth.ts +++ b/site/src/helpers/auth.ts @@ -141,11 +141,7 @@ function serviceClient(): AuthClient { await callService("/auth/verify", { email, code }); }, async getUser() { - try { - return (await callService<{ user: AuthUser | null }>("/auth/session")).user; - } catch { - return null; - } + return (await callService<{ user: AuthUser | null }>("/auth/session")).user; }, async signOut() { await callService("/auth/signout", {}); diff --git a/site/src/hooks/useSession.ts b/site/src/hooks/useSession.ts index 2225f26..a7a39da 100644 --- a/site/src/hooks/useSession.ts +++ b/site/src/hooks/useSession.ts @@ -4,21 +4,26 @@ import type { AuthSession, AuthUser } from "../types/auth"; const toSession = (user: AuthUser | null): AuthSession => (user ? { status: "signedIn", user } : { status: "signedOut" }); -/** Who is signed in, read when the page opens and again on `refresh`. */ +/** + * Who is signed in, read when the page opens and again on `refresh`. When the service can't be + * asked, the session is "unavailable", not signed out: the cookie may still be good. + */ export function useSession() { const [session, setSession] = useState({ status: "loading" }); useEffect(() => { let live = true; - void authClient.getUser().then((user) => { - if (live) setSession(toSession(user)); - }); + authClient.getUser().then( + (user) => live && setSession(toSession(user)), + () => live && setSession({ status: "unavailable" }), + ); return () => { live = false; }; }, []); - // Asks again, e.g. whether a waiting account has been approved. + // Asks again, e.g. whether a waiting account has been approved. If the + // service can't be asked, it throws and the session stays as it was. const refresh = useCallback(async () => { const user = await authClient.getUser(); setSession(toSession(user)); diff --git a/site/src/pages/AccountPage.tsx b/site/src/pages/AccountPage.tsx index c5c59c0..29009a6 100644 --- a/site/src/pages/AccountPage.tsx +++ b/site/src/pages/AccountPage.tsx @@ -1,6 +1,7 @@ import { useState } from "react"; import { Navigate, useNavigate } from "react-router"; import { AuthPage } from "../components/auth/AuthPage"; +import { SessionUnavailable } from "../components/auth/SessionUnavailable"; import { ButtonLink } from "../components/shared/ButtonLink"; import { Button } from "../components/ui/button"; import { Card } from "../components/ui/card"; @@ -13,12 +14,13 @@ import { authCard, pillOutline } from "../styles/classes"; const COPY = AUTH_COPY.account; export function AccountPage() { - const { session, signOut } = useSession(); + const { session, refresh, signOut } = useSession(); const navigate = useNavigate(); const [leaving, setLeaving] = useState(false); const [status, setStatus] = useState(""); if (session.status === "loading") return null; + if (session.status === "unavailable") return ; if (session.status === "signedOut" && !leaving) return ; if (session.status === "signedIn" && session.user.waiting) return ; diff --git a/site/src/pages/WaitlistPage.tsx b/site/src/pages/WaitlistPage.tsx index 7a2b97e..6dc0894 100644 --- a/site/src/pages/WaitlistPage.tsx +++ b/site/src/pages/WaitlistPage.tsx @@ -1,6 +1,7 @@ import { useState } from "react"; import { Navigate, useNavigate } from "react-router"; import { AuthPage } from "../components/auth/AuthPage"; +import { SessionUnavailable } from "../components/auth/SessionUnavailable"; import { Button } from "../components/ui/button"; import { Card } from "../components/ui/card"; import { AUTH_COPY, AUTH_PATHS } from "../constants/auth"; @@ -22,16 +23,23 @@ export function WaitlistPage() { const [status, setStatus] = useState(""); if (session.status === "loading") return null; + if (session.status === "unavailable") return ; if (session.status === "signedOut" && busy !== "leave") return ; if (session.status === "signedIn" && !session.user.waiting) return ; async function onCheck() { setBusy("check"); setStatus(""); - const user = await refresh(); - setBusy(null); - // Approved or signed out, the redirects above take over. - if (user?.waiting) setStatus(COPY.stillWaiting); + try { + const user = await refresh(); + // Approved or signed out, the redirects above take over. + if (user?.waiting) setStatus(COPY.stillWaiting); + } catch (error) { + // The service couldn't be asked: still waiting, as far as anyone knows. + setStatus(error instanceof Error ? error.message : AUTH_COPY.service.failed); + } finally { + setBusy(null); + } } async function onSignOut() { diff --git a/site/src/pages/console/AdminPage.tsx b/site/src/pages/console/AdminPage.tsx index b937e5a..9a5121f 100644 --- a/site/src/pages/console/AdminPage.tsx +++ b/site/src/pages/console/AdminPage.tsx @@ -50,8 +50,14 @@ export function AdminPage() { setStatus(""); try { if (action === "approve") { - const { emailed } = await adminClient.approve(email); - setStatus(emailed ? ADMIN_COPY.approved(email) : ADMIN_COPY.approvedNoEmail(email)); + const { emailed, alreadyApproved } = await adminClient.approve(email); + setStatus( + alreadyApproved + ? ADMIN_COPY.alreadyApproved(email) + : emailed + ? ADMIN_COPY.approved(email) + : ADMIN_COPY.approvedNoEmail(email), + ); } else { await adminClient.remove(email); setStatus(ADMIN_COPY.removed(email)); diff --git a/site/src/types/auth.ts b/site/src/types/auth.ts index e8e6a48..699cec8 100644 --- a/site/src/types/auth.ts +++ b/site/src/types/auth.ts @@ -25,7 +25,9 @@ export type SignupMode = "waitlist" | "open"; export type AuthSession = | { status: "loading" } | { status: "signedOut" } - | { status: "signedIn"; user: AuthUser }; + | { status: "signedIn"; user: AuthUser } + /** The sign-in service couldn't be asked, so it isn't known whether anyone is signed in. */ + | { status: "unavailable" }; export type AuthClient = { /** @@ -35,7 +37,7 @@ export type AuthClient = { sendCode: (email: string) => Promise<{ code?: string }>; /** Checks the code and starts a session. Signing in with a new address creates the account. */ verifyCode: (email: string, code: string) => Promise; - /** Who is signed in; null when no one is, or the service can't be asked. */ + /** Who is signed in, or null when no one is. Throws when the service can't be asked. */ getUser: () => Promise; /** Ends the session, or throws if it couldn't. */ signOut: () => Promise;