@realtimex/folio 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/api/server.ts +1 -1
- package/api/src/config/index.ts +8 -0
- package/bin/folio.js +6 -0
- package/dist/api/server.js +1 -1
- package/dist/api/src/config/index.js +9 -0
- package/dist/assets/{index-Uy-ai3Dh.js → index-COmZGXRg.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ Folio is designed to be run locally on your machine while securely syncing data
|
|
|
29
29
|
```bash
|
|
30
30
|
npx @realtimex/folio@latest --port 5176
|
|
31
31
|
```
|
|
32
|
+
*(You can change the `--port` to any available port you prefer).*
|
|
32
33
|
2. **Configure your Database:**
|
|
33
34
|
Follow the Setup Wizard in your browser. You can use **Zero-Config Cloud Provisioning** to automatically set up a secure Supabase project, or manually provide an existing Supabase URL and Key.
|
|
34
35
|
3. **Connect your Integrations:**
|
package/api/server.ts
CHANGED
|
@@ -112,7 +112,7 @@ if (existsSync(path.join(distUiPath, "index.html"))) {
|
|
|
112
112
|
app.use(errorHandler);
|
|
113
113
|
|
|
114
114
|
const server = app.listen(config.port, () => {
|
|
115
|
-
logger.info(
|
|
115
|
+
logger.info(`Folio API started. UI accessible at http://localhost:${config.port}`, {
|
|
116
116
|
port: config.port,
|
|
117
117
|
environment: config.nodeEnv,
|
|
118
118
|
packageRoot: config.packageRoot
|
package/api/src/config/index.ts
CHANGED
|
@@ -43,6 +43,14 @@ function parseArgs(args: string[]): { port: number | null; noUi: boolean } {
|
|
|
43
43
|
if (!Number.isNaN(candidate) && candidate > 0 && candidate < 65536) {
|
|
44
44
|
port = candidate;
|
|
45
45
|
}
|
|
46
|
+
} else {
|
|
47
|
+
const portArg = args.find(a => a.startsWith("--port="));
|
|
48
|
+
if (portArg) {
|
|
49
|
+
const candidate = Number.parseInt(portArg.split("=")[1], 10);
|
|
50
|
+
if (!Number.isNaN(candidate) && candidate > 0 && candidate < 65536) {
|
|
51
|
+
port = candidate;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
return {
|
package/bin/folio.js
CHANGED
|
@@ -14,12 +14,18 @@ let port = "5176";
|
|
|
14
14
|
const portIndex = args.indexOf("--port");
|
|
15
15
|
if (portIndex !== -1 && args[portIndex + 1]) {
|
|
16
16
|
port = args[portIndex + 1];
|
|
17
|
+
} else {
|
|
18
|
+
const portArg = args.find(a => a.startsWith("--port="));
|
|
19
|
+
if (portArg) {
|
|
20
|
+
port = portArg.split("=")[1];
|
|
21
|
+
}
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
const noUi = args.includes("--no-ui");
|
|
20
25
|
|
|
21
26
|
console.log("🚀 Folio starting...");
|
|
22
27
|
console.log(`📡 Port: ${port}`);
|
|
28
|
+
console.log(`🔗 UI URL: http://localhost:${port}`);
|
|
23
29
|
if (noUi) console.log("🖥️ Mode: No-UI");
|
|
24
30
|
|
|
25
31
|
const distServerPath = join(__dirname, "..", "dist", "api", "server.js");
|
package/dist/api/server.js
CHANGED
|
@@ -90,7 +90,7 @@ else {
|
|
|
90
90
|
}
|
|
91
91
|
app.use(errorHandler);
|
|
92
92
|
const server = app.listen(config.port, () => {
|
|
93
|
-
logger.info(
|
|
93
|
+
logger.info(`Folio API started. UI accessible at http://localhost:${config.port}`, {
|
|
94
94
|
port: config.port,
|
|
95
95
|
environment: config.nodeEnv,
|
|
96
96
|
packageRoot: config.packageRoot
|
|
@@ -38,6 +38,15 @@ function parseArgs(args) {
|
|
|
38
38
|
port = candidate;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
else {
|
|
42
|
+
const portArg = args.find(a => a.startsWith("--port="));
|
|
43
|
+
if (portArg) {
|
|
44
|
+
const candidate = Number.parseInt(portArg.split("=")[1], 10);
|
|
45
|
+
if (!Number.isNaN(candidate) && candidate > 0 && candidate < 65536) {
|
|
46
|
+
port = candidate;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
41
50
|
return {
|
|
42
51
|
port,
|
|
43
52
|
noUi: args.includes("--no-ui")
|
|
@@ -92,7 +92,7 @@ ${N}`}class Tt extends Error{constructor({message:e,code:s,cause:r,name:l}){var
|
|
|
92
92
|
|
|
93
93
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
94
94
|
|
|
95
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return v.useEffect(()=>{t&&(document.getElementById(t)||console.error(s))},[s,t]),null},LO="DialogDescriptionWarning",UO=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${k1(LO).contentName}}.`;return v.useEffect(()=>{const l=t.current?.getAttribute("aria-describedby");e&&l&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},BO=p1,VO=v1,IO=x1,$O=b1,qO=S1,HO=_1,GO=T1;function Za({...t}){return o.jsx(BO,{"data-slot":"dialog",...t})}function FO({...t}){return o.jsx(VO,{"data-slot":"dialog-portal",...t})}function C1({className:t,...e}){return o.jsx(IO,{"data-slot":"dialog-overlay",className:ge("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function er({className:t,children:e,...s}){return o.jsxs(FO,{"data-slot":"dialog-portal",children:[o.jsx(C1,{}),o.jsxs($O,{"data-slot":"dialog-content",className:ge("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...s,children:[e,o.jsxs(GO,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o.jsx(zn,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fi({className:t,...e}){return o.jsx("div",{"data-slot":"dialog-header",className:ge("flex flex-col gap-2 text-center sm:text-left",t),...e})}function ti({className:t,...e}){return o.jsx("div",{"data-slot":"dialog-footer",className:ge("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function hi({className:t,...e}){return o.jsx(qO,{"data-slot":"dialog-title",className:ge("text-lg leading-none font-semibold",t),...e})}function tl({className:t,...e}){return o.jsx(HO,{"data-slot":"dialog-description",className:ge("text-muted-foreground text-sm",t),...e})}function KO({open:t,onOpenChange:e,health:s,isBootstrapping:r,initStatus:l,sessionStatus:u,migrationStatus:d,onRunMigration:f}){return o.jsx(Za,{open:t,onOpenChange:e,children:o.jsxs(er,{className:"sm:max-w-md",children:[o.jsxs(fi,{children:[o.jsxs(hi,{className:"flex items-center gap-2",children:[o.jsx(ui,{className:"w-5 h-5 text-primary"}),"Runtime Health Engine"]}),o.jsx(tl,{children:"Diagnostic overview of active foundation services."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[[{label:"API Provider",value:s,status:s==="ok"?"success":s==="error"?"error":"warning"},{label:"Bootstrap Cycle",value:r?"running":"stable",status:r?"warning":"success"},{label:"Init Integrity",value:l,status:l==="initialized"?"success":l==="error"?"error":"warning"},{label:"Auth Context",value:u,status:u==="authenticated"?"success":u==="error"?"error":"warning"}].map(m=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-muted/50 border",children:[o.jsx("span",{className:"text-sm font-medium",children:m.label}),o.jsx(Pt,{variant:"outline",className:ge("text-[10px] uppercase font-bold",m.status==="success"&&"border-emerald-500/50 text-emerald-500 bg-emerald-500/5",m.status==="warning"&&"border-amber-500/50 text-amber-500 bg-amber-500/5",m.status==="error"&&"border-destructive/50 text-destructive bg-destructive/5"),children:m.value})]},m.label)),o.jsxs("div",{className:ge("p-4 rounded-xl border flex flex-col gap-3 transition-all",d?.needsMigration?"bg-amber-500/10 border-amber-500/20 text-amber-600 dark:text-amber-500":"bg-primary/5 border-primary/10 text-primary"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[d?.needsMigration?o.jsx(ui,{className:"w-4 h-4 shrink-0 animate-pulse"}):o.jsx(ga,{className:"w-4 h-4 shrink-0"}),o.jsx("p",{className:"text-xs font-semibold leading-relaxed",children:d?d.message:"Checking database schema migration parity..."})]}),d?.needsMigration&&f&&o.jsx(ae,{size:"sm",className:"w-full bg-amber-500 hover:bg-amber-600 text-white font-black text-[10px] uppercase tracking-widest h-8 rounded-lg",onClick:f,children:"Run System Migration"})]})]})]})})}const Wa="0.1.
|
|
95
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return v.useEffect(()=>{t&&(document.getElementById(t)||console.error(s))},[s,t]),null},LO="DialogDescriptionWarning",UO=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${k1(LO).contentName}}.`;return v.useEffect(()=>{const l=t.current?.getAttribute("aria-describedby");e&&l&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},BO=p1,VO=v1,IO=x1,$O=b1,qO=S1,HO=_1,GO=T1;function Za({...t}){return o.jsx(BO,{"data-slot":"dialog",...t})}function FO({...t}){return o.jsx(VO,{"data-slot":"dialog-portal",...t})}function C1({className:t,...e}){return o.jsx(IO,{"data-slot":"dialog-overlay",className:ge("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function er({className:t,children:e,...s}){return o.jsxs(FO,{"data-slot":"dialog-portal",children:[o.jsx(C1,{}),o.jsxs($O,{"data-slot":"dialog-content",className:ge("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...s,children:[e,o.jsxs(GO,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o.jsx(zn,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fi({className:t,...e}){return o.jsx("div",{"data-slot":"dialog-header",className:ge("flex flex-col gap-2 text-center sm:text-left",t),...e})}function ti({className:t,...e}){return o.jsx("div",{"data-slot":"dialog-footer",className:ge("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function hi({className:t,...e}){return o.jsx(qO,{"data-slot":"dialog-title",className:ge("text-lg leading-none font-semibold",t),...e})}function tl({className:t,...e}){return o.jsx(HO,{"data-slot":"dialog-description",className:ge("text-muted-foreground text-sm",t),...e})}function KO({open:t,onOpenChange:e,health:s,isBootstrapping:r,initStatus:l,sessionStatus:u,migrationStatus:d,onRunMigration:f}){return o.jsx(Za,{open:t,onOpenChange:e,children:o.jsxs(er,{className:"sm:max-w-md",children:[o.jsxs(fi,{children:[o.jsxs(hi,{className:"flex items-center gap-2",children:[o.jsx(ui,{className:"w-5 h-5 text-primary"}),"Runtime Health Engine"]}),o.jsx(tl,{children:"Diagnostic overview of active foundation services."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[[{label:"API Provider",value:s,status:s==="ok"?"success":s==="error"?"error":"warning"},{label:"Bootstrap Cycle",value:r?"running":"stable",status:r?"warning":"success"},{label:"Init Integrity",value:l,status:l==="initialized"?"success":l==="error"?"error":"warning"},{label:"Auth Context",value:u,status:u==="authenticated"?"success":u==="error"?"error":"warning"}].map(m=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-muted/50 border",children:[o.jsx("span",{className:"text-sm font-medium",children:m.label}),o.jsx(Pt,{variant:"outline",className:ge("text-[10px] uppercase font-bold",m.status==="success"&&"border-emerald-500/50 text-emerald-500 bg-emerald-500/5",m.status==="warning"&&"border-amber-500/50 text-amber-500 bg-amber-500/5",m.status==="error"&&"border-destructive/50 text-destructive bg-destructive/5"),children:m.value})]},m.label)),o.jsxs("div",{className:ge("p-4 rounded-xl border flex flex-col gap-3 transition-all",d?.needsMigration?"bg-amber-500/10 border-amber-500/20 text-amber-600 dark:text-amber-500":"bg-primary/5 border-primary/10 text-primary"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[d?.needsMigration?o.jsx(ui,{className:"w-4 h-4 shrink-0 animate-pulse"}):o.jsx(ga,{className:"w-4 h-4 shrink-0"}),o.jsx("p",{className:"text-xs font-semibold leading-relaxed",children:d?d.message:"Checking database schema migration parity..."})]}),d?.needsMigration&&f&&o.jsx(ae,{size:"sm",className:"w-full bg-amber-500 hover:bg-amber-600 text-white font-black text-[10px] uppercase tracking-widest h-8 rounded-lg",onClick:f,children:"Run System Migration"})]})]})]})})}const Wa="0.1.3",YO="20260228000001";async function XO(t,e){const s=Promise.resolve(t);let r=null;const l=new Promise((u,d)=>{r=setTimeout(()=>{d(new Error(`Operation timed out after ${e}ms`))},e)});try{return await Promise.race([s,l])}finally{r&&clearTimeout(r)}}async function WO(t){try{const{data:e,error:s}=await XO(t.rpc("get_latest_migration_timestamp"),12e3);if(s)return s.code==="42883"?{latestMigrationTimestamp:"0"}:{latestMigrationTimestamp:null};const r=e??null;return r&&r>="29990000000000"?{latestMigrationTimestamp:null}:{latestMigrationTimestamp:r}}catch{return{latestMigrationTimestamp:null}}}async function A1(t){const e=await WO(t);return!e.latestMigrationTimestamp||e.latestMigrationTimestamp.trim()===""?{needsMigration:!0,appVersion:Wa,latestMigrationTimestamp:e.latestMigrationTimestamp,message:"Database migration state unknown."}:YO>e.latestMigrationTimestamp?{needsMigration:!0,appVersion:Wa,latestMigrationTimestamp:e.latestMigrationTimestamp,message:`Database is behind (${e.latestMigrationTimestamp}).`}:{needsMigration:!1,appVersion:Wa,latestMigrationTimestamp:e.latestMigrationTimestamp,message:"Database schema is up-to-date."}}class JO{buffer="";processChunk(e){const s=[];this.buffer+=e;const r=this.buffer.split(`
|
|
96
96
|
`);this.buffer=r.pop()||"";for(const l of r)if(l.startsWith("data: "))try{const u=JSON.parse(l.slice(6));s.push(u)}catch{}return s}flush(){if(!this.buffer.trim())return[];const e=[];if(this.buffer.startsWith("data: "))try{e.push(JSON.parse(this.buffer.slice(6)))}catch{}return this.buffer="",e}reset(){this.buffer=""}}async function R1(t,e,s={}){const{timeout:r=3e5,onError:l}=s;if(!t.body)throw new Error("Response body is empty");const u=t.body.getReader(),d=new TextDecoder,f=new JO,m=setTimeout(()=>{u.cancel("Timeout").catch(()=>{})},r);try{for(;;){const{value:g,done:y}=await u.read();if(y){f.flush().forEach(e);break}const x=d.decode(g,{stream:!0});f.processChunk(x).forEach(e)}}catch(g){const y=g instanceof Error?g:new Error(String(g));if(l)l(y);else throw y}finally{clearTimeout(m),f.reset()}}class rs extends Error{constructor(e,s,r){super(e),this.code=s,this.status=r,this.name="SetupApiError"}}async function QO(t){const e=await fetch("/api/setup/organizations",{headers:{Authorization:`Bearer ${t}`}}),s=await e.text();let r={};if(s.trim())try{r=JSON.parse(s)}catch{r={message:s.trim()}}if(!e.ok){const l=typeof r?.error=="string"&&r.error||typeof r?.message=="string"&&r.message||`${e.status} ${e.statusText} while fetching organizations`,u=e.status===500||e.status===502?" If local API is not running, start `npm run dev:api` and retry.":"";throw new rs(`${l}${u}`,"FETCH_ORGS_FAILED",e.status)}return r}async function ZO(t,e){const s=await fetch("/api/setup/auto-provision",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.accessToken}`},body:JSON.stringify({orgId:t.orgId,projectName:t.projectName,region:t.region})});if(!s.ok){const r=await s.json().catch(()=>({}));throw new rs(r?.error||"Failed to auto-provision","PROVISION_FAILED",s.status)}await R1(s,e,{timeout:36e4,onError:r=>{throw new rs(`Provisioning stream error: ${r.message}`,"STREAM_ERROR")}})}async function e5(t){const e=await fetch(`/api/setup/projects/${encodeURIComponent(t.projectRef)}/credentials`,{headers:{Authorization:`Bearer ${t.accessToken}`}}),s=await e.json().catch(()=>({}));if(!e.ok)throw new rs(s?.error||"Failed to recover project credentials","RECOVERY_FAILED",e.status);return{projectId:String(s.projectId||t.projectRef),url:String(s.url||`https://${t.projectRef}.supabase.co`),anonKey:String(s.anonKey||""),dbPass:""}}async function t5(t,e){const s=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:t.projectRef,accessToken:t.accessToken,anonKey:t.anonKey})});if(!s.ok){const r=await s.json().catch(()=>({}));throw new rs(r?.error||"Failed to run migration","MIGRATION_FAILED",s.status)}await R1(s,e,{timeout:6e5,onError:r=>{throw new rs(`Migration stream error: ${r.message}`,"STREAM_ERROR")}})}const om={step:"welcome",managed:{accessToken:"",organizations:[],selectedOrg:"",projectName:"Folio-Core",region:"us-east-1",isFetchingOrgs:!1},manual:{url:"",anonKey:""},projectId:"",logs:[],error:null,isMigrating:!1,migrationStatus:null};function n5(t,e){switch(e.type){case"SET_STEP":return{...t,step:e.payload,error:null};case"SET_ACCESS_TOKEN":return{...t,managed:{...t.managed,accessToken:e.payload}};case"SET_ORGANIZATIONS":return{...t,managed:{...t.managed,organizations:e.payload,selectedOrg:e.payload.length>0?e.payload[0].id:""}};case"SET_SELECTED_ORG":return{...t,managed:{...t.managed,selectedOrg:e.payload}};case"SET_PROJECT_NAME":return{...t,managed:{...t.managed,projectName:e.payload}};case"SET_REGION":return{...t,managed:{...t.managed,region:e.payload}};case"SET_FETCHING_ORGS":return{...t,managed:{...t.managed,isFetchingOrgs:e.payload}};case"SET_MANUAL_URL":return{...t,manual:{...t.manual,url:e.payload}};case"SET_MANUAL_ANON_KEY":return{...t,manual:{...t.manual,anonKey:e.payload}};case"SET_PROJECT_ID":return{...t,projectId:e.payload};case"ADD_LOG":return{...t,logs:[...t.logs,{...e.payload,timestamp:Date.now()}].slice(-500)};case"CLEAR_LOGS":return{...t,logs:[]};case"SET_ERROR":return{...t,error:e.payload};case"SET_MIGRATING":return{...t,isMigrating:e.payload};case"SET_MIGRATION_STATUS":return{...t,migrationStatus:e.payload};case"RESET_MANAGED_FLOW":return{...t,managed:{...om.managed},error:null};case"RESET_MANUAL_FLOW":return{...t,manual:{...om.manual},error:null};default:return t}}const Ym=v.forwardRef(({className:t,...e},s)=>o.jsx("textarea",{className:ge("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...e}));Ym.displayName="Textarea";function Sh(t){const e=t.trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}.supabase.co`:""}function s5(t){const e=t.trim();if(!e)return{valid:!1,message:"URL is required"};if(e.startsWith("http://")||e.startsWith("https://"))try{return new URL(e).hostname.endsWith(".supabase.co")?{valid:!0,message:"Valid Supabase URL"}:{valid:!1,message:"URL must be a supabase.co domain"}}catch{return{valid:!1,message:"Invalid URL format"}}return/^[a-z0-9-]+$/.test(e)?{valid:!0,message:"Project ID detected"}:{valid:!1,message:"Enter a valid URL or project ID"}}function a5(t){const e=t.trim();return e?e.startsWith("sb_publishable_")?e.length<25?{valid:!1,message:"Incomplete publishable key"}:{valid:!0,message:"Valid publishable key"}:e.startsWith("eyJ")?e.length<50?{valid:!1,message:"Incomplete anon key"}:{valid:!0,message:"Valid anon key"}:{valid:!1,message:"Invalid API key format"}:{valid:!1,message:"API key is required"}}function O1(t){const e=t.trim();return e?e.startsWith("sbp_")?e.length<20?{valid:!1,message:"Token is too short"}:{valid:!0,message:"Valid access token"}:{valid:!1,message:"Token must start with sbp_"}:{valid:!1,message:"Access token is required"}}function O0(t){const e=t.trim();if(!e)return null;if(!e.includes(".")&&!e.includes("/"))return e;try{return new URL(e.startsWith("http")?e:`https://${e}`).hostname.split(".")[0]||null}catch{return null}}function r5({url:t,anonKey:e,error:s,onUrlChange:r,onAnonKeyChange:l,onSave:u,onBack:d}){const f=s5(t),m=a5(e);return o.jsxs("div",{className:"flex flex-col gap-6 animate-in fade-in slide-in-from-right-4 duration-500",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Manual Credentials"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"Connect Folio to an existing Supabase project with URL and anon key."})]}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"supabase-url",children:"Supabase URL or Project ID"}),o.jsx(je,{id:"supabase-url",value:t,onChange:g=>r(g.target.value),placeholder:"https://project.supabase.co or project-id",className:!f.valid&&t.length>0?"border-destructive focus-visible:ring-destructive":""}),t.length>0&&o.jsxs("p",{className:ge("text-xs flex items-center gap-1",f.valid?"text-emerald-500":"text-destructive"),children:[f.valid?o.jsx(os,{className:"w-3"}):o.jsx(Sn,{className:"w-3"}),f.message]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"supabase-anon-key",children:"Anon Key"}),o.jsx(Ym,{id:"supabase-anon-key",value:e,onChange:g=>l(g.target.value),placeholder:"eyJ...",className:ge("min-h-[120px] font-mono text-xs",!m.valid&&e.length>0?"border-destructive focus-visible:ring-destructive":"")}),e.length>0&&o.jsxs("p",{className:ge("text-xs flex items-center gap-1",m.valid?"text-emerald-500":"text-destructive"),children:[m.valid?o.jsx(os,{className:"w-3"}):o.jsx(Sn,{className:"w-3"}),m.message]})]})]}),s&&o.jsxs(jn,{variant:"destructive",children:[o.jsx(Sn,{className:"h-4 w-4"}),o.jsx(_n,{children:s})]}),o.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[o.jsxs(ae,{variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:d,children:[o.jsx(Jo,{className:"w-4 h-4 mr-1"}),"Back"]}),o.jsx(ae,{className:"ml-auto",onClick:u,disabled:!f.valid||!m.valid,children:"Validate and Continue"})]})]})}const nl=v.createContext(null),i5=({children:t,value:e,onValueChange:s,...r})=>{const[l,u]=v.useState(!1),d=v.useRef(null);return v.useEffect(()=>{const f=m=>{d.current&&!d.current.contains(m.target)&&u(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]),o.jsx(nl.Provider,{value:{value:e,onValueChange:s,open:l,setOpen:u},children:o.jsx("div",{ref:d,className:"relative inline-block w-full",...r,children:t})})},M1=v.forwardRef(({className:t,children:e,...s},r)=>{const l=v.useContext(nl);return o.jsxs("button",{ref:r,type:"button",onClick:()=>l?.setOpen(!l.open),className:ge("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:[e,o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4 opacity-50",children:o.jsx("path",{d:"m6 9 6 6 6-6"})})]})});M1.displayName="SelectTrigger";const D1=v.forwardRef(({className:t,placeholder:e,...s},r)=>{const l=v.useContext(nl);return v.Children.toArray(s.children),o.jsx("span",{ref:r,className:ge("pointer-events-none",t),...s,children:l?.value||e})});D1.displayName="SelectValue";const P1=v.forwardRef(({className:t,children:e,position:s="popper",...r},l)=>v.useContext(nl)?.open?o.jsx("div",{ref:l,className:ge("absolute z-50 min-w-[8rem] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-80 mt-1",s==="popper"&&"translate-y-1",t),...r,children:o.jsx("div",{className:"p-1 bg-white dark:bg-zinc-950",children:e})}):null);P1.displayName="SelectContent";const z1=v.forwardRef(({className:t,children:e,value:s,...r},l)=>{const u=v.useContext(nl);return o.jsxs("div",{ref:l,className:ge("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none hover:bg-accent hover:text-accent-foreground cursor-pointer",t),onClick:()=>{u?.onValueChange?.(s),u?.setOpen(!1)},...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:u?.value===s&&o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})})}),o.jsx("span",{className:"truncate",children:e})]})});z1.displayName="SelectItem";const o5=[{value:"us-east-1",label:"US East (N. Virginia)"},{value:"us-west-1",label:"US West (N. California)"},{value:"eu-central-1",label:"Europe (Frankfurt)"},{value:"ap-southeast-1",label:"Asia Pacific (Singapore)"}];function l5({organizations:t,selectedOrg:e,projectName:s,region:r,onOrgSelect:l,onProjectNameChange:u,onRegionChange:d,onProvision:f,onBack:m}){return o.jsxs("div",{className:"flex flex-col gap-6 animate-in fade-in slide-in-from-right-4 duration-500",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Provisioning Parameters"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"Choose an organization and project configuration for Folio deployment."})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"project-name",children:"Project Name"}),o.jsx(je,{id:"project-name",value:s,onChange:g=>u(g.target.value),placeholder:"my-folio-app"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"region",children:"Region"}),o.jsxs(i5,{value:r,onValueChange:d,children:[o.jsx(M1,{id:"region",children:o.jsx(D1,{placeholder:"Select region"})}),o.jsx(P1,{children:o5.map(g=>o.jsx(z1,{value:g.value,children:g.label},g.value))})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs(Je,{className:"flex items-center gap-2",children:[o.jsx(Pk,{className:"w-4 h-4"}),"Select Organization"]}),o.jsx("div",{className:"grid gap-2 max-h-[160px] overflow-y-auto p-1 rounded-lg border bg-muted/20",children:t.map(g=>o.jsxs("button",{onClick:()=>l(g.id),className:ge("flex items-center justify-between p-3 rounded-md border text-sm transition-all",e===g.id?"bg-primary text-primary-foreground border-primary shadow-sm":"bg-background hover:border-primary/50"),children:[o.jsx("span",{children:g.name}),e===g.id&&o.jsx(dC,{className:"w-3 h-3 opacity-70"})]},g.id))})]}),o.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[o.jsxs(ae,{variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:m,children:[o.jsx(Jo,{className:"w-4 h-4 mr-1"}),"Back"]}),o.jsxs(ae,{className:"ml-auto",onClick:f,disabled:!e||!s,children:[o.jsx(UC,{className:"mr-2 h-4 w-4"}),"Auto-Provision"]})]})]})}function c5({accessToken:t,error:e,isFetching:s,onTokenChange:r,onFetchOrgs:l,onBack:u}){const d=O1(t);return o.jsxs("div",{className:"flex flex-col gap-6 animate-in fade-in slide-in-from-right-4 duration-500",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Supabase Access Token"}),o.jsxs("p",{className:"text-muted-foreground text-sm",children:["Enter a management token (",o.jsx("code",{className:"text-primary",children:"sbp_..."}),") so Folio can discover organizations and provision a project."]})]}),o.jsx("div",{className:"grid gap-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"access-token",children:"Personal Access Token"}),o.jsxs("div",{className:"relative",children:[o.jsx(Zo,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(je,{id:"access-token",type:"password",value:t,onChange:f=>r(f.target.value),placeholder:"sbp_xxxxxxxxxxxxx",className:ge("pl-9",!d.valid&&t.length>0?"border-destructive focus-visible:ring-destructive":"")})]}),t.length>0&&o.jsxs("p",{className:ge("text-xs flex items-center gap-1",d.valid?"text-emerald-500":"text-destructive"),children:[d.valid?o.jsx(os,{className:"w-3"}):o.jsx(Sn,{className:"w-3"}),d.message]})]})}),e&&o.jsxs(jn,{variant:"destructive",children:[o.jsx(Sn,{className:"h-4 w-4"}),o.jsx(_n,{children:e})]}),o.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[o.jsxs(ae,{variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:u,disabled:s,children:[o.jsx(Jo,{className:"w-4 h-4 mr-1"}),"Back"]}),o.jsx(ae,{className:"ml-auto",onClick:l,disabled:!d.valid||s,children:s?o.jsxs(o.Fragment,{children:[o.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Fetching..."]}):"Fetch Organizations"})]})]})}function L1({logs:t}){const e=v.useRef(null);return v.useEffect(()=>{e.current?.scrollIntoView({behavior:"smooth"})},[t]),o.jsxs("div",{className:"bg-zinc-950 rounded-xl border border-zinc-800 overflow-hidden shadow-2xl flex flex-col h-[300px]",role:"log","aria-live":"polite","aria-label":"Setup logs",children:[o.jsxs("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-zinc-800 bg-zinc-900/50",children:[o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/80"}),o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-amber-500/80"}),o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-emerald-500/80"}),o.jsx("span",{className:"ml-2 text-[10px] uppercase tracking-widest text-zinc-500 font-bold",children:"Foundation Trace"})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-4 font-mono text-[13px] leading-relaxed scrollbar-thin scrollbar-thumb-zinc-800",children:[t.length===0?o.jsx("div",{className:"text-zinc-600 italic",children:"Awaiting setup activity..."}):t.map((s,r)=>o.jsxs("div",{className:ge("mb-1 flex gap-3",s.type==="error"&&"text-red-400",s.type==="success"&&"text-emerald-400",s.type==="info"&&"text-blue-400",s.type==="stderr"&&"text-amber-400",s.type==="stdout"&&"text-zinc-300"),children:[o.jsx("span",{className:"text-zinc-600 shrink-0 select-none",children:new Date(s.timestamp).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}),o.jsx("span",{className:"break-all",children:s.message})]},`${s.timestamp}-${s.type}-${s.message}-${r}`)),o.jsx("div",{ref:e})]})]})}function u5({logs:t,error:e,isMigrating:s,migrationStatus:r,accessToken:l,onTokenChange:u,onRunMigration:d,onBypass:f}){const m=r?!r.needsMigration:!1;return o.jsxs("div",{className:"flex flex-col gap-6 animate-in fade-in slide-in-from-right-4 duration-500",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Database Migration"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:r?.message||`Run migration to align database with app v${Wa}.`})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(Je,{htmlFor:"migration-token",className:"flex items-center gap-2",children:[o.jsx(Zo,{className:"w-4 h-4"}),"Supabase Access Token"]}),o.jsx(je,{id:"migration-token",type:"password",value:l,onChange:g=>u(g.target.value),placeholder:"sbp_xxxxxxxxxxxxx"})]}),o.jsx(L1,{logs:t}),e&&o.jsxs(jn,{variant:"destructive",children:[o.jsx(Sn,{className:"h-4 w-4"}),o.jsx(_n,{children:e})]}),o.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[m&&o.jsx(ae,{variant:"ghost",size:"sm",onClick:f,disabled:s,children:"Skip for now"}),o.jsx(ae,{className:"ml-auto",onClick:d,disabled:s||l.trim()==="",children:s?o.jsxs(o.Fragment,{children:[o.jsx(it,{className:"mr-2 h-4 w-4 animate-spin"}),"Migrating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(qw,{className:"mr-2 h-4 w-4"}),"Run Migration"]})})]})]})}function d5({logs:t,error:e,onRetry:s}){return o.jsxs("div",{className:"flex flex-col gap-6 animate-in fade-in slide-in-from-right-4 duration-500",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Provisioning"}),o.jsxs("p",{className:"text-muted-foreground text-sm flex items-center gap-2",children:[!e&&o.jsx(it,{className:"w-4 h-4 animate-spin text-primary"}),"Folio is creating a Supabase project and preparing runtime credentials."]})]}),o.jsx(L1,{logs:t}),e?o.jsx("div",{className:"flex items-center gap-3",children:o.jsxs(ae,{variant:"destructive",onClick:s,children:[o.jsx(Sn,{className:"w-4 h-4 mr-2"}),"Retry Provisioning"]})}):null]})}function f5({onManaged:t,onManual:e,onBack:s}){return o.jsxs("div",{className:"flex flex-col h-full justify-center gap-10 animate-in fade-in slide-in-from-right-4 duration-500",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx("h2",{className:"text-4xl font-black tracking-tight",children:"Setup Mode"}),o.jsx("p",{className:"text-muted-foreground text-lg leading-relaxed max-w-md",children:"Select whether Folio should auto-provision a project or connect to an existing one."})]}),o.jsxs("div",{className:"grid gap-6",children:[o.jsxs("button",{onClick:t,className:"group relative flex flex-col items-start p-8 text-left border border-border/40 rounded-3xl hover:border-primary hover:bg-primary/5 hover:shadow-xl hover:shadow-primary/5 transition-all duration-300",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[o.jsx("div",{className:"w-12 h-12 rounded-2xl bg-primary/10 flex items-center justify-center text-primary group-hover:scale-110 transition-transform duration-500",children:o.jsx(fu,{className:"w-6 h-6 fill-primary/20"})}),o.jsx("strong",{className:"text-xl font-bold",children:"Managed Setup"})]}),o.jsx("span",{className:"text-muted-foreground leading-relaxed",children:"Use an access token to auto-provision project + run migration automatically. Recommended for most users."}),o.jsx("div",{className:"absolute top-8 right-8 opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:o.jsx(di,{className:"w-6 h-6 text-primary"})})]}),o.jsxs("button",{onClick:e,className:"group relative flex flex-col items-start p-8 text-left border border-border/40 rounded-3xl hover:border-primary hover:bg-primary/5 hover:shadow-xl hover:shadow-primary/5 transition-all duration-300",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[o.jsx("div",{className:"w-12 h-12 rounded-2xl bg-muted flex items-center justify-center text-muted-foreground group-hover:bg-primary/10 group-hover:text-primary group-hover:scale-110 transition-all duration-500",children:o.jsx($m,{className:"w-6 h-6"})}),o.jsx("strong",{className:"text-xl font-bold",children:"Manual Connection"})]}),o.jsx("span",{className:"text-muted-foreground leading-relaxed",children:"Provide your own Supabase URL + anon key. Use this if you already have a configured project."}),o.jsx("div",{className:"absolute top-8 right-8 opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:o.jsx(di,{className:"w-6 h-6 text-primary"})})]})]}),o.jsx("div",{className:"pt-4",children:o.jsxs(ae,{variant:"ghost",size:"sm",className:"w-fit -ml-2 text-muted-foreground hover:text-foreground h-10 px-4 rounded-xl font-bold",onClick:s,children:[o.jsx(Jo,{className:"w-4 h-4 mr-1"}),"Back to Welcome"]})})]})}function h5({onNext:t}){return o.jsxs("div",{className:"flex flex-col h-full justify-center gap-12 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[o.jsxs("div",{className:"space-y-4 text-center sm:text-left",children:[o.jsxs("h2",{className:"text-5xl font-black tracking-tight leading-tight",children:["Welcome to ",o.jsx("span",{className:"text-primary",children:"Folio"})]}),o.jsx("p",{className:"text-muted-foreground text-lg max-w-lg leading-relaxed",children:"Let's configure your foundation runtime: local desktop app, remote Supabase database, and RealTimeX SDK backend connectivity."})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6",children:[o.jsxs(ft,{className:"bg-muted/30 border-border/40 shadow-sm hover:shadow-md transition-all duration-300",children:[o.jsx(zt,{className:"pb-3 px-6",children:o.jsxs(Lt,{className:"flex items-center gap-2 text-base font-bold",children:[o.jsx(ga,{className:"w-5 h-5 text-primary"}),"Secure by Default"]})}),o.jsx(xt,{className:"px-6 pb-6",children:o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Credentials are stored locally and used to configure runtime contracts only."})})]}),o.jsxs(ft,{className:"bg-muted/30 border-border/40 shadow-sm hover:shadow-md transition-all duration-300",children:[o.jsx(zt,{className:"pb-3 px-6",children:o.jsxs(Lt,{className:"flex items-center gap-2 text-base font-bold",children:[o.jsx(xC,{className:"w-5 h-5 text-primary"}),"No Feature Lock-In"]})}),o.jsx(xt,{className:"px-6 pb-6",children:o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"This step only prepares infrastructure, not document automation features."})})]})]}),o.jsx("div",{className:"pt-4 flex justify-center sm:justify-start",children:o.jsx(ae,{size:"lg",className:"h-14 px-10 rounded-2xl text-base font-black shadow-xl shadow-primary/20 hover:scale-105 transition-all",onClick:t,children:"Start Setup"})})]})}function m5({onComplete:t,open:e=!0,canClose:s=!1}){const[r,l]=v.useReducer(n5,om),u=v.useRef("");v.useEffect(()=>()=>{u.current=""},[]);const d=v.useCallback((j,_)=>{l({type:"ADD_LOG",payload:{type:j,message:_}})},[]),f=v.useCallback(()=>{u.current="",t()},[t]),m=v.useCallback(async()=>{l({type:"SET_ERROR",payload:null}),l({type:"SET_FETCHING_ORGS",payload:!0});const j=r.managed.accessToken.trim(),_=O1(j);if(!_.valid){l({type:"SET_ERROR",payload:_.message||"Invalid token"}),l({type:"SET_FETCHING_ORGS",payload:!1});return}try{u.current=j;const N=await QO(j);l({type:"SET_ORGANIZATIONS",payload:N}),l({type:"SET_STEP",payload:"managed-org"})}catch(N){const k=N instanceof rs?N.message:String(N);l({type:"SET_ERROR",payload:k})}finally{l({type:"SET_FETCHING_ORGS",payload:!1})}},[r.managed.accessToken]),g=v.useCallback(async j=>{const _=j?.projectRef||r.projectId||O0(r.manual.url),N=j?.accessToken||u.current||r.managed.accessToken.trim(),k=j?.url||r.manual.url,C=j?.anonKey||r.manual.anonKey;if(!_||!N){l({type:"SET_ERROR",payload:"Project ID and access token are required for migration."});return}l({type:"SET_STEP",payload:"migration"}),l({type:"SET_ERROR",payload:null}),l({type:"SET_MIGRATING",payload:!0}),l({type:"CLEAR_LOGS"});let A=!1;try{if(await t5({projectRef:_,accessToken:N,anonKey:C},D=>{if(D.type==="stdout"){d("stdout",String(D.data));return}if(D.type==="stderr"){d("stderr",String(D.data));return}if(D.type==="info"){d("info",String(D.data));return}if(D.type==="error"){d("error",String(D.data));return}D.type==="done"&&(A=D.data==="success")}),!A)throw new Error("Migration did not complete successfully.");k&&C&&fh({url:Sh(k),anonKey:C.trim()}),d("success","Migration completed. Setup is ready."),setTimeout(()=>f(),600)}catch(D){const U=D instanceof rs?D.message:String(D);l({type:"SET_ERROR",payload:U}),d("error",U)}finally{l({type:"SET_MIGRATING",payload:!1})}},[d,f,r.managed.accessToken,r.manual.anonKey,r.manual.url,r.projectId]),y=v.useCallback(async()=>{l({type:"SET_ERROR",payload:null}),l({type:"SET_STEP",payload:"provisioning"}),l({type:"CLEAR_LOGS"}),d("info","Starting managed provisioning...");const j=u.current||r.managed.accessToken.trim(),_={result:null,projectId:"",receivedDone:!1,receivedError:!1},N=k=>{_.result=k,l({type:"SET_PROJECT_ID",payload:k.projectId}),fh({url:Sh(k.url),anonKey:k.anonKey.trim()}),l({type:"SET_MIGRATION_STATUS",payload:{needsMigration:!0,appVersion:Wa,latestMigrationTimestamp:null,message:"Fresh project created. Migration is required."}}),d("success","Project ready. Starting migration...")};try{if(await ZO({accessToken:j,orgId:r.managed.selectedOrg,projectName:r.managed.projectName,region:r.managed.region},k=>{if(k.type==="project_id"){_.projectId=String(k.data),l({type:"SET_PROJECT_ID",payload:_.projectId});return}if(k.type==="info"){d("info",String(k.data));return}if(k.type==="error"){_.receivedError=!0,d("error",String(k.data)),l({type:"SET_ERROR",payload:String(k.data)});return}if(k.type==="success"){N(k.data);return}k.type==="done"&&(_.receivedDone=!0)}),!_.result&&_.projectId){d("info","Provisioning stream disconnected. Recovering credentials from existing project...");const k=await e5({accessToken:j,projectRef:_.projectId});N(k)}if(!_.result){const k=_.receivedError?"Provisioning failed before credentials were available. Retry or use manual setup.":_.receivedDone?"Provisioning ended without credentials. Retry or use manual setup.":"Provisioning stream ended unexpectedly. The project may still be provisioning; retry in a moment.";throw new rs(k,"PROVISION_INCOMPLETE")}await g({projectRef:_.result.projectId,accessToken:j,url:_.result.url,anonKey:_.result.anonKey})}catch(k){const C=k instanceof rs?k.message:String(k);l({type:"SET_ERROR",payload:C}),d("error",C)}},[d,g,r.managed.accessToken,r.managed.projectName,r.managed.region,r.managed.selectedOrg]),x=v.useCallback(async()=>{l({type:"SET_ERROR",payload:null}),l({type:"SET_STEP",payload:"validating"});const j=Sh(r.manual.url),_=r.manual.anonKey.trim(),N=await SA(j,_);if(!N.valid){l({type:"SET_ERROR",payload:N.error||"Connection validation failed."}),l({type:"SET_STEP",payload:"credentials"});return}fh({url:j,anonKey:_}),l({type:"SET_MANUAL_URL",payload:j});const k=O0(j);k&&l({type:"SET_PROJECT_ID",payload:k});try{const C=zm(j,_),A=await A1(C);l({type:"SET_MIGRATION_STATUS",payload:{needsMigration:A.needsMigration,appVersion:A.appVersion,latestMigrationTimestamp:A.latestMigrationTimestamp,message:A.message}}),A.needsMigration?l({type:"SET_STEP",payload:"migration"}):f()}catch{l({type:"SET_MIGRATION_STATUS",payload:{needsMigration:!0,appVersion:Wa,latestMigrationTimestamp:null,message:"Could not verify migration status. Run migration to continue."}}),l({type:"SET_STEP",payload:"migration"})}},[f,r.manual.anonKey,r.manual.url]);if(!e)return null;const w=[{key:"welcome",label:"Welcome"},{key:"config",label:"Configuration",subSteps:["type","managed-token","managed-org","credentials"]},{key:"validation",label:"Validation",subSteps:["provisioning","validating"]},{key:"migration",label:"Migration"}],E=r.step==="welcome"?"welcome":["type","managed-token","managed-org","credentials"].includes(r.step)?"config":["provisioning","validating"].includes(r.step)?"validation":"migration";return o.jsxs(Za,{open:e,onOpenChange:j=>{!j&&s&&t()},children:[o.jsx(C1,{className:"bg-zinc-950/80 backdrop-blur-sm"}),o.jsx(er,{className:"sm:max-w-[1100px] w-full p-0 overflow-hidden border-none shadow-2xl",children:o.jsxs("div",{className:"flex w-full min-h-[700px]",children:[o.jsxs("aside",{className:"w-[300px] border-r bg-muted/30 p-8 flex flex-col gap-10",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Folio Setup"}),o.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wider",children:"Foundation Parity Mode"})]}),o.jsx("nav",{className:"flex-1",children:o.jsx("ul",{className:"space-y-4",children:w.map(j=>{const _=E===j.key,N=w.findIndex(k=>k.key===E)>w.findIndex(k=>k.key===j.key);return o.jsxs("li",{className:"flex items-center gap-3",children:[o.jsx("div",{className:ge("w-6 h-6 rounded-full flex items-center justify-center border transition-all duration-300",_?"border-primary bg-primary text-primary-foreground shadow-sm scale-110":N?"border-emerald-500 bg-emerald-50 text-emerald-500":"border-muted text-muted-foreground"),children:N?o.jsx(os,{className:"w-4 h-4"}):o.jsx("div",{className:"text-[10px] font-bold",children:w.indexOf(j)+1})}),o.jsx("span",{className:ge("text-sm font-medium transition-colors",_?"text-foreground":"text-muted-foreground"),children:j.label})]},j.key)})})}),o.jsxs("div",{className:"mt-auto pt-6 border-t flex items-center justify-between",children:[o.jsxs("span",{className:"text-[10px] font-bold text-muted-foreground/50 uppercase tracking-widest",children:["Version ",Wa]}),o.jsx(Pt,{variant:"outline",className:"text-[10px] py-0 h-4",children:"Production"})]})]}),o.jsx("main",{className:"flex-1 p-12 bg-background relative flex flex-col",children:o.jsxs("div",{className:"max-w-[700px] w-full mx-auto flex-1",children:[r.step==="welcome"&&o.jsx(h5,{onNext:()=>l({type:"SET_STEP",payload:"type"})}),r.step==="type"&&o.jsx(f5,{onManaged:()=>{l({type:"RESET_MANUAL_FLOW"}),l({type:"SET_STEP",payload:"managed-token"})},onManual:()=>{l({type:"RESET_MANAGED_FLOW"}),l({type:"SET_STEP",payload:"credentials"})},onBack:()=>l({type:"SET_STEP",payload:"welcome"})}),r.step==="managed-token"&&o.jsx(c5,{accessToken:r.managed.accessToken,error:r.error,isFetching:r.managed.isFetchingOrgs,onTokenChange:j=>l({type:"SET_ACCESS_TOKEN",payload:j}),onFetchOrgs:m,onBack:()=>l({type:"SET_STEP",payload:"type"})}),r.step==="managed-org"&&o.jsx(l5,{organizations:r.managed.organizations,selectedOrg:r.managed.selectedOrg,projectName:r.managed.projectName,region:r.managed.region,onOrgSelect:j=>l({type:"SET_SELECTED_ORG",payload:j}),onProjectNameChange:j=>l({type:"SET_PROJECT_NAME",payload:j}),onRegionChange:j=>l({type:"SET_REGION",payload:j}),onProvision:y,onBack:()=>l({type:"SET_STEP",payload:"managed-token"})}),r.step==="provisioning"&&o.jsx(d5,{logs:r.logs,error:r.error,onRetry:()=>l({type:"SET_STEP",payload:"managed-token"})}),r.step==="credentials"&&o.jsx(r5,{url:r.manual.url,anonKey:r.manual.anonKey,error:r.error,onUrlChange:j=>l({type:"SET_MANUAL_URL",payload:j}),onAnonKeyChange:j=>l({type:"SET_MANUAL_ANON_KEY",payload:j}),onSave:x,onBack:()=>l({type:"SET_STEP",payload:"type"})}),r.step==="validating"&&o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center space-y-4 animate-in fade-in zoom-in-95 duration-500",children:[o.jsx("div",{className:"w-12 h-12 rounded-full border-4 border-primary border-t-transparent animate-spin"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("h2",{className:"text-xl font-bold",children:"Validating Credentials"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"Please wait while Folio verifies your Supabase configuration."})]})]}),r.step==="migration"&&o.jsx(u5,{logs:r.logs,error:r.error,isMigrating:r.isMigrating,migrationStatus:r.migrationStatus,accessToken:r.managed.accessToken,onTokenChange:j=>l({type:"SET_ACCESS_TOKEN",payload:j}),onRunMigration:()=>g(),onBypass:f})]})})]})})]})}const Xm=v.createContext({});function Wm(t){const e=v.useRef(null);return e.current===null&&(e.current=t()),e.current}const U1=typeof window<"u",B1=U1?v.useLayoutEffect:v.useEffect,Du=v.createContext(null);function Jm(t,e){t.indexOf(e)===-1&&t.push(e)}function pu(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}const ls=(t,e,s)=>s>e?e:s<t?t:s;let Qm=()=>{};const As={},V1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function I1(t){return typeof t=="object"&&t!==null}const $1=t=>/^0[^.\s]+$/u.test(t);function q1(t){let e;return()=>(e===void 0&&(e=t()),e)}const Ln=t=>t,p5=(t,e)=>s=>e(t(s)),sl=(...t)=>t.reduce(p5),Go=(t,e,s)=>{const r=e-t;return r===0?1:(s-t)/r};class Zm{constructor(){this.subscriptions=[]}add(e){return Jm(this.subscriptions,e),()=>pu(this.subscriptions,e)}notify(e,s,r){const l=this.subscriptions.length;if(l)if(l===1)this.subscriptions[0](e,s,r);else for(let u=0;u<l;u++){const d=this.subscriptions[u];d&&d(e,s,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Fn=t=>t*1e3,Pn=t=>t/1e3;function H1(t,e){return e?t*(1e3/e):0}const G1=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,g5=1e-7,y5=12;function v5(t,e,s,r,l){let u,d,f=0;do d=e+(s-e)/2,u=G1(d,r,l)-t,u>0?s=d:e=d;while(Math.abs(u)>g5&&++f<y5);return d}function al(t,e,s,r){if(t===e&&s===r)return Ln;const l=u=>v5(u,0,1,t,s);return u=>u===0||u===1?u:G1(l(u),e,r)}const F1=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,K1=t=>e=>1-t(1-e),Y1=al(.33,1.53,.69,.99),ep=K1(Y1),X1=F1(ep),W1=t=>(t*=2)<1?.5*ep(t):.5*(2-Math.pow(2,-10*(t-1))),tp=t=>1-Math.sin(Math.acos(t)),J1=K1(tp),Q1=F1(tp),x5=al(.42,0,1,1),b5=al(0,0,.58,1),Z1=al(.42,0,.58,1),w5=t=>Array.isArray(t)&&typeof t[0]!="number",eS=t=>Array.isArray(t)&&typeof t[0]=="number",S5={linear:Ln,easeIn:x5,easeInOut:Z1,easeOut:b5,circIn:tp,circInOut:Q1,circOut:J1,backIn:ep,backInOut:X1,backOut:Y1,anticipate:W1},j5=t=>typeof t=="string",M0=t=>{if(eS(t)){Qm(t.length===4);const[e,s,r,l]=t;return al(e,s,r,l)}else if(j5(t))return S5[t];return t},$c=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function _5(t,e){let s=new Set,r=new Set,l=!1,u=!1;const d=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function m(y){d.has(y)&&(g.schedule(y),t()),y(f)}const g={schedule:(y,x=!1,w=!1)=>{const E=w&&l?s:r;return x&&d.add(y),E.has(y)||E.add(y),y},cancel:y=>{r.delete(y),d.delete(y)},process:y=>{if(f=y,l){u=!0;return}l=!0,[s,r]=[r,s],s.forEach(m),s.clear(),l=!1,u&&(u=!1,g.process(y))}};return g}const N5=40;function tS(t,e){let s=!1,r=!0;const l={delta:0,timestamp:0,isProcessing:!1},u=()=>s=!0,d=$c.reduce((C,A)=>(C[A]=_5(u),C),{}),{setup:f,read:m,resolveKeyframes:g,preUpdate:y,update:x,preRender:w,render:S,postRender:E}=d,j=()=>{const C=As.useManualTiming?l.timestamp:performance.now();s=!1,As.useManualTiming||(l.delta=r?1e3/60:Math.max(Math.min(C-l.timestamp,N5),1)),l.timestamp=C,l.isProcessing=!0,f.process(l),m.process(l),g.process(l),y.process(l),x.process(l),w.process(l),S.process(l),E.process(l),l.isProcessing=!1,s&&e&&(r=!1,t(j))},_=()=>{s=!0,r=!0,l.isProcessing||t(j)};return{schedule:$c.reduce((C,A)=>{const D=d[A];return C[A]=(U,V=!1,R=!1)=>(s||_(),D.schedule(U,V,R)),C},{}),cancel:C=>{for(let A=0;A<$c.length;A++)d[$c[A]].cancel(C)},state:l,steps:d}}const{schedule:lt,cancel:ma,state:Ft,steps:jh}=tS(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ln,!0);let Wc;function T5(){Wc=void 0}const Jt={now:()=>(Wc===void 0&&Jt.set(Ft.isProcessing||As.useManualTiming?Ft.timestamp:performance.now()),Wc),set:t=>{Wc=t,queueMicrotask(T5)}},nS=t=>e=>typeof e=="string"&&e.startsWith(t),sS=nS("--"),E5=nS("var(--"),np=t=>E5(t)?k5.test(t.split("/*")[0].trim()):!1,k5=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function D0(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const yi={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Fo={...yi,transform:t=>ls(0,1,t)},qc={...yi,default:1},Eo=t=>Math.round(t*1e5)/1e5,sp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function C5(t){return t==null}const A5=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ap=(t,e)=>s=>!!(typeof s=="string"&&A5.test(s)&&s.startsWith(t)||e&&!C5(s)&&Object.prototype.hasOwnProperty.call(s,e)),aS=(t,e,s)=>r=>{if(typeof r!="string")return r;const[l,u,d,f]=r.match(sp);return{[t]:parseFloat(l),[e]:parseFloat(u),[s]:parseFloat(d),alpha:f!==void 0?parseFloat(f):1}},R5=t=>ls(0,255,t),_h={...yi,transform:t=>Math.round(R5(t))},Fa={test:ap("rgb","red"),parse:aS("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:r=1})=>"rgba("+_h.transform(t)+", "+_h.transform(e)+", "+_h.transform(s)+", "+Eo(Fo.transform(r))+")"};function O5(t){let e="",s="",r="",l="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),r=t.substring(5,7),l=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),r=t.substring(3,4),l=t.substring(4,5),e+=e,s+=s,r+=r,l+=l),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:l?parseInt(l,16)/255:1}}const lm={test:ap("#"),parse:O5,transform:Fa.transform},rl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),la=rl("deg"),is=rl("%"),be=rl("px"),M5=rl("vh"),D5=rl("vw"),P0={...is,parse:t=>is.parse(t)/100,transform:t=>is.transform(t*100)},ni={test:ap("hsl","hue"),parse:aS("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:r=1})=>"hsla("+Math.round(t)+", "+is.transform(Eo(e))+", "+is.transform(Eo(s))+", "+Eo(Fo.transform(r))+")"},Et={test:t=>Fa.test(t)||lm.test(t)||ni.test(t),parse:t=>Fa.test(t)?Fa.parse(t):ni.test(t)?ni.parse(t):lm.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Fa.transform(t):ni.transform(t),getAnimatableNone:t=>{const e=Et.parse(t);return e.alpha=0,Et.transform(e)}},P5=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function z5(t){return isNaN(t)&&typeof t=="string"&&(t.match(sp)?.length||0)+(t.match(P5)?.length||0)>0}const rS="number",iS="color",L5="var",U5="var(",z0="${}",B5=/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+)/giu;function Ko(t){const e=t.toString(),s=[],r={color:[],number:[],var:[]},l=[];let u=0;const f=e.replace(B5,m=>(Et.test(m)?(r.color.push(u),l.push(iS),s.push(Et.parse(m))):m.startsWith(U5)?(r.var.push(u),l.push(L5),s.push(m)):(r.number.push(u),l.push(rS),s.push(parseFloat(m))),++u,z0)).split(z0);return{values:s,split:f,indexes:r,types:l}}function oS(t){return Ko(t).values}function lS(t){const{split:e,types:s}=Ko(t),r=e.length;return l=>{let u="";for(let d=0;d<r;d++)if(u+=e[d],l[d]!==void 0){const f=s[d];f===rS?u+=Eo(l[d]):f===iS?u+=Et.transform(l[d]):u+=l[d]}return u}}const V5=t=>typeof t=="number"?0:Et.test(t)?Et.getAnimatableNone(t):t;function I5(t){const e=oS(t);return lS(t)(e.map(V5))}const Kn={test:z5,parse:oS,createTransformer:lS,getAnimatableNone:I5};function Nh(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t}function $5({hue:t,saturation:e,lightness:s,alpha:r}){t/=360,e/=100,s/=100;let l=0,u=0,d=0;if(!e)l=u=d=s;else{const f=s<.5?s*(1+e):s+e-s*e,m=2*s-f;l=Nh(m,f,t+1/3),u=Nh(m,f,t),d=Nh(m,f,t-1/3)}return{red:Math.round(l*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:r}}function gu(t,e){return s=>s>0?e:t}const mt=(t,e,s)=>t+(e-t)*s,Th=(t,e,s)=>{const r=t*t,l=s*(e*e-r)+r;return l<0?0:Math.sqrt(l)},q5=[lm,Fa,ni],H5=t=>q5.find(e=>e.test(t));function L0(t){const e=H5(t);if(!e)return!1;let s=e.parse(t);return e===ni&&(s=$5(s)),s}const U0=(t,e)=>{const s=L0(t),r=L0(e);if(!s||!r)return gu(t,e);const l={...s};return u=>(l.red=Th(s.red,r.red,u),l.green=Th(s.green,r.green,u),l.blue=Th(s.blue,r.blue,u),l.alpha=mt(s.alpha,r.alpha,u),Fa.transform(l))},cm=new Set(["none","hidden"]);function G5(t,e){return cm.has(t)?s=>s<=0?t:e:s=>s>=1?e:t}function F5(t,e){return s=>mt(t,e,s)}function rp(t){return typeof t=="number"?F5:typeof t=="string"?np(t)?gu:Et.test(t)?U0:X5:Array.isArray(t)?cS:typeof t=="object"?Et.test(t)?U0:K5:gu}function cS(t,e){const s=[...t],r=s.length,l=t.map((u,d)=>rp(u)(u,e[d]));return u=>{for(let d=0;d<r;d++)s[d]=l[d](u);return s}}function K5(t,e){const s={...t,...e},r={};for(const l in s)t[l]!==void 0&&e[l]!==void 0&&(r[l]=rp(t[l])(t[l],e[l]));return l=>{for(const u in r)s[u]=r[u](l);return s}}function Y5(t,e){const s=[],r={color:0,var:0,number:0};for(let l=0;l<e.values.length;l++){const u=e.types[l],d=t.indexes[u][r[u]],f=t.values[d]??0;s[l]=f,r[u]++}return s}const X5=(t,e)=>{const s=Kn.createTransformer(e),r=Ko(t),l=Ko(e);return r.indexes.var.length===l.indexes.var.length&&r.indexes.color.length===l.indexes.color.length&&r.indexes.number.length>=l.indexes.number.length?cm.has(t)&&!l.values.length||cm.has(e)&&!r.values.length?G5(t,e):sl(cS(Y5(r,l),l.values),s):gu(t,e)};function uS(t,e,s){return typeof t=="number"&&typeof e=="number"&&typeof s=="number"?mt(t,e,s):rp(t)(t,e)}const W5=t=>{const e=({timestamp:s})=>t(s);return{start:(s=!0)=>lt.update(e,s),stop:()=>ma(e),now:()=>Ft.isProcessing?Ft.timestamp:Jt.now()}},dS=(t,e,s=10)=>{let r="";const l=Math.max(Math.round(e/s),2);for(let u=0;u<l;u++)r+=Math.round(t(u/(l-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},yu=2e4;function ip(t){let e=0;const s=50;let r=t.next(e);for(;!r.done&&e<yu;)e+=s,r=t.next(e);return e>=yu?1/0:e}function J5(t,e=100,s){const r=s({...t,keyframes:[0,e]}),l=Math.min(ip(r),yu);return{type:"keyframes",ease:u=>r.next(l*u).value/e,duration:Pn(l)}}const Q5=5;function fS(t,e,s){const r=Math.max(e-Q5,0);return H1(s-t(r),e-r)}const vt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Eh=.001;function Z5({duration:t=vt.duration,bounce:e=vt.bounce,velocity:s=vt.velocity,mass:r=vt.mass}){let l,u,d=1-e;d=ls(vt.minDamping,vt.maxDamping,d),t=ls(vt.minDuration,vt.maxDuration,Pn(t)),d<1?(l=g=>{const y=g*d,x=y*t,w=y-s,S=um(g,d),E=Math.exp(-x);return Eh-w/S*E},u=g=>{const x=g*d*t,w=x*s+s,S=Math.pow(d,2)*Math.pow(g,2)*t,E=Math.exp(-x),j=um(Math.pow(g,2),d);return(-l(g)+Eh>0?-1:1)*((w-S)*E)/j}):(l=g=>{const y=Math.exp(-g*t),x=(g-s)*t+1;return-Eh+y*x},u=g=>{const y=Math.exp(-g*t),x=(s-g)*(t*t);return y*x});const f=5/t,m=t4(l,u,f);if(t=Fn(t),isNaN(m))return{stiffness:vt.stiffness,damping:vt.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:d*2*Math.sqrt(r*g),duration:t}}}const e4=12;function t4(t,e,s){let r=s;for(let l=1;l<e4;l++)r=r-t(r)/e(r);return r}function um(t,e){return t*Math.sqrt(1-e*e)}const n4=["duration","bounce"],s4=["stiffness","damping","mass"];function B0(t,e){return e.some(s=>t[s]!==void 0)}function a4(t){let e={velocity:vt.velocity,stiffness:vt.stiffness,damping:vt.damping,mass:vt.mass,isResolvedFromDuration:!1,...t};if(!B0(t,s4)&&B0(t,n4))if(e.velocity=0,t.visualDuration){const s=t.visualDuration,r=2*Math.PI/(s*1.2),l=r*r,u=2*ls(.05,1,1-(t.bounce||0))*Math.sqrt(l);e={...e,mass:vt.mass,stiffness:l,damping:u}}else{const s=Z5({...t,velocity:0});e={...e,...s,mass:vt.mass},e.isResolvedFromDuration=!0}return e}function vu(t=vt.visualDuration,e=vt.bounce){const s=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:l}=s;const u=s.keyframes[0],d=s.keyframes[s.keyframes.length-1],f={done:!1,value:u},{stiffness:m,damping:g,mass:y,duration:x,velocity:w,isResolvedFromDuration:S}=a4({...s,velocity:-Pn(s.velocity||0)}),E=w||0,j=g/(2*Math.sqrt(m*y)),_=d-u,N=Pn(Math.sqrt(m/y)),k=Math.abs(_)<5;r||(r=k?vt.restSpeed.granular:vt.restSpeed.default),l||(l=k?vt.restDelta.granular:vt.restDelta.default);let C;if(j<1){const D=um(N,j);C=U=>{const V=Math.exp(-j*N*U);return d-V*((E+j*N*_)/D*Math.sin(D*U)+_*Math.cos(D*U))}}else if(j===1)C=D=>d-Math.exp(-N*D)*(_+(E+N*_)*D);else{const D=N*Math.sqrt(j*j-1);C=U=>{const V=Math.exp(-j*N*U),R=Math.min(D*U,300);return d-V*((E+j*N*_)*Math.sinh(R)+D*_*Math.cosh(R))/D}}const A={calculatedDuration:S&&x||null,next:D=>{const U=C(D);if(S)f.done=D>=x;else{let V=D===0?E:0;j<1&&(V=D===0?Fn(E):fS(C,D,U));const R=Math.abs(V)<=r,P=Math.abs(d-U)<=l;f.done=R&&P}return f.value=f.done?d:U,f},toString:()=>{const D=Math.min(ip(A),yu),U=dS(V=>A.next(D*V).value,D,30);return D+"ms "+U},toTransition:()=>{}};return A}vu.applyToOptions=t=>{const e=J5(t,100,vu);return t.ease=e.ease,t.duration=Fn(e.duration),t.type="keyframes",t};function dm({keyframes:t,velocity:e=0,power:s=.8,timeConstant:r=325,bounceDamping:l=10,bounceStiffness:u=500,modifyTarget:d,min:f,max:m,restDelta:g=.5,restSpeed:y}){const x=t[0],w={done:!1,value:x},S=R=>f!==void 0&&R<f||m!==void 0&&R>m,E=R=>f===void 0?m:m===void 0||Math.abs(f-R)<Math.abs(m-R)?f:m;let j=s*e;const _=x+j,N=d===void 0?_:d(_);N!==_&&(j=N-x);const k=R=>-j*Math.exp(-R/r),C=R=>N+k(R),A=R=>{const P=k(R),Z=C(R);w.done=Math.abs(P)<=g,w.value=w.done?N:Z};let D,U;const V=R=>{S(w.value)&&(D=R,U=vu({keyframes:[w.value,E(w.value)],velocity:fS(C,R,w.value),damping:l,stiffness:u,restDelta:g,restSpeed:y}))};return V(0),{calculatedDuration:null,next:R=>{let P=!1;return!U&&D===void 0&&(P=!0,A(R),V(R)),D!==void 0&&R>=D?U.next(R-D):(!P&&A(R),w)}}}function r4(t,e,s){const r=[],l=s||As.mix||uS,u=t.length-1;for(let d=0;d<u;d++){let f=l(t[d],t[d+1]);if(e){const m=Array.isArray(e)?e[d]||Ln:e;f=sl(m,f)}r.push(f)}return r}function i4(t,e,{clamp:s=!0,ease:r,mixer:l}={}){const u=t.length;if(Qm(u===e.length),u===1)return()=>e[0];if(u===2&&e[0]===e[1])return()=>e[1];const d=t[0]===t[1];t[0]>t[u-1]&&(t=[...t].reverse(),e=[...e].reverse());const f=r4(e,r,l),m=f.length,g=y=>{if(d&&y<t[0])return e[0];let x=0;if(m>1)for(;x<t.length-2&&!(y<t[x+1]);x++);const w=Go(t[x],t[x+1],y);return f[x](w)};return s?y=>g(ls(t[0],t[u-1],y)):g}function o4(t,e){const s=t[t.length-1];for(let r=1;r<=e;r++){const l=Go(0,e,r);t.push(mt(s,1,l))}}function l4(t){const e=[0];return o4(e,t.length-1),e}function c4(t,e){return t.map(s=>s*e)}function u4(t,e){return t.map(()=>e||Z1).splice(0,t.length-1)}function ko({duration:t=300,keyframes:e,times:s,ease:r="easeInOut"}){const l=w5(r)?r.map(M0):M0(r),u={done:!1,value:e[0]},d=c4(s&&s.length===e.length?s:l4(e),t),f=i4(d,e,{ease:Array.isArray(l)?l:u4(e,l)});return{calculatedDuration:t,next:m=>(u.value=f(m),u.done=m>=t,u)}}const d4=t=>t!==null;function op(t,{repeat:e,repeatType:s="loop"},r,l=1){const u=t.filter(d4),f=l<0||e&&s!=="loop"&&e%2===1?0:u.length-1;return!f||r===void 0?u[f]:r}const f4={decay:dm,inertia:dm,tween:ko,keyframes:ko,spring:vu};function hS(t){typeof t.type=="string"&&(t.type=f4[t.type])}class lp{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,s){return this.finished.then(e,s)}}const h4=t=>t/100;class cp extends lp{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:s}=this.options;s&&s.updatedAt!==Jt.now()&&this.tick(Jt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;hS(e);const{type:s=ko,repeat:r=0,repeatDelay:l=0,repeatType:u,velocity:d=0}=e;let{keyframes:f}=e;const m=s||ko;m!==ko&&typeof f[0]!="number"&&(this.mixKeyframes=sl(h4,uS(f[0],f[1])),f=[0,100]);const g=m({...e,keyframes:f});u==="mirror"&&(this.mirroredGenerator=m({...e,keyframes:[...f].reverse(),velocity:-d})),g.calculatedDuration===null&&(g.calculatedDuration=ip(g));const{calculatedDuration:y}=g;this.calculatedDuration=y,this.resolvedDuration=y+l,this.totalDuration=this.resolvedDuration*(r+1)-l,this.generator=g}updateTime(e){const s=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(e,s=!1){const{generator:r,totalDuration:l,mixKeyframes:u,mirroredGenerator:d,resolvedDuration:f,calculatedDuration:m}=this;if(this.startTime===null)return r.next(0);const{delay:g=0,keyframes:y,repeat:x,repeatType:w,repeatDelay:S,type:E,onUpdate:j,finalKeyframe:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-l/this.speed,this.startTime)),s?this.currentTime=e:this.updateTime(e);const N=this.currentTime-g*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?N<0:N>l;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=l);let C=this.currentTime,A=r;if(x){const R=Math.min(this.currentTime,l)/f;let P=Math.floor(R),Z=R%1;!Z&&R>=1&&(Z=1),Z===1&&P--,P=Math.min(P,x+1),P%2&&(w==="reverse"?(Z=1-Z,S&&(Z-=S/f)):w==="mirror"&&(A=d)),C=ls(0,1,Z)*f}const D=k?{done:!1,value:y[0]}:A.next(C);u&&(D.value=u(D.value));let{done:U}=D;!k&&m!==null&&(U=this.playbackSpeed>=0?this.currentTime>=l:this.currentTime<=0);const V=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&U);return V&&E!==dm&&(D.value=op(y,this.options,_,this.speed)),j&&j(D.value),V&&this.finish(),D}then(e,s){return this.finished.then(e,s)}get duration(){return Pn(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Pn(e)}get time(){return Pn(this.currentTime)}set time(e){e=Fn(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Jt.now());const s=this.playbackSpeed!==e;this.playbackSpeed=e,s&&(this.time=Pn(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=W5,startTime:s}=this.options;this.driver||(this.driver=e(l=>this.tick(l))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=s??r),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(Jt.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.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function m4(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Ka=t=>t*180/Math.PI,fm=t=>{const e=Ka(Math.atan2(t[1],t[0]));return hm(e)},p4={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:fm,rotateZ:fm,skewX:t=>Ka(Math.atan(t[1])),skewY:t=>Ka(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},hm=t=>(t=t%360,t<0&&(t+=360),t),V0=fm,I0=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),$0=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),g4={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:I0,scaleY:$0,scale:t=>(I0(t)+$0(t))/2,rotateX:t=>hm(Ka(Math.atan2(t[6],t[5]))),rotateY:t=>hm(Ka(Math.atan2(-t[2],t[0]))),rotateZ:V0,rotate:V0,skewX:t=>Ka(Math.atan(t[4])),skewY:t=>Ka(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function mm(t){return t.includes("scale")?1:0}function pm(t,e){if(!t||t==="none")return mm(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,l;if(s)r=g4,l=s;else{const f=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=p4,l=f}if(!l)return mm(e);const u=r[e],d=l[1].split(",").map(v4);return typeof u=="function"?u(d):d[u]}const y4=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return pm(s,e)};function v4(t){return parseFloat(t.trim())}const vi=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],xi=new Set(vi),q0=t=>t===yi||t===be,x4=new Set(["x","y","z"]),b4=vi.filter(t=>!x4.has(t));function w4(t){const e=[];return b4.forEach(s=>{const r=t.getValue(s);r!==void 0&&(e.push([s,r.get()]),r.set(s.startsWith("scale")?1:0))}),e}const da={width:({x:t},{paddingLeft:e="0",paddingRight:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),height:({y:t},{paddingTop:e="0",paddingBottom:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>pm(e,"x"),y:(t,{transform:e})=>pm(e,"y")};da.translateX=da.x;da.translateY=da.y;const Ja=new Set;let gm=!1,ym=!1,vm=!1;function mS(){if(ym){const t=Array.from(Ja).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),s=new Map;e.forEach(r=>{const l=w4(r);l.length&&(s.set(r,l),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const l=s.get(r);l&&l.forEach(([u,d])=>{r.getValue(u)?.set(d)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}ym=!1,gm=!1,Ja.forEach(t=>t.complete(vm)),Ja.clear()}function pS(){Ja.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(ym=!0)})}function S4(){vm=!0,pS(),mS(),vm=!1}class up{constructor(e,s,r,l,u,d=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=s,this.name=r,this.motionValue=l,this.element=u,this.isAsync=d}scheduleResolve(){this.state="scheduled",this.isAsync?(Ja.add(this),gm||(gm=!0,lt.read(pS),lt.resolveKeyframes(mS))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:s,element:r,motionValue:l}=this;if(e[0]===null){const u=l?.get(),d=e[e.length-1];if(u!==void 0)e[0]=u;else if(r&&s){const f=r.readValue(s,d);f!=null&&(e[0]=f)}e[0]===void 0&&(e[0]=d),l&&u===void 0&&l.set(e[0])}m4(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Ja.delete(this)}cancel(){this.state==="scheduled"&&(Ja.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const j4=t=>t.startsWith("--");function _4(t,e,s){j4(e)?t.style.setProperty(e,s):t.style[e]=s}const N4={};function gS(t,e){const s=q1(t);return()=>N4[e]??s()}const T4=gS(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),yS=gS(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),So=([t,e,s,r])=>`cubic-bezier(${t}, ${e}, ${s}, ${r})`,H0={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:So([0,.65,.55,1]),circOut:So([.55,0,1,.45]),backIn:So([.31,.01,.66,-.59]),backOut:So([.33,1.53,.69,.99])};function vS(t,e){if(t)return typeof t=="function"?yS()?dS(t,e):"ease-out":eS(t)?So(t):Array.isArray(t)?t.map(s=>vS(s,e)||H0.easeOut):H0[t]}function E4(t,e,s,{delay:r=0,duration:l=300,repeat:u=0,repeatType:d="loop",ease:f="easeOut",times:m}={},g=void 0){const y={[e]:s};m&&(y.offset=m);const x=vS(f,l);Array.isArray(x)&&(y.easing=x);const w={delay:r,duration:l,easing:Array.isArray(x)?"linear":x,fill:"both",iterations:u+1,direction:d==="reverse"?"alternate":"normal"};return g&&(w.pseudoElement=g),t.animate(y,w)}function xS(t){return typeof t=="function"&&"applyToOptions"in t}function k4({type:t,...e}){return xS(t)&&yS()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class bS extends lp{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:s,name:r,keyframes:l,pseudoElement:u,allowFlatten:d=!1,finalKeyframe:f,onComplete:m}=e;this.isPseudoElement=!!u,this.allowFlatten=d,this.options=e,Qm(typeof e.type!="string");const g=k4(e);this.animation=E4(s,r,l,g,u),g.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!u){const y=op(l,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(y):_4(s,r,y),this.animation.cancel()}m?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Pn(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Pn(e)}get time(){return Pn(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Fn(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&T4()?(this.animation.timeline=e,Ln):s(this)}}const wS={anticipate:W1,backInOut:X1,circInOut:Q1};function C4(t){return t in wS}function A4(t){typeof t.ease=="string"&&C4(t.ease)&&(t.ease=wS[t.ease])}const kh=10;class R4 extends bS{constructor(e){A4(e),hS(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:s,onUpdate:r,onComplete:l,element:u,...d}=this.options;if(!s)return;if(e!==void 0){s.set(e);return}const f=new cp({...d,autoplay:!1}),m=Math.max(kh,Jt.now()-this.startTime),g=ls(0,kh,m-kh);s.setWithVelocity(f.sample(Math.max(0,m-g)).value,f.sample(m).value,g),f.stop()}}const G0=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Kn.test(t)||t==="0")&&!t.startsWith("url("));function O4(t){const e=t[0];if(t.length===1)return!0;for(let s=0;s<t.length;s++)if(t[s]!==e)return!0}function M4(t,e,s,r){const l=t[0];if(l===null)return!1;if(e==="display"||e==="visibility")return!0;const u=t[t.length-1],d=G0(l,e),f=G0(u,e);return!d||!f?!1:O4(t)||(s==="spring"||xS(s))&&r}function xm(t){t.duration=0,t.type="keyframes"}const D4=new Set(["opacity","clipPath","filter","transform"]),P4=q1(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function z4(t){const{motionValue:e,name:s,repeatDelay:r,repeatType:l,damping:u,type:d}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:g}=e.owner.getProps();return P4()&&s&&D4.has(s)&&(s!=="transform"||!g)&&!m&&!r&&l!=="mirror"&&u!==0&&d!=="inertia"}const L4=40;class U4 extends lp{constructor({autoplay:e=!0,delay:s=0,type:r="keyframes",repeat:l=0,repeatDelay:u=0,repeatType:d="loop",keyframes:f,name:m,motionValue:g,element:y,...x}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Jt.now();const w={autoplay:e,delay:s,type:r,repeat:l,repeatDelay:u,repeatType:d,name:m,motionValue:g,element:y,...x},S=y?.KeyframeResolver||up;this.keyframeResolver=new S(f,(E,j,_)=>this.onKeyframesResolved(E,j,w,!_),m,g,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,s,r,l){this.keyframeResolver=void 0;const{name:u,type:d,velocity:f,delay:m,isHandoff:g,onUpdate:y}=r;this.resolvedAt=Jt.now(),M4(e,u,d,f)||((As.instantAnimations||!m)&&y?.(op(e,r,s)),e[0]=e[e.length-1],xm(r),r.repeat=0);const w={startTime:l?this.resolvedAt?this.resolvedAt-this.createdAt>L4?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...r,keyframes:e},S=!g&&z4(w),E=w.motionValue?.owner?.current,j=S?new R4({...w,element:E}):new cp(w);j.finished.then(()=>{this.notifyFinished()}).catch(Ln),this.pendingTimeline&&(this.stopTimeline=j.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=j}get finished(){return this._animation?this.animation.finished:this._finished}then(e,s){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),S4()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function SS(t,e,s,r=0,l=1){const u=Array.from(t).sort((g,y)=>g.sortNodePosition(y)).indexOf(e),d=t.size,f=(d-1)*r;return typeof s=="function"?s(u,d):l===1?u*r:f-u*r}const B4=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function V4(t){const e=B4.exec(t);if(!e)return[,];const[,s,r,l]=e;return[`--${s??r}`,l]}function jS(t,e,s=1){const[r,l]=V4(t);if(!r)return;const u=window.getComputedStyle(e).getPropertyValue(r);if(u){const d=u.trim();return V1(d)?parseFloat(d):d}return np(l)?jS(l,e,s+1):l}const I4={type:"spring",stiffness:500,damping:25,restSpeed:10},$4=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),q4={type:"keyframes",duration:.8},H4={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},G4=(t,{keyframes:e})=>e.length>2?q4:xi.has(t)?t.startsWith("scale")?$4(e[1]):I4:H4,F4=t=>t!==null;function K4(t,{repeat:e,repeatType:s="loop"},r){const l=t.filter(F4),u=e&&s!=="loop"&&e%2===1?0:l.length-1;return l[u]}function _S(t,e){if(t?.inherit&&e){const{inherit:s,...r}=t;return{...e,...r}}return t}function dp(t,e){const s=t?.[e]??t?.default??t;return s!==t?_S(s,t):s}function Y4({when:t,delay:e,delayChildren:s,staggerChildren:r,staggerDirection:l,repeat:u,repeatType:d,repeatDelay:f,from:m,elapsed:g,...y}){return!!Object.keys(y).length}const fp=(t,e,s,r={},l,u)=>d=>{const f=dp(r,t)||{},m=f.delay||r.delay||0;let{elapsed:g=0}=r;g=g-Fn(m);const y={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:e.getVelocity(),...f,delay:-g,onUpdate:w=>{e.set(w),f.onUpdate&&f.onUpdate(w)},onComplete:()=>{d(),f.onComplete&&f.onComplete()},name:t,motionValue:e,element:u?void 0:l};Y4(f)||Object.assign(y,G4(t,y)),y.duration&&(y.duration=Fn(y.duration)),y.repeatDelay&&(y.repeatDelay=Fn(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let x=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(xm(y),y.delay===0&&(x=!0)),(As.instantAnimations||As.skipAnimations||l?.shouldSkipAnimations)&&(x=!0,xm(y),y.delay=0),y.allowFlatten=!f.type&&!f.ease,x&&!u&&e.get()!==void 0){const w=K4(y.keyframes,f);if(w!==void 0){lt.update(()=>{y.onUpdate(w),y.onComplete()});return}}return f.isSync?new cp(y):new U4(y)};function F0(t){const e=[{},{}];return t?.values.forEach((s,r)=>{e[0][r]=s.get(),e[1][r]=s.getVelocity()}),e}function hp(t,e,s,r){if(typeof e=="function"){const[l,u]=F0(r);e=e(s!==void 0?s:t.custom,l,u)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[l,u]=F0(r);e=e(s!==void 0?s:t.custom,l,u)}return e}function ci(t,e,s){const r=t.getProps();return hp(r,e,s!==void 0?s:r.custom,t)}const NS=new Set(["width","height","top","left","right","bottom",...vi]),K0=30,X4=t=>!isNaN(parseFloat(t));class W4{constructor(e,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const l=Jt.now();if(this.updatedAt!==l&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const u of this.dependents)u.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=s.owner}setCurrent(e){this.current=e,this.updatedAt=Jt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=X4(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,s){this.events[e]||(this.events[e]=new Zm);const r=this.events[e].add(s);return e==="change"?()=>{r(),lt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,s){this.passiveEffect=e,this.stopPassiveEffect=s}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,s,r){this.set(s),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,s=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Jt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>K0)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,K0);return H1(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(e){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=e(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function mi(t,e){return new W4(t,e)}const bm=t=>Array.isArray(t);function J4(t,e,s){t.hasValue(e)?t.getValue(e).set(s):t.addValue(e,mi(s))}function Q4(t){return bm(t)?t[t.length-1]||0:t}function Z4(t,e){const s=ci(t,e);let{transitionEnd:r={},transition:l={},...u}=s||{};u={...u,...r};for(const d in u){const f=Q4(u[d]);J4(t,d,f)}}const Xt=t=>!!(t&&t.getVelocity);function eM(t){return!!(Xt(t)&&t.add)}function wm(t,e){const s=t.getValue("willChange");if(eM(s))return s.add(e);if(!s&&As.WillChange){const r=new As.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function mp(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const tM="framerAppearId",TS="data-"+mp(tM);function ES(t){return t.props[TS]}function nM({protectedKeys:t,needsAnimating:e},s){const r=t.hasOwnProperty(s)&&e[s]!==!0;return e[s]=!1,r}function kS(t,e,{delay:s=0,transitionOverride:r,type:l}={}){let{transition:u,transitionEnd:d,...f}=e;const m=t.getDefaultTransition();u=u?_S(u,m):m;const g=u?.reduceMotion;r&&(u=r);const y=[],x=l&&t.animationState&&t.animationState.getState()[l];for(const w in f){const S=t.getValue(w,t.latestValues[w]??null),E=f[w];if(E===void 0||x&&nM(x,w))continue;const j={delay:s,...dp(u||{},w)},_=S.get();if(_!==void 0&&!S.isAnimating&&!Array.isArray(E)&&E===_&&!j.velocity)continue;let N=!1;if(window.MotionHandoffAnimation){const A=ES(t);if(A){const D=window.MotionHandoffAnimation(A,w,lt);D!==null&&(j.startTime=D,N=!0)}}wm(t,w);const k=g??t.shouldReduceMotion;S.start(fp(w,S,E,k&&NS.has(w)?{type:!1}:j,t,N));const C=S.animation;C&&y.push(C)}if(d){const w=()=>lt.update(()=>{d&&Z4(t,d)});y.length?Promise.all(y).then(w):w()}return y}function Sm(t,e,s={}){const r=ci(t,e,s.type==="exit"?t.presenceContext?.custom:void 0);let{transition:l=t.getDefaultTransition()||{}}=r||{};s.transitionOverride&&(l=s.transitionOverride);const u=r?()=>Promise.all(kS(t,r,s)):()=>Promise.resolve(),d=t.variantChildren&&t.variantChildren.size?(m=0)=>{const{delayChildren:g=0,staggerChildren:y,staggerDirection:x}=l;return sM(t,e,m,g,y,x,s)}:()=>Promise.resolve(),{when:f}=l;if(f){const[m,g]=f==="beforeChildren"?[u,d]:[d,u];return m().then(()=>g())}else return Promise.all([u(),d(s.delay)])}function sM(t,e,s=0,r=0,l=0,u=1,d){const f=[];for(const m of t.variantChildren)m.notify("AnimationStart",e),f.push(Sm(m,e,{...d,delay:s+(typeof r=="function"?0:r)+SS(t.variantChildren,m,r,l,u)}).then(()=>m.notify("AnimationComplete",e)));return Promise.all(f)}function aM(t,e,s={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const l=e.map(u=>Sm(t,u,s));r=Promise.all(l)}else if(typeof e=="string")r=Sm(t,e,s);else{const l=typeof e=="function"?ci(t,e,s.custom):e;r=Promise.all(kS(t,l,s))}return r.then(()=>{t.notify("AnimationComplete",e)})}const rM={test:t=>t==="auto",parse:t=>t},CS=t=>e=>e.test(t),AS=[yi,be,is,la,D5,M5,rM],Y0=t=>AS.find(CS(t));function iM(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||$1(t):!0}const oM=new Set(["brightness","contrast","saturate","opacity"]);function lM(t){const[e,s]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=s.match(sp)||[];if(!r)return t;const l=s.replace(r,"");let u=oM.has(e)?1:0;return r!==s&&(u*=100),e+"("+u+l+")"}const cM=/\b([a-z-]*)\(.*?\)/gu,jm={...Kn,getAnimatableNone:t=>{const e=t.match(cM);return e?e.map(lM).join(" "):t}},_m={...Kn,getAnimatableNone:t=>{const e=Kn.parse(t);return Kn.createTransformer(t)(e.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},X0={...yi,transform:Math.round},uM={rotate:la,rotateX:la,rotateY:la,rotateZ:la,scale:qc,scaleX:qc,scaleY:qc,scaleZ:qc,skew:la,skewX:la,skewY:la,distance:be,translateX:be,translateY:be,translateZ:be,x:be,y:be,z:be,perspective:be,transformPerspective:be,opacity:Fo,originX:P0,originY:P0,originZ:be},pp={borderWidth:be,borderTopWidth:be,borderRightWidth:be,borderBottomWidth:be,borderLeftWidth:be,borderRadius:be,borderTopLeftRadius:be,borderTopRightRadius:be,borderBottomRightRadius:be,borderBottomLeftRadius:be,width:be,maxWidth:be,height:be,maxHeight:be,top:be,right:be,bottom:be,left:be,inset:be,insetBlock:be,insetBlockStart:be,insetBlockEnd:be,insetInline:be,insetInlineStart:be,insetInlineEnd:be,padding:be,paddingTop:be,paddingRight:be,paddingBottom:be,paddingLeft:be,paddingBlock:be,paddingBlockStart:be,paddingBlockEnd:be,paddingInline:be,paddingInlineStart:be,paddingInlineEnd:be,margin:be,marginTop:be,marginRight:be,marginBottom:be,marginLeft:be,marginBlock:be,marginBlockStart:be,marginBlockEnd:be,marginInline:be,marginInlineStart:be,marginInlineEnd:be,fontSize:be,backgroundPositionX:be,backgroundPositionY:be,...uM,zIndex:X0,fillOpacity:Fo,strokeOpacity:Fo,numOctaves:X0},dM={...pp,color:Et,backgroundColor:Et,outlineColor:Et,fill:Et,stroke:Et,borderColor:Et,borderTopColor:Et,borderRightColor:Et,borderBottomColor:Et,borderLeftColor:Et,filter:jm,WebkitFilter:jm,mask:_m,WebkitMask:_m},RS=t=>dM[t],fM=new Set([jm,_m]);function OS(t,e){let s=RS(t);return fM.has(s)||(s=Kn),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const hM=new Set(["auto","none","0"]);function mM(t,e,s){let r=0,l;for(;r<t.length&&!l;){const u=t[r];typeof u=="string"&&!hM.has(u)&&Ko(u).values.length&&(l=t[r]),r++}if(l&&s)for(const u of e)t[u]=OS(s,l)}class pM extends up{constructor(e,s,r,l,u){super(e,s,r,l,u,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:s,name:r}=this;if(!s||!s.current)return;super.readKeyframes();for(let y=0;y<e.length;y++){let x=e[y];if(typeof x=="string"&&(x=x.trim(),np(x))){const w=jS(x,s.current);w!==void 0&&(e[y]=w),y===e.length-1&&(this.finalKeyframe=x)}}if(this.resolveNoneKeyframes(),!NS.has(r)||e.length!==2)return;const[l,u]=e,d=Y0(l),f=Y0(u),m=D0(l),g=D0(u);if(m!==g&&da[r]){this.needsMeasurement=!0;return}if(d!==f)if(q0(d)&&q0(f))for(let y=0;y<e.length;y++){const x=e[y];typeof x=="string"&&(e[y]=parseFloat(x))}else da[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:s}=this,r=[];for(let l=0;l<e.length;l++)(e[l]===null||iM(e[l]))&&r.push(l);r.length&&mM(e,r,s)}measureInitialState(){const{element:e,unresolvedKeyframes:s,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=da[r](e.measureViewportBox(),window.getComputedStyle(e.current)),s[0]=this.measuredOrigin;const l=s[s.length-1];l!==void 0&&e.getValue(r,l).jump(l,!1)}measureEndState(){const{element:e,name:s,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const l=e.getValue(s);l&&l.jump(this.measuredOrigin,!1);const u=r.length-1,d=r[u];r[u]=da[s](e.measureViewportBox(),window.getComputedStyle(e.current)),d!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=d),this.removedTransforms?.length&&this.removedTransforms.forEach(([f,m])=>{e.getValue(f).set(m)}),this.resolveNoneKeyframes()}}const gM=new Set(["opacity","clipPath","filter","transform"]);function MS(t,e,s){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const l=s?.[t]??r.querySelectorAll(t);return l?Array.from(l):[]}return Array.from(t).filter(r=>r!=null)}const DS=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Nm(t){return I1(t)&&"offsetHeight"in t}const{schedule:gp}=tS(queueMicrotask,!1),qn={x:!1,y:!1};function PS(){return qn.x||qn.y}function yM(t){return t==="x"||t==="y"?qn[t]?null:(qn[t]=!0,()=>{qn[t]=!1}):qn.x||qn.y?null:(qn.x=qn.y=!0,()=>{qn.x=qn.y=!1})}function zS(t,e){const s=MS(t),r=new AbortController,l={passive:!0,...e,signal:r.signal};return[s,l,()=>r.abort()]}function vM(t){return!(t.pointerType==="touch"||PS())}function xM(t,e,s={}){const[r,l,u]=zS(t,s);return r.forEach(d=>{let f=!1,m=!1,g;const y=()=>{d.removeEventListener("pointerleave",E)},x=_=>{g&&(g(_),g=void 0),y()},w=_=>{f=!1,window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w),m&&(m=!1,x(_))},S=()=>{f=!0,window.addEventListener("pointerup",w,l),window.addEventListener("pointercancel",w,l)},E=_=>{if(_.pointerType!=="touch"){if(f){m=!0;return}x(_)}},j=_=>{if(!vM(_))return;m=!1;const N=e(d,_);typeof N=="function"&&(g=N,d.addEventListener("pointerleave",E,l))};d.addEventListener("pointerenter",j,l),d.addEventListener("pointerdown",S,l)}),u}const LS=(t,e)=>e?t===e?!0:LS(t,e.parentElement):!1,yp=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,bM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function wM(t){return bM.has(t.tagName)||t.isContentEditable===!0}const SM=new Set(["INPUT","SELECT","TEXTAREA"]);function jM(t){return SM.has(t.tagName)||t.isContentEditable===!0}const Jc=new WeakSet;function W0(t){return e=>{e.key==="Enter"&&t(e)}}function Ch(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const _M=(t,e)=>{const s=t.currentTarget;if(!s)return;const r=W0(()=>{if(Jc.has(s))return;Ch(s,"down");const l=W0(()=>{Ch(s,"up")}),u=()=>Ch(s,"cancel");s.addEventListener("keyup",l,e),s.addEventListener("blur",u,e)});s.addEventListener("keydown",r,e),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),e)};function J0(t){return yp(t)&&!PS()}const Q0=new WeakSet;function NM(t,e,s={}){const[r,l,u]=zS(t,s),d=f=>{const m=f.currentTarget;if(!J0(f)||Q0.has(f))return;Jc.add(m),s.stopPropagation&&Q0.add(f);const g=e(m,f),y=(S,E)=>{window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",w),Jc.has(m)&&Jc.delete(m),J0(S)&&typeof g=="function"&&g(S,{success:E})},x=S=>{y(S,m===window||m===document||s.useGlobalTarget||LS(m,S.target))},w=S=>{y(S,!1)};window.addEventListener("pointerup",x,l),window.addEventListener("pointercancel",w,l)};return r.forEach(f=>{(s.useGlobalTarget?window:f).addEventListener("pointerdown",d,l),Nm(f)&&(f.addEventListener("focus",g=>_M(g,l)),!wM(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),u}function vp(t){return I1(t)&&"ownerSVGElement"in t}const Qc=new WeakMap;let Zc;const US=(t,e,s)=>(r,l)=>l&&l[0]?l[0][t+"Size"]:vp(r)&&"getBBox"in r?r.getBBox()[e]:r[s],TM=US("inline","width","offsetWidth"),EM=US("block","height","offsetHeight");function kM({target:t,borderBoxSize:e}){Qc.get(t)?.forEach(s=>{s(t,{get width(){return TM(t,e)},get height(){return EM(t,e)}})})}function CM(t){t.forEach(kM)}function AM(){typeof ResizeObserver>"u"||(Zc=new ResizeObserver(CM))}function RM(t,e){Zc||AM();const s=MS(t);return s.forEach(r=>{let l=Qc.get(r);l||(l=new Set,Qc.set(r,l)),l.add(e),Zc?.observe(r)}),()=>{s.forEach(r=>{const l=Qc.get(r);l?.delete(e),l?.size||Zc?.unobserve(r)})}}const eu=new Set;let si;function OM(){si=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};eu.forEach(e=>e(t))},window.addEventListener("resize",si)}function MM(t){return eu.add(t),si||OM(),()=>{eu.delete(t),!eu.size&&typeof si=="function"&&(window.removeEventListener("resize",si),si=void 0)}}function Z0(t,e){return typeof t=="function"?MM(t):RM(t,e)}function DM(t){return vp(t)&&t.tagName==="svg"}const PM=[...AS,Et,Kn],zM=t=>PM.find(CS(t)),eb=()=>({translate:0,scale:1,origin:0,originPoint:0}),ai=()=>({x:eb(),y:eb()}),tb=()=>({min:0,max:0}),Ot=()=>({x:tb(),y:tb()}),LM=new WeakMap;function Pu(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Yo(t){return typeof t=="string"||Array.isArray(t)}const xp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],bp=["initial",...xp];function zu(t){return Pu(t.animate)||bp.some(e=>Yo(t[e]))}function BS(t){return!!(zu(t)||t.variants)}function UM(t,e,s){for(const r in e){const l=e[r],u=s[r];if(Xt(l))t.addValue(r,l);else if(Xt(u))t.addValue(r,mi(l,{owner:t}));else if(u!==l)if(t.hasValue(r)){const d=t.getValue(r);d.liveStyle===!0?d.jump(l):d.hasAnimated||d.set(l)}else{const d=t.getStaticValue(r);t.addValue(r,mi(d!==void 0?d:l,{owner:t}))}}for(const r in s)e[r]===void 0&&t.removeValue(r);return e}const Tm={current:null},VS={current:!1},BM=typeof window<"u";function VM(){if(VS.current=!0,!!BM)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Tm.current=t.matches;t.addEventListener("change",e),e()}else Tm.current=!1}const nb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let xu={};function IS(t){xu=t}function IM(){return xu}class $M{scrapeMotionValuesFromProps(e,s,r){return{}}constructor({parent:e,props:s,presenceContext:r,reducedMotionConfig:l,skipAnimations:u,blockInitialAnimation:d,visualState:f},m={}){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=up,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 S=Jt.now();this.renderScheduledAt<S&&(this.renderScheduledAt=S,lt.render(this.render,!1,!0))};const{latestValues:g,renderState:y}=f;this.latestValues=g,this.baseTarget={...g},this.initialValues=s.initial?{...g}:{},this.renderState=y,this.parent=e,this.props=s,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=l,this.skipAnimationsConfig=u,this.options=m,this.blockInitialAnimation=!!d,this.isControllingVariants=zu(s),this.isVariantNode=BS(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:x,...w}=this.scrapeMotionValuesFromProps(s,{},this);for(const S in w){const E=w[S];g[S]!==void 0&&Xt(E)&&E.set(g[S])}}mount(e){if(this.hasBeenMounted)for(const s in this.initialValues)this.values.get(s)?.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];this.current=e,LM.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,r)=>this.bindToMotionValue(r,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(VS.current||VM(),this.shouldReduceMotion=Tm.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),ma(this.notifyUpdate),ma(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const s=this.features[e];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,s){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),s.accelerate&&gM.has(e)&&this.current instanceof HTMLElement){const{factory:d,keyframes:f,times:m,ease:g,duration:y}=s.accelerate,x=new bS({element:this.current,name:e,keyframes:f,times:m,ease:g,duration:Fn(y)}),w=d(x);this.valueSubscriptions.set(e,()=>{w(),x.cancel()});return}const r=xi.has(e);r&&this.onBindTransform&&this.onBindTransform();const l=s.on("change",d=>{this.latestValues[e]=d,this.props.onUpdate&<.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let u;typeof window<"u"&&window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,e,s)),this.valueSubscriptions.set(e,()=>{l(),u&&u(),s.owner&&s.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in xu){const s=xu[e];if(!s)continue;const{isEnabled:r,Feature:l}=s;if(!this.features[e]&&l&&r(this.props)&&(this.features[e]=new l(this)),this.features[e]){const u=this.features[e];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ot()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,s){this.latestValues[e]=s}update(e,s){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let r=0;r<nb.length;r++){const l=nb[r];this.propEventSubscriptions[l]&&(this.propEventSubscriptions[l](),delete this.propEventSubscriptions[l]);const u="on"+l,d=e[u];d&&(this.propEventSubscriptions[l]=this.on(l,d))}this.prevMotionValues=UM(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(e),()=>s.variantChildren.delete(e)}addValue(e,s){const r=this.values.get(e);s!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,s),this.values.set(e,s),this.latestValues[e]=s.get())}removeValue(e){this.values.delete(e);const s=this.valueSubscriptions.get(e);s&&(s(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,s){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&s!==void 0&&(r=mi(s===null?void 0:s,{owner:this}),this.addValue(e,r)),r}readValue(e,s){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(V1(r)||$1(r))?r=parseFloat(r):!zM(r)&&Kn.test(s)&&(r=OS(e,s)),this.setBaseTarget(e,Xt(r)?r.get():r)),Xt(r)?r.get():r}setBaseTarget(e,s){this.baseTarget[e]=s}getBaseTarget(e){const{initial:s}=this.props;let r;if(typeof s=="string"||typeof s=="object"){const u=hp(this.props,s,this.presenceContext?.custom);u&&(r=u[e])}if(s&&r!==void 0)return r;const l=this.getBaseTargetFromProps(this.props,e);return l!==void 0&&!Xt(l)?l:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,s){return this.events[e]||(this.events[e]=new Zm),this.events[e].add(s)}notify(e,...s){this.events[e]&&this.events[e].notify(...s)}scheduleRenderMicrotask(){gp.render(this.render)}}class $S extends $M{constructor(){super(...arguments),this.KeyframeResolver=pM}sortInstanceNodePosition(e,s){return e.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(e,s){const r=e.style;return r?r[s]:void 0}removeValueFromRenderState(e,{vars:s,style:r}){delete s[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Xt(e)&&(this.childSubscription=e.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class ya{constructor(e){this.isMounted=!1,this.node=e}update(){}}function qS({top:t,left:e,right:s,bottom:r}){return{x:{min:e,max:s},y:{min:t,max:r}}}function qM({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function HM(t,e){if(!e)return t;const s=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:s.y,left:s.x,bottom:r.y,right:r.x}}function Ah(t){return t===void 0||t===1}function Em({scale:t,scaleX:e,scaleY:s}){return!Ah(t)||!Ah(e)||!Ah(s)}function $a(t){return Em(t)||HS(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function HS(t){return sb(t.x)||sb(t.y)}function sb(t){return t&&t!=="0%"}function bu(t,e,s){const r=t-s,l=e*r;return s+l}function ab(t,e,s,r,l){return l!==void 0&&(t=bu(t,l,r)),bu(t,s,r)+e}function km(t,e=0,s=1,r,l){t.min=ab(t.min,e,s,r,l),t.max=ab(t.max,e,s,r,l)}function GS(t,{x:e,y:s}){km(t.x,e.translate,e.scale,e.originPoint),km(t.y,s.translate,s.scale,s.originPoint)}const rb=.999999999999,ib=1.0000000000001;function GM(t,e,s,r=!1){const l=s.length;if(!l)return;e.x=e.y=1;let u,d;for(let f=0;f<l;f++){u=s[f],d=u.projectionDelta;const{visualElement:m}=u.options;m&&m.props.style&&m.props.style.display==="contents"||(r&&u.options.layoutScroll&&u.scroll&&u!==u.root&&ii(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(e.x*=d.x.scale,e.y*=d.y.scale,GS(t,d)),r&&$a(u.latestValues)&&ii(t,u.latestValues))}e.x<ib&&e.x>rb&&(e.x=1),e.y<ib&&e.y>rb&&(e.y=1)}function ri(t,e){t.min=t.min+e,t.max=t.max+e}function ob(t,e,s,r,l=.5){const u=mt(t.min,t.max,l);km(t,e,s,u,r)}function ii(t,e){ob(t.x,e.x,e.scaleX,e.scale,e.originX),ob(t.y,e.y,e.scaleY,e.scale,e.originY)}function FS(t,e){return qS(HM(t.getBoundingClientRect(),e))}function FM(t,e,s){const r=FS(t,s),{scroll:l}=e;return l&&(ri(r.x,l.offset.x),ri(r.y,l.offset.y)),r}const KM={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},YM=vi.length;function XM(t,e,s){let r="",l=!0;for(let u=0;u<YM;u++){const d=vi[u],f=t[d];if(f===void 0)continue;let m=!0;if(typeof f=="number")m=f===(d.startsWith("scale")?1:0);else{const g=parseFloat(f);m=d.startsWith("scale")?g===1:g===0}if(!m||s){const g=DS(f,pp[d]);if(!m){l=!1;const y=KM[d]||d;r+=`${y}(${g}) `}s&&(e[d]=g)}}return r=r.trim(),s?r=s(e,l?"":r):l&&(r="none"),r}function wp(t,e,s){const{style:r,vars:l,transformOrigin:u}=t;let d=!1,f=!1;for(const m in e){const g=e[m];if(xi.has(m)){d=!0;continue}else if(sS(m)){l[m]=g;continue}else{const y=DS(g,pp[m]);m.startsWith("origin")?(f=!0,u[m]=y):r[m]=y}}if(e.transform||(d||s?r.transform=XM(e,t.transform,s):r.transform&&(r.transform="none")),f){const{originX:m="50%",originY:g="50%",originZ:y=0}=u;r.transformOrigin=`${m} ${g} ${y}`}}function KS(t,{style:e,vars:s},r,l){const u=t.style;let d;for(d in e)u[d]=e[d];l?.applyProjectionStyles(u,r);for(d in s)u.setProperty(d,s[d])}function lb(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const xo={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(be.test(t))t=parseFloat(t);else return t;const s=lb(t,e.target.x),r=lb(t,e.target.y);return`${s}% ${r}%`}},WM={correct:(t,{treeScale:e,projectionDelta:s})=>{const r=t,l=Kn.parse(t);if(l.length>5)return r;const u=Kn.createTransformer(t),d=typeof l[0]!="number"?1:0,f=s.x.scale*e.x,m=s.y.scale*e.y;l[0+d]/=f,l[1+d]/=m;const g=mt(f,m,.5);return typeof l[2+d]=="number"&&(l[2+d]/=g),typeof l[3+d]=="number"&&(l[3+d]/=g),u(l)}},Cm={borderRadius:{...xo,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:xo,borderTopRightRadius:xo,borderBottomLeftRadius:xo,borderBottomRightRadius:xo,boxShadow:WM};function YS(t,{layout:e,layoutId:s}){return xi.has(t)||t.startsWith("origin")||(e||s!==void 0)&&(!!Cm[t]||t==="opacity")}function Sp(t,e,s){const r=t.style,l=e?.style,u={};if(!r)return u;for(const d in r)(Xt(r[d])||l&&Xt(l[d])||YS(d,t)||s?.getValue(d)?.liveStyle!==void 0)&&(u[d]=r[d]);return u}function JM(t){return window.getComputedStyle(t)}class QM extends $S{constructor(){super(...arguments),this.type="html",this.renderInstance=KS}readValueFromInstance(e,s){if(xi.has(s))return this.projection?.isProjecting?mm(s):y4(e,s);{const r=JM(e),l=(sS(s)?r.getPropertyValue(s):r[s])||0;return typeof l=="string"?l.trim():l}}measureInstanceViewportBox(e,{transformPagePoint:s}){return FS(e,s)}build(e,s,r){wp(e,s,r.transformTemplate)}scrapeMotionValuesFromProps(e,s,r){return Sp(e,s,r)}}const ZM={offset:"stroke-dashoffset",array:"stroke-dasharray"},eD={offset:"strokeDashoffset",array:"strokeDasharray"};function tD(t,e,s=1,r=0,l=!0){t.pathLength=1;const u=l?ZM:eD;t[u.offset]=`${-r}`,t[u.array]=`${e} ${s}`}const nD=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function XS(t,{attrX:e,attrY:s,attrScale:r,pathLength:l,pathSpacing:u=1,pathOffset:d=0,...f},m,g,y){if(wp(t,f,g),m){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:x,style:w}=t;x.transform&&(w.transform=x.transform,delete x.transform),(w.transform||x.transformOrigin)&&(w.transformOrigin=x.transformOrigin??"50% 50%",delete x.transformOrigin),w.transform&&(w.transformBox=y?.transformBox??"fill-box",delete x.transformBox);for(const S of nD)x[S]!==void 0&&(w[S]=x[S],delete x[S]);e!==void 0&&(x.x=e),s!==void 0&&(x.y=s),r!==void 0&&(x.scale=r),l!==void 0&&tD(x,l,u,d,!1)}const WS=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"]),JS=t=>typeof t=="string"&&t.toLowerCase()==="svg";function sD(t,e,s,r){KS(t,e,void 0,r);for(const l in e.attrs)t.setAttribute(WS.has(l)?l:mp(l),e.attrs[l])}function QS(t,e,s){const r=Sp(t,e,s);for(const l in t)if(Xt(t[l])||Xt(e[l])){const u=vi.indexOf(l)!==-1?"attr"+l.charAt(0).toUpperCase()+l.substring(1):l;r[u]=t[l]}return r}class aD extends $S{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ot}getBaseTargetFromProps(e,s){return e[s]}readValueFromInstance(e,s){if(xi.has(s)){const r=RS(s);return r&&r.default||0}return s=WS.has(s)?s:mp(s),e.getAttribute(s)}scrapeMotionValuesFromProps(e,s,r){return QS(e,s,r)}build(e,s,r){XS(e,s,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,s,r,l){sD(e,s,r,l)}mount(e){this.isSVGTag=JS(e.tagName),super.mount(e)}}const rD=bp.length;function ZS(t){if(!t)return;if(!t.isControllingVariants){const s=t.parent?ZS(t.parent)||{}:{};return t.props.initial!==void 0&&(s.initial=t.props.initial),s}const e={};for(let s=0;s<rD;s++){const r=bp[s],l=t.props[r];(Yo(l)||l===!1)&&(e[r]=l)}return e}function ej(t,e){if(!Array.isArray(e))return!1;const s=e.length;if(s!==t.length)return!1;for(let r=0;r<s;r++)if(e[r]!==t[r])return!1;return!0}const iD=[...xp].reverse(),oD=xp.length;function lD(t){return e=>Promise.all(e.map(({animation:s,options:r})=>aM(t,s,r)))}function cD(t){let e=lD(t),s=cb(),r=!0;const l=m=>(g,y)=>{const x=ci(t,y,m==="exit"?t.presenceContext?.custom:void 0);if(x){const{transition:w,transitionEnd:S,...E}=x;g={...g,...E,...S}}return g};function u(m){e=m(t)}function d(m){const{props:g}=t,y=ZS(t.parent)||{},x=[],w=new Set;let S={},E=1/0;for(let _=0;_<oD;_++){const N=iD[_],k=s[N],C=g[N]!==void 0?g[N]:y[N],A=Yo(C),D=N===m?k.isActive:null;D===!1&&(E=_);let U=C===y[N]&&C!==g[N]&&A;if(U&&r&&t.manuallyAnimateOnMount&&(U=!1),k.protectedKeys={...S},!k.isActive&&D===null||!C&&!k.prevProp||Pu(C)||typeof C=="boolean")continue;if(N==="exit"&&k.isActive&&D!==!0){k.prevResolvedValues&&(S={...S,...k.prevResolvedValues});continue}const V=uD(k.prevProp,C);let R=V||N===m&&k.isActive&&!U&&A||_>E&&A,P=!1;const Z=Array.isArray(C)?C:[C];let te=Z.reduce(l(N),{});D===!1&&(te={});const{prevResolvedValues:me={}}=k,Ee={...me,...te},ye=Y=>{R=!0,w.has(Y)&&(P=!0,w.delete(Y)),k.needsAnimating[Y]=!0;const J=t.getValue(Y);J&&(J.liveStyle=!1)};for(const Y in Ee){const J=te[Y],pe=me[Y];if(S.hasOwnProperty(Y))continue;let se=!1;bm(J)&&bm(pe)?se=!ej(J,pe):se=J!==pe,se?J!=null?ye(Y):w.add(Y):J!==void 0&&w.has(Y)?ye(Y):k.protectedKeys[Y]=!0}k.prevProp=C,k.prevResolvedValues=te,k.isActive&&(S={...S,...te}),r&&t.blockInitialAnimation&&(R=!1);const _e=U&&V;R&&(!_e||P)&&x.push(...Z.map(Y=>{const J={type:N};if(typeof Y=="string"&&r&&!_e&&t.manuallyAnimateOnMount&&t.parent){const{parent:pe}=t,se=ci(pe,Y);if(pe.enteringChildren&&se){const{delayChildren:M}=se.transition||{};J.delay=SS(pe.enteringChildren,t,M)}}return{animation:Y,options:J}}))}if(w.size){const _={};if(typeof g.initial!="boolean"){const N=ci(t,Array.isArray(g.initial)?g.initial[0]:g.initial);N&&N.transition&&(_.transition=N.transition)}w.forEach(N=>{const k=t.getBaseTarget(N),C=t.getValue(N);C&&(C.liveStyle=!0),_[N]=k??null}),x.push({animation:_})}let j=!!x.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(j=!1),r=!1,j?e(x):Promise.resolve()}function f(m,g){if(s[m].isActive===g)return Promise.resolve();t.variantChildren?.forEach(x=>x.animationState?.setActive(m,g)),s[m].isActive=g;const y=d(m);for(const x in s)s[x].protectedKeys={};return y}return{animateChanges:d,setActive:f,setAnimateFunction:u,getState:()=>s,reset:()=>{s=cb()}}}function uD(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!ej(e,t):!1}function Ba(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function cb(){return{animate:Ba(!0),whileInView:Ba(),whileHover:Ba(),whileTap:Ba(),whileDrag:Ba(),whileFocus:Ba(),exit:Ba()}}function ub(t,e){t.min=e.min,t.max=e.max}function In(t,e){ub(t.x,e.x),ub(t.y,e.y)}function db(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const tj=1e-4,dD=1-tj,fD=1+tj,nj=.01,hD=0-nj,mD=0+nj;function Qt(t){return t.max-t.min}function pD(t,e,s){return Math.abs(t-e)<=s}function fb(t,e,s,r=.5){t.origin=r,t.originPoint=mt(e.min,e.max,t.origin),t.scale=Qt(s)/Qt(e),t.translate=mt(s.min,s.max,t.origin)-t.originPoint,(t.scale>=dD&&t.scale<=fD||isNaN(t.scale))&&(t.scale=1),(t.translate>=hD&&t.translate<=mD||isNaN(t.translate))&&(t.translate=0)}function Co(t,e,s,r){fb(t.x,e.x,s.x,r?r.originX:void 0),fb(t.y,e.y,s.y,r?r.originY:void 0)}function hb(t,e,s){t.min=s.min+e.min,t.max=t.min+Qt(e)}function gD(t,e,s){hb(t.x,e.x,s.x),hb(t.y,e.y,s.y)}function mb(t,e,s){t.min=e.min-s.min,t.max=t.min+Qt(e)}function wu(t,e,s){mb(t.x,e.x,s.x),mb(t.y,e.y,s.y)}function pb(t,e,s,r,l){return t-=e,t=bu(t,1/s,r),l!==void 0&&(t=bu(t,1/l,r)),t}function yD(t,e=0,s=1,r=.5,l,u=t,d=t){if(is.test(e)&&(e=parseFloat(e),e=mt(d.min,d.max,e/100)-d.min),typeof e!="number")return;let f=mt(u.min,u.max,r);t===u&&(f-=e),t.min=pb(t.min,e,s,f,l),t.max=pb(t.max,e,s,f,l)}function gb(t,e,[s,r,l],u,d){yD(t,e[s],e[r],e[l],e.scale,u,d)}const vD=["x","scaleX","originX"],xD=["y","scaleY","originY"];function yb(t,e,s,r){gb(t.x,e,vD,s?s.x:void 0,r?r.x:void 0),gb(t.y,e,xD,s?s.y:void 0,r?r.y:void 0)}function vb(t){return t.translate===0&&t.scale===1}function sj(t){return vb(t.x)&&vb(t.y)}function xb(t,e){return t.min===e.min&&t.max===e.max}function bD(t,e){return xb(t.x,e.x)&&xb(t.y,e.y)}function bb(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function aj(t,e){return bb(t.x,e.x)&&bb(t.y,e.y)}function wb(t){return Qt(t.x)/Qt(t.y)}function Sb(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function ts(t){return[t("x"),t("y")]}function wD(t,e,s){let r="";const l=t.x.translate/e.x,u=t.y.translate/e.y,d=s?.z||0;if((l||u||d)&&(r=`translate3d(${l}px, ${u}px, ${d}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),s){const{transformPerspective:g,rotate:y,rotateX:x,rotateY:w,skewX:S,skewY:E}=s;g&&(r=`perspective(${g}px) ${r}`),y&&(r+=`rotate(${y}deg) `),x&&(r+=`rotateX(${x}deg) `),w&&(r+=`rotateY(${w}deg) `),S&&(r+=`skewX(${S}deg) `),E&&(r+=`skewY(${E}deg) `)}const f=t.x.scale*e.x,m=t.y.scale*e.y;return(f!==1||m!==1)&&(r+=`scale(${f}, ${m})`),r||"none"}const rj=["TopLeft","TopRight","BottomLeft","BottomRight"],SD=rj.length,jb=t=>typeof t=="string"?parseFloat(t):t,_b=t=>typeof t=="number"||be.test(t);function jD(t,e,s,r,l,u){l?(t.opacity=mt(0,s.opacity??1,_D(r)),t.opacityExit=mt(e.opacity??1,0,ND(r))):u&&(t.opacity=mt(e.opacity??1,s.opacity??1,r));for(let d=0;d<SD;d++){const f=`border${rj[d]}Radius`;let m=Nb(e,f),g=Nb(s,f);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||_b(m)===_b(g)?(t[f]=Math.max(mt(jb(m),jb(g),r),0),(is.test(g)||is.test(m))&&(t[f]+="%")):t[f]=g}(e.rotate||s.rotate)&&(t.rotate=mt(e.rotate||0,s.rotate||0,r))}function Nb(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const _D=ij(0,.5,J1),ND=ij(.5,.95,Ln);function ij(t,e,s){return r=>r<t?0:r>e?1:s(Go(t,e,r))}function TD(t,e,s){const r=Xt(t)?t:mi(t);return r.start(fp("",r,e,s)),r.animation}function Xo(t,e,s,r={passive:!0}){return t.addEventListener(e,s,r),()=>t.removeEventListener(e,s)}const ED=(t,e)=>t.depth-e.depth;class kD{constructor(){this.children=[],this.isDirty=!1}add(e){Jm(this.children,e),this.isDirty=!0}remove(e){pu(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(ED),this.isDirty=!1,this.children.forEach(e)}}function CD(t,e){const s=Jt.now(),r=({timestamp:l})=>{const u=l-s;u>=e&&(ma(r),t(u-e))};return lt.setup(r,!0),()=>ma(r)}function tu(t){return Xt(t)?t.get():t}class AD{constructor(){this.members=[]}add(e){Jm(this.members,e);for(let s=this.members.length-1;s>=0;s--){const r=this.members[s];if(r===e||r===this.lead||r===this.prevLead)continue;const l=r.instance;l&&l.isConnected===!1&&r.isPresent!==!1&&!r.snapshot&&pu(this.members,r)}e.scheduleRender()}remove(e){if(pu(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(e){const s=this.members.findIndex(l=>e===l);if(s===0)return!1;let r;for(let l=s;l>=0;l--){const u=this.members[l],d=u.instance;if(u.isPresent!==!1&&(!d||d.isConnected!==!1)){r=u;break}}return r?(this.promote(r),!0):!1}promote(e,s){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender();const l=r.options.layoutDependency,u=e.options.layoutDependency;if(!(l!==void 0&&u!==void 0&&l===u)){const m=r.instance;m&&m.isConnected===!1&&!r.snapshot||(e.resumeFrom=r,s&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0))}const{crossfade:f}=e.options;f===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:s,resumingFrom:r}=e;s.onExitComplete&&s.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const nu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Rh=["","X","Y","Z"],RD=1e3;let OD=0;function Oh(t,e,s,r){const{latestValues:l}=e;l[t]&&(s[t]=l[t],e.setStaticValue(t,0),r&&(r[t]=0))}function oj(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const s=ES(e);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:l,layoutId:u}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",lt,!(l||u))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&oj(r)}function lj({attachResizeListener:t,defaultParent:e,measureScroll:s,checkIsScrollRoot:r,resetTransform:l}){return class{constructor(d={},f=e?.()){this.id=OD++,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.layoutVersion=0,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(PD),this.nodes.forEach(BD),this.nodes.forEach(VD),this.nodes.forEach(zD)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,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 m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new kD)}addEventListener(d,f){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new Zm),this.eventHandlers.get(d).add(f)}notifyListeners(d,...f){const m=this.eventHandlers.get(d);m&&m.notify(...f)}hasListeners(d){return this.eventHandlers.has(d)}mount(d){if(this.instance)return;this.isSVG=vp(d)&&!DM(d),this.instance=d;const{layoutId:f,layout:m,visualElement:g}=this.options;if(g&&!g.current&&g.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||f)&&(this.isLayoutDirty=!0),t){let y,x=0;const w=()=>this.root.updateBlockedByResize=!1;lt.read(()=>{x=window.innerWidth}),t(d,()=>{const S=window.innerWidth;S!==x&&(x=S,this.root.updateBlockedByResize=!0,y&&y(),y=CD(w,250),nu.hasAnimatedSinceResize&&(nu.hasAnimatedSinceResize=!1,this.nodes.forEach(kb)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&g&&(f||m)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:x,hasRelativeLayoutChanged:w,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const E=this.options.transition||g.getDefaultTransition()||GD,{onLayoutAnimationStart:j,onLayoutAnimationComplete:_}=g.getProps(),N=!this.targetLayout||!aj(this.targetLayout,S),k=!x&&w;if(this.options.layoutRoot||this.resumeFrom||k||x&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...dp(E,"layout"),onPlay:j,onComplete:_};(g.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(y,k)}else x||kb(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const d=this.getStack();d&&d.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ma(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ID),this.animationId++)}getTransformTemplate(){const{visualElement:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&oj(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const x=this.path[y];x.shouldResetTransform=!0,x.updateScroll("snapshot"),x.options.layoutRoot&&x.willUpdate(!1)}const{layoutId:f,layout:m}=this.options;if(f===void 0&&!m)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),d&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Tb);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Eb);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(UD),this.nodes.forEach(MD),this.nodes.forEach(DD)):this.nodes.forEach(Eb),this.clearAllSnapshots();const f=Jt.now();Ft.delta=ls(0,1e3/60,f-Ft.timestamp),Ft.timestamp=f,Ft.isProcessing=!0,jh.update.process(Ft),jh.preRender.process(Ft),jh.render.process(Ft),Ft.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,gp.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(LD),this.sharedNodes.forEach($D)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,lt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){lt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Qt(this.snapshot.measuredBox.x)&&!Qt(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 m=0;m<this.path.length;m++)this.path[m].updateScroll();const d=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Ot(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(f=!1),f&&this.instance){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:d,isRoot:m,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!l)return;const d=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!sj(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,y=g!==this.prevTransformTemplateValue;d&&this.instance&&(f||$a(this.latestValues)||y)&&(l(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const f=this.measurePageBox();let m=this.removeElementScroll(f);return d&&(m=this.removeTransform(m)),FD(m),{animationId:this.root.animationId,measuredBox:f,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:d}=this.options;if(!d)return Ot();const f=d.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(KD))){const{scroll:g}=this.root;g&&(ri(f.x,g.offset.x),ri(f.y,g.offset.y))}return f}removeElementScroll(d){const f=Ot();if(In(f,d),this.scroll?.wasRoot)return f;for(let m=0;m<this.path.length;m++){const g=this.path[m],{scroll:y,options:x}=g;g!==this.root&&y&&x.layoutScroll&&(y.wasRoot&&In(f,d),ri(f.x,y.offset.x),ri(f.y,y.offset.y))}return f}applyTransform(d,f=!1){const m=Ot();In(m,d);for(let g=0;g<this.path.length;g++){const y=this.path[g];!f&&y.options.layoutScroll&&y.scroll&&y!==y.root&&ii(m,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),$a(y.latestValues)&&ii(m,y.latestValues)}return $a(this.latestValues)&&ii(m,this.latestValues),m}removeTransform(d){const f=Ot();In(f,d);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!$a(g.latestValues))continue;Em(g.latestValues)&&g.updateSnapshot();const y=Ot(),x=g.measurePageBox();In(y,x),yb(f,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,y)}return $a(this.latestValues)&&yb(f,this.latestValues),f}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ft.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!1){const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==f;if(!(d||m&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:x}=this.options;if(!this.layout||!(y||x))return;this.resolvedRelativeTargetAt=Ft.timestamp;const w=this.getClosestProjectingParent();w&&this.linkedParentVersion!==w.layoutVersion&&!w.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(w&&w.layout?this.createRelativeTarget(w,this.layout.layoutBox,w.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ot(),this.targetWithTransforms=Ot()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),gD(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):In(this.target,this.layout.layoutBox),GS(this.target,this.targetDelta)):In(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,w&&!!w.resumingFrom==!!this.resumingFrom&&!w.options.layoutScroll&&w.target&&this.animationProgress!==1?this.createRelativeTarget(w,this.target,w.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Em(this.parent.latestValues)||HS(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(d,f,m){this.relativeParent=d,this.linkedParentVersion=d.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ot(),this.relativeTargetOrigin=Ot(),wu(this.relativeTargetOrigin,f,m),In(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const d=this.getLead(),f=!!this.resumingFrom||this!==d;let m=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(m=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===Ft.timestamp&&(m=!1),m)return;const{layout:g,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(g||y))return;In(this.layoutCorrected,this.layout.layoutBox);const x=this.treeScale.x,w=this.treeScale.y;GM(this.layoutCorrected,this.treeScale,this.path,f),d.layout&&!d.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(d.target=d.layout.layoutBox,d.targetWithTransforms=Ot());const{target:S}=d;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(db(this.prevProjectionDelta.x,this.projectionDelta.x),db(this.prevProjectionDelta.y,this.projectionDelta.y)),Co(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==x||this.treeScale.y!==w||!Sb(this.projectionDelta.x,this.prevProjectionDelta.x)||!Sb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){if(this.options.visualElement?.scheduleRender(),d){const f=this.getStack();f&&f.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ai(),this.projectionDelta=ai(),this.projectionDeltaWithTransform=ai()}setAnimationOrigin(d,f=!1){const m=this.snapshot,g=m?m.latestValues:{},y={...this.latestValues},x=ai();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const w=Ot(),S=m?m.source:void 0,E=this.layout?this.layout.source:void 0,j=S!==E,_=this.getStack(),N=!_||_.members.length<=1,k=!!(j&&!N&&this.options.crossfade===!0&&!this.path.some(HD));this.animationProgress=0;let C;this.mixTargetDelta=A=>{const D=A/1e3;Cb(x.x,d.x,D),Cb(x.y,d.y,D),this.setTargetDelta(x),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(wu(w,this.layout.layoutBox,this.relativeParent.layout.layoutBox),qD(this.relativeTarget,this.relativeTargetOrigin,w,D),C&&bD(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=Ot()),In(C,this.relativeTarget)),j&&(this.animationValues=y,jD(y,g,this.latestValues,D,k,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=D},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ma(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=lt.update(()=>{nu.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=mi(0)),this.motionValue.jump(0,!1),this.currentAnimation=TD(this.motionValue,[0,1e3],{...d,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),d.onUpdate&&d.onUpdate(f)},onStop:()=>{},onComplete:()=>{d.onComplete&&d.onComplete(),this.completeAnimation()}}),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 d=this.getStack();d&&d.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(RD),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:f,target:m,layout:g,latestValues:y}=d;if(!(!f||!m||!g)){if(this!==d&&this.layout&&g&&cj(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||Ot();const x=Qt(this.layout.layoutBox.x);m.x.min=d.target.x.min,m.x.max=m.x.min+x;const w=Qt(this.layout.layoutBox.y);m.y.min=d.target.y.min,m.y.max=m.y.min+w}In(f,m),ii(f,y),Co(this.projectionDeltaWithTransform,this.layoutCorrected,f,y)}}registerSharedNode(d,f){this.sharedNodes.has(d)||this.sharedNodes.set(d,new AD),this.sharedNodes.get(d).add(f);const g=f.options.initialPromotionConfig;f.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(f):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){const{layoutId:d}=this.options;return d?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:d}=this.options;return d?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:f,preserveFollowOpacity:m}={}){const g=this.getStack();g&&g.promote(this,m),d&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let f=!1;const{latestValues:m}=d;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(f=!0),!f)return;const g={};m.z&&Oh("z",d,g,this.animationValues);for(let y=0;y<Rh.length;y++)Oh(`rotate${Rh[y]}`,d,g,this.animationValues),Oh(`skew${Rh[y]}`,d,g,this.animationValues);d.render();for(const y in g)d.setStaticValue(y,g[y]),this.animationValues&&(this.animationValues[y]=g[y]);d.scheduleRender()}applyProjectionStyles(d,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){d.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,d.visibility="",d.opacity="",d.pointerEvents=tu(f?.pointerEvents)||"",d.transform=m?m(this.latestValues,""):"none";return}const g=this.getLead();if(!this.projectionDelta||!this.layout||!g.target){this.options.layoutId&&(d.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,d.pointerEvents=tu(f?.pointerEvents)||""),this.hasProjected&&!$a(this.latestValues)&&(d.transform=m?m({},""):"none",this.hasProjected=!1);return}d.visibility="";const y=g.animationValues||g.latestValues;this.applyTransformsToTarget();let x=wD(this.projectionDeltaWithTransform,this.treeScale,y);m&&(x=m(y,x)),d.transform=x;const{x:w,y:S}=this.projectionDelta;d.transformOrigin=`${w.origin*100}% ${S.origin*100}% 0`,g.animationValues?d.opacity=g===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:d.opacity=g===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const E in Cm){if(y[E]===void 0)continue;const{correct:j,applyTo:_,isCSSVariable:N}=Cm[E],k=x==="none"?y[E]:j(y[E],g);if(_){const C=_.length;for(let A=0;A<C;A++)d[_[A]]=k}else N?this.options.visualElement.renderState.vars[E]=k:d[E]=k}this.options.layoutId&&(d.pointerEvents=g===this?tu(f?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>d.currentAnimation?.stop()),this.root.nodes.forEach(Tb),this.root.sharedNodes.clear()}}}function MD(t){t.updateLayout()}function DD(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=t.layout,{animationType:l}=t.options,u=e.source!==t.layout.source;l==="size"?ts(y=>{const x=u?e.measuredBox[y]:e.layoutBox[y],w=Qt(x);x.min=s[y].min,x.max=x.min+w}):cj(l,e.layoutBox,s)&&ts(y=>{const x=u?e.measuredBox[y]:e.layoutBox[y],w=Qt(s[y]);x.max=x.min+w,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+w)});const d=ai();Co(d,s,e.layoutBox);const f=ai();u?Co(f,t.applyTransform(r,!0),e.measuredBox):Co(f,s,e.layoutBox);const m=!sj(d);let g=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:x,layout:w}=y;if(x&&w){const S=Ot();wu(S,e.layoutBox,x.layoutBox);const E=Ot();wu(E,s,w.layoutBox),aj(S,E)||(g=!0),y.options.layoutRoot&&(t.relativeTarget=E,t.relativeTargetOrigin=S,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:e,delta:f,layoutDelta:d,hasLayoutChanged:m,hasRelativeLayoutChanged:g})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function PD(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function zD(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function LD(t){t.clearSnapshot()}function Tb(t){t.clearMeasurements()}function Eb(t){t.isLayoutDirty=!1}function UD(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function kb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function BD(t){t.resolveTargetDelta()}function VD(t){t.calcProjection()}function ID(t){t.resetSkewAndRotation()}function $D(t){t.removeLeadSnapshot()}function Cb(t,e,s){t.translate=mt(e.translate,0,s),t.scale=mt(e.scale,1,s),t.origin=e.origin,t.originPoint=e.originPoint}function Ab(t,e,s,r){t.min=mt(e.min,s.min,r),t.max=mt(e.max,s.max,r)}function qD(t,e,s,r){Ab(t.x,e.x,s.x,r),Ab(t.y,e.y,s.y,r)}function HD(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const GD={duration:.45,ease:[.4,0,.1,1]},Rb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Ob=Rb("applewebkit/")&&!Rb("chrome/")?Math.round:Ln;function Mb(t){t.min=Ob(t.min),t.max=Ob(t.max)}function FD(t){Mb(t.x),Mb(t.y)}function cj(t,e,s){return t==="position"||t==="preserve-aspect"&&!pD(wb(e),wb(s),.2)}function KD(t){return t!==t.root&&t.scroll?.wasRoot}const YD=lj({attachResizeListener:(t,e)=>Xo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Mh={current:void 0},uj=lj({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Mh.current){const t=new YD({});t.mount(window),t.setOptions({layoutScroll:!0}),Mh.current=t}return Mh.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),jp=v.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Db(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function XD(...t){return e=>{let s=!1;const r=t.map(l=>{const u=Db(l,e);return!s&&typeof u=="function"&&(s=!0),u});if(s)return()=>{for(let l=0;l<r.length;l++){const u=r[l];typeof u=="function"?u():Db(t[l],null)}}}}function WD(...t){return v.useCallback(XD(...t),t)}class JD extends v.Component{getSnapshotBeforeUpdate(e){const s=this.props.childRef.current;if(s&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=s.offsetParent,l=Nm(r)&&r.offsetWidth||0,u=Nm(r)&&r.offsetHeight||0,d=this.props.sizeRef.current;d.height=s.offsetHeight||0,d.width=s.offsetWidth||0,d.top=s.offsetTop,d.left=s.offsetLeft,d.right=l-d.width-d.left,d.bottom=u-d.height-d.top}return null}componentDidUpdate(){}render(){return this.props.children}}function QD({children:t,isPresent:e,anchorX:s,anchorY:r,root:l,pop:u}){const d=v.useId(),f=v.useRef(null),m=v.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:g}=v.useContext(jp),y=t.props?.ref??t?.ref,x=WD(f,y);return v.useInsertionEffect(()=>{const{width:w,height:S,top:E,left:j,right:_,bottom:N}=m.current;if(e||u===!1||!f.current||!w||!S)return;const k=s==="left"?`left: ${j}`:`right: ${_}`,C=r==="bottom"?`bottom: ${N}`:`top: ${E}`;f.current.dataset.motionPopId=d;const A=document.createElement("style");g&&(A.nonce=g);const D=l??document.head;return D.appendChild(A),A.sheet&&A.sheet.insertRule(`
|
|
97
97
|
[data-motion-pop-id="${d}"] {
|
|
98
98
|
position: absolute !important;
|
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>Folio</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-COmZGXRg.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-DzN8-j-e.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|