From 1c488fdbe48453487a85f42dbf1c79d1e88eb494 Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Thu, 30 May 2024 02:08:11 +0800 Subject: [PATCH 01/13] add send to trash package to delete file to trash instead of perm deletion --- __init__.py | 22 ++++++---------------- requirements.txt | 1 + service/twoway_sync_folder_service.py | 3 ++- 3 files changed, 9 insertions(+), 17 deletions(-) create mode 100644 requirements.txt diff --git a/__init__.py b/__init__.py index 87f7473..e66c866 100644 --- a/__init__.py +++ b/__init__.py @@ -5,17 +5,15 @@ import folder_paths import shutil import os import sys -import subprocess # don't remove this -from urllib.parse import urlparse +import subprocess import subprocess import os import json -from .service.model_manager.model_installer import download_url_with_wget -from .service.model_manager.model_list import get_model_list from .service.media_service import * from .service.file_sync_service import * from .service.db_service import get_my_workflows_dir from .service.node_service import * +from send2trash import send2trash WEB_DIRECTORY = "entry" NODE_CLASS_MAPPINGS = {} @@ -112,31 +110,23 @@ async def update_file(request): await asyncio.to_thread(write_json_to_file, json_str) return web.Response(text="File updated successfully") - @server.PromptServer.instance.routes.post("/workspace/delete_file") async def delete_file(request): data = await request.json() file_path = data['file_path'] - delete_empty_folder = data['deleteEmptyFolder'] - def sync_delete_file(file_path, delete_empty_folder): + def sync_delete_file(file_path): my_workflows_dir = get_my_workflows_dir() full_path = os.path.join(my_workflows_dir, file_path) if os.path.exists(full_path): - os.remove(full_path) - directory = os.path.dirname(full_path) - if delete_empty_folder and not os.listdir(directory): - # If the directory is empty, remove the directory - os.rmdir(directory) - return "File and empty directory deleted successfully" - else: - return "File deleted successfully" + send2trash(full_path) + "File deleted successfully" else: return "File not found" # Run the synchronous file operation in a separate thread - response_text = await asyncio.to_thread(sync_delete_file, file_path, delete_empty_folder) + response_text = await asyncio.to_thread(sync_delete_file, file_path) if response_text == "File not found": return web.Response(text=response_text, status=404) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..cdb6763 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +send2trash diff --git a/service/twoway_sync_folder_service.py b/service/twoway_sync_folder_service.py index efdc7d0..e6b539c 100644 --- a/service/twoway_sync_folder_service.py +++ b/service/twoway_sync_folder_service.py @@ -3,6 +3,7 @@ import shutil from aiohttp import web import os from pathlib import Path +from send2trash import send2trash import server from .db_service import get_my_workflows_dir @@ -31,7 +32,7 @@ def delete_folder_sync(reqJson): folder_path = reqJson.get('path') folder_path = os.path.join(get_my_workflows_dir(), folder_path) try: - shutil.rmtree(folder_path) + send2trash(folder_path) return {"success": True} except Exception as e: return {"success": False, "error": str(e)} From 5343172070bd9b7f67a1313aa640252bf85c363b Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Thu, 30 May 2024 02:28:06 +0800 Subject: [PATCH 02/13] fix savelock not working on page refresh --- ui/src/App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/App.tsx b/ui/src/App.tsx index a98dc5d..da532a3 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -157,7 +157,7 @@ export default function App() { if (id) { const flow = await workflowsTable?.get(id); flow && setCurFlowIDAndName(flow); - if (flow && flow.json != latestWf) { + if (!flow?.saveLock && flow && flow.json != latestWf) { setIsDirty(true); } } From 727f55d843e044f7636e582a46393a05bd1fe7ee Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Thu, 30 May 2024 18:33:08 +0800 Subject: [PATCH 03/13] add try catch when scan from workflow folder, remove saving workflowJSON col to media table --- ui/src/db-tables/ChangelogsTable.ts | 3 +-- ui/src/db-tables/MediaTable.ts | 10 ---------- ui/src/types/dbTypes.ts | 3 --- ui/src/utils/twowaySyncUtils.ts | 10 ++++++++-- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/ui/src/db-tables/ChangelogsTable.ts b/ui/src/db-tables/ChangelogsTable.ts index 36b3b19..47dca19 100644 --- a/ui/src/db-tables/ChangelogsTable.ts +++ b/ui/src/db-tables/ChangelogsTable.ts @@ -44,9 +44,8 @@ export class ChangelogsTable extends TableBase { createTime: Date.now(), isAutoSave: input.isAutoSave, }; - await this.deleteLogsExceedLimit(input.workflowID); await indexdb.changelogs.add(change); - // this.saveDiskDB(); // its not that important to save to disk for changelog table + await this.deleteLogsExceedLimit(input.workflowID); return change; } async deleteLogsExceedLimit(workflowID: string) { diff --git a/ui/src/db-tables/MediaTable.ts b/ui/src/db-tables/MediaTable.ts index fd132e8..6ca05ef 100644 --- a/ui/src/db-tables/MediaTable.ts +++ b/ui/src/db-tables/MediaTable.ts @@ -2,7 +2,6 @@ import { Table, workflowsTable } from "./WorkspaceDB"; import { TableBase } from "./TableBase"; import { Media } from "../types/dbTypes"; import { indexdb } from "./indexdb"; -import { getMetadataFromUrl } from "../gallery/utils.ts"; export class MediaTable extends TableBase { static readonly TABLE_NAME: Table = "media"; @@ -25,20 +24,11 @@ export class MediaTable extends TableBase { const format = input.localPath.split(".").pop(); if (format == null) return null; - const res = await getMetadataFromUrl( - `/workspace/view_media?filename=${input.localPath}`, - ).catch((e) => { - console.error("get meta error:", e); - return { prompt: "" }; - }); - const md: Media = { id: input.localPath, localPath: input.localPath, workflowID: input.workflowID, createTime: Date.now(), - workflowJSON: JSON.stringify(res?.prompt), - format: format, }; await workflowsTable?.updateMetaInfo(input.workflowID, { latestImage: md.localPath, diff --git a/ui/src/types/dbTypes.ts b/ui/src/types/dbTypes.ts index a09abbe..6a00160 100644 --- a/ui/src/types/dbTypes.ts +++ b/ui/src/types/dbTypes.ts @@ -10,10 +10,8 @@ export interface SortableItem { export interface Workflow extends SortableItem { id: string; json: string; - lastSavedJson?: string; // TODO will be deprecated name: string; createTime: number; - filePath?: string; // TODO will be deprecated privacy?: WorkflowPrivacy; tags?: string[]; parentFolderID?: string | null; //TODO remove undefined, use null only @@ -131,7 +129,6 @@ export type Media = { workflowJSON?: string; createTime: number; localPath: string; - format: string; }; /** diff --git a/ui/src/utils/twowaySyncUtils.ts b/ui/src/utils/twowaySyncUtils.ts index 7688abe..2f67b02 100644 --- a/ui/src/utils/twowaySyncUtils.ts +++ b/ui/src/utils/twowaySyncUtils.ts @@ -4,7 +4,7 @@ import { ScanLocalFolder, scanLocalFiles, } from "../apis/TwowaySyncApi"; -import { isFolder, userSettingsTable } from "../db-tables/WorkspaceDB"; +import { isFolder } from "../db-tables/WorkspaceDB"; import { indexdb } from "../db-tables/indexdb"; import { Folder, Workflow } from "../types/dbTypes"; import { sortFileItem } from "../utils"; @@ -34,7 +34,13 @@ export async function scanMyWorkflowsDir( return folder; } else { // is workflow - const existingWorkflow = (await indexdb.workflows?.get(file.id)) ?? { + + const existingWorkflow = (await indexdb.workflows + ?.get(file.id) + .catch((err) => { + console.error("Error getting workflow from indexdb", err); + return null; + })) ?? { createTime: Date.now(), updateTime: Date.now(), }; From f7652cbcbed7e6acf3f7d5e526760dae42259b3a Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Thu, 30 May 2024 18:43:09 +0800 Subject: [PATCH 04/13] remove legacy non-twoway-sync mode disk file manipulations --- ui/src/db-tables/DiskFileUtils.ts | 93 ------------------------------ ui/src/db-tables/WorkflowsTable.ts | 23 -------- 2 files changed, 116 deletions(-) diff --git a/ui/src/db-tables/DiskFileUtils.ts b/ui/src/db-tables/DiskFileUtils.ts index fefac3f..9f80ff3 100644 --- a/ui/src/db-tables/DiskFileUtils.ts +++ b/ui/src/db-tables/DiskFileUtils.ts @@ -1,59 +1,6 @@ -import { deleteFile, updateFile } from "../Api"; import { foldersTable, workflowsTable, userSettingsTable } from "./WorkspaceDB"; -import { - COMFYSPACE_TRACKING_FIELD_NAME, - LEGACY_COMFYSPACE_TRACKING_FIELD_NAME, -} from "../const"; -import { toFileNameFriendly } from "../utils"; -import { Folder, Workflow } from "../types/dbTypes"; import { TwowayFolderSyncAPI } from "../apis/TwowaySyncFolderApi"; -export async function saveJsonFileMyWorkflows(workflow: Workflow) { - const file_path = await generateFilePath(workflow); - if (file_path == null) { - return; - } - const fullPath = await generateFilePathAbsolute(workflow); - await workflowsTable?.updateMetaInfo(workflow.id, { - filePath: fullPath ?? undefined, - }); - const json = workflow.json; - const flow = JSON.parse(json); - flow.extra[COMFYSPACE_TRACKING_FIELD_NAME] = { - id: workflow.id, - name: workflow.name, - }; - delete flow.extra[LEGACY_COMFYSPACE_TRACKING_FIELD_NAME]; - - await updateFile(file_path, JSON.stringify(flow)); -} - -export async function deleteJsonFileMyWorkflows(workflow: Workflow) { - if (workflow.name == null) { - return; - } - const file_path = await generateFilePath(workflow); - file_path != null && deleteFile(file_path); -} - -export async function generateFilePath( - workflow: Workflow, -): Promise { - let filePath = toFileNameFriendly(workflow.name) + ".json"; - let curFolderID = workflow.parentFolderID; - while (curFolderID != null) { - const folder = await foldersTable?.get(curFolderID); - if (folder == null) { - break; - } - const folderName = folder.name; - filePath = `${folderName}/${filePath}`; - curFolderID = folder.parentFolderID ?? undefined; - } - - return filePath ?? null; -} - export async function genFolderRelPath( folderId: string | null, ): Promise { @@ -71,46 +18,6 @@ export async function genFolderRelPath( return filePath; } -export async function generateFilePathAbsolute( - workflow: Workflow, -): Promise { - const subPath = await generateFilePath(workflow); - let myWorkflowsDir = await userSettingsTable?.getSetting("myWorkflowsDir"); - if (!myWorkflowsDir) { - console.error("myWorkflowsDir is not set"); - return null; - } - if (!myWorkflowsDir.endsWith("/")) { - myWorkflowsDir = myWorkflowsDir + "/"; - } - return myWorkflowsDir + subPath; -} - -export async function generateFolderPath(id: string): Promise { - const folder = await foldersTable?.get(id); - let parentFolderID = folder?.parentFolderID; - let folderPath = folder?.name; - while (parentFolderID) { - const folder = await foldersTable?.get(parentFolderID); - if (folder == null) { - break; - } - folderPath = `${folder.name}/${folderPath}`; - parentFolderID = folder.parentFolderID ?? undefined; - } - - let myWorkflowsDir = await userSettingsTable?.getSetting("myWorkflowsDir"); - - if (!myWorkflowsDir) { - console.error("myWorkflowsDir is not set"); - return null; - } - - if (!myWorkflowsDir.endsWith("/")) { - myWorkflowsDir = myWorkflowsDir + "/"; - } - return myWorkflowsDir + folderPath; -} export async function getFileCountInFolder(folderId: string): Promise { const twoWaySyncEnabled = await userSettingsTable?.getSetting("twoWaySync"); diff --git a/ui/src/db-tables/WorkflowsTable.ts b/ui/src/db-tables/WorkflowsTable.ts index f2a71be..8101c60 100644 --- a/ui/src/db-tables/WorkflowsTable.ts +++ b/ui/src/db-tables/WorkflowsTable.ts @@ -8,10 +8,6 @@ import { sortFileItem } from "../utils"; import { nanoid } from "nanoid"; import { TableBase } from "./TableBase"; import { indexdb } from "./indexdb"; -import { - deleteJsonFileMyWorkflows, - saveJsonFileMyWorkflows, -} from "./DiskFileUtils"; import { ESortTypes, ImportWorkflow } from "../RecentFilesDrawer/types"; import { defaultGraph } from "../defaultGraph"; import { scanMyWorkflowsDir } from "../utils/twowaySyncUtils"; @@ -146,8 +142,6 @@ export class WorkflowsTable extends TableBase { if (twoWaySyncEnabled) { await TwowaySyncAPI.createWorkflow(newWorkflow); return await this.get(newWorkflow.id); - } else { - saveJsonFileMyWorkflows(newWorkflow); } return newWorkflow; } @@ -197,15 +191,6 @@ export class WorkflowsTable extends TableBase { } if (twoWaySyncEnabled) { await TwowaySyncAPI.moveWorkflow(oldWorkflow, change.parentFolderID!); - } else { - await saveJsonFileMyWorkflows(newWorkflow); - await deleteJsonFileMyWorkflows(oldWorkflow); - // update parent folder updateTime - if (newWorkflow?.parentFolderID != null) { - await indexdb.folders?.update(newWorkflow.parentFolderID, { - updateTime: Date.now(), - }); - } } } public async genLastManualSavedJson(id: string) { @@ -240,8 +225,6 @@ export class WorkflowsTable extends TableBase { const twoWaySyncEnabled = await userSettingsTable?.getSetting("twoWaySync"); if (twoWaySyncEnabled) { after && (await TwowaySyncAPI.saveWorkflow(after)); - } else { - after && (await saveJsonFileMyWorkflows(after)); } } @@ -294,8 +277,6 @@ export class WorkflowsTable extends TableBase { } catch (e) { console.error("batchCreateFlows error", e); } - } else { - await saveJsonFileMyWorkflows(newWorkflow); } } try { @@ -314,8 +295,6 @@ export class WorkflowsTable extends TableBase { await userSettingsTable?.getSetting("twoWaySync"); if (twoWaySyncEnabled) { await TwowaySyncAPI.deleteWorkflow(workflow); - } else { - deleteJsonFileMyWorkflows({ ...workflow }); } } //add to IndexDB @@ -331,8 +310,6 @@ export class WorkflowsTable extends TableBase { await userSettingsTable?.getSetting("twoWaySync"); if (twoWaySyncEnabled) { await TwowaySyncAPI.deleteWorkflow(flow); - } else { - deleteJsonFileMyWorkflows({ ...flow }); } } await indexdb.workflows.bulkDelete(ids); From 4fcf3dc0531450666ae7729261002cf98b2a31da Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Sun, 2 Jun 2024 20:44:51 +0800 Subject: [PATCH 05/13] fix --- ui/src/db-tables/WorkflowsTable.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ui/src/db-tables/WorkflowsTable.ts b/ui/src/db-tables/WorkflowsTable.ts index 8101c60..d9887d5 100644 --- a/ui/src/db-tables/WorkflowsTable.ts +++ b/ui/src/db-tables/WorkflowsTable.ts @@ -47,11 +47,7 @@ export class WorkflowsTable extends TableBase { } /** - * Check whether the currently opened workflow is the latest version and is consistent with the DB. - * Through updateTime comparison, if it is inconsistent, it means that a newer version already exists in the DB. - * If the automatic save function is turned on at this time, the latest version in the DB will be overwritten. - * Therefore, the user needs to confirm whether to continue to enable automatic saving. - * @returns boolean + * Check whether the currently opened workflow is the latest version and is consistent with the DB */ public async latestVersionCheck() { if (this._curWorkflow) { From 7228169ee7c04bad2cd76c719a435e0bee3a0833 Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Tue, 4 Jun 2024 22:39:27 +0800 Subject: [PATCH 06/13] fix version name not updating --- ui/src/components/EditFlowName.tsx | 2 +- ui/src/share/ShareDialog.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/src/components/EditFlowName.tsx b/ui/src/components/EditFlowName.tsx index 52a003e..7173b43 100644 --- a/ui/src/components/EditFlowName.tsx +++ b/ui/src/components/EditFlowName.tsx @@ -81,7 +81,7 @@ export default function EditFlowName({ as="div" color="white" onClick={startEdit} - maxW={200} + maxW={160} fontWeight={500} whiteSpace="nowrap" overflow="hidden" diff --git a/ui/src/share/ShareDialog.tsx b/ui/src/share/ShareDialog.tsx index b01f6d2..029e292 100644 --- a/ui/src/share/ShareDialog.tsx +++ b/ui/src/share/ShareDialog.tsx @@ -47,7 +47,9 @@ interface Props { } export default function ShareDialog({ onClose }: Props) { - const [versionName, setVersionName] = useState("v" + getCurDateString()); + const [versionName, setVersionName, versionNameRef] = useStateRef( + "v" + getCurDateString(), + ); const [localVersions, setLocalVersions] = useState([]); const [loading, setLoading] = useState(false); const cloudHost = userSettingsTable?.settings?.cloudHost; @@ -159,7 +161,7 @@ export default function ShareDialog({ onClose }: Props) { if (selectedVersion === "new_version") { version = await workflowVersionsTable?.add({ workflowID: workflow!.id, - name: versionName, + name: versionNameRef.current, createTime: Date.now(), json: jsonToShare ?? JSON.stringify(app.graph.serialize()), }); From f97450465d84f67a1d9145104fee6585ac38957f Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Wed, 5 Jun 2024 19:23:37 +0800 Subject: [PATCH 07/13] cleanup share and deps form logic, add models deps automatically --- dist/workspace_web/App-1AImvRpr.js | 27 + .../AppIsDirtyEventListener-xmtnIvLQ.js | 1 + dist/workspace_web/GalleryModal-XNUSEfqI.js | 1 + dist/workspace_web/IconCopy-DxyTNBlz.js | 1 + dist/workspace_web/IconSearch-qxAzDzhT.js | 1 + dist/workspace_web/MediaPreview-muJLkZRm.js | 1 + .../ModelManagerTopbar-4hMR9SRa.js | 1 + .../RecentFilesDrawer-g7Y8NeOQ.js | 5 + dist/workspace_web/ShareDialog-t7mRPVSb.js | 1 + .../workspace_web/SpotlightSearch-crj3ER75.js | 1 + dist/workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js | 1 + dist/workspace_web/chunk-7D6N5TE5-fihyubSX.js | 1 + dist/workspace_web/chunk-JARCRF6W-UyOcndjS.js | 1 + dist/workspace_web/chunk-NTCQBYKE-HH_ifqNx.js | 1 + dist/workspace_web/chunk-VTV6N5LE-7BSZDdqw.js | 1 + dist/workspace_web/civitUtils-uJNBxoFV.js | 1 + dist/workspace_web/input.js | 688 ++++++++++++++++++ ui/src/components/DropdownTitle.tsx | 9 - .../MissingModelItem.tsx | 10 +- .../MissingModelsListDrawer.tsx | 6 +- .../topbar/ModelManagerTopbar.tsx | 9 - ui/src/share/ShareDialog.tsx | 145 ++-- ui/src/spacejson/DownloadSpaceJsonDialog.tsx | 54 -- ui/src/spacejson/ResourceDepsForm.tsx | 362 ++------- ui/src/spacejson/handleDownloadSpaceJson.ts | 48 +- 25 files changed, 880 insertions(+), 497 deletions(-) create mode 100644 dist/workspace_web/App-1AImvRpr.js create mode 100644 dist/workspace_web/AppIsDirtyEventListener-xmtnIvLQ.js create mode 100644 dist/workspace_web/GalleryModal-XNUSEfqI.js create mode 100644 dist/workspace_web/IconCopy-DxyTNBlz.js create mode 100644 dist/workspace_web/IconSearch-qxAzDzhT.js create mode 100644 dist/workspace_web/MediaPreview-muJLkZRm.js create mode 100644 dist/workspace_web/ModelManagerTopbar-4hMR9SRa.js create mode 100644 dist/workspace_web/RecentFilesDrawer-g7Y8NeOQ.js create mode 100644 dist/workspace_web/ShareDialog-t7mRPVSb.js create mode 100644 dist/workspace_web/SpotlightSearch-crj3ER75.js create mode 100644 dist/workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js create mode 100644 dist/workspace_web/chunk-7D6N5TE5-fihyubSX.js create mode 100644 dist/workspace_web/chunk-JARCRF6W-UyOcndjS.js create mode 100644 dist/workspace_web/chunk-NTCQBYKE-HH_ifqNx.js create mode 100644 dist/workspace_web/chunk-VTV6N5LE-7BSZDdqw.js create mode 100644 dist/workspace_web/civitUtils-uJNBxoFV.js create mode 100644 dist/workspace_web/input.js delete mode 100644 ui/src/spacejson/DownloadSpaceJsonDialog.tsx diff --git a/dist/workspace_web/App-1AImvRpr.js b/dist/workspace_web/App-1AImvRpr.js new file mode 100644 index 0000000..aaebc13 --- /dev/null +++ b/dist/workspace_web/App-1AImvRpr.js @@ -0,0 +1,27 @@ +var fl=Object.defineProperty;var hl=(t,e,n)=>e in t?fl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Se=(t,e,n)=>(hl(t,typeof e!="symbol"?e+"":e,n),n);import{u as pl,a as ml,r as j,c as yl,b as et,m as Te,d as Bt,f as fe,e as ke,j as O,B as vl,g as de,h as Le,i as gl,o as tt,k as jt,l as ot,I as Ur,n as Kr,p as no,q as Oe,s as xa,t as wl,v as bl,w as _l,x as $r,y as kl,z as xl,A as El,C as Cl,D as Sl,E as ss,F as Ea,G as as,H as Ca,J as Ol,K as Il,L as Dl,P as Sa,_ as At,M as is,N as ls,O as cs,Q as us,R as ds,S as fs,T as hs,U as Oa,V as Ia,W as Xn,X as Da}from"./input.js";function Pl(t){return t!=null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function Pa(t){var e;return Pl(t)&&(e=t.ownerDocument)!=null?e:document}function jl(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Al=jl();function Nl(t){const e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function ja(t){const{theme:e}=pl(),n=ml();return j.useMemo(()=>yl(e.direction,{...n,...t}),[t,e.direction,n])}var Fl=Object.defineProperty,Rl=(t,e,n)=>e in t?Fl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,De=(t,e,n)=>(Rl(t,typeof e!="symbol"?e+"":e,n),n);function qs(t){return t.sort((e,n)=>{const r=e.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var Tl=t=>typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE;function Hs(t,e,n){let r=t+1;return n&&r>=e&&(r=0),r}function Vs(t,e,n){let r=t-1;return n&&r<0&&(r=e),r}var wo=typeof window<"u"?j.useLayoutEffect:j.useEffect,kr=t=>t,Bl=class{constructor(){De(this,"descendants",new Map),De(this,"register",t=>{if(t!=null)return Tl(t)?this.registerNode(t):e=>{this.registerNode(e,t)}}),De(this,"unregister",t=>{this.descendants.delete(t);const e=qs(Array.from(this.descendants.keys()));this.assignIndex(e)}),De(this,"destroy",()=>{this.descendants.clear()}),De(this,"assignIndex",t=>{this.descendants.forEach(e=>{const n=t.indexOf(e.node);e.index=n,e.node.dataset.index=e.index.toString()})}),De(this,"count",()=>this.descendants.size),De(this,"enabledCount",()=>this.enabledValues().length),De(this,"values",()=>Array.from(this.descendants.values()).sort((e,n)=>e.index-n.index)),De(this,"enabledValues",()=>this.values().filter(t=>!t.disabled)),De(this,"item",t=>{if(this.count()!==0)return this.values()[t]}),De(this,"enabledItem",t=>{if(this.enabledCount()!==0)return this.enabledValues()[t]}),De(this,"first",()=>this.item(0)),De(this,"firstEnabled",()=>this.enabledItem(0)),De(this,"last",()=>this.item(this.descendants.size-1)),De(this,"lastEnabled",()=>{const t=this.enabledValues().length-1;return this.enabledItem(t)}),De(this,"indexOf",t=>{var e,n;return t&&(n=(e=this.descendants.get(t))==null?void 0:e.index)!=null?n:-1}),De(this,"enabledIndexOf",t=>t==null?-1:this.enabledValues().findIndex(e=>e.node.isSameNode(t))),De(this,"next",(t,e=!0)=>{const n=Hs(t,this.count(),e);return this.item(n)}),De(this,"nextEnabled",(t,e=!0)=>{const n=this.item(t);if(!n)return;const r=this.enabledIndexOf(n.node),o=Hs(r,this.enabledCount(),e);return this.enabledItem(o)}),De(this,"prev",(t,e=!0)=>{const n=Vs(t,this.count()-1,e);return this.item(n)}),De(this,"prevEnabled",(t,e=!0)=>{const n=this.item(t);if(!n)return;const r=this.enabledIndexOf(n.node),o=Vs(r,this.enabledCount()-1,e);return this.enabledItem(o)}),De(this,"registerNode",(t,e)=>{if(!t||this.descendants.has(t))return;const n=Array.from(this.descendants.keys()).concat(t),r=qs(n);e!=null&&e.disabled&&(e.disabled=!!e.disabled);const o={node:t,index:-1,...e};this.descendants.set(t,o),this.assignIndex(r)})}};function Ml(){const t=j.useRef(new Bl);return wo(()=>()=>t.current.destroy()),t.current}var[zl,Aa]=et({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function Ll(t){const e=Aa(),[n,r]=j.useState(-1),o=j.useRef(null);wo(()=>()=>{o.current&&e.unregister(o.current)},[]),wo(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=kr(t?e.register(t):e.register);return{descendants:e,index:n,enabledIndex:e.enabledIndexOf(o.current),register:Te(s,o)}}function Na(){return[kr(zl),()=>kr(Aa()),()=>Ml(),o=>Ll(o)]}function Fa(t){const{value:e,defaultValue:n,onChange:r,shouldUpdate:o=(p,h)=>p!==h}=t,s=Bt(r),i=Bt(o),[a,l]=j.useState(n),u=e!==void 0,c=u?e:a,d=Bt(p=>{const b=typeof p=="function"?p(c):p;i(c,b)&&(u||l(b),s(b))},[u,s,c,i]);return[c,d]}function ps(t){return j.Children.toArray(t).filter(e=>j.isValidElement(e))}var Wl={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},Ul={horizontal:t=>({"& > *:not(style) ~ *:not(style)":{marginStart:t}}),vertical:t=>({"& > *:not(style) ~ *:not(style)":{marginTop:t}})},Ra=fe(function(e,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:a="0.5rem",isAttached:l,isDisabled:u,orientation:c="horizontal",...d}=e,p=ke("chakra-button__group",i),h=j.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:u}),[r,o,s,u]);let b={display:"inline-flex",...l?Wl[c]:Ul[c](a)};const f=c==="vertical";return O.jsx(vl,{value:h,children:O.jsx(de.div,{ref:n,role:"group",__css:b,className:p,"data-attached":l?"":void 0,"data-orientation":c,flexDir:f?"column":void 0,...d})})});Ra.displayName="ButtonGroup";var jn=fe((t,e)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=t,a=n||r,l=j.isValidElement(a)?j.cloneElement(a,{"aria-hidden":!0,focusable:!1}):null;return O.jsx(Le,{padding:"0",borderRadius:o?"full":void 0,ref:e,"aria-label":s,...i,children:l})});jn.displayName="IconButton";var[Kl,Ta]=gl("Card"),$l=fe(function(e,n){const{className:r,...o}=e,s=Ta();return O.jsx(de.div,{ref:n,className:ke("chakra-card__body",r),__css:s.body,...o})}),ql=fe(function(e,n){const{className:r,...o}=e,s=Ta();return O.jsx(de.div,{ref:n,className:ke("chakra-card__header",r),__css:s.header,...o})}),Hl=fe(function(e,n){const{className:r,children:o,direction:s="column",justify:i,align:a,...l}=tt(e),u=jt("Card",e);return O.jsx(de.div,{ref:n,className:ke("chakra-card",r),__css:{display:"flex",flexDirection:s,justifyContent:i,alignItems:a,position:"relative",minWidth:0,wordWrap:"break-word",...u.container},...l,children:O.jsx(Kl,{value:u,children:o})})}),[Vl,Ba]=et({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Zl,hn]=et({strict:!1,name:"FormControlContext"});function Gl(t){const{id:e,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=t,a=j.useId(),l=e||`field-${a}`,u=`${l}-label`,c=`${l}-feedback`,d=`${l}-helptext`,[p,h]=j.useState(!1),[b,f]=j.useState(!1),[y,m]=j.useState(!1),w=j.useCallback((E={},N=null)=>({id:d,...E,ref:Te(N,D=>{D&&f(!0)})}),[d]),_=j.useCallback((E={},N=null)=>({...E,ref:N,"data-focus":ot(y),"data-disabled":ot(o),"data-invalid":ot(r),"data-readonly":ot(s),id:E.id!==void 0?E.id:u,htmlFor:E.htmlFor!==void 0?E.htmlFor:l}),[l,o,y,r,s,u]),k=j.useCallback((E={},N=null)=>({id:c,...E,ref:Te(N,D=>{D&&h(!0)}),"aria-live":"polite"}),[c]),x=j.useCallback((E={},N=null)=>({...E,...i,ref:N,role:"group","data-focus":ot(y),"data-disabled":ot(o),"data-invalid":ot(r),"data-readonly":ot(s)}),[i,o,y,r,s]),I=j.useCallback((E={},N=null)=>({...E,ref:N,role:"presentation","aria-hidden":!0,children:E.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!y,onFocus:()=>m(!0),onBlur:()=>m(!1),hasFeedbackText:p,setHasFeedbackText:h,hasHelpText:b,setHasHelpText:f,id:l,labelId:u,feedbackId:c,helpTextId:d,htmlProps:i,getHelpTextProps:w,getErrorMessageProps:k,getRootProps:x,getLabelProps:_,getRequiredIndicatorProps:I}}var qr=fe(function(e,n){const r=jt("Form",e),o=tt(e),{getRootProps:s,htmlProps:i,...a}=Gl(o),l=ke("chakra-form-control",e.className);return O.jsx(Zl,{value:a,children:O.jsx(Vl,{value:r,children:O.jsx(de.div,{...s({},n),className:l,__css:r.container})})})});qr.displayName="FormControl";var Yl=fe(function(e,n){const r=hn(),o=Ba(),s=ke("chakra-form__helper-text",e.className);return O.jsx(de.div,{...r==null?void 0:r.getHelpTextProps(e,n),__css:o.helperText,className:s})});Yl.displayName="FormHelperText";var[Jl,Xl]=et({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Hr=fe((t,e)=>{const n=jt("FormError",t),r=tt(t),o=hn();return o!=null&&o.isInvalid?O.jsx(Jl,{value:n,children:O.jsx(de.div,{...o==null?void 0:o.getErrorMessageProps(r,e),className:ke("chakra-form__error-message",t.className),__css:{display:"flex",alignItems:"center",...n.text}})}):null});Hr.displayName="FormErrorMessage";var Ql=fe((t,e)=>{const n=Xl(),r=hn();if(!(r!=null&&r.isInvalid))return null;const o=ke("chakra-form__error-icon",t.className);return O.jsx(Ur,{ref:e,"aria-hidden":!0,...t,__css:n.icon,className:o,children:O.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})});Ql.displayName="FormErrorIcon";var Vr=fe(function(e,n){var r;const o=Kr("FormLabel",e),s=tt(e),{className:i,children:a,requiredIndicator:l=O.jsx(Ma,{}),optionalIndicator:u=null,...c}=s,d=hn(),p=(r=d==null?void 0:d.getLabelProps(c,n))!=null?r:{ref:n,...c};return O.jsxs(de.label,{...p,className:ke("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[a,d!=null&&d.isRequired?l:u]})});Vr.displayName="FormLabel";var Ma=fe(function(e,n){const r=hn(),o=Ba();if(!(r!=null&&r.isRequired))return null;const s=ke("chakra-form__required-indicator",e.className);return O.jsx(de.span,{...r==null?void 0:r.getRequiredIndicatorProps(e,n),__css:o.requiredIndicator,className:s})});Ma.displayName="RequiredIndicator";function ec(t){const{isDisabled:e,isInvalid:n,isReadOnly:r,isRequired:o,...s}=tc(t);return{...s,disabled:e,readOnly:r,required:o,"aria-invalid":no(n),"aria-required":no(o),"aria-readonly":no(r)}}function tc(t){var e,n,r;const o=hn(),{id:s,disabled:i,readOnly:a,required:l,isRequired:u,isInvalid:c,isReadOnly:d,isDisabled:p,onFocus:h,onBlur:b,...f}=t,y=t["aria-describedby"]?[t["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&y.push(o.feedbackId),o!=null&&o.hasHelpText&&y.push(o.helpTextId),{...f,"aria-describedby":y.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(e=i??p)!=null?e:o==null?void 0:o.isDisabled,isReadOnly:(n=a??d)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=l??u)!=null?r:o==null?void 0:o.isRequired,isInvalid:c??(o==null?void 0:o.isInvalid),onFocus:Oe(o==null?void 0:o.onFocus,h),onBlur:Oe(o==null?void 0:o.onBlur,b)}}function nn(t,e,n,r){const o=Bt(n);return j.useEffect(()=>{const s=typeof t=="function"?t():t??document;if(!(!n||!s))return s.addEventListener(e,o,r),()=>{s.removeEventListener(e,o,r)}},[e,t,r,o,n]),()=>{const s=typeof t=="function"?t():t??document;s==null||s.removeEventListener(e,o,r)}}function nc(t){return"current"in t}var za=()=>typeof window<"u";function rc(){var t;const e=navigator.userAgentData;return(t=e==null?void 0:e.platform)!=null?t:navigator.platform}var oc=t=>za()&&t.test(navigator.vendor),sc=t=>za()&&t.test(rc()),ac=()=>sc(/mac|iphone|ipad|ipod/i),ic=()=>ac()&&oc(/apple/i);function lc(t){const{ref:e,elements:n,enabled:r}=t,o=()=>{var s,i;return(i=(s=e.current)==null?void 0:s.ownerDocument)!=null?i:document};nn(o,"pointerdown",s=>{if(!ic()||!r)return;const i=s.target,l=(n??[e]).some(u=>{const c=nc(u)?u.current:u;return(c==null?void 0:c.contains(i))||c===i});o().activeElement!==i&&l&&(s.preventDefault(),i.focus())})}var La={exports:{}},cc="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",uc=cc,dc=uc;function Wa(){}function Ua(){}Ua.resetWarningCache=Wa;var fc=function(){function t(r,o,s,i,a,l){if(l!==dc){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Ua,resetWarningCache:Wa};return n.PropTypes=n,n};La.exports=fc();var hc=La.exports;const Ft=xa(hc);function pc(t){const e=t.ownerDocument.defaultView||window,{overflow:n,overflowX:r,overflowY:o}=e.getComputedStyle(t);return/auto|scroll|overlay|hidden/.test(n+o+r)}function mc(t){return t.localName==="html"?t:t.assignedSlot||t.parentElement||t.ownerDocument.documentElement}function Ka(t){return["html","body","#document"].includes(t.localName)?t.ownerDocument.body:wl(t)&&pc(t)?t:Ka(mc(t))}var yc=Al?j.useLayoutEffect:j.useEffect;function bo(t,e=[]){const n=j.useRef(t);return yc(()=>{n.current=t}),j.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},e)}function vc(t){const{ref:e,handler:n,enabled:r=!0}=t,o=bo(n),i=j.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;j.useEffect(()=>{if(!r)return;const a=d=>{ro(d,e)&&(i.isPointerDown=!0)},l=d=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&ro(d,e)&&(i.isPointerDown=!1,o(d))},u=d=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&ro(d,e)&&(i.isPointerDown=!1,o(d))},c=Pa(e.current);return c.addEventListener("mousedown",a,!0),c.addEventListener("mouseup",l,!0),c.addEventListener("touchstart",a,!0),c.addEventListener("touchend",u,!0),()=>{c.removeEventListener("mousedown",a,!0),c.removeEventListener("mouseup",l,!0),c.removeEventListener("touchstart",a,!0),c.removeEventListener("touchend",u,!0)}},[n,e,o,i,r])}function ro(t,e){var n;const r=t.target;return r&&!Pa(r).contains(r)?!1:!((n=e.current)!=null&&n.contains(r))}function gc(t,e){const n=j.useId();return j.useMemo(()=>t||[e,n].filter(Boolean).join("-"),[t,e,n])}function wc(t,e){const n=t!==void 0;return[n,n&&typeof t<"u"?t:e]}function bc(t={}){const{onClose:e,onOpen:n,isOpen:r,id:o}=t,s=bo(n),i=bo(e),[a,l]=j.useState(t.defaultIsOpen||!1),[u,c]=wc(r,a),d=gc(o,"disclosure"),p=j.useCallback(()=>{u||l(!1),i==null||i()},[u,i]),h=j.useCallback(()=>{u||l(!0),s==null||s()},[u,s]),b=j.useCallback(()=>{(c?p:h)()},[c,h,p]);return{isOpen:!!c,onOpen:h,onClose:p,onToggle:b,isControlled:u,getButtonProps:(f={})=>({...f,"aria-expanded":c,"aria-controls":d,onClick:bl(f.onClick,b)}),getDisclosureProps:(f={})=>({...f,hidden:!c,id:d})}}var Un=fe(function(e,n){const{htmlSize:r,...o}=e,s=jt("Input",o),i=tt(o),a=ec(i),l=ke("chakra-input",e.className);return O.jsx(de.input,{size:r,...a,__css:s.field,ref:n,className:l})});Un.displayName="Input";Un.id="Input";function _c(t,e){return Array.isArray(t)?t.map(n=>n===null?null:e(n)):_l(t)?Object.keys(t).reduce((n,r)=>(n[r]=e(t[r]),n),{}):t!=null?e(t):null}var Mt=fe(function(e,n){const r=Kr("Text",e),{className:o,align:s,decoration:i,casing:a,...l}=tt(e),u=Nl({textAlign:e.align,textDecoration:e.decoration,textTransform:e.casing});return O.jsx(de.p,{ref:n,className:ke("chakra-text",e.className),...u,...l,__css:r})});Mt.displayName="Text";var _o=t=>O.jsx(de.div,{className:"chakra-stack__divider",...t,__css:{...t.__css,borderWidth:0,alignSelf:"stretch",borderColor:"inherit",width:"auto",height:"auto"}});_o.displayName="StackDivider";var $a=t=>O.jsx(de.div,{className:"chakra-stack__item",...t,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...t.__css}});$a.displayName="StackItem";function kc(t){const{spacing:e,direction:n}=t,r={column:{my:e,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:e,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:e,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:e,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":_c(n,o=>r[o])}}var rn=fe((t,e)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:a,children:l,divider:u,className:c,shouldWrapChildren:d,...p}=t,h=n?"row":r??"column",b=j.useMemo(()=>kc({spacing:i,direction:h}),[i,h]),f=!!u,y=!d&&!f,m=j.useMemo(()=>{const _=ps(l);return y?_:_.map((k,x)=>{const I=typeof k.key<"u"?k.key:x,E=x+1===_.length,D=d?O.jsx($a,{children:k},I):k;if(!f)return D;const R=j.cloneElement(u,{__css:b}),K=E?null:R;return O.jsxs(j.Fragment,{children:[D,K]},I)})},[u,b,f,y,d,l]),w=ke("chakra-stack",c);return O.jsx(de.div,{ref:e,display:"flex",alignItems:o,justifyContent:s,flexDirection:h,flexWrap:a,gap:f?void 0:i,className:w,...p,children:m})});rn.displayName="Stack";var zt=fe((t,e)=>O.jsx(rn,{align:"center",...t,direction:"row",ref:e}));zt.displayName="HStack";var ms=fe(function(e,n){const r=Kr("Heading",e),{className:o,...s}=tt(e);return O.jsx(de.h2,{ref:n,className:ke("chakra-heading",e.className),...s,__css:r})});ms.displayName="Heading";var St=de("div");St.displayName="Box";var qa=fe(function(e,n){const{size:r,centerContent:o=!0,...s}=e,i=o?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return O.jsx(St,{ref:n,boxSize:r,__css:{...i,flexShrink:0,flexGrow:0},...s})});qa.displayName="Square";var xc=fe(function(e,n){const{size:r,...o}=e;return O.jsx(qa,{size:r,ref:n,borderRadius:"9999px",...o})});xc.displayName="Circle";var xn=fe(function(e,n){const{direction:r,align:o,justify:s,wrap:i,basis:a,grow:l,shrink:u,...c}=e,d={display:"flex",flexDirection:r,alignItems:o,justifyContent:s,flexWrap:i,flexBasis:a,flexGrow:l,flexShrink:u};return O.jsx(de.div,{ref:n,__css:d,...c})});xn.displayName="Flex";function Ec(t){const{key:e}=t;return e.length===1||e.length>1&&/[^a-zA-Z0-9]/.test(e)}function Cc(t={}){const{timeout:e=300,preventDefault:n=()=>!0}=t,[r,o]=j.useState([]),s=j.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},a=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},e)};j.useEffect(()=>i,[]);function l(u){return c=>{if(c.key==="Backspace"){const d=[...r];d.pop(),o(d);return}if(Ec(c)){const d=r.concat(c.key);n(c)&&(c.preventDefault(),c.stopPropagation()),o(d),u(d.join("")),a()}}}return l}function Sc(t,e,n,r){if(e==null)return r;if(!r)return t.find(i=>n(i).toLowerCase().startsWith(e.toLowerCase()));const o=t.filter(s=>n(s).toLowerCase().startsWith(e.toLowerCase()));if(o.length>0){let s;return o.includes(r)?(s=o.indexOf(r)+1,s===o.length&&(s=0),o[s]):(s=t.indexOf(o[0]),t[s])}return r}function Oc(){const t=j.useRef(new Map),e=t.current,n=j.useCallback((o,s,i,a)=>{t.current.set(i,{type:s,el:o,options:a}),o.addEventListener(s,i,a)},[]),r=j.useCallback((o,s,i,a)=>{o.removeEventListener(s,i,a),t.current.delete(i)},[]);return j.useEffect(()=>()=>{e.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,e]),{add:n,remove:r}}function oo(t){const e=t.target,{tagName:n,isContentEditable:r}=e;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function Ha(t={}){const{ref:e,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:a,onClick:l,onKeyDown:u,onKeyUp:c,tabIndex:d,onMouseOver:p,onMouseLeave:h,...b}=t,[f,y]=j.useState(!0),[m,w]=j.useState(!1),_=Oc(),k=A=>{A&&A.tagName!=="BUTTON"&&y(!1)},x=f?d:d||0,I=n&&!r,E=j.useCallback(A=>{if(n){A.stopPropagation(),A.preventDefault();return}A.currentTarget.focus(),l==null||l(A)},[n,l]),N=j.useCallback(A=>{m&&oo(A)&&(A.preventDefault(),A.stopPropagation(),w(!1),_.remove(document,"keyup",N,!1))},[m,_]),D=j.useCallback(A=>{if(u==null||u(A),n||A.defaultPrevented||A.metaKey||!oo(A.nativeEvent)||f)return;const X=o&&A.key==="Enter";s&&A.key===" "&&(A.preventDefault(),w(!0)),X&&(A.preventDefault(),A.currentTarget.click()),_.add(document,"keyup",N,!1)},[n,f,u,o,s,_,N]),R=j.useCallback(A=>{if(c==null||c(A),n||A.defaultPrevented||A.metaKey||!oo(A.nativeEvent)||f)return;s&&A.key===" "&&(A.preventDefault(),w(!1),A.currentTarget.click())},[s,f,n,c]),K=j.useCallback(A=>{A.button===0&&(w(!1),_.remove(document,"mouseup",K,!1))},[_]),P=j.useCallback(A=>{if(A.button!==0)return;if(n){A.stopPropagation(),A.preventDefault();return}f||w(!0),A.currentTarget.focus({preventScroll:!0}),_.add(document,"mouseup",K,!1),i==null||i(A)},[n,f,i,_,K]),B=j.useCallback(A=>{A.button===0&&(f||w(!1),a==null||a(A))},[a,f]),v=j.useCallback(A=>{if(n){A.preventDefault();return}p==null||p(A)},[n,p]),T=j.useCallback(A=>{m&&(A.preventDefault(),w(!1)),h==null||h(A)},[m,h]),H=Te(e,k);return f?{...b,ref:H,type:"button","aria-disabled":I?void 0:n,disabled:I,onClick:E,onMouseDown:i,onMouseUp:a,onKeyUp:c,onKeyDown:u,onMouseOver:p,onMouseLeave:h}:{...b,ref:H,role:"button","data-active":ot(m),"aria-disabled":n?"true":void 0,tabIndex:I?void 0:x,onClick:E,onMouseDown:P,onMouseUp:B,onKeyUp:R,onKeyDown:D,onMouseOver:v,onMouseLeave:T}}function Ic(t){const e=t.current;if(!e)return!1;const n=El(e);return!n||e.contains(n)?!1:!!Cl(n)}function Va(t,e){const{shouldFocus:n,visible:r,focusRef:o}=e,s=n&&!r;$r(()=>{if(!s||Ic(t))return;const i=(o==null?void 0:o.current)||t.current;let a;if(i)return a=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(a)}},[s,t,o])}var Dc={preventScroll:!0,shouldFocus:!1};function Pc(t,e=Dc){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=e,i=jc(t)?t.current:t,a=o&&s,l=j.useRef(a),u=j.useRef(s);kl(()=>{!u.current&&s&&(l.current=a),u.current=s},[s,a]);const c=j.useCallback(()=>{if(!(!s||!i||!l.current)&&(l.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var d;(d=n.current)==null||d.focus({preventScroll:r})});else{const d=xl(i);d.length>0&&requestAnimationFrame(()=>{d[0].focus({preventScroll:r})})}},[s,r,i,n]);$r(()=>{c()},[c]),nn(i,"transitionend",c)}function jc(t){return"current"in t}var Jt=(t,e)=>({var:t,varRef:e?`var(${t}, ${e})`:`var(${t})`}),Ae={arrowShadowColor:Jt("--popper-arrow-shadow-color"),arrowSize:Jt("--popper-arrow-size","8px"),arrowSizeHalf:Jt("--popper-arrow-size-half"),arrowBg:Jt("--popper-arrow-bg"),transformOrigin:Jt("--popper-transform-origin"),arrowOffset:Jt("--popper-arrow-offset")};function Ac(t){if(t.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(t.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(t.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(t.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var Nc={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},Fc=t=>Nc[t],Zs={scroll:!0,resize:!0};function Rc(t){let e;return typeof t=="object"?e={enabled:!0,options:{...Zs,...t}}:e={enabled:t,options:Zs},e}var Tc={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:t})=>{t.styles.popper.width=`${t.rects.reference.width}px`},effect:({state:t})=>()=>{const e=t.elements.reference;t.elements.popper.style.width=`${e.offsetWidth}px`}},Bc={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:t})=>{Gs(t)},effect:({state:t})=>()=>{Gs(t)}},Gs=t=>{t.elements.popper.style.setProperty(Ae.transformOrigin.var,Fc(t.placement))},Mc={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:t})=>{zc(t)}},zc=t=>{var e;if(!t.placement)return;const n=Lc(t.placement);if((e=t.elements)!=null&&e.arrow&&n){Object.assign(t.elements.arrow.style,{[n.property]:n.value,width:Ae.arrowSize.varRef,height:Ae.arrowSize.varRef,zIndex:-1});const r={[Ae.arrowSizeHalf.var]:`calc(${Ae.arrowSize.varRef} / 2 - 1px)`,[Ae.arrowOffset.var]:`calc(${Ae.arrowSizeHalf.varRef} * -1)`};for(const o in r)t.elements.arrow.style.setProperty(o,r[o])}},Lc=t=>{if(t.startsWith("top"))return{property:"bottom",value:Ae.arrowOffset.varRef};if(t.startsWith("bottom"))return{property:"top",value:Ae.arrowOffset.varRef};if(t.startsWith("left"))return{property:"right",value:Ae.arrowOffset.varRef};if(t.startsWith("right"))return{property:"left",value:Ae.arrowOffset.varRef}},Wc={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:t})=>{Ys(t)},effect:({state:t})=>()=>{Ys(t)}},Ys=t=>{if(!t.elements.arrow)return;const e=t.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!e)return;const n=Ac(t.placement);n&&e.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(e.style,{transform:"rotate(45deg)",background:Ae.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},Uc={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},Kc={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function $c(t,e="ltr"){var n,r;const o=((n=Uc[t])==null?void 0:n[e])||t;return e==="ltr"?o:(r=Kc[t])!=null?r:o}var Ue="top",Xe="bottom",Qe="right",Ke="left",ys="auto",Kn=[Ue,Xe,Qe,Ke],ln="start",An="end",qc="clippingParents",Za="viewport",wn="popper",Hc="reference",Js=Kn.reduce(function(t,e){return t.concat([e+"-"+ln,e+"-"+An])},[]),Ga=[].concat(Kn,[ys]).reduce(function(t,e){return t.concat([e,e+"-"+ln,e+"-"+An])},[]),Vc="beforeRead",Zc="read",Gc="afterRead",Yc="beforeMain",Jc="main",Xc="afterMain",Qc="beforeWrite",eu="write",tu="afterWrite",nu=[Vc,Zc,Gc,Yc,Jc,Xc,Qc,eu,tu];function lt(t){return t?(t.nodeName||"").toLowerCase():null}function Ve(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function qt(t){var e=Ve(t).Element;return t instanceof e||t instanceof Element}function Je(t){var e=Ve(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function vs(t){if(typeof ShadowRoot>"u")return!1;var e=Ve(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function ru(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},s=e.elements[n];!Je(s)||!lt(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var a=o[i];a===!1?s.removeAttribute(i):s.setAttribute(i,a===!0?"":a)}))})}function ou(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],s=e.attributes[r]||{},i=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=i.reduce(function(l,u){return l[u]="",l},{});!Je(o)||!lt(o)||(Object.assign(o.style,a),Object.keys(s).forEach(function(l){o.removeAttribute(l)}))})}}const su={name:"applyStyles",enabled:!0,phase:"write",fn:ru,effect:ou,requires:["computeStyles"]};function it(t){return t.split("-")[0]}var Lt=Math.max,xr=Math.min,cn=Math.round;function ko(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Ya(){return!/^((?!chrome|android).)*safari/i.test(ko())}function un(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),o=1,s=1;e&&Je(t)&&(o=t.offsetWidth>0&&cn(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&cn(r.height)/t.offsetHeight||1);var i=qt(t)?Ve(t):window,a=i.visualViewport,l=!Ya()&&n,u=(r.left+(l&&a?a.offsetLeft:0))/o,c=(r.top+(l&&a?a.offsetTop:0))/s,d=r.width/o,p=r.height/s;return{width:d,height:p,top:c,right:u+d,bottom:c+p,left:u,x:u,y:c}}function gs(t){var e=un(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function Ja(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&vs(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function vt(t){return Ve(t).getComputedStyle(t)}function au(t){return["table","td","th"].indexOf(lt(t))>=0}function Nt(t){return((qt(t)?t.ownerDocument:t.document)||window.document).documentElement}function Zr(t){return lt(t)==="html"?t:t.assignedSlot||t.parentNode||(vs(t)?t.host:null)||Nt(t)}function Xs(t){return!Je(t)||vt(t).position==="fixed"?null:t.offsetParent}function iu(t){var e=/firefox/i.test(ko()),n=/Trident/i.test(ko());if(n&&Je(t)){var r=vt(t);if(r.position==="fixed")return null}var o=Zr(t);for(vs(o)&&(o=o.host);Je(o)&&["html","body"].indexOf(lt(o))<0;){var s=vt(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function $n(t){for(var e=Ve(t),n=Xs(t);n&&au(n)&&vt(n).position==="static";)n=Xs(n);return n&&(lt(n)==="html"||lt(n)==="body"&&vt(n).position==="static")?e:n||iu(t)||e}function ws(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function En(t,e,n){return Lt(t,xr(e,n))}function lu(t,e,n){var r=En(t,e,n);return r>n?n:r}function Xa(){return{top:0,right:0,bottom:0,left:0}}function Qa(t){return Object.assign({},Xa(),t)}function ei(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var cu=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Qa(typeof e!="number"?e:ei(e,Kn))};function uu(t){var e,n=t.state,r=t.name,o=t.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,a=it(n.placement),l=ws(a),u=[Ke,Qe].indexOf(a)>=0,c=u?"height":"width";if(!(!s||!i)){var d=cu(o.padding,n),p=gs(s),h=l==="y"?Ue:Ke,b=l==="y"?Xe:Qe,f=n.rects.reference[c]+n.rects.reference[l]-i[l]-n.rects.popper[c],y=i[l]-n.rects.reference[l],m=$n(s),w=m?l==="y"?m.clientHeight||0:m.clientWidth||0:0,_=f/2-y/2,k=d[h],x=w-p[c]-d[b],I=w/2-p[c]/2+_,E=En(k,I,x),N=l;n.modifiersData[r]=(e={},e[N]=E,e.centerOffset=E-I,e)}}function du(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||Ja(e.elements.popper,o)&&(e.elements.arrow=o))}const fu={name:"arrow",enabled:!0,phase:"main",fn:uu,effect:du,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function dn(t){return t.split("-")[1]}var hu={top:"auto",right:"auto",bottom:"auto",left:"auto"};function pu(t,e){var n=t.x,r=t.y,o=e.devicePixelRatio||1;return{x:cn(n*o)/o||0,y:cn(r*o)/o||0}}function Qs(t){var e,n=t.popper,r=t.popperRect,o=t.placement,s=t.variation,i=t.offsets,a=t.position,l=t.gpuAcceleration,u=t.adaptive,c=t.roundOffsets,d=t.isFixed,p=i.x,h=p===void 0?0:p,b=i.y,f=b===void 0?0:b,y=typeof c=="function"?c({x:h,y:f}):{x:h,y:f};h=y.x,f=y.y;var m=i.hasOwnProperty("x"),w=i.hasOwnProperty("y"),_=Ke,k=Ue,x=window;if(u){var I=$n(n),E="clientHeight",N="clientWidth";if(I===Ve(n)&&(I=Nt(n),vt(I).position!=="static"&&a==="absolute"&&(E="scrollHeight",N="scrollWidth")),I=I,o===Ue||(o===Ke||o===Qe)&&s===An){k=Xe;var D=d&&I===x&&x.visualViewport?x.visualViewport.height:I[E];f-=D-r.height,f*=l?1:-1}if(o===Ke||(o===Ue||o===Xe)&&s===An){_=Qe;var R=d&&I===x&&x.visualViewport?x.visualViewport.width:I[N];h-=R-r.width,h*=l?1:-1}}var K=Object.assign({position:a},u&&hu),P=c===!0?pu({x:h,y:f},Ve(n)):{x:h,y:f};if(h=P.x,f=P.y,l){var B;return Object.assign({},K,(B={},B[k]=w?"0":"",B[_]=m?"0":"",B.transform=(x.devicePixelRatio||1)<=1?"translate("+h+"px, "+f+"px)":"translate3d("+h+"px, "+f+"px, 0)",B))}return Object.assign({},K,(e={},e[k]=w?f+"px":"",e[_]=m?h+"px":"",e.transform="",e))}function mu(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:it(e.placement),variation:dn(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Qs(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:i,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Qs(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const yu={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:mu,data:{}};var Qn={passive:!0};function vu(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,a=i===void 0?!0:i,l=Ve(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&u.forEach(function(c){c.addEventListener("scroll",n.update,Qn)}),a&&l.addEventListener("resize",n.update,Qn),function(){s&&u.forEach(function(c){c.removeEventListener("scroll",n.update,Qn)}),a&&l.removeEventListener("resize",n.update,Qn)}}const gu={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:vu,data:{}};var wu={left:"right",right:"left",bottom:"top",top:"bottom"};function cr(t){return t.replace(/left|right|bottom|top/g,function(e){return wu[e]})}var bu={start:"end",end:"start"};function ea(t){return t.replace(/start|end/g,function(e){return bu[e]})}function bs(t){var e=Ve(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function _s(t){return un(Nt(t)).left+bs(t).scrollLeft}function _u(t,e){var n=Ve(t),r=Nt(t),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;var u=Ya();(u||!u&&e==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:s,height:i,x:a+_s(t),y:l}}function ku(t){var e,n=Nt(t),r=bs(t),o=(e=t.ownerDocument)==null?void 0:e.body,s=Lt(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Lt(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+_s(t),l=-r.scrollTop;return vt(o||n).direction==="rtl"&&(a+=Lt(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:a,y:l}}function ks(t){var e=vt(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function ti(t){return["html","body","#document"].indexOf(lt(t))>=0?t.ownerDocument.body:Je(t)&&ks(t)?t:ti(Zr(t))}function Cn(t,e){var n;e===void 0&&(e=[]);var r=ti(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),s=Ve(r),i=o?[s].concat(s.visualViewport||[],ks(r)?r:[]):r,a=e.concat(i);return o?a:a.concat(Cn(Zr(i)))}function xo(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function xu(t,e){var n=un(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function ta(t,e,n){return e===Za?xo(_u(t,n)):qt(e)?xu(e,n):xo(ku(Nt(t)))}function Eu(t){var e=Cn(Zr(t)),n=["absolute","fixed"].indexOf(vt(t).position)>=0,r=n&&Je(t)?$n(t):t;return qt(r)?e.filter(function(o){return qt(o)&&Ja(o,r)&<(o)!=="body"}):[]}function Cu(t,e,n,r){var o=e==="clippingParents"?Eu(t):[].concat(e),s=[].concat(o,[n]),i=s[0],a=s.reduce(function(l,u){var c=ta(t,u,r);return l.top=Lt(c.top,l.top),l.right=xr(c.right,l.right),l.bottom=xr(c.bottom,l.bottom),l.left=Lt(c.left,l.left),l},ta(t,i,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function ni(t){var e=t.reference,n=t.element,r=t.placement,o=r?it(r):null,s=r?dn(r):null,i=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(o){case Ue:l={x:i,y:e.y-n.height};break;case Xe:l={x:i,y:e.y+e.height};break;case Qe:l={x:e.x+e.width,y:a};break;case Ke:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var u=o?ws(o):null;if(u!=null){var c=u==="y"?"height":"width";switch(s){case ln:l[u]=l[u]-(e[c]/2-n[c]/2);break;case An:l[u]=l[u]+(e[c]/2-n[c]/2);break}}return l}function Nn(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,s=n.strategy,i=s===void 0?t.strategy:s,a=n.boundary,l=a===void 0?qc:a,u=n.rootBoundary,c=u===void 0?Za:u,d=n.elementContext,p=d===void 0?wn:d,h=n.altBoundary,b=h===void 0?!1:h,f=n.padding,y=f===void 0?0:f,m=Qa(typeof y!="number"?y:ei(y,Kn)),w=p===wn?Hc:wn,_=t.rects.popper,k=t.elements[b?w:p],x=Cu(qt(k)?k:k.contextElement||Nt(t.elements.popper),l,c,i),I=un(t.elements.reference),E=ni({reference:I,element:_,strategy:"absolute",placement:o}),N=xo(Object.assign({},_,E)),D=p===wn?N:I,R={top:x.top-D.top+m.top,bottom:D.bottom-x.bottom+m.bottom,left:x.left-D.left+m.left,right:D.right-x.right+m.right},K=t.modifiersData.offset;if(p===wn&&K){var P=K[o];Object.keys(R).forEach(function(B){var v=[Qe,Xe].indexOf(B)>=0?1:-1,T=[Ue,Xe].indexOf(B)>=0?"y":"x";R[B]+=P[T]*v})}return R}function Su(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?Ga:l,c=dn(r),d=c?a?Js:Js.filter(function(b){return dn(b)===c}):Kn,p=d.filter(function(b){return u.indexOf(b)>=0});p.length===0&&(p=d);var h=p.reduce(function(b,f){return b[f]=Nn(t,{placement:f,boundary:o,rootBoundary:s,padding:i})[it(f)],b},{});return Object.keys(h).sort(function(b,f){return h[b]-h[f]})}function Ou(t){if(it(t)===ys)return[];var e=cr(t);return[ea(t),e,ea(e)]}function Iu(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,a=i===void 0?!0:i,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,p=n.altBoundary,h=n.flipVariations,b=h===void 0?!0:h,f=n.allowedAutoPlacements,y=e.options.placement,m=it(y),w=m===y,_=l||(w||!b?[cr(y)]:Ou(y)),k=[y].concat(_).reduce(function(J,G){return J.concat(it(G)===ys?Su(e,{placement:G,boundary:c,rootBoundary:d,padding:u,flipVariations:b,allowedAutoPlacements:f}):G)},[]),x=e.rects.reference,I=e.rects.popper,E=new Map,N=!0,D=k[0],R=0;R=0,T=v?"width":"height",H=Nn(e,{placement:K,boundary:c,rootBoundary:d,altBoundary:p,padding:u}),A=v?B?Qe:Ke:B?Xe:Ue;x[T]>I[T]&&(A=cr(A));var X=cr(A),$=[];if(s&&$.push(H[P]<=0),a&&$.push(H[A]<=0,H[X]<=0),$.every(function(J){return J})){D=K,N=!1;break}E.set(K,$)}if(N)for(var ne=b?3:1,z=function(G){var me=k.find(function(we){var ie=E.get(we);if(ie)return ie.slice(0,G).every(function(ue){return ue})});if(me)return D=me,"break"},M=ne;M>0;M--){var te=z(M);if(te==="break")break}e.placement!==D&&(e.modifiersData[r]._skip=!0,e.placement=D,e.reset=!0)}}const Du={name:"flip",enabled:!0,phase:"main",fn:Iu,requiresIfExists:["offset"],data:{_skip:!1}};function na(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function ra(t){return[Ue,Qe,Xe,Ke].some(function(e){return t[e]>=0})}function Pu(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,s=e.modifiersData.preventOverflow,i=Nn(e,{elementContext:"reference"}),a=Nn(e,{altBoundary:!0}),l=na(i,r),u=na(a,o,s),c=ra(l),d=ra(u);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const ju={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Pu};function Au(t,e,n){var r=it(t),o=[Ke,Ue].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,i=s[0],a=s[1];return i=i||0,a=(a||0)*o,[Ke,Qe].indexOf(r)>=0?{x:a,y:i}:{x:i,y:a}}function Nu(t){var e=t.state,n=t.options,r=t.name,o=n.offset,s=o===void 0?[0,0]:o,i=Ga.reduce(function(c,d){return c[d]=Au(d,e.rects,s),c},{}),a=i[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=i}const Fu={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Nu};function Ru(t){var e=t.state,n=t.name;e.modifiersData[n]=ni({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Tu={name:"popperOffsets",enabled:!0,phase:"read",fn:Ru,data:{}};function Bu(t){return t==="x"?"y":"x"}function Mu(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,a=i===void 0?!1:i,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,p=n.tether,h=p===void 0?!0:p,b=n.tetherOffset,f=b===void 0?0:b,y=Nn(e,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),m=it(e.placement),w=dn(e.placement),_=!w,k=ws(m),x=Bu(k),I=e.modifiersData.popperOffsets,E=e.rects.reference,N=e.rects.popper,D=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,R=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),K=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,P={x:0,y:0};if(I){if(s){var B,v=k==="y"?Ue:Ke,T=k==="y"?Xe:Qe,H=k==="y"?"height":"width",A=I[k],X=A+y[v],$=A-y[T],ne=h?-N[H]/2:0,z=w===ln?E[H]:N[H],M=w===ln?-N[H]:-E[H],te=e.elements.arrow,J=h&&te?gs(te):{width:0,height:0},G=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Xa(),me=G[v],we=G[T],ie=En(0,E[H],J[H]),ue=_?E[H]/2-ne-ie-me-R.mainAxis:z-ie-me-R.mainAxis,_e=_?-E[H]/2+ne+ie+we+R.mainAxis:M+ie+we+R.mainAxis,ye=e.elements.arrow&&$n(e.elements.arrow),pe=ye?k==="y"?ye.clientTop||0:ye.clientLeft||0:0,xe=(B=K==null?void 0:K[k])!=null?B:0,g=A+ue-xe-pe,U=A+_e-xe,W=En(h?xr(X,g):X,A,h?Lt($,U):$);I[k]=W,P[k]=W-A}if(a){var S,C=k==="x"?Ue:Ke,F=k==="x"?Xe:Qe,V=I[x],Z=x==="y"?"height":"width",L=V+y[C],Q=V-y[F],re=[Ue,Ke].indexOf(m)!==-1,ee=(S=K==null?void 0:K[x])!=null?S:0,se=re?L:V-E[Z]-N[Z]-ee+R.altAxis,ve=re?V+E[Z]+N[Z]-ee-R.altAxis:Q,he=h&&re?lu(se,V,ve):En(h?se:L,V,h?ve:Q);I[x]=he,P[x]=he-V}e.modifiersData[r]=P}}const zu={name:"preventOverflow",enabled:!0,phase:"main",fn:Mu,requiresIfExists:["offset"]};function Lu(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Wu(t){return t===Ve(t)||!Je(t)?bs(t):Lu(t)}function Uu(t){var e=t.getBoundingClientRect(),n=cn(e.width)/t.offsetWidth||1,r=cn(e.height)/t.offsetHeight||1;return n!==1||r!==1}function Ku(t,e,n){n===void 0&&(n=!1);var r=Je(e),o=Je(e)&&Uu(e),s=Nt(e),i=un(t,o,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((lt(e)!=="body"||ks(s))&&(a=Wu(e)),Je(e)?(l=un(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=_s(s))),{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function $u(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&o(l)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||o(s)}),r}function qu(t){var e=$u(t);return nu.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function Hu(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function Vu(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var oa={placement:"bottom",modifiers:[],strategy:"absolute"};function sa(){for(var t=arguments.length,e=new Array(t),n=0;n{}),_=j.useCallback(()=>{var R;!e||!b.current||!f.current||((R=w.current)==null||R.call(w),y.current=Yu(b.current,f.current,{placement:m,modifiers:[Wc,Mc,Bc,{...Tc,enabled:!!p},{name:"eventListeners",...Rc(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:a??[0,l]}},{name:"flip",enabled:!!u,options:{padding:8}},{name:"preventOverflow",enabled:!!d,options:{boundary:c}},...n??[]],strategy:o}),y.current.forceUpdate(),w.current=y.current.destroy)},[m,e,n,p,i,s,a,l,u,d,c,o]);j.useEffect(()=>()=>{var R;!b.current&&!f.current&&((R=y.current)==null||R.destroy(),y.current=null)},[]);const k=j.useCallback(R=>{b.current=R,_()},[_]),x=j.useCallback((R={},K=null)=>({...R,ref:Te(k,K)}),[k]),I=j.useCallback(R=>{f.current=R,_()},[_]),E=j.useCallback((R={},K=null)=>({...R,ref:Te(I,K),style:{...R.style,position:o,minWidth:p?void 0:"max-content",inset:"0 auto auto 0"}}),[o,I,p]),N=j.useCallback((R={},K=null)=>{const{size:P,shadowColor:B,bg:v,style:T,...H}=R;return{...H,ref:K,"data-popper-arrow":"",style:Ju(R)}},[]),D=j.useCallback((R={},K=null)=>({...R,ref:K,"data-popper-arrow-inner":""}),[]);return{update(){var R;(R=y.current)==null||R.update()},forceUpdate(){var R;(R=y.current)==null||R.forceUpdate()},transformOrigin:Ae.transformOrigin.varRef,referenceRef:k,popperRef:I,getPopperProps:E,getArrowProps:N,getArrowInnerProps:D,getReferenceProps:x}}function Ju(t){const{size:e,shadowColor:n,bg:r,style:o}=t,s={...o,position:"absolute"};return e&&(s["--popper-arrow-size"]=e),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function Es(t={}){const{onClose:e,onOpen:n,isOpen:r,id:o}=t,s=Bt(n),i=Bt(e),[a,l]=j.useState(t.defaultIsOpen||!1),u=r!==void 0?r:a,c=r!==void 0,d=j.useId(),p=o??`disclosure-${d}`,h=j.useCallback(()=>{c||l(!1),i==null||i()},[c,i]),b=j.useCallback(()=>{c||l(!0),s==null||s()},[c,s]),f=j.useCallback(()=>{u?h():b()},[u,b,h]);function y(w={}){return{...w,"aria-expanded":u,"aria-controls":p,onClick(_){var k;(k=w.onClick)==null||k.call(w,_),f()}}}function m(w={}){return{...w,hidden:!u,id:p}}return{isOpen:u,onOpen:b,onClose:h,onToggle:f,isControlled:c,getButtonProps:y,getDisclosureProps:m}}function Xu(t){const{ref:e,handler:n,enabled:r=!0}=t,o=Bt(n),i=j.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;j.useEffect(()=>{if(!r)return;const a=d=>{so(d,e)&&(i.isPointerDown=!0)},l=d=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&so(d,e)&&(i.isPointerDown=!1,o(d))},u=d=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&so(d,e)&&(i.isPointerDown=!1,o(d))},c=ri(e.current);return c.addEventListener("mousedown",a,!0),c.addEventListener("mouseup",l,!0),c.addEventListener("touchstart",a,!0),c.addEventListener("touchend",u,!0),()=>{c.removeEventListener("mousedown",a,!0),c.removeEventListener("mouseup",l,!0),c.removeEventListener("touchstart",a,!0),c.removeEventListener("touchend",u,!0)}},[n,e,o,i,r])}function so(t,e){var n;const r=t.target;return r&&!ri(r).contains(r)?!1:!((n=e.current)!=null&&n.contains(r))}function ri(t){var e;return(e=t==null?void 0:t.ownerDocument)!=null?e:document}function oi(t){const{isOpen:e,ref:n}=t,[r,o]=j.useState(e),[s,i]=j.useState(!1);return j.useEffect(()=>{s||(o(e),i(!0))},[e,s,r]),nn(()=>n.current,"animationend",()=>{o(e)}),{present:!(e?!1:!r),onComplete(){var l;const u=Sl(n.current),c=new u.CustomEvent("animationend",{bubbles:!0});(l=n.current)==null||l.dispatchEvent(c)}}}function Cs(t){const{wasSelected:e,enabled:n,isSelected:r,mode:o="unmount"}=t;return!!(!n||r||o==="keepMounted"&&e)}var[Qu,ed,td,nd]=Na(),[rd,qn]=et({strict:!1,name:"MenuContext"});function od(t,...e){const n=j.useId(),r=t||n;return j.useMemo(()=>e.map(o=>`${o}-${r}`),[r,e])}function si(t){var e;return(e=t==null?void 0:t.ownerDocument)!=null?e:document}function aa(t){return si(t).activeElement===t}function sd(t={}){const{id:e,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:a,defaultIsOpen:l,onClose:u,onOpen:c,placement:d="bottom-start",lazyBehavior:p="unmount",direction:h,computePositionOnMount:b=!1,...f}=t,y=j.useRef(null),m=j.useRef(null),w=td(),_=j.useCallback(()=>{requestAnimationFrame(()=>{var te;(te=y.current)==null||te.focus({preventScroll:!1})})},[]),k=j.useCallback(()=>{const te=setTimeout(()=>{var J;if(o)(J=o.current)==null||J.focus();else{const G=w.firstEnabled();G&&B(G.index)}});X.current.add(te)},[w,o]),x=j.useCallback(()=>{const te=setTimeout(()=>{const J=w.lastEnabled();J&&B(J.index)});X.current.add(te)},[w]),I=j.useCallback(()=>{c==null||c(),s?k():_()},[s,k,_,c]),{isOpen:E,onOpen:N,onClose:D,onToggle:R}=Es({isOpen:a,defaultIsOpen:l,onClose:u,onOpen:I});Xu({enabled:E&&r,ref:y,handler:te=>{var J;(J=m.current)!=null&&J.contains(te.target)||D()}});const K=xs({...f,enabled:E||b,placement:d,direction:h}),[P,B]=j.useState(-1);$r(()=>{E||B(-1)},[E]),Va(y,{focusRef:m,visible:E,shouldFocus:!0});const v=oi({isOpen:E,ref:y}),[T,H]=od(e,"menu-button","menu-list"),A=j.useCallback(()=>{N(),_()},[N,_]),X=j.useRef(new Set([]));j.useEffect(()=>{const te=X.current;return()=>{te.forEach(J=>clearTimeout(J)),te.clear()}},[]);const $=j.useCallback(()=>{N(),k()},[k,N]),ne=j.useCallback(()=>{N(),x()},[N,x]),z=j.useCallback(()=>{var te,J;const G=si(y.current),me=(te=y.current)==null?void 0:te.contains(G.activeElement);if(!(E&&!me))return;const ie=(J=w.item(P))==null?void 0:J.node;ie==null||ie.focus({preventScroll:!0})},[E,P,w]),M=j.useRef(null);return{openAndFocusMenu:A,openAndFocusFirstItem:$,openAndFocusLastItem:ne,onTransitionEnd:z,unstable__animationState:v,descendants:w,popper:K,buttonId:T,menuId:H,forceUpdate:K.forceUpdate,orientation:"vertical",isOpen:E,onToggle:R,onOpen:N,onClose:D,menuRef:y,buttonRef:m,focusedIndex:P,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:B,isLazy:i,lazyBehavior:p,initialFocusRef:o,rafId:M}}function op(t={},e=null){const n=qn(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,a=j.useCallback(l=>{const u=l.key,d={Enter:s,ArrowDown:s,ArrowUp:i}[u];d&&(l.preventDefault(),l.stopPropagation(),d(l))},[s,i]);return{...t,ref:Te(n.buttonRef,e,o.referenceRef),id:n.buttonId,"data-active":ot(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:Oe(t.onClick,r),onKeyDown:Oe(t.onKeyDown,a)}}function Eo(t){var e;return ld(t)&&!!((e=t==null?void 0:t.getAttribute("role"))!=null&&e.startsWith("menuitem"))}function ad(t={},e=null){const n=qn();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:i,onClose:a,menuId:l,isLazy:u,lazyBehavior:c,unstable__animationState:d}=n,p=ed(),h=Cc({preventDefault:m=>m.key!==" "&&Eo(m.target)}),b=j.useCallback(m=>{if(!m.currentTarget.contains(m.target))return;const w=m.key,k={Tab:I=>I.preventDefault(),Escape:a,ArrowDown:()=>{const I=p.nextEnabled(r);I&&o(I.index)},ArrowUp:()=>{const I=p.prevEnabled(r);I&&o(I.index)}}[w];if(k){m.preventDefault(),k(m);return}const x=h(I=>{const E=Sc(p.values(),I,N=>{var D,R;return(R=(D=N==null?void 0:N.node)==null?void 0:D.textContent)!=null?R:""},p.item(r));if(E){const N=p.indexOf(E.node);o(N)}});Eo(m.target)&&x(m)},[p,r,h,a,o]),f=j.useRef(!1);i&&(f.current=!0);const y=Cs({wasSelected:f.current,enabled:u,mode:c,isSelected:d.present});return{...t,ref:Te(s,e),children:y?t.children:null,tabIndex:-1,role:"menu",id:l,style:{...t.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:Oe(t.onKeyDown,b)}}function id(t={}){const{popper:e,isOpen:n}=qn();return e.getPopperProps({...t,style:{visibility:n?"visible":"hidden",...t.style}})}function ai(t={},e=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:a,isFocusable:l,closeOnSelect:u,type:c,...d}=t,p=qn(),{setFocusedIndex:h,focusedIndex:b,closeOnSelect:f,onClose:y,menuRef:m,isOpen:w,menuId:_,rafId:k}=p,x=j.useRef(null),I=`${_}-menuitem-${j.useId()}`,{index:E,register:N}=nd({disabled:a&&!l}),D=j.useCallback(A=>{n==null||n(A),!a&&h(E)},[h,E,a,n]),R=j.useCallback(A=>{r==null||r(A),x.current&&!aa(x.current)&&D(A)},[D,r]),K=j.useCallback(A=>{o==null||o(A),!a&&h(-1)},[h,a,o]),P=j.useCallback(A=>{s==null||s(A),Eo(A.currentTarget)&&(u??f)&&y()},[y,s,f,u]),B=j.useCallback(A=>{i==null||i(A),h(E)},[h,i,E]),v=E===b,T=a&&!l;$r(()=>{if(w)return v&&!T&&x.current?(k.current&&cancelAnimationFrame(k.current),k.current=requestAnimationFrame(()=>{var A;(A=x.current)==null||A.focus({preventScroll:!0}),k.current=null})):m.current&&!aa(m.current)&&m.current.focus({preventScroll:!0}),()=>{k.current&&cancelAnimationFrame(k.current)}},[v,T,m,w]);const H=Ha({onClick:P,onFocus:B,onMouseEnter:D,onMouseMove:R,onMouseLeave:K,ref:Te(N,x,e),isDisabled:a,isFocusable:l});return{...d,...H,type:c??H.type,id:I,role:"menuitem",tabIndex:v?0:-1}}function sp(t={},e=null){const{type:n="radio",isChecked:r,...o}=t;return{...ai(o,e),role:`menuitem${n}`,"aria-checked":r}}function ap(t={}){const{children:e,type:n="radio",value:r,defaultValue:o,onChange:s,...i}=t,l=n==="radio"?"":[],[u,c]=Fa({defaultValue:o??l,value:r,onChange:s}),d=j.useCallback(b=>{if(n==="radio"&&typeof u=="string"&&c(b),n==="checkbox"&&Array.isArray(u)){const f=u.includes(b)?u.filter(y=>y!==b):u.concat(b);c(f)}},[u,c,n]),h=ps(e).map(b=>{if(b.type.id!=="MenuItemOption")return b;const f=m=>{var w,_;d(b.props.value),(_=(w=b.props).onClick)==null||_.call(w,m)},y=n==="radio"?b.props.value===u:u.includes(b.props.value);return j.cloneElement(b,{type:n,onClick:f,isChecked:y})});return{...i,children:h}}function ld(t){var e;if(!cd(t))return!1;const n=(e=t.ownerDocument.defaultView)!=null?e:window;return t instanceof n.HTMLElement}function cd(t){return t!=null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}var[ud,Gr]=et({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Ss=t=>{const{children:e}=t,n=jt("Menu",t),r=tt(t),{direction:o}=ss(),{descendants:s,...i}=sd({...r,direction:o}),a=j.useMemo(()=>i,[i]),{isOpen:l,onClose:u,forceUpdate:c}=a;return O.jsx(Qu,{value:s,children:O.jsx(rd,{value:a,children:O.jsx(ud,{value:n,children:Ea(e,{isOpen:l,onClose:u,forceUpdate:c})})})})};Ss.displayName="Menu";var ii=fe((t,e)=>{const n=Gr();return O.jsx(de.span,{ref:e,...t,__css:n.command,className:"chakra-menu__command"})});ii.displayName="MenuCommand";var dd=fe((t,e)=>{const{type:n,...r}=t,o=Gr(),s=r.as||n?n??void 0:"button",i=j.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return O.jsx(de.button,{ref:e,type:s,...r,__css:i})}),li=t=>{const{className:e,children:n,...r}=t,o=Gr(),s=j.Children.only(n),i=j.isValidElement(s)?j.cloneElement(s,{focusable:"false","aria-hidden":!0,className:ke("chakra-menu__icon",s.props.className)}):null,a=ke("chakra-menu__icon-wrapper",e);return O.jsx(de.span,{className:a,...r,__css:o.icon,children:i})};li.displayName="MenuIcon";var bt=fe((t,e)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...a}=t,l=ai(a,e),c=n||o?O.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return O.jsxs(dd,{...l,className:ke("chakra-menu__menuitem",l.className),children:[n&&O.jsx(li,{fontSize:"0.8em",marginEnd:r,children:n}),c,o&&O.jsx(ii,{marginStart:s,children:o})]})});bt.displayName="MenuItem";var fd={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},hd=de(as.div),Os=fe(function(e,n){var r,o;const{rootProps:s,motionProps:i,...a}=e,{isOpen:l,onTransitionEnd:u,unstable__animationState:c}=qn(),d=ad(a,n),p=id(s),h=Gr();return O.jsx(de.div,{...p,__css:{zIndex:(o=e.zIndex)!=null?o:(r=h.list)==null?void 0:r.zIndex},children:O.jsx(hd,{variants:fd,initial:!1,animate:l?"enter":"exit",__css:{outline:0,...h.list},...i,className:ke("chakra-menu__menu-list",d.className),...d,onUpdate:u,onAnimationComplete:Ca(c.onComplete,d.onAnimationComplete)})})});Os.displayName="MenuList";var[pd,Hn]=et({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[md,Is]=et({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function ci(t){const e=j.Children.only(t.children),{getTriggerProps:n}=Hn();return j.cloneElement(e,n(e.props,e.ref))}ci.displayName="PopoverTrigger";var Xt={click:"click",hover:"hover"};function yd(t={}){const{closeOnBlur:e=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:a,arrowShadowColor:l,trigger:u=Xt.click,openDelay:c=200,closeDelay:d=200,isLazy:p,lazyBehavior:h="unmount",computePositionOnMount:b,...f}=t,{isOpen:y,onClose:m,onOpen:w,onToggle:_}=Es(t),k=j.useRef(null),x=j.useRef(null),I=j.useRef(null),E=j.useRef(!1),N=j.useRef(!1);y&&(N.current=!0);const[D,R]=j.useState(!1),[K,P]=j.useState(!1),B=j.useId(),v=o??B,[T,H,A,X]=["popover-trigger","popover-content","popover-header","popover-body"].map(U=>`${U}-${v}`),{referenceRef:$,getArrowProps:ne,getPopperProps:z,getArrowInnerProps:M,forceUpdate:te}=xs({...f,enabled:y||!!b}),J=oi({isOpen:y,ref:I});lc({enabled:y,ref:x}),Va(I,{focusRef:x,visible:y,shouldFocus:s&&u===Xt.click}),Pc(I,{focusRef:r,visible:y,shouldFocus:i&&u===Xt.click});const G=Cs({wasSelected:N.current,enabled:p,mode:h,isSelected:J.present}),me=j.useCallback((U={},W=null)=>{const S={...U,style:{...U.style,transformOrigin:Ae.transformOrigin.varRef,[Ae.arrowSize.var]:a?`${a}px`:void 0,[Ae.arrowShadowColor.var]:l},ref:Te(I,W),children:G?U.children:null,id:H,tabIndex:-1,role:"dialog",onKeyDown:Oe(U.onKeyDown,C=>{n&&C.key==="Escape"&&m()}),onBlur:Oe(U.onBlur,C=>{const F=ia(C),V=ao(I.current,F),Z=ao(x.current,F);y&&e&&(!V&&!Z)&&m()}),"aria-labelledby":D?A:void 0,"aria-describedby":K?X:void 0};return u===Xt.hover&&(S.role="tooltip",S.onMouseEnter=Oe(U.onMouseEnter,()=>{E.current=!0}),S.onMouseLeave=Oe(U.onMouseLeave,C=>{C.nativeEvent.relatedTarget!==null&&(E.current=!1,setTimeout(()=>m(),d))})),S},[G,H,D,A,K,X,u,n,m,y,e,d,l,a]),we=j.useCallback((U={},W=null)=>z({...U,style:{visibility:y?"visible":"hidden",...U.style}},W),[y,z]),ie=j.useCallback((U,W=null)=>({...U,ref:Te(W,k,$)}),[k,$]),ue=j.useRef(),_e=j.useRef(),ye=j.useCallback(U=>{k.current==null&&$(U)},[$]),pe=j.useCallback((U={},W=null)=>{const S={...U,ref:Te(x,W,ye),id:T,"aria-haspopup":"dialog","aria-expanded":y,"aria-controls":H};return u===Xt.click&&(S.onClick=Oe(U.onClick,_)),u===Xt.hover&&(S.onFocus=Oe(U.onFocus,()=>{ue.current===void 0&&w()}),S.onBlur=Oe(U.onBlur,C=>{const F=ia(C),V=!ao(I.current,F);y&&e&&V&&m()}),S.onKeyDown=Oe(U.onKeyDown,C=>{C.key==="Escape"&&m()}),S.onMouseEnter=Oe(U.onMouseEnter,()=>{E.current=!0,ue.current=window.setTimeout(()=>w(),c)}),S.onMouseLeave=Oe(U.onMouseLeave,()=>{E.current=!1,ue.current&&(clearTimeout(ue.current),ue.current=void 0),_e.current=window.setTimeout(()=>{E.current===!1&&m()},d)})),S},[T,y,H,u,ye,_,w,e,m,c,d]);j.useEffect(()=>()=>{ue.current&&clearTimeout(ue.current),_e.current&&clearTimeout(_e.current)},[]);const xe=j.useCallback((U={},W=null)=>({...U,id:A,ref:Te(W,S=>{R(!!S)})}),[A]),g=j.useCallback((U={},W=null)=>({...U,id:X,ref:Te(W,S=>{P(!!S)})}),[X]);return{forceUpdate:te,isOpen:y,onAnimationComplete:J.onComplete,onClose:m,getAnchorProps:ie,getArrowProps:ne,getArrowInnerProps:M,getPopoverPositionerProps:we,getPopoverProps:me,getTriggerProps:pe,getHeaderProps:xe,getBodyProps:g}}function ao(t,e){return t===e||(t==null?void 0:t.contains(e))}function ia(t){var e;const n=t.currentTarget.ownerDocument.activeElement;return(e=t.relatedTarget)!=null?e:n}function ui(t){const e=jt("Popover",t),{children:n,...r}=tt(t),o=ss(),s=yd({...r,direction:o.direction});return O.jsx(pd,{value:s,children:O.jsx(md,{value:e,children:Ea(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}ui.displayName="Popover";var di=fe(function(e,n){const{getBodyProps:r}=Hn(),o=Is();return O.jsx(de.div,{...r(e,n),className:ke("chakra-popover__body",e.className),__css:o.body})});di.displayName="PopoverBody";var fi=fe(function(e,n){const{onClose:r}=Hn(),o=Is();return O.jsx(Ol,{size:"sm",onClick:r,className:ke("chakra-popover__close-btn",e.className),__css:o.closeButton,ref:n,...e})});fi.displayName="PopoverCloseButton";function vd(t){if(t)return{enter:{...t.enter,visibility:"visible"},exit:{...t.exit,transitionEnd:{visibility:"hidden"}}}}var gd={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},wd=de(as.section),hi=fe(function(e,n){const{variants:r=gd,...o}=e,{isOpen:s}=Hn();return O.jsx(wd,{ref:n,variants:vd(r),initial:!1,animate:s?"enter":"exit",...o})});hi.displayName="PopoverTransition";var pi=fe(function(e,n){const{rootProps:r,motionProps:o,...s}=e,{getPopoverProps:i,getPopoverPositionerProps:a,onAnimationComplete:l}=Hn(),u=Is(),c={position:"relative",display:"flex",flexDirection:"column",...u.content};return O.jsx(de.div,{...a(r),__css:u.popper,className:"chakra-popover__popper",children:O.jsx(hi,{...o,...i(s,n),onAnimationComplete:Ca(l,s.onAnimationComplete),className:ke("chakra-popover__content",e.className),__css:c})})});pi.displayName="PopoverContent";var[bd,_d,kd,xd]=Na();function Ed(t){var e;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:a="unmount",orientation:l="horizontal",direction:u="ltr",...c}=t,[d,p]=j.useState(n??0),[h,b]=Fa({defaultValue:n??0,value:o,onChange:r});j.useEffect(()=>{o!=null&&p(o)},[o]);const f=kd(),y=j.useId();return{id:`tabs-${(e=t.id)!=null?e:y}`,selectedIndex:h,focusedIndex:d,setSelectedIndex:b,setFocusedIndex:p,isManual:s,isLazy:i,lazyBehavior:a,orientation:l,descendants:f,direction:u,htmlProps:c}}var[Cd,Yr]=et({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function Sd(t){const{focusedIndex:e,orientation:n,direction:r}=Yr(),o=_d(),s=j.useCallback(i=>{const a=()=>{var w;const _=o.nextEnabled(e);_&&((w=_.node)==null||w.focus())},l=()=>{var w;const _=o.prevEnabled(e);_&&((w=_.node)==null||w.focus())},u=()=>{var w;const _=o.firstEnabled();_&&((w=_.node)==null||w.focus())},c=()=>{var w;const _=o.lastEnabled();_&&((w=_.node)==null||w.focus())},d=n==="horizontal",p=n==="vertical",h=i.key,b=r==="ltr"?"ArrowLeft":"ArrowRight",f=r==="ltr"?"ArrowRight":"ArrowLeft",m={[b]:()=>d&&l(),[f]:()=>d&&a(),ArrowDown:()=>p&&a(),ArrowUp:()=>p&&l(),Home:u,End:c}[h];m&&(i.preventDefault(),m(i))},[o,e,n,r]);return{...t,role:"tablist","aria-orientation":n,onKeyDown:Oe(t.onKeyDown,s)}}function Od(t){const{isDisabled:e=!1,isFocusable:n=!1,...r}=t,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:a,selectedIndex:l}=Yr(),{index:u,register:c}=xd({disabled:e&&!n}),d=u===l,p=()=>{o(u)},h=()=>{a(u),!s&&!(e&&n)&&o(u)},b=Ha({...r,ref:Te(c,t.ref),isDisabled:e,isFocusable:n,onClick:Oe(t.onClick,p)}),f="button";return{...b,id:mi(i,u),role:"tab",tabIndex:d?0:-1,type:f,"aria-selected":d,"aria-controls":yi(i,u),onFocus:e?void 0:Oe(t.onFocus,h)}}var[Id,Dd]=et({});function Pd(t){const e=Yr(),{id:n,selectedIndex:r}=e,s=ps(t.children).map((i,a)=>j.createElement(Id,{key:a,value:{isSelected:a===r,id:yi(n,a),tabId:mi(n,a),selectedIndex:r}},i));return{...t,children:s}}function jd(t){const{children:e,...n}=t,{isLazy:r,lazyBehavior:o}=Yr(),{isSelected:s,id:i,tabId:a}=Dd(),l=j.useRef(!1);s&&(l.current=!0);const u=Cs({wasSelected:l.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:u?e:null,role:"tabpanel","aria-labelledby":a,hidden:!s,id:i}}function mi(t,e){return`${t}--tab-${e}`}function yi(t,e){return`${t}--tabpanel-${e}`}var[Ad,Jr]=et({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),vi=fe(function(e,n){const r=jt("Tabs",e),{children:o,className:s,...i}=tt(e),{htmlProps:a,descendants:l,...u}=Ed(i),c=j.useMemo(()=>u,[u]),{isFitted:d,...p}=a,h={position:"relative",...r.root};return O.jsx(bd,{value:l,children:O.jsx(Cd,{value:c,children:O.jsx(Ad,{value:r,children:O.jsx(de.div,{className:ke("chakra-tabs",s),ref:n,...p,__css:h,children:o})})})})});vi.displayName="Tabs";var gi=fe(function(e,n){const r=Sd({...e,ref:n}),s={display:"flex",...Jr().tablist};return O.jsx(de.div,{...r,className:ke("chakra-tabs__tablist",e.className),__css:s})});gi.displayName="TabList";var Co=fe(function(e,n){const r=jd({...e,ref:n}),o=Jr();return O.jsx(de.div,{outline:"0",...r,className:ke("chakra-tabs__tab-panel",e.className),__css:o.tabpanel})});Co.displayName="TabPanel";var wi=fe(function(e,n){const r=Pd(e),o=Jr();return O.jsx(de.div,{...r,width:"100%",ref:n,className:ke("chakra-tabs__tab-panels",e.className),__css:o.tabpanels})});wi.displayName="TabPanels";var So=fe(function(e,n){const r=Jr(),o=Od({...e,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return O.jsx(de.button,{...o,className:ke("chakra-tabs__tab",e.className),__css:s})});So.displayName="Tab";var[Nd,bi]=et({name:"TagStylesContext",errorMessage:`useTagStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Xr=fe((t,e)=>{const n=jt("Tag",t),r=tt(t),o={display:"inline-flex",verticalAlign:"top",alignItems:"center",maxWidth:"100%",...n.container};return O.jsx(Nd,{value:n,children:O.jsx(de.span,{ref:e,...r,__css:o})})});Xr.displayName="Tag";var Fd=fe((t,e)=>{const n=bi();return O.jsx(de.span,{ref:e,noOfLines:1,...t,__css:n.label})});Fd.displayName="TagLabel";var Rd=fe((t,e)=>O.jsx(Ur,{ref:e,verticalAlign:"top",marginEnd:"0.5rem",...t}));Rd.displayName="TagLeftIcon";var Td=fe((t,e)=>O.jsx(Ur,{ref:e,verticalAlign:"top",marginStart:"0.5rem",...t}));Td.displayName="TagRightIcon";var _i=t=>O.jsx(Ur,{verticalAlign:"inherit",viewBox:"0 0 512 512",...t,children:O.jsx("path",{fill:"currentColor",d:"M289.94 256l95-95A24 24 0 00351 127l-95 95-95-95a24 24 0 00-34 34l95 95-95 95a24 24 0 1034 34l95-95 95 95a24 24 0 0034-34z"})});_i.displayName="TagCloseIcon";var Bd=fe((t,e)=>{const{isDisabled:n,children:r,...o}=t,i={display:"flex",alignItems:"center",justifyContent:"center",outline:"0",...bi().closeButton};return O.jsx(de.button,{ref:e,"aria-label":"close",...o,type:"button",disabled:n,__css:i,children:r||O.jsx(_i,{})})});Bd.displayName="TagCloseButton";var Md={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},Oo=t=>{var e;return((e=t.current)==null?void 0:e.ownerDocument)||document},ur=t=>{var e,n;return((n=(e=t.current)==null?void 0:e.ownerDocument)==null?void 0:n.defaultView)||window};function zd(t={}){const{openDelay:e=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:a=!0,onOpen:l,onClose:u,placement:c,id:d,isOpen:p,defaultIsOpen:h,arrowSize:b=10,arrowShadowColor:f,arrowPadding:y,modifiers:m,isDisabled:w,gutter:_,offset:k,direction:x,...I}=t,{isOpen:E,onOpen:N,onClose:D}=Es({isOpen:p,defaultIsOpen:h,onOpen:l,onClose:u}),{referenceRef:R,getPopperProps:K,getArrowInnerProps:P,getArrowProps:B}=xs({enabled:E,placement:c,arrowPadding:y,modifiers:m,gutter:_,offset:k,direction:x}),v=j.useId(),H=`tooltip-${d??v}`,A=j.useRef(null),X=j.useRef(),$=j.useCallback(()=>{X.current&&(clearTimeout(X.current),X.current=void 0)},[]),ne=j.useRef(),z=j.useCallback(()=>{ne.current&&(clearTimeout(ne.current),ne.current=void 0)},[]),M=j.useCallback(()=>{z(),D()},[D,z]),te=Ld(A,M),J=j.useCallback(()=>{if(!w&&!X.current){E&&te();const pe=ur(A);X.current=pe.setTimeout(N,e)}},[te,w,E,N,e]),G=j.useCallback(()=>{$();const pe=ur(A);ne.current=pe.setTimeout(M,n)},[n,M,$]),me=j.useCallback(()=>{E&&r&&G()},[r,G,E]),we=j.useCallback(()=>{E&&i&&G()},[i,G,E]),ie=j.useCallback(pe=>{E&&pe.key==="Escape"&&G()},[E,G]);nn(()=>Oo(A),"keydown",a?ie:void 0),nn(()=>{if(!s)return null;const pe=A.current;if(!pe)return null;const xe=Ka(pe);return xe.localName==="body"?ur(A):xe},"scroll",()=>{E&&s&&M()},{passive:!0,capture:!0}),j.useEffect(()=>{w&&($(),E&&D())},[w,E,D,$]),j.useEffect(()=>()=>{$(),z()},[$,z]),nn(()=>A.current,"pointerleave",G);const ue=j.useCallback((pe={},xe=null)=>({...pe,ref:Te(A,xe,R),onPointerEnter:Oe(pe.onPointerEnter,U=>{U.pointerType!=="touch"&&J()}),onClick:Oe(pe.onClick,me),onPointerDown:Oe(pe.onPointerDown,we),onFocus:Oe(pe.onFocus,J),onBlur:Oe(pe.onBlur,G),"aria-describedby":E?H:void 0}),[J,G,we,E,H,me,R]),_e=j.useCallback((pe={},xe=null)=>K({...pe,style:{...pe.style,[Ae.arrowSize.var]:b?`${b}px`:void 0,[Ae.arrowShadowColor.var]:f}},xe),[K,b,f]),ye=j.useCallback((pe={},xe=null)=>{const g={...pe.style,position:"relative",transformOrigin:Ae.transformOrigin.varRef};return{ref:xe,...I,...pe,id:H,role:"tooltip",style:g}},[I,H]);return{isOpen:E,show:J,hide:G,getTriggerProps:ue,getTooltipProps:ye,getTooltipPositionerProps:_e,getArrowProps:B,getArrowInnerProps:P}}var io="chakra-ui:close-tooltip";function Ld(t,e){return j.useEffect(()=>{const n=Oo(t);return n.addEventListener(io,e),()=>n.removeEventListener(io,e)},[e,t]),()=>{const n=Oo(t),r=ur(t);n.dispatchEvent(new r.CustomEvent(io))}}function Wd(t,e=[]){const n=Object.assign({},t);for(const r of e)r in n&&delete n[r];return n}function Ud(t,e){const n={};for(const r of e)r in t&&(n[r]=t[r]);return n}var Kd=de(as.div),Ht=fe((t,e)=>{var n,r;const o=Kr("Tooltip",t),s=tt(t),i=ss(),{children:a,label:l,shouldWrapChildren:u,"aria-label":c,hasArrow:d,bg:p,portalProps:h,background:b,backgroundColor:f,bgColor:y,motionProps:m,...w}=s,_=(r=(n=b??f)!=null?n:p)!=null?r:y;if(_){o.bg=_;const K=Il(i,"colors",_);o[Ae.arrowBg.var]=K}const k=zd({...w,direction:i.direction}),x=typeof a=="string"||u;let I;if(x)I=O.jsx(de.span,{display:"inline-block",tabIndex:0,...k.getTriggerProps(),children:a});else{const K=j.Children.only(a);I=j.cloneElement(K,k.getTriggerProps(K.props,K.ref))}const E=!!c,N=k.getTooltipProps({},e),D=E?Wd(N,["role","id"]):N,R=Ud(N,["role","id"]);return l?O.jsxs(O.Fragment,{children:[I,O.jsx(Dl,{children:k.isOpen&&O.jsx(Sa,{...h,children:O.jsx(de.div,{...k.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:O.jsxs(Kd,{variants:Md,initial:"exit",animate:"enter",exit:"exit",...m,...D,__css:o,children:[l,E&&O.jsx(de.span,{srOnly:!0,...R,children:c}),d&&O.jsx(de.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:O.jsx(de.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):O.jsx(O.Fragment,{children:a})});Ht.displayName="Tooltip";const $d="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Fn=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=$d[n[t]&63];return e},Pe=null;const ki=location.pathname.split("/").slice(0,-1).join("/");let Er=null;At(()=>import(ki+"/scripts/api.js"),__vite__mapDeps([])).then(t=>{Er=t==null?void 0:t.api});At(()=>import(ki+"/scripts/app.js"),__vite__mapDeps([])).then(t=>{Pe=t==null?void 0:t.app});function Ie(t,e){if(Er==null)throw console.error("api is null!"),new Error("api is null!");return Er.fetchApi(t,e)}async function qd(t){console.warn("[workspace deprecated] getDB is deprecated",t);try{const e=await Ie(`/workspace/get_db?table=${t}`);return e.ok?await e.json():void 0}catch(e){console.error("Error fetching workspace:",e);return}}async function Hd(t,e){try{return await(await Ie("/workspace/save_db",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:t,json:e})})).text()}catch(n){console.error("Error saving workspace:",n)}}async function ip(t){try{return await(await Ie("/workspace/get_system_dir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({absolute_dir:t??""})})).json()}catch(e){console.error("Error getting workflows dir:",e)}}async function lp(){try{return await(await Ie("/workspace/open_workflow_file_browser",{method:"POST",headers:{"Content-Type":"application/json"}})).json()}catch(t){console.error("Error open workflows folder:",t)}}async function Vd(){const e=await(await Ie("/workspace/get_my_workflows_dir")).json();return e.error&&alert(`Failed to fetch my workflows path: ${e.error}`),e}async function cp(){try{return await(await Ie("/model_manager/get_model_list",{method:"GET",headers:{"Content-Type":"application/json"}})).json()}catch(t){console.error("Error get all models list:",t)}}async function up(){try{return await(await Ie("/model_manager/get_folder_list",{method:"GET",headers:{"Content-Type":"application/json"}})).json()}catch(t){console.error("Error get all models list:",t)}}async function dp(t){try{return await(await Ie("/model_manager/cancel_installation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({save_path:t})})).text()}catch(e){console.error("Error move file:",e)}}async function fp(t,e){try{return await(await Ie("/workspace/copy_json_files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({src:t,dst:e})})).json()}catch(n){console.error("Error copy flows to new directory:",n)}}const Zd="backup",Cr="workspace";let er=null;function Gd(){return new Promise((t,e)=>{const n=indexedDB.open("WorkspaceDB",3);n.onupgradeneeded=r=>{const o=r.target.result;o.objectStoreNames.contains(Cr)||o.createObjectStore(Cr,{keyPath:"id"})},n.onsuccess=r=>{t(r.target.result)},n.onerror=r=>{e(r.target.error)}})}async function Yd(){try{return er==null&&(er=await Gd()),new Promise((t,e)=>{if(er==null)return e("indexDB is null");const o=er.transaction([Cr],"readonly").objectStore(Cr).get(Zd);o.onsuccess=()=>{o.result?t(o.result.value):t(void 0)},o.onerror=()=>e(o.error)})}catch(t){console.error("Error while reading from database:",t)}}async function Jd(){try{return await Yd()}catch(t){console.error("Error retrieving data from IndexedDB:",t)}}const Ee=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ne=Object.keys,Me=Array.isArray;function We(t,e){return typeof e!="object"||Ne(e).forEach(function(n){t[n]=e[n]}),t}typeof Promise>"u"||Ee.Promise||(Ee.Promise=Promise);const Rn=Object.getPrototypeOf,Xd={}.hasOwnProperty;function Ze(t,e){return Xd.call(t,e)}function fn(t,e){typeof e=="function"&&(e=e(Rn(t))),(typeof Reflect>"u"?Ne:Reflect.ownKeys)(e).forEach(n=>{mt(t,n,e[n])})}const xi=Object.defineProperty;function mt(t,e,n,r){xi(t,e,We(n&&Ze(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function on(t){return{from:function(e){return t.prototype=Object.create(e.prototype),mt(t.prototype,"constructor",t),{extend:fn.bind(null,t.prototype)}}}}const Qd=Object.getOwnPropertyDescriptor;function Ds(t,e){let n;return Qd(t,e)||(n=Rn(t))&&Ds(n,e)}const ef=[].slice;function Sr(t,e,n){return ef.call(t,e,n)}function Ei(t,e){return e(t)}function _n(t){if(!t)throw new Error("Assertion Failed")}function Ci(t){Ee.setImmediate?setImmediate(t):setTimeout(t,0)}function Si(t,e){return t.reduce((n,r,o)=>{var s=e(r,o);return s&&(n[s[0]]=s[1]),n},{})}function yt(t,e){if(Ze(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var n=[],r=0,o=e.length;r["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>Ee[t]),nf=Di.map(t=>Ee[t]);Si(Di,t=>[t,!0]);let kt=null;function Vn(t){kt=typeof WeakMap<"u"&&new WeakMap;const e=Io(t);return kt=null,e}function Io(t){if(!t||typeof t!="object")return t;let e=kt&&kt.get(t);if(e)return e;if(Me(t)){e=[],kt&&kt.set(t,e);for(var n=0,r=t.length;n=0)e=t;else{const s=Rn(t);for(var o in e=s===Object.prototype?{}:Object.create(s),kt&&kt.set(t,e),t)Ze(t,o)&&(e[o]=Io(t[o]))}return e}const{toString:rf}={};function Do(t){return rf.call(t).slice(8,-1)}const Po=typeof Symbol<"u"?Symbol.iterator:"@@iterator",of=typeof Po=="symbol"?function(t){var e;return t!=null&&(e=t[Po])&&e.apply(t)}:function(){return null},tn={};function ht(t){var e,n,r,o;if(arguments.length===1){if(Me(t))return t.slice();if(this===tn&&typeof t=="string")return[t];if(o=of(t)){for(n=[];!(r=o.next()).done;)n.push(r.value);return n}if(t==null)return[t];if(typeof(e=t.length)=="number"){for(n=new Array(e);e--;)n[e]=t[e];return n}return[t]}for(e=arguments.length,n=new Array(e);e--;)n[e]=arguments[e];return n}const Ps=typeof Symbol<"u"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1;var ct=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Pi(t,e){ct=t,ji=e}var ji=()=>!0;const sf=!new Error("").stack;function Gt(){if(sf)try{throw Gt.arguments,new Error}catch(t){return t}return new Error}function jo(t,e){var n=t.stack;return n?(e=e||0,n.indexOf(t.name)===0&&(e+=(t.name+t.message).split(` +`).length),n.split(` +`).slice(e).filter(ji).map(r=>` +`+r).join("")):""}var Ai=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],js=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Ai),af={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function sn(t,e){this._e=Gt(),this.name=t,this.message=e}function Ni(t,e){return t+". Errors: "+Object.keys(e).map(n=>e[n].toString()).filter((n,r,o)=>o.indexOf(n)===r).join(` +`)}function Or(t,e,n,r){this._e=Gt(),this.failures=e,this.failedKeys=r,this.successCount=n,this.message=Ni(t,e)}function Sn(t,e){this._e=Gt(),this.name="BulkError",this.failures=Object.keys(e).map(n=>e[n]),this.failuresByPos=e,this.message=Ni(t,e)}on(sn).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+jo(this._e,2))}},toString:function(){return this.name+": "+this.message}}),on(Or).from(sn),on(Sn).from(sn);var As=js.reduce((t,e)=>(t[e]=e+"Error",t),{});const lf=sn;var le=js.reduce((t,e)=>{var n=e+"Error";function r(o,s){this._e=Gt(),this.name=n,o?typeof o=="string"?(this.message=`${o}${s?` + `+s:""}`,this.inner=s||null):typeof o=="object"&&(this.message=`${o.name} ${o.message}`,this.inner=o):(this.message=af[e]||n,this.inner=null)}return on(r).from(lf),t[e]=r,t},{});le.Syntax=SyntaxError,le.Type=TypeError,le.Range=RangeError;var la=Ai.reduce((t,e)=>(t[e+"Error"]=le[e],t),{}),dr=js.reduce((t,e)=>(["Syntax","Type","Range"].indexOf(e)===-1&&(t[e+"Error"]=le[e]),t),{});function be(){}function Tn(t){return t}function cf(t,e){return t==null||t===Tn?e:function(n){return e(t(n))}}function Vt(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function uf(t,e){return t===be?e:function(){var n=t.apply(this,arguments);n!==void 0&&(arguments[0]=n);var r=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var s=e.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?Vt(r,this.onsuccess):r),o&&(this.onerror=this.onerror?Vt(o,this.onerror):o),s!==void 0?s:n}}function df(t,e){return t===be?e:function(){t.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,e.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?Vt(n,this.onsuccess):n),r&&(this.onerror=this.onerror?Vt(r,this.onerror):r)}}function ff(t,e){return t===be?e:function(n){var r=t.apply(this,arguments);We(n,r);var o=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var i=e.apply(this,arguments);return o&&(this.onsuccess=this.onsuccess?Vt(o,this.onsuccess):o),s&&(this.onerror=this.onerror?Vt(s,this.onerror):s),r===void 0?i===void 0?void 0:i:We(r,i)}}function hf(t,e){return t===be?e:function(){return e.apply(this,arguments)!==!1&&t.apply(this,arguments)}}function Ns(t,e){return t===be?e:function(){var n=t.apply(this,arguments);if(n&&typeof n.then=="function"){for(var r=this,o=arguments.length,s=new Array(o);o--;)s[o]=arguments[o];return n.then(function(){return e.apply(r,s)})}return e.apply(this,arguments)}}dr.ModifyError=Or,dr.DexieError=sn,dr.BulkError=Sn;var Bn={};const Fi=100,[Ao,Ir,No]=typeof Promise>"u"?[]:(()=>{let t=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[t,Rn(t),t];const e=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[e,Rn(e),t]})(),Ri=Ir&&Ir.then,fr=Ao&&Ao.constructor,Fs=!!No;var Fo=!1,pf=No?()=>{No.then(tr)}:Ee.setImmediate?setImmediate.bind(null,tr):Ee.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver(()=>{tr(),t=null}).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(tr,0)},On=function(t,e){kn.push([t,e]),Dr&&(pf(),Dr=!1)},Ro=!0,Dr=!0,Wt=[],hr=[],To=null,Bo=Tn,an={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:da,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(t=>{try{da(t[0],t[1])}catch{}})}},ae=an,kn=[],Ut=0,pr=[];function oe(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=be,this._lib=!1;var e=this._PSD=ae;if(ct&&(this._stackHolder=Gt(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==Bn)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&zo(this,this._value))}this._state=null,this._value=null,++e.ref,Bi(this,t)}const Mo={get:function(){var t=ae,e=Pr;function n(r,o){var s=!t.global&&(t!==ae||e!==Pr);const i=s&&!gt();var a=new oe((l,u)=>{Rs(this,new Ti(jr(r,t,s,i),jr(o,t,s,i),l,u,t))});return ct&&Li(a,this),a}return n.prototype=Bn,n},set:function(t){mt(this,"then",t&&t.prototype===Bn?Mo:{get:function(){return t},set:Mo.set})}};function Ti(t,e,n,r,o){this.onFulfilled=typeof t=="function"?t:null,this.onRejected=typeof e=="function"?e:null,this.resolve=n,this.reject=r,this.psd=o}function Bi(t,e){try{e(n=>{if(t._state===null){if(n===t)throw new TypeError("A promise cannot be resolved with itself.");var r=t._lib&&Zn();n&&typeof n.then=="function"?Bi(t,(o,s)=>{n instanceof oe?n._then(o,s):n.then(o,s)}):(t._state=!0,t._value=n,Mi(t)),r&&Gn()}},zo.bind(null,t))}catch(n){zo(t,n)}}function zo(t,e){if(hr.push(e),t._state===null){var n=t._lib&&Zn();e=Bo(e),t._state=!1,t._value=e,ct&&e!==null&&typeof e=="object"&&!e._promise&&function(r,o,s){try{r.apply(null,s)}catch(i){o&&o(i)}}(()=>{var r=Ds(e,"stack");e._promise=t,mt(e,"stack",{get:()=>Fo?r&&(r.get?r.get.apply(e):r.value):t.stack})}),function(r){Wt.some(o=>o._value===r._value)||Wt.push(r)}(t),Mi(t),n&&Gn()}}function Mi(t){var e=t._listeners;t._listeners=[];for(var n=0,r=e.length;n{--Ut==0&&Ts()},[]))}function Rs(t,e){if(t._state!==null){var n=t._state?e.onFulfilled:e.onRejected;if(n===null)return(t._state?e.resolve:e.reject)(t._value);++e.psd.ref,++Ut,On(mf,[n,t,e])}else t._listeners.push(e)}function mf(t,e,n){try{To=e;var r,o=e._value;e._state?r=t(o):(hr.length&&(hr=[]),r=t(o),hr.indexOf(o)===-1&&function(s){for(var i=Wt.length;i;)if(Wt[--i]._value===s._value)return void Wt.splice(i,1)}(e)),n.resolve(r)}catch(s){n.reject(s)}finally{To=null,--Ut==0&&Ts(),--n.psd.ref||n.psd.finalize()}}function zi(t,e,n){if(e.length===n)return e;var r="";if(t._state===!1){var o,s,i=t._value;i!=null?(o=i.name||"Error",s=i.message||i,r=jo(i,0)):(o=i,s=""),e.push(o+(s?": "+s:"")+r)}return ct&&((r=jo(t._stackHolder,2))&&e.indexOf(r)===-1&&e.push(r),t._prev&&zi(t._prev,e,n)),e}function Li(t,e){var n=e?e._numPrev+1:0;n<100&&(t._prev=e,t._numPrev=n)}function tr(){Zn()&&Gn()}function Zn(){var t=Ro;return Ro=!1,Dr=!1,t}function Gn(){var t,e,n;do for(;kn.length>0;)for(t=kn,kn=[],n=t.length,e=0;e0);Ro=!0,Dr=!0}function Ts(){var t=Wt;Wt=[],t.forEach(r=>{r._PSD.onunhandled.call(null,r._value,r)});for(var e=pr.slice(0),n=e.length;n;)e[--n]()}function nr(t){return new oe(Bn,!1,t)}function Ce(t,e){var n=ae;return function(){var r=Zn(),o=ae;try{return It(n,!0),t.apply(this,arguments)}catch(s){e&&e(s)}finally{It(o,!1),r&&Gn()}}}fn(oe.prototype,{then:Mo,_then:function(t,e){Rs(this,new Ti(null,null,t,e,ae))},catch:function(t){if(arguments.length===1)return this.then(null,t);var e=arguments[0],n=arguments[1];return typeof e=="function"?this.then(null,r=>r instanceof e?n(r):nr(r)):this.then(null,r=>r&&r.name===e?n(r):nr(r))},finally:function(t){return this.then(e=>(t(),e),e=>(t(),nr(e)))},stack:{get:function(){if(this._stack)return this._stack;try{Fo=!0;var t=zi(this,[],20).join(` +From previous: `);return this._state!==null&&(this._stack=t),t}finally{Fo=!1}}},timeout:function(t,e){return t<1/0?new oe((n,r)=>{var o=setTimeout(()=>r(new le.Timeout(e)),t);this.then(n,r).finally(clearTimeout.bind(null,o))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&mt(oe.prototype,Symbol.toStringTag,"Dexie.Promise"),an.env=Wi(),fn(oe,{all:function(){var t=ht.apply(null,arguments).map(rr);return new oe(function(e,n){t.length===0&&e([]);var r=t.length;t.forEach((o,s)=>oe.resolve(o).then(i=>{t[s]=i,--r||e(t)},n))})},resolve:t=>{if(t instanceof oe)return t;if(t&&typeof t.then=="function")return new oe((n,r)=>{t.then(n,r)});var e=new oe(Bn,!0,t);return Li(e,To),e},reject:nr,race:function(){var t=ht.apply(null,arguments).map(rr);return new oe((e,n)=>{t.map(r=>oe.resolve(r).then(e,n))})},PSD:{get:()=>ae,set:t=>ae=t},totalEchoes:{get:()=>Pr},newPSD:Ot,usePSD:mn,scheduler:{get:()=>On,set:t=>{On=t}},rejectionMapper:{get:()=>Bo,set:t=>{Bo=t}},follow:(t,e)=>new oe((n,r)=>Ot((o,s)=>{var i=ae;i.unhandleds=[],i.onunhandled=s,i.finalize=Vt(function(){(function(a){function l(){a(),pr.splice(pr.indexOf(l),1)}pr.push(l),++Ut,On(()=>{--Ut==0&&Ts()},[])})(()=>{this.unhandleds.length===0?o():s(this.unhandleds[0])})},i.finalize),t()},e,n,r))}),fr&&(fr.allSettled&&mt(oe,"allSettled",function(){const t=ht.apply(null,arguments).map(rr);return new oe(e=>{t.length===0&&e([]);let n=t.length;const r=new Array(n);t.forEach((o,s)=>oe.resolve(o).then(i=>r[s]={status:"fulfilled",value:i},i=>r[s]={status:"rejected",reason:i}).then(()=>--n||e(r)))})}),fr.any&&typeof AggregateError<"u"&&mt(oe,"any",function(){const t=ht.apply(null,arguments).map(rr);return new oe((e,n)=>{t.length===0&&n(new AggregateError([]));let r=t.length;const o=new Array(r);t.forEach((s,i)=>oe.resolve(s).then(a=>e(a),a=>{o[i]=a,--r||n(new AggregateError(o))}))})}));const Be={awaits:0,echoes:0,id:0};var yf=0,mr=[],lo=0,Pr=0,vf=0;function Ot(t,e,n,r){var o=ae,s=Object.create(o);s.parent=o,s.ref=0,s.global=!1,s.id=++vf;var i=an.env;s.env=Fs?{Promise:oe,PromiseProp:{value:oe,configurable:!0,writable:!0},all:oe.all,race:oe.race,allSettled:oe.allSettled,any:oe.any,resolve:oe.resolve,reject:oe.reject,nthen:ca(i.nthen,s),gthen:ca(i.gthen,s)}:{},e&&We(s,e),++o.ref,s.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=mn(s,t,n,r);return s.ref===0&&s.finalize(),a}function pn(){return Be.id||(Be.id=++yf),++Be.awaits,Be.echoes+=Fi,Be.id}function gt(){return!!Be.awaits&&(--Be.awaits==0&&(Be.id=0),Be.echoes=Be.awaits*Fi,!0)}function rr(t){return Be.echoes&&t&&t.constructor===fr?(pn(),t.then(e=>(gt(),e),e=>(gt(),Fe(e)))):t}function gf(t){++Pr,Be.echoes&&--Be.echoes!=0||(Be.echoes=Be.id=0),mr.push(ae),It(t,!0)}function wf(){var t=mr[mr.length-1];mr.pop(),It(t,!1)}function It(t,e){var n=ae;if((e?!Be.echoes||lo++&&t===ae:!lo||--lo&&t===ae)||Ui(e?gf.bind(null,t):wf),t!==ae&&(ae=t,n===an&&(an.env=Wi()),Fs)){var r=an.env.Promise,o=t.env;Ir.then=o.nthen,r.prototype.then=o.gthen,(n.global||t.global)&&(Object.defineProperty(Ee,"Promise",o.PromiseProp),r.all=o.all,r.race=o.race,r.resolve=o.resolve,r.reject=o.reject,o.allSettled&&(r.allSettled=o.allSettled),o.any&&(r.any=o.any))}}function Wi(){var t=Ee.Promise;return Fs?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(Ee,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:Ir.then,gthen:t.prototype.then}:{}}function mn(t,e,n,r,o){var s=ae;try{return It(t,!0),e(n,r,o)}finally{It(s,!1)}}function Ui(t){Ri.call(Ao,t)}function jr(t,e,n,r){return typeof t!="function"?t:function(){var o=ae;n&&pn(),It(e,!0);try{return t.apply(this,arguments)}finally{It(o,!1),r&&Ui(gt)}}}function ca(t,e){return function(n,r){return t.call(this,jr(n,e),jr(r,e))}}(""+Ri).indexOf("[native code]")===-1&&(pn=gt=be);const ua="unhandledrejection";function da(t,e){var n;try{n=e.onuncatched(t)}catch{}if(n!==!1)try{var r,o={promise:e,reason:t};if(Ee.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(ua,!0,!0),We(r,o)):Ee.CustomEvent&&We(r=new CustomEvent(ua,{detail:o}),o),r&&Ee.dispatchEvent&&(dispatchEvent(r),!Ee.PromiseRejectionEvent&&Ee.onunhandledrejection))try{Ee.onunhandledrejection(r)}catch{}ct&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var Fe=oe.reject;function Lo(t,e,n,r){if(t.idbdb&&(t._state.openComplete||ae.letThrough||t._vip)){var o=t._createTransaction(e,n,t._dbSchema);try{o.create(),t._state.PR1398_maxLoop=3}catch(s){return s.name===As.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>Lo(t,e,n,r))):Fe(s)}return o._promise(e,(s,i)=>Ot(()=>(ae.trans=o,r(s,i,o)))).then(s=>o._completion.then(()=>s))}if(t._state.openComplete)return Fe(new le.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return Fe(new le.DatabaseClosed);t.open().catch(be)}return t._state.dbReadyPromise.then(()=>Lo(t,e,n,r))}const fa="3.2.4",Tt="￿",Wo=-1/0,dt="Invalid key provided. Keys must be of type string, number, Date or Array.",Ki="String expected.",In=[],Qr=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),bf=Qr,_f=Qr,$i=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),eo="__dbnames",co="readonly",uo="readwrite";function Zt(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}const qi={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function or(t){return typeof t!="string"||/\./.test(t)?e=>e:e=>(e[t]===void 0&&t in e&&delete(e=Vn(e))[t],e)}class kf{_trans(e,n,r){const o=this._tx||ae.trans,s=this.name;function i(l,u,c){if(!c.schema[s])throw new le.NotFound("Table "+s+" not part of transaction");return n(c.idbtrans,c)}const a=Zn();try{return o&&o.db===this.db?o===ae.trans?o._promise(e,i,r):Ot(()=>o._promise(e,i,r),{trans:o,transless:ae.transless||ae}):Lo(this.db,e,[this.name],i)}finally{a&&Gn()}}get(e,n){return e&&e.constructor===Object?this.where(e).first(n):this._trans("readonly",r=>this.core.get({trans:r,key:e}).then(o=>this.hook.reading.fire(o))).then(n)}where(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(Me(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const n=Ne(e);if(n.length===1)return this.where(n[0]).equals(e[n[0]]);const r=this.schema.indexes.concat(this.schema.primKey).filter(u=>u.compound&&n.every(c=>u.keyPath.indexOf(c)>=0)&&u.keyPath.every(c=>n.indexOf(c)>=0))[0];if(r&&this.db._maxKey!==Tt)return this.where(r.name).equals(r.keyPath.map(u=>e[u]));!r&&ct&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);const{idxByName:o}=this.schema,s=this.db._deps.indexedDB;function i(u,c){try{return s.cmp(u,c)===0}catch{return!1}}const[a,l]=n.reduce(([u,c],d)=>{const p=o[d],h=e[d];return[u||p,u||!p?Zt(c,p&&p.multi?b=>{const f=yt(b,d);return Me(f)&&f.some(y=>i(h,y))}:b=>i(h,yt(b,d))):c]},[null,null]);return a?this.where(a.name).equals(e[a.keyPath]).filter(l):r?this.filter(l):this.where(n).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,Me(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;const n=r=>{if(!r)return r;const o=Object.create(e.prototype);for(var s in r)if(Ze(r,s))try{o[s]=r[s]}catch{}return o};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),e}defineClass(){return this.mapToClass(function(e){We(this,e)})}add(e,n){const{auto:r,keyPath:o}=this.schema.primKey;let s=e;return o&&r&&(s=or(o)(e)),this._trans("readwrite",i=>this.core.mutate({trans:i,type:"add",keys:n!=null?[n]:null,values:[s]})).then(i=>i.numFailures?oe.reject(i.failures[0]):i.lastResult).then(i=>{if(o)try{nt(e,o,i)}catch{}return i})}update(e,n){if(typeof e!="object"||Me(e))return this.where(":id").equals(e).modify(n);{const r=yt(e,this.schema.primKey.keyPath);if(r===void 0)return Fe(new le.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?Ne(n).forEach(o=>{nt(e,o,n[o])}):n(e,{value:e,primKey:r})}catch{}return this.where(":id").equals(r).modify(n)}}put(e,n){const{auto:r,keyPath:o}=this.schema.primKey;let s=e;return o&&r&&(s=or(o)(e)),this._trans("readwrite",i=>this.core.mutate({trans:i,type:"put",values:[s],keys:n!=null?[n]:null})).then(i=>i.numFailures?oe.reject(i.failures[0]):i.lastResult).then(i=>{if(o)try{nt(e,o,i)}catch{}return i})}delete(e){return this._trans("readwrite",n=>this.core.mutate({trans:n,type:"delete",keys:[e]})).then(n=>n.numFailures?oe.reject(n.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:qi})).then(e=>e.numFailures?oe.reject(e.failures[0]):void 0)}bulkGet(e){return this._trans("readonly",n=>this.core.getMany({keys:e,trans:n}).then(r=>r.map(o=>this.hook.reading.fire(o))))}bulkAdd(e,n,r){const o=Array.isArray(n)?n:void 0,s=(r=r||(o?void 0:n))?r.allKeys:void 0;return this._trans("readwrite",i=>{const{auto:a,keyPath:l}=this.schema.primKey;if(l&&o)throw new le.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new le.InvalidArgument("Arguments objects and keys must have the same length");const u=e.length;let c=l&&a?e.map(or(l)):e;return this.core.mutate({trans:i,type:"add",keys:o,values:c,wantResults:s}).then(({numFailures:d,results:p,lastResult:h,failures:b})=>{if(d===0)return s?p:h;throw new Sn(`${this.name}.bulkAdd(): ${d} of ${u} operations failed`,b)})})}bulkPut(e,n,r){const o=Array.isArray(n)?n:void 0,s=(r=r||(o?void 0:n))?r.allKeys:void 0;return this._trans("readwrite",i=>{const{auto:a,keyPath:l}=this.schema.primKey;if(l&&o)throw new le.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new le.InvalidArgument("Arguments objects and keys must have the same length");const u=e.length;let c=l&&a?e.map(or(l)):e;return this.core.mutate({trans:i,type:"put",keys:o,values:c,wantResults:s}).then(({numFailures:d,results:p,lastResult:h,failures:b})=>{if(d===0)return s?p:h;throw new Sn(`${this.name}.bulkPut(): ${d} of ${u} operations failed`,b)})})}bulkDelete(e){const n=e.length;return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:e})).then(({numFailures:r,lastResult:o,failures:s})=>{if(r===0)return o;throw new Sn(`${this.name}.bulkDelete(): ${r} of ${n} operations failed`,s)})}}function Dn(t){var e={},n=function(i,a){if(a){for(var l=arguments.length,u=new Array(l-1);--l;)u[l-1]=arguments[l];return e[i].subscribe.apply(null,u),t}if(typeof i=="string")return e[i]};n.addEventType=s;for(var r=1,o=arguments.length;rZt(r(),e()):e,t.justLimit=n&&!r}function yr(t,e){if(t.isPrimKey)return e.primaryKey;const n=e.getIndexByKeyPath(t.index);if(!n)throw new le.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return n}function ha(t,e,n){const r=yr(t,e.schema);return e.openCursor({trans:n,values:!t.keysOnly,reverse:t.dir==="prev",unique:!!t.unique,query:{index:r,range:t.range}})}function sr(t,e,n,r){const o=t.replayFilter?Zt(t.filter,t.replayFilter()):t.filter;if(t.or){const s={},i=(a,l,u)=>{if(!o||o(l,u,p=>l.stop(p),p=>l.fail(p))){var c=l.primaryKey,d=""+c;d==="[object ArrayBuffer]"&&(d=""+new Uint8Array(c)),Ze(s,d)||(s[d]=!0,e(a,l,u))}};return Promise.all([t.or._iterate(i,n),pa(ha(t,r,n),t.algorithm,i,!t.keysOnly&&t.valueMapper)])}return pa(ha(t,r,n),Zt(t.algorithm,o),e,!t.keysOnly&&t.valueMapper)}function pa(t,e,n,r){var o=Ce(r?(s,i,a)=>n(r(s),i,a):n);return t.then(s=>{if(s)return s.start(()=>{var i=()=>s.continue();e&&!e(s,a=>i=a,a=>{s.stop(a),i=be},a=>{s.fail(a),i=be})||o(s.value,s,a=>i=a),i()})})}function ze(t,e){try{const n=ma(t),r=ma(e);if(n!==r)return n==="Array"?1:r==="Array"?-1:n==="binary"?1:r==="binary"?-1:n==="string"?1:r==="string"?-1:n==="Date"?1:r!=="Date"?NaN:-1;switch(n){case"number":case"Date":case"string":return t>e?1:tsr(n,e,r,n.table.core))}count(e){return this._read(n=>{const r=this._ctx,o=r.table.core;if(Qt(r,!0))return o.count({trans:n,query:{index:yr(r,o.schema),range:r.range}}).then(i=>Math.min(i,r.limit));var s=0;return sr(r,()=>(++s,!1),n,o).then(()=>s)}).then(e)}sortBy(e,n){const r=e.split(".").reverse(),o=r[0],s=r.length-1;function i(u,c){return c?i(u[r[c]],c-1):u[o]}var a=this._ctx.dir==="next"?1:-1;function l(u,c){var d=i(u,s),p=i(c,s);return dp?a:0}return this.toArray(function(u){return u.sort(l)}).then(n)}toArray(e){return this._read(n=>{var r=this._ctx;if(r.dir==="next"&&Qt(r,!0)&&r.limit>0){const{valueMapper:o}=r,s=yr(r,r.table.core.schema);return r.table.core.query({trans:n,limit:r.limit,values:!0,query:{index:s,range:r.range}}).then(({result:i})=>o?i.map(o):i)}{const o=[];return sr(r,s=>o.push(s),n,r.table.core).then(()=>o)}},e)}offset(e){var n=this._ctx;return e<=0||(n.offset+=e,Qt(n)?ho(n,()=>{var r=e;return(o,s)=>r===0||(r===1?(--r,!1):(s(()=>{o.advance(r),r=0}),!1))}):ho(n,()=>{var r=e;return()=>--r<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),ho(this._ctx,()=>{var n=e;return function(r,o,s){return--n<=0&&o(s),n>=0}},!0),this}until(e,n){return fo(this._ctx,function(r,o,s){return!e(r.value)||(o(s),n)}),this}first(e){return this.limit(1).toArray(function(n){return n[0]}).then(e)}last(e){return this.reverse().first(e)}filter(e){var n,r;return fo(this._ctx,function(o){return e(o.value)}),n=this._ctx,r=e,n.isMatch=Zt(n.isMatch,r),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,o){e(o.key,o)})}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,o){e(o.primaryKey,o)})}keys(e){var n=this._ctx;n.keysOnly=!n.isMatch;var r=[];return this.each(function(o,s){r.push(s.key)}).then(function(){return r}).then(e)}primaryKeys(e){var n=this._ctx;if(n.dir==="next"&&Qt(n,!0)&&n.limit>0)return this._read(o=>{var s=yr(n,n.table.core.schema);return n.table.core.query({trans:o,values:!1,limit:n.limit,query:{index:s,range:n.range}})}).then(({result:o})=>o).then(e);n.keysOnly=!n.isMatch;var r=[];return this.each(function(o,s){r.push(s.primaryKey)}).then(function(){return r}).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys(function(n){return n[0]}).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,n=e.index&&e.table.schema.idxByName[e.index];if(!n||!n.multi)return this;var r={};return fo(this._ctx,function(o){var s=o.primaryKey.toString(),i=Ze(r,s);return r[s]=!0,!i}),this}modify(e){var n=this._ctx;return this._write(r=>{var o;if(typeof e=="function")o=e;else{var s=Ne(e),i=s.length;o=function(f){for(var y=!1,m=0;m{const{failures:m,numFailures:w}=y;p+=f-w;for(let _ of Ne(m))d.push(m[_])};return this.clone().primaryKeys().then(f=>{const y=m=>{const w=Math.min(c,f.length-m);return a.getMany({trans:r,keys:f.slice(m,m+w),cache:"immutable"}).then(_=>{const k=[],x=[],I=l?[]:null,E=[];for(let D=0;D0&&a.mutate({trans:r,type:"add",values:k}).then(D=>{for(let R in D.failures)E.splice(parseInt(R),1);b(k.length,D)})).then(()=>(x.length>0||N&&typeof e=="object")&&a.mutate({trans:r,type:"put",keys:I,values:x,criteria:N,changeSpec:typeof e!="function"&&e}).then(D=>b(x.length,D))).then(()=>(E.length>0||N&&e===po)&&a.mutate({trans:r,type:"delete",keys:E,criteria:N}).then(D=>b(E.length,D))).then(()=>f.length>m+w&&y(m+c))})};return y(0).then(()=>{if(d.length>0)throw new Or("Error modifying one or more objects",d,p,h);return f.length})})})}delete(){var e=this._ctx,n=e.range;return Qt(e)&&(e.isPrimKey&&!_f||n.type===3)?this._write(r=>{const{primaryKey:o}=e.table.core.schema,s=n;return e.table.core.count({trans:r,query:{index:o,range:s}}).then(i=>e.table.core.mutate({trans:r,type:"deleteRange",range:s}).then(({failures:a,lastResult:l,results:u,numFailures:c})=>{if(c)throw new Or("Could not delete some values",Object.keys(a).map(d=>a[d]),i-c);return i-c}))}):this.modify(po)}}const po=(t,e)=>e.value=null;function Ef(t,e){return te?-1:t===e?0:1}function $e(t,e,n){var r=t instanceof Vi?new t.Collection(t):t;return r._ctx.error=n?new n(e):new TypeError(e),r}function en(t){return new t.Collection(t,()=>Hi("")).limit(0)}function Sf(t,e,n,r,o,s){for(var i=Math.min(t.length,r.length),a=-1,l=0;l=0?t.substr(0,a)+e[a]+n.substr(a+1):null;o(t[l],u)<0&&(a=l)}return itypeof f=="string"))return $e(t,Ki);function p(f){o=function(m){return m==="next"?w=>w.toUpperCase():w=>w.toLowerCase()}(f),s=function(m){return m==="next"?w=>w.toLowerCase():w=>w.toUpperCase()}(f),i=f==="next"?Ef:Cf;var y=n.map(function(m){return{lower:s(m),upper:o(m)}}).sort(function(m,w){return i(m.lower,w.lower)});a=y.map(function(m){return m.upper}),l=y.map(function(m){return m.lower}),u=f,c=f==="next"?"":r}p("next");var h=new t.Collection(t,()=>_t(a[0],l[d-1]+r));h._ondirectionchange=function(f){p(f)};var b=0;return h._addAlgorithm(function(f,y,m){var w=f.key;if(typeof w!="string")return!1;var _=s(w);if(e(_,l,b))return!0;for(var k=null,x=b;x0)&&(k=I)}return y(k!==null?function(){f.continue(k+c)}:m),!1}),h}function _t(t,e,n,r){return{type:2,lower:t,upper:e,lowerOpen:n,upperOpen:r}}function Hi(t){return{type:1,lower:t,upper:t}}class Vi{get Collection(){return this._ctx.table.db.Collection}between(e,n,r,o){r=r!==!1,o=o===!0;try{return this._cmp(e,n)>0||this._cmp(e,n)===0&&(r||o)&&(!r||!o)?en(this):new this.Collection(this,()=>_t(e,n,!r,!o))}catch{return $e(this,dt)}}equals(e){return e==null?$e(this,dt):new this.Collection(this,()=>Hi(e))}above(e){return e==null?$e(this,dt):new this.Collection(this,()=>_t(e,void 0,!0))}aboveOrEqual(e){return e==null?$e(this,dt):new this.Collection(this,()=>_t(e,void 0,!1))}below(e){return e==null?$e(this,dt):new this.Collection(this,()=>_t(void 0,e,!1,!0))}belowOrEqual(e){return e==null?$e(this,dt):new this.Collection(this,()=>_t(void 0,e))}startsWith(e){return typeof e!="string"?$e(this,Ki):this.between(e,e+Tt,!0,!0)}startsWithIgnoreCase(e){return e===""?this.startsWith(e):ar(this,(n,r)=>n.indexOf(r[0])===0,[e],Tt)}equalsIgnoreCase(e){return ar(this,(n,r)=>n===r[0],[e],"")}anyOfIgnoreCase(){var e=ht.apply(tn,arguments);return e.length===0?en(this):ar(this,(n,r)=>r.indexOf(n)!==-1,e,"")}startsWithAnyOfIgnoreCase(){var e=ht.apply(tn,arguments);return e.length===0?en(this):ar(this,(n,r)=>r.some(o=>n.indexOf(o)===0),e,Tt)}anyOf(){const e=ht.apply(tn,arguments);let n=this._cmp;try{e.sort(n)}catch{return $e(this,dt)}if(e.length===0)return en(this);const r=new this.Collection(this,()=>_t(e[0],e[e.length-1]));r._ondirectionchange=s=>{n=s==="next"?this._ascending:this._descending,e.sort(n)};let o=0;return r._addAlgorithm((s,i,a)=>{const l=s.key;for(;n(l,e[o])>0;)if(++o,o===e.length)return i(a),!1;return n(l,e[o])===0||(i(()=>{s.continue(e[o])}),!1)}),r}notEqual(e){return this.inAnyRange([[Wo,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=ht.apply(tn,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return $e(this,dt)}const n=e.reduce((r,o)=>r?r.concat([[r[r.length-1][1],o]]):[[Wo,o]],null);return n.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,n){const r=this._cmp,o=this._ascending,s=this._descending,i=this._min,a=this._max;if(e.length===0)return en(this);if(!e.every(w=>w[0]!==void 0&&w[1]!==void 0&&o(w[0],w[1])<=0))return $e(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",le.InvalidArgument);const l=!n||n.includeLowers!==!1,u=n&&n.includeUppers===!0;let c,d=o;function p(w,_){return d(w[0],_[0])}try{c=e.reduce(function(w,_){let k=0,x=w.length;for(;k0){I[0]=i(I[0],_[0]),I[1]=a(I[1],_[1]);break}}return k===x&&w.push(_),w},[]),c.sort(p)}catch{return $e(this,dt)}let h=0;const b=u?w=>o(w,c[h][1])>0:w=>o(w,c[h][1])>=0,f=l?w=>s(w,c[h][0])>0:w=>s(w,c[h][0])>=0;let y=b;const m=new this.Collection(this,()=>_t(c[0][0],c[c.length-1][1],!l,!u));return m._ondirectionchange=w=>{w==="next"?(y=b,d=o):(y=f,d=s),c.sort(p)},m._addAlgorithm((w,_,k)=>{for(var x=w.key;y(x);)if(++h,h===c.length)return _(k),!1;return!!function(I){return!b(I)&&!f(I)}(x)||(this._cmp(x,c[h][1])===0||this._cmp(x,c[h][0])===0||_(()=>{d===o?w.continue(c[h][0]):w.continue(c[h][1])}),!1)}),m}startsWithAnyOf(){const e=ht.apply(tn,arguments);return e.every(n=>typeof n=="string")?e.length===0?en(this):this.inAnyRange(e.map(n=>[n,n+Tt])):$e(this,"startsWithAnyOf() only works with strings")}}function st(t){return Ce(function(e){return Mn(e),t(e.target.error),!1})}function Mn(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}const zn="storagemutated",Et="x-storagemutated-1",Dt=Dn(null,zn);class Of{_lock(){return _n(!ae.global),++this._reculock,this._reculock!==1||ae.global||(ae.lockOwnerFor=this),this}_unlock(){if(_n(!ae.global),--this._reculock==0)for(ae.global||(ae.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{mn(e[1],e[0])}catch{}}return this}_locked(){return this._reculock&&ae.lockOwnerFor!==this}create(e){if(!this.mode)return this;const n=this.db.idbdb,r=this.db._state.dbOpenError;if(_n(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new le.DatabaseClosed(r);case"MissingAPIError":throw new le.MissingAPI(r.message,r);default:throw new le.OpenFailed(r)}if(!this.active)throw new le.TransactionInactive;return _n(this._completion._state===null),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=Ce(o=>{Mn(o),this._reject(e.error)}),e.onabort=Ce(o=>{Mn(o),this.active&&this._reject(new le.Abort(e.error)),this.active=!1,this.on("abort").fire(o)}),e.oncomplete=Ce(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&Dt.storagemutated.fire(e.mutatedParts)}),this}_promise(e,n,r){if(e==="readwrite"&&this.mode!=="readwrite")return Fe(new le.ReadOnly("Transaction is readonly"));if(!this.active)return Fe(new le.TransactionInactive);if(this._locked())return new oe((s,i)=>{this._blockedFuncs.push([()=>{this._promise(e,n,r).then(s,i)},ae])});if(r)return Ot(()=>{var s=new oe((i,a)=>{this._lock();const l=n(i,a,this);l&&l.then&&l.then(i,a)});return s.finally(()=>this._unlock()),s._lib=!0,s});var o=new oe((s,i)=>{var a=n(s,i,this);a&&a.then&&a.then(s,i)});return o._lib=!0,o}_root(){return this.parent?this.parent._root():this}waitFor(e){var n=this._root();const r=oe.resolve(e);if(n._waitingFor)n._waitingFor=n._waitingFor.then(()=>r);else{n._waitingFor=r,n._waitingQueue=[];var o=n.idbtrans.objectStore(n.storeNames[0]);(function i(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(o.get(-1/0).onsuccess=i)})()}var s=n._waitingFor;return new oe((i,a)=>{r.then(l=>n._waitingQueue.push(Ce(i.bind(null,l))),l=>n._waitingQueue.push(Ce(a.bind(null,l)))).finally(()=>{n._waitingFor===s&&(n._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new le.Abort))}table(e){const n=this._memoizedTables||(this._memoizedTables={});if(Ze(n,e))return n[e];const r=this.schema[e];if(!r)throw new le.NotFound("Table "+e+" not part of transaction");const o=new this.db.Table(e,r,this);return o.core=this.db.core.table(e),n[e]=o,o}}function Uo(t,e,n,r,o,s,i){return{name:t,keyPath:e,unique:n,multi:r,auto:o,compound:s,src:(n&&!i?"&":"")+(r?"*":"")+(o?"++":"")+Zi(e)}}function Zi(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function Gi(t,e,n){return{name:t,primKey:e,indexes:n,mappedClass:null,idxByName:Si(n,r=>[r.name,r])}}let Ln=t=>{try{return t.only([[]]),Ln=()=>[[]],[[]]}catch{return Ln=()=>Tt,Tt}};function Ko(t){return t==null?()=>{}:typeof t=="string"?function(e){return e.split(".").length===1?r=>r[e]:r=>yt(r,e)}(t):e=>yt(e,t)}function va(t){return[].slice.call(t)}let If=0;function Pn(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Df(t,e,n){function r(l){if(l.type===3)return null;if(l.type===4)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:u,upper:c,lowerOpen:d,upperOpen:p}=l;return u===void 0?c===void 0?null:e.upperBound(c,!!p):c===void 0?e.lowerBound(u,!!d):e.bound(u,c,!!d,!!p)}const{schema:o,hasGetAll:s}=function(l,u){const c=va(l.objectStoreNames);return{schema:{name:l.name,tables:c.map(d=>u.objectStore(d)).map(d=>{const{keyPath:p,autoIncrement:h}=d,b=Me(p),f=p==null,y={},m={name:d.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:f,compound:b,keyPath:p,autoIncrement:h,unique:!0,extractKey:Ko(p)},indexes:va(d.indexNames).map(w=>d.index(w)).map(w=>{const{name:_,unique:k,multiEntry:x,keyPath:I}=w,E={name:_,compound:Me(I),keyPath:I,unique:k,multiEntry:x,extractKey:Ko(I)};return y[Pn(I)]=E,E}),getIndexByKeyPath:w=>y[Pn(w)]};return y[":id"]=m.primaryKey,p!=null&&(y[Pn(p)]=m.primaryKey),m})},hasGetAll:c.length>0&&"getAll"in u.objectStore(c[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(t,n),i=o.tables.map(l=>function(u){const c=u.name;return{name:c,schema:u,mutate:function({trans:d,type:p,keys:h,values:b,range:f}){return new Promise((y,m)=>{y=Ce(y);const w=d.objectStore(c),_=w.keyPath==null,k=p==="put"||p==="add";if(!k&&p!=="delete"&&p!=="deleteRange")throw new Error("Invalid operation type: "+p);const{length:x}=h||b||{length:1};if(h&&b&&h.length!==b.length)throw new Error("Given keys array must have same length as given values array.");if(x===0)return y({numFailures:0,failures:{},results:[],lastResult:void 0});let I;const E=[],N=[];let D=0;const R=P=>{++D,Mn(P)};if(p==="deleteRange"){if(f.type===4)return y({numFailures:D,failures:N,results:[],lastResult:void 0});f.type===3?E.push(I=w.clear()):E.push(I=w.delete(r(f)))}else{const[P,B]=k?_?[b,h]:[b,null]:[h,null];if(k)for(let v=0;v{const B=P.target.result;E.forEach((v,T)=>v.error!=null&&(N[T]=v.error)),y({numFailures:D,failures:N,results:p==="delete"?h:E.map(v=>v.result),lastResult:B})};I.onerror=P=>{R(P),K(P)},I.onsuccess=K})},getMany:({trans:d,keys:p})=>new Promise((h,b)=>{h=Ce(h);const f=d.objectStore(c),y=p.length,m=new Array(y);let w,_=0,k=0;const x=E=>{const N=E.target;m[N._pos]=N.result,++k===_&&h(m)},I=st(b);for(let E=0;Enew Promise((h,b)=>{h=Ce(h);const f=d.objectStore(c).get(p);f.onsuccess=y=>h(y.target.result),f.onerror=st(b)}),query:function(d){return p=>new Promise((h,b)=>{h=Ce(h);const{trans:f,values:y,limit:m,query:w}=p,_=m===1/0?void 0:m,{index:k,range:x}=w,I=f.objectStore(c),E=k.isPrimaryKey?I:I.index(k.name),N=r(x);if(m===0)return h({result:[]});if(d){const D=y?E.getAll(N,_):E.getAllKeys(N,_);D.onsuccess=R=>h({result:R.target.result}),D.onerror=st(b)}else{let D=0;const R=y||!("openKeyCursor"in E)?E.openCursor(N):E.openKeyCursor(N),K=[];R.onsuccess=P=>{const B=R.result;return B?(K.push(y?B.value:B.primaryKey),++D===m?h({result:K}):void B.continue()):h({result:K})},R.onerror=st(b)}})}(s),openCursor:function({trans:d,values:p,query:h,reverse:b,unique:f}){return new Promise((y,m)=>{y=Ce(y);const{index:w,range:_}=h,k=d.objectStore(c),x=w.isPrimaryKey?k:k.index(w.name),I=b?f?"prevunique":"prev":f?"nextunique":"next",E=p||!("openKeyCursor"in x)?x.openCursor(r(_),I):x.openKeyCursor(r(_),I);E.onerror=st(m),E.onsuccess=Ce(N=>{const D=E.result;if(!D)return void y(null);D.___id=++If,D.done=!1;const R=D.continue.bind(D);let K=D.continuePrimaryKey;K&&(K=K.bind(D));const P=D.advance.bind(D),B=()=>{throw new Error("Cursor not stopped")};D.trans=d,D.stop=D.continue=D.continuePrimaryKey=D.advance=()=>{throw new Error("Cursor not started")},D.fail=Ce(m),D.next=function(){let v=1;return this.start(()=>v--?this.continue():this.stop()).then(()=>this)},D.start=v=>{const T=new Promise((A,X)=>{A=Ce(A),E.onerror=st(X),D.fail=X,D.stop=$=>{D.stop=D.continue=D.continuePrimaryKey=D.advance=B,A($)}}),H=()=>{if(E.result)try{v()}catch(A){D.fail(A)}else D.done=!0,D.start=()=>{throw new Error("Cursor behind last entry")},D.stop()};return E.onsuccess=Ce(A=>{E.onsuccess=H,H()}),D.continue=R,D.continuePrimaryKey=K,D.advance=P,H(),T},y(D)},m)})},count({query:d,trans:p}){const{index:h,range:b}=d;return new Promise((f,y)=>{const m=p.objectStore(c),w=h.isPrimaryKey?m:m.index(h.name),_=r(b),k=_?w.count(_):w.count();k.onsuccess=Ce(x=>f(x.target.result)),k.onerror=st(y)})}}}(l)),a={};return i.forEach(l=>a[l.name]=l),{stack:"dbcore",transaction:t.transaction.bind(t),table(l){if(!a[l])throw new Error(`Table '${l}' not found`);return a[l]},MIN_KEY:-1/0,MAX_KEY:Ln(e),schema:o}}function $o({_novip:t},e){const n=e.db,r=function(o,s,{IDBKeyRange:i,indexedDB:a},l){return{dbcore:function(c,d){return d.reduce((p,{create:h})=>({...p,...h(p)}),c)}(Df(s,i,l),o.dbcore)}}(t._middlewares,n,t._deps,e);t.core=r.dbcore,t.tables.forEach(o=>{const s=o.name;t.core.schema.tables.some(i=>i.name===s)&&(o.core=t.core.table(s),t[s]instanceof t.Table&&(t[s].core=o.core))})}function Ar({_novip:t},e,n,r){n.forEach(o=>{const s=r[o];e.forEach(i=>{const a=Ds(i,o);(!a||"value"in a&&a.value===void 0)&&(i===t.Transaction.prototype||i instanceof t.Transaction?mt(i,o,{get(){return this.table(o)},set(l){xi(this,o,{value:l,writable:!0,configurable:!0,enumerable:!0})}}):i[o]=new t.Table(o,s))})})}function qo({_novip:t},e){e.forEach(n=>{for(let r in n)n[r]instanceof t.Table&&delete n[r]})}function Pf(t,e){return t._cfg.version-e._cfg.version}function jf(t,e,n,r){const o=t._dbSchema,s=t._createTransaction("readwrite",t._storeNames,o);s.create(n),s._completion.catch(r);const i=s._reject.bind(s),a=ae.transless||ae;Ot(()=>{ae.trans=s,ae.transless=a,e===0?(Ne(o).forEach(l=>{mo(n,l,o[l].primKey,o[l].indexes)}),$o(t,n),oe.follow(()=>t.on.populate.fire(s)).catch(i)):function({_novip:l},u,c,d){const p=[],h=l._versions;let b=l._dbSchema=Vo(l,l.idbdb,d),f=!1;const y=h.filter(w=>w._cfg.version>=u);function m(){return p.length?oe.resolve(p.shift()(c.idbtrans)).then(m):oe.resolve()}return y.forEach(w=>{p.push(()=>{const _=b,k=w._cfg.dbschema;Zo(l,_,d),Zo(l,k,d),b=l._dbSchema=k;const x=Yi(_,k);x.add.forEach(E=>{mo(d,E[0],E[1].primKey,E[1].indexes)}),x.change.forEach(E=>{if(E.recreate)throw new le.Upgrade("Not yet support for changing primary key");{const N=d.objectStore(E.name);E.add.forEach(D=>Ho(N,D)),E.change.forEach(D=>{N.deleteIndex(D.name),Ho(N,D)}),E.del.forEach(D=>N.deleteIndex(D))}});const I=w._cfg.contentUpgrade;if(I&&w._cfg.version>u){$o(l,d),c._memoizedTables={},f=!0;let E=Oi(k);x.del.forEach(K=>{E[K]=_[K]}),qo(l,[l.Transaction.prototype]),Ar(l,[l.Transaction.prototype],Ne(E),E),c.schema=E;const N=Ps(I);let D;N&&pn();const R=oe.follow(()=>{if(D=I(c),D&&N){var K=gt.bind(null,null);D.then(K,K)}});return D&&typeof D.then=="function"?oe.resolve(D):R.then(()=>D)}}),p.push(_=>{(!f||!bf)&&function(k,x){[].slice.call(x.db.objectStoreNames).forEach(I=>k[I]==null&&x.db.deleteObjectStore(I))}(w._cfg.dbschema,_),qo(l,[l.Transaction.prototype]),Ar(l,[l.Transaction.prototype],l._storeNames,l._dbSchema),c.schema=l._dbSchema})}),m().then(()=>{var w,_;_=d,Ne(w=b).forEach(k=>{_.db.objectStoreNames.contains(k)||mo(_,k,w[k].primKey,w[k].indexes)})})}(t,e,s,n).catch(i)})}function Yi(t,e){const n={del:[],add:[],change:[]};let r;for(r in t)e[r]||n.del.push(r);for(r in e){const o=t[r],s=e[r];if(o){const i={name:r,def:s,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(s.primKey.keyPath||"")||o.primKey.auto!==s.primKey.auto&&!Qr)i.recreate=!0,n.change.push(i);else{const a=o.idxByName,l=s.idxByName;let u;for(u in a)l[u]||i.del.push(u);for(u in l){const c=a[u],d=l[u];c?c.src!==d.src&&i.change.push(d):i.add.push(d)}(i.del.length>0||i.add.length>0||i.change.length>0)&&n.change.push(i)}}else n.add.push([r,s])}return n}function mo(t,e,n,r){const o=t.db.createObjectStore(e,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(s=>Ho(o,s)),o}function Ho(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function Vo(t,e,n){const r={};return Sr(e.objectStoreNames,0).forEach(o=>{const s=n.objectStore(o);let i=s.keyPath;const a=Uo(Zi(i),i||"",!1,!1,!!s.autoIncrement,i&&typeof i!="string",!0),l=[];for(let c=0;c{if(e[r]!==null){var o=e[r].split(",").map((i,a)=>{const l=(i=i.trim()).replace(/([&*]|\+\+)/g,""),u=/^\[/.test(l)?l.match(/^\[(.*)\]$/)[1].split("+"):l;return Uo(l,u||null,/\&/.test(i),/\*/.test(i),/\+\+/.test(i),Me(u),a===0)}),s=o.shift();if(s.multi)throw new le.Schema("Primary key cannot be multi-valued");o.forEach(i=>{if(i.auto)throw new le.Schema("Only primary key can be marked as autoIncrement (++)");if(!i.keyPath)throw new le.Schema("Index must have a name and cannot be an empty string")}),n[r]=Gi(r,s,o)}})}stores(e){const n=this.db;this._cfg.storesSource=this._cfg.storesSource?We(this._cfg.storesSource,e):e;const r=n._versions,o={};let s={};return r.forEach(i=>{We(o,i._cfg.storesSource),s=i._cfg.dbschema={},i._parseStoresSpec(o,s)}),n._dbSchema=s,qo(n,[n._allTables,n,n.Transaction.prototype]),Ar(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],Ne(s),s),n._storeNames=Ne(s),this}upgrade(e){return this._cfg.contentUpgrade=Ns(this._cfg.contentUpgrade||be,e),this}}function Bs(t,e){let n=t._dbNamesDB;return n||(n=t._dbNamesDB=new Kt(eo,{addons:[],indexedDB:t,IDBKeyRange:e}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Ms(t){return t&&typeof t.databases=="function"}function Go(t){return Ot(function(){return ae.letThrough=!0,t()})}function Nf(){var t;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(e){var n=function(){return indexedDB.databases().finally(e)};t=setInterval(n,100),n()}).finally(function(){return clearInterval(t)}):Promise.resolve()}function Ff(t){const e=t._state,{indexedDB:n}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then(()=>e.dbOpenError?Fe(e.dbOpenError):t);ct&&(e.openCanceller._stackHolder=Gt()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;const r=e.openCanceller;function o(){if(e.openCanceller!==r)throw new le.DatabaseClosed("db.open() was cancelled")}let s=e.dbReadyResolve,i=null,a=!1;return oe.race([r,(typeof navigator>"u"?oe.resolve():Nf()).then(()=>new oe((l,u)=>{if(o(),!n)throw new le.MissingAPI;const c=t.name,d=e.autoSchema?n.open(c):n.open(c,Math.round(10*t.verno));if(!d)throw new le.MissingAPI;d.onerror=st(u),d.onblocked=Ce(t._fireOnBlocked),d.onupgradeneeded=Ce(p=>{if(i=d.transaction,e.autoSchema&&!t._options.allowEmptyDB){d.onerror=Mn,i.abort(),d.result.close();const b=n.deleteDatabase(c);b.onsuccess=b.onerror=Ce(()=>{u(new le.NoSuchDatabase(`Database ${c} doesnt exist`))})}else{i.onerror=st(u);var h=p.oldVersion>Math.pow(2,62)?0:p.oldVersion;a=h<1,t._novip.idbdb=d.result,jf(t,h/10,i,u)}},u),d.onsuccess=Ce(()=>{i=null;const p=t._novip.idbdb=d.result,h=Sr(p.objectStoreNames);if(h.length>0)try{const f=p.transaction((b=h).length===1?b[0]:b,"readonly");e.autoSchema?function({_novip:y},m,w){y.verno=m.version/10;const _=y._dbSchema=Vo(0,m,w);y._storeNames=Sr(m.objectStoreNames,0),Ar(y,[y._allTables],Ne(_),_)}(t,p,f):(Zo(t,t._dbSchema,f),function(y,m){const w=Yi(Vo(0,y.idbdb,m),y._dbSchema);return!(w.add.length||w.change.some(_=>_.add.length||_.change.length))}(t,f)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),$o(t,f)}catch{}var b;In.push(t),p.onversionchange=Ce(f=>{e.vcFired=!0,t.on("versionchange").fire(f)}),p.onclose=Ce(f=>{t.on("close").fire(f)}),a&&function({indexedDB:f,IDBKeyRange:y},m){!Ms(f)&&m!==eo&&Bs(f,y).put({name:m}).catch(be)}(t._deps,c),l()},u)}))]).then(()=>(o(),e.onReadyBeingFired=[],oe.resolve(Go(()=>t.on.ready.fire(t.vip))).then(function l(){if(e.onReadyBeingFired.length>0){let u=e.onReadyBeingFired.reduce(Ns,be);return e.onReadyBeingFired=[],oe.resolve(Go(()=>u(t.vip))).then(l)}}))).finally(()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1}).then(()=>t).catch(l=>{e.dbOpenError=l;try{i&&i.abort()}catch{}return r===e.openCanceller&&t._close(),Fe(l)}).finally(()=>{e.openComplete=!0,s()})}function Yo(t){var e=s=>t.next(s),n=o(e),r=o(s=>t.throw(s));function o(s){return i=>{var a=s(i),l=a.value;return a.done?l:l&&typeof l.then=="function"?l.then(n,r):Me(l)?Promise.all(l).then(n,r):n(l)}}return o(e)()}function Rf(t,e,n){var r=arguments.length;if(r<2)throw new le.InvalidArgument("Too few arguments");for(var o=new Array(r-1);--r;)o[r-1]=arguments[r];return n=o.pop(),[t,Ii(o),n]}function Ji(t,e,n,r,o){return oe.resolve().then(()=>{const s=ae.transless||ae,i=t._createTransaction(e,n,t._dbSchema,r),a={trans:i,transless:s};if(r)i.idbtrans=r.idbtrans;else try{i.create(),t._state.PR1398_maxLoop=3}catch(d){return d.name===As.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>Ji(t,e,n,null,o))):Fe(d)}const l=Ps(o);let u;l&&pn();const c=oe.follow(()=>{if(u=o.call(i,i),u)if(l){var d=gt.bind(null,null);u.then(d,d)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=Yo(u))},a);return(u&&typeof u.then=="function"?oe.resolve(u).then(d=>i.active?d:Fe(new le.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):c.then(()=>u)).then(d=>(r&&i._resolve(),i._completion.then(()=>d))).catch(d=>(i._reject(d),Fe(d)))})}function ir(t,e,n){const r=Me(t)?t.slice():[t];for(let o=0;o0,m={...p,isVirtual:y,keyTail:d,keyLength:f,extractKey:Ko(c),unique:!y&&p.unique};return b.push(m),m.isPrimaryKey||s.push(m),f>1&&i(f===2?c[0]:c.slice(0,f-1),d+1,p),b.sort((w,_)=>w.keyTail-_.keyTail),m}const a=i(r.primaryKey.keyPath,0,r.primaryKey);o[":id"]=[a];for(const c of r.indexes)i(c.keyPath,0,c);function l(c){const d=c.query.index;return d.isVirtual?{...c,query:{index:d,range:(p=c.query.range,h=d.keyTail,{type:p.type===1?2:p.type,lower:ir(p.lower,p.lowerOpen?t.MAX_KEY:t.MIN_KEY,h),lowerOpen:!0,upper:ir(p.upper,p.upperOpen?t.MIN_KEY:t.MAX_KEY,h),upperOpen:!0})}}:c;var p,h}return{...n,schema:{...r,primaryKey:a,indexes:s,getIndexByKeyPath:function(c){const d=o[Pn(c)];return d&&d[0]}},count:c=>n.count(l(c)),query:c=>n.query(l(c)),openCursor(c){const{keyTail:d,isVirtual:p,keyLength:h}=c.query.index;return p?n.openCursor(l(c)).then(b=>b&&function(f){return Object.create(f,{continue:{value:function(m){m!=null?f.continue(ir(m,c.reverse?t.MAX_KEY:t.MIN_KEY,d)):c.unique?f.continue(f.key.slice(0,h).concat(c.reverse?t.MIN_KEY:t.MAX_KEY,d)):f.continue()}},continuePrimaryKey:{value(m,w){f.continuePrimaryKey(ir(m,t.MAX_KEY,d),w)}},primaryKey:{get:()=>f.primaryKey},key:{get(){const m=f.key;return h===1?m[0]:m.slice(0,h)}},value:{get:()=>f.value}})}(b)):n.openCursor(c)}}}}}};function zs(t,e,n,r){return n=n||{},r=r||"",Ne(t).forEach(o=>{if(Ze(e,o)){var s=t[o],i=e[o];if(typeof s=="object"&&typeof i=="object"&&s&&i){const a=Do(s);a!==Do(i)?n[r+o]=e[o]:a==="Object"?zs(s,i,n,r+o+"."):s!==i&&(n[r+o]=e[o])}else s!==i&&(n[r+o]=e[o])}else n[r+o]=void 0}),Ne(e).forEach(o=>{Ze(t,o)||(n[r+o]=e[o])}),n}const Bf={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>({...t,table(e){const n=t.table(e),{primaryKey:r}=n.schema;return{...n,mutate(s){const i=ae.trans,{deleting:a,creating:l,updating:u}=i.table(e).hook;switch(s.type){case"add":if(l.fire===be)break;return i._promise("readwrite",()=>c(s),!0);case"put":if(l.fire===be&&u.fire===be)break;return i._promise("readwrite",()=>c(s),!0);case"delete":if(a.fire===be)break;return i._promise("readwrite",()=>c(s),!0);case"deleteRange":if(a.fire===be)break;return i._promise("readwrite",()=>function(p){return d(p.trans,p.range,1e4)}(s),!0)}return n.mutate(s);function c(p){const h=ae.trans,b=p.keys||function(f,y){return y.type==="delete"?y.keys:y.keys||y.values.map(f.extractKey)}(r,p);if(!b)throw new Error("Keys missing");return(p=p.type==="add"||p.type==="put"?{...p,keys:b}:{...p}).type!=="delete"&&(p.values=[...p.values]),p.keys&&(p.keys=[...p.keys]),function(f,y,m){return y.type==="add"?Promise.resolve([]):f.getMany({trans:y.trans,keys:m,cache:"immutable"})}(n,p,b).then(f=>{const y=b.map((m,w)=>{const _=f[w],k={onerror:null,onsuccess:null};if(p.type==="delete")a.fire.call(k,m,_,h);else if(p.type==="add"||_===void 0){const x=l.fire.call(k,m,p.values[w],h);m==null&&x!=null&&(m=x,p.keys[w]=m,r.outbound||nt(p.values[w],r.keyPath,m))}else{const x=zs(_,p.values[w]),I=u.fire.call(k,x,m,_,h);if(I){const E=p.values[w];Object.keys(I).forEach(N=>{Ze(E,N)?E[N]=I[N]:nt(E,N,I[N])})}}return k});return n.mutate(p).then(({failures:m,results:w,numFailures:_,lastResult:k})=>{for(let x=0;x(y.forEach(w=>w.onerror&&w.onerror(m)),Promise.reject(m)))})}function d(p,h,b){return n.query({trans:p,values:!1,query:{index:r,range:h},limit:b}).then(({result:f})=>c({type:"delete",keys:f,trans:p}).then(y=>y.numFailures>0?Promise.reject(y.failures[0]):f.length({table:e=>{const n=t.table(e);return{...n,getMany:r=>{if(!r.cache)return n.getMany(r);const o=Xi(r.keys,r.trans._cache,r.cache==="clone");return o?oe.resolve(o):n.getMany(r).then(s=>(r.trans._cache={keys:r.keys,values:r.cache==="clone"?Vn(s):s},s))},mutate:r=>(r.type!=="add"&&(r.trans._cache=null),n.mutate(r))}}})};function Ls(t){return!("from"in t)}const ft=function(t,e){if(!this){const n=new ft;return t&&"d"in t&&We(n,t),n}We(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0})};function Wn(t,e,n){const r=ze(e,n);if(isNaN(r))return;if(r>0)throw RangeError();if(Ls(t))return We(t,{from:e,to:n,d:1});const o=t.l,s=t.r;if(ze(n,t.from)<0)return o?Wn(o,e,n):t.l={from:e,to:n,d:1,l:null,r:null},ga(t);if(ze(e,t.to)>0)return s?Wn(s,e,n):t.r={from:e,to:n,d:1,l:null,r:null},ga(t);ze(e,t.from)<0&&(t.from=e,t.l=null,t.d=s?s.d+1:1),ze(n,t.to)>0&&(t.to=n,t.r=null,t.d=t.l?t.l.d+1:1);const i=!t.r;o&&!t.l&&Nr(t,o),s&&i&&Nr(t,s)}function Nr(t,e){Ls(e)||function n(r,{from:o,to:s,l:i,r:a}){Wn(r,o,s),i&&n(r,i),a&&n(r,a)}(t,e)}function zf(t,e){const n=Jo(e);let r=n.next();if(r.done)return!1;let o=r.value;const s=Jo(t);let i=s.next(o.from),a=i.value;for(;!r.done&&!i.done;){if(ze(a.from,o.to)<=0&&ze(a.to,o.from)>=0)return!0;ze(o.from,a.from)<0?o=(r=n.next(a.from)).value:a=(i=s.next(o.from)).value}return!1}function Jo(t){let e=Ls(t)?null:{s:0,n:t};return{next(n){const r=arguments.length>0;for(;e;)switch(e.s){case 0:if(e.s=1,r)for(;e.n.l&&ze(n,e.n.from)<0;)e={up:e,n:e.n.l,s:1};else for(;e.n.l;)e={up:e,n:e.n.l,s:1};case 1:if(e.s=2,!r||ze(n,e.n.to)<=0)return{value:e.n,done:!1};case 2:if(e.n.r){e.s=3,e={up:e,n:e.n.r,s:0};continue}case 3:e=e.up}return{done:!0}}}}function ga(t){var e,n;const r=(((e=t.r)===null||e===void 0?void 0:e.d)||0)-(((n=t.l)===null||n===void 0?void 0:n.d)||0),o=r>1?"r":r<-1?"l":"";if(o){const s=o==="r"?"l":"r",i={...t},a=t[o];t.from=a.from,t.to=a.to,t[o]=a[o],i[o]=a[s],t[s]=i,i.d=wa(i)}t.d=wa(t)}function wa({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}fn(ft.prototype,{add(t){return Nr(this,t),this},addKey(t){return Wn(this,t,t),this},addKeys(t){return t.forEach(e=>Wn(this,e,e)),this},[Po](){return Jo(this)}});const Lf={stack:"dbcore",level:0,create:t=>{const e=t.schema.name,n=new ft(t.MIN_KEY,t.MAX_KEY);return{...t,table:r=>{const o=t.table(r),{schema:s}=o,{primaryKey:i}=s,{extractKey:a,outbound:l}=i,u={...o,mutate:p=>{const h=p.trans,b=h.mutatedParts||(h.mutatedParts={}),f=I=>{const E=`idb://${e}/${r}/${I}`;return b[E]||(b[E]=new ft)},y=f(""),m=f(":dels"),{type:w}=p;let[_,k]=p.type==="deleteRange"?[p.range]:p.type==="delete"?[p.keys]:p.values.length<50?[[],p.values]:[];const x=p.trans._cache;return o.mutate(p).then(I=>{if(Me(_)){w!=="delete"&&(_=I.results),y.addKeys(_);const E=Xi(_,x);E||w==="add"||m.addKeys(_),(E||k)&&function(N,D,R,K){function P(B){const v=N(B.name||"");function T(A){return A!=null?B.extractKey(A):null}const H=A=>B.multiEntry&&Me(A)?A.forEach(X=>v.addKey(X)):v.addKey(A);(R||K).forEach((A,X)=>{const $=R&&T(R[X]),ne=K&&T(K[X]);ze($,ne)!==0&&($!=null&&H($),ne!=null&&H(ne))})}D.indexes.forEach(P)}(f,s,E,k)}else if(_){const E={from:_.lower,to:_.upper};m.add(E),y.add(E)}else y.add(n),m.add(n),s.indexes.forEach(E=>f(E.name).add(n));return I})}},c=({query:{index:p,range:h}})=>{var b,f;return[p,new ft((b=h.lower)!==null&&b!==void 0?b:t.MIN_KEY,(f=h.upper)!==null&&f!==void 0?f:t.MAX_KEY)]},d={get:p=>[i,new ft(p.key)],getMany:p=>[i,new ft().addKeys(p.keys)],count:c,query:c,openCursor:c};return Ne(d).forEach(p=>{u[p]=function(h){const{subscr:b}=ae;if(b){const f=k=>{const x=`idb://${e}/${r}/${k}`;return b[x]||(b[x]=new ft)},y=f(""),m=f(":dels"),[w,_]=d[p](h);if(f(w.name||"").add(_),!w.isPrimaryKey){if(p!=="count"){const k=p==="query"&&l&&h.values&&o.query({...h,values:!1});return o[p].apply(this,arguments).then(x=>{if(p==="query"){if(l&&h.values)return k.then(({result:E})=>(y.addKeys(E),x));const I=h.values?x.result.map(a):x.result;h.values?y.addKeys(I):m.addKeys(I)}else if(p==="openCursor"){const I=x,E=h.values;return I&&Object.create(I,{key:{get:()=>(m.addKey(I.primaryKey),I.key)},primaryKey:{get(){const N=I.primaryKey;return m.addKey(N),N}},value:{get:()=>(E&&y.addKey(I.primaryKey),I.value)}})}return x})}m.add(n)}}return o[p].apply(this,arguments)}}),u}}}};class Kt{constructor(e,n){this._middlewares={},this.verno=0;const r=Kt.dependencies;this._options=n={addons:Kt.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange,...n},this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};const{addons:o}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:be,dbReadyPromise:null,cancelOpen:be,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var i;s.dbReadyPromise=new oe(a=>{s.dbReadyResolve=a}),s.openCanceller=new oe((a,l)=>{s.cancelOpen=l}),this._state=s,this.name=e,this.on=Dn(this,"populate","blocked","versionchange","close",{ready:[Ns,be]}),this.on.ready.subscribe=Ei(this.on.ready.subscribe,a=>(l,u)=>{Kt.vip(()=>{const c=this._state;if(c.openComplete)c.dbOpenError||oe.resolve().then(l),u&&a(l);else if(c.onReadyBeingFired)c.onReadyBeingFired.push(l),u&&a(l);else{a(l);const d=this;u||a(function p(){d.on.ready.unsubscribe(l),d.on.ready.unsubscribe(p)})}})}),this.Collection=(i=this,bn(xf.prototype,function(a,l){this.db=i;let u=qi,c=null;if(l)try{u=l()}catch(b){c=b}const d=a._ctx,p=d.table,h=p.hook.reading.fire;this._ctx={table:p,index:d.index,isPrimKey:!d.index||p.schema.primKey.keyPath&&d.index===p.schema.primKey.name,range:u,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:c,or:d.or,valueMapper:h!==Tn?h:null}})),this.Table=function(a){return bn(kf.prototype,function(l,u,c){this.db=a,this._tx=c,this.name=l,this.schema=u,this.hook=a._allTables[l]?a._allTables[l].hook:Dn(null,{creating:[uf,be],reading:[cf,Tn],updating:[ff,be],deleting:[df,be]})})}(this),this.Transaction=function(a){return bn(Of.prototype,function(l,u,c,d,p){this.db=a,this.mode=l,this.storeNames=u,this.schema=c,this.chromeTransactionDurability=d,this.idbtrans=null,this.on=Dn(this,"complete","error","abort"),this.parent=p||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new oe((h,b)=>{this._resolve=h,this._reject=b}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},h=>{var b=this.active;return this.active=!1,this.on.error.fire(h),this.parent?this.parent._reject(h):b&&this.idbtrans&&this.idbtrans.abort(),Fe(h)})})}(this),this.Version=function(a){return bn(Af.prototype,function(l){this.db=a,this._cfg={version:l,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(a){return bn(Vi.prototype,function(l,u,c){this.db=a,this._ctx={table:l,index:u===":id"?null:u,or:c};const d=a._deps.indexedDB;if(!d)throw new le.MissingAPI;this._cmp=this._ascending=d.cmp.bind(d),this._descending=(p,h)=>d.cmp(h,p),this._max=(p,h)=>d.cmp(p,h)>0?p:h,this._min=(p,h)=>d.cmp(p,h)<0?p:h,this._IDBKeyRange=a._deps.IDBKeyRange})}(this),this.on("versionchange",a=>{a.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()}),this.on("blocked",a=>{!a.newVersion||a.newVersionnew this.Transaction(a,l,u,this._options.chromeTransactionDurability,c),this._fireOnBlocked=a=>{this.on("blocked").fire(a),In.filter(l=>l.name===this.name&&l!==this&&!l._state.vcFired).map(l=>l.on("versionchange").fire(a))},this.use(Tf),this.use(Bf),this.use(Lf),this.use(Mf),this.vip=Object.create(this,{_vip:{value:!0}}),o.forEach(a=>a(this))}version(e){if(isNaN(e)||e<.1)throw new le.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new le.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);const n=this._versions;var r=n.filter(o=>o._cfg.version===e)[0];return r||(r=new this.Version(e),n.push(r),n.sort(Pf),r.stores({}),this._state.autoSchema=!1,r)}_whenReady(e){return this.idbdb&&(this._state.openComplete||ae.letThrough||this._vip)?e():new oe((n,r)=>{if(this._state.openComplete)return r(new le.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void r(new le.DatabaseClosed);this.open().catch(be)}this._state.dbReadyPromise.then(n,r)}).then(e)}use({stack:e,create:n,level:r,name:o}){o&&this.unuse({stack:e,name:o});const s=this._middlewares[e]||(this._middlewares[e]=[]);return s.push({stack:e,create:n,level:r??10,name:o}),s.sort((i,a)=>i.level-a.level),this}unuse({stack:e,name:n,create:r}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter(o=>r?o.create!==r:!!n&&o.name!==n)),this}open(){return Ff(this)}_close(){const e=this._state,n=In.indexOf(this);if(n>=0&&In.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}e.dbReadyPromise=new oe(r=>{e.dbReadyResolve=r}),e.openCanceller=new oe((r,o)=>{e.cancelOpen=o})}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new le.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,n=this._state;return new oe((r,o)=>{const s=()=>{this.close();var i=this._deps.indexedDB.deleteDatabase(this.name);i.onsuccess=Ce(()=>{(function({indexedDB:a,IDBKeyRange:l},u){!Ms(a)&&u!==eo&&Bs(a,l).delete(u).catch(be)})(this._deps,this.name),r()}),i.onerror=st(o),i.onblocked=this._fireOnBlocked};if(e)throw new le.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(s):s()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){const e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return Ne(this._allTables).map(e=>this._allTables[e])}transaction(){const e=Rf.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,n,r){let o=ae.trans;o&&o.db===this&&e.indexOf("!")===-1||(o=null);const s=e.indexOf("?")!==-1;let i,a;e=e.replace("!","").replace("?","");try{if(a=n.map(u=>{var c=u instanceof this.Table?u.name:u;if(typeof c!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return c}),e=="r"||e===co)i=co;else{if(e!="rw"&&e!=uo)throw new le.InvalidArgument("Invalid transaction mode: "+e);i=uo}if(o){if(o.mode===co&&i===uo){if(!s)throw new le.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o=null}o&&a.forEach(u=>{if(o&&o.storeNames.indexOf(u)===-1){if(!s)throw new le.SubTransaction("Table "+u+" not included in parent transaction.");o=null}}),s&&o&&!o.active&&(o=null)}}catch(u){return o?o._promise(null,(c,d)=>{d(u)}):Fe(u)}const l=Ji.bind(null,this,i,a,o,r);return o?o._promise(i,l,"lock"):ae.trans?mn(ae.transless,()=>this._whenReady(l)):this._whenReady(l)}table(e){if(!Ze(this._allTables,e))throw new le.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}const Wf=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class Uf{constructor(e){this._subscribe=e}subscribe(e,n,r){return this._subscribe(e&&typeof e!="function"?e:{next:e,error:n,complete:r})}[Wf](){return this}}function Qi(t,e){return Ne(e).forEach(n=>{Nr(t[n]||(t[n]=new ft),e[n])}),t}function Kf(t){let e,n=!1;const r=new Uf(o=>{const s=Ps(t);let i=!1,a={},l={};const u={get closed(){return i},unsubscribe:()=>{i=!0,Dt.storagemutated.unsubscribe(h)}};o.start&&o.start(u);let c=!1,d=!1;function p(){return Ne(l).some(f=>a[f]&&zf(a[f],l[f]))}const h=f=>{Qi(a,f),p()&&b()},b=()=>{if(c||i)return;a={};const f={},y=function(m){s&&pn();const w=()=>Ot(t,{subscr:m,trans:null}),_=ae.trans?mn(ae.transless,w):w();return s&&_.then(gt,gt),_}(f);d||(Dt(zn,h),d=!0),c=!0,Promise.resolve(y).then(m=>{n=!0,e=m,c=!1,i||(p()?b():(a={},l=f,o.next&&o.next(m)))},m=>{c=!1,n=!1,o.error&&o.error(m),u.unsubscribe()})};return b(),u});return r.hasValue=()=>n,r.getValue=()=>e,r}let Xo;try{Xo={indexedDB:Ee.indexedDB||Ee.mozIndexedDB||Ee.webkitIndexedDB||Ee.msIndexedDB,IDBKeyRange:Ee.IDBKeyRange||Ee.webkitIDBKeyRange}}catch{Xo={indexedDB:null,IDBKeyRange:null}}const Rt=Kt;function vr(t){let e=pt;try{pt=!0,Dt.storagemutated.fire(t)}finally{pt=e}}fn(Rt,{...dr,delete:t=>new Rt(t,{addons:[]}).delete(),exists:t=>new Rt(t,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(t){try{return function({indexedDB:e,IDBKeyRange:n}){return Ms(e)?Promise.resolve(e.databases()).then(r=>r.map(o=>o.name).filter(o=>o!==eo)):Bs(e,n).toCollection().primaryKeys()}(Rt.dependencies).then(t)}catch{return Fe(new le.MissingAPI)}},defineClass:()=>function(t){We(this,t)},ignoreTransaction:t=>ae.trans?mn(ae.transless,t):t(),vip:Go,async:function(t){return function(){try{var e=Yo(t.apply(this,arguments));return e&&typeof e.then=="function"?e:oe.resolve(e)}catch(n){return Fe(n)}}},spawn:function(t,e,n){try{var r=Yo(t.apply(n,e||[]));return r&&typeof r.then=="function"?r:oe.resolve(r)}catch(o){return Fe(o)}},currentTransaction:{get:()=>ae.trans||null},waitFor:function(t,e){const n=oe.resolve(typeof t=="function"?Rt.ignoreTransaction(t):t).timeout(e||6e4);return ae.trans?ae.trans.waitFor(n):n},Promise:oe,debug:{get:()=>ct,set:t=>{Pi(t,t==="dexie"?()=>!0:$i)}},derive:on,extend:We,props:fn,override:Ei,Events:Dn,on:Dt,liveQuery:Kf,extendObservabilitySet:Qi,getByKeyPath:yt,setByKeyPath:nt,delByKeyPath:function(t,e){typeof e=="string"?nt(t,e,void 0):"length"in e&&[].map.call(e,function(n){nt(t,n,void 0)})},shallowClone:Oi,deepClone:Vn,getObjectDiff:zs,cmp:ze,asap:Ci,minKey:Wo,addons:[],connections:In,errnames:As,dependencies:Xo,semVer:fa,version:fa.split(".").map(t=>parseInt(t)).reduce((t,e,n)=>t+e/Math.pow(10,2*n))}),Rt.maxKey=Ln(Rt.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(Dt(zn,t=>{if(!pt){let e;Qr?(e=document.createEvent("CustomEvent"),e.initCustomEvent(Et,!0,!0,t)):e=new CustomEvent(Et,{detail:t}),pt=!0,dispatchEvent(e),pt=!1}}),addEventListener(Et,({detail:t})=>{pt||vr(t)}));let pt=!1;if(typeof BroadcastChannel<"u"){const t=new BroadcastChannel(Et);typeof t.unref=="function"&&t.unref(),Dt(zn,e=>{pt||t.postMessage(e)}),t.onmessage=e=>{e.data&&vr(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){Dt(zn,e=>{try{pt||(typeof localStorage<"u"&&localStorage.setItem(Et,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(n=>n.postMessage({type:Et,changedParts:e})))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",e=>{if(e.key===Et){const n=JSON.parse(e.newValue);n&&vr(n.changedParts)}});const t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",function({data:e}){e&&e.type===Et&&vr(e.changedParts)})}oe.rejectionMapper=function(t,e){if(!t||t instanceof sn||t instanceof TypeError||t instanceof SyntaxError||!t.name||!la[t.name])return t;var n=new la[t.name](e||t.message,t);return"stack"in t&&mt(n,"stack",{get:function(){return this.inner.stack}}),n},Pi(ct,$i);var $f=(t=>(t.SAVE="save",t.SAVE_AS="saveAs",t.openSpotlightSearch="openSpotlightSearch",t))($f||{}),gr=(t=>(t.MOVE_TO_ROOT_FOLDER="moveToRootFolder",t.DELETE="delete",t))(gr||{});const qf="comfyui_workspace_db";class Hf extends Kt{constructor(){super(qf);Se(this,"workflows");Se(this,"changelogs");Se(this,"media");Se(this,"folders");Se(this,"tags");Se(this,"userSettings");Se(this,"models");Se(this,"cache");Se(this,"workflowVersions");this.version(1).stores({workflows:"&id, name, parentFolderID",changelogs:"&id, workflowID",media:"&id, workflowID",folders:"&id, name, parentFolderID",tags:"&name",userSettings:"&id",models:"&id, fileName, fileHash",cache:"&id"}).upgrade(n=>{}),this.version(2).stores({workflows:"&id, name, parentFolderID,cloudID",changelogs:"&id, workflowID",media:"&id, workflowID",folders:"&id, name, parentFolderID",tags:"&name",userSettings:"&id",models:"&id, fileName, fileHash",cache:"&id",workflowVersions:"&id, name, workflowID,cloudID"}).upgrade(n=>{})}}const ce=new Hf;class Yt{constructor(e){Se(this,"tableName");this.tableName=e}async saveDiskDB(){const e=await ce[this.tableName].toArray(),n={};e.forEach(r=>{r.id?n[r.id]=r:r.name?n[r.name]=r:console.error("TableBaseModel should have id or name")});try{Hd(this.tableName,JSON.stringify(n))}catch(r){console.error("error saving disk db",r)}}async add(e){return e.id||(e.id=Fn()),e.createTime||(e.createTime=Date.now()),await ce[this.tableName].add(e),await this.saveDiskDB(),e}async put(e){return await ce[this.tableName].put(e),await this.saveDiskDB(),e}async bulkPut(e){await ce[this.tableName].bulkPut(e),this.saveDiskDB()}async update(e,n){return await ce[this.tableName].update(e,n),this.saveDiskDB(),await this.get(e)??null}async listAll(){return await ce[this.tableName].toArray()}async filter(e){return await ce[this.tableName].filter(e).toArray()}async batchQuery(e){return await ce[this.tableName].bulkGet(e)}async getRecords(){console.warn("[DEPRECATED] getRecords() call, should only be used for one-time backfill for indexdb",this.tableName);const e=await qd(this.tableName);let n;try{n=e!=null?JSON.parse(e):null}catch{}if(n==null){const r=await Jd()??"{}";n=JSON.parse(r)[this.tableName]}return n??{}}async get(e){return await ce[this.tableName].get(e)}async delete(e){await ce[this.tableName].delete(e),this.saveDiskDB()}async listByIndex(e,n){return await ce[this.tableName].where(e).equals(n).toArray()}}const Vf=80,Tr=class Tr extends Yt{constructor(){super("changelogs")}static async load(){return new Tr}async listByWorkflowID(e){return await ce.changelogs.where("workflowID").equals(e).reverse().sortBy("createTime")}async getLastestByWorkflowID(e){return(await this.listByWorkflowID(e))[0]}async create(e){const n=await this.getLastestByWorkflowID(e.workflowID);if(n!=null&&n.json===e.json)return null;const r={id:Fn(),json:e.json,workflowID:e.workflowID,createTime:Date.now(),isAutoSave:e.isAutoSave};return await ce.changelogs.add(r),await this.deleteLogsExceedLimit(e.workflowID),r}async deleteLogsExceedLimit(e){var o;const n=await ce.changelogs.where("workflowID").equals(e).reverse().sortBy("createTime"),r=((o=Y==null?void 0:Y.settings)==null?void 0:o.maximumChangelogNumber)??Vf;if(n.length>r){const s=n.slice(r);await ce.changelogs.bulkDelete(s.map(i=>i.id))}}};Se(Tr,"TABLE_NAME","changelogs");let Qo=Tr;const hp="CWM_WORKFLOWS_SORT_TYPE";var at=(t=>(t.RECENTLY_OPENED="recentlyOpened",t.RECENTLY_MODIFIED="newest",t.OLDEST_MODIFIED="oldest",t.AZ="name A-Z",t.ZA="name Z-A",t))(at||{});const pp=[{title:"Import Workflows",type:"file"},{title:"Import Folder",type:"folder"}];function el(t,e=!0,n=!1,r="-"){const o=new Date(t),s=String(o.getDate()).padStart(2,"0"),i=String(o.getMonth()+1).padStart(2,"0"),a=o.getFullYear(),l=String(o.getHours()).padStart(2,"0"),u=String(o.getMinutes()).padStart(2,"0"),c=String(o.getSeconds()).padStart(2,"0"),d=`${i}${r}${s}${r}${a}`;return e?d+` ${l}:${u}`:n?d+`:${c}`:d}const wr=(t,e=at.RECENTLY_MODIFIED)=>{const n=[...t];switch(e){case at.AZ:n.sort((r,o)=>r.name.localeCompare(o.name));break;case at.ZA:n.sort((r,o)=>o.name.localeCompare(r.name));break;case at.RECENTLY_MODIFIED:n.sort((r,o)=>o.updateTime-r.updateTime);break;case at.OLDEST_MODIFIED:n.sort((r,o)=>r.updateTime-o.updateTime);break;case at.RECENTLY_OPENED:n.sort((r,o)=>(o.lastOpenedTime??0)-(r.lastOpenedTime??0));break}return n};function Zf(t){const e=t.nodes,n=new Array,r=new Map,o=new Array;for(let s=0;s{var n;const e=(n=Y==null?void 0:Y.settings)==null?void 0:n.shortcuts;if(!e)return!1;for(const r in e){const s=e[r].split("+"),i={Control:t.ctrlKey,Shift:t.shiftKey,Alt:t.altKey,Command:t.metaKey,[t.key.toUpperCase()]:!0};for(const a in i)i[a]||delete i[a];if(s.length===Object.keys(i).length&&s.every(a=>i[a]))return r}};function vp(t){const e=["png","jpg","jpeg","gif","bmp","webp"],n=t.split(".").pop();return n!=null&&e.includes(n)}function Gf(t){return`/workspace/view_media?filename=${t}`}function ba(){const e=window.location.hash.slice(1).split("/").find(n=>n.includes("workspaceId@"));return e?e.split("@")[1]:null}function tl(t){const e=window.location.hash.slice(1).split("/"),n=e.findIndex(o=>o.includes("workspaceId@")),r=`workspaceId@${t}`;return n>=0?e[n]=r:e.push(r),`${e.join("/")}`}const Yf=t=>{const e=tl(t);window.open(`${window.location.origin}/#${e}`)},nl={last_node_id:9,last_link_id:9,nodes:[{id:7,type:"CLIPTextEncode",pos:[413,389],size:{0:425.27801513671875,1:180.6060791015625},flags:{},order:3,mode:0,inputs:[{name:"clip",type:"CLIP",link:5}],outputs:[{name:"CONDITIONING",type:"CONDITIONING",links:[6],slot_index:0}],properties:{},widgets_values:["text, watermark"]},{id:6,type:"CLIPTextEncode",pos:[415,186],size:{0:422.84503173828125,1:164.31304931640625},flags:{},order:2,mode:0,inputs:[{name:"clip",type:"CLIP",link:3}],outputs:[{name:"CONDITIONING",type:"CONDITIONING",links:[4],slot_index:0}],properties:{},widgets_values:["beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"]},{id:5,type:"EmptyLatentImage",pos:[473,609],size:{0:315,1:106},flags:{},order:1,mode:0,outputs:[{name:"LATENT",type:"LATENT",links:[2],slot_index:0}],properties:{},widgets_values:[512,512,1]},{id:3,type:"KSampler",pos:[863,186],size:{0:315,1:262},flags:{},order:4,mode:0,inputs:[{name:"model",type:"MODEL",link:1},{name:"positive",type:"CONDITIONING",link:4},{name:"negative",type:"CONDITIONING",link:6},{name:"latent_image",type:"LATENT",link:2}],outputs:[{name:"LATENT",type:"LATENT",links:[7],slot_index:0}],properties:{},widgets_values:[0x8e7ff42ed37e,!0,20,8,"euler","normal",1]},{id:8,type:"VAEDecode",pos:[1209,188],size:{0:210,1:46},flags:{},order:5,mode:0,inputs:[{name:"samples",type:"LATENT",link:7},{name:"vae",type:"VAE",link:8}],outputs:[{name:"IMAGE",type:"IMAGE",links:[9],slot_index:0}],properties:{}},{id:9,type:"SaveImage",pos:[1451,189],size:{0:210,1:26},flags:{},order:6,mode:0,inputs:[{name:"images",type:"IMAGE",link:9}],properties:{}},{id:4,type:"CheckpointLoaderSimple",pos:[26,474],size:{0:315,1:98},flags:{},order:0,mode:0,outputs:[{name:"MODEL",type:"MODEL",links:[1],slot_index:0},{name:"CLIP",type:"CLIP",links:[3,5],slot_index:1},{name:"VAE",type:"VAE",links:[8],slot_index:2}],properties:{},widgets_values:["v1-5-pruned-emaonly.ckpt"]}],links:[[1,4,0,3,0,"MODEL"],[2,5,0,3,3,"LATENT"],[3,4,1,6,0,"CLIP"],[4,6,0,3,1,"CONDITIONING"],[5,4,1,7,0,"CLIP"],[6,7,0,3,2,"CONDITIONING"],[7,3,0,8,0,"LATENT"],[8,4,2,8,1,"VAE"],[9,8,0,9,0,"IMAGE"]],groups:[],config:{},extra:{},version:.4},xt="workspace_info",Jf=9999999,yo="upgrade_to_2way_sync",Ws=28,gp="SHORTCUT_TRIGGER_EVENT";function br(...t){const e=t.filter(n=>n!=="").join("/");return Pt(e)}function Pt(t){let n=t.split("/").filter(r=>r!=="").join("/").replace(/\\/g,"/");return n=n.replace(/^\/+/,""),n}function vo(t){return br(t.parentFolderID??"",t.name+".json")}var Ye;(t=>{async function e(l,u){try{const d=await(await Ie("/workspace/file/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:vo(l),newParentPath:u})})).json();return d.error?(alert("Error moving file: "+d.error),!1):!0}catch(c){console.error("Error deleting file:",c)}}t.moveWorkflow=e;async function n(l,u){try{const d=await(await Ie("/workspace/file/gen_unique_name",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:br(u??"",l)})})).json();return d.error?(console.error("Error getting unique name:",d.error),null):d.uniqueName}catch(c){console.error("Error deleting file:",c)}return null}t.genFileUniqueName=n;async function r({parentFolderID:l,name:u},c){try{const p=await(await Ie("/workspace/file/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:br(l??"",u+".json"),newName:c})})).json();return p.error?(alert("Error rename file: "+p.error),!1):!0}catch(d){console.error("Error deleting file:",d)}}t.renameWorkflow=r;async function o(l){const u=l.json,c=JSON.parse(u);c.extra[xt]==null&&(c.extra[xt]={}),c.extra[xt].id=l.id;const p=await(await Ie("/workspace/file/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:vo(l),json:JSON.stringify(c)})})).json();if(p.error)throw console.error("Error saving file:",p.error),alert(`"Error saving file: ${p.error} + + 👉Please try "Save as" from "Files" dropdown menu + `),new Error(p.error);return p}t.saveWorkflow=o;async function s(l){try{return await(await Ie("/workspace/delete_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:vo(l),deleteEmptyFolder:!1})})).text()}catch(u){alert("Error deleting workflow .json file: "+u),console.error("Error deleting file:",u)}}t.deleteWorkflow=s;async function i({parentFolderID:l,name:u,json:c,id:d}){var b;let p=JSON.parse(c);p.extra==null&&(p.extra={}),p.extra[xt]==null&&(p.extra[xt]={}),p.extra[xt].id=d;const h={parentFolderPath:Pt(l??""),name:u,json:JSON.stringify(p)};try{const y=await(await Ie("/workspace/create_workflow_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).json();return y.name&&await((b=ce.workflows)==null?void 0:b.update(d,{name:y.name})),y}catch(f){return console.error(`Error creating file <${d}> at "${l}"`,f),alert(`Error creating file <${d}> at "${l}"`),{}}}t.createWorkflow=i;async function a({parentFolderID:l,name:u,id:c}){const d=br(l??"",u+".json");try{const h=await(await Ie("/workspace/get_workflow_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:d,id:c})})).json();return h.error&&(console.error(`Error getting file <${c}> at "${d}"`,h.error),alert({message:`Error getting file <${c}> at "${d}"`,level:"error"})),h}catch(p){return console.error(`Erro finding file <${c}> at "${d}"`,p),{}}}t.getFile=a})(Ye||(Ye={}));async function Us(t,e=!1,n=!1){try{return await(await Ie("/workspace/file/scan_my_workflows_folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Pt(t),recursive:e,metaInfoOnly:n})})).json()}catch(r){return console.error("Error scan local new files:",r),[]}}async function Xf(t,e){const n=Pt(t??""),o=(await Us(n)).map(async a=>{var c;const l=a.name,u=[n,l].join("/");return Qf(a)?{id:Pt(u),name:a.name,parentFolderID:n,type:"folder",createTime:Date.now(),updateTime:Date.now()}:{...await((c=ce.workflows)==null?void 0:c.get(a.id).catch(h=>(console.error("Error getting workflow from indexdb",h),null)))??{createTime:Date.now(),updateTime:Date.now()},id:a.id,json:a.json??"{}",name:l.replace(/\.json$/,""),parentFolderID:n,createTime:a.createTime}}),s=await Promise.all(o);ce.workflows.bulkPut(s.filter(a=>!nh(a)));const i=s.filter(a=>a!=null);return wr(i,e??at.RECENTLY_MODIFIED)}function Qf(t){return"type"in t&&t.type==="folder"}const Br=class Br extends Yt{constructor(){super("workflows");Se(this,"_curWorkflow",null)}get curWorkflow(){return this._curWorkflow}static async load(){return new Br}updateCurWorkflowID(n){if(n==null){this._curWorkflow=null;return}this.get(n).then(r=>{this._curWorkflow=r??null})}updateCurWorkflow(n){this._curWorkflow=n}async latestVersionCheck(){if(this._curWorkflow){const n=await ce.workflows.get(this._curWorkflow.id);return n?(n==null?void 0:n.updateTime)===this._curWorkflow.updateTime:!0}return!0}async listByIndex(n,r){const o=await super.listByIndex(n,r);return await(Y==null?void 0:Y.getSetting("twoWaySync"))?(await Promise.all(o.map(async a=>await this.get(a.id)))).filter(a=>a!=null):o}async generateUniqueName(n,r){if(await(Y==null?void 0:Y.getSetting("twoWaySync"))){const l=await Ye.genFileUniqueName((n??"Untitled Flow")+".json",r??"");return(l==null?void 0:l.replace(/\.json$/,""))??"Untitled Flow"}let s=n??"Untitled Flow";const a=(await this.listAll()??[]).filter(l=>l.parentFolderID==r).map(l=>l.name);if(a.includes(s)){let l=2,u=!0;for(;u;)a.includes(`${s} ${l}`)?l++:(s=`${s} ${l}`,u=!1)}return s}async createFlow(n){const{name:r}=n,o=await this.generateUniqueName(r,n.parentFolderID??void 0),s=Date.now(),i={...n,id:n.id??Fn(),json:n.json??JSON.stringify(nl),name:o,updateTime:n.updateTime??s,createTime:n.createTime??s};return await ce.workflows.add(i),this.saveDiskDB(),await(Y==null?void 0:Y.getSetting("twoWaySync"))?(await Ye.createWorkflow(i),await this.get(i.id)):i}async update(n,r){throw new Error("Method not allowed.")}async updateTopFields(n,r){return this._update(n,r)}async updateMetaInfo(n,r){return this._update(n,r)}async _update(n,r){await ce.workflows.update(n,r);const o=await ce.workflows.get(n)??null;return this._curWorkflow&&this._curWorkflow.id===n&&(this._curWorkflow=o),this.saveDiskDB(),o}async updateFolder(n,r){const o=await(Y==null?void 0:Y.getSetting("twoWaySync")),s=await this.get(n);!await this.updateMetaInfo(n,r)||!s||o&&await Ye.moveWorkflow(s,r.parentFolderID)}async genLastManualSavedJson(n){const r=await(He==null?void 0:He.getLastestByWorkflowID(n));return r==null?void 0:r.json}async updateName(n,r){const o=await this.get(n);return await(Y==null?void 0:Y.getSetting("twoWaySync"))&&o&&await Ye.renameWorkflow(o,r.name+".json"),await this.updateMetaInfo(n,r)}async updateFlow(n,r){const o=await this.get(n,!1);if(o==null)return;const s=JSON.stringify(o.json),i=JSON.stringify(r.json);if(s===i)return;const a=await this._update(n,{updateTime:Date.now(),json:r.json});await(Y==null?void 0:Y.getSetting("twoWaySync"))&&a&&await Ye.saveWorkflow(a)}async batchCreateFlows(n=[],r=!1,o){var i,a;const s=[];for(const l of n){const u=l.name&&r?l.name:await this.generateUniqueName(l.name,o),c=Fn(),d=Date.now(),p={id:c,name:u,json:l.json,parentFolderID:o,updateTime:d,createTime:d,tags:[]};if(s.push(p),await(Y==null?void 0:Y.getSetting("twoWaySync")))try{const b=JSON.parse(l.json),f=(a=(i=b==null?void 0:b.extra)==null?void 0:i[xt])==null?void 0:a.id;f&&(await this.get(f)||(p.id=f)),Ye.createWorkflow(p)}catch(b){console.error("batchCreateFlows error",b)}}try{await ce.workflows.bulkAdd(s),this.saveDiskDB()}catch(l){console.error("batchCreateFlows error",l)}}async deleteFlow(n){const r=await this.get(n);r&&await(Y==null?void 0:Y.getSetting("twoWaySync"))&&await Ye.deleteWorkflow(r),await ce.workflows.delete(n),this.saveDiskDB()}async batchDeleteFlow(n){const r=await ce.workflows.bulkGet(n);for(const o of r){if(!o)return;await(Y==null?void 0:Y.getSetting("twoWaySync"))&&await Ye.deleteWorkflow(o)}await ce.workflows.bulkDelete(n),this.saveDiskDB()}async listFolderContent(n,r){if(await(Y==null?void 0:Y.getSetting("twoWaySync"))){const l=await Xf(n??null);return wr(l,r??at.RECENTLY_MODIFIED)}const s=await this.listAll().then(l=>l.filter(u=>u.parentFolderID==n))??[],i=await(qe==null?void 0:qe.listAll().then(l=>l.filter(u=>u.parentFolderID==n)))??[],a=[...s,...i];return wr(a,r??at.RECENTLY_MODIFIED)}async get(n,r=!0){const o=await(Y==null?void 0:Y.getSetting("twoWaySync")),s=await ce.workflows.get(n);if(!o||!r)return s;if(s==null)return;const i=await Ye.getFile({parentFolderID:s.parentFolderID??null,name:s.name,id:s.id});if(i.json)return{...s,json:JSON.stringify(i.json)}}async listAll(n){const r=await(Y==null?void 0:Y.getSetting("twoWaySync"));let o;if(r){const i=(await Us("",!0)).filter(a=>(a==null?void 0:a.type)==="workflow").map(async a=>{const l=await ce.workflows.get(a.id);return a.updateTime=(l==null?void 0:l.updateTime)??Date.now(),l!=null&&l.lastOpenedTime&&(a.lastOpenedTime=l==null?void 0:l.lastOpenedTime),a});o=await Promise.all(i)}else o=await ce.workflows.toArray();return n?wr(o,n):o}async updateLastOpenedTime(n){await ce.workflows.update(n,{lastOpenedTime:Date.now()})}};Se(Br,"TABLE_NAME","workflows");let es=Br;var Ct;(t=>{async function e({parentFolderID:a,name:l}){return Pt(`${a??""}/${l}`)}t.genFolderRelPath=e;async function n(a){await Ie("/workspace/folder/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Pt(a.id)})})}t.createFolder=n;async function r(a,l){const c=await(await Ie("/workspace/folder/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder:a,newParentPath:l})})).json();c.error&&alert("Failed to move folder: "+c.error)}t.moveFolder=r;async function o(a){try{return await(await Ie("/workspace/folder/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})})).text()}catch(l){console.error("Error deleting file:",l)}}t.deleteFolder=o;async function s(a){try{const u=await(await Ie("/workspace/file/count_files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})})).json();return u.error&&console.error("Error counting files:",u.error),u.count}catch(l){console.error("Error renaming file:",l)}return null}t.genFilesCountInFolder=s;async function i(a,l){try{const c=await(await Ie("/workspace/folder/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({absPath:a,newName:l})})).json();c.error&&alert("Failed to rename folder: "+c.error)}catch(u){console.error("Error renaming file:",u)}}t.renameFolder=i})(Ct||(Ct={}));const Mr=class Mr extends Yt{constructor(){super("folders")}static async load(){return new Mr}async create(e){const n=await this.generateUniqueName(e.name,e.parentFolderID),r=await(Y==null?void 0:Y.getSetting("twoWaySync")),o=await Ct.genFolderRelPath({name:n,parentFolderID:e.parentFolderID??""}),s={id:r?o:Fn(),name:n,parentFolderID:e.parentFolderID??null,updateTime:Date.now(),createTime:Date.now(),type:"folder"};return r?await Ct.createFolder(s):(await ce.folders.add(s),this.saveDiskDB()),s}async update(e,n){if(await(Y==null?void 0:Y.getSetting("twoWaySync")))return"parentFolderID"in n&&await Ct.moveFolder(e,n.parentFolderID??""),"name"in n&&await Ct.renameFolder(e,n.name??""),null;const o=await this.get(e);if(o==null)return null;"name"in n&&n.name!=o.name;const s="parentFolderID"in n&&n.parentFolderID!=o.parentFolderID,i={...o,...n};return n.name!=null&&(i.updateTime=Date.now()),s&&(n.name=await this.generateUniqueName(i.name,i.parentFolderID??void 0)),await ce.folders.update(e,n),this.saveDiskDB(),i}async deleteFolder(e,n=gr.DELETE){if(await(Y==null?void 0:Y.getSetting("twoWaySync"))){await Us(e,!0,!0).then(a=>{a.forEach(l=>{l.type==="workflow"&&(q==null||q.deleteFlow(l.id))})}),await Ct.deleteFolder(e);return}const o=await(q==null?void 0:q.listAll())??[],s=await this.listAll(),i=[e];for(;i.length>0;){const a=i.shift();if(a){for(const u of o)if(u.parentFolderID===a)switch(n){case gr.DELETE:await(q==null?void 0:q.deleteFlow(u.id));break;case gr.MOVE_TO_ROOT_FOLDER:await(q==null?void 0:q.updateFolder(u.id,{parentFolderID:void 0}));break}await ce.folders.delete(a);const l=s.filter(u=>u.parentFolderID===a).map(u=>u.id);l.length&&i.push(...l)}}this.saveDiskDB()}async generateUniqueName(e,n){if(await(Y==null?void 0:Y.getSetting("twoWaySync")))return await Ye.genFileUniqueName(e??"New folder",n??"")??"New folder";let o=e??"New folder";const s=await this.listAll().then(i=>i.filter(a=>a.parentFolderID==n).map(a=>a.name));if(s.includes(o)){let i=2,a=!0;for(;a;)s.includes(`${o} ${i}`)?i++:(o=`${o} ${i}`,a=!1)}return o}};Se(Mr,"TABLE_NAME","folders");let ts=Mr;class rl extends Yt{constructor(){super("media")}async listByWorkflowID(e){return await ce.media.where("workflowID").equals(e).reverse().sortBy("createTime")}async create(e){if(e.localPath.split(".").pop()==null)return null;const r={id:e.localPath,localPath:e.localPath,workflowID:e.workflowID,createTime:Date.now()};return await(q==null?void 0:q.updateMetaInfo(e.workflowID,{latestImage:r.localPath})),ce.media.put(r),this.saveDiskDB(),r}async delete(e){var n,r;super.delete(e),((n=q==null?void 0:q.curWorkflow)==null?void 0:n.coverMediaPath)===e&&(q==null||q.updateMetaInfo(q.curWorkflow.id,{coverMediaPath:void 0})),((r=q==null?void 0:q.curWorkflow)==null?void 0:r.latestImage)===e&&(q==null||q.updateMetaInfo(q.curWorkflow.id,{latestImage:void 0}))}}Se(rl,"TABLE_NAME","media");const wp=["Checkpoint","TextualInversion","Hypernetwork","LORA","Controlnet","Upscaler","VAE"],eh={Checkpoint:"checkpoints",TextualInversion:"embeddings",Hypernetwork:"hypernetworks",LORA:"loras",Controlnet:"controlnet",Upscaler:"upscale_models",VAE:"vae"};function bp(t){return t.modelVersions!==void 0}function th(t){var e;return((e=t.files)==null?void 0:e[0])!==void 0}function _p(t,e){var r,o,s,i,a,l;if(!t)return;let n;return th(t)?n={id:t.id,SHA256:(o=(r=t.files)==null?void 0:r[0].hashes)==null?void 0:o.SHA256,name:(s=t.files)==null?void 0:s[0].name,sizeKB:(a=(i=t.files)==null?void 0:i[0])==null?void 0:a.sizeKB}:n={id:t.id,SHA256:(l=t.hashes)==null?void 0:l[2],name:`${e} ${t.name}`},n}const zr=class zr extends Yt{constructor(){super("userSettings");Se(this,"defaultSettings");Se(this,"DEFAULT_USER","guest");Se(this,"_autoSave",!1);Se(this,"_settings");this.defaultSettings={id:this.DEFAULT_USER,topBarStyle:{top:0,left:0},myWorkflowsDir:"",shortcuts:{save:"Shift+S",saveAs:"Control+Alt+S",openSpotlightSearch:"Control+P"},defaultFolders:eh,autoSave:!1,autoSaveDuration:3,twoWaySync:!1,foldersOnTop:!1,cloudHost:"https://www.nodecafe.org",overwriteCurWorkflowWhenDroppingFileToCanvas:!1,maximumChangelogNumber:80,hideCoverImage:!1,disableUnsavedWarning:!1}}get settings(){return this._settings}get autoSave(){return this._autoSave}async getSetting(n){const r=await this.get(this.DEFAULT_USER);return n==="shortcuts"&&(r!=null&&r.shortcuts)?{...this.defaultSettings.shortcuts,...r.shortcuts}:(r==null?void 0:r[n])??this.defaultSettings[n]}async upsert(n){const o={...await this.get(this.DEFAULT_USER)??this.defaultSettings,...n};await this.put(o),this._settings={...this.defaultSettings,...o}}static async load(){const n=new zr,r=await Vd();return n.defaultSettings.myWorkflowsDir=r.path,await n.get(n.DEFAULT_USER).then(o=>{n._autoSave=(o==null?void 0:o.autoSave)??!1,n._settings={...n.defaultSettings,...o}}),n.defaultSettings.cloudHost.includes("comfyspace.art")&&await n.upsert({cloudHost:n.defaultSettings.cloudHost}),n}};Se(zr,"TABLE_NAME","userSettings");let ns=zr;const Lr=class Lr extends Yt{constructor(){super("tags")}static async load(){return new Lr}};Se(Lr,"TABLE_NAME","tags");let rs=Lr;const Wr=class Wr extends Yt{constructor(){super("workflowVersions")}static async load(){return new Wr}async listByWorkflowID(e){return await ce[this.tableName].where("workflowID").equals(e).reverse().sortBy("createTime")??[]}async getLatestByWorkflowID(e){const n=await this.listByWorkflowID(e);return n!=null&&n.length?n[0]:null}};Se(Wr,"TABLE_NAME","workflowVersions");let os=Wr;function nh(t){return"type"in t&&t.type==="folder"}let q=null,_r=null,Y=null,qe=null,He=null,$t=null,ge=null;async function rh(){const t=async()=>{q=await es.load()},e=async()=>{_r=await rs.load()},n=async()=>{Y=await ns.load()},r=async()=>{qe=await ts.load()},o=async()=>{He=await Qo.load()},s=async()=>{$t=new rl},i=async()=>{ge=await os.load()};await Promise.all([t(),e(),n(),r(),o(),s(),i()]),localStorage.getItem("WORKSPACE_INDEXDB_BACKFILL")!=="true"&&(await oh(),localStorage.setItem("WORKSPACE_INDEXDB_BACKFILL","true"))}async function oh(){const t=async()=>{try{const a=await(q==null?void 0:q.getRecords());a&&await ce.workflows.bulkPut(Object.values(a))}catch(a){console.error(a)}},e=async()=>{try{const a=await(qe==null?void 0:qe.getRecords());a&&await ce.folders.bulkPut(Object.values(a))}catch(a){console.error(a)}},n=async()=>{try{const a=await($t==null?void 0:$t.getRecords());a&&await ce.media.bulkPut(Object.values(a))}catch(a){console.error(a)}},r=async()=>{try{const a=await(He==null?void 0:He.getRecords());a&&await ce.changelogs.bulkPut(Object.values(a))}catch(a){console.error(a)}},o=async()=>{try{const a=await(_r==null?void 0:_r.getRecords());a&&await ce.tags.bulkPut(Object.values(a))}catch(a){console.error(a)}},s=async()=>{try{const a=Y,l=await a.getRecords().then(u=>u[a.DEFAULT_USER]?u[a.DEFAULT_USER]:u);await ce.userSettings.put({...a.defaultSettings,...l})}catch(a){console.error(a)}},i=async()=>{try{const a=await(ge==null?void 0:ge.getRecords());a&&await ce.workflowVersions.bulkPut(Object.values(a))}catch(a){console.error(a)}};await Promise.all([t(),e(),n(),r(),o(),s(),i()])}const wt=j.createContext({curFlowID:null,loadWorkflowID:()=>{},saveCurWorkflow:async()=>{},discardUnsavedChanges:async()=>{},isDirty:!1,loadNewWorkflow:()=>{},loadFilePath:()=>{},setRoute:()=>{},route:"root",curVersion:null,setIsDirty:()=>{},setCurVersion:()=>{},setCurFlowIDAndName:()=>{}}),kp=j.createContext({refreshFolderStamp:0,setRefreshFolderStamp:()=>{}}),go={x:0,y:0};function sh({children:t,onDragEnd:e,dragIconId:n}){const r=j.useRef(go),o=j.useRef(!1),[s,i]=j.useState(go),a=d=>{var p,h,b;if(!(!(d.target instanceof Element)||!(d.target.parentNode instanceof Element))&&[(p=d.target)==null?void 0:p.id,(b=(h=d.target)==null?void 0:h.parentNode)==null?void 0:b.id].includes(n)){r.current={x:d.clientX,y:d.clientY},o.current=!0,window.addEventListener("mousemove",l),window.addEventListener("mouseup",u);const f=document.getElementsByTagName("body")[0];f.style.userSelect="none"}},l=j.useCallback(d=>{const p={x:d.clientX-r.current.x,y:d.clientY-r.current.y};i(p)},[]),u=j.useCallback(()=>{i(p=>(setTimeout(()=>{e(p)},0),go)),o.current=!1;const d=document.getElementsByTagName("body")[0];d.style.userSelect="auto",window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",u)},[e,l]),c={transform:`translate(${s.x}px, ${s.y}px)`,zIndex:o.current?1e3:1};return O.jsx("div",{style:c,onMouseDown:a,children:t})}var ah={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"},ih=Object.defineProperty,lh=Object.defineProperties,ch=Object.getOwnPropertyDescriptors,Fr=Object.getOwnPropertySymbols,ol=Object.prototype.hasOwnProperty,sl=Object.prototype.propertyIsEnumerable,_a=(t,e,n)=>e in t?ih(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ka=(t,e)=>{for(var n in e||(e={}))ol.call(e,n)&&_a(t,n,e[n]);if(Fr)for(var n of Fr(e))sl.call(e,n)&&_a(t,n,e[n]);return t},uh=(t,e)=>lh(t,ch(e)),dh=(t,e)=>{var n={};for(var r in t)ol.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Fr)for(var r of Fr(t))e.indexOf(r)<0&&sl.call(t,r)&&(n[r]=t[r]);return n},Re=(t,e,n)=>{const r=j.forwardRef((o,s)=>{var i=o,{color:a="currentColor",size:l=24,stroke:u=2,children:c}=i,d=dh(i,["color","size","stroke","children"]);return j.createElement("svg",ka(uh(ka({ref:s},ah),{width:l,height:l,stroke:a,strokeWidth:u,className:`tabler-icon tabler-icon-${t}`}),d),[...n.map(([p,h])=>j.createElement(p,h)),...c||[]])});return r.propTypes={color:Ft.string,size:Ft.oneOfType([Ft.string,Ft.number]),stroke:Ft.oneOfType([Ft.string,Ft.number])},r.displayName=`${e}`,r},fh=Re("arrow-back-up-double","IconArrowBackUpDouble",[["path",{d:"M13 14l-4 -4l4 -4",key:"svg-0"}],["path",{d:"M8 14l-4 -4l4 -4",key:"svg-1"}],["path",{d:"M9 10h7a4 4 0 1 1 0 8h-1",key:"svg-2"}]]),hh=Re("chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]),Rr=Re("device-floppy","IconDeviceFloppy",[["path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2",key:"svg-0"}],["path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M14 4l0 4l-6 0l0 -4",key:"svg-2"}]]),ph=Re("download","IconDownload",[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 11l5 5l5 -5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]]),mh=Re("external-link","IconExternalLink",[["path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",key:"svg-0"}],["path",{d:"M11 13l9 -9",key:"svg-1"}],["path",{d:"M15 4h5v5",key:"svg-2"}]]),yh=Re("folder","IconFolder",[["path",{d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2",key:"svg-0"}]]),vh=Re("grip-vertical","IconGripVertical",[["path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]]),gh=Re("history","IconHistory",[["path",{d:"M12 8l0 4l2 2",key:"svg-0"}],["path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5",key:"svg-1"}]]),wh=Re("link","IconLink",[["path",{d:"M9 15l6 -6",key:"svg-0"}],["path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464",key:"svg-1"}],["path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463",key:"svg-2"}]]),al=Re("lock","IconLock",[["path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z",key:"svg-0"}],["path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-4a4 4 0 1 1 8 0v4",key:"svg-2"}]]),bh=Re("photo","IconPhoto",[["path",{d:"M15 8h.01",key:"svg-0"}],["path",{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z",key:"svg-1"}],["path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5",key:"svg-2"}],["path",{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3",key:"svg-3"}]]),_h=Re("plus","IconPlus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]),kh=Re("share-2","IconShare2",[["path",{d:"M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1",key:"svg-0"}],["path",{d:"M12 14v-11",key:"svg-1"}],["path",{d:"M9 6l3 -3l3 3",key:"svg-2"}]]),xh=Re("trash","IconTrash",[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]]),il=Re("triangle-inverted-filled","IconTriangleInvertedFilled",[["path",{d:"M20.118 3h-16.225a2.914 2.914 0 0 0 -2.503 4.371l8.116 13.549a2.917 2.917 0 0 0 4.987 .005l8.11 -13.539a2.914 2.914 0 0 0 -2.486 -4.386z",fill:"currentColor",key:"svg-0",strokeWidth:"0"}]]),Eh=Re("versions","IconVersions",[["path",{d:"M10 5m0 2a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M7 7l0 10",key:"svg-1"}],["path",{d:"M4 8l0 8",key:"svg-2"}]]),Ch=Re("world","IconWorld",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M3.6 9h16.8",key:"svg-1"}],["path",{d:"M3.6 15h16.8",key:"svg-2"}],["path",{d:"M11.5 3a17 17 0 0 0 0 18",key:"svg-3"}],["path",{d:"M12.5 3a17 17 0 0 1 0 18",key:"svg-4"}]]),Sh=Re("x","IconX",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);function Oh(t){const{promptMessage:e="Are you sure you want to delete this?",variant:n="ghost",onDelete:r,isDisabled:o=!1,tooltipText:s}=t;return O.jsx(ui,{isLazy:!0,placement:"auto",gutter:0,children:({onClose:i})=>O.jsxs(O.Fragment,{children:[O.jsx(ci,{children:O.jsx(St,{children:O.jsx(Ht,{hasArrow:!0,label:s,placement:"bottom",children:O.jsx(jn,{"aria-label":"Delete confirm",size:"sm",icon:O.jsx(xh,{color:"#F56565",size:"20px"}),isDisabled:o,variant:n})})})}),O.jsxs(pi,{children:[O.jsx(fi,{onClick:i}),O.jsxs(di,{children:[O.jsx(Mt,{mb:4,pr:4,fontWeight:600,children:e}),O.jsx(Le,{colorScheme:"red",size:"sm",onClick:()=>{r(),i()},children:"Yes, delete"})]})]})]})})}function Ih({onClose:t}){ja();const{curFlowID:e,isDirty:n,loadWorkflowID:r,curVersion:o}=j.useContext(wt),[s,i]=j.useState(0),[a,l]=j.useState(null),[u,c]=j.useState([]),[d,p]=j.useState([]),h=async y=>{var x;const m=await(q==null?void 0:q.get(y)),w=await(He==null?void 0:He.listByWorkflowID(y));c(w??[]);const _=w==null?void 0:w.filter(I=>I.json===(m==null?void 0:m.json)),k=(x=_==null?void 0:_[0])==null?void 0:x.id;k&&l(k)},b=async()=>{const y=await(ge==null?void 0:ge.listByWorkflowID(e))??[];p(y)},f=y=>{ge==null||ge.delete(y).then(()=>{b()})};return j.useEffect(()=>{switch(s){case 0:b();break;case 1:h(e);break}},[s]),j.useEffect(()=>(Pe.canvasEl.addEventListener("click",t),()=>{Pe.canvasEl.removeEventListener("click",t)}),[s]),O.jsxs(Hl,{width:430,height:"100vh",gap:0,position:"fixed",top:0,left:0,zIndex:1e3,children:[O.jsx(ql,{pb:1,mb:0,children:O.jsxs(xn,{justifyContent:"space-between",alignItems:"center",children:[O.jsx(ms,{size:"md",children:"Version History"}),O.jsx(jn,{size:"sm",icon:O.jsx(Sh,{}),onClick:t,variant:"ghost","aria-label":"close version history"})]})}),O.jsx($l,{overflowY:"auto",gap:0,children:O.jsxs(vi,{isFitted:!0,variant:"enclosed",onChange:i,colorScheme:"teal",children:[O.jsxs(gi,{mb:"1em",children:[O.jsx(So,{children:"Versions"}),O.jsx(So,{children:"Change History"})]}),O.jsxs(wi,{children:[O.jsx(Co,{children:O.jsx(rn,{divider:O.jsx(_o,{}),spacing:2,children:d==null?void 0:d.map(y=>O.jsxs(xn,{w:"100%",mb:1,justify:"space-between",backgroundColor:y.id===(o==null?void 0:o.id)?"teal.300":void 0,borderRadius:4,children:[O.jsxs(rn,{textAlign:"left",gap:0,children:[O.jsx(Mt,{fontWeight:"500",children:y.name??"untitled"}),O.jsxs(Mt,{color:"GrayText",fontSize:"sm",children:["Created: ",el(y.createTime)]})]}),O.jsxs(xn,{alignItems:"center",gap:2,children:[O.jsx(Le,{size:"sm",onClick:()=>{if(n){alert("You have unsaved changes, please save or discard your changes to proceed switching version, in case losing your changes.");return}Pe.loadGraphData(JSON.parse(y.json)),r(e,y.id),t()},children:"Load"}),O.jsx(Oh,{promptMessage:"Are you sure you want to delete this version?",onDelete:()=>{f(y.id)}})]})]},y.id))})}),O.jsxs(Co,{children:[O.jsx(Mt,{mb:4,children:"All the saved changes of this workflow"}),O.jsx(rn,{divider:O.jsx(_o,{}),spacing:2,children:u==null?void 0:u.map(y=>O.jsxs(zt,{justifyContent:"space-between",children:[O.jsxs(Le,{size:"sm",variant:"ghost",onClick:()=>{if(n){alert("You have unsaved changes, please save or discard your changes to proceed switching version, in case losing your changes.");return}Pe.loadGraphData(JSON.parse(y.json)),q==null||q.updateFlow(e,{json:y.json}),t()},isActive:y.id===a,children:["Saved at ",new Date(y.createTime).toLocaleString()]},y.id),y.isAutoSave?O.jsx(Xr,{colorScheme:"teal",size:"sm",children:"Auto save"}):null]},y.id))})]})]})]})})]})}function Dh({workflowId:t,onClose:e}){const[n,r]=j.useState(""),[o,s]=j.useState(""),i=l=>{r(l.target.value),o&&s("")},a=async()=>{const l=n.trim();if(r(l),(await(ge==null?void 0:ge.listByWorkflowID(t))??[]).some(c=>c.name===l))s("The name is duplicated, please modify it and submit again.");else{const c=JSON.stringify(Pe.graph.serialize());await(ge==null?void 0:ge.add({name:n,workflowID:t,createTime:Date.now(),json:c})),e()}};return O.jsxs(is,{isOpen:!0,onClose:e,children:[O.jsx(ls,{}),O.jsxs(cs,{children:[O.jsx(us,{children:"Create Version"}),O.jsx(ds,{}),O.jsx(fs,{children:O.jsxs(qr,{isInvalid:!!o,children:[O.jsx(Vr,{children:"Name"}),O.jsx(Un,{value:n,onChange:i,autoFocus:!0,onKeyUp:l=>{l.code==="Enter"&&!o&&n&&a()}}),o&&O.jsx(Hr,{children:o})]})}),O.jsxs(hs,{children:[O.jsx(Le,{colorScheme:"teal",mr:3,onClick:a,isDisabled:!n||!!o,children:"Create"}),O.jsx(Le,{onClick:e,children:"Cancel"})]})]})]})}function Ph({options:t,menuButton:e,isOpen:n,onClose:r}){const o=j.useRef(null);return vc({ref:o,handler:()=>r()}),O.jsxs(St,{position:"relative",children:[O.jsx(St,{children:e}),n&&O.jsx(St,{ref:o,mt:"8px",shadow:"md",p:"2",position:"absolute",zIndex:"dropdown",children:t})]})}function jh({menuButton:t,menuContent:e,onClose:n}){const r=j.useRef(),[o,s]=j.useState(!1),i=()=>{r.current=setTimeout(()=>s(!1),400)},a=()=>{s(!0),clearTimeout(r.current),r.current=void 0};return O.jsx(Ph,{isOpen:o,onClose:i,menuButton:O.jsx(St,{"aria-label":"menu",onClick:a,onMouseEnter:a,onMouseLeave:i,children:t}),options:O.jsx(Ss,{isOpen:!0,children:O.jsx(Os,{minWidth:150,zIndex:1e3,onMouseEnter:a,onMouseLeave:i,children:e})})})}function Ah(t,e){const n=new Blob([t],{type:"application/json"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${e}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}function xp(t){const e=new Uint8Array(t);return window.crypto.getRandomValues(e),Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}const Ep=[{label:"Private",value:"PRIVATE",icon:O.jsx(al,{})},{label:"Unlisted, anyone with the link can view",value:"UNLISTED",icon:O.jsx(wh,{})},{label:"Public",value:"PUBLIC",icon:O.jsx(Ch,{})}],Cp=()=>{const t=Pe.graph._nodes,e={};for(let n of t)if(n.type in LiteGraph.registered_node_types){const r=structuredClone(LiteGraph.registered_node_types[n.type].nodeData);if(r==null)continue;for(let o in r.input){const s=r.input[o];for(let i in s){const a=s[i];Array.isArray(a[0])&&(a[0]=["value_1","value_2"])}}e[n.type]=r}return e};async function Nh(t){const e=t.cloudOrigin;if(!e)throw Error("cloudURL is required");return fetch(e+`/api/getWorkflow?id=${t.cloudID}`).then(n=>n.json()).then(n=>{var o;return((o=n.data)==null?void 0:o.privacy)??"PRIVATE"})}function Sp({privacy:t,showEmoji:e=!1}){let n;return t==="PRIVATE"?(n="Private",e&&(n="🔒 Private")):t==="UNLISTED"?(n="Unlisted",e&&(n="🔗 Unlisted")):t==="PUBLIC"&&(n="Public",e&&(n="🌐 Public")),O.jsx("span",{children:n})}function Fh({}){const[t,e]=j.useState(),[n,r]=j.useState(),{curFlowID:o}=j.useContext(wt);return j.useEffect(()=>{o&&(q==null||q.get(o).then(s=>{s!=null&&s.cloudID?(e(s.cloudOrigin+"/workflow/"+s.cloudID),Nh(s).then(i=>{r(i)})):e(void 0)}))},[o]),t?O.jsx("a",{href:t,style:{textDecoration:"none"},target:"_blank",children:O.jsx(Oa,{children:O.jsx(Xr,{children:n==="PUBLIC"?"🌐":n==="UNLISTED"?"🔗":"🔒"})})}):null}const Rh=j.lazy(()=>At(()=>import("./ShareDialog-t7mRPVSb.js"),__vite__mapDeps([0,1,2,3,4,5])));function Th(){var k;const{curFlowID:t,loadWorkflowID:e,discardUnsavedChanges:n,saveCurWorkflow:r,setRoute:o,route:s}=j.useContext(wt),[i,a]=j.useState(!1),[l,u]=j.useState(""),[c,d]=j.useState(""),[p,h]=j.useState(),[b,f]=j.useState({save:"",saveAs:""});j.useEffect(()=>{t&&(q==null||q.get(t).then(x=>{u((x==null?void 0:x.name)??""),h(x)})),Y==null||Y.getSetting("shortcuts").then(x=>{f(x)})},[t]);const y=x=>{u(x.target.value),c&&d("")},m=async()=>{if(!t){alert("Flow ID is required");return}const x=JSON.stringify(Pe.graph.serialize()),I=await(q==null?void 0:q.createFlow({json:x,name:l,parentFolderID:p==null?void 0:p.parentFolderID}));I&&await e(I.id,null,!0),w()},w=()=>{o("root")},_=j.useCallback(async()=>{const x=q==null?void 0:q.curWorkflow;if(!x){alert("No current workflow!");return}const I=Pe.graph.serialize(),E=JSON.stringify(I,null,2);Ah(E,x.name)},[t]);return O.jsxs(O.Fragment,{children:[O.jsx(jh,{menuButton:O.jsx(Oa,{children:O.jsxs(Le,{px:1,height:Ws+"px","aria-label":"menu",size:"sm",backgroundColor:"#434554",children:["File",O.jsx(hh,{size:20})]})}),menuContent:O.jsx(Ss,{isOpen:!0,children:O.jsxs(Os,{minWidth:150,zIndex:1e3,children:[O.jsx(bt,{onClick:()=>r(),icon:O.jsx(Rr,{size:20}),iconSpacing:1,command:b.save,children:"Save"}),!((k=Y==null?void 0:Y.settings)!=null&&k.autoSave)&&O.jsx(Ht,{label:"Revert workflow to your last saved version. You will lose all changes made since your last save.",children:O.jsx(bt,{onClick:n,icon:O.jsx(fh,{size:20}),iconSpacing:1,children:"Discard unsaved changes"})}),O.jsx(bt,{onClick:_,icon:O.jsx(ph,{size:20}),iconSpacing:1,children:"Download"}),O.jsx(bt,{onClick:()=>o("saveAsModal"),icon:O.jsx(Rr,{size:20}),iconSpacing:1,command:b.saveAs,children:"Save As"}),O.jsx(bt,{onClick:()=>a(!0),icon:O.jsx(Eh,{size:20}),iconSpacing:1,children:"Create Version"}),O.jsx(bt,{onClick:()=>o("versionHistory"),icon:O.jsx(gh,{size:20}),iconSpacing:1,children:"Versions History"}),O.jsx(bt,{onClick:()=>o("share"),icon:O.jsx(kh,{size:20}),iconSpacing:1,alignItems:"center",children:O.jsxs(zt,{children:[O.jsx("p",{children:"Share"})," ",O.jsx(Xr,{size:"sm",children:"🧪beta"}),O.jsx(Fh,{})]})})]})})}),s==="share"&&O.jsx(Rh,{onClose:()=>o("root")}),s=="versionHistory"&&O.jsx(Ih,{onClose:()=>o("root")}),s==="saveAsModal"&&O.jsxs(is,{isOpen:!0,onClose:w,children:[O.jsx(ls,{}),O.jsxs(cs,{children:[O.jsx(us,{children:"Save As"}),O.jsx(ds,{}),O.jsx(fs,{children:O.jsxs(qr,{isInvalid:!!c,children:[O.jsx(Vr,{children:"Workflow name"}),O.jsx(Un,{value:l,onChange:y,autoFocus:!0,onKeyUp:x=>{x.code==="Enter"&&!c&&l&&m()}}),c&&O.jsx(Hr,{children:c})]})}),O.jsxs(hs,{children:[O.jsx(Le,{colorScheme:"teal",mr:3,onClick:m,isDisabled:!l||!!c,children:"Save"}),O.jsx(Le,{onClick:w,children:"Cancel"})]})]})]}),i&&O.jsx(Dh,{workflowId:t,onClose:()=>a(!1)})]})}function Bh({displayName:t,updateFlowName:e,isDirty:n}){const{isOpen:r,onOpen:o,onClose:s}=bc(),{curFlowID:i}=j.useContext(wt),[a,l]=j.useState(t),[u,c]=j.useState(""),d=()=>{l(t),o()},p=f=>{l(f.target.value),u&&c("")},h=async()=>{var f;if(i){const y=a.trim();if(l(y),t===y)return b();await(q==null?void 0:q.generateUniqueName(y,((f=q.curWorkflow)==null?void 0:f.parentFolderID)??""))!==y?c("The name is duplicated, please modify it and submit again."):(await(q==null?void 0:q.updateName(i,{name:y})),e(y),b())}},b=()=>{c(""),s()};return i==null?null:O.jsxs(zt,{children:[O.jsx(Ht,{label:t,placement:"bottom",children:O.jsxs(Mt,{as:"div",color:"white",onClick:d,maxW:160,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[O.jsx("div",{style:{width:8,display:"inline-block"},children:O.jsx(Mt,{as:"span",children:n&&"* "})}),t]})}),O.jsxs(is,{isOpen:r,onClose:b,children:[O.jsx(ls,{}),O.jsxs(cs,{children:[O.jsx(us,{children:"Edit workflow name"}),O.jsx(ds,{}),O.jsx(fs,{children:O.jsxs(qr,{isInvalid:!!u,children:[O.jsx(Vr,{children:"Workflow name"}),O.jsx(Un,{value:a,onChange:p,autoFocus:!0,onKeyUp:f=>{f.code==="Enter"&&!u&&a&&h()}}),u&&O.jsx(Hr,{children:u})]})}),O.jsxs(hs,{children:[O.jsx(Le,{colorScheme:"teal",mr:3,onClick:h,isDisabled:!a||!!u,children:"Save"}),O.jsx(Le,{onClick:b,children:"Cancel"})]})]})]})]})}function Mh({}){const{setRoute:t,curVersion:e,isDirty:n,setCurVersion:r}=j.useContext(wt);return j.useEffect(()=>{n&&e&&(e==null?void 0:e.name.endsWith("*"))===!1&&(r==null||r({...e,name:e.name+"*"}))},[n]),e?O.jsx(xn,{alignItems:"center",children:O.jsx(Ra,{size:"sm",isAttached:!0,variant:"outline",children:O.jsx(Le,{rightIcon:O.jsx(il,{size:10}),onClick:()=>t("versionHistory"),children:e.name})})}):null}function zh(){const{loadNewWorkflow:t,setCurFlowIDAndName:e,curFlowID:n}=j.useContext(wt),r=async()=>{const o=JSON.stringify(Pe.graph.serialize()),s=prompt("Enter workflow name","Untitled");if(!s)return;const i=await(q==null?void 0:q.createFlow({json:o,name:s}));i&&e(i)};return O.jsx(Ht,{label:n?"New workflow":"Save workflow",children:O.jsx(Le,{size:"sm",variant:"outline",colorScheme:"teal","aria-label":"new workflow",height:Ws+"px",onClick:()=>n?t():r(),px:1,children:n?O.jsx(_h,{size:16,color:"white"}):O.jsx(Rr,{size:16,color:"white"})})})}const Lh=j.lazy(()=>At(()=>import("./AppIsDirtyEventListener-xmtnIvLQ.js"),__vite__mapDeps([6,1,7]))),Wh=j.lazy(()=>At(()=>import("./ModelManagerTopbar-4hMR9SRa.js"),__vite__mapDeps([8,1,2,3,9,10,11]))),Uh=j.lazy(()=>At(()=>import("./SpotlightSearch-crj3ER75.js"),__vite__mapDeps([12,1,7,13,14])));function Kh({curFlowName:t,setCurFlowName:e}){var c;const{isDirty:n,saveCurWorkflow:r,setRoute:o,curFlowID:s,route:i}=j.useContext(wt),[a,l]=j.useState(),u=j.useCallback((d,p=!1)=>{const{top:h=0,left:b=0}=a||{};let{top:f=0,left:y=0}=d??{};f+=h,y+=b;const m=document.documentElement.clientWidth,w=document.documentElement.clientHeight,_=document.getElementById("workspaceManagerPanel"),k=(_==null?void 0:_.offsetWidth)||392;f+36>w&&(f=w-36),y+k>=m&&(y=m-k),l({top:Math.max(0,f),left:Math.max(0,y)}),p&&(Y==null||Y.upsert({topBarStyle:{top:f,left:y}}))},[a]);return j.useEffect(()=>{Y==null||Y.getSetting("topBarStyle").then(d=>{u(d,!1)})},[]),a?O.jsx(sh,{onDragEnd:d=>{u({top:d.y,left:d.x},!0)},dragIconId:"dragPanelIcon",children:O.jsxs(zt,{style:{padding:2,position:"fixed",...a},justifyContent:"space-between",alignItems:"center",gap:2,draggable:!1,id:"workspaceManagerPanel",className:"workspaceManagerPanel",children:[O.jsx(Le,{size:"sm","aria-label":"workspace folder",height:Ws+"px",onClick:()=>o("recentFlows"),px:2,children:O.jsxs(zt,{gap:1,children:[O.jsx(yh,{size:21}),O.jsx(il,{size:8})]})}),O.jsx(j.Suspense,{fallback:O.jsx("div",{style:{width:"60px"}}),children:O.jsx(Wh,{})}),O.jsx(zh,{}),O.jsx(Bh,{isDirty:n,displayName:t??"",updateFlowName:d=>{e(d),requestAnimationFrame(()=>{u()})}}),((c=q==null?void 0:q.curWorkflow)==null?void 0:c.saveLock)&&O.jsx(al,{color:"#FFF",size:20}),s&&O.jsxs(zt,{gap:"4px",children:[O.jsx(Ht,{label:"Open gallery",children:O.jsx(jn,{onClick:()=>o("gallery"),icon:O.jsx(bh,{size:22,color:"white"}),size:"sm","aria-label":"open gallery",variant:"ghost"})}),O.jsx(Th,{})]}),s&&n?O.jsx(Ht,{label:"Save workflow",children:O.jsx(jn,{onClick:()=>r(),icon:O.jsx(Rr,{size:23,color:"white"}),size:"xs",paddingY:4,"aria-label":"save workspace",variant:"ghost"})}):O.jsx("div",{style:{width:1}}),O.jsx(Mh,{}),O.jsx(Lh,{}),O.jsx(vh,{id:"dragPanelIcon",className:"dragPanelIcon",cursor:"move",size:15,color:"#FFF"}),i==="spotlightSearch"&&O.jsx(Uh,{})]})}):null}function $h(){const{showDialog:t}=Ia(),{loadWorkflowID:e}=j.useContext(wt),n=async(o,s)=>{var u,c;const{workflow:i,version:a}=o.detail;if(!i.id||!a.id)return;const l=(u=await(q==null?void 0:q.listByIndex("cloudID",i.id)))==null?void 0:u.at(0);if(l){const d=(c=await(ge==null?void 0:ge.listByIndex("cloudID",a.id)))==null?void 0:c.at(0);if(d)await e(l.id,d.id);else{const p=await(ge==null?void 0:ge.add({id:a.id,cloudID:a.id,workflowID:l.id,cloudOrigin:s,name:a.name,authorID:a.authorID,json:a.json}));p&&e(l.id,p.id)}}else{const d=await(q==null?void 0:q.createFlow({cloudID:i.id,cloudOrigin:s,name:i.name,json:a.json,updateTime:Date.now()}));if(!d){alert("Failed to add workflow to local db");return}const p=await(ge==null?void 0:ge.put({id:a.id,cloudID:a.id,workflowID:d.id,cloudOrigin:s,name:a.name,json:a.json,authorID:a.authorID,createTime:Date.now()}));await e(d.id,p==null?void 0:p.id)}},r=async o=>{const s=o.data;if(qh(s)){const i=o.origin;t(`Open workflow "${s.detail.workflow.name}", version "${s.detail.version.name}" from ${i}`,[{label:"Open",colorScheme:"teal",onClick:()=>{n(s,i)}}])}};return j.useEffect(()=>{window.opener&&window.opener.postMessage("comfyui_workspace_manager_connected","*"),window.addEventListener("message",r)},[]),null}function qh(t){return t.type==="workspace_open_workflow"}const Hh=t=>typeof t=="function",Vh=t=>{const[e,n]=j.useState(t),r=j.useRef(e),o=j.useCallback(s=>{r.current=Hh(s)?s(r.current):s,n(r.current)},[]);return[e,o,r]};function lr(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ll={exports:{}};/*! + +JSZip v3.10.1 - A JavaScript class for generating and reading zip files + + +(c) 2009-2016 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/main/LICENSE +*/(function(t,e){(function(n){t.exports=n()})(function(){return function n(r,o,s){function i(u,c){if(!o[u]){if(!r[u]){var d=typeof lr=="function"&&lr;if(!c&&d)return d(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var h=o[u]={exports:{}};r[u][0].call(h.exports,function(b){var f=r[u][1][b];return i(f||b)},h,h.exports,n,r,o,s)}return o[u].exports}for(var a=typeof lr=="function"&&lr,l=0;l>2,h=(3&u)<<4|c>>4,b=1<_?(15&c)<<2|d>>6:64,f=2<_?63&d:64,y.push(a.charAt(p)+a.charAt(h)+a.charAt(b)+a.charAt(f));return y.join("")},o.decode=function(l){var u,c,d,p,h,b,f=0,y=0,m="data:";if(l.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");var w,_=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&_--,l.charAt(l.length-2)===a.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(w=i.uint8array?new Uint8Array(0|_):new Array(0|_);f>4,c=(15&p)<<4|(h=a.indexOf(l.charAt(f++)))>>2,d=(3&h)<<6|(b=a.indexOf(l.charAt(f++))),w[y++]=u,h!==64&&(w[y++]=c),b!==64&&(w[y++]=d);return w}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),i=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(c,d,p,h,b){this.compressedSize=c,this.uncompressedSize=d,this.crc32=p,this.compression=h,this.compressedContent=b}u.prototype={getContentWorker:function(){var c=new i(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return c.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new i(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(c,d,p){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var s=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var s=n("./utils"),i=function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(u,c,d,p){var h=i,b=p+d;u^=-1;for(var f=p;f>>8^h[255&(u^c[f])];return-1^u}(0|l,a,a.length,0):function(u,c,d,p){var h=i,b=p+d;u^=-1;for(var f=p;f>>8^h[255&(u^c.charCodeAt(f))];return-1^u}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=s?"uint8array":"array";function c(d,p){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,d.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(p){d.push({data:p,meta:d.meta})}},o.compressWorker=function(d){return new c("Deflate",d)},o.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(h,b){var f,y="";for(f=0;f>>=8;return y}function i(h,b,f,y,m,w){var _,k,x=h.file,I=h.compression,E=w!==u.utf8encode,N=a.transformTo("string",w(x.name)),D=a.transformTo("string",u.utf8encode(x.name)),R=x.comment,K=a.transformTo("string",w(R)),P=a.transformTo("string",u.utf8encode(R)),B=D.length!==x.name.length,v=P.length!==R.length,T="",H="",A="",X=x.dir,$=x.date,ne={crc32:0,compressedSize:0,uncompressedSize:0};b&&!f||(ne.crc32=h.crc32,ne.compressedSize=h.compressedSize,ne.uncompressedSize=h.uncompressedSize);var z=0;b&&(z|=8),E||!B&&!v||(z|=2048);var M=0,te=0;X&&(M|=16),m==="UNIX"?(te=798,M|=function(G,me){var we=G;return G||(we=me?16893:33204),(65535&we)<<16}(x.unixPermissions,X)):(te=20,M|=function(G){return 63&(G||0)}(x.dosPermissions)),_=$.getUTCHours(),_<<=6,_|=$.getUTCMinutes(),_<<=5,_|=$.getUTCSeconds()/2,k=$.getUTCFullYear()-1980,k<<=4,k|=$.getUTCMonth()+1,k<<=5,k|=$.getUTCDate(),B&&(H=s(1,1)+s(c(N),4)+D,T+="up"+s(H.length,2)+H),v&&(A=s(1,1)+s(c(K),4)+P,T+="uc"+s(A.length,2)+A);var J="";return J+=` +\0`,J+=s(z,2),J+=I.magic,J+=s(_,2),J+=s(k,2),J+=s(ne.crc32,4),J+=s(ne.compressedSize,4),J+=s(ne.uncompressedSize,4),J+=s(N.length,2),J+=s(T.length,2),{fileRecord:d.LOCAL_FILE_HEADER+J+N+T,dirRecord:d.CENTRAL_FILE_HEADER+s(te,2)+J+s(K.length,2)+"\0\0\0\0"+s(M,4)+s(y,4)+N+T+K}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),c=n("../crc32"),d=n("../signature");function p(h,b,f,y){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=b,this.zipPlatform=f,this.encodeFileName=y,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(h){var b=h.meta.percent||0,f=this.entriesCount,y=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,l.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:f?(b+100*(f-y-1))/f:100}}))},p.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var b=this.streamFiles&&!h.file.dir;if(b){var f=i(h,b,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(h){this.accumulate=!1;var b=this.streamFiles&&!h.file.dir,f=i(h,b,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),b)this.push({data:function(y){return d.DATA_DESCRIPTOR+s(y.crc32,4)+s(y.compressedSize,4)+s(y.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var h=this.bytesWritten,b=0;b=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),c=n("./Uint8ArrayReader");r.exports=function(d){var p=s.getTypeOf(d);return s.checkSupport(p),p!=="string"||i.uint8array?p==="nodebuffer"?new u(d):i.uint8array?new c(s.transformTo("uint8array",d)):new a(s.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),i=n("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}i.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:i.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=i(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(l){i.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,i),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}i.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(l){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=s.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}s.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var l=0;l "+i:i}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),i=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),c=n("../external"),d=null;if(u.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(b,f){return new c.Promise(function(y,m){var w=[],_=b._internalType,k=b._outputType,x=b._mimeType;b.on("data",function(I,E){w.push(I),f&&f(E)}).on("error",function(I){w=[],m(I)}).on("end",function(){try{var I=function(E,N,D){switch(E){case"blob":return s.newBlob(s.transformTo("arraybuffer",N),D);case"base64":return l.encode(N);default:return s.transformTo(E,N)}}(k,function(E,N){var D,R=0,K=null,P=0;for(D=0;D"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(s),o.blob=i.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),i=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(h){return i.nodebuffer?a.newBufferFrom(h,"utf-8"):function(b){var f,y,m,w,_,k=b.length,x=0;for(w=0;w>>6:(y<65536?f[_++]=224|y>>>12:(f[_++]=240|y>>>18,f[_++]=128|y>>>12&63),f[_++]=128|y>>>6&63),f[_++]=128|63&y);return f}(h)},o.utf8decode=function(h){return i.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(b){var f,y,m,w,_=b.length,k=new Array(2*_);for(f=y=0;f<_;)if((m=b[f++])<128)k[y++]=m;else if(4<(w=u[m]))k[y++]=65533,f+=w-1;else{for(m&=w===2?31:w===3?15:7;1>10&1023,k[y++]=56320|1023&m)}return k.length!==y&&(k.subarray?k=k.subarray(0,y):k.length=y),s.applyFromCharCode(k)}(h=s.transformTo(i.uint8array?"uint8array":"array",h))},s.inherits(d,l),d.prototype.processChunk=function(h){var b=s.transformTo(i.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var f=b;(b=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),b.set(f,this.leftOver.length)}else b=this.leftOver.concat(b);this.leftOver=null}var y=function(w,_){var k;for((_=_||w.length)>w.length&&(_=w.length),k=_-1;0<=k&&(192&w[k])==128;)k--;return k<0||k===0?_:k+u[w[k]]>_?k:_}(b),m=b;y!==b.length&&(i.uint8array?(m=b.subarray(0,y),this.leftOver=b.subarray(y,b.length)):(m=b.slice(0,y),this.leftOver=b.slice(y,b.length))),this.push({data:o.utf8decode(m),meta:h.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=d,s.inherits(p,l),p.prototype.processChunk=function(h){this.push({data:o.utf8encode(h.data),meta:h.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(f){return f}function c(f,y){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var b,f,y,m=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?p[y++]=224|h>>>12:(p[y++]=240|h>>>18,p[y++]=128|h>>>12&63),p[y++]=128|h>>>6&63),p[y++]=128|63&h);return p},o.buf2binstring=function(d){return c(d,d.length)},o.binstring2buf=function(d){for(var p=new s.Buf8(d.length),h=0,b=p.length;h>10&1023,w[b++]=56320|1023&f)}return c(w,b)},o.utf8border=function(d,p){var h;for((p=p||d.length)>d.length&&(p=d.length),h=p-1;0<=h&&(192&d[h])==128;)h--;return h<0||h===0?p:h+l[d[h]]>p?h:p}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,a,l){for(var u=65535&s|0,c=s>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3>>1:i>>>1;a[l]=i}return a}();r.exports=function(i,a,l,u){var c=s,d=u+l;i^=-1;for(var p=u;p>>8^c[255&(i^a[p])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),c=n("./messages"),d=0,p=4,h=0,b=-2,f=-1,y=4,m=2,w=8,_=9,k=286,x=30,I=19,E=2*k+1,N=15,D=3,R=258,K=R+D+1,P=42,B=113,v=1,T=2,H=3,A=4;function X(g,U){return g.msg=c[U],U}function $(g){return(g<<1)-(4g.avail_out&&(W=g.avail_out),W!==0&&(i.arraySet(g.output,U.pending_buf,U.pending_out,W,g.next_out),g.next_out+=W,U.pending_out+=W,g.total_out+=W,g.avail_out-=W,U.pending-=W,U.pending===0&&(U.pending_out=0))}function M(g,U){a._tr_flush_block(g,0<=g.block_start?g.block_start:-1,g.strstart-g.block_start,U),g.block_start=g.strstart,z(g.strm)}function te(g,U){g.pending_buf[g.pending++]=U}function J(g,U){g.pending_buf[g.pending++]=U>>>8&255,g.pending_buf[g.pending++]=255&U}function G(g,U){var W,S,C=g.max_chain_length,F=g.strstart,V=g.prev_length,Z=g.nice_match,L=g.strstart>g.w_size-K?g.strstart-(g.w_size-K):0,Q=g.window,re=g.w_mask,ee=g.prev,se=g.strstart+R,ve=Q[F+V-1],he=Q[F+V];g.prev_length>=g.good_match&&(C>>=2),Z>g.lookahead&&(Z=g.lookahead);do if(Q[(W=U)+V]===he&&Q[W+V-1]===ve&&Q[W]===Q[F]&&Q[++W]===Q[F+1]){F+=2,W++;do;while(Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&FL&&--C!=0);return V<=g.lookahead?V:g.lookahead}function me(g){var U,W,S,C,F,V,Z,L,Q,re,ee=g.w_size;do{if(C=g.window_size-g.lookahead-g.strstart,g.strstart>=ee+(ee-K)){for(i.arraySet(g.window,g.window,ee,ee,0),g.match_start-=ee,g.strstart-=ee,g.block_start-=ee,U=W=g.hash_size;S=g.head[--U],g.head[U]=ee<=S?S-ee:0,--W;);for(U=W=ee;S=g.prev[--U],g.prev[U]=ee<=S?S-ee:0,--W;);C+=ee}if(g.strm.avail_in===0)break;if(V=g.strm,Z=g.window,L=g.strstart+g.lookahead,Q=C,re=void 0,re=V.avail_in,Q=D)for(F=g.strstart-g.insert,g.ins_h=g.window[F],g.ins_h=(g.ins_h<=D&&(g.ins_h=(g.ins_h<=D)if(S=a._tr_tally(g,g.strstart-g.match_start,g.match_length-D),g.lookahead-=g.match_length,g.match_length<=g.max_lazy_match&&g.lookahead>=D){for(g.match_length--;g.strstart++,g.ins_h=(g.ins_h<=D&&(g.ins_h=(g.ins_h<=D&&g.match_length<=g.prev_length){for(C=g.strstart+g.lookahead-D,S=a._tr_tally(g,g.strstart-1-g.prev_match,g.prev_length-D),g.lookahead-=g.prev_length-1,g.prev_length-=2;++g.strstart<=C&&(g.ins_h=(g.ins_h<g.pending_buf_size-5&&(W=g.pending_buf_size-5);;){if(g.lookahead<=1){if(me(g),g.lookahead===0&&U===d)return v;if(g.lookahead===0)break}g.strstart+=g.lookahead,g.lookahead=0;var S=g.block_start+W;if((g.strstart===0||g.strstart>=S)&&(g.lookahead=g.strstart-S,g.strstart=S,M(g,!1),g.strm.avail_out===0)||g.strstart-g.block_start>=g.w_size-K&&(M(g,!1),g.strm.avail_out===0))return v}return g.insert=0,U===p?(M(g,!0),g.strm.avail_out===0?H:A):(g.strstart>g.block_start&&(M(g,!1),g.strm.avail_out),v)}),new ue(4,4,8,4,we),new ue(4,5,16,8,we),new ue(4,6,32,32,we),new ue(4,4,16,16,ie),new ue(8,16,32,32,ie),new ue(8,16,128,128,ie),new ue(8,32,128,256,ie),new ue(32,128,258,1024,ie),new ue(32,258,258,4096,ie)],o.deflateInit=function(g,U){return xe(g,U,w,15,8,0)},o.deflateInit2=xe,o.deflateReset=pe,o.deflateResetKeep=ye,o.deflateSetHeader=function(g,U){return g&&g.state?g.state.wrap!==2?b:(g.state.gzhead=U,h):b},o.deflate=function(g,U){var W,S,C,F;if(!g||!g.state||5>8&255),te(S,S.gzhead.time>>16&255),te(S,S.gzhead.time>>24&255),te(S,S.level===9?2:2<=S.strategy||S.level<2?4:0),te(S,255&S.gzhead.os),S.gzhead.extra&&S.gzhead.extra.length&&(te(S,255&S.gzhead.extra.length),te(S,S.gzhead.extra.length>>8&255)),S.gzhead.hcrc&&(g.adler=u(g.adler,S.pending_buf,S.pending,0)),S.gzindex=0,S.status=69):(te(S,0),te(S,0),te(S,0),te(S,0),te(S,0),te(S,S.level===9?2:2<=S.strategy||S.level<2?4:0),te(S,3),S.status=B);else{var V=w+(S.w_bits-8<<4)<<8;V|=(2<=S.strategy||S.level<2?0:S.level<6?1:S.level===6?2:3)<<6,S.strstart!==0&&(V|=32),V+=31-V%31,S.status=B,J(S,V),S.strstart!==0&&(J(S,g.adler>>>16),J(S,65535&g.adler)),g.adler=1}if(S.status===69)if(S.gzhead.extra){for(C=S.pending;S.gzindex<(65535&S.gzhead.extra.length)&&(S.pending!==S.pending_buf_size||(S.gzhead.hcrc&&S.pending>C&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),z(g),C=S.pending,S.pending!==S.pending_buf_size));)te(S,255&S.gzhead.extra[S.gzindex]),S.gzindex++;S.gzhead.hcrc&&S.pending>C&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),S.gzindex===S.gzhead.extra.length&&(S.gzindex=0,S.status=73)}else S.status=73;if(S.status===73)if(S.gzhead.name){C=S.pending;do{if(S.pending===S.pending_buf_size&&(S.gzhead.hcrc&&S.pending>C&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),z(g),C=S.pending,S.pending===S.pending_buf_size)){F=1;break}F=S.gzindexC&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),F===0&&(S.gzindex=0,S.status=91)}else S.status=91;if(S.status===91)if(S.gzhead.comment){C=S.pending;do{if(S.pending===S.pending_buf_size&&(S.gzhead.hcrc&&S.pending>C&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),z(g),C=S.pending,S.pending===S.pending_buf_size)){F=1;break}F=S.gzindexC&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),F===0&&(S.status=103)}else S.status=103;if(S.status===103&&(S.gzhead.hcrc?(S.pending+2>S.pending_buf_size&&z(g),S.pending+2<=S.pending_buf_size&&(te(S,255&g.adler),te(S,g.adler>>8&255),g.adler=0,S.status=B)):S.status=B),S.pending!==0){if(z(g),g.avail_out===0)return S.last_flush=-1,h}else if(g.avail_in===0&&$(U)<=$(W)&&U!==p)return X(g,-5);if(S.status===666&&g.avail_in!==0)return X(g,-5);if(g.avail_in!==0||S.lookahead!==0||U!==d&&S.status!==666){var Z=S.strategy===2?function(L,Q){for(var re;;){if(L.lookahead===0&&(me(L),L.lookahead===0)){if(Q===d)return v;break}if(L.match_length=0,re=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++,re&&(M(L,!1),L.strm.avail_out===0))return v}return L.insert=0,Q===p?(M(L,!0),L.strm.avail_out===0?H:A):L.last_lit&&(M(L,!1),L.strm.avail_out===0)?v:T}(S,U):S.strategy===3?function(L,Q){for(var re,ee,se,ve,he=L.window;;){if(L.lookahead<=R){if(me(L),L.lookahead<=R&&Q===d)return v;if(L.lookahead===0)break}if(L.match_length=0,L.lookahead>=D&&0L.lookahead&&(L.match_length=L.lookahead)}if(L.match_length>=D?(re=a._tr_tally(L,1,L.match_length-D),L.lookahead-=L.match_length,L.strstart+=L.match_length,L.match_length=0):(re=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++),re&&(M(L,!1),L.strm.avail_out===0))return v}return L.insert=0,Q===p?(M(L,!0),L.strm.avail_out===0?H:A):L.last_lit&&(M(L,!1),L.strm.avail_out===0)?v:T}(S,U):s[S.level].func(S,U);if(Z!==H&&Z!==A||(S.status=666),Z===v||Z===H)return g.avail_out===0&&(S.last_flush=-1),h;if(Z===T&&(U===1?a._tr_align(S):U!==5&&(a._tr_stored_block(S,0,0,!1),U===3&&(ne(S.head),S.lookahead===0&&(S.strstart=0,S.block_start=0,S.insert=0))),z(g),g.avail_out===0))return S.last_flush=-1,h}return U!==p?h:S.wrap<=0?1:(S.wrap===2?(te(S,255&g.adler),te(S,g.adler>>8&255),te(S,g.adler>>16&255),te(S,g.adler>>24&255),te(S,255&g.total_in),te(S,g.total_in>>8&255),te(S,g.total_in>>16&255),te(S,g.total_in>>24&255)):(J(S,g.adler>>>16),J(S,65535&g.adler)),z(g),0=W.w_size&&(F===0&&(ne(W.head),W.strstart=0,W.block_start=0,W.insert=0),Q=new i.Buf8(W.w_size),i.arraySet(Q,U,re-W.w_size,W.w_size,0),U=Q,re=W.w_size),V=g.avail_in,Z=g.next_in,L=g.input,g.avail_in=re,g.next_in=0,g.input=U,me(W);W.lookahead>=D;){for(S=W.strstart,C=W.lookahead-(D-1);W.ins_h=(W.ins_h<>>=D=N>>>24,_-=D,(D=N>>>16&255)===0)T[c++]=65535&N;else{if(!(16&D)){if(!(64&D)){N=k[(65535&N)+(w&(1<>>=D,_-=D),_<15&&(w+=v[l++]<<_,_+=8,w+=v[l++]<<_,_+=8),N=x[w&E];n:for(;;){if(w>>>=D=N>>>24,_-=D,!(16&(D=N>>>16&255))){if(!(64&D)){N=x[(65535&N)+(w&(1<>>=D,_-=D,(D=c-d)>3,w&=(1<<(_-=R<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(P>>>8&65280)+((65280&P)<<8)+((255&P)<<24)}function w(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(P){var B;return P&&P.state?(B=P.state,P.total_in=P.total_out=B.total=0,P.msg="",B.wrap&&(P.adler=1&B.wrap),B.mode=b,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new s.Buf32(f),B.distcode=B.distdyn=new s.Buf32(y),B.sane=1,B.back=-1,p):h}function k(P){var B;return P&&P.state?((B=P.state).wsize=0,B.whave=0,B.wnext=0,_(P)):h}function x(P,B){var v,T;return P&&P.state?(T=P.state,B<0?(v=0,B=-B):(v=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15=A.wsize?(s.arraySet(A.window,B,v-A.wsize,A.wsize,0),A.wnext=0,A.whave=A.wsize):(T<(H=A.wsize-A.wnext)&&(H=T),s.arraySet(A.window,B,v-T,H,A.wnext),(T-=H)?(s.arraySet(A.window,B,v-T,T,0),A.wnext=T,A.whave=A.wsize):(A.wnext+=H,A.wnext===A.wsize&&(A.wnext=0),A.whave>>8&255,v.check=a(v.check,F,2,0),M=z=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&z)<<8)+(z>>8))%31){P.msg="incorrect header check",v.mode=30;break}if((15&z)!=8){P.msg="unknown compression method",v.mode=30;break}if(M-=4,g=8+(15&(z>>>=4)),v.wbits===0)v.wbits=g;else if(g>v.wbits){P.msg="invalid window size",v.mode=30;break}v.dmax=1<>8&1),512&v.flags&&(F[0]=255&z,F[1]=z>>>8&255,v.check=a(v.check,F,2,0)),M=z=0,v.mode=3;case 3:for(;M<32;){if($===0)break e;$--,z+=T[A++]<>>8&255,F[2]=z>>>16&255,F[3]=z>>>24&255,v.check=a(v.check,F,4,0)),M=z=0,v.mode=4;case 4:for(;M<16;){if($===0)break e;$--,z+=T[A++]<>8),512&v.flags&&(F[0]=255&z,F[1]=z>>>8&255,v.check=a(v.check,F,2,0)),M=z=0,v.mode=5;case 5:if(1024&v.flags){for(;M<16;){if($===0)break e;$--,z+=T[A++]<>>8&255,v.check=a(v.check,F,2,0)),M=z=0}else v.head&&(v.head.extra=null);v.mode=6;case 6:if(1024&v.flags&&($<(G=v.length)&&(G=$),G&&(v.head&&(g=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),s.arraySet(v.head.extra,T,A,G,g)),512&v.flags&&(v.check=a(v.check,T,G,A)),$-=G,A+=G,v.length-=G),v.length))break e;v.length=0,v.mode=7;case 7:if(2048&v.flags){if($===0)break e;for(G=0;g=T[A+G++],v.head&&g&&v.length<65536&&(v.head.name+=String.fromCharCode(g)),g&&G<$;);if(512&v.flags&&(v.check=a(v.check,T,G,A)),$-=G,A+=G,g)break e}else v.head&&(v.head.name=null);v.length=0,v.mode=8;case 8:if(4096&v.flags){if($===0)break e;for(G=0;g=T[A+G++],v.head&&g&&v.length<65536&&(v.head.comment+=String.fromCharCode(g)),g&&G<$;);if(512&v.flags&&(v.check=a(v.check,T,G,A)),$-=G,A+=G,g)break e}else v.head&&(v.head.comment=null);v.mode=9;case 9:if(512&v.flags){for(;M<16;){if($===0)break e;$--,z+=T[A++]<>9&1,v.head.done=!0),P.adler=v.check=0,v.mode=12;break;case 10:for(;M<32;){if($===0)break e;$--,z+=T[A++]<>>=7&M,M-=7&M,v.mode=27;break}for(;M<3;){if($===0)break e;$--,z+=T[A++]<>>=1)){case 0:v.mode=14;break;case 1:if(R(v),v.mode=20,B!==6)break;z>>>=2,M-=2;break e;case 2:v.mode=17;break;case 3:P.msg="invalid block type",v.mode=30}z>>>=2,M-=2;break;case 14:for(z>>>=7&M,M-=7&M;M<32;){if($===0)break e;$--,z+=T[A++]<>>16^65535)){P.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&z,M=z=0,v.mode=15,B===6)break e;case 15:v.mode=16;case 16:if(G=v.length){if($>>=5,M-=5,v.ndist=1+(31&z),z>>>=5,M-=5,v.ncode=4+(15&z),z>>>=4,M-=4,286>>=3,M-=3}for(;v.have<19;)v.lens[V[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,W={bits:v.lenbits},U=u(0,v.lens,0,19,v.lencode,0,v.work,W),v.lenbits=W.bits,U){P.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have>>16&255,_e=65535&C,!((ie=C>>>24)<=M);){if($===0)break e;$--,z+=T[A++]<>>=ie,M-=ie,v.lens[v.have++]=_e;else{if(_e===16){for(S=ie+2;M>>=ie,M-=ie,v.have===0){P.msg="invalid bit length repeat",v.mode=30;break}g=v.lens[v.have-1],G=3+(3&z),z>>>=2,M-=2}else if(_e===17){for(S=ie+3;M>>=ie)),z>>>=3,M-=3}else{for(S=ie+7;M>>=ie)),z>>>=7,M-=7}if(v.have+G>v.nlen+v.ndist){P.msg="invalid bit length repeat",v.mode=30;break}for(;G--;)v.lens[v.have++]=g}}if(v.mode===30)break;if(v.lens[256]===0){P.msg="invalid code -- missing end-of-block",v.mode=30;break}if(v.lenbits=9,W={bits:v.lenbits},U=u(c,v.lens,0,v.nlen,v.lencode,0,v.work,W),v.lenbits=W.bits,U){P.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,W={bits:v.distbits},U=u(d,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,W),v.distbits=W.bits,U){P.msg="invalid distances set",v.mode=30;break}if(v.mode=20,B===6)break e;case 20:v.mode=21;case 21:if(6<=$&&258<=ne){P.next_out=X,P.avail_out=ne,P.next_in=A,P.avail_in=$,v.hold=z,v.bits=M,l(P,J),X=P.next_out,H=P.output,ne=P.avail_out,A=P.next_in,T=P.input,$=P.avail_in,z=v.hold,M=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;ue=(C=v.lencode[z&(1<>>16&255,_e=65535&C,!((ie=C>>>24)<=M);){if($===0)break e;$--,z+=T[A++]<>ye)])>>>16&255,_e=65535&C,!(ye+(ie=C>>>24)<=M);){if($===0)break e;$--,z+=T[A++]<>>=ye,M-=ye,v.back+=ye}if(z>>>=ie,M-=ie,v.back+=ie,v.length=_e,ue===0){v.mode=26;break}if(32&ue){v.back=-1,v.mode=12;break}if(64&ue){P.msg="invalid literal/length code",v.mode=30;break}v.extra=15&ue,v.mode=22;case 22:if(v.extra){for(S=v.extra;M>>=v.extra,M-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;ue=(C=v.distcode[z&(1<>>16&255,_e=65535&C,!((ie=C>>>24)<=M);){if($===0)break e;$--,z+=T[A++]<>ye)])>>>16&255,_e=65535&C,!(ye+(ie=C>>>24)<=M);){if($===0)break e;$--,z+=T[A++]<>>=ye,M-=ye,v.back+=ye}if(z>>>=ie,M-=ie,v.back+=ie,64&ue){P.msg="invalid distance code",v.mode=30;break}v.offset=_e,v.extra=15&ue,v.mode=24;case 24:if(v.extra){for(S=v.extra;M>>=v.extra,M-=v.extra,v.back+=v.extra}if(v.offset>v.dmax){P.msg="invalid distance too far back",v.mode=30;break}v.mode=25;case 25:if(ne===0)break e;if(G=J-ne,v.offset>G){if((G=v.offset-G)>v.whave&&v.sane){P.msg="invalid distance too far back",v.mode=30;break}me=G>v.wnext?(G-=v.wnext,v.wsize-G):v.wnext-G,G>v.length&&(G=v.length),we=v.window}else we=H,me=X-v.offset,G=v.length;for(neE?(D=me[we+y[B]],M[te+y[B]]):(D=96,0),w=1<>X)+(_-=w)]=N<<24|D<<16|R|0,_!==0;);for(w=1<>=1;if(w!==0?(z&=w-1,z+=w):z=0,B++,--J[P]==0){if(P===T)break;P=d[p+y[B]]}if(H>>7)]}function te(C,F){C.pending_buf[C.pending++]=255&F,C.pending_buf[C.pending++]=F>>>8&255}function J(C,F,V){C.bi_valid>m-V?(C.bi_buf|=F<>m-C.bi_valid,C.bi_valid+=V-m):(C.bi_buf|=F<>>=1,V<<=1,0<--F;);return V>>>1}function we(C,F,V){var Z,L,Q=new Array(y+1),re=0;for(Z=1;Z<=y;Z++)Q[Z]=re=re+V[Z-1]<<1;for(L=0;L<=F;L++){var ee=C[2*L+1];ee!==0&&(C[2*L]=me(Q[ee]++,ee))}}function ie(C){var F;for(F=0;F>1;1<=V;V--)ye(C,Q,V);for(L=se;V=C.heap[1],C.heap[1]=C.heap[C.heap_len--],ye(C,Q,1),Z=C.heap[1],C.heap[--C.heap_max]=V,C.heap[--C.heap_max]=Z,Q[2*L]=Q[2*V]+Q[2*Z],C.depth[L]=(C.depth[V]>=C.depth[Z]?C.depth[V]:C.depth[Z])+1,Q[2*V+1]=Q[2*Z+1]=L,C.heap[1]=L++,ye(C,Q,1),2<=C.heap_len;);C.heap[--C.heap_max]=C.heap[1],function(he,Ge){var yn,rt,vn,je,Yn,to,ut=Ge.dyn_tree,Ks=Ge.max_code,cl=Ge.stat_desc.static_tree,ul=Ge.stat_desc.has_stree,dl=Ge.stat_desc.extra_bits,$s=Ge.stat_desc.extra_base,gn=Ge.stat_desc.max_length,Jn=0;for(je=0;je<=y;je++)he.bl_count[je]=0;for(ut[2*he.heap[he.heap_max]+1]=0,yn=he.heap_max+1;yn>=7;L>>=1)if(1&ve&&ee.dyn_ltree[2*se]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(se=32;se>>3,(Q=C.static_len+3+7>>>3)<=L&&(L=Q)):L=Q=V+5,V+4<=L&&F!==-1?S(C,F,V,Z):C.strategy===4||Q===L?(J(C,2+(Z?1:0),3),pe(C,K,P)):(J(C,4+(Z?1:0),3),function(ee,se,ve,he){var Ge;for(J(ee,se-257,5),J(ee,ve-1,5),J(ee,he-4,4),Ge=0;Ge>>8&255,C.pending_buf[C.d_buf+2*C.last_lit+1]=255&F,C.pending_buf[C.l_buf+C.last_lit]=255&V,C.last_lit++,F===0?C.dyn_ltree[2*V]++:(C.matches++,F--,C.dyn_ltree[2*(v[V]+d+1)]++,C.dyn_dtree[2*M(F)]++),C.last_lit===C.lit_bufsize-1},o._tr_align=function(C){J(C,2,3),G(C,_,K),function(F){F.bi_valid===16?(te(F,F.bi_buf),F.bi_buf=0,F.bi_valid=0):8<=F.bi_valid&&(F.pending_buf[F.pending++]=255&F.bi_buf,F.bi_buf>>=8,F.bi_valid-=8)}(C)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,a){if(!i.setImmediate){var l,u,c,d,p=1,h={},b=!1,f=i.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(i);y=y&&y.setTimeout?y:i,l={}.toString.call(i.process)==="[object process]"?function(k){process.nextTick(function(){w(k)})}:function(){if(i.postMessage&&!i.importScripts){var k=!0,x=i.onmessage;return i.onmessage=function(){k=!1},i.postMessage("","*"),i.onmessage=x,k}}()?(d="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",_,!1):i.attachEvent("onmessage",_),function(k){i.postMessage(d+k,"*")}):i.MessageChannel?((c=new MessageChannel).port1.onmessage=function(k){w(k.data)},function(k){c.port2.postMessage(k)}):f&&"onreadystatechange"in f.createElement("script")?(u=f.documentElement,function(k){var x=f.createElement("script");x.onreadystatechange=function(){w(k),x.onreadystatechange=null,u.removeChild(x),x=null},u.appendChild(x)}):function(k){setTimeout(w,0,k)},y.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var x=new Array(arguments.length-1),I=0;I"u"?s===void 0?this:s:self)}).call(this,typeof Xn<"u"?Xn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(ll);var Zh=ll.exports;const Gh=xa(Zh);async function Yh(t){let e="",n=t;for(;n!=null;){const r=await(qe==null?void 0:qe.get(n));if(r==null)break;e=`${r.name}/${e}`,n=r.parentFolderID??null}return e}async function Op(t){if(await(Y==null?void 0:Y.getSetting("twoWaySync")))return await Ct.genFilesCountInFolder(t)??0;const n=await(q==null?void 0:q.listAll())??[],r=await(qe==null?void 0:qe.listAll())??[],o=[t];let s=0;for(;o.length>0;){const i=o.shift();if(i){for(const l of n)l.parentFolderID===i&&s++;const a=r.filter(l=>l.parentFolderID===i).map(l=>l.id);a.length&&o.push(...a)}}return s}const Jh=async t=>{const e=`ComfyUI workspace workflows ${el(Date.now())}`,n=new Gh,r=await(Y==null?void 0:Y.getSetting("twoWaySync"));for(const o of t){let s;r?s=o.parentFolderID??"":s=await Yh(o.parentFolderID??null).then(async a=>Pt(a??""));const i=n.folder(s);i==null||i.file(`${o.name}.json`,o.json)}n.generateAsync({type:"blob"}).then(function(o){const s=document.createElement("a");s.href=window.URL.createObjectURL(o),s.download=`${e}.zip`,document.body.appendChild(s),s.click(),document.body.removeChild(s)})};function Xh({myWorkflowsDir:t}){return O.jsxs(rn,{gap:3,children:[O.jsx(ms,{size:"md",children:"🦄 Upgrade to 2.0 - enable two way sync!"}),O.jsx("p",{children:"Your workflows will be synced to and from path:"}),O.jsx("p",{children:O.jsx("b",{children:t})}),O.jsxs("p",{children:["You can manually put workflow files into this folder using File Explorer to sync them with your workspace. You can change this path anytime in Settings ",">"," Workspace Save Directory"]}),O.jsxs("p",{children:[O.jsx("b",{children:"Please download all your workflows before enabling two way sync as a backup!"})," ","So you can manually import some workflows into your workspace in case something unexpected happens."]}),O.jsx(Le,{colorScheme:"teal",variant:"outline",width:"fit-content",onClick:async()=>{const e=await(q==null?void 0:q.listAll());Jh(e??[])},children:"👉 Download All My Workflows"})]})}const Qh=Da.lazy(()=>At(()=>import("./RecentFilesDrawer-g7Y8NeOQ.js"),__vite__mapDeps([15,1,9,3,14,16,13,5]))),ep=Da.lazy(()=>At(()=>import("./GalleryModal-XNUSEfqI.js"),__vite__mapDeps([17,1,16,13,3,10,9,4])));function tp(){const[t,e]=j.useState(null),[n,r]=j.useState("root"),[o,s]=j.useState(!0),[i,a]=j.useState(null),l=j.useRef(null),[u,c]=j.useState(!1),d=j.useRef(null),{showDialog:p}=Ia(),[h,b]=j.useState(!1);j.useRef(!1);const f=ja(),[y,m]=Vh(null),w=j.useCallback(async(v=!1)=>{var H,A;const T=q==null?void 0:q.curWorkflow;if(T){if(!v&&((H=q==null?void 0:q.curWorkflow)!=null&&H.saveLock)){f({title:"The workflow is locked and cannot be saved",status:"warning",duration:3e3});return}const X=JSON.stringify(Pe.graph.serialize());await Promise.all([q==null?void 0:q.updateFlow(T.id,{json:X}),He==null?void 0:He.create({workflowID:T.id,json:X,isAutoSave:!1})]),(A=Y==null?void 0:Y.settings)!=null&&A.autoSave&&f({title:"Saved",status:"success",duration:1e3,isClosable:!0}),c(!1)}},[]),_=async()=>{var T,H,A;if((T=Y==null?void 0:Y.settings)!=null&&T.autoSave){alert("You cannot discard unsaved changes when auto save is enabled");return}if(confirm("Are you sure you want to discard unsaved changes? This will revert current workflow to your last saved version. You will lose all changes made since your last save.")){const X=(H=q==null?void 0:q.curWorkflow)==null?void 0:H.id;if(X==null)return;const $=(A=await(q==null?void 0:q.get(X)))==null?void 0:A.json;$?(q==null||q.updateCurWorkflow({...q.curWorkflow,json:$}),await Pe.loadGraphData(JSON.parse($)),c(!1)):alert("Error: No last saved version found")}},k=v=>{const T=(v==null?void 0:v.id)??null;if(q==null||q.updateCurWorkflow(v),l.current=T,a(T),e((v==null?void 0:v.name)??""),T==null){document.title="ComfyUI",window.location.hash="",localStorage.removeItem("curFlowID");return}if(ba()){const H=tl(T);window.location.hash=H,document.title=v.name+" - ComfyUI"}else localStorage.setItem("curFlowID",T),document.title="ComfyUI - "+v.name;v&&(q==null||q.updateLastOpenedTime(v.id))},x=async()=>{var H,A;localStorage.removeItem("workspace"),localStorage.removeItem("comfyspace");try{await rh()}catch(X){console.error("error loading db",X)}s(!1);const v=ba();if(v==null){const X=localStorage.getItem("workflow");if(X){const ne=(A=(H=JSON.parse(X).extra)==null?void 0:H[xt])==null?void 0:A.id;if(ne){const z=await(q==null?void 0:q.get(ne));z&&k(z),!(z!=null&&z.saveLock)&&z&&z.json!=X&&c(!0)}}}else I(v);Ie("/workspace/deduplicate_workflow_ids"),!await(Y==null?void 0:Y.getSetting("twoWaySync"))&&ce.cache.get(yo).then(async X=>{if((X==null?void 0:X.value)!=="true"){if(await ce.workflows.count()==0){await(Y==null?void 0:Y.upsert({twoWaySync:!0})),await ce.cache.put({id:yo,value:"true"});return}const ne=await(Y==null?void 0:Y.getSetting("myWorkflowsDir"));p(O.jsx(Xh,{myWorkflowsDir:ne??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{await(Y==null?void 0:Y.upsert({twoWaySync:!0})),await(Y==null?void 0:Y.getSetting("twoWaySync"))&&(ce.cache.put({id:yo,value:"true"}),location.reload())},colorScheme:"red"}],{closeOnOverlayClick:!1})}})},I=async(v,T)=>{if(Pe.graph==null)return;const H=await(q==null?void 0:q.get(v));if(H==null){alert("Error: Workflow not found! id: "+v),k(null);return}const A=T?await(ge==null?void 0:ge.get(T)):null;Pe.ui.dialog.close(),A?(m(A),k({...H,json:A.json}),Pe.loadGraphData(JSON.parse(A.json))):(k(H),m(null),Pe.loadGraphData(JSON.parse(H.json))),r("root"),u&&c(!1)},E=async(v,T,H=!1)=>{var A;if(v===null){k(null),Pe.graph.clear();return}if(!u||H||(A=Y==null?void 0:Y.settings)!=null&&A.autoSave||(q==null?void 0:q.curWorkflow)==null){I(v,T);return}N(v)},N=async v=>{var H;const T=[v?{label:"Open in new tab",icon:O.jsx(mh,{}),onClick:()=>{Yf(v)}}:null,{label:"Save",colorScheme:"teal",onClick:async()=>{await w(),v&&I(v)}}];T.push({label:"Discard",colorScheme:"red",onClick:async()=>{v&&I(v)}}),p(`Please save or discard your changes to "${(H=q==null?void 0:q.curWorkflow)==null?void 0:H.name}" before leaving, or your changes will be lost.`,T)},D=async v=>{const T=(v==null?void 0:v.json)??JSON.stringify(nl),H=await(q==null?void 0:q.createFlow({json:T,name:v==null?void 0:v.name}));H&&await E(H.id),r("root")},R=async(v,T=!1)=>{const H=v.split("/").pop()??v;T?w():D({name:H});const A=await fetch(Gf(v)),X=await A.blob(),$=new File([X],H,{type:A.headers.get("Content-Type")||""});await Pe.handleFile($),r("root")},K=async(v,T)=>{const H=await(q==null?void 0:q.get(v));if(H==null)return;const A=await(q==null?void 0:q.createFlow({json:H.json,name:T||H.name,parentFolderID:H.parentFolderID,tags:H.tags}));A&&await E(A.id)},P=j.useCallback(v=>{if(l.current==null)return;let T=v.filename;v.subfolder!=null&&v.subfolder!==""&&(T=v.subfolder+"/"+T),$t==null||$t.create({workflowID:l.current,localPath:T})},[]),B=j.useCallback(()=>{r("root")},[]);return j.useEffect(()=>{x(),b(!0);const v=T=>{var H,A,X,$,ne,z;(X=(A=(H=T.detail)==null?void 0:H.output)==null?void 0:A.images)==null||X.forEach(M=>{M.type==="output"&&P(M)}),(z=(ne=($=T.detail)==null?void 0:$.output)==null?void 0:ne.gifs)==null||z.forEach(M=>{M.type==="output"&&P(M)})};return Er.addEventListener("executed",v),()=>{window.removeEventListener("executed",v)}},[]),o?null:O.jsx(wt.Provider,{value:{curFlowID:i,onDuplicateWorkflow:K,loadWorkflowID:E,discardUnsavedChanges:_,saveCurWorkflow:w,isDirty:u,setIsDirty:c,loadNewWorkflow:D,loadFilePath:R,setRoute:r,route:n,curVersion:y,setCurVersion:m,setCurFlowIDAndName:k},children:O.jsx("div",{ref:d,className:"workspace_manager",children:O.jsxs(Sa,{containerRef:d,children:[O.jsxs(St,{style:{position:"absolute",top:0,right:0,left:0},zIndex:Jf,draggable:!1,children:[O.jsx(Kh,{curFlowName:t,setCurFlowName:e}),h&&n==="recentFlows"&&O.jsx(j.Suspense,{children:O.jsx(Qh,{onClose:B,onClickNewFlow:()=>{D(),r("root")}})}),n==="gallery"&&O.jsx(j.Suspense,{children:O.jsx(ep,{onclose:()=>r("root")})})]}),O.jsx($h,{})]})})})}const Ip=Object.freeze(Object.defineProperty({__proto__:null,default:tp},Symbol.toStringTag,{value:"Module"}));export{Ie as $,hh as A,St as B,pp as C,Oh as D,$f as E,xn as F,yh as G,zt as H,jn as I,qe as J,qr as K,Vr as L,li as M,Hr as N,_h as O,nl as P,Op as Q,kp as R,dd as S,Xr as T,gr as U,nh as V,hp as W,wt as X,mh as Y,Yf as Z,al as _,ap as a,$t as a0,el as a1,at as a2,Pe as a3,Hl as a4,Jf as a5,lp as a6,wr as a7,mp as a8,Fa as a9,wp as aA,Ws as aB,ps as aC,Ep as aD,xp as aE,Cp as aF,Fn as aG,Nh as aH,Sp as aI,Ip as aJ,ec as aa,vp as ab,ms as ac,nn as ad,tc as ae,xt as af,gp as ag,yp as ah,He as ai,Nl as aj,Hn as ak,Is as al,ce as am,cp as an,bp as ao,_p as ap,up as aq,Er as ar,dp as as,bc as at,ui as au,ci as av,pi as aw,fi as ax,Vh as ay,eh as az,op as b,sp as c,Re as d,xh as e,ja as f,rn as g,Mt as h,Ht as i,Un as j,Y as k,Xh as l,_c as m,Vd as n,ip as o,fp as p,_o as q,Ss as r,Os as s,_r as t,Gr as u,bt as v,ph as w,q as x,Sh as y,Jh as z}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["workspace_web/ShareDialog-t7mRPVSb.js","workspace_web/input.js","workspace_web/civitUtils-uJNBxoFV.js","workspace_web/chunk-7D6N5TE5-fihyubSX.js","workspace_web/chunk-VTV6N5LE-7BSZDdqw.js","workspace_web/IconCopy-DxyTNBlz.js","workspace_web/AppIsDirtyEventListener-xmtnIvLQ.js","workspace_web/useDebounceFn-ld478fd0.js","workspace_web/ModelManagerTopbar-4hMR9SRa.js","workspace_web/chunk-JARCRF6W-UyOcndjS.js","workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js","workspace_web/assets/ModelManagerTopbar--iv3sdjQ.css","workspace_web/SpotlightSearch-crj3ER75.js","workspace_web/IconSearch-qxAzDzhT.js","workspace_web/chunk-NTCQBYKE-HH_ifqNx.js","workspace_web/RecentFilesDrawer-g7Y8NeOQ.js","workspace_web/MediaPreview-muJLkZRm.js","workspace_web/GalleryModal-XNUSEfqI.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/workspace_web/AppIsDirtyEventListener-xmtnIvLQ.js b/dist/workspace_web/AppIsDirtyEventListener-xmtnIvLQ.js new file mode 100644 index 0000000..cd10d2a --- /dev/null +++ b/dist/workspace_web/AppIsDirtyEventListener-xmtnIvLQ.js @@ -0,0 +1 @@ +import{r as u,j as E}from"./input.js";import{X as x,a3 as r,af as C,x as a,i as W,T as A,E as d,ag as L,ah as R,k as h,ai as j}from"./App-1AImvRpr.js";import{u as O}from"./useDebounceFn-ld478fd0.js";function M(){const{isDirty:p,setIsDirty:k,setRoute:v,saveCurWorkflow:T,setCurFlowIDAndName:b}=u.useContext(x),w=u.useRef(p),[S,D]=u.useState(!1),g=u.useRef(null);u.useEffect(()=>{w.current=p},[p]),u.useEffect(()=>{var n,i;const c=e=>{var s;if(document.visibilityState==="hidden")return;const t=R(e);if(t)switch(t===d.openSpotlightSearch&&e.preventDefault(),window.dispatchEvent(new CustomEvent(L,{detail:{shortcutType:t}})),t){case d.SAVE:T();break;case d.SAVE_AS:v("saveAsModal");break;case d.openSpotlightSearch:v("spotlightSearch");break}else(s=e.target)!=null&&s.matches("input, textarea")&&Object.keys(r.canvas.selected_nodes??{}).length&&m()},o=r.graph.onConfigure;return r.graph.onConfigure=function(){o==null||o.apply(this,arguments),setTimeout(()=>{var t,s,l,f;const e=(s=(t=r.graph.extra)==null?void 0:t[C])==null?void 0:s.id;(e==null||e!=((f=(l=a)==null?void 0:l.curWorkflow)==null?void 0:f.id))&&b(null)},500)},document.addEventListener("click",e=>{Object.keys(r.canvas.selected_nodes??{}).length&&(r.canvas.node_over!=null||r.canvas.node_capturing_input!=null||r.canvas.node_widget!=null)&&m()}),document.addEventListener("keydown",c),(i=(n=h)==null?void 0:n.settings)!=null&&i.autoSave&&h.settings.autoSaveDuration&&(g.current=setInterval(()=>{_()},h.settings.autoSaveDuration*1e3)),()=>{document.removeEventListener("keydown",c),g.current&&clearInterval(g.current)}},[]);const _=async()=>{var o,n,i,e,t,s;if((n=(o=a)==null?void 0:o.curWorkflow)!=null&&n.saveLock||!((e=(i=a)==null?void 0:i.curWorkflow)!=null&&e.id)||!w.current)return;const c=JSON.stringify(r.graph.serialize());await((t=a)==null?void 0:t.updateFlow(a.curWorkflow.id,{json:c})),(s=j)==null||s.create({workflowID:a.curWorkflow.id,isAutoSave:!0,json:c}),k(!1)},I=async()=>{var o,n,i,e,t,s,l,f,y;if((n=(o=a)==null?void 0:o.curWorkflow)!=null&&n.saveLock||w.current)return;const c=r.graph.serialize();JSON.stringify(c)!==((e=(i=a)==null?void 0:i.curWorkflow)==null?void 0:e.json)&&(k(!0),(s=(t=h)==null?void 0:t.settings)!=null&&s.autoSave&&((f=(l=a)==null?void 0:l.curWorkflow)!=null&&f.id)&&!S&&(await((y=a)==null?void 0:y.latestVersionCheck())||D(!0)))},[m,N]=O(I,900);return S?E.jsx(W,{label:"This workflow was changed by another tab, so you are not working on the latest version. Please refresh page to see the latest version of this workflow.",children:E.jsx(A,{colorScheme:"yellow",children:"⚠️Outdated version"})}):null}export{M as default}; diff --git a/dist/workspace_web/GalleryModal-XNUSEfqI.js b/dist/workspace_web/GalleryModal-XNUSEfqI.js new file mode 100644 index 0000000..8c25d81 --- /dev/null +++ b/dist/workspace_web/GalleryModal-XNUSEfqI.js @@ -0,0 +1 @@ +import{r as d,d as Se,x as Ht,m as be,b as it,f as O,k as Kt,o as ct,E as Wt,j as r,g as L,n as Yt,e as Xt,V as ut,h as dt,M as Zt,N as qt,O as Jt,Q as Qt,R as en,S as tn}from"./input.js";import{a9 as nn,aa as sn,d as Re,F as m,ab as rn,I as M,j as on,g as Ee,B as ht,h as W,X as oe,a3 as tt,x as R,H as Y,i as A,w as ft,a1 as xt,e as pt,a0 as F,ac as an,y as ln}from"./App-1AImvRpr.js";import{c as je,p as cn,r as nt,v as st,I as un,i as dn,b as hn,d as fn,g as xn,N as pn,a as gn,e as mn,f as vn,h as yn,M as gt,u as wn,S as Sn}from"./MediaPreview-muJLkZRm.js";import{I as bn}from"./chunk-7D6N5TE5-fihyubSX.js";import{S as jn}from"./chunk-3RSXBRAN-gZ_JDRlM.js";import{C as Ae,G as kn}from"./chunk-JARCRF6W-UyOcndjS.js";import{S as rt,L as Ne}from"./chunk-VTV6N5LE-7BSZDdqw.js";import"./IconSearch-qxAzDzhT.js";const mt=1/60*1e3,Pn=typeof performance<"u"?()=>performance.now():()=>Date.now(),vt=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(Pn()),mt);function Cn(e){let t=[],s=[],n=0,o=!1,a=!1;const l=new WeakSet,c={schedule:(i,u=!1,p=!1)=>{const f=p&&o,v=f?t:s;return u&&l.add(i),v.indexOf(i)===-1&&(v.push(i),f&&o&&(n=t.length)),i},cancel:i=>{const u=s.indexOf(i);u!==-1&&s.splice(u,1),l.delete(i)},process:i=>{if(o){a=!0;return}if(o=!0,[t,s]=[s,t],s.length=0,n=t.length,n)for(let u=0;u(e[t]=Cn(()=>X=!0),e),{}),Tn=Z.reduce((e,t)=>{const s=ae[t];return e[t]=(n,o=!1,a=!1)=>(X||Mn(),s.schedule(n,o,a)),e},{}),En=Z.reduce((e,t)=>(e[t]=ae[t].cancel,e),{});Z.reduce((e,t)=>(e[t]=()=>ae[t].process(B),e),{});const Nn=e=>ae[e].process(B),yt=e=>{X=!1,B.delta=Me?mt:Math.max(Math.min(e-B.timestamp,In),1),B.timestamp=e,_e=!0,Z.forEach(Nn),_e=!1,X&&(Me=!1,vt(yt))},Mn=()=>{X=!0,Me=!0,_e||vt(yt)},ot=()=>B;var V=e=>e?"":void 0,ke=e=>e?!0:void 0,q=(...e)=>e.filter(Boolean).join(" ");function Pe(...e){return function(s){e.some(n=>(n==null||n(s),s==null?void 0:s.defaultPrevented))}}function Q(e){const{orientation:t,vertical:s,horizontal:n}=e;return t==="vertical"?s:n}var te={width:0,height:0},ee=e=>e||te;function _n(e){const{orientation:t,thumbPercents:s,thumbRects:n,isReversed:o}=e,a=y=>{var w;const E=(w=n[y])!=null?w:te;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Q({orientation:t,vertical:{bottom:`calc(${s[y]}% - ${E.height/2}px)`},horizontal:{left:`calc(${s[y]}% - ${E.width/2}px)`}})}},l=t==="vertical"?n.reduce((y,w)=>ee(y).height>ee(w).height?y:w,te):n.reduce((y,w)=>ee(y).width>ee(w).width?y:w,te),c={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Q({orientation:t,vertical:l?{paddingLeft:l.width/2,paddingRight:l.width/2}:{},horizontal:l?{paddingTop:l.height/2,paddingBottom:l.height/2}:{}})},i={position:"absolute",...Q({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},u=s.length===1,p=[0,o?100-s[0]:s[0]],f=u?p:s;let v=f[0];!u&&o&&(v=100-v);const g=Math.abs(f[f.length-1]-f[0]),I={...i,...Q({orientation:t,vertical:o?{height:`${g}%`,top:`${v}%`}:{height:`${g}%`,bottom:`${v}%`},horizontal:o?{width:`${g}%`,right:`${v}%`}:{width:`${g}%`,left:`${v}%`}})};return{trackStyle:i,innerTrackStyle:I,rootStyle:c,getThumbStyle:a}}function Dn(e){const{isReversed:t,direction:s,orientation:n}=e;return s==="ltr"||n==="vertical"?t:!t}function zn(e,t,s,n){return e.addEventListener(t,s,n),()=>{e.removeEventListener(t,s,n)}}function Rn(e){const t=Fn(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function wt(e){return!!e.touches}function An(e){return wt(e)&&e.touches.length>1}function Fn(e){var t;return(t=e.view)!=null?t:window}function $n(e,t="page"){const s=e.touches[0]||e.changedTouches[0];return{x:s[`${t}X`],y:s[`${t}Y`]}}function Vn(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function St(e,t="page"){return wt(e)?$n(e,t):Vn(e,t)}function Bn(e){return t=>{const s=Rn(t);(!s||s&&t.button===0)&&e(t)}}function On(e,t=!1){function s(o){e(o,{point:St(o)})}return t?Bn(s):s}function ne(e,t,s,n){return zn(e,t,On(s,t==="pointerdown"),n)}var Ln=Object.defineProperty,Gn=(e,t,s)=>t in e?Ln(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,T=(e,t,s)=>(Gn(e,typeof t!="symbol"?t+"":t,s),s),Un=class{constructor(e,t,s){T(this,"history",[]),T(this,"startEvent",null),T(this,"lastEvent",null),T(this,"lastEventInfo",null),T(this,"handlers",{}),T(this,"removeListeners",()=>{}),T(this,"threshold",3),T(this,"win"),T(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const c=Ce(this.lastEventInfo,this.history),i=this.startEvent!==null,u=Yn(c.offset,{x:0,y:0})>=this.threshold;if(!i&&!u)return;const{timestamp:p}=ot();this.history.push({...c.point,timestamp:p});const{onStart:f,onMove:v}=this.handlers;i||(f==null||f(this.lastEvent,c),this.startEvent=this.lastEvent),v==null||v(this.lastEvent,c)}),T(this,"onPointerMove",(c,i)=>{this.lastEvent=c,this.lastEventInfo=i,Tn.update(this.updatePoint,!0)}),T(this,"onPointerUp",(c,i)=>{const u=Ce(i,this.history),{onEnd:p,onSessionEnd:f}=this.handlers;f==null||f(c,u),this.end(),!(!p||!this.startEvent)&&(p==null||p(c,u))});var n;if(this.win=(n=e.view)!=null?n:window,An(e))return;this.handlers=t,s&&(this.threshold=s),e.stopPropagation(),e.preventDefault();const o={point:St(e)},{timestamp:a}=ot();this.history=[{...o.point,timestamp:a}];const{onSessionStart:l}=t;l==null||l(e,Ce(o,this.history)),this.removeListeners=Wn(ne(this.win,"pointermove",this.onPointerMove),ne(this.win,"pointerup",this.onPointerUp),ne(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),En.update(this.updatePoint)}};function at(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ce(e,t){return{point:e.point,delta:at(e.point,t[t.length-1]),offset:at(e.point,t[0]),velocity:Kn(t,.1)}}var Hn=e=>e*1e3;function Kn(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,n=null;const o=e[e.length-1];for(;s>=0&&(n=e[s],!(o.timestamp-n.timestamp>Hn(t)));)s--;if(!n)return{x:0,y:0};const a=(o.timestamp-n.timestamp)/1e3;if(a===0)return{x:0,y:0};const l={x:(o.x-n.x)/a,y:(o.y-n.y)/a};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function Wn(...e){return t=>e.reduce((s,n)=>n(s),t)}function Ie(e,t){return Math.abs(e-t)}function lt(e){return"x"in e&&"y"in e}function Yn(e,t){if(typeof e=="number"&&typeof t=="number")return Ie(e,t);if(lt(e)&<(t)){const s=Ie(e.x,t.x),n=Ie(e.y,t.y);return Math.sqrt(s**2+n**2)}return 0}function bt(e){const t=d.useRef(null);return t.current=e,t}function Xn(e,t){const{onPan:s,onPanStart:n,onPanEnd:o,onPanSessionStart:a,onPanSessionEnd:l,threshold:c}=t,i=!!(s||n||o||a||l),u=d.useRef(null),p=bt({onSessionStart:a,onSessionEnd:l,onStart:n,onMove:s,onEnd(f,v){u.current=null,o==null||o(f,v)}});d.useEffect(()=>{var f;(f=u.current)==null||f.updateHandlers(p.current)}),d.useEffect(()=>{const f=e.current;if(!f||!i)return;function v(g){u.current=new Un(g,p.current,c)}return ne(f,"pointerdown",v)},[e,i,p,c]),d.useEffect(()=>()=>{var f;(f=u.current)==null||f.end(),u.current=null},[])}function Zn(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const s=e.ownerDocument.defaultView??window,n=new s.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[a]=o;let l,c;if("borderBoxSize"in a){const i=a.borderBoxSize,u=Array.isArray(i)?i[0]:i;l=u.inlineSize,c=u.blockSize}else l=e.offsetWidth,c=e.offsetHeight;t({width:l,height:c})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}var qn=globalThis!=null&&globalThis.document?d.useLayoutEffect:d.useEffect;function Jn(e,t){var s,n;if(!e||!e.parentElement)return;const o=(n=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?n:window,a=new o.MutationObserver(()=>{t()});return a.observe(e.parentElement,{childList:!0}),()=>{a.disconnect()}}function Qn({getNodes:e,observeMutation:t=!0}){const[s,n]=d.useState([]),[o,a]=d.useState(0);return qn(()=>{const l=e(),c=l.map((i,u)=>Zn(i,p=>{n(f=>[...f.slice(0,u),p,...f.slice(u+1)])}));if(t){const i=l[0];c.push(Jn(i,()=>{a(u=>u+1)}))}return()=>{c.forEach(i=>{i==null||i()})}},[o]),s}function es(e){return typeof e=="object"&&e!==null&&"current"in e}function ts(e){const[t]=Qn({observeMutation:!1,getNodes(){return[es(e)?e.current:e]}});return t}function ns(e){var t;const{min:s=0,max:n=100,onChange:o,value:a,defaultValue:l,isReversed:c,direction:i="ltr",orientation:u="horizontal",id:p,isDisabled:f,isReadOnly:v,onChangeStart:g,onChangeEnd:I,step:y=1,getAriaValueText:w,"aria-valuetext":E,"aria-label":$,"aria-labelledby":b,name:_,focusThumbOnChange:Mt=!0,...Fe}=e,$e=Se(g),G=Se(I),Ve=Se(w),C=Dn({isReversed:c,direction:i,orientation:u}),[_t,de]=nn({value:a,defaultValue:l??rs(s,n),onChange:o}),[he,Be]=d.useState(!1),[fe,Oe]=d.useState(!1),xe=!(f||v),pe=(n-s)/10,U=y||(n-s)/100,S=je(_t,s,n),Dt=n-S+s,Le=st(C?Dt:S,s,n),J=u==="vertical",j=bt({min:s,max:n,step:y,isDisabled:f,value:S,isInteractive:xe,isReversed:C,isVertical:J,eventSource:null,focusThumbOnChange:Mt,orientation:u}),ge=d.useRef(null),me=d.useRef(null),Ge=d.useRef(null),zt=d.useId(),Ue=p??zt,[He,Ke]=[`slider-thumb-${Ue}`,`slider-track-${Ue}`],Rt=d.useCallback(h=>{var x,H;if(!ge.current)return;const k=j.current;k.eventSource="pointer";const N=ge.current.getBoundingClientRect(),{clientX:ye,clientY:Lt}=(H=(x=h.touches)==null?void 0:x[0])!=null?H:h,Gt=J?N.bottom-Lt:ye-N.left,Ut=J?N.height:N.width;let we=Gt/Ut;C&&(we=1-we);let K=cn(we,k.min,k.max);return k.step&&(K=parseFloat(nt(K,k.min,k.step))),K=je(K,k.min,k.max),K},[J,C,j]),D=d.useCallback(h=>{const x=j.current;x.isInteractive&&(h=parseFloat(nt(h,x.min,U)),h=je(h,x.min,x.max),de(h))},[U,de,j]),z=d.useMemo(()=>({stepUp(h=U){const x=C?S-h:S+h;D(x)},stepDown(h=U){const x=C?S+h:S-h;D(x)},reset(){D(l||0)},stepTo(h){D(h)}}),[D,C,S,U,l]),We=d.useCallback(h=>{const x=j.current,k={ArrowRight:()=>z.stepUp(),ArrowUp:()=>z.stepUp(),ArrowLeft:()=>z.stepDown(),ArrowDown:()=>z.stepDown(),PageUp:()=>z.stepUp(pe),PageDown:()=>z.stepDown(pe),Home:()=>D(x.min),End:()=>D(x.max)}[h.key];k&&(h.preventDefault(),h.stopPropagation(),k(h),x.eventSource="keyboard")},[z,D,pe,j]),Ye=(t=Ve==null?void 0:Ve(S))!=null?t:E,ve=ts(me),{getThumbStyle:Xe,rootStyle:Ze,trackStyle:qe,innerTrackStyle:Je}=d.useMemo(()=>{const h=j.current,x=ve??{width:0,height:0};return _n({isReversed:C,orientation:h.orientation,thumbRects:[x],thumbPercents:[Le]})},[C,ve,Le,j]),Qe=d.useCallback(()=>{j.current.focusThumbOnChange&&setTimeout(()=>{var x;return(x=me.current)==null?void 0:x.focus()})},[j]);Ht(()=>{const h=j.current;Qe(),h.eventSource==="keyboard"&&(G==null||G(h.value))},[S,G]);function et(h){const x=Rt(h);x!=null&&x!==j.current.value&&de(x)}Xn(Ge,{onPanSessionStart(h){const x=j.current;x.isInteractive&&(Be(!0),Qe(),et(h),$e==null||$e(x.value))},onPanSessionEnd(){const h=j.current;h.isInteractive&&(Be(!1),G==null||G(h.value))},onPan(h){j.current.isInteractive&&et(h)}});const At=d.useCallback((h={},x=null)=>({...h,...Fe,ref:be(x,Ge),tabIndex:-1,"aria-disabled":ke(f),"data-focused":V(fe),style:{...h.style,...Ze}}),[Fe,f,fe,Ze]),Ft=d.useCallback((h={},x=null)=>({...h,ref:be(x,ge),id:Ke,"data-disabled":V(f),style:{...h.style,...qe}}),[f,Ke,qe]),$t=d.useCallback((h={},x=null)=>({...h,ref:x,style:{...h.style,...Je}}),[Je]),Vt=d.useCallback((h={},x=null)=>({...h,ref:be(x,me),role:"slider",tabIndex:xe?0:void 0,id:He,"data-active":V(he),"aria-valuetext":Ye,"aria-valuemin":s,"aria-valuemax":n,"aria-valuenow":S,"aria-orientation":u,"aria-disabled":ke(f),"aria-readonly":ke(v),"aria-label":$,"aria-labelledby":$?void 0:b,style:{...h.style,...Xe(0)},onKeyDown:Pe(h.onKeyDown,We),onFocus:Pe(h.onFocus,()=>Oe(!0)),onBlur:Pe(h.onBlur,()=>Oe(!1))}),[xe,He,he,Ye,s,n,S,u,f,v,$,b,Xe,We]),Bt=d.useCallback((h,x=null)=>{const H=!(h.valuen),k=S>=h.value,N=st(h.value,s,n),ye={position:"absolute",pointerEvents:"none",...ss({orientation:u,vertical:{bottom:C?`${100-N}%`:`${N}%`},horizontal:{left:C?`${100-N}%`:`${N}%`}})};return{...h,ref:x,role:"presentation","aria-hidden":!0,"data-disabled":V(f),"data-invalid":V(!H),"data-highlighted":V(k),style:{...h.style,...ye}}},[f,C,n,s,u,S]),Ot=d.useCallback((h={},x=null)=>({...h,ref:x,type:"hidden",value:S,name:_}),[_,S]);return{state:{value:S,isFocused:fe,isDragging:he},actions:z,getRootProps:At,getTrackProps:Ft,getInnerTrackProps:$t,getThumbProps:Vt,getMarkerProps:Bt,getInputProps:Ot}}function ss(e){const{orientation:t,vertical:s,horizontal:n}=e;return t==="vertical"?s:n}function rs(e,t){return t"}),[as,ie]=it({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),jt=O((e,t)=>{var s;const n={...e,orientation:(s=e==null?void 0:e.orientation)!=null?s:"horizontal"},o=Kt("Slider",n),a=ct(n),{direction:l}=Wt();a.direction=l;const{getInputProps:c,getRootProps:i,...u}=ns(a),p=i(),f=c({},t);return r.jsx(os,{value:u,children:r.jsx(as,{value:o,children:r.jsxs(L.div,{...p,className:q("chakra-slider",n.className),__css:o.container,children:[n.children,r.jsx("input",{...f})]})})})});jt.displayName="Slider";var kt=O((e,t)=>{const{getThumbProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(L.div,{...o,className:q("chakra-slider__thumb",e.className),__css:n.thumb})});kt.displayName="SliderThumb";var Pt=O((e,t)=>{const{getTrackProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(L.div,{...o,className:q("chakra-slider__track",e.className),__css:n.track})});Pt.displayName="SliderTrack";var Ct=O((e,t)=>{const{getInnerTrackProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(L.div,{...o,className:q("chakra-slider__filled-track",e.className),__css:n.filledTrack})});Ct.displayName="SliderFilledTrack";var ls=O((e,t)=>{const{getMarkerProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(L.div,{...o,className:q("chakra-slider__marker",e.className),__css:n.mark})});ls.displayName="SliderMark";function is(e,t=[]){const s=Object.assign({},e);for(const n of t)n in s&&delete s[n];return s}var cs=["h","minH","height","minHeight"],It=O((e,t)=>{const s=Yt("Textarea",e),{className:n,rows:o,...a}=ct(e),l=sn(a),c=o?is(s,cs):s;return r.jsx(L.textarea,{ref:t,rows:o,...l,className:Xt("chakra-textarea",n),__css:c})});It.displayName="Textarea";var us=Re("chevron-left","IconChevronLeft",[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]]),Tt=Re("pin-filled","IconPinFilled",[["path",{d:"M15.113 3.21l.094 .083l5.5 5.5a1 1 0 0 1 -1.175 1.59l-3.172 3.171l-1.424 3.797a1 1 0 0 1 -.158 .277l-.07 .08l-1.5 1.5a1 1 0 0 1 -1.32 .082l-.095 -.083l-2.793 -2.792l-3.793 3.792a1 1 0 0 1 -1.497 -1.32l.083 -.094l3.792 -3.793l-2.792 -2.793a1 1 0 0 1 -.083 -1.32l.083 -.094l1.5 -1.5a1 1 0 0 1 .258 -.187l.098 -.042l3.796 -1.425l3.171 -3.17a1 1 0 0 1 1.497 -1.26z",fill:"currentColor",key:"svg-0",strokeWidth:"0"}]]),Et=Re("pin","IconPin",[["path",{d:"M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4",key:"svg-0"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-1"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-2"}]]);const ds=({setMediaAct:e,media:t,currentNum:s})=>{const n=l=>{const c=(s+l+t.length)%t.length;e&&e(t[c])},o={width:"100%",height:"100%"};if(t.length===0)return r.jsx("p",{children:"No images found, let's start generating 🪄"});const a=t.at(s);return a?r.jsxs(m,{justifyContent:"center",alignItems:"center",position:"relative",width:o.width,height:o.height,overflow:"hidden",children:[r.jsx("div",{style:{position:"absolute",cursor:"pointer",width:"100%",height:"100%"},onClick:()=>{window.open(a.imageUrl)},children:rn(a.imageUrl)?r.jsx(bn,{src:a.imageUrl,alt:`image-${a.id}`,width:"100%",height:"100%",objectFit:"contain"}):r.jsx("video",{style:{objectFit:"contain"},width:"100%",height:"100%",src:a.imageUrl,loop:!0,autoPlay:!0,muted:!0,children:r.jsx("track",{kind:"captions"})})},a.id),r.jsx(M,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Previous image",icon:r.jsx(us,{}),onClick:()=>n(-1),position:"absolute",left:"0",zIndex:"2"}),r.jsx(M,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Next image",icon:r.jsx(un,{}),onClick:()=>n(1),position:"absolute",right:"0",zIndex:"2"})]}):null};function hs(e){const t=e.split(".").pop();return fetch(e).then(s=>{if(!s.ok)throw new Error("Network response was not ok");return s.blob()}).then(async s=>{const n=e.split("/").pop()??"",o=new File([s],n);if(dn(e))return hn(o);if(t==="webp")return fn(o);const a=await xn(o),l=JSON.parse(a==null?void 0:a.prompt),c=JSON.parse(a==null?void 0:a.workflow);return{prompt:l,workflow:c}})}const fs=({inputItem:e})=>r.jsxs(m,{gap:2,children:[r.jsx(m,{gap:1,alignItems:"center",flexBasis:"200px",children:e.label??e.inputName}),r.jsx(on,{value:e.inputValue,onChange:t=>{}})]}),xs=e=>{const t=e.inputItem;return r.jsxs(m,{gap:1,direction:"column",children:[r.jsxs(m,{gap:2,children:[r.jsx(m,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsxs(pn,{width:"100%",step:e==null?void 0:e.step,value:t.inputValue,min:e==null?void 0:e.min,max:e==null?void 0:e.max,onChange:s=>{},children:[r.jsx(gn,{}),r.jsxs(mn,{children:[r.jsx(vn,{}),r.jsx(yn,{})]})]})]}),r.jsx(m,{children:r.jsxs(jt,{maxWidth:"400px",step:e==null?void 0:e.step,value:Number(t.inputValue),min:(e==null?void 0:e.min)??0,max:(e==null?void 0:e.max)??100,onChange:s=>{},children:[r.jsx(Pt,{children:r.jsx(Ct,{})}),r.jsx(kt,{})]})})]})},ps=e=>{var s;const{inputItem:t}=e;return r.jsxs(m,{gap:2,children:[r.jsx(m,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsx(jn,{value:t.inputValue,onChange:n=>{},children:(s=e==null?void 0:e.options)==null?void 0:s.map((n,o)=>r.jsx("option",{value:n,children:n},`select${t.nodeID}${t.inputName}${o}`))})]})},gs=e=>{const t=e.inputItem;return r.jsxs(m,{gap:1,direction:"column",children:[r.jsx(m,{children:t.label??t.inputName}),r.jsx(It,{value:t.inputValue,onChange:s=>{},rows:5})]})};var P=(e=>(e.Input="Input",e.InputSlider="InputSlider",e.Select="Select",e.Textarea="Textarea",e.Checkbox="Checkbox",e.NoSupport="NoSupport",e))(P||{});const ms=e=>r.jsxs(m,{gap:2,children:[r.jsx(m,{gap:1,alignItems:"center",flexBasis:"200px",children:e.inputItem.label??e.inputItem.inputName}),r.jsx(m,{children:"No Support"})]}),vs=e=>{const t=e.inputItem;return r.jsxs(m,{gap:2,children:[r.jsx(m,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsx(Ae,{defaultChecked:!!t.inputValue,onChange:s=>{var n;(n=e==null?void 0:e.updateMetaData)==null||n.call(e,{promptKey:e.promptKey,name:e.name,value:s.target.checked})}})]})},ce=d.createContext({topFields:[],calcInputList:[],showNodeName:!1,updateTopField(){}}),ys={[P.Input]:fs,[P.InputSlider]:xs,[P.Select]:ps,[P.Textarea]:gs,[P.Checkbox]:vs,NoSupport:ms},ws=LiteGraph.registered_node_types;function Ss(e,t){var o,a,l,c,i;const s=(o=ws[e])==null?void 0:o.nodeData,n={...((a=s==null?void 0:s.input)==null?void 0:a.required)??{},...((l=s==null?void 0:s.input)==null?void 0:l.optional)??{}}[t];return(n==null?void 0:n[0])==="STRING"?(c=n==null?void 0:n[1])!=null&&c.multiline?{type:P.Textarea}:{type:P.Input}:(n==null?void 0:n[0])==="BOOLEAN"?{type:P.Checkbox}:(n==null?void 0:n[0])==="FLOAT"?{...(n==null?void 0:n[1])??{},type:P.InputSlider}:(n==null?void 0:n[0])==="INT"?{...(n==null?void 0:n[1])??{},type:P.InputSlider}:Array.isArray(n==null?void 0:n[0])&&((i=n==null?void 0:n[0])!=null&&i.every(u=>typeof u=="string"))?{options:n==null?void 0:n[0],type:P.Select}:{type:P.NoSupport}}const De=({inputItem:e})=>{const t=Ss(e.classType,e.inputName),[s,n]=d.useState(!1),o=ys[t.type??"Input"],{updateTopField:a,topFields:l}=d.useContext(ce),c=e.children[0]==="negative"||e.children[0]==="positive"?`-${e.children[0]}`:"",i={...e,label:e.label??e.inputName+c};return r.jsxs(m,{alignItems:"center",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[r.jsx(M,{size:"xs",onClick:()=>a==null?void 0:a({name:e.inputName,promptKey:e.nodeID,class_type:e.classType}),variant:"ghost",icon:re(l,{name:e.inputName,promptKey:e.nodeID,classType:e.classType})?r.jsx(Tt,{size:14}):r.jsx(Et,{size:14}),"aria-label":"pin"}),r.jsx("div",{style:{flex:1},children:r.jsx(o,{inputItem:i,...t})})]})};function bs(){const{topFields:e,updateTopField:t,calcInputList:s}=d.useContext(ce);return e.length===0?null:r.jsx(r.Fragment,{children:r.jsx(m,{px:2,gap:2,direction:"column",children:e==null?void 0:e.map(n=>{const o=s.find(a=>a.nodeID==n.promptKey&&a.inputName===n.name&&a.classType===n.class_type);return!n.class_type||!o?null:r.jsx(De,{inputItem:o},`formTopField${n.promptKey}${n.name}`)})})})}function js(){const{topFields:e,calcInputList:t,showNodeName:s}=d.useContext(ce),n=d.useCallback(a=>{const l=[];return a.forEach(c=>{const i=l[l.length-1];!i||i[0].nodeID!==c.nodeID||i[0].classType!==c.classType?l.push([c]):i.push(c)}),l},[]);if(d.useEffect(()=>{},[s]),!s)return r.jsx(Ee,{children:t.map(a=>re(e,{name:a.inputName,promptKey:a.nodeID,classType:a.classType})?null:r.jsx(De,{inputItem:a},`form${a.nodeID}${a.inputName}`))});const o=n(t);return r.jsx(Ee,{children:o.map(a=>a[0]?r.jsx(ks,{title:a[0].classType+" #"+a[0].nodeID,children:r.jsx(m,{px:2,gap:1,direction:"column",children:a.map(l=>re(e,{name:l.inputName,promptKey:l.nodeID,classType:l.classType})?null:r.jsx(De,{inputItem:l},`form${l.nodeID}${l.inputName}`))})},a[0].nodeID):null)})}function ks({title:e,children:t}){return r.jsxs(ht,{border:"1px",borderColor:"gray.500",borderRadius:"md",p:4,children:[r.jsx(W,{size:"sm",mb:1,color:"GrayText",children:e}),r.jsx("div",{children:t})]})}let se=[],ze=new Set;function Nt(e,t){if(!ze.has(e.nodeID))return ze.add(e.nodeID),Object.entries(e.inputs).forEach(([s,n])=>{if(Array.isArray(n)){const o=n[0];Nt(t[o],t)}}),Object.entries(e.inputs).forEach(([s,n])=>{Array.isArray(n)||se.push({classType:e.class_type,inputName:s,inputValue:n,nodeID:e.nodeID,children:e.children||[]})}),se}function Ps(e){se=[],ze=new Set;for(const t of Object.keys(e))e[t].nodeID=t,Object.entries(e[t].inputs).forEach(([s,n])=>{if(Array.isArray(n)){const o=n[0],a=e[o];a.children||(a.children=[]),a.children.push(s)}});for(const t of Object.keys(e))Nt(e[t],e);return se}const re=(e,t)=>e==null?void 0:e.some(s=>s.promptKey===(t==null?void 0:t.promptKey)&&s.name===(t==null?void 0:t.name)&&s.class_type===t.classType);function Cs({media:e}){const[t,s]=d.useState([]),{curFlowID:n}=d.useContext(oe),[o,a]=d.useState(),[l,c]=d.useState(!0),[i,u]=d.useState(!0);d.useEffect(()=>{e?hs(`/workspace/view_media?filename=${e.localPath}`).then(g=>{a(g.prompt)}):tt.graphToPrompt(tt.graph).then(g=>{a(g.output)})},[e]),d.useEffect(()=>{if(!o)return;const g=Ps(o);s(g)},[o]);const[p,f]=d.useState([]);d.useEffect(()=>{(async()=>{var g,I;if(n){const y=(I=await((g=R)==null?void 0:g.get(n)))==null?void 0:I.topFieldsConfig;y&&(f(y),c(!1))}})()},[n]);const v=g=>{var I,y;if(re(p,{name:g.name,promptKey:g==null?void 0:g.promptKey,classType:(g==null?void 0:g.class_type)??""})){const w=p.filter(E=>E.name!==g.name||E.promptKey!==g.promptKey);f(w),n&&((I=R)==null||I.updateTopFields(n,{topFieldsConfig:w}))}else{const w=[...p,g];f(w),n&&((y=R)==null||y.updateTopFields(n,{topFieldsConfig:w}))}};return r.jsx(ce.Provider,{value:{topFields:p,showNodeName:i,calcInputList:t,updateTopField:v},children:r.jsxs(m,{direction:"column",align:"stretch",gap:5,children:[r.jsx(bs,{}),r.jsxs(Y,{children:[r.jsx("p",{children:"Show all inputs"}),r.jsx(rt,{isChecked:l,onChange:g=>c(!l)}),r.jsx("p",{children:"Show node names"}),r.jsx(rt,{isChecked:i,onChange:g=>u(!i)})]}),l&&r.jsx(js,{})]})})}const ue=d.createContext({showAllImages:!1,curMedia:null,setCurMedia(){},setMediaList(){},setShowAllImages(){}}),Is=({media:e})=>{var l,c;const[t,s]=d.useState(!1),{setMediaList:n}=d.useContext(ue),{loadFilePath:o}=d.useContext(oe),{showDialog:a}=ut();return d.useEffect(()=>{var i,u;s((e==null?void 0:e.localPath)!=null&&((u=(i=R)==null?void 0:i.curWorkflow)==null?void 0:u.coverMediaPath)===(e==null?void 0:e.localPath))},[e]),e?r.jsxs(m,{flexWrap:"wrap",gap:3,children:[r.jsx(m,{alignItems:"center",gap:2,children:e.localPath&&r.jsxs(r.Fragment,{children:[r.jsx(W,{children:e==null?void 0:e.localPath}),r.jsx(A,{label:"Donwload image from gallery",children:r.jsx(Ne,{href:`/workspace/view_media?filename=${e==null?void 0:e.localPath}`,download:e==null?void 0:e.localPath,children:r.jsx(M,{size:"sm",icon:r.jsx(ft,{size:19}),"aria-label":"donwload image from gallery"})})})]})}),r.jsx(m,{gap:1,alignItems:"center",color:"GrayText",children:!!(e!=null&&e.createTime)&&r.jsx(W,{children:xt((e==null?void 0:e.createTime)??0,!0)})}),r.jsx(A,{label:"Remove image from gallery",children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(pt,{size:19}),"aria-label":"remove image from gallery",colorScheme:"red",onClick:async()=>{var u;confirm("Are you sure to remove this image from gallery? (won't delete image on your disk)")&&(await((u=F)==null?void 0:u.delete(e.id)),n(p=>p.filter(f=>f.id!==e.id)))}})}),((c=(l=R)==null?void 0:l.curWorkflow)==null?void 0:c.id)&&r.jsx(A,{label:"Set as cover",children:r.jsx(M,{size:"sm",variant:"ghost",icon:t?r.jsx(Tt,{size:19}):r.jsx(Et,{size:19}),"aria-label":"set as cover",onClick:async()=>{var i;await((i=R)==null?void 0:i.updateMetaInfo(R.curWorkflow.id,{coverMediaPath:t?void 0:e.localPath})),s(!t)}})}),r.jsx(dt,{onClick:()=>a("How do you want to load this workflow?",[{label:"Load in new workflow",onClick:()=>{o(e.localPath)},colorScheme:"teal"},{label:"Overwrite current workflow",onClick:()=>o(e.localPath,!0),colorScheme:"red"}]),size:"sm",children:"Load"})]}):null},Ts=({media:e})=>r.jsxs(m,{overflowY:"auto",mb:4,direction:"column",gap:2,flex:1,children:[r.jsx(Is,{media:e}),r.jsx(Cs,{media:e??null})]}),Te=120;function Es({mediaList:e}){const{curMedia:t,setCurMedia:s}=d.useContext(ue);return r.jsxs(m,{gap:3,h:"100%",children:[r.jsxs(kn,{gridTemplateRows:e.length<=6?"1fr 20%":"1fr",flex:1,gap:2,children:[r.jsx("div",{style:{height:"56vh"},children:r.jsx(ds,{media:e.map(n=>({id:n.id,imageUrl:`/workspace/view_media?filename=${n.localPath}`})),currentNum:(e==null?void 0:e.findIndex(n=>n.id===(t==null?void 0:t.id)))??0,setMediaAct:n=>s((e==null?void 0:e.find(o=>o.id===n.id))??null)})}),r.jsx(m,{wrap:"wrap",children:e==null?void 0:e.map(n=>r.jsx(ht,{display:"inline-block",p:1,borderRadius:"4px",width:`${Te+3}px`,height:`${Te+3}px`,cursor:"pointer",border:(t==null?void 0:t.id)===n.id?"1px solid gray":"",onClick:()=>s(n),children:r.jsx(gt,{mediaLocalPath:n.localPath,size:Te,objectFit:"contain",hideBrokenImage:!0,onBrokenLink:()=>{var o;(o=F)==null||o.delete(n.id)}})},`image-bottom-${n.id}`))})]}),r.jsx(Ts,{media:t??void 0})]})}const Ns=({media:e,isSelecting:t,selectedID:s,onClickMedia:n})=>{const{curFlowID:a,loadFilePath:l}=d.useContext(oe),{showDialog:c}=ut();if(e.localPath==null||a==null)return null;const i=r.jsxs(Ne,{isExternal:!0,onClick:()=>n(e),position:"relative",children:[t&&r.jsx(Ae,{isChecked:s.includes(e.id),position:"absolute",top:2,left:2}),r.jsx(gt,{mediaLocalPath:e.localPath,size:180,onBrokenLink:()=>{var u;(u=F)==null||u.delete(e.id)},hideBrokenImage:!0,autoPlay:!0,isPreview:!0})]});return r.jsxs(Ee,{width:180,mb:2,children:[r.jsx(A,{label:xt(e.createTime,!0),children:i}),r.jsx(A,{label:e.localPath,children:r.jsx(W,{color:"GrayText",noOfLines:1,children:e.localPath})}),r.jsxs(Y,{hidden:t,gap:0,children:[r.jsx(dt,{flexGrow:1,onClick:()=>c("How do you want to load this workflow?",[{label:"Load in new workflow",onClick:()=>{l(e.localPath)},colorScheme:"teal"},{label:"Overwrite current workflow",onClick:()=>l(e.localPath,!0),colorScheme:"red"}]),size:"sm",children:"Load"}),r.jsx(A,{label:"Donwload image from gallery",children:r.jsx(Ne,{href:`/workspace/view_media?filename=${e.localPath}`,download:e.localPath,children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(ft,{size:19}),"aria-label":"donwload image from gallery"})})}),r.jsx(A,{label:"Remove image from gallery",children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(pt,{size:19}),"aria-label":"remove image from gallery",colorScheme:"red",onClick:async()=>{var p;confirm("Are you sure to remove this image from gallery? (won't delete image on your disk)")&&await((p=F)==null?void 0:p.delete(e.id))}})})]})]})},Ms=Ns;function _s({searchQuery:e}){const[t,s]=d.useState([]),{setCurMedia:n,setShowAllImages:o,setMediaList:a}=d.useContext(ue);d.useEffect(()=>{var c,i;e===""?(c=F)==null||c.listAll().then(u=>{s(u.slice(0,50)??[])}):(i=F)==null||i.filter(u=>{var p;return((p=u.workflowJSON)==null?void 0:p.includes(e))??!1}).then(u=>{s(u)})},[e]);const l=c=>{a([c].concat(t.filter(i=>i.id!==c.id))),n(c),o(!1)};return r.jsx(Y,{wrap:"wrap",children:t.map(c=>r.jsx(Ms,{selectedID:[],media:c,isSelecting:!1,onClickMedia:l},c.id))})}function Gs({onclose:e}){const{curFlowID:t}=d.useContext(oe),[s,n]=d.useState(""),[o,a]=d.useState([]),[l,c]=d.useState(!1),[i,u]=d.useState([]),[p,f]=d.useState(),[v,g]=d.useState(""),I=wn(v,300),[y,w]=d.useState(!1),E=async()=>{var _;if(t==null)return;const b=await((_=F)==null?void 0:_.listByWorkflowID(t));u(b??[]),b!=null&&b.length&&f(b[0])};if(d.useEffect(()=>{var b;E(),t&&((b=R)==null||b.get(t).then(_=>{_&&n(_.name)}))},[]),t==null)return null;const $=i.length>0&&o.length===i.length;return r.jsx(ue.Provider,{value:{curMedia:p??null,setCurMedia:f,setMediaList:u,showAllImages:y,setShowAllImages:w},children:r.jsxs(Zt,{isOpen:!0,onClose:e,blockScrollOnMount:!0,children:[r.jsx(qt,{}),r.jsxs(Jt,{width:"90%",maxWidth:"90vw",height:"90vh",children:[r.jsxs(Qt,{children:[r.jsxs(Y,{gap:2,mb:2,children:[r.jsxs(an,{size:"md",mr:2,children:["Gallery - ",s]}),r.jsx(Sn,{searchValue:v,onUpdateSearchValue:b=>{g(b),y||w(!0)},placeholder:"Search prompt, model name, etc.",style:{width:"300px"}})]}),l&&r.jsxs(Y,{gap:3,children:[r.jsx(Ae,{isChecked:$,onChange:()=>{a($?[]:i.map(b=>b.id))},children:"All"}),r.jsxs(W,{fontSize:16,children:[o.length," Selected"]}),r.jsx(M,{size:"sm",icon:r.jsx(ln,{size:19}),onClick:()=>c(!1),"aria-label":"cancel"})]})]}),r.jsx(en,{}),r.jsx(tn,{overflowY:"auto",children:y?r.jsx(_s,{searchQuery:I}):r.jsx(Es,{mediaList:i})})]})]})})}export{Gs as default}; diff --git a/dist/workspace_web/IconCopy-DxyTNBlz.js b/dist/workspace_web/IconCopy-DxyTNBlz.js new file mode 100644 index 0000000..fd6d107 --- /dev/null +++ b/dist/workspace_web/IconCopy-DxyTNBlz.js @@ -0,0 +1 @@ +import{d as a}from"./App-1AImvRpr.js";var p=a("copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]);export{p as I}; diff --git a/dist/workspace_web/IconSearch-qxAzDzhT.js b/dist/workspace_web/IconSearch-qxAzDzhT.js new file mode 100644 index 0000000..aa1ff67 --- /dev/null +++ b/dist/workspace_web/IconSearch-qxAzDzhT.js @@ -0,0 +1 @@ +import{d as a}from"./App-1AImvRpr.js";var r=a("search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]);export{r as I}; diff --git a/dist/workspace_web/MediaPreview-muJLkZRm.js b/dist/workspace_web/MediaPreview-muJLkZRm.js new file mode 100644 index 0000000..eeaae23 --- /dev/null +++ b/dist/workspace_web/MediaPreview-muJLkZRm.js @@ -0,0 +1 @@ +import{d as D,r as l,j as v,I as Ee,x as Te,y as je,m as ae,q as _,p as se,b as Pe,f as T,g as Y,k as Be,o as Ke,e as Ve}from"./input.js";import{ad as Ge,ae as We,d as Le,B as qe,I as ze,y as He,j as Xe,ab as $e}from"./App-1AImvRpr.js";import{I as Ye}from"./IconSearch-qxAzDzhT.js";import{I as Je}from"./chunk-7D6N5TE5-fihyubSX.js";function Qe(t){const e=parseFloat(t);return typeof e!="number"||Number.isNaN(e)?0:e}function ie(t,e){let r=Qe(t);const a=10**(e??10);return r=Math.round(r*a)/a,e?r.toFixed(e):r.toString()}function ue(t){if(!Number.isFinite(t))return 0;let e=1,r=0;for(;Math.round(t*e)/e!==t;)e*=10,r+=1;return r}function Ct(t,e,r){return(t-e)*100/(r-e)}function It(t,e,r){return(r-e)*t+e}function St(t,e,r){const a=Math.round((t-e)/r)*r+e,i=ue(r);return ie(a,i)}function Ze(t,e,r){return t==null?t:(r{var g;return a==null?"":(g=oe(a,s,r))!=null?g:""}),x=typeof i<"u",h=x?i:m,I=Me(P(h),s),S=r??I,A=l.useCallback(g=>{g!==h&&(x||w(g.toString()),c==null||c(g.toString(),P(g)))},[c,x,h]),k=l.useCallback(g=>{let b=g;return f&&(b=Ze(b,u,o)),ie(b,S)},[S,f,o,u]),j=l.useCallback((g=s)=>{let b;h===""?b=P(g):b=P(h)+g,b=k(b),A(b)},[k,s,A,h]),B=l.useCallback((g=s)=>{let b;h===""?b=P(-g):b=P(h)-g,b=k(b),A(b)},[k,s,A,h]),K=l.useCallback(()=>{var g;let b;a==null?b="":b=(g=oe(a,s,r))!=null?g:u,A(b)},[a,r,s,A,u]),Q=l.useCallback(g=>{var b;const ee=(b=oe(g,s,S))!=null?b:u;A(ee)},[S,s,A,u]),V=P(h);return{isOutOfRange:V>o||Vv.jsx(Ee,{viewBox:"0 0 24 24",...t,children:v.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),nt=t=>v.jsx(Ee,{viewBox:"0 0 24 24",...t,children:v.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function _e(t,e,r,a){l.useEffect(()=>{var i;if(!t.current||!a)return;const s=(i=t.current.ownerDocument.defaultView)!=null?i:window,u=Array.isArray(e)?e:[e],o=new s.MutationObserver(f=>{for(const c of f)c.type==="attributes"&&c.attributeName&&u.includes(c.attributeName)&&r(c)});return o.observe(t.current,{attributes:!0,attributeFilter:u}),()=>o.disconnect()})}function rt(t,e){const r=D(t);l.useEffect(()=>{let a=null;const i=()=>r();return e!==null&&(a=window.setInterval(i,e)),()=>{a&&window.clearInterval(a)}},[e,r])}var at=50,ke=300;function st(t,e){const[r,a]=l.useState(!1),[i,s]=l.useState(null),[u,o]=l.useState(!0),f=l.useRef(null),c=()=>clearTimeout(f.current);rt(()=>{i==="increment"&&t(),i==="decrement"&&e()},r?at:null);const m=l.useCallback(()=>{u&&t(),f.current=setTimeout(()=>{o(!1),a(!0),s("increment")},ke)},[t,u]),w=l.useCallback(()=>{u&&e(),f.current=setTimeout(()=>{o(!1),a(!0),s("decrement")},ke)},[e,u]),x=l.useCallback(()=>{o(!0),a(!1),c()},[]);return l.useEffect(()=>()=>c(),[]),{up:m,down:w,stop:x,isSpinning:r}}var ot=/^[Ee0-9+\-.]$/;function ut(t){return ot.test(t)}function it(t,e){if(t.key==null)return!0;const r=t.ctrlKey||t.altKey||t.metaKey;return!(t.key.length===1)||r?!0:e(t.key)}function lt(t={}){const{focusInputOnChange:e=!0,clampValueOnBlur:r=!0,keepWithinRange:a=!0,min:i=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:u=1,isReadOnly:o,isDisabled:f,isRequired:c,isInvalid:m,pattern:w="[0-9]*(.[0-9]+)?",inputMode:x="decimal",allowMouseWheel:h,id:I,onChange:S,precision:A,name:k,"aria-describedby":j,"aria-label":B,"aria-labelledby":K,onFocus:Q,onBlur:V,onInvalid:ce,getAriaValueText:fe,isValidCharacter:Z,format:g,parse:b,...ee}=t,te=D(Q),de=D(V),R=D(ce),G=D(Z??ut),ne=D(fe),d=et(t),{update:U,increment:pe,decrement:me}=d,[Fe,re]=l.useState(!1),W=!(o||f),E=l.useRef(null),L=l.useRef(null),be=l.useRef(null),ge=l.useRef(null),q=l.useCallback(n=>n.split("").filter(G).join(""),[G]),z=l.useCallback(n=>{var p;return(p=b==null?void 0:b(n))!=null?p:n},[b]),F=l.useCallback(n=>{var p;return((p=g==null?void 0:g(n))!=null?p:n).toString()},[g]);Te(()=>{(d.valueAsNumber>s||d.valueAsNumber{if(!E.current)return;if(E.current.value!=d.value){const p=z(E.current.value);d.setValue(q(p))}},[z,q]);const H=l.useCallback((n=u)=>{W&&pe(n)},[pe,W,u]),X=l.useCallback((n=u)=>{W&&me(n)},[me,W,u]),N=st(H,X);_e(be,"disabled",N.stop,N.isSpinning),_e(ge,"disabled",N.stop,N.isSpinning);const he=l.useCallback(n=>{if(n.nativeEvent.isComposing)return;const y=z(n.currentTarget.value);U(q(y)),L.current={start:n.currentTarget.selectionStart,end:n.currentTarget.selectionEnd}},[U,q,z]),ve=l.useCallback(n=>{var p,y,C;te==null||te(n),L.current&&(n.target.selectionStart=(y=L.current.start)!=null?y:(p=n.currentTarget.value)==null?void 0:p.length,n.currentTarget.selectionEnd=(C=L.current.end)!=null?C:n.currentTarget.selectionStart)},[te]),ye=l.useCallback(n=>{if(n.nativeEvent.isComposing)return;it(n,G)||n.preventDefault();const p=we(n)*u,y=n.key,M={ArrowUp:()=>H(p),ArrowDown:()=>X(p),Home:()=>U(i),End:()=>U(s)}[y];M&&(n.preventDefault(),M(n))},[G,u,H,X,U,i,s]),we=n=>{let p=1;return(n.metaKey||n.ctrlKey)&&(p=.1),n.shiftKey&&(p=10),p},xe=l.useMemo(()=>{const n=ne==null?void 0:ne(d.value);if(n!=null)return n;const p=d.value.toString();return p||void 0},[d.value,ne]),Ne=l.useCallback(()=>{let n=d.value;if(d.value==="")return;/^[eE]/.test(d.value.toString())?d.setValue(""):(d.valueAsNumbers&&(n=s),d.cast(n))},[d,s,i]),Ce=l.useCallback(()=>{re(!1),r&&Ne()},[r,re,Ne]),$=l.useCallback(()=>{e&&requestAnimationFrame(()=>{var n;(n=E.current)==null||n.focus()})},[e]),Ie=l.useCallback(n=>{n.preventDefault(),N.up(),$()},[$,N]),Se=l.useCallback(n=>{n.preventDefault(),N.down(),$()},[$,N]);Ge(()=>E.current,"wheel",n=>{var p,y;const M=((y=(p=E.current)==null?void 0:p.ownerDocument)!=null?y:document).activeElement===E.current;if(!h||!M)return;n.preventDefault();const O=we(n)*u,Ae=Math.sign(n.deltaY);Ae===-1?H(O):Ae===1&&X(O)},{passive:!1});const Re=l.useCallback((n={},p=null)=>{const y=f||a&&d.isAtMax;return{...n,ref:ae(p,be),role:"button",tabIndex:-1,onPointerDown:_(n.onPointerDown,C=>{C.button!==0||y||Ie(C)}),onPointerLeave:_(n.onPointerLeave,N.stop),onPointerUp:_(n.onPointerUp,N.stop),disabled:y,"aria-disabled":se(y)}},[d.isAtMax,a,Ie,N.stop,f]),Ue=l.useCallback((n={},p=null)=>{const y=f||a&&d.isAtMin;return{...n,ref:ae(p,ge),role:"button",tabIndex:-1,onPointerDown:_(n.onPointerDown,C=>{C.button!==0||y||Se(C)}),onPointerLeave:_(n.onPointerLeave,N.stop),onPointerUp:_(n.onPointerUp,N.stop),disabled:y,"aria-disabled":se(y)}},[d.isAtMin,a,Se,N.stop,f]),Oe=l.useCallback((n={},p=null)=>{var y,C,M,O;return{name:k,inputMode:x,type:"text",pattern:w,"aria-labelledby":K,"aria-label":B,"aria-describedby":j,id:I,disabled:f,...n,readOnly:(y=n.readOnly)!=null?y:o,"aria-readonly":(C=n.readOnly)!=null?C:o,"aria-required":(M=n.required)!=null?M:c,required:(O=n.required)!=null?O:c,ref:ae(E,p),value:F(d.value),role:"spinbutton","aria-valuemin":i,"aria-valuemax":s,"aria-valuenow":Number.isNaN(d.valueAsNumber)?void 0:d.valueAsNumber,"aria-invalid":se(m??d.isOutOfRange),"aria-valuetext":xe,autoComplete:"off",autoCorrect:"off",onChange:_(n.onChange,he),onKeyDown:_(n.onKeyDown,ye),onFocus:_(n.onFocus,ve,()=>re(!0)),onBlur:_(n.onBlur,de,Ce)}},[k,x,w,K,B,F,j,I,f,c,o,m,d.value,d.valueAsNumber,d.isOutOfRange,i,s,xe,he,ye,ve,de,Ce]);return{value:F(d.value),valueAsNumber:d.valueAsNumber,isFocused:Fe,isDisabled:f,isReadOnly:o,getIncrementButtonProps:Re,getDecrementButtonProps:Ue,getInputProps:Oe,htmlProps:ee}}var[ct,J]=Pe({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[ft,le]=Pe({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),dt=T(function(e,r){const a=Be("NumberInput",e),i=Ke(e),s=We(i),{htmlProps:u,...o}=lt(s),f=l.useMemo(()=>o,[o]);return v.jsx(ft,{value:f,children:v.jsx(ct,{value:a,children:v.jsx(Y.div,{...u,ref:r,className:Ve("chakra-numberinput",e.className),__css:{position:"relative",zIndex:0,...a.root}})})})});dt.displayName="NumberInput";var pt=T(function(e,r){const a=J();return v.jsx(Y.div,{"aria-hidden":!0,ref:r,...e,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...a.stepperGroup}})});pt.displayName="NumberInputStepper";var mt=T(function(e,r){const{getInputProps:a}=le(),i=a(e,r),s=J();return v.jsx(Y.input,{...i,className:Ve("chakra-numberinput__field",e.className),__css:{width:"100%",...s.field}})});mt.displayName="NumberInputField";var De=Y("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),bt=T(function(e,r){var a;const i=J(),{getDecrementButtonProps:s}=le(),u=s(e,r);return v.jsx(De,{...u,__css:i.stepper,children:(a=e.children)!=null?a:v.jsx(tt,{})})});bt.displayName="NumberDecrementStepper";var gt=T(function(e,r){var a;const{getIncrementButtonProps:i}=le(),s=i(e,r),u=J();return v.jsx(De,{...s,__css:u.stepper,children:(a=e.children)!=null?a:v.jsx(nt,{})})});gt.displayName="NumberIncrementStepper";var At=Le("chevron-right","IconChevronRight",[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]]);const _t=(t,e)=>{const[r,a]=l.useState(t);return l.useEffect(()=>{const i=setTimeout(()=>{a(t)},e);return()=>{clearTimeout(i)}},[t,e]),r},ht={position:"absolute",marginLeft:"10px",width:"20px",height:"20px",top:"50%",color:"#A0AEC0",transform:"translateY(-50%)"};function kt(t){const{searchValue:e,onUpdateSearchValue:r,style:a}=t,i=e!=="";return v.jsxs(qe,{style:{position:"relative",...a},mb:2,children:[v.jsx(Ye,{style:ht}),i&&v.jsx(ze,{size:"xs",position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",cursor:"pointer",background:"none",zIndex:"100",icon:v.jsx(He,{width:15,height:15}),onClick:()=>r(""),"aria-label":"clear input button"}),v.jsx(Xe,{placeholder:t.placeholder??"Search",size:"sm",paddingLeft:"35px",paddingBlock:"5px",value:e,onChange:({target:s})=>r(s.value)})]})}function Et(t){return new Promise((e,r)=>{const a=new FileReader;a.onload=i=>{const s=new Uint8Array(i.target.result),u=new DataView(s.buffer);u.getUint32(0)!==2303741511&&(console.error("Not a valid PNG file"),r());let o=8;const f={};for(;oString.fromCharCode(S)).join("");f[x]=I}o+=12+c}e(f)},a.readAsArrayBuffer(t)})}function vt(t){const e=new Uint16Array(t.slice(0,2))[0]===18761;function r(u,o,f){const c=t.slice(u,u+f);if(f===2)return new DataView(c.buffer,c.byteOffset,c.byteLength).getUint16(0,o);if(f===4)return new DataView(c.buffer,c.byteOffset,c.byteLength).getUint32(0,o)}const a=r(4,e,4);function i(u){const o=r(u,e,2),f={};for(let c=0;c{const r=new FileReader;r.onload=a=>{var f;const i=new Uint8Array((f=a==null?void 0:a.target)==null?void 0:f.result),s=new DataView(i.buffer);if(s.getUint32(0)!==1380533830||s.getUint32(8)!==1464156752){console.error("Not a valid WEBP file"),e();return}let u=12;const o={};for(;u{const r=new FileReader;r.onload=a=>{const i=new Uint8Array(a.target.result),s=new DataView(i.buffer),u=new TextDecoder;if(s.getUint32(0)==440786851){let o=12;for(;o>8*(4-m)&~(1<<7*m),x=u.decode(i.slice(o+2+m,o+2+m+w)),h=JSON.parse(x);e(h);return}}o+=1}}else if(s.getUint32(4)==1718909296&&s.getUint32(8)==1769172845){let o=i.length-4;for(;o>16;){if(s.getUint32(o)==1684108385&&s.getUint32(o-8)==2841865588){s.getUint32(o+4),s.getUint32(o+8);const f=s.getUint32(o-4)-4*4,c=u.decode(i.slice(o+12,o+12+f)),m=JSON.parse(c);e(m);return}o-=1}}else{console.error("Unknown magic: "+s.getUint32(0)),e();return}},r.readAsArrayBuffer(t)})}function Dt({mediaLocalPath:t,size:e,isPreview:r,autoPlay:a,hideBrokenImage:i,objectFit:s,onBrokenLink:u}){const[o,f]=l.useState(!0);return l.useEffect(()=>{i&&(async()=>{try{if((await fetch(r?`/workspace/preview_media?filename=${t}`:`/workspace/view_media?filename=${t}`)).status==404){f(!1),u==null||u();return}}catch(m){console.error("Error checking media exists",m)}})()},[]),o?$e(t)?v.jsx(Je,{borderRadius:3,boxSize:`${e}px`,objectFit:s??"cover",src:`/workspace/view_media?filename=${t}`,alt:"workflow image renamed or moved from output folder"}):v.jsx("div",{style:{width:e+"px",height:e+"px",overflow:"hidden",position:"relative"},children:v.jsx("video",{width:e,height:e,src:`/workspace/view_media?filename=${t}`,loop:!0,autoPlay:a??!1,muted:!0,style:{objectFit:"cover",width:"100%",height:"100%"},children:v.jsx("track",{kind:"captions"})})}):null}export{At as I,Dt as M,dt as N,kt as S,mt as a,Mt as b,Ze as c,Pt as d,pt as e,gt as f,Et as g,bt as h,Vt as i,It as p,St as r,_t as u,Ct as v}; diff --git a/dist/workspace_web/ModelManagerTopbar-4hMR9SRa.js b/dist/workspace_web/ModelManagerTopbar-4hMR9SRa.js new file mode 100644 index 0000000..6ea0e97 --- /dev/null +++ b/dist/workspace_web/ModelManagerTopbar-4hMR9SRa.js @@ -0,0 +1 @@ +import{f as H,r as m,j as n,g as z,e as re,$ as J,b as qe,o as Ye,k as Qe,h as A,a0 as ae,P as Je,a1 as Xe,N as Le,a2 as Ze,Q as Ie,S as Ee,T as et,Z as tt,M as st,O as nt,R as ot}from"./input.js";import{aj as it,m as rt,ak as at,al as lt,am as $,B as oe,F as R,h as N,i as ie,X as Ae,an as ct,k as V,a3 as G,a4 as Te,a5 as dt,ac as Ne,j as X,H as W,ao as De,ap as xe,g as q,w as ht,aq as Fe,f as Pe,ar as ye,as as ut,at as Oe,au as ft,av as mt,aw as pt,ax as gt,ay as xt,az as ee,aA as yt,aB as wt}from"./App-1AImvRpr.js";import{f as le,s as vt,g as jt}from"./civitUtils-uJNBxoFV.js";import{I as ze}from"./chunk-7D6N5TE5-fihyubSX.js";import{G as Mt,C as _t}from"./chunk-JARCRF6W-UyOcndjS.js";import{api as ce}from"/scripts/api.js";import{S as Z}from"./chunk-3RSXBRAN-gZ_JDRlM.js";var Be=H(function(e,s){const{spacing:o="0.5rem",spacingX:i,spacingY:r,children:a,justify:c,direction:l,align:d,className:h,shouldWrapChildren:f,...u}=e,g=m.useMemo(()=>f?m.Children.map(a,(p,x)=>n.jsx(de,{children:p},x)):a,[a,f]);return n.jsx(z.div,{ref:s,className:re("chakra-wrap",h),...u,children:n.jsx(z.ul,{className:"chakra-wrap__list",__css:{display:"flex",flexWrap:"wrap",justifyContent:c,alignItems:d,flexDirection:l,listStyleType:"none",gap:o,columnGap:i,rowGap:r,padding:"0"},children:g})})});Be.displayName="Wrap";var de=H(function(e,s){const{className:o,...i}=e;return n.jsx(z.li,{ref:s,__css:{display:"flex",alignItems:"flex-start"},className:re("chakra-wrap__listitem",o),...i})});de.displayName="WrapItem";function we(t){return rt(t,e=>e==="auto"?"auto":`span ${e}/span ${e}`)}var Re=H(function(e,s){const{area:o,colSpan:i,colStart:r,colEnd:a,rowEnd:c,rowSpan:l,rowStart:d,...h}=e,f=it({gridArea:o,gridColumn:we(i),gridRow:we(l),gridColumnStart:r,gridColumnEnd:a,gridRowStart:d,gridRowEnd:c});return n.jsx(z.div,{ref:s,__css:f,...h})});Re.displayName="GridItem";var te=(t,e)=>e?`${t}.${e}, ${e}`:void 0;function We(t){var e;const{bg:s,bgColor:o,backgroundColor:i,shadow:r,boxShadow:a,shadowColor:c}=t,{getArrowProps:l,getArrowInnerProps:d}=at(),h=lt(),f=(e=s??o)!=null?e:i,u=r??a;return n.jsx(z.div,{...l(),className:"chakra-popover__arrow-positioner",children:n.jsx(z.div,{className:re("chakra-popover__arrow",t.className),...d(t),__css:{"--popper-arrow-shadow-color":te("colors",c),"--popper-arrow-bg":te("colors",f),"--popper-arrow-shadow":te("shadows",u),...h.arrow}})})}We.displayName="PopoverArrow";function St(t,e,s){return(t-e)*100/(s-e)}J({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});J({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var Ct=J({"0%":{left:"-40%"},"100%":{left:"100%"}}),bt=J({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function kt(t){const{value:e=0,min:s,max:o,valueText:i,getValueText:r,isIndeterminate:a,role:c="progressbar"}=t,l=St(e,s,o);return{bind:{"data-indeterminate":a?"":void 0,"aria-valuemax":o,"aria-valuemin":s,"aria-valuenow":a?void 0:e,"aria-valuetext":(()=>{if(e!=null)return typeof r=="function"?r(e,l):i})(),role:c},percent:l,value:e}}var[Lt,It]=qe({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Et=H((t,e)=>{const{min:s,max:o,value:i,isIndeterminate:r,role:a,...c}=t,l=kt({value:i,min:s,max:o,isIndeterminate:r,role:a}),h={height:"100%",...It().filledTrack};return n.jsx(z.div,{ref:e,style:{width:`${l.percent}%`,...c.style},...l.bind,...c,__css:h})}),$e=H((t,e)=>{var s;const{value:o,min:i=0,max:r=100,hasStripe:a,isAnimated:c,children:l,borderRadius:d,isIndeterminate:h,"aria-label":f,"aria-labelledby":u,"aria-valuetext":g,title:p,role:x,...j}=Ye(t),M=Qe("Progress",t),b=d??((s=M.track)==null?void 0:s.borderRadius),k={animation:`${bt} 1s linear infinite`},D={...!h&&a&&c&&k,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${Ct} 1s ease infinite normal none running`}},C={overflow:"hidden",position:"relative",...M.track};return n.jsx(z.div,{ref:e,borderRadius:b,__css:C,...j,children:n.jsxs(Lt,{value:M,children:[n.jsx(Et,{"aria-label":f,"aria-labelledby":u,"aria-valuetext":g,min:i,max:r,value:o,isIndeterminate:h,css:D,borderRadius:b,title:p,role:x}),l]})})});$e.displayName="Progress";function K(t){return Array.isArray?Array.isArray(t):Ue(t)==="[object Array]"}const At=1/0;function Tt(t){return t==null?"":function(e){if(typeof e=="string")return e;let s=e+"";return s=="0"&&1/e==-At?"-0":s}(t)}function F(t){return typeof t=="string"}function Ke(t){return typeof t=="number"}function Nt(t){return t===!0||t===!1||function(e){return function(s){return typeof s=="object"}(e)&&e!==null}(t)&&Ue(t)=="[object Boolean]"}function T(t){return t!=null}function se(t){return!t.trim().length}function Ue(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Dt=t=>`Missing ${t} property in key`,Ft=t=>`Property 'weight' in key '${t}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class Pt{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(o=>{let i=Ge(o);this._keys.push(i),this._keyMap[i.id]=i,s+=i.weight}),this._keys.forEach(o=>{o.weight/=s})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Ge(t){let e=null,s=null,o=null,i=1,r=null;if(F(t)||K(t))o=t,e=je(t),s=Me(t);else{if(!ve.call(t,"name"))throw new Error(Dt("name"));const a=t.name;if(o=a,ve.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(Ft(a));e=je(a),s=Me(a),r=t.getFn}return{path:e,id:s,weight:i,src:o,getFn:r}}function je(t){return K(t)?t:t.split(".")}function Me(t){return K(t)?t.join("."):t}var v={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx{if(T(r))if(a[c]){const l=r[a[c]];if(!T(l))return;if(c===a.length-1&&(F(l)||Ke(l)||Nt(l)))s.push(Tt(l));else if(K(l)){o=!0;for(let d=0,h=l.length;d{this._keysMap[s.id]=o})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,F(this.docs[0])?this.docs.forEach((e,s)=>{this._addString(e,s)}):this.docs.forEach((e,s)=>{this._addObject(e,s)}),this.norm.clear())}add(e){const s=this.size();F(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let s=e,o=this.size();s{let a=i.getFn?i.getFn(e):this.getFn(e,i.path);if(T(a)){if(K(a)){let c=[];const l=[{nestedArrIndex:-1,value:a}];for(;l.length;){const{nestedArrIndex:d,value:h}=l.pop();if(T(h))if(F(h)&&!se(h)){let f={v:h,i:d,n:this.norm.get(h)};c.push(f)}else K(h)&&h.forEach((f,u)=>{l.push({nestedArrIndex:u,value:f})})}o.$[r]=c}else if(F(a)&&!se(a)){let c={v:a,n:this.norm.get(a)};o.$[r]=c}}}),this.records.push(o)}toJSON(){return{keys:this.keys,records:this.records}}}function Ve(t,e,{getFn:s=v.getFn,fieldNormWeight:o=v.fieldNormWeight}={}){const i=new he({getFn:s,fieldNormWeight:o});return i.setKeys(t.map(Ge)),i.setSources(e),i.create(),i}function Q(t,{errors:e=0,currentLocation:s=0,expectedLocation:o=0,distance:i=v.distance,ignoreLocation:r=v.ignoreLocation}={}){const a=e/t.length;if(r)return a;const c=Math.abs(o-s);return i?a+c/i:c?1:a}const B=32;function zt(t,e,s,{location:o=v.location,distance:i=v.distance,threshold:r=v.threshold,findAllMatches:a=v.findAllMatches,minMatchCharLength:c=v.minMatchCharLength,includeMatches:l=v.includeMatches,ignoreLocation:d=v.ignoreLocation}={}){if(e.length>B)throw new Error(`Pattern length exceeds max of ${B}.`);const h=e.length,f=t.length,u=Math.max(0,Math.min(o,f));let g=r,p=u;const x=c>1||l,j=x?Array(f):[];let M;for(;(M=t.indexOf(e,p))>-1;){let C=Q(e,{currentLocation:M,expectedLocation:u,distance:i,ignoreLocation:d});if(g=Math.min(C,g),p=M+h,x){let L=0;for(;L=O;w-=1){let _=w-1,S=s[t.charAt(_)];if(x&&(j[_]=+!!S),y[w]=(y[w+1]<<1|1)&S,C&&(y[w]|=(b[w+1]|b[w])<<1|1|b[w+1]),y[w]&Y&&(k=Q(e,{errors:C,currentLocation:_,expectedLocation:u,distance:i,ignoreLocation:d}),k<=g)){if(g=k,p=_,p<=u)break;O=Math.max(1,2*u-p)}}if(Q(e,{errors:C+1,currentLocation:u,expectedLocation:u,distance:i,ignoreLocation:d})>g)break;b=y}const D={isMatch:p>=0,score:Math.max(.001,k)};if(x){const C=function(L=[],I=v.minMatchCharLength){let O=[],E=-1,y=-1,w=0;for(let _=L.length;w<_;w+=1){let S=L[w];S&&E===-1?E=w:S||E===-1||(y=w-1,y-E+1>=I&&O.push([E,y]),E=-1)}return L[w-1]&&w-E>=I&&O.push([E,w-1]),O}(j,c);C.length?l&&(D.indices=C):D.isMatch=!1}return D}function Bt(t){let e={};for(let s=0,o=t.length;s{this.chunks.push({pattern:u,alphabet:Bt(u),startIndex:g})},f=this.pattern.length;if(f>B){let u=0;const g=f%B,p=f-g;for(;u{const{isMatch:M,score:b,indices:k}=zt(e,p,x,{location:i+j,distance:r,threshold:a,findAllMatches:c,minMatchCharLength:l,includeMatches:o,ignoreLocation:d});M&&(u=!0),f+=b,M&&k&&(h=[...h,...k])});let g={isMatch:u,score:u?f/this.chunks.length:1};return u&&o&&(g.indices=h),g}}const _e=[];function Se(t,e){for(let s=0,o=_e.length;s{if(!T(o.indices)||!o.indices.length)return;const{indices:i,value:r}=o;let a={indices:i,value:r};o.key&&(a.key=o.key.src),o.idx>-1&&(a.refIndex=o.idx),e.matches.push(a)})}function $t(t,e){e.score=t.score}class U{constructor(e,s={},o){if(this.options={...v,...s},this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new Pt(this.options.keys),this.setCollection(e,o)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof he))throw new Error("Incorrect 'index' type");this._myIndex=s||Ve(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){T(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const s=[];for(let o=0,i=this._docs.length;o{let u=1;f.matches.forEach(({key:g,norm:p,score:x})=>{const j=g?g.weight:null;u*=Math.pow(x===0&&j?Number.EPSILON:x,(j||1)*(h?1:p))}),f.score=u})}(l,{ignoreFieldNorm:c}),r&&l.sort(a),Ke(s)&&s>-1&&(l=l.slice(0,s)),function(d,h,{includeMatches:f=v.includeMatches,includeScore:u=v.includeScore}={}){const g=[];return f&&g.push(Wt),u&&g.push($t),d.map(p=>{const{idx:x}=p,j={item:h[x],refIndex:x};return g.length&&g.forEach(M=>{M(p,j)}),j})}(l,this._docs,{includeMatches:o,includeScore:i})}_searchStringList(e){const s=Se(e,this.options),{records:o}=this._myIndex,i=[];return o.forEach(({v:r,i:a,n:c})=>{if(!T(r))return;const{isMatch:l,score:d,indices:h}=s.searchIn(r);l&&i.push({item:r,idx:a,matches:[{score:d,value:r,norm:c,indices:h}]})}),i}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e){const s=Se(e,this.options),{keys:o,records:i}=this._myIndex,r=[];return i.forEach(({$:a,i:c})=>{if(!T(a))return;let l=[];o.forEach((d,h)=>{l.push(...this._findMatches({key:d,value:a[h],searcher:s}))}),l.length&&r.push({idx:c,item:a,matches:l})}),r}_findMatches({key:e,value:s,searcher:o}){if(!T(s))return[];let i=[];if(K(s))s.forEach(({v:r,i:a,n:c})=>{if(!T(r))return;const{isMatch:l,score:d,indices:h}=o.searchIn(r);l&&i.push({score:d,key:e,value:r,idx:a,norm:c,indices:h})});else{const{v:r,n:a}=s,{isMatch:c,score:l,indices:d}=o.searchIn(r);c&&i.push({score:l,key:e,value:r,norm:a,indices:d})}return i}}U.version="7.0.0",U.createIndex=Ve,U.parseIndex=function(t,{getFn:e=v.getFn,fieldNormWeight:s=v.fieldNormWeight}={}){const{keys:o,records:i}=t,r=new he({getFn:e,fieldNormWeight:s});return r.setKeys(o),r.setIndexRecords(i),r},U.config=v;function Kt({selectedModel:t,setSelectedModel:e,modelTypeList:s}){const o=i=>{e(i)};return n.jsx(Be,{children:s.map(i=>n.jsx(de,{children:n.jsx(A,{colorScheme:"blue",variant:t===i?"solid":"outline",onClick:()=>o(i),size:"sm",children:i})},i))})}const Ut={checkpoints:"CheckpointLoaderSimple",vae:"VAELoader",loras:"LoraLoader",controlnet:"ControlNetLoader",upscale_models:"UpscaleModelLoader"};function Gt({data:t}){const[e,s]=m.useState("https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/27fd7433-cb0a-4a87-88c1-21ccb2b1a842/width=450/00060-881622046.jpeg"),[o,i]=m.useState(!t.file_hash),[r,a]=m.useState();m.useEffect(()=>{i(!t.file_hash),c()},[t.file_hash]);const c=async()=>{var h;const d=await $.models.get(t.model_name+"@"+t.model_type);if(d!=null&&(a(d),(h=d.imageUrl)!=null&&h.length&&s(d.imageUrl)),!(d!=null&&d.imageUrl)&&t.file_hash!=null)try{const f=await le(t.file_hash),u=f.imageUrl;u&&s(u);const g={id:t.model_name+"@"+t.model_type,fileHash:t.file_hash,fileFolder:t.model_type,fileName:t.model_name+t.model_extension,modelName:f.modelName??null,civitModelID:f.civitModelID,civitModelVersionID:f.civitModelVersionID,imageUrl:u??null};a(g)}catch{}t.preview&&s(t.preview)},l=d=>{const h=Ut[t.model_type];h&&(d.dataTransfer.setData("eventName","WorkspaceManagerAddNode"),d.dataTransfer.setData("modelRelativePath",t.model_name+t.model_extension),d.dataTransfer.setData("nodeType",h))};return n.jsxs(oe,{children:[n.jsxs(oe,{position:"relative",borderRadius:4,draggable:!0,onDragStart:l,children:[o?n.jsx(R,{bg:"rgba(0, 0, 0, 0.5)",height:178,justifyContent:"center",alignItems:"center",children:n.jsx(ae,{})}):n.jsx(ze,{src:e,draggable:!1,boxSize:"100%",height:150,objectFit:"cover",borderRadius:4,cursor:(r==null?void 0:r.civitModelID)!=null?"pointer":"auto",onClick:()=>{(r==null?void 0:r.civitModelID)==null||(r==null?void 0:r.civitModelVersionID)==null||window.open(`https://civitai.com/models/${r==null?void 0:r.civitModelID}?modelVersionId=${r==null?void 0:r.civitModelVersionID}`)}}),n.jsx(N,{position:"absolute",bottom:"0",left:"0",right:"0",color:"white",fontSize:14})]}),n.jsx(ie,{label:n.jsxs("span",{children:[t.model_name+t.model_extension,n.jsx("br",{}),t.date.toLocaleDateString()]}),children:n.jsx(N,{textAlign:"center",p:"1",fontSize:14,noOfLines:2,children:t.model_name+t.model_extension})})]})}function Vt({list:t}){return n.jsx(Mt,{templateColumns:"repeat(3, minmax(0, 1fr))",gap:1,marginTop:2,children:t.map(e=>n.jsx(Re,{children:n.jsx(Gt,{data:e})},e.model_name+e.date.getTime()))})}function Ht(){const{setRoute:t}=m.useContext(Ae);return n.jsx(n.Fragment,{children:n.jsx(A,{size:"sm",colorScheme:"teal",onClick:()=>t("installModels"),children:"Install Models"})})}const qt=()=>{const[t,e]=m.useState(["checkpoints"]),[s,o]=m.useState([]),[i,r]=m.useState(!0);m.useEffect(()=>{a(),ce.addEventListener("model_list",async l=>{c(l.detail)})},[]);const a=async()=>{const l=await ct();c(l)},c=async l=>{if(!l)return;r(!1);const d=Array.from(new Set(l.map(f=>f.model_type))),h=d.indexOf("checkpoints");h>=0&&d.splice(h,1),d.unshift("checkpoints"),e(d),o(l.map(f=>({...f,date:new Date(f.date*1e3)})))};return{modelTypeList:t,modelsList:s,loading:i}};function Yt(){const[t,e]=m.useState(!1),s=()=>{var a;(a=V)==null||a.getSetting("showNsfwModelThumbnail").then(c=>{e(c??!1)})};m.useEffect(()=>{s()},[]);const o=a=>{var l;const c=a.target.checked;(l=V)==null||l.upsert({showNsfwModelThumbnail:c}).then(()=>{s(),i(),window.dispatchEvent(new Event("showNsfwModelThumbnail"))})},i=async()=>{const a=await $.models.toArray();for(let c=0;c{try{if(a.fileHash==null)return;const l=(await le(a.fileHash)).imageUrl;$.models.update(a.id,{imageUrl:l??null})}catch{}};return n.jsx(_t,{isChecked:t,onChange:o,children:"Show NSFW"})}function Qt(){const t=async e=>{if(e.dataTransfer.getData("eventName")!=="WorkspaceManagerAddNode")return;const o=e.dataTransfer.getData("modelRelativePath"),i=e.dataTransfer.getData("nodeType"),r=LiteGraph.createNode(i);r.pos=[e.canvasX,e.canvasY],r.configure({widgets_values:[o]}),G.graph.add(r)};return m.useEffect(()=>(G.canvasEl.addEventListener("drop",t),()=>{G.canvasEl.removeEventListener("drop",t)}),[]),null}function Jt({onClose:t}){const[e,s]=m.useState("checkpoints"),[o,i]=m.useState(""),[r,a]=m.useState("name"),{loading:c,modelTypeList:l,modelsList:d}=qt(),[h,f]=m.useState([]),[u,g]=m.useState([]);m.useEffect(()=>{x();async function x(){const j=await $.models.toArray();f(d.map(M=>({...M,db:j.find(b=>b.id===M.model_name+"@"+M.model_type)})))}},[d]),m.useEffect(()=>{let x=[];o.length?x=new U(h,{keys:["model_name","db.modelName"]}).search(o).map(b=>b.item):x=d.filter(j=>j.model_type===e).sort((j,M)=>r==="name"?j.model_name.localeCompare(M.model_name):M.date.getTime()-j.date.getTime()),g(x)},[e,d,o,r,h]),m.useEffect(()=>(G.canvasEl.addEventListener("click",t),()=>{G.canvasEl.removeEventListener("click",t)}),[t]);const p=440;return n.jsx(Je,{children:n.jsxs(oe,{style:{width:p},children:[n.jsxs(Te,{width:p,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:dt,overflowY:"auto",children:[n.jsxs(R,{justifyContent:"space-between",alignContent:"center",py:3,children:[n.jsx(Ne,{size:"md",mr:2,children:"Models"}),n.jsx(Ht,{})]}),n.jsx(R,{gap:4,justifyContent:"center",alignItems:"center",mb:1,children:n.jsx(X,{size:"sm",placeholder:"Search",value:o,onChange:x=>i(x.target.value)})}),n.jsxs(R,{gap:4,justifyContent:"space-between",alignItems:"center",mb:1,children:[!o.length&&n.jsxs(W,{children:[n.jsx("span",{children:"Sort By"}),n.jsxs(Z,{value:r,size:"sm",width:"120px",onChange:x=>a(x.target.value),children:[n.jsx("option",{value:"name",children:"Name"}),n.jsx("option",{value:"date",children:"Date"})]})]}),n.jsx(Yt,{})]}),!o.length&&n.jsx(Kt,{modelTypeList:l,setSelectedModel:s,selectedModel:e}),n.jsx(Vt,{list:u}),c&&n.jsx(R,{justifyContent:"center",alignItems:"center",height:"100%",children:n.jsx(ae,{})})]}),n.jsx(Qt,{})]})})}const Xt=async t=>{try{const s=await(await ce.fetchApi("/model_manager/install_model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).text();window.dispatchEvent(new CustomEvent("model_install_message",{detail:s}))}catch(e){console.error("Failed to connect to the server:",e)}};function Ce(t,e=1){const i=t/1024;return i>=1024?(i/1024).toFixed(e)+" GB":i.toFixed(e)+" MB"}function be(t,e){if(!t||t.length===0)return;let s=t.find(o=>o.nsfw==="None"||o.nsfwLevel===1);return e&&(s=s??t[0]),s}function Zt(t,e=280,s){var o,i,r,a;if(t){if(t.images)return`https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/${(o=be(t.images,s))==null?void 0:o.url}/width=${e}/`;if(De(t))return(a=be((r=(i=t.modelVersions)==null?void 0:i.at(0))==null?void 0:r.images,s))==null?void 0:a.url}}const ne=280;function es({model:t,onClickInstallModel:e,installing:s}){var u,g;const[o,i]=m.useState();m.useEffect(()=>{p();async function p(){var j;const x=await((j=V)==null?void 0:j.getSetting("showNsfwModelThumbnail"));i(Zt(t,ne,x))}},[t]);const r=De(t)?t.modelVersions:t.versions,[a,c]=m.useState(((u=r==null?void 0:r[0])==null?void 0:u.name)??""),l=r==null?void 0:r.find(p=>(p==null?void 0:p.name)===a),d=()=>{window.open(`https://civitai.com/models/${t.id}`)},h=m.useCallback(()=>{if(l==null){console.error("no file is find by name",a);return}e(xe(l,t.name),t)},[a]),f=(g=xe(l))==null?void 0:g.sizeKB;return n.jsxs(Te,{width:ne,justifyContent:"space-between",mb:2,gap:1,children:[n.jsx(ze,{borderRadius:3,boxSize:ne+"px",objectFit:"cover",src:o,alt:"model cover image",cursor:"pointer",onClick:()=>d()}),n.jsxs(q,{p:1,children:[n.jsx(ie,{label:t.name,children:n.jsx(N,{fontWeight:500,noOfLines:1,children:t.name})}),n.jsxs(R,{justifyContent:"space-between",alignItems:"center",children:[n.jsx(A,{borderRadius:14,noOfLines:1,size:"xs",colorScheme:"teal",maxWidth:"40%",flexShrink:1,variant:"outline",px:1,cursor:"text",children:n.jsx(N,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:t.type})}),n.jsx(A,{leftIcon:n.jsx(ht,{size:18}),iconSpacing:1,borderRadius:10,size:"sm",py:1,colorScheme:"teal",type:"submit",onClick:()=>h(),isDisabled:!!(a&&s.includes(a)),children:"Install"})]}),n.jsxs(W,{children:[n.jsx(Z,{size:"md",style:{paddingLeft:4},onChange:p=>{c(p.target.value)},children:r==null?void 0:r.map(p=>{const x=p==null?void 0:p.name;return x?n.jsx("option",{value:x,style:{padding:0},children:x},p.id):null})}),f&&n.jsx(ie,{label:Ce(f),children:n.jsx(N,{flexShrink:1,noOfLines:1,width:"40%",children:Ce(f)})})]})]})]})}function ts({searchQuery:t,setSearchQuery:e,onSearch:s}){return n.jsxs(R,{gap:1,alignItems:"center",grow:1,children:[n.jsx(X,{placeholder:"Search models in CivitAI",width:"60%",value:t,onChange:o=>e(o.target.value),onKeyUp:o=>{o.code==="Enter"&&s()}}),n.jsx(A,{size:"sm",onClick:()=>s(),colorScheme:"teal",children:"Search"})]})}function ss({isOpen:t,fileSelected:e,onClose:s,selectFolder:o}){const[i,r]=m.useState(""),[a,c]=m.useState([]),[l,d]=m.useState(""),h=m.useRef(null);m.useEffect(()=>{f()},[]);const f=async()=>{const u=await Fe();u&&(["custom_nodes","config","saved_prompts"].forEach(g=>{delete u[g]}),c(Object.values(u).flatMap(g=>g)))};return n.jsx(Xe,{isOpen:t,leastDestructiveRef:h,onClose:s,children:n.jsx(Le,{children:n.jsxs(Ze,{children:[n.jsx(Ie,{fontSize:"lg",fontWeight:"bold",children:"Choose Folder"}),n.jsx(Ee,{children:n.jsxs(q,{spacing:4,children:[!e&&n.jsxs(n.Fragment,{children:[n.jsx(N,{children:"Model download url"}),n.jsx(X,{placeholder:"https://civitai.com/api/download/models/311399",onChange:u=>d(u.target.value),value:l})]}),n.jsx(N,{children:"Choose model install folder"}),n.jsx(Z,{placeholder:"Select option",value:i,onChange:u=>r(u.target.value),children:a.map(u=>n.jsx("option",{value:u,children:u},u))})]})}),n.jsxs(et,{children:[n.jsx(A,{ref:h,onClick:s,children:"Cancel"}),n.jsx(A,{onClick:()=>o(i,l),ml:3,isDisabled:l.length===0,children:"Confirm"})]})]})})})}function ns(){const{colorMode:t}=tt(),e=Pe(),[s,o]=m.useState([]);return m.useEffect(()=>{ye.addEventListener("download_progress",i=>{o(i.detail)}),ye.addEventListener("download_error",i=>{e({title:"Download Error",description:i.detail,status:"error",duration:4e3,isClosable:!0})})},[]),n.jsx(q,{spacing:5,pos:"absolute",bottom:"0",left:"0",width:"50%",zIndex:80,backgroundColor:t==="light"?"white":"#242424",paddingX:5,pt:2,children:s.map(({save_path:i,progress:r})=>n.jsxs(W,{children:[n.jsx(N,{fontSize:16,width:"40%",children:i.replace(/^.*[\\/]/,"")}),n.jsx($e,{isIndeterminate:!r,hasStripe:!0,width:"50%",value:r}),n.jsxs(N,{fontSize:16,width:"10%",children:[r.toFixed(1),"%"]}),n.jsx(A,{variant:"outline",size:"sm",colorScheme:"red",onClick:()=>ut(i),children:"Cancel"})]},i))})}function os(){const[t,e]=m.useState(""),{onOpen:s,onClose:o,isOpen:i}=Oe(),r=()=>{vt(t),o()};return n.jsxs(ft,{isOpen:i,onOpen:s,onClose:o,placement:"right",closeOnBlur:!1,children:[n.jsx(mt,{children:n.jsx(A,{size:"sm",py:1,mr:8,children:"Set Civitai API Key"})}),n.jsxs(pt,{p:5,children:[n.jsx(We,{}),n.jsx(gt,{}),n.jsxs(q,{spacing:4,children:[n.jsx(N,{fontSize:14,children:"Some Civitai.com models require user login to download, you will nedd a Civitai API key to download in that case"}),n.jsx(X,{value:t,onChange:a=>e(a.target.value),placeholder:"API Key"}),n.jsx(A,{size:"sm",py:1,mr:8,onClick:r,children:"Save"})]})]})]})}var ke={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};async function is(t,e){var a,c;const s={queries:[{q:t,indexUid:"models_v9",facets:["category.name","checkpointType","fileFormats","lastVersionAtUnix","tags.name","type","user.username","version.baseModel"],attributesToHighlight:["*"],highlightPreTag:"__ais-highlight__",highlightPostTag:"__/ais-highlight__",limit:80,offset:0}]};return e&&(s.queries[0].filter=[[`"type"="${e}"`]]),((c=(a=await(await fetch(ke.VITE_CMODEL_SEARCH_URL,{headers:{"Content-Type":"application/json",Authorization:ke.VITE_CMODEL_APP_KEY},method:"POST",body:JSON.stringify(s)})).json())==null?void 0:a.results)==null?void 0:c.at(0)).hits??[]}function rs({onclose:t,searchQuery:e="",modelType:s}){const[o,i]=m.useState([]),[r,a]=m.useState(!1),[c,l]=m.useState(s),d=Pe(),[h,f]=m.useState([]),[u,g]=m.useState(e),{isOpen:p,onOpen:x,onClose:j}=Oe(),[M,b,k]=xt(),[P,Y]=m.useState({}),[D,C]=m.useState(ee),L=m.useCallback(async()=>{var S;a(!0);const y=await is(u,c);i(y);const w=await Fe();w&&Y(w);const _=await((S=V)==null?void 0:S.getSetting("defaultFolders"));_&&C(_),a(!1)},[u,c]),I=(y,w)=>{var fe,me,pe,ge;if(!((fe=k.current)!=null&&fe.id)&&!w){console.error("no url to download");return}let _=w??`https://civitai.com/api/download/models/${(me=k.current)==null?void 0:me.id}`,S=(pe=k.current)==null?void 0:pe.name;if(!S&&(S=_.split("/").pop(),!S)){console.error("downloadUrl is malformed");return}d({title:"Installing...",description:S,status:"info",duration:4e3,isClosable:!0}),S!=null&&f(He=>[...He,S??""]);const ue=jt();ue&&(_+=`?token=${ue}`),Xt({file_hash:(ge=k.current)==null?void 0:ge.SHA256,filename:S,save_path:y,url:_}),b(void 0),j()},O=async(y,w)=>{const _=D[w.type];b(y),_==null?x():I(_)},E=async(y,w)=>{var S;const _={...D,[y]:w};await((S=V)==null?void 0:S.upsert({defaultFolders:_})),C(_)};return m.useEffect(()=>{L()},[c]),n.jsxs(n.Fragment,{children:[n.jsxs(st,{isOpen:!0,onClose:t,blockScrollOnMount:!0,children:[n.jsx(Le,{}),n.jsxs(nt,{width:"90%",maxWidth:"90vw",height:"90vh",children:[n.jsxs(Ie,{pb:1,children:[n.jsxs(W,{gap:2,mb:2,alignItems:"center",children:[n.jsx(Ne,{size:"md",mr:2,children:"Models"}),n.jsx(ts,{searchQuery:u,setSearchQuery:g,onSearch:L}),n.jsx(A,{size:"sm",py:1,mr:8,onClick:x,children:"Custom URL Install"}),n.jsx(os,{})]}),n.jsxs(W,{gap:2,wrap:"wrap",children:[n.jsx(A,{size:"sm",py:1,onClick:()=>{l(void 0)},isActive:c==null,children:"All"}),yt.map(y=>n.jsx(A,{size:"sm",py:1,isActive:c===y,onClick:()=>{l(y)},children:y},y)),c&&P[ee[c]]&&n.jsxs(W,{ml:"auto",children:[n.jsx(N,{fontSize:17,whiteSpace:"nowrap",children:"Default Download Folder:"}),n.jsx(Z,{value:D[c],onChange:y=>E(c,y.target.value),children:P[ee[c]].map(y=>n.jsx("option",{value:y,children:y},y))})]})]}),r&&n.jsx(ae,{thickness:"4px",emptyColor:"gray.200",color:"pink.500",size:"lg"})]}),n.jsx(ot,{}),n.jsxs(Ee,{overflowY:"auto",children:[n.jsx(W,{wrap:"wrap",children:o==null?void 0:o.map(y=>n.jsx(es,{model:y,onClickInstallModel:O,installing:h},y.id))}),n.jsx(ns,{})]})]})]}),n.jsx(ss,{fileSelected:!!M,isOpen:p,onClose:j,selectFolder:(y,w)=>{I(y,k.current?void 0:w)}})]})}function ms(){const{setRoute:t,route:e}=m.useContext(Ae);return m.useEffect(()=>{ce.addEventListener("model_list",async s=>{var r;const o=(r=s.detail)==null?void 0:r.map(async a=>{const c=await $.models.get(a.model_name+"@"+a.model_type);if(c!=null&&c.fileHash)return c;let l={id:a.model_name+"@"+a.model_type,modelName:null,fileHash:a.file_hash??null,fileFolder:a.model_type,fileName:a.model_name+a.model_extension};if(!a.file_hash)return l;const d=await le(a.file_hash);return l={...l,modelName:d.modelName??null,civitModelID:d.civitModelID,civitModelVersionID:d.civitModelVersionID,imageUrl:d.imageUrl??null},l}),i=(await Promise.all(o)).filter(a=>a!=null);await $.models.clear(),await $.models.bulkPut(i.filter(a=>a!=null)),window.dispatchEvent(new CustomEvent("model_list_updated"))})},[]),n.jsxs(q,{style:{position:"relative"},children:[n.jsx(A,{size:"sm",backgroundColor:"#434554",color:"white",colorScheme:"blue","aria-label":"My models",onClick:()=>t("modelList"),px:1,height:wt+"px",children:"Models"}),e==="modelList"&&n.jsx(Jt,{onClose:()=>t("root")}),e==="installModels"&&n.jsx(rs,{modelType:"Checkpoint",onclose:()=>t("root")})]})}export{ms as default}; diff --git a/dist/workspace_web/RecentFilesDrawer-g7Y8NeOQ.js b/dist/workspace_web/RecentFilesDrawer-g7Y8NeOQ.js new file mode 100644 index 0000000..6b15f0a --- /dev/null +++ b/dist/workspace_web/RecentFilesDrawer-g7Y8NeOQ.js @@ -0,0 +1,5 @@ +import{f as Q,E as qe,j as e,Y as Je,e as ie,g as we,r,M as re,N as le,O as ce,Q as de,R as ue,S as he,V as ve,h as W,Z as ke,T as Qe}from"./input.js";import{m as Le,u as Ae,a as et,b as tt,c as st,S as nt,M as at,d as A,H as z,T as We,I as P,t as je,e as Ne,f as Y,E as me,g as B,h as L,i as R,j as pe,k as C,R as H,l as ot,n as Me,B as _,F as Z,o as Fe,p as it,q as rt,r as ee,s as te,v as N,w as lt,D as Pe,x as T,y as Re,z as ct,A as Se,C as dt,G as _e,J as G,K as ut,L as ht,N as pt,O as Be,P as gt,Q as mt,U as ft,V as U,W as ye,X as Ce,Y as xt,Z as jt,_ as $e,$ as yt,a0 as wt,a1 as vt,a2 as J,a3 as oe,a4 as kt,a5 as St,a6 as Ct,a7 as fe,a8 as bt}from"./App-1AImvRpr.js";import{G as It,C as q}from"./chunk-JARCRF6W-UyOcndjS.js";import{V as Ke}from"./chunk-NTCQBYKE-HH_ifqNx.js";import{N as Mt,a as Ft,g as Dt,I as Et,M as Tt,u as Ot,S as zt}from"./MediaPreview-muJLkZRm.js";import{I as Lt}from"./IconCopy-DxyTNBlz.js";import"./chunk-7D6N5TE5-fihyubSX.js";import"./IconSearch-qxAzDzhT.js";var Ge=Q(function(t,l){const{columns:o,spacingX:n,spacingY:a,spacing:u,minChildWidth:p,...i}=t,h=qe(),d=p?Wt(p,h):Nt(o);return e.jsx(It,{ref:l,gap:u,columnGap:n,rowGap:a,templateColumns:d,...i})});Ge.displayName="SimpleGrid";function At(s){return typeof s=="number"?`${s}px`:s}function Wt(s,t){return Le(s,l=>{const o=Je("sizes",l,At(l))(t);return l===null?null:`repeat(auto-fit, minmax(${o}, 1fr))`})}function Nt(s){return Le(s,t=>t===null?null:`repeat(${t}, minmax(0, 1fr))`)}var He=Q((s,t)=>{const{title:l,children:o,className:n,...a}=s,u=ie("chakra-menu__group__title",n),p=Ae();return e.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[l&&e.jsx(we.p,{className:u,...a,__css:p.groupTitle,children:l}),o]})});He.displayName="MenuGroup";var Ve=s=>{const{className:t,title:l,...o}=s,n=et(o);return e.jsx(He,{title:l,className:ie("chakra-menu__option-group",t),...n})};Ve.displayName="MenuOptionGroup";var Pt=Q((s,t)=>{const l=Ae();return e.jsx(we.button,{ref:t,...s,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...l.button}})}),se=Q((s,t)=>{const{children:l,as:o,...n}=s,a=tt(n,t),u=o||Pt;return e.jsx(u,{...a,className:ie("chakra-menu__menu-button",s.className),children:e.jsx(we.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:s.children})})});se.displayName="MenuButton";var Rt=s=>e.jsx("svg",{viewBox:"0 0 14 14",width:"1em",height:"1em",...s,children:e.jsx("polygon",{fill:"currentColor",points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})}),be=Q((s,t)=>{const{icon:l,iconSpacing:o="0.75rem",...n}=s,a=st(n,t);return e.jsxs(nt,{...a,className:ie("chakra-menu__menuitem-option",n.className),children:[l!==null&&e.jsx(at,{fontSize:"0.8em",marginEnd:o,opacity:s.isChecked?1:0,children:l||e.jsx(Rt,{})}),e.jsx("span",{style:{flex:1},children:a.children})]})});be.id="MenuItemOption";be.displayName="MenuItemOption";var _t=A("chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]),Bt=A("dots-vertical","IconDotsVertical",[["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]),$t=A("edit","IconEdit",[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]]),De=A("file-import","IconFileImport",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M5 13v-8a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-5.5m-9.5 -2h7m-3 -3l3 3l-3 3",key:"svg-1"}]]),Kt=A("file","IconFile",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}]]),Ue=A("folder-plus","IconFolderPlus",[["path",{d:"M12 19h-7a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v3.5",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}]]),Gt=A("list-check","IconListCheck",[["path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5",key:"svg-0"}],["path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5",key:"svg-1"}],["path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5",key:"svg-2"}],["path",{d:"M11 6l9 0",key:"svg-3"}],["path",{d:"M11 12l9 0",key:"svg-4"}],["path",{d:"M11 18l9 0",key:"svg-5"}]]),Ht=A("lock-open","IconLockOpen",[["path",{d:"M5 11m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M12 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-5a4 4 0 0 1 8 0",key:"svg-2"}]]),Vt=A("menu-2","IconMenu2",[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M4 12l16 0",key:"svg-1"}],["path",{d:"M4 18l16 0",key:"svg-2"}]]),Ut=A("moon","IconMoon",[["path",{d:"M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z",key:"svg-0"}]]),Zt=A("pencil","IconPencil",[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]]),Yt=A("settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]),Xt=A("sun","IconSun",[["path",{d:"M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7",key:"svg-1"}]]),qt=A("tag","IconTag",[["path",{d:"M7.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3z",key:"svg-1"}]]),Jt=A("upload","IconUpload",[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 9l5 -5l5 5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]]);function Qt({onclose:s}){const[t,l]=r.useState([]),o=async()=>{var a;const n=await((a=je)==null?void 0:a.listAll());l(n??[])};return r.useEffect(()=>{o()},[]),e.jsxs(re,{isOpen:!0,onClose:s,children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"My Tags"}),e.jsx(ue,{}),e.jsx(he,{children:t.map(n=>e.jsxs(z,{children:[e.jsx(We,{children:n.name}),e.jsx(P,{onClick:async()=>{var a;await((a=je)==null?void 0:a.delete(n.name)),o()},"aria-label":"delete-tag",colorScheme:"red",variant:"ghost",icon:e.jsx(Ne,{})})]}))})]})]})}function es(){const s=Y(),t=r.useRef([{title:"Save current workflow",key:me.SAVE},{title:"Save as current workflow",key:me.SAVE_AS},{title:"Open spotlight search",key:me.openSpotlightSearch}]),[l,o]=r.useState({save:"",saveAs:"",openSpotlightSearch:""}),[n,a]=r.useState(),u=async(i,h)=>{var g;i.preventDefault();let d="";if(i.ctrlKey&&(d+="Control+"),i.metaKey&&(d+="Command+"),i.shiftKey&&(d+="Shift+"),i.altKey&&(d+="Alt+"),d.length>0&&!["Control","Shift","Alt","Meta"].includes(i.key)){d+=i.key.toUpperCase();const m={...l};delete m[h],Object.values(m).includes(d)?s({title:"Shortcut key conflict",description:`The shortcut key 「${d}」 is already used, please + modify it.`,status:"info",duration:3e3,position:"top",isClosable:!1}):(await((g=C)==null?void 0:g.upsert({shortcuts:{...l,[h]:d}})),p())}},p=()=>{var i;(i=C)==null||i.getSetting("shortcuts").then(h=>{var g;const d=h??((g=C)==null?void 0:g.defaultSettings.shortcuts);o({...l,...d})})};return r.useEffect(()=>{p()},[]),e.jsxs(B,{children:[e.jsx(L,{children:"Keyboard Shortcut"}),t.current.map(i=>e.jsxs(z,{children:[e.jsx(L,{fontSize:"sm",w:170,children:i.title}),e.jsx(R,{label:"Press shortcut key combinations to setup",placement:"bottom",hasArrow:!0,isOpen:n===i.key,children:e.jsx(pe,{value:l[i.key],onKeyDown:h=>{u(h,i.key)},onFocus:()=>{a(i.key)},onBlur:()=>{a(void 0)},placeholder:"Press a key combination",readOnly:!0,width:"auto",flex:1})})]},i.key))]})}function ts(){const{setRefreshFolderStamp:s}=r.useContext(H),[t,l]=r.useState(!1),o=()=>{var a;(a=C)==null||a.getSetting("foldersOnTop").then(u=>{l(!!u)})},n=a=>{var p;const u=a.target.checked;(p=C)==null||p.upsert({foldersOnTop:u}).then(()=>{o(),s(Date.now())})};return r.useEffect(()=>{o()},[]),e.jsx(B,{children:e.jsx(q,{isChecked:t,onChange:n,children:"Folders always on top"})})}function ss(){const[s,t]=r.useState(!1),[l,o]=r.useState(""),{showDialog:n}=ve(),a=()=>{var p,i;(p=C)==null||p.getSetting("myWorkflowsDir").then(h=>{o(h??"undefined")}),(i=C)==null||i.getSetting("twoWaySync").then(h=>{t(h??!1)})};r.useEffect(()=>{a()},[]);const u=async p=>{var h,d;if(!p.target.checked){await((h=C)==null?void 0:h.upsert({twoWaySync:p.target.checked})),a();return}const i=await((d=C)==null?void 0:d.getSetting("myWorkflowsDir"));n(e.jsx(ot,{myWorkflowsDir:i??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{var g;await((g=C)==null?void 0:g.upsert({twoWaySync:!0})),a()},colorScheme:"red"}])};return e.jsxs(B,{children:[e.jsx(L,{children:"Only for legacy two way sync users to get back their data. Do not disable two way sync if you have already enabled it. It may cause some unexpected issues."}),e.jsx(q,{isChecked:s,onChange:u,children:"Enable two way sync"})]})}function Ee({settingKey:s,text:t,defaultChecked:l=!1}){const[o,n]=r.useState(l),a=Y(),u=()=>{var p;(p=C)==null||p.getSetting(s).then(i=>{n(!!i)})};return r.useEffect(()=>{u()},[]),e.jsx(B,{children:e.jsx(q,{isChecked:o,onChange:async p=>{var i;await((i=C)==null?void 0:i.upsert({[s]:p.target.checked})),u(),a({title:"Setting saved. Please refresh to see the changes.",status:"success",duration:3e3,isClosable:!0})},children:t})})}function ns(){const[s,t]=r.useState(!1),[l,o]=r.useState(!1),[n,a]=r.useState([]),[u,p]=r.useState(""),[i,h]=r.useState([]),[d,g]=r.useState(!1),[m,c]=r.useState(!1),[f,v]=r.useState(!1),S=r.useRef(null),w=Y();ve();const b=f?"\\":"/";r.useEffect(()=>{var j;Me().then(k=>{p(k.path??""),v(k.os==="win32")}),(j=C)==null||j.getSetting("twoWaySync").then(k=>{g(k??!1)})},[]);const F=async j=>{const{dir_path:k="",dir_contents:E=[],error:V=""}=await Fe(j??"");return V.includes("Operation not permitted")?(c(!0),O(),{isError:!0}):{dirList:E,dirPath:k}},y=async()=>{const{isError:j=!1,dirList:k=[]}=await F(u);j||(a(k),o(!0),h(u&&u.split(b).filter(E=>!!E)||[]))},O=()=>{o(!1),t(!1),h([])},$=async(j,k=!1,E=!1)=>{var x,I;if(k){const{path:M}=await Me();M&&await it(M,j)}await((x=C)==null?void 0:x.upsert({myWorkflowsDir:j}));const V=await((I=C)==null?void 0:I.getSetting("myWorkflowsDir"))??"";p(V),E&&c(!1),O()},K=async j=>{if(j){const{error:E=""}=await Fe(j);if(E.includes("Not a directory")){w({title:"The directory address you entered is invalid, please re-enter it.",status:"warning",duration:5e3,position:"top",isClosable:!0});return}}const k=j??`${f?"":b}${i.join(b)}`;$(k,!1,!!j)},X=async()=>{const{dirPath:j,dirList:k}=await F("");h(j.split(b).filter(E=>!!E)),a(k)},ne=async(j,k)=>{var I;let E="";j===-1&&k?E=`${f?"":b}${i.concat([k]).join(b)}`:E=`${f?"":b}${i.slice(0,j+1).join(b)}`;const{isError:V=!1,dirList:x=[]}=await F(E);V||(a(x),h(f?E.split(b):(I=E.slice(1))==null?void 0:I.split(b)))},ae=e.jsxs(_,{textAlign:"end",mb:4,children:[e.jsx(pe,{placeholder:"Please enter the absolute path directory address",ref:S,mt:2,mb:2}),e.jsx(W,{colorScheme:"teal",mr:3,size:"sm",onClick:()=>{var j,k;(j=S==null?void 0:S.current)!=null&&j.value&&K((k=S==null?void 0:S.current)==null?void 0:k.value)},children:"Save"})]}),ge=()=>{o(!0),t(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs(_,{mb:4,children:[e.jsx(L,{mb:2,fontWeight:500,children:"My Workflows Save Directory"}),l?s?ae:e.jsxs(Ke,{spacing:2,alignItems:"start",children:[e.jsx(B,{spacing:"2px",direction:"row",wrap:"wrap",children:i.map((j,k)=>e.jsxs("span",{children:[k>0&&b,e.jsx(W,{colorScheme:"teal",variant:"link",minW:1,onClick:()=>{ne(k)},children:j},`${j}-${k}`)]},j))}),e.jsx(Ge,{columns:2,spacing:3,maxHeight:500,width:"100%",overflowY:"auto",children:n.map((j,k)=>e.jsx(W,{size:"sm",leftIcon:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.2rem",height:"1.2rem"},children:e.jsx("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"})}),justifyContent:"start",onClick:()=>{ne(-1,j)},children:j},`${j}-${k}`))}),e.jsxs(_,{w:"100%",textAlign:"end",children:[e.jsx(W,{colorScheme:"teal",size:"sm",onClick:()=>{K()},children:"Save"}),e.jsx(W,{size:"sm",onClick:X,mr:2,ml:2,children:"Reset"}),e.jsx(W,{size:"sm",onClick:O,children:"Cancel"})]})]}):e.jsxs(Z,{children:[e.jsx(We,{overflowWrap:"anywhere",children:u}),e.jsx(R,{label:d?"Choose folder":"Enable two way sync to link local folder",children:e.jsx(P,{"aria-label":"Select folder",size:"sm",ml:2,isDisabled:!d,icon:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.4rem",height:"1.4srem"},children:e.jsx("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"})}),onClick:y})}),e.jsx(R,{label:d?"Input absolute path":"Enable two way sync to link local folder",children:e.jsx(P,{isDisabled:!d,"aria-label":"Enter folder address",size:"sm",ml:2,icon:e.jsx($t,{size:19}),onClick:ge,variant:"ghost"})})]})]}),e.jsxs(re,{isOpen:m,onClose:()=>c(!1),size:"xl",children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"Kind tips"}),e.jsx(ue,{}),e.jsx(he,{children:e.jsxs(_,{children:[navigator.userAgent.indexOf("Mac OS X")!==-1?e.jsxs(L,{fontWeight:500,children:["There is no permission to access the folder. You need to grant full disk access permission to the terminal that starts the ComfyUI program. For details, refer to the",e.jsx(W,{colorScheme:"teal",variant:"link",as:"a",ml:2,target:"_block",href:`https://stackoverflow.com/questions/58479686/permissionerror-errno-1-operation-not-permitted-after-macos + -catalina-update`,children:"Document"}),", or you can manually enter the absolute path of the folder in the input box below to save."]}):e.jsx(L,{fontWeight:500,children:"You do not have permission to access the folder. It is recommended that you manually enter the absolute path address of the required folder."}),ae]})})]})]})]})}function Ze({label:s,settingKey:t}){const[l,o]=r.useState(200),n=Y(),a=i=>{if(!i.length){o(0);return}o(parseInt(i))},u=async()=>{var i;l<0&&o(0),await((i=C)==null?void 0:i.upsert({[t]:Number(l)})),n({title:"Setting saved",status:"success",duration:3e3,isClosable:!0})},p=()=>{var i;(i=C)==null||i.getSetting(t).then(h=>{o(h)})};return r.useEffect(()=>{p()},[]),e.jsxs(B,{children:[e.jsx(L,{children:s}),e.jsx(Mt,{defaultValue:200,min:0,keepWithinRange:!0,placeholder:"Enter a number",maxWidth:"300px",value:l,onChange:i=>a(i),onBlur:()=>{u()},onKeyUp:i=>{i.key==="Enter"&&u()},children:e.jsx(Ft,{})})]})}function as(){const[s,t]=r.useState(!1),l=Y(),o=()=>{var n;(n=C)==null||n.getSetting("autoSave").then(a=>{t(!!a)})};return r.useEffect(()=>{o()},[]),e.jsxs(B,{children:[e.jsx(q,{isChecked:s,onChange:async n=>{var a;await((a=C)==null?void 0:a.upsert({autoSave:n.target.checked})),o(),l({title:"Setting saved",status:"success",duration:3e3,isClosable:!0})},children:"Enable auto save workflow"}),s&&e.jsx(Ze,{label:"Auto save duration (auto save workflow every X seconds)",settingKey:"autoSaveDuration"})]})}function os(){const s=r.useRef(null),t=Y(),l=()=>{var o;(o=C)==null||o.getSetting("cloudHost").then(n=>{var a;(a=s.current)==null||a.setAttribute("value",n??"")})};return r.useEffect(()=>{l()},[]),e.jsxs(B,{children:[e.jsx(L,{children:"For enterprise paid user only. Hosting site of the shared workflow."}),e.jsxs(Z,{gap:2,alignItems:"center",children:[e.jsx(pe,{ref:s,onBlur:()=>{var o,n,a;console.log("onBlur",(o=s.current)==null?void 0:o.value),(a=C)==null||a.upsert({cloudHost:(n=s.current)==null?void 0:n.value}),l(),t({title:"Setting saved. Please refresh to see the changes.",status:"success",duration:4e3})}}),e.jsx(W,{size:"sm",onClick:()=>{var o,n,a;(n=s.current)==null||n.setAttribute("value",(o=C)==null?void 0:o.defaultSettings.cloudHost),(a=s.current)==null||a.blur()},children:"Reset"})]})]})}function is({onClose:s}){return e.jsx(e.Fragment,{children:e.jsxs(re,{isOpen:!0,onClose:s,size:"xl",children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"Settings"}),e.jsx(ue,{}),e.jsx(he,{pb:14,children:e.jsx(z,{children:e.jsxs(Ke,{divider:e.jsx(rt,{borderColor:"gray.500"}),spacing:4,align:"stretch",w:"100%",children:[e.jsx(ns,{}),e.jsx(as,{}),e.jsx(es,{}),e.jsx(ss,{}),e.jsx(ts,{}),e.jsx(Ee,{settingKey:"overwriteCurWorkflowWhenDroppingFileToCanvas",text:"Overwrite current workflow when drag and drop workflow file to canvas"}),e.jsx(Ze,{label:`Maximum number of save change history to store. This does not include + versions that you created by "Create Version", which are always stored + and has no limit.`,settingKey:"maximumChangelogNumber"}),e.jsx(Ee,{settingKey:"hideCoverImage",text:"Hide thumbnail image in workflow list"}),e.jsx(os,{})]})})})]})]})})}const xe=16;function rs({}){const[s,t]=r.useState(!1),[l,o]=r.useState(!1),{colorMode:n,toggleColorMode:a}=ke();return e.jsxs(e.Fragment,{children:[e.jsxs(ee,{isLazy:!0,children:[e.jsx(se,{as:P,"aria-label":"Options",icon:e.jsx(Vt,{}),size:"sm",variant:"outline"}),e.jsxs(te,{children:[e.jsx(N,{onClick:()=>o(!0),icon:e.jsx(Yt,{size:16}),fontSize:16,children:"Settings"}),e.jsx(N,{onClick:()=>t(!0),icon:e.jsx(qt,{size:xe}),fontSize:16,children:"Manage Tags"}),e.jsxs(N,{onClick:a,icon:n==="light"?e.jsx(Ut,{size:xe}):e.jsx(Xt,{size:xe}),fontSize:16,children:[n==="light"?"Dark":"Light"," Mode"]})]})]}),s&&e.jsx(Qt,{onclose:()=>t(!1)}),l&&e.jsx(is,{onClose:()=>o(!1)})]})}function ls(s){const{multipleState:t,changeMultipleState:l,selectedKeys:o,isSelectedAll:n,batchOperationCallback:a}=s,u=async()=>{var h;const i=await((h=T)==null?void 0:h.batchQuery(o))??[];ct(i)},p=o.length===0;return e.jsx(z,{spacing:2,wrap:"wrap",mb:0,children:t?e.jsxs(e.Fragment,{children:[e.jsx(q,{isChecked:n,onChange:i=>{a("selectAll",i.target.checked)}}),e.jsx(R,{hasArrow:!0,label:"Download Zip",placement:"bottom",children:e.jsx(P,{isDisabled:p,"aria-label":"Batch export",size:"sm",icon:e.jsx(lt,{size:21}),onClick:u})}),e.jsx(R,{hasArrow:!0,label:"Batch deletion",children:e.jsx(Pe,{isDisabled:p,variant:"solid",promptMessage:`Are you sure you want to delete these ${o.length} checked workflows?`,tooltipText:"Delete selected",onDelete:async()=>{var i;await((i=T)==null?void 0:i.batchDeleteFlow(o)),a("batchDelete")}})}),o.length>0&&e.jsx(L,{fontWeight:600,children:`Selected ${o.length}`}),e.jsx(R,{hasArrow:!0,label:"Exit multi-select",children:e.jsx(P,{"aria-label":"Close multi-select operation",size:"sm",icon:e.jsx(Re,{}),onClick:()=>{l(!1)}})})]}):e.jsx(R,{hasArrow:!0,label:"Select multiple",placement:"bottom-start",children:e.jsx(P,{"aria-label":"Start multi-select operation",size:"sm",variant:"outline",icon:e.jsx(Gt,{size:21}),onClick:()=>{l(!0)}})})})}const Te=6;function cs({setSelectedTag:s,selectedTag:t}){const[l,o]=r.useState(!1),[n,a]=r.useState([]);return r.useEffect(()=>{var u;(u=je)==null||u.listAll().then(p=>{a(p)})},[]),e.jsxs(z,{spacing:2,wrap:"wrap",mb:0,children:[t!=null&&e.jsx(P,{"aria-label":"Close",size:"sm",icon:e.jsx(Re,{}),onClick:()=>{s(void 0)}}),n.slice(0,l?void 0:Te).map(u=>e.jsx(W,{variant:"solid",width:"auto",flexShrink:0,size:"sm",borderRadius:15,py:4,onClick:()=>{s(u.name)},isActive:t===u.name,children:u.name},u.name)),(n.length??0)>Te&&e.jsx(P,{"aria-label":"Show-all-tags",size:"sm",icon:l?e.jsx(_t,{}):e.jsx(Se,{}),onClick:()=>o(!l)})]})}function Ye({parentFolderID:s,onlyImportFile:t=!1}){const{onRefreshFilesList:l}=r.useContext(H),[o,n]=r.useState("file"),a=r.useRef(null),u=d=>{var g;n(d),d==="folder"?a.current.setAttribute("webkitdirectory",""):a.current.removeAttribute("webkitdirectory"),(g=a.current)==null||g.click()},p=async d=>{var g;if(d.type==="image/png"){const m=await Dt(d),c=m==null?void 0:m.workflow;if(c)return{json:c,name:d.name.replace(".png","")}}else if(d.type==="application/json"||(g=d.name)!=null&&g.endsWith(".json"))return await new Promise((m,c)=>{const f=new FileReader;f.onload=v=>{var S;try{const w=(S=v.target)==null?void 0:S.result;typeof w=="string"?m({json:w,name:d.name.replace(".json","")}):c(new Error("File content is not a string"))}catch(w){c(w)}},f.onerror=c,f.readAsText(d)});return null},i=async d=>{var m,c;const g=[d];for(;g.length>0;){const f=g.shift();if(f&&!f.isFile){const v=await((m=G)==null?void 0:m.create({name:f.name,parentFolderID:f.parentFolderID}));if(f.children&&f.children.length){const S=[];f.children.forEach(w=>{w.isFile&&w.file?S.push(w.file):(w.parentFolderID=v==null?void 0:v.id,g.push(w))}),S.length&&await((c=T)==null?void 0:c.batchCreateFlows(S,void 0,v==null?void 0:v.id))}}}l==null||l()},h=async d=>{var m;const g=d.target.files;if(g)if(o==="folder"){const c={name:g[0].webkitRelativePath.split("/")[0],isFile:!1,children:[]};for(const f of g)if(f.name!==".DS_Store"){const v=f.webkitRelativePath.split("/");let S=c.children??[];for(let w=1;wy.name===b);if(!F){if(F={name:b,isFile:w===v.length-1,children:w===v.length-1?void 0:[]},F.isFile){const y=await p(f);y&&(F.file=y)}S.push(F)}F&&!F.isFile&&(S=F.children)}}i(c)}else{const c=[];for(const f of g){const v=await p(f);v&&c.push(v)}c.length&&(await((m=T)==null?void 0:m.batchCreateFlows(c,void 0,s)),l&&l())}};return e.jsxs(e.Fragment,{children:[t?e.jsx(N,{onClick:d=>{d.stopPropagation(),u("file")},icon:e.jsx(De,{size:19}),children:"Import workflows"}):e.jsxs(ee,{closeOnSelect:!0,children:[e.jsx(se,{as:W,leftIcon:e.jsx(De,{size:18}),variant:"outline",iconSpacing:1,size:"sm",colorScheme:"teal",children:"Import"}),e.jsx(te,{children:dt.map((d,g)=>e.jsx(N,{onClick:()=>{u(d.type)},iconSpacing:2,icon:d.type==="folder"?e.jsx(_e,{size:18}):e.jsx(Kt,{size:18}),children:d.title},g))})]}),e.jsx("input",{style:{display:"none"},ref:a,type:"file",accept:".json,image/png",multiple:!0,onChange:h,onClick:d=>{d.stopPropagation()}})]})}function ds({folder:s,onclose:t}){const[l,o]=r.useState(s.name),[n,a]=r.useState(""),{onRefreshFilesList:u}=r.useContext(H),p=h=>{o(h.target.value),n&&a("")},i=async()=>{var g,m;const h=l.trim();if(o(h),h===s.name)return t();await((g=G)==null?void 0:g.generateUniqueName(h,s.parentFolderID??""))!==h?a("The name is duplicated, please modify it and submit again."):(await((m=G)==null?void 0:m.update(s.id,{name:h})),u&&u(),t())};return e.jsxs(re,{isOpen:!0,onClose:t,children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"Edit folder name"}),e.jsx(ue,{}),e.jsx(he,{children:e.jsxs(ut,{isInvalid:!!n,children:[e.jsx(ht,{children:"Folder name"}),e.jsx(pe,{value:l,onChange:p,autoFocus:!0,onKeyUp:h=>{h.code==="Enter"&&!n&&l&&i()}}),n&&e.jsx(pt,{children:n})]})}),e.jsxs(Qe,{children:[e.jsx(W,{colorScheme:"teal",mr:3,onClick:i,isDisabled:!l||!!n,children:"Save"}),e.jsx(W,{onClick:t,children:"Cancel"})]})]})]})}function us({menuPosition:s,isopen:t,folder:l,onClose:o}){const[n,a]=r.useState(!1),{onRefreshFilesList:u}=r.useContext(H),{showDialog:p}=ve(),i=async m=>{var c;m.stopPropagation(),await((c=G)==null?void 0:c.create({name:"New Folder",parentFolderID:l.id})),u&&u()},h=async m=>{var c;m.stopPropagation(),await((c=T)==null?void 0:c.createFlow({json:JSON.stringify(gt),parentFolderID:l.id})),u&&u()},d=async m=>{m.stopPropagation();const c=await mt(l.id);p(`Do you want to delete the ${c} files inside the folder too?`,[{label:"Delete all files",colorScheme:"red",onClick:()=>{g(ft.DELETE)}}])},g=async m=>{var c;await((c=G)==null?void 0:c.deleteFolder(l.id,m)),o(),u&&u()};return e.jsxs(e.Fragment,{children:[e.jsx(_,{position:"absolute",top:s.y,left:s.x,children:e.jsx(ee,{isOpen:t,onClose:o,isLazy:!0,lazyBehavior:"keepMounted",children:e.jsxs(te,{children:[e.jsx(N,{icon:e.jsx(Zt,{size:19}),onClick:m=>{m.preventDefault(),m.stopPropagation(),a(!0)},children:"Rename"}),e.jsx(N,{icon:e.jsx(Ne,{size:19}),onClick:d,children:"Delete"}),e.jsx(N,{onClick:i,icon:e.jsx(Ue,{size:19}),children:"New folder"}),e.jsx(N,{onClick:h,icon:e.jsx(Be,{size:19}),children:"New file"}),e.jsx(Ye,{parentFolderID:l.id,onlyImportFile:!0})]})})}),n&&e.jsx(ds,{folder:l,onclose:()=>a(!1)})]})}const Oe=r.memo(function({folder:t}){const[l,o]=r.useState(!1),[n,a]=r.useState(t.isCollapse??!0),[u,p]=r.useState([]),[i,h]=r.useState({x:0,y:0}),[d,g]=r.useState(!1),{colorMode:m}=ke(),{draggingFile:c,setDraggingFile:f,refreshFolderStamp:v,onRefreshFilesList:S}=r.useContext(H),w=m==="light"?{backgroundColor:"#E2E8F0"}:{backgroundColor:"#4A5568"};r.useEffect(()=>{var y;n||(y=T)==null||y.listFolderContent(t.id,window.localStorage.getItem(ye)).then(O=>{p(O)})},[t.id,v,n]);const b=y=>{y.preventDefault(),h({x:y.clientX,y:y.clientY}),g(!0)},F=async y=>{var O,$;if(y.preventDefault(),y.stopPropagation(),!c)return o(!1);if(U(c)){if(c.id===t.id)return o(!1);await((O=G)==null?void 0:O.update(c.id,{parentFolderID:t.id}))}else U(c)||await(($=T)==null?void 0:$.updateFolder(c.id,{parentFolderID:t.id}));await(S==null?void 0:S()),o(!1)};return r.useEffect(()=>{var y;!!t.isCollapse!==n&&((y=G)==null||y.update(t.id,{isCollapse:n}))},[n]),r.useEffect(()=>{var X;const y=(X=T)==null?void 0:X.curWorkflow,O=(y==null?void 0:y.parentFolderID)+"/",$=t.id+"/";O.startsWith($)&&a(!1)},[]),e.jsxs(B,{children:[e.jsxs(z,{w:"100%",as:"button",py:1,onClick:()=>{a(!n)},onContextMenu:b,draggable:"true",onDragOver:y=>{y.preventDefault(),y.stopPropagation(),o(!0)},onDragLeave:y=>{y.preventDefault(),y.stopPropagation(),o(!1)},onDragStart:()=>f==null?void 0:f(t),onDrop:F,_hover:w,style:l||d?w:void 0,className:"droppable",children:[e.jsxs(z,{gap:1,children:[n?e.jsx(Et,{size:20}):e.jsx(Se,{size:20}),e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.2rem",height:"1.2rem"},children:e.jsx("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"})})]}),e.jsx(L,{children:t.name})]}),e.jsx(us,{isopen:d,menuPosition:i,onClose:()=>g(!1),folder:t}),!n&&e.jsx(B,{ml:4,gap:0,children:e.jsx(Xe,{items:u})})]})});function hs({workflow:s}){const t=r.useRef(null),l=Y(),{onDuplicateWorkflow:o}=r.useContext(Ce),[n,a]=r.useState(s.saveLock??!1),u=async()=>{var h;const i=!n;a(i),await((h=T)==null?void 0:h.updateMetaInfo(s.id,{saveLock:i})),l({title:`${i?"Locked":"Unlocked"} successfully`,status:"success",duration:2e3})},p=async i=>{const h=i.target.files;if(!h)return;const d=new FormData;Array.from(h).forEach((g,m)=>{d.append(`images[${m}]`,g,g.name)}),d.append("subfolder","workspace_manager"),await yt("/workspace/images/save",{method:"POST",body:d}),Array.from(h).forEach(async g=>{var c,f;const m=`workspace_manager/${g.name}`;(c=wt)==null||c.create({workflowID:s.id,localPath:m}),(f=T)==null||f.updateMetaInfo(s.id,{coverMediaPath:m})})};return e.jsxs(e.Fragment,{children:[e.jsxs(ee,{isLazy:!0,closeOnSelect:!1,placement:"right",gutter:0,children:[e.jsx(se,{border:0,as:P,"aria-label":"Options",icon:e.jsx(Bt,{size:20}),size:"sm",variant:"outline"}),e.jsxs(te,{zIndex:101,children:[e.jsx(N,{icon:e.jsx(Lt,{}),onClick:()=>o&&o(s.id),children:"Duplicate"}),e.jsx(N,{icon:e.jsx(xt,{size:20}),onClick:()=>jt(s.id),children:"Open in new tab"}),e.jsx(R,{hasArrow:!0,label:n?"Unlock workflow, allow modifying":"Lock workflow, prevent modifying",placement:"bottom",children:e.jsx(N,{icon:n?e.jsx($e,{}):e.jsx(Ht,{}),onClick:u,children:n?"Unlock":"Lock"})}),e.jsx(N,{icon:e.jsx(Jt,{}),onClick:()=>{var i;(i=t.current)==null||i.click()},children:"Upload Thumbnail Image"})]})]}),e.jsx("input",{style:{display:"none"},ref:t,type:"file",accept:".json,image/png",multiple:!0,onChange:p,onClick:i=>{i.stopPropagation()}})]})}function ps({workflow:s}){const{onDeleteFlow:t}=r.useContext(H);return e.jsxs(Z,{justifyContent:"flex-end",children:[e.jsx(Pe,{promptMessage:"Are you sure you want to delete this workflow?",onDelete:()=>{t&&t(s.id)}}),e.jsx(hs,{workflow:s})]})}const ze=r.memo(function({workflow:t}){var v,S,w,b;const{colorMode:l}=ke(),{setDraggingFile:o,isMultiSelecting:n,onMultiSelectFlow:a,multiSelectedFlowsID:u}=r.useContext(H),p=u&&u.length>0&&u.includes(t.id),{curFlowID:i,loadWorkflowID:h}=r.useContext(Ce),d=i===t.id,g=l==="light"?"gray.200":"#4A5568",[m,c]=r.useState(!1),f=e.jsx(_,{flexShrink:1,flexGrow:1,backgroundColor:d?"teal.200":void 0,color:d&&!n?"#333":void 0,draggable:!n,onDragStart:()=>o==null?void 0:o(t),borderRadius:6,px:1,py:"5px",onClick:()=>{!n&&h(t.id)},_hover:{bg:g},children:e.jsxs(z,{flexGrow:1,children:[!((S=(v=C)==null?void 0:v.settings)!=null&&S.hideCoverImage)&&(((w=t.coverMediaPath)==null?void 0:w.length)||((b=t.latestImage)==null?void 0:b.length))&&e.jsx(Tt,{mediaLocalPath:t.coverMediaPath??t.latestImage??"",size:60,hideBrokenImage:!0,isPreview:!0}),e.jsx(_,{textAlign:"left",gap:0,justifyContent:"space-between",flexGrow:1,children:e.jsxs(Z,{alignItems:"center",children:[e.jsx(L,{fontWeight:"500",noOfLines:1,wordBreak:"break-all",children:t.name??"untitled"}),t.saveLock&&e.jsx($e,{size:18,style:{display:"inline-block"}})]})})]})});return e.jsx(z,{w:"100%",justify:"space-between",borderBottom:"1px solid",borderColor:l=="dark"?"gray.700":"gray.200",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:n?e.jsx(q,{isChecked:p,spacing:4,onChange:F=>{a&&a(t.id,F.target.checked)},children:f}):e.jsxs(e.Fragment,{children:[f,e.jsx(_,{width:"fit-content",children:m?e.jsx(ps,{workflow:t}):e.jsx(L,{color:"GrayText",fontSize:"sm",children:vt(t.updateTime,!1,!1,"/")})})]})})});function Xe({items:s}){var m;const[t,l]=r.useState(!1),o=s.filter(U),n=s.filter(c=>!U(c)),a=(m=n[0])==null?void 0:m.parentFolderID,[u,p]=r.useState(!1),{onRefreshFilesList:i,draggingFile:h,refreshFolderStamp:d}=r.useContext(H),g=async c=>{var f,v;if(c.preventDefault(),c.stopPropagation(),!h)return p(!1);if(U(h)){if(h.id===a)return p(!1);await((f=G)==null?void 0:f.update(h.id,{parentFolderID:a}))}else await((v=T)==null?void 0:v.updateFolder(h.id,{parentFolderID:a}));await(i==null?void 0:i()),p(!1)};return r.useEffect(()=>{var c;(c=C)==null||c.getSetting("foldersOnTop").then(f=>{l(f??!1)})},[d]),e.jsxs(e.Fragment,{children:[t&&o.map(c=>e.jsx(Oe,{folder:c},c.id)),e.jsx(_,{border:u?"2px dashed #718096":"2px dashed transparent",onDragOver:c=>{c.preventDefault(),c.stopPropagation(),p(!0)},onDragLeave:c=>{c.preventDefault(),c.stopPropagation(),p(!1)},onDrop:g,className:"droppable",children:t?n.map(c=>e.jsx(ze,{workflow:c},c.id)):s.map(c=>U(c)?e.jsx(Oe,{folder:c},c.id):e.jsx(ze,{workflow:c},c.id))})]})}function ks({onClose:s,onClickNewFlow:t}){const[l,o]=r.useState([]),n=r.useRef([]),{loadWorkflowID:a,curFlowID:u}=r.useContext(Ce),[p,i]=r.useState(),[h,d]=r.useState(!1),[g,m]=r.useState([]),[c,f]=r.useState(0),[v,S]=r.useState(""),w=Ot(v,400),b=r.useRef(null),[F,y]=r.useState(null),O=r.useRef(window.localStorage.getItem(ye)??J.RECENTLY_MODIFIED),$=!!p||!!w.length,K=async()=>{var I,M;const x=await((I=T)==null?void 0:I.listFolderContent())??[];o(fe(x,O.current)),f(Date.now()),n.current=await((M=T)==null?void 0:M.listAll())??[]},X=()=>{const x=n.current.filter(I=>{var Ie;let M=!0,D=!0;return p&&(M=!!((Ie=I.tags)!=null&&Ie.includes(p))),w&&(D=!!I.name.toLocaleLowerCase().includes(w.toLocaleLowerCase())),M&&D});o(fe(x,O.current))},ne=x=>{o(fe(l,x)),O.current=x,window.localStorage.setItem(ye,x),!$&&f(Date.now())};r.useEffect(()=>{$?X():K()},[w,p]);const ae=r.useCallback(async x=>{var I,M,D;await((I=T)==null?void 0:I.deleteFlow(x)),((D=(M=T)==null?void 0:M.curWorkflow)==null?void 0:D.id)===x&&await(a==null?void 0:a(null)),await K()},[p,w]);r.useEffect(()=>{const x=async I=>{var M;if(b.current){const D=await((M=T)==null?void 0:M.get(b.current));D&&D.json&&bt(D.json,[I.canvasX,I.canvasY])}};return oe.canvasEl.addEventListener("drop",x),oe.canvasEl.addEventListener("click",s),()=>{oe.canvasEl.removeEventListener("drop",x),oe.canvasEl.removeEventListener("click",s)}},[]);const ge=r.useCallback((x,I)=>{m(M=>{const D=[...M];return I?D.push(x):D.splice(D.indexOf(x),1),D})},[]),j=(x,I)=>{var M;switch(x){case"batchDelete":u&&((M=T)==null||M.get(u).then(D=>{D||a==null||a(null)})),K(),d(!1),m([]);return;case"selectAll":m(I?n.current.map(D=>D.id):[]);return}},k=x=>{y(x),U(x)||(b.current=x.id)},E=x=>{S(x)},V=450;return e.jsx(H.Provider,{value:{onRefreshFilesList:K,draggingFile:F??void 0,setDraggingFile:k,isMultiSelecting:h,onMultiSelectFlow:ge,multiSelectedFlowsID:g,onDeleteFlow:ae,refreshFolderStamp:c,setRefreshFolderStamp:f},children:e.jsx(_,{style:{width:V},children:e.jsxs(kt,{width:V,height:"100vh",pl:2,pr:2,pt:4,gap:4,position:"absolute",top:0,left:0,shadow:"xl",zIndex:St,children:[e.jsxs(Z,{alignItems:"center",justifyContent:"space-between",children:[e.jsxs(z,{gap:4,children:[e.jsx(z,{gap:2,children:e.jsx(L,{fontSize:19,fontWeight:600,children:"🦄Workspace"})}),e.jsx(Ye,{}),e.jsx(R,{label:"Open workspace save directory",children:e.jsx(P,{"aria-label":"Open workspace save directory",size:"sm",icon:e.jsx(_e,{}),variant:"outline",colorScheme:"teal",onClick:()=>Ct()})}),e.jsx(R,{label:"New workflow",children:e.jsx(P,{"aria-label":"New workflow",size:"sm",icon:e.jsx(Be,{}),variant:"outline",colorScheme:"teal",onClick:t})})]}),e.jsx(z,{alignItems:"center",children:e.jsx(rs,{})})]}),e.jsxs(Z,{direction:"column",h:"calc(100% - 64px)",children:[e.jsx(cs,{selectedTag:p,setSelectedTag:i}),e.jsxs(z,{mb:2,mt:2,p:0,justifyContent:"space-between",children:[e.jsxs(z,{children:[e.jsx(ls,{multipleState:h,changeMultipleState:x=>{d(x),!x&&m([])},selectedKeys:g,isSelectedAll:g.length===n.current.length,batchOperationCallback:j}),!h&&e.jsx(R,{hasArrow:!0,label:"New folder",placement:"bottom-start",children:e.jsx(P,{size:"sm",variant:"outline",icon:e.jsx(Ue,{size:21}),onClick:async()=>{var x;await((x=G)==null?void 0:x.create({name:"New Folder"})),K()},"aria-label":"new folder button"})})]}),e.jsxs(ee,{closeOnSelect:!0,children:[e.jsx(se,{as:W,variant:"ghost",size:"xs",pr:0,rightIcon:e.jsx(Se,{size:"16"}),children:e.jsxs(z,{children:[e.jsx(L,{children:"Sort by:"}),e.jsx(L,{display:"inline-block",children:O.current})]})}),e.jsx(te,{children:e.jsx(Ve,{value:O.current,type:"radio",onChange:x=>ne(x),children:[J.RECENTLY_MODIFIED,J.OLDEST_MODIFIED,J.AZ,J.ZA].map((x,I)=>e.jsx(be,{value:x,children:x},I))})})]})]}),e.jsx(zt,{searchValue:v,onUpdateSearchValue:E}),e.jsx(Z,{overflowY:"auto",overflowX:"hidden",direction:"column",style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:e.jsx(Xe,{items:l})})]})]})})})}export{ks as default}; diff --git a/dist/workspace_web/ShareDialog-t7mRPVSb.js b/dist/workspace_web/ShareDialog-t7mRPVSb.js new file mode 100644 index 0000000..371600c --- /dev/null +++ b/dist/workspace_web/ShareDialog-t7mRPVSb.js @@ -0,0 +1 @@ +import{f as oe,n as pe,o as fe,j as e,g as te,e as ae,r as l,m as me,w as X,b as ge,h as L,a0 as Z,M as we,N as xe,O as je,Q as ve,S as ye}from"./input.js";import{B as be,A as ke,a4 as Se,a3 as P,af as z,am as Ce,g as W,H as G,ac as Ie,ay as ee,X as Re,f as De,k as H,F as se,aD as Ee,j as Ne,x as F,$ as Pe,aE as Te,aF as We,aG as _e,aH as Fe,h as Me,T as Oe,aI as ze,Y as Le}from"./App-1AImvRpr.js";import{a as Ae}from"./civitUtils-uJNBxoFV.js";import{I as He}from"./chunk-7D6N5TE5-fihyubSX.js";import{S as Ge,L as $e}from"./chunk-VTV6N5LE-7BSZDdqw.js";import{I as Be}from"./IconCopy-DxyTNBlz.js";var ne=oe(function(n,c){const i=pe("Badge",n),{className:s,...r}=fe(n);return e.jsx(te.span,{ref:c,className:ae("chakra-badge",n.className),...r,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...i}})});ne.displayName="Badge";function Ue(t){return t&&X(t)&&X(t.target)}function Ve(t={}){const{onChange:n,value:c,defaultValue:i,name:s,isDisabled:r,isFocusable:o,isNative:k,...h}=t,[S,v]=l.useState(i||""),w=typeof c<"u",p=w?c:S,x=l.useRef(null),a=l.useCallback(()=>{const m=x.current;if(!m)return;let j="input:not(:disabled):checked";const T=m.querySelector(j);if(T){T.focus();return}j="input:not(:disabled)";const E=m.querySelector(j);E==null||E.focus()},[]),y=`radio-${l.useId()}`,C=s||y,I=l.useCallback(m=>{const j=Ue(m)?m.target.value:m;w||v(j),n==null||n(String(j))},[n,w]),f=l.useCallback((m={},j=null)=>({...m,ref:me(j,x),role:"radiogroup"}),[]),A=l.useCallback((m={},j=null)=>({...m,ref:j,name:C,[k?"checked":"isChecked"]:p!=null?m.value===p:void 0,onChange(E){I(E)},"data-radiogroup":!0}),[k,C,I,p]);return{getRootProps:f,getRadioProps:A,name:C,ref:x,focus:a,setValue:v,value:p,onChange:I,isDisabled:r,isFocusable:o,htmlProps:h}}var[Ke,ns]=ge({name:"RadioGroupContext",strict:!1}),re=oe((t,n)=>{const{colorScheme:c,size:i,variant:s,children:r,className:o,isDisabled:k,isFocusable:h,...S}=t,{value:v,onChange:w,getRootProps:p,name:x,htmlProps:a}=Ve(S),R=l.useMemo(()=>({name:x,size:i,onChange:w,colorScheme:c,value:v,variant:s,isDisabled:k,isFocusable:h}),[x,i,w,c,v,s,k,h]);return e.jsx(Ke,{value:R,children:e.jsx(te.div,{...p(a,n),className:ae("chakra-radio-group",o),children:r})})});re.displayName="RadioGroup";function qe({options:t,value:n,onChange:c}){const[i,s]=l.useState(!1),r=l.useRef(null),o=t.find(h=>h.value===n);l.useEffect(()=>{const h=S=>{r.current&&!r.current.contains(S.target)&&s(!1)};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[r]);const k=()=>s(!i);return e.jsxs(be,{position:"relative",children:[e.jsx(L,{onClick:k,rightIcon:e.jsx(ke,{}),leftIcon:o==null?void 0:o.icon,children:o==null?void 0:o.label}),i&&e.jsx(Se,{gap:4,ref:r,mt:"2",shadow:"md",borderWidth:"1px",p:"2",position:"absolute",zIndex:100,children:t.map(h=>e.jsx(L,{onClick:()=>{s(!1),c(h.value)},leftIcon:h.icon,justifyContent:"flex-start",variant:"ghost",width:"full",children:h.label},h.label))})]})}async function Je(t,n,c){const i=await Ce.models.where("fileName").equals(t).toArray()??[];console.log("fetch modeldata",i);const s=i.at(0);return{name:t,nodeType:n,hash:(s==null?void 0:s.fileHash)??null,folder:(s==null?void 0:s.fileFolder)??null,url:s!=null&&s.civitModelVersionID?Ae(s.civitModelVersionID):(s==null?void 0:s.downloadUrl)??null,inputName:c,length:i.length}}async function Ye(t){var p,x;let n=[],c={};const i=[".ckpt",".pt",".bin",".pth",".safetensors"],s=[".jpeg",".jpg",".png",".gif",".webp"],r=(x=(p=P.graph.extra)==null?void 0:p[z])==null?void 0:x.deps,o=await P.graphToPrompt();Object.values(o.output).forEach(a=>{a.inputs&&Object.keys(a.inputs).forEach(R=>{var C,I;const y=(C=a.inputs)==null?void 0:C[R];typeof y=="string"&&(i.some(f=>y.endsWith(f))&&n.push(Je(y,a.class_type,R)),s.some(f=>y.endsWith(f))&&(c[y]=((I=r==null?void 0:r.images)==null?void 0:I[y])??{filename:y,nodeType:a.class_type}))})});const h=await fetch("workspace/fetch_node_repos",{method:"POST",body:JSON.stringify({nodes:t.map(a=>a.type)})}).then(a=>a.ok?a.json():[]).catch(a=>(console.error("Error fetching node repos",a),[])),S=await Promise.all(n),v={};S.forEach(a=>{v[a.name]=a});const w={};return Object.values(h).forEach(a=>{w[a.gitRepo]=a}),{models:v,images:c,nodeRepos:Object.values(w)}}function Qe({deps:t,setDeps:n,uploadingImage:c}){const i=l.useCallback(async()=>{const r=P.graph.serialize();Ye(r.nodes??[]).then(o=>{n(o)})},[]);l.useEffect(()=>{i()},[]);const s=Object.values((t==null?void 0:t.images)??{});return t?e.jsx(W,{gap:5,children:s.length>0&&e.jsxs(W,{children:[e.jsxs(G,{children:[e.jsxs(Ie,{size:"sm",children:["Images (",s.length,")"]}),e.jsx("p",{style:{color:"GrayText"},children:"Will be uploaded as url"})]}),c&&e.jsxs("span",{children:[e.jsx(Z,{size:"md",color:"teal.400"})," Uploading"]}),s.map(r=>e.jsxs(W,{children:[e.jsx("p",{children:r.filename}),e.jsx(He,{width:250,src:`/workspace/view_media?filename=${r.filename}&isPreview=true&isInput=true`})]},r.filename))]})}):e.jsx(Z,{size:"md",color:"teal.400"})}function rs({onClose:t}){var $,B,U,V,K;const[n,c,i]=ee("v"+Xe()),{saveCurWorkflow:s,setRoute:r}=l.useContext(Re),[o,k]=l.useState(),[h,S]=l.useState(!1),[v,w]=l.useState(!1),p=(B=($=H)==null?void 0:$.settings)==null?void 0:B.cloudHost,[x,a,R]=ee("PRIVATE"),[y,C]=l.useState("new_version"),I=l.useRef(""),f=(U=F)==null?void 0:U.curWorkflow,A=De(),[m,j]=l.useState(!0),T=async d=>{var b;const u=d.data;if(u.type!=="share_workflow_success")return;const g=u.localWorkflowID,N=u.version.id,D=u.version.workflowID;D&&g&&await((b=F)==null?void 0:b.updateMetaInfo(g,{cloudID:D,privacy:R.current})),E(),window.open(I.current+"/workflow/"+D+"/"+N,"_blank"),w(!1)};l.useEffect(()=>(E(),window.addEventListener("message",T),()=>{window.removeEventListener("message",T)}),[]);const E=async()=>{var u;const d=await((u=H)==null?void 0:u.getSetting("cloudHost"));d&&(I.current=d),f!=null&&f.cloudID&&f.cloudOrigin&&Fe(f).then(g=>{a(g)})},ie=d=>{navigator.clipboard.writeText(d).then(()=>{A({title:"Copied to clipboard",status:"success",duration:2e3,isClosable:!0})}).catch(u=>{console.error("Failed to copy text: ",u)})},le=async d=>{var J;w(!0);const u=Te(32),g=await((J=H)==null?void 0:J.getSetting("cloudHost"));let N;N=We();const D={id:_e(),workflowID:f.id,name:i.current,createTime:Date.now(),json:d??JSON.stringify(P.graph.serialize())},b=window.location.protocol,O=window.location.host,_=`${b}//${O}`,de=g+`/share_workflow_confirm/${u}?redirectUrl=${_}`,ue=window.open(de,"Share Workflow","width=800,height=800"),q=Y=>{var Q;if(Y.origin===g&&Y.data==="child_ready"){const he=(Q=F)==null?void 0:Q.curWorkflow;ue.postMessage({workflow:he,version:D,nodeDefs:N,privacy:R.current},g),window.removeEventListener("message",q)}};window.addEventListener("message",q)},ce=async()=>{var N,D;S(!0);const d=Object.values((o==null?void 0:o.images)??{}).filter(b=>!b.url).map(b=>b.filename),u=(o==null?void 0:o.images)??{};if(d.length){const O=await(await Pe("/workspace/upload_image",{method:"POST",body:JSON.stringify({images:d})})).json();Object.keys(O).forEach(_=>{u!=null&&u[_]&&(u[_].url=O[_])})}S(!1);const g=P.graph.serialize();(N=g.extra||(g.extra={}))[D=z]||(N[D]={}),g.extra[z].deps={models:(o==null?void 0:o.models)??{},images:u??{},nodeRepos:(o==null?void 0:o.nodeRepos)??[]},await P.graphToPrompt(P.graph).then(b=>{g.extra[z].apiPrompt=b.output}),await s(),le(JSON.stringify(g))},M=(K=(V=F)==null?void 0:V.curWorkflow)==null?void 0:K.cloudID;return e.jsxs(we,{isOpen:!0,onClose:t,size:"lg",children:[e.jsx(xe,{}),e.jsxs(je,{width:["98%","90%","50%"],maxWidth:"600px",children:[e.jsxs(ve,{children:[e.jsxs(se,{justifyContent:"space-between",children:[e.jsxs("p",{children:['Share "',f==null?void 0:f.name,'"']}),e.jsx(L,{colorScheme:"teal",onClick:ce,size:"sm",isDisabled:v,children:v?"Sharing":"Share"})]}),p&&e.jsxs(Me,{fontSize:16,color:"GrayText",fontWeight:400,children:["Share to ",new URL(p).host]})]}),e.jsx(ye,{pb:10,children:e.jsxs(W,{gap:5,children:[M==null?e.jsx(qe,{options:Ee,value:x,onChange:d=>{a(d)}}):e.jsx(Oe,{variant:"outline",borderRadius:"full",width:"fit-content",children:e.jsx(ze,{privacy:x,showEmoji:!0})}),M&&e.jsxs(G,{spacing:2,color:"teal.400",children:[e.jsxs($e,{wordBreak:"break-all",href:p+"/workflow/"+M,isExternal:!0,children:[p+"/workflow/"+M," ",e.jsx(Le,{size:20,style:{display:"inline-block",verticalAlign:"middle"}})]}),e.jsx(L,{size:"sm",leftIcon:e.jsx(Be,{size:18}),onClick:()=>{var d,u;ie(p+"/workflow/"+((u=(d=F)==null?void 0:d.curWorkflow)==null?void 0:u.cloudID))},children:"Copy link"})]}),e.jsx(re,{gap:4,onChange:d=>{C(d)},value:y,children:e.jsx(W,{children:e.jsxs(G,{mb:5,alignItems:"center",children:[e.jsx(Ne,{value:n,width:"60%",onFocus:()=>{C("new_version")},onChange:d=>{c(d.target.value)}}),e.jsx(se,{color:"green",children:e.jsx(ne,{colorScheme:"purple",children:"Version Name"})})]})})}),e.jsxs(W,{borderRadius:6,borderWidth:"1px",p:2,children:[e.jsx(Ge,{isChecked:m,onChange:()=>j(!m),fontWeight:"600",children:"Share input images"}),e.jsxs("span",{style:{color:"GrayText"},children:["If enabled your input images will be uploaded and shared to"," ",p]}),e.jsx(Qe,{deps:o??null,setDeps:k,uploadingImage:h})]})]})})]})]})}function Xe(){const t=new Date,n=t.getFullYear(),c=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${n}-${c}-${i}`}export{rs as default}; diff --git a/dist/workspace_web/SpotlightSearch-crj3ER75.js b/dist/workspace_web/SpotlightSearch-crj3ER75.js new file mode 100644 index 0000000..18a83a9 --- /dev/null +++ b/dist/workspace_web/SpotlightSearch-crj3ER75.js @@ -0,0 +1 @@ +import{b as X,f as L,k as Z,o as $,e as w,r as g,j as n,g as A,Z as q,M as J,O as Q,a0 as ee,h as te}from"./input.js";import{aC as ne,aj as se,X as re,ay as T,ag as G,H as ae,j as oe,h as O,a1 as ie,x as ce,a2 as le,E as ue,k as D}from"./App-1AImvRpr.js";import{u as pe}from"./useDebounceFn-ld478fd0.js";import{I as de}from"./IconSearch-qxAzDzhT.js";import{V as he}from"./chunk-NTCQBYKE-HH_ifqNx.js";var[me,ge]=X({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),M=L(function(a,u){const r=Z("Input",a),{children:c,className:l,...I}=$(a),x=w("chakra-input__group",l),t={},E=ne(c),o=r.field;E.forEach(s=>{var p,y;r&&(o&&s.type.id==="InputLeftElement"&&(t.paddingStart=(p=o.height)!=null?p:o.h),o&&s.type.id==="InputRightElement"&&(t.paddingEnd=(y=o.height)!=null?y:o.h),s.type.id==="InputRightAddon"&&(t.borderEndRadius=0),s.type.id==="InputLeftAddon"&&(t.borderStartRadius=0))});const f=E.map(s=>{var p,y;const R=se({size:((p=s.props)==null?void 0:p.size)||a.size,variant:((y=s.props)==null?void 0:y.variant)||a.variant});return s.type.id!=="Input"?g.cloneElement(s,R):g.cloneElement(s,Object.assign(R,t,s.props))});return n.jsx(A.div,{className:x,ref:u,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...I,children:n.jsx(me,{value:r,children:f})})});M.displayName="InputGroup";var Se=A("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),C=L(function(a,u){var r,c;const{placement:l="left",...I}=a,x=ge(),t=x.field,o={[l==="left"?"insetStart":"insetEnd"]:"0",width:(r=t==null?void 0:t.height)!=null?r:t==null?void 0:t.h,height:(c=t==null?void 0:t.height)!=null?c:t==null?void 0:t.h,fontSize:t==null?void 0:t.fontSize,...x.element};return n.jsx(Se,{ref:u,__css:o,...I})});C.id="InputElement";C.displayName="InputElement";var P=L(function(a,u){const{className:r,...c}=a,l=w("chakra-input__left-element",r);return n.jsx(C,{ref:u,placement:"left",className:l,...c})});P.id="InputLeftElement";P.displayName="InputLeftElement";var K=L(function(a,u){const{className:r,...c}=a,l=w("chakra-input__right-element",r);return n.jsx(C,{ref:u,placement:"right",className:l,...c})});K.id="InputRightElement";K.displayName="InputRightElement";function Ie(){const{colorMode:S}=q(),{loadWorkflowID:a,setRoute:u}=g.useContext(re),[r,c]=g.useState([]),[l,I,x]=T(""),t=g.useRef([]),[E,o,f]=T([]),[s,p]=g.useState(!1),[y,R,b]=T(0),v=g.useRef({lastPressedKey:"",spotlightSearchShortcutFirstKey:"",spotlightSearchShortcutLastKey:""}),z=()=>{u("root")},_=e=>{a(e.id),z()},H=()=>{const e=r.filter(i=>!!i.name.toLocaleLowerCase().includes(x.current.toLocaleLowerCase()));o(e),R(0),p(!1)},[U,W]=pe(H,300),V=e=>{I(e.target.value),e.target.value?(U(),!s&&p(!0)):(p(!1),W(),o(t.current))},B=()=>s?null:l&&E.length===0?n.jsx(O,{ml:2,children:"No matching results"}):n.jsx(n.Fragment,{children:E.map((e,i)=>n.jsxs(te,{colorScheme:"teal",variant:"ghost",size:"sm",justifyContent:"start",px:2,color:S==="light"?"#1A202C":"rgba(255, 255, 255, 0.92)",onClick:()=>{_(e)},minH:"26px",isActive:i===y,children:[e.name,e.updateTime&&n.jsxs(O,{color:S==="light"?"GrayText":"rgb(255, 255, 255, 0.6)",ml:2,fontSize:"sm",children:["Updated: ",ie(e.updateTime)]})]},e.id))}),Y=async()=>{var k;const e=h=>h.map(m=>({type:"workflow",updateTime:(m==null?void 0:m.updateTime)??Date.now(),id:m.id,name:m.name.replace(/\.json$/,"")}))??[],i=await((k=ce)==null?void 0:k.listAll(le.RECENTLY_OPENED))??[];c(e(i));const d=e(i.slice(0,20));t.current=d,o(d)},N=e=>{R(i=>{const d=i+e;return d<0?f.current.length-1:d>f.current.length-1?0:d})};return g.useEffect(()=>{var k;Y(),(k=D)==null||k.getSetting("shortcuts").then(h=>{var F;const j=(h.openSpotlightSearch??((F=D)==null?void 0:F.defaultSettings.shortcuts.openSpotlightSearch)).split("+");v.current.spotlightSearchShortcutFirstKey=j[0]==="Command"?"Meta":j[0],v.current.spotlightSearchShortcutLastKey=j[j.length-1]});const e=h=>{h.key===v.current.spotlightSearchShortcutFirstKey&&v.current.lastPressedKey===v.current.spotlightSearchShortcutLastKey&&b.current>0&&f.current[b.current]&&_(f.current[b.current])},i=h=>{const m=h.key.toUpperCase();switch(v.current.lastPressedKey=m,m){case"ARROWDOWN":N(1);break;case"ARROWUP":N(-1);break;case"ENTER":_(f.current[b.current]);break}},d=h=>{switch(h.detail.shortcutType){case ue.openSpotlightSearch:N(1);break}};return document.addEventListener("keyup",e),document.addEventListener("keydown",i),window.addEventListener(G,d),()=>{document.removeEventListener("keyup",e),document.removeEventListener("keydown",i),window.removeEventListener(G,d)}},[]),n.jsx(J,{isOpen:!0,onClose:z,size:"xl",children:n.jsxs(Q,{bg:S==="light"?"rgba(255, 255, 255, 0.8)":"rgb(45, 55, 72, 0.8)",backdropFilter:"auto",backdropBlur:"8px",children:[n.jsxs(ae,{spacing:1,px:4,py:2,borderBottom:"1px",borderColor:"gray.400",children:[n.jsx(de,{size:20}),n.jsxs(M,{children:[n.jsx(oe,{value:l,onChange:V,autoFocus:!0,variant:"unstyled",fontSize:18}),s&&n.jsx(K,{h:"27px",children:n.jsx(ee,{size:"sm"})})]})]}),n.jsx(he,{spacing:1,align:"stretch",px:2,py:2,maxHeight:"calc(100vh - 200px)",overflowY:"auto",children:B()})]})})}export{Ie as default}; diff --git a/dist/workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js b/dist/workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js new file mode 100644 index 0000000..87490be --- /dev/null +++ b/dist/workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js @@ -0,0 +1 @@ +import{f as x,j as l,g as i,e as b,k as C,o as E,l as I,r as f,a3 as P}from"./input.js";import{aa as z}from"./App-1AImvRpr.js";var v=x(function(o,s){const{children:t,placeholder:n,className:r,...a}=o;return l.jsxs(i.select,{...a,ref:s,className:b("chakra-select",r),children:[n&&l.jsx("option",{value:"",children:n}),t]})});v.displayName="SelectField";function F(e,o){const s={},t={};for(const[n,r]of Object.entries(e))o.includes(n)?s[n]=r:t[n]=r;return[s,t]}var H=x((e,o)=>{var s;const t=C("Select",e),{rootProps:n,placeholder:r,icon:a,color:c,height:_,h:d,minH:h,minHeight:y,iconColor:p,iconSize:u,...j}=E(e),[g,N]=F(j,P),m=z(N),k={width:"100%",height:"fit-content",position:"relative",color:c},w={paddingEnd:"2rem",...t.field,_focus:{zIndex:"unset",...(s=t.field)==null?void 0:s._focus}};return l.jsxs(i.div,{className:"chakra-select__wrapper",__css:k,...g,...n,children:[l.jsx(v,{ref:o,height:d??_,minH:h??y,placeholder:r,...m,__css:w,children:e.children}),l.jsx(S,{"data-disabled":I(m.disabled),...(p||c)&&{color:p||c},__css:t.icon,...u&&{fontSize:u},children:a})]})});H.displayName="Select";var M=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),R=i("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),S=e=>{const{children:o=l.jsx(M,{}),...s}=e,t=f.cloneElement(o,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(R,{...s,className:"chakra-select__icon-wrapper",children:f.isValidElement(o)?t:null})};S.displayName="SelectIcon";export{H as S}; diff --git a/dist/workspace_web/chunk-7D6N5TE5-fihyubSX.js b/dist/workspace_web/chunk-7D6N5TE5-fihyubSX.js new file mode 100644 index 0000000..a1a0ab0 --- /dev/null +++ b/dist/workspace_web/chunk-7D6N5TE5-fihyubSX.js @@ -0,0 +1 @@ +import{f as ce,j as W,r as i,y as A,g as oe,d as T,x as ye,l as r,q as m,m as re}from"./input.js";import{ae as pe}from"./App-1AImvRpr.js";var z=ce(function(n,t){const{htmlWidth:o,htmlHeight:d,alt:l,...v}=n;return W.jsx("img",{width:o,height:d,ref:t,alt:l,...v})});z.displayName="NativeImage";function Ee(e){const{loading:n,src:t,srcSet:o,onLoad:d,onError:l,crossOrigin:v,sizes:w,ignoreFallback:L}=e,[h,k]=i.useState("pending");i.useEffect(()=>{k(t?"loading":"pending")},[t]);const f=i.useRef(),I=i.useCallback(()=>{if(!t)return;y();const s=new Image;s.src=t,v&&(s.crossOrigin=v),o&&(s.srcset=o),w&&(s.sizes=w),n&&(s.loading=n),s.onload=p=>{y(),k("loaded"),d==null||d(p)},s.onerror=p=>{y(),k("failed"),l==null||l(p)},f.current=s},[t,v,o,w,d,l,n]),y=()=>{f.current&&(f.current.onload=null,f.current.onerror=null,f.current=null)};return A(()=>{if(!L)return h==="loading"&&I(),()=>{y()}},[h,I,L]),L?"loaded":h}var we=(e,n)=>e!=="loaded"&&n==="beforeLoadOrError"||e==="failed"&&n==="onError";function Le(e,n=[]){const t=Object.assign({},e);for(const o of n)o in t&&delete t[o];return t}var Ce=ce(function(n,t){const{fallbackSrc:o,fallback:d,src:l,srcSet:v,align:w,fit:L,loading:h,ignoreFallback:k,crossOrigin:f,fallbackStrategy:I="beforeLoadOrError",referrerPolicy:y,...s}=n,p=o!==void 0||d!==void 0,P=h!=null||k||!p,B=Ee({...n,crossOrigin:f,ignoreFallback:P}),K=we(B,I),D={ref:t,objectFit:L,objectPosition:w,...P?s:Le(s,["onError","onLoad"])};return K?d||W.jsx(oe.img,{as:z,className:"chakra-image__placeholder",src:o,...D}):W.jsx(oe.img,{as:z,src:l,srcSet:v,crossOrigin:f,loading:h,referrerPolicy:y,className:"chakra-image",...D})});Ce.displayName="Image";var Ie={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},Fe=()=>typeof document<"u",se=!1,M=null,C=!1,$=!1,G=new Set;function J(e,n){G.forEach(t=>t(e,n))}var Se=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function Pe(e){return!(e.metaKey||!Se&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ie(e){C=!0,Pe(e)&&(M="keyboard",J("keyboard",e))}function S(e){if(M="pointer",e.type==="mousedown"||e.type==="pointerdown"){C=!0;const n=e.composedPath?e.composedPath()[0]:e.target;let t=!1;try{t=n.matches(":focus-visible")}catch{}if(t)return;J("pointer",e)}}function De(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function Re(e){De(e)&&(C=!0,M="virtual")}function xe(e){e.target===window||e.target===document||(!C&&!$&&(M="virtual",J("virtual",e)),C=!1,$=!1)}function Me(){C=!1,$=!0}function le(){return M!=="pointer"}function Be(){if(!Fe()||se)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...t){C=!0,e.apply(this,t)},document.addEventListener("keydown",ie,!0),document.addEventListener("keyup",ie,!0),document.addEventListener("click",Re,!0),window.addEventListener("focus",xe,!0),window.addEventListener("blur",Me,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",S,!0),document.addEventListener("pointermove",S,!0),document.addEventListener("pointerup",S,!0)):(document.addEventListener("mousedown",S,!0),document.addEventListener("mousemove",S,!0),document.addEventListener("mouseup",S,!0)),se=!0}function Ke(e){Be(),e(le());const n=()=>e(le());return G.add(n),()=>{G.delete(n)}}function Oe(e,n=[]){const t=Object.assign({},e);for(const o of n)o in t&&delete t[o];return t}function Ue(e={}){const n=pe(e),{isDisabled:t,isReadOnly:o,isRequired:d,isInvalid:l,id:v,onBlur:w,onFocus:L,"aria-describedby":h}=n,{defaultChecked:k,isChecked:f,isFocusable:I,onChange:y,isIndeterminate:s,name:p,value:P,tabIndex:B=void 0,"aria-label":K,"aria-labelledby":D,"aria-invalid":U,...de}=e,V=Oe(de,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),q=T(y),Q=T(w),X=T(L),[O,ue]=i.useState(!1),[E,j]=i.useState(!1),[R,Y]=i.useState(!1),[x,F]=i.useState(!1);i.useEffect(()=>Ke(ue),[]);const b=i.useRef(null),[Z,fe]=i.useState(!0),[me,N]=i.useState(!!k),_=f!==void 0,c=_?f:me,ee=i.useCallback(a=>{if(o||t){a.preventDefault();return}_||N(c?a.target.checked:s?!0:a.target.checked),q==null||q(a)},[o,t,c,_,s,q]);A(()=>{b.current&&(b.current.indeterminate=!!s)},[s]),ye(()=>{t&&j(!1)},[t,j]),A(()=>{const a=b.current;if(!(a!=null&&a.form))return;const u=()=>{N(!!k)};return a.form.addEventListener("reset",u),()=>{var g;return(g=a.form)==null?void 0:g.removeEventListener("reset",u)}},[]);const te=t&&!I,ae=i.useCallback(a=>{a.key===" "&&F(!0)},[F]),ne=i.useCallback(a=>{a.key===" "&&F(!1)},[F]);A(()=>{if(!b.current)return;b.current.checked!==c&&N(b.current.checked)},[b.current]);const ve=i.useCallback((a={},u=null)=>{const g=H=>{E&&H.preventDefault(),F(!0)};return{...a,ref:u,"data-active":r(x),"data-hover":r(R),"data-checked":r(c),"data-focus":r(E),"data-focus-visible":r(E&&O),"data-indeterminate":r(s),"data-disabled":r(t),"data-invalid":r(l),"data-readonly":r(o),"aria-hidden":!0,onMouseDown:m(a.onMouseDown,g),onMouseUp:m(a.onMouseUp,()=>F(!1)),onMouseEnter:m(a.onMouseEnter,()=>Y(!0)),onMouseLeave:m(a.onMouseLeave,()=>Y(!1))}},[x,c,t,E,O,R,s,l,o]),be=i.useCallback((a={},u=null)=>({...a,ref:u,"data-active":r(x),"data-hover":r(R),"data-checked":r(c),"data-focus":r(E),"data-focus-visible":r(E&&O),"data-indeterminate":r(s),"data-disabled":r(t),"data-invalid":r(l),"data-readonly":r(o)}),[x,c,t,E,O,R,s,l,o]),ge=i.useCallback((a={},u=null)=>({...V,...a,ref:re(u,g=>{g&&fe(g.tagName==="LABEL")}),onClick:m(a.onClick,()=>{var g;Z||((g=b.current)==null||g.click(),requestAnimationFrame(()=>{var H;(H=b.current)==null||H.focus({preventScroll:!0})}))}),"data-disabled":r(t),"data-checked":r(c),"data-invalid":r(l)}),[V,t,c,l,Z]),he=i.useCallback((a={},u=null)=>({...a,ref:re(b,u),type:"checkbox",name:p,value:P,id:v,tabIndex:B,onChange:m(a.onChange,ee),onBlur:m(a.onBlur,Q,()=>j(!1)),onFocus:m(a.onFocus,X,()=>j(!0)),onKeyDown:m(a.onKeyDown,ae),onKeyUp:m(a.onKeyUp,ne),required:d,checked:c,disabled:te,readOnly:o,"aria-label":K,"aria-labelledby":D,"aria-invalid":U?!!U:l,"aria-describedby":h,"aria-disabled":t,style:Ie}),[p,P,v,ee,Q,X,ae,ne,d,c,te,o,K,D,U,l,h,t,B]),ke=i.useCallback((a={},u=null)=>({...a,ref:u,onMouseDown:m(a.onMouseDown,je),"data-disabled":r(t),"data-checked":r(c),"data-invalid":r(l)}),[c,t,l]);return{state:{isInvalid:l,isFocused:E,isChecked:c,isActive:x,isHovered:R,isIndeterminate:s,isDisabled:t,isReadOnly:o,isRequired:d},getRootProps:ge,getCheckboxProps:ve,getIndicatorProps:be,getInputProps:he,getLabelProps:ke,htmlProps:V}}function je(e){e.preventDefault(),e.stopPropagation()}export{Ce as I,Ue as u}; diff --git a/dist/workspace_web/chunk-JARCRF6W-UyOcndjS.js b/dist/workspace_web/chunk-JARCRF6W-UyOcndjS.js new file mode 100644 index 0000000..1ef7f96 --- /dev/null +++ b/dist/workspace_web/chunk-JARCRF6W-UyOcndjS.js @@ -0,0 +1 @@ +import{b as D,r as h,j as t,g as i,$ as v,f as j,k as T,o as $,H as B,e as E}from"./input.js";import{u as z}from"./chunk-7D6N5TE5-fihyubSX.js";var[Z,F]=D({name:"CheckboxGroupContext",strict:!1});function M(o){const[s,n]=h.useState(o),[e,r]=h.useState(!1);return o!==s&&(r(!0),n(o)),e}function W(o){return t.jsx(i.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...o,children:t.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function X(o){return t.jsx(i.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...o,children:t.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function H(o){const{isIndeterminate:s,isChecked:n,...e}=o,r=s?X:W;return n||s?t.jsx(i.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:t.jsx(r,{...e})}):null}var L={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},O={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},q=v({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),J=v({from:{opacity:0},to:{opacity:1}}),K=v({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Q=j(function(s,n){const e=F(),r={...e,...s},a=T("Checkbox",r),c=$(s),{spacing:x="0.5rem",className:C,children:m,iconColor:u,iconSize:d,icon:k=t.jsx(H,{}),isChecked:f,isDisabled:g=e==null?void 0:e.isDisabled,onChange:p,inputProps:w,..._}=c;let y=f;e!=null&&e.value&&c.value&&(y=e.value.includes(c.value));let b=p;e!=null&&e.onChange&&c.value&&(b=B(e.onChange,p));const{state:l,getInputProps:A,getCheckboxProps:S,getLabelProps:G,getRootProps:P}=z({..._,isDisabled:g,isChecked:y,onChange:b}),I=M(l.isChecked),R=h.useMemo(()=>({animation:I?l.isIndeterminate?`${J} 20ms linear, ${K} 200ms linear`:`${q} 200ms linear`:void 0,fontSize:d,color:u,...a.icon}),[u,d,I,l.isIndeterminate,a.icon]),N=h.cloneElement(k,{__css:R,isIndeterminate:l.isIndeterminate,isChecked:l.isChecked});return t.jsxs(i.label,{__css:{...O,...a.container},className:E("chakra-checkbox",C),...P(),children:[t.jsx("input",{className:"chakra-checkbox__input",...A(w,n)}),t.jsx(i.span,{__css:{...L,...a.control},className:"chakra-checkbox__control",...S(),children:N}),m&&t.jsx(i.span,{className:"chakra-checkbox__label",...G(),__css:{marginStart:x,...a.label},children:m})]})});Q.displayName="Checkbox";var U=j(function(s,n){const{templateAreas:e,gap:r,rowGap:a,columnGap:c,column:x,row:C,autoFlow:m,autoRows:u,templateRows:d,autoColumns:k,templateColumns:f,...g}=s,p={display:"grid",gridTemplateAreas:e,gridGap:r,gridRowGap:a,gridColumnGap:c,gridAutoColumns:k,gridColumn:x,gridRow:C,gridAutoFlow:m,gridAutoRows:u,gridTemplateRows:d,gridTemplateColumns:f};return t.jsx(i.div,{ref:n,__css:p,...g})});U.displayName="Grid";export{Q as C,U as G}; diff --git a/dist/workspace_web/chunk-NTCQBYKE-HH_ifqNx.js b/dist/workspace_web/chunk-NTCQBYKE-HH_ifqNx.js new file mode 100644 index 0000000..0b92a57 --- /dev/null +++ b/dist/workspace_web/chunk-NTCQBYKE-HH_ifqNx.js @@ -0,0 +1 @@ +import{g as t}from"./App-1AImvRpr.js";import{f as o,j as s}from"./input.js";var e=o((a,r)=>s.jsx(t,{align:"center",...a,direction:"column",ref:r}));e.displayName="VStack";export{e as V}; diff --git a/dist/workspace_web/chunk-VTV6N5LE-7BSZDdqw.js b/dist/workspace_web/chunk-VTV6N5LE-7BSZDdqw.js new file mode 100644 index 0000000..7aff80b --- /dev/null +++ b/dist/workspace_web/chunk-VTV6N5LE-7BSZDdqw.js @@ -0,0 +1 @@ +import{f as l,n as f,o as h,j as e,g as n,e as m,k as y,r as o}from"./input.js";import{u as w}from"./chunk-7D6N5TE5-fihyubSX.js";var N=l(function(a,i){const s=f("Link",a),{className:c,isExternal:t,...r}=h(a);return e.jsx(n.a,{target:t?"_blank":void 0,rel:t?"noopener":void 0,ref:i,className:m("chakra-link",c),...r,__css:s})});N.displayName="Link";var j=l(function(a,i){const s=y("Switch",a),{spacing:c="0.5rem",children:t,...r}=h(a),{getIndicatorProps:u,getInputProps:p,getCheckboxProps:x,getRootProps:_,getLabelProps:g}=w(r),b=o.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...s.container}),[s.container]),S=o.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...s.track}),[s.track]),d=o.useMemo(()=>({userSelect:"none",marginStart:c,...s.label}),[c,s.label]);return e.jsxs(n.label,{..._(),className:m("chakra-switch",a.className),__css:b,children:[e.jsx("input",{className:"chakra-switch__input",...p({},i)}),e.jsx(n.span,{...x(),className:"chakra-switch__track",__css:S,children:e.jsx(n.span,{__css:s.thumb,className:"chakra-switch__thumb",...u()})}),t&&e.jsx(n.span,{className:"chakra-switch__label",...g(),__css:d,children:t})]})});j.displayName="Switch";export{N as L,j as S}; diff --git a/dist/workspace_web/civitUtils-uJNBxoFV.js b/dist/workspace_web/civitUtils-uJNBxoFV.js new file mode 100644 index 0000000..5ec75e1 --- /dev/null +++ b/dist/workspace_web/civitUtils-uJNBxoFV.js @@ -0,0 +1 @@ +import{k as m}from"./App-1AImvRpr.js";const r="WORKSPACE_CIVIT_API_KEY_STORAGE_KEY";function g(){return localStorage.getItem(r)}function h(e){localStorage.setItem(r,e)}function v(e){return`https://civitai.com/api/download/models/${e}`}async function w(e){var s,a,n;try{const l=`https://civitai.com/api/v1/model-versions/by-hash/${e}`,t=await(await fetch(l)).json();let i;if(await((s=m)==null?void 0:s.getSetting("showNsfwModelThumbnail"))===!0)i=(n=(a=t==null?void 0:t.images)==null?void 0:a[0])==null?void 0:n.url;else if(!t.model.nsfw){const o=t.images.find(c=>c.nsfwLevel==1);i=o==null?void 0:o.url}return{modelName:t.model.name,civitModelID:String(t.modelId),civitModelVersionID:String(t.id),imageUrl:i??void 0}}catch{return{}}}export{v as a,w as f,g,h as s}; diff --git a/dist/workspace_web/input.js b/dist/workspace_web/input.js new file mode 100644 index 0000000..ee91be9 --- /dev/null +++ b/dist/workspace_web/input.js @@ -0,0 +1,688 @@ +function Gk(e,t){for(var r=0;rn[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const Kk="modulepreload",Yk=function(e){return"/"+e},im={},Xk=function(t,r,n){if(!r||r.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(r.map(i=>{if(i=Yk(i),i in im)return;im[i]=!0;const a=i.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!n)for(let c=o.length-1;c>=0;c--){const d=o[c];if(d.href===i&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${s}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":Kk,a||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),a)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t()).catch(i=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i})};var os=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var B0={exports:{}},ou={},j0={exports:{}},W={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var za=Symbol.for("react.element"),Qk=Symbol.for("react.portal"),qk=Symbol.for("react.fragment"),Zk=Symbol.for("react.strict_mode"),Jk=Symbol.for("react.profiler"),eC=Symbol.for("react.provider"),tC=Symbol.for("react.context"),rC=Symbol.for("react.forward_ref"),nC=Symbol.for("react.suspense"),oC=Symbol.for("react.memo"),iC=Symbol.for("react.lazy"),am=Symbol.iterator;function aC(e){return e===null||typeof e!="object"?null:(e=am&&e[am]||e["@@iterator"],typeof e=="function"?e:null)}var N0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},V0=Object.assign,W0={};function ei(e,t,r){this.props=e,this.context=t,this.refs=W0,this.updater=r||N0}ei.prototype.isReactComponent={};ei.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ei.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function U0(){}U0.prototype=ei.prototype;function Kf(e,t,r){this.props=e,this.context=t,this.refs=W0,this.updater=r||N0}var Yf=Kf.prototype=new U0;Yf.constructor=Kf;V0(Yf,ei.prototype);Yf.isPureReactComponent=!0;var sm=Array.isArray,H0=Object.prototype.hasOwnProperty,Xf={current:null},G0={key:!0,ref:!0,__self:!0,__source:!0};function K0(e,t,r){var n,o={},i=null,a=null;if(t!=null)for(n in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)H0.call(t,n)&&!G0.hasOwnProperty(n)&&(o[n]=t[n]);var s=arguments.length-2;if(s===1)o.children=r;else if(1>>1,ne=z[B];if(0>>1;Bo(Xt,V))weo(Fe,Xt)?(z[B]=Fe,z[we]=V,B=we):(z[B]=Xt,z[Ge]=V,B=Ge);else if(weo(Fe,V))z[B]=Fe,z[we]=V,B=we;else break e}}return N}function o(z,N){var V=z.sortIndex-N.sortIndex;return V!==0?V:z.id-N.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,p=!1,v=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(z){for(var N=r(u);N!==null;){if(N.callback===null)n(u);else if(N.startTime<=z)n(u),N.sortIndex=N.expirationTime,t(l,N);else break;N=r(u)}}function C(z){if(y=!1,g(z),!v)if(r(l)!==null)v=!0,He(_);else{var N=r(u);N!==null&&it(C,N.startTime-z)}}function _(z,N){v=!1,y&&(y=!1,m(A),A=-1),p=!0;var V=f;try{for(g(N),d=r(l);d!==null&&(!(d.expirationTime>N)||z&&!ee());){var B=d.callback;if(typeof B=="function"){d.callback=null,f=d.priorityLevel;var ne=B(d.expirationTime<=N);N=e.unstable_now(),typeof ne=="function"?d.callback=ne:d===r(l)&&n(l),g(N)}else n(l);d=r(l)}if(d!==null)var U=!0;else{var Ge=r(u);Ge!==null&&it(C,Ge.startTime-N),U=!1}return U}finally{d=null,f=V,p=!1}}var $=!1,T=null,A=-1,M=5,I=-1;function ee(){return!(e.unstable_now()-Iz||125B?(z.sortIndex=V,t(u,z),r(l)===null&&z===r(u)&&(y?(m(A),A=-1):y=!0,it(C,V-B))):(z.sortIndex=ne,t(l,z),v||p||(v=!0,He(_))),z},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(z){var N=f;return function(){var V=f;f=N;try{return z.apply(this,arguments)}finally{f=V}}}})(q0);Q0.exports=q0;var gC=Q0.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Z0=S,wt=gC;function R(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yd=Object.prototype.hasOwnProperty,yC=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,cm={},dm={};function bC(e){return yd.call(dm,e)?!0:yd.call(cm,e)?!1:yC.test(e)?dm[e]=!0:(cm[e]=!0,!1)}function SC(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function xC(e,t,r,n){if(t===null||typeof t>"u"||SC(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function ot(e,t,r,n,o,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=o,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var Ue={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ue[e]=new ot(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ue[t]=new ot(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ue[e]=new ot(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ue[e]=new ot(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ue[e]=new ot(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ue[e]=new ot(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ue[e]=new ot(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ue[e]=new ot(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ue[e]=new ot(e,5,!1,e.toLowerCase(),null,!1,!1)});var qf=/[\-:]([a-z])/g;function Zf(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(qf,Zf);Ue[t]=new ot(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(qf,Zf);Ue[t]=new ot(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(qf,Zf);Ue[t]=new ot(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ue[e]=new ot(e,1,!1,e.toLowerCase(),null,!1,!1)});Ue.xlinkHref=new ot("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ue[e]=new ot(e,1,!1,e.toLowerCase(),null,!0,!0)});function Jf(e,t,r,n){var o=Ue.hasOwnProperty(t)?Ue[t]:null;(o!==null?o.type!==0:n||!(2s||o[a]!==i[s]){var l=` +`+o[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{lc=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Ci(e):""}function wC(e){switch(e.tag){case 5:return Ci(e.type);case 16:return Ci("Lazy");case 13:return Ci("Suspense");case 19:return Ci("SuspenseList");case 0:case 2:case 15:return e=uc(e.type,!1),e;case 11:return e=uc(e.type.render,!1),e;case 1:return e=uc(e.type,!0),e;default:return""}}function wd(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case io:return"Fragment";case oo:return"Portal";case bd:return"Profiler";case eh:return"StrictMode";case Sd:return"Suspense";case xd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ty:return(e.displayName||"Context")+".Consumer";case ey:return(e._context.displayName||"Context")+".Provider";case th:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case rh:return t=e.displayName||null,t!==null?t:wd(e.type)||"Memo";case Wr:t=e._payload,e=e._init;try{return wd(e(t))}catch{}}return null}function kC(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return wd(t);case 8:return t===eh?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ln(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ny(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function CC(e){var t=ny(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ss(e){e._valueTracker||(e._valueTracker=CC(e))}function oy(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=ny(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function pl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function kd(e,t){var r=t.checked;return be({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function hm(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=ln(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function iy(e,t){t=t.checked,t!=null&&Jf(e,"checked",t,!1)}function Cd(e,t){iy(e,t);var r=ln(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?_d(e,t.type,r):t.hasOwnProperty("defaultValue")&&_d(e,t.type,ln(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function pm(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function _d(e,t,r){(t!=="number"||pl(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var _i=Array.isArray;function Eo(e,t,r,n){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=ls.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function na(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Li={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},_C=["Webkit","ms","Moz","O"];Object.keys(Li).forEach(function(e){_C.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Li[t]=Li[e]})});function uy(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Li.hasOwnProperty(e)&&Li[e]?(""+t).trim():t+"px"}function cy(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=uy(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,o):e[r]=o}}var PC=be({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ed(e,t){if(t){if(PC[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(R(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(R(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(R(61))}if(t.style!=null&&typeof t.style!="object")throw Error(R(62))}}function $d(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ad=null;function nh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Rd=null,$o=null,Ao=null;function gm(e){if(e=Ia(e)){if(typeof Rd!="function")throw Error(R(280));var t=e.stateNode;t&&(t=uu(t),Rd(e.stateNode,e.type,t))}}function dy(e){$o?Ao?Ao.push(e):Ao=[e]:$o=e}function fy(){if($o){var e=$o,t=Ao;if(Ao=$o=null,gm(e),t)for(e=0;e>>=0,e===0?32:31-(LC(e)/OC|0)|0}var us=64,cs=4194304;function Pi(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function yl(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,o=e.suspendedLanes,i=e.pingedLanes,a=r&268435455;if(a!==0){var s=a&~o;s!==0?n=Pi(s):(i&=a,i!==0&&(n=Pi(i)))}else a=r&~o,a!==0?n=Pi(a):i!==0&&(n=Pi(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&o)&&(o=n&-n,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function Fa(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ht(t),e[t]=r}function VC(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=Bi),Pm=" ",Tm=!1;function My(e,t){switch(e){case"keyup":return v2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zy(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ao=!1;function y2(e,t){switch(e){case"compositionend":return zy(t);case"keypress":return t.which!==32?null:(Tm=!0,Pm);case"textInput":return e=t.data,e===Pm&&Tm?null:e;default:return null}}function b2(e,t){if(ao)return e==="compositionend"||!dh&&My(e,t)?(e=Ay(),Vs=lh=Xr=null,ao=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Rm(r)}}function Ly(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ly(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Oy(){for(var e=window,t=pl();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=pl(e.document)}return t}function fh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function E2(e){var t=Oy(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Ly(r.ownerDocument.documentElement,r)){if(n!==null&&fh(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=r.textContent.length,i=Math.min(n.start,o);n=n.end===void 0?i:Math.min(n.end,o),!e.extend&&i>n&&(o=n,n=i,i=o),o=Mm(r,i);var a=Mm(r,n);o&&a&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,so=null,Ld=null,Ni=null,Od=!1;function zm(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Od||so==null||so!==pl(n)||(n=so,"selectionStart"in n&&fh(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Ni&&ua(Ni,n)||(Ni=n,n=xl(Ld,"onSelect"),0co||(e.current=Ud[co],Ud[co]=null,co--)}function ae(e,t){co++,Ud[co]=e.current,e.current=t}var un={},qe=hn(un),ut=hn(!1),jn=un;function Wo(e,t){var r=e.type.contextTypes;if(!r)return un;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in r)o[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function ct(e){return e=e.childContextTypes,e!=null}function kl(){fe(ut),fe(qe)}function jm(e,t,r){if(qe.current!==un)throw Error(R(168));ae(qe,t),ae(ut,r)}function Ky(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var o in n)if(!(o in t))throw Error(R(108,kC(e)||"Unknown",o));return be({},r,n)}function Cl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||un,jn=qe.current,ae(qe,e),ae(ut,ut.current),!0}function Nm(e,t,r){var n=e.stateNode;if(!n)throw Error(R(169));r?(e=Ky(e,t,jn),n.__reactInternalMemoizedMergedChildContext=e,fe(ut),fe(qe),ae(qe,e)):fe(ut),ae(ut,r)}var br=null,cu=!1,kc=!1;function Yy(e){br===null?br=[e]:br.push(e)}function j2(e){cu=!0,Yy(e)}function pn(){if(!kc&&br!==null){kc=!0;var e=0,t=te;try{var r=br;for(te=1;e>=a,o-=a,wr=1<<32-Ht(t)+o|r<A?(M=T,T=null):M=T.sibling;var I=f(m,T,g[A],C);if(I===null){T===null&&(T=M);break}e&&T&&I.alternate===null&&t(m,T),h=i(I,h,A),$===null?_=I:$.sibling=I,$=I,T=M}if(A===g.length)return r(m,T),me&&xn(m,A),_;if(T===null){for(;AA?(M=T,T=null):M=T.sibling;var ee=f(m,T,I.value,C);if(ee===null){T===null&&(T=M);break}e&&T&&ee.alternate===null&&t(m,T),h=i(ee,h,A),$===null?_=ee:$.sibling=ee,$=ee,T=M}if(I.done)return r(m,T),me&&xn(m,A),_;if(T===null){for(;!I.done;A++,I=g.next())I=d(m,I.value,C),I!==null&&(h=i(I,h,A),$===null?_=I:$.sibling=I,$=I);return me&&xn(m,A),_}for(T=n(m,T);!I.done;A++,I=g.next())I=p(T,m,A,I.value,C),I!==null&&(e&&I.alternate!==null&&T.delete(I.key===null?A:I.key),h=i(I,h,A),$===null?_=I:$.sibling=I,$=I);return e&&T.forEach(function(ze){return t(m,ze)}),me&&xn(m,A),_}function x(m,h,g,C){if(typeof g=="object"&&g!==null&&g.type===io&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case as:e:{for(var _=g.key,$=h;$!==null;){if($.key===_){if(_=g.type,_===io){if($.tag===7){r(m,$.sibling),h=o($,g.props.children),h.return=m,m=h;break e}}else if($.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Wr&&Ym(_)===$.type){r(m,$.sibling),h=o($,g.props),h.ref=mi(m,$,g),h.return=m,m=h;break e}r(m,$);break}else t(m,$);$=$.sibling}g.type===io?(h=Fn(g.props.children,m.mode,C,g.key),h.return=m,m=h):(C=Qs(g.type,g.key,g.props,null,m.mode,C),C.ref=mi(m,h,g),C.return=m,m=C)}return a(m);case oo:e:{for($=g.key;h!==null;){if(h.key===$)if(h.tag===4&&h.stateNode.containerInfo===g.containerInfo&&h.stateNode.implementation===g.implementation){r(m,h.sibling),h=o(h,g.children||[]),h.return=m,m=h;break e}else{r(m,h);break}else t(m,h);h=h.sibling}h=Rc(g,m.mode,C),h.return=m,m=h}return a(m);case Wr:return $=g._init,x(m,h,$(g._payload),C)}if(_i(g))return v(m,h,g,C);if(ci(g))return y(m,h,g,C);gs(m,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,h!==null&&h.tag===6?(r(m,h.sibling),h=o(h,g),h.return=m,m=h):(r(m,h),h=Ac(g,m.mode,C),h.return=m,m=h),a(m)):r(m,h)}return x}var Ho=r1(!0),n1=r1(!1),La={},cr=hn(La),ha=hn(La),pa=hn(La);function An(e){if(e===La)throw Error(R(174));return e}function xh(e,t){switch(ae(pa,t),ae(ha,e),ae(cr,La),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Td(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Td(t,e)}fe(cr),ae(cr,t)}function Go(){fe(cr),fe(ha),fe(pa)}function o1(e){An(pa.current);var t=An(cr.current),r=Td(t,e.type);t!==r&&(ae(ha,e),ae(cr,r))}function wh(e){ha.current===e&&(fe(cr),fe(ha))}var ve=hn(0);function Al(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Cc=[];function kh(){for(var e=0;er?r:4,e(!0);var n=_c.transition;_c.transition={};try{e(!1),t()}finally{te=r,_c.transition=n}}function S1(){return Lt().memoizedState}function U2(e,t,r){var n=nn(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},x1(e))w1(t,r);else if(r=Zy(e,t,r,n),r!==null){var o=tt();Gt(r,e,n,o),k1(r,t,n)}}function H2(e,t,r){var n=nn(e),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(x1(e))w1(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,s=i(a,r);if(o.hasEagerState=!0,o.eagerState=s,Yt(s,a)){var l=t.interleaved;l===null?(o.next=o,bh(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}r=Zy(e,t,o,n),r!==null&&(o=tt(),Gt(r,e,n,o),k1(r,t,n))}}function x1(e){var t=e.alternate;return e===ye||t!==null&&t===ye}function w1(e,t){Vi=Rl=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function k1(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,ih(e,r)}}var Ml={readContext:It,useCallback:Ke,useContext:Ke,useEffect:Ke,useImperativeHandle:Ke,useInsertionEffect:Ke,useLayoutEffect:Ke,useMemo:Ke,useReducer:Ke,useRef:Ke,useState:Ke,useDebugValue:Ke,useDeferredValue:Ke,useTransition:Ke,useMutableSource:Ke,useSyncExternalStore:Ke,useId:Ke,unstable_isNewReconciler:!1},G2={readContext:It,useCallback:function(e,t){return er().memoizedState=[e,t===void 0?null:t],e},useContext:It,useEffect:Qm,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Gs(4194308,4,m1.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Gs(4194308,4,e,t)},useInsertionEffect:function(e,t){return Gs(4,2,e,t)},useMemo:function(e,t){var r=er();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=er();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=U2.bind(null,ye,e),[n.memoizedState,e]},useRef:function(e){var t=er();return e={current:e},t.memoizedState=e},useState:Xm,useDebugValue:Eh,useDeferredValue:function(e){return er().memoizedState=e},useTransition:function(){var e=Xm(!1),t=e[0];return e=W2.bind(null,e[1]),er().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ye,o=er();if(me){if(r===void 0)throw Error(R(407));r=r()}else{if(r=t(),Le===null)throw Error(R(349));Vn&30||s1(n,t,r)}o.memoizedState=r;var i={value:r,getSnapshot:t};return o.queue=i,Qm(u1.bind(null,n,i,e),[e]),n.flags|=2048,ga(9,l1.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=er(),t=Le.identifierPrefix;if(me){var r=kr,n=wr;r=(n&~(1<<32-Ht(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=ma++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=a.createElement(r,{is:n.is}):(e=a.createElement(r),r==="select"&&(a=e,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):e=a.createElementNS(e,r),e[ir]=t,e[fa]=n,M1(e,t,!1,!1),t.stateNode=e;e:{switch(a=$d(r,n),r){case"dialog":ce("cancel",e),ce("close",e),o=n;break;case"iframe":case"object":case"embed":ce("load",e),o=n;break;case"video":case"audio":for(o=0;oYo&&(t.flags|=128,n=!0,vi(i,!1),t.lanes=4194304)}else{if(!n)if(e=Al(a),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),vi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!me)return Ye(t),null}else 2*ke()-i.renderingStartTime>Yo&&r!==1073741824&&(t.flags|=128,n=!0,vi(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(r=i.last,r!==null?r.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ke(),t.sibling=null,r=ve.current,ae(ve,n?r&1|2:r&1),t):(Ye(t),null);case 22:case 23:return Fh(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?gt&1073741824&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),null;case 24:return null;case 25:return null}throw Error(R(156,t.tag))}function e_(e,t){switch(ph(t),t.tag){case 1:return ct(t.type)&&kl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Go(),fe(ut),fe(qe),kh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return wh(t),null;case 13:if(fe(ve),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(R(340));Uo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fe(ve),null;case 4:return Go(),null;case 10:return yh(t.type._context),null;case 22:case 23:return Fh(),null;case 24:return null;default:return null}}var bs=!1,Qe=!1,t_=typeof WeakSet=="function"?WeakSet:Set,D=null;function mo(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Se(e,t,n)}else r.current=null}function rf(e,t,r){try{r()}catch(n){Se(e,t,n)}}var iv=!1;function r_(e,t){if(Bd=bl,e=Oy(),fh(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var o=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var a=0,s=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var p;d!==r||o!==0&&d.nodeType!==3||(s=a+o),d!==i||n!==0&&d.nodeType!==3||(l=a+n),d.nodeType===3&&(a+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===e)break t;if(f===r&&++u===o&&(s=a),f===i&&++c===n&&(l=a),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}r=s===-1||l===-1?null:{start:s,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(jd={focusedElem:e,selectionRange:r},bl=!1,D=t;D!==null;)if(t=D,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,D=e;else for(;D!==null;){t=D;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var y=v.memoizedProps,x=v.memoizedState,m=t.stateNode,h=m.getSnapshotBeforeUpdate(t.elementType===t.type?y:Nt(t.type,y),x);m.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(R(163))}}catch(C){Se(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,D=e;break}D=t.return}return v=iv,iv=!1,v}function Wi(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&rf(t,r,i)}o=o.next}while(o!==n)}}function hu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function nf(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function D1(e){var t=e.alternate;t!==null&&(e.alternate=null,D1(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ir],delete t[fa],delete t[Wd],delete t[O2],delete t[B2])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function I1(e){return e.tag===5||e.tag===3||e.tag===4}function av(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||I1(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function of(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=wl));else if(n!==4&&(e=e.child,e!==null))for(of(e,t,r),e=e.sibling;e!==null;)of(e,t,r),e=e.sibling}function af(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(af(e,t,r),e=e.sibling;e!==null;)af(e,t,r),e=e.sibling}var Ne=null,Vt=!1;function Or(e,t,r){for(r=r.child;r!==null;)L1(e,t,r),r=r.sibling}function L1(e,t,r){if(ur&&typeof ur.onCommitFiberUnmount=="function")try{ur.onCommitFiberUnmount(iu,r)}catch{}switch(r.tag){case 5:Qe||mo(r,t);case 6:var n=Ne,o=Vt;Ne=null,Or(e,t,r),Ne=n,Vt=o,Ne!==null&&(Vt?(e=Ne,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ne.removeChild(r.stateNode));break;case 18:Ne!==null&&(Vt?(e=Ne,r=r.stateNode,e.nodeType===8?wc(e.parentNode,r):e.nodeType===1&&wc(e,r),sa(e)):wc(Ne,r.stateNode));break;case 4:n=Ne,o=Vt,Ne=r.stateNode.containerInfo,Vt=!0,Or(e,t,r),Ne=n,Vt=o;break;case 0:case 11:case 14:case 15:if(!Qe&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){o=n=n.next;do{var i=o,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&rf(r,t,a),o=o.next}while(o!==n)}Or(e,t,r);break;case 1:if(!Qe&&(mo(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Se(r,t,s)}Or(e,t,r);break;case 21:Or(e,t,r);break;case 22:r.mode&1?(Qe=(n=Qe)||r.memoizedState!==null,Or(e,t,r),Qe=n):Or(e,t,r);break;default:Or(e,t,r)}}function sv(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new t_),t.forEach(function(n){var o=d_.bind(null,e,n);r.has(n)||(r.add(n),n.then(o,o))})}}function Bt(e,t){var r=t.deletions;if(r!==null)for(var n=0;no&&(o=a),n&=~i}if(n=o,n=ke()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*o_(n/1960))-n,10e?16:e,Qr===null)var n=!1;else{if(e=Qr,Qr=null,Dl=0,Y&6)throw Error(R(331));var o=Y;for(Y|=4,D=e.current;D!==null;){var i=D,a=i.child;if(D.flags&16){var s=i.deletions;if(s!==null){for(var l=0;lke()-Mh?zn(e,0):Rh|=r),dt(e,t)}function H1(e,t){t===0&&(e.mode&1?(t=cs,cs<<=1,!(cs&130023424)&&(cs=4194304)):t=1);var r=tt();e=zr(e,t),e!==null&&(Fa(e,t,r),dt(e,r))}function c_(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),H1(e,r)}function d_(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,o=e.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(R(314))}n!==null&&n.delete(t),H1(e,r)}var G1;G1=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||ut.current)lt=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return lt=!1,Z2(e,t,r);lt=!!(e.flags&131072)}else lt=!1,me&&t.flags&1048576&&Xy(t,Pl,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Ks(e,t),e=t.pendingProps;var o=Wo(t,qe.current);Mo(t,r),o=_h(null,t,n,e,o,r);var i=Ph();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ct(n)?(i=!0,Cl(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Sh(t),o.updater=du,t.stateNode=o,o._reactInternals=t,Xd(t,n,e,r),t=Zd(null,t,n,!0,i,r)):(t.tag=0,me&&i&&hh(t),Je(null,t,o,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Ks(e,t),e=t.pendingProps,o=n._init,n=o(n._payload),t.type=n,o=t.tag=h_(n),e=Nt(n,e),o){case 0:t=qd(null,t,n,e,r);break e;case 1:t=rv(null,t,n,e,r);break e;case 11:t=ev(null,t,n,e,r);break e;case 14:t=tv(null,t,n,Nt(n.type,e),r);break e}throw Error(R(306,n,""))}return t;case 0:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Nt(n,o),qd(e,t,n,o,r);case 1:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Nt(n,o),rv(e,t,n,o,r);case 3:e:{if($1(t),e===null)throw Error(R(387));n=t.pendingProps,i=t.memoizedState,o=i.element,Jy(e,t),$l(t,n,null,r);var a=t.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Ko(Error(R(423)),t),t=nv(e,t,n,r,o);break e}else if(n!==o){o=Ko(Error(R(424)),t),t=nv(e,t,n,r,o);break e}else for(yt=en(t.stateNode.containerInfo.firstChild),bt=t,me=!0,Wt=null,r=n1(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Uo(),n===o){t=Fr(e,t,r);break e}Je(e,t,n,r)}t=t.child}return t;case 5:return o1(t),e===null&&Gd(t),n=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,a=o.children,Nd(n,o)?a=null:i!==null&&Nd(n,i)&&(t.flags|=32),E1(e,t),Je(e,t,a,r),t.child;case 6:return e===null&&Gd(t),null;case 13:return A1(e,t,r);case 4:return xh(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ho(t,null,n,r):Je(e,t,n,r),t.child;case 11:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Nt(n,o),ev(e,t,n,o,r);case 7:return Je(e,t,t.pendingProps,r),t.child;case 8:return Je(e,t,t.pendingProps.children,r),t.child;case 12:return Je(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,o=t.pendingProps,i=t.memoizedProps,a=o.value,ae(Tl,n._currentValue),n._currentValue=a,i!==null)if(Yt(i.value,a)){if(i.children===o.children&&!ut.current){t=Fr(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){a=i.child;for(var l=s.firstContext;l!==null;){if(l.context===n){if(i.tag===1){l=Pr(-1,r&-r),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),Kd(i.return,r,t),s.lanes|=r;break}l=l.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(R(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),Kd(a,r,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Je(e,t,o.children,r),t=t.child}return t;case 9:return o=t.type,n=t.pendingProps.children,Mo(t,r),o=It(o),n=n(o),t.flags|=1,Je(e,t,n,r),t.child;case 14:return n=t.type,o=Nt(n,t.pendingProps),o=Nt(n.type,o),tv(e,t,n,o,r);case 15:return P1(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Nt(n,o),Ks(e,t),t.tag=1,ct(n)?(e=!0,Cl(t)):e=!1,Mo(t,r),t1(t,n,o),Xd(t,n,o,r),Zd(null,t,n,!0,e,r);case 19:return R1(e,t,r);case 22:return T1(e,t,r)}throw Error(R(156,t.tag))};function K1(e,t){return by(e,t)}function f_(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zt(e,t,r,n){return new f_(e,t,r,n)}function Ih(e){return e=e.prototype,!(!e||!e.isReactComponent)}function h_(e){if(typeof e=="function")return Ih(e)?1:0;if(e!=null){if(e=e.$$typeof,e===th)return 11;if(e===rh)return 14}return 2}function on(e,t){var r=e.alternate;return r===null?(r=zt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Qs(e,t,r,n,o,i){var a=2;if(n=e,typeof e=="function")Ih(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case io:return Fn(r.children,o,i,t);case eh:a=8,o|=8;break;case bd:return e=zt(12,r,t,o|2),e.elementType=bd,e.lanes=i,e;case Sd:return e=zt(13,r,t,o),e.elementType=Sd,e.lanes=i,e;case xd:return e=zt(19,r,t,o),e.elementType=xd,e.lanes=i,e;case ry:return mu(r,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ey:a=10;break e;case ty:a=9;break e;case th:a=11;break e;case rh:a=14;break e;case Wr:a=16,n=null;break e}throw Error(R(130,e==null?e:typeof e,""))}return t=zt(a,r,t,o),t.elementType=e,t.type=n,t.lanes=i,t}function Fn(e,t,r,n){return e=zt(7,e,n,t),e.lanes=r,e}function mu(e,t,r,n){return e=zt(22,e,n,t),e.elementType=ry,e.lanes=r,e.stateNode={isHidden:!1},e}function Ac(e,t,r){return e=zt(6,e,null,t),e.lanes=r,e}function Rc(e,t,r){return t=zt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function p_(e,t,r,n,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=dc(0),this.expirationTimes=dc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dc(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Lh(e,t,r,n,o,i,a,s,l){return e=new p_(e,t,r,s,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=zt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sh(i),e}function m_(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(q1)}catch(e){console.error(e)}}q1(),X0.exports=Ct;var Nh=X0.exports,mv=Nh;gd.createRoot=mv.createRoot,gd.hydrateRoot=mv.hydrateRoot;function S_(e){if(e.sheet)return e.sheet;for(var t=0;t0?Ve(ni,--ft):0,Xo--,Ee===10&&(Xo=1,xu--),Ee}function St(){return Ee=ft2||Sa(Ee)>3?"":" "}function z_(e,t){for(;--t&&St()&&!(Ee<48||Ee>102||Ee>57&&Ee<65||Ee>70&&Ee<97););return Oa(e,qs()+(t<6&&dr()==32&&St()==32))}function ff(e){for(;St();)switch(Ee){case e:return ft;case 34:case 39:e!==34&&e!==39&&ff(Ee);break;case 40:e===41&&ff(e);break;case 92:St();break}return ft}function F_(e,t){for(;St()&&e+Ee!==57;)if(e+Ee===84&&dr()===47)break;return"/*"+Oa(t,ft-1)+"*"+Su(e===47?e:St())}function D_(e){for(;!Sa(dr());)St();return Oa(e,ft)}function I_(e){return nb(Js("",null,null,null,[""],e=rb(e),0,[0],e))}function Js(e,t,r,n,o,i,a,s,l){for(var u=0,c=0,d=a,f=0,p=0,v=0,y=1,x=1,m=1,h=0,g="",C=o,_=i,$=n,T=g;x;)switch(v=h,h=St()){case 40:if(v!=108&&Ve(T,d-1)==58){df(T+=q(Zs(h),"&","&\f"),"&\f")!=-1&&(m=-1);break}case 34:case 39:case 91:T+=Zs(h);break;case 9:case 10:case 13:case 32:T+=M_(v);break;case 92:T+=z_(qs()-1,7);continue;case 47:switch(dr()){case 42:case 47:ws(L_(F_(St(),qs()),t,r),l);break;default:T+="/"}break;case 123*y:s[u++]=nr(T)*m;case 125*y:case 59:case 0:switch(h){case 0:case 125:x=0;case 59+c:m==-1&&(T=q(T,/\f/g,"")),p>0&&nr(T)-d&&ws(p>32?gv(T+";",n,r,d-1):gv(q(T," ","")+";",n,r,d-2),l);break;case 59:T+=";";default:if(ws($=vv(T,t,r,u,c,o,s,g,C=[],_=[],d),i),h===123)if(c===0)Js(T,t,$,$,C,i,d,s,_);else switch(f===99&&Ve(T,3)===110?100:f){case 100:case 108:case 109:case 115:Js(e,$,$,n&&ws(vv(e,$,$,0,0,o,s,g,o,C=[],d),_),o,_,d,s,n?C:_);break;default:Js(T,$,$,$,[""],_,0,s,_)}}u=c=p=0,y=m=1,g=T="",d=a;break;case 58:d=1+nr(T),p=v;default:if(y<1){if(h==123)--y;else if(h==125&&y++==0&&R_()==125)continue}switch(T+=Su(h),h*y){case 38:m=c>0?1:(T+="\f",-1);break;case 44:s[u++]=(nr(T)-1)*m,m=1;break;case 64:dr()===45&&(T+=Zs(St())),f=dr(),c=d=nr(g=T+=D_(qs())),h++;break;case 45:v===45&&nr(T)==2&&(y=0)}}return i}function vv(e,t,r,n,o,i,a,s,l,u,c){for(var d=o-1,f=o===0?i:[""],p=Uh(f),v=0,y=0,x=0;v0?f[m]+" "+h:q(h,/&\f/g,f[m])))&&(l[x++]=g);return wu(e,t,r,o===0?Vh:s,l,u,c)}function L_(e,t,r){return wu(e,t,r,Z1,Su(A_()),ba(e,2,-2),0)}function gv(e,t,r,n){return wu(e,t,r,Wh,ba(e,0,n),ba(e,n+1,-1),n)}function Fo(e,t){for(var r="",n=Uh(e),o=0;o6)switch(Ve(e,t+1)){case 109:if(Ve(e,t+4)!==45)break;case 102:return q(e,/(.+:)(.+)-([^]+)/,"$1"+Q+"$2-$3$1"+Ol+(Ve(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~df(e,"stretch")?ib(q(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ve(e,t+1)!==115)break;case 6444:switch(Ve(e,nr(e)-3-(~df(e,"!important")&&10))){case 107:return q(e,":",":"+Q)+e;case 101:return q(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Q+(Ve(e,14)===45?"inline-":"")+"box$3$1"+Q+"$2$3$1"+Xe+"$2box$3")+e}break;case 5936:switch(Ve(e,t+11)){case 114:return Q+e+Xe+q(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Q+e+Xe+q(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Q+e+Xe+q(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Q+e+Xe+e+e}return e}var G_=function(t,r,n,o){if(t.length>-1&&!t.return)switch(t.type){case Wh:t.return=ib(t.value,t.length);break;case J1:return Fo([yi(t,{value:q(t.value,"@","@"+Q)})],o);case Vh:if(t.length)return $_(t.props,function(i){switch(E_(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Fo([yi(t,{props:[q(i,/:(read-\w+)/,":"+Ol+"$1")]})],o);case"::placeholder":return Fo([yi(t,{props:[q(i,/:(plac\w+)/,":"+Q+"input-$1")]}),yi(t,{props:[q(i,/:(plac\w+)/,":"+Ol+"$1")]}),yi(t,{props:[q(i,/:(plac\w+)/,Xe+"input-$1")]})],o)}return""})}},K_=[G_],Y_=function(t){var r=t.key;if(r==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(y){var x=y.getAttribute("data-emotion");x.indexOf(" ")!==-1&&(document.head.appendChild(y),y.setAttribute("data-s",""))})}var o=t.stylisPlugins||K_,i={},a,s=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+r+' "]'),function(y){for(var x=y.getAttribute("data-emotion").split(" "),m=1;m=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var aP={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},sP=/[A-Z]|^ms/g,lP=/_EMO_([^_]+?)_([^]*?)_EMO_/g,fb=function(t){return t.charCodeAt(1)===45},Sv=function(t){return t!=null&&typeof t!="boolean"},Mc=ob(function(e){return fb(e)?e:e.replace(sP,"-$&").toLowerCase()}),xv=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(lP,function(n,o,i){return or={name:o,styles:i,next:or},o})}return aP[t]!==1&&!fb(t)&&typeof r=="number"&&r!==0?r+"px":r};function xa(e,t,r){if(r==null)return"";if(r.__emotion_styles!==void 0)return r;switch(typeof r){case"boolean":return"";case"object":{if(r.anim===1)return or={name:r.name,styles:r.styles,next:or},r.name;if(r.styles!==void 0){var n=r.next;if(n!==void 0)for(;n!==void 0;)or={name:n.name,styles:n.styles,next:or},n=n.next;var o=r.styles+";";return o}return uP(e,t,r)}case"function":{if(e!==void 0){var i=or,a=r(e);return or=i,xa(e,t,a)}break}}if(t==null)return r;var s=t[r];return s!==void 0?s:r}function uP(e,t,r){var n="";if(Array.isArray(r))for(var o=0;oE.jsx(Ba,{styles:gb}),yP=({scope:e=""})=>E.jsx(Ba,{styles:vb` + html { + line-height: 1.5; + -webkit-text-size-adjust: 100%; + font-family: system-ui, sans-serif; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + -moz-osx-font-smoothing: grayscale; + touch-action: manipulation; + } + + body { + position: relative; + min-height: 100%; + margin: 0; + font-feature-settings: "kern"; + } + + ${e} :where(*, *::before, *::after) { + border-width: 0; + border-style: solid; + box-sizing: border-box; + word-wrap: break-word; + } + + main { + display: block; + } + + ${e} hr { + border-top-width: 1px; + box-sizing: content-box; + height: 0; + overflow: visible; + } + + ${e} :where(pre, code, kbd,samp) { + font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; + font-size: 1em; + } + + ${e} a { + background-color: transparent; + color: inherit; + text-decoration: inherit; + } + + ${e} abbr[title] { + border-bottom: none; + text-decoration: underline; + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; + } + + ${e} :where(b, strong) { + font-weight: bold; + } + + ${e} small { + font-size: 80%; + } + + ${e} :where(sub,sup) { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; + } + + ${e} sub { + bottom: -0.25em; + } + + ${e} sup { + top: -0.5em; + } + + ${e} img { + border-style: none; + } + + ${e} :where(button, input, optgroup, select, textarea) { + font-family: inherit; + font-size: 100%; + line-height: 1.15; + margin: 0; + } + + ${e} :where(button, input) { + overflow: visible; + } + + ${e} :where(button, select) { + text-transform: none; + } + + ${e} :where( + button::-moz-focus-inner, + [type="button"]::-moz-focus-inner, + [type="reset"]::-moz-focus-inner, + [type="submit"]::-moz-focus-inner + ) { + border-style: none; + padding: 0; + } + + ${e} fieldset { + padding: 0.35em 0.75em 0.625em; + } + + ${e} legend { + box-sizing: border-box; + color: inherit; + display: table; + max-width: 100%; + padding: 0; + white-space: normal; + } + + ${e} progress { + vertical-align: baseline; + } + + ${e} textarea { + overflow: auto; + } + + ${e} :where([type="checkbox"], [type="radio"]) { + box-sizing: border-box; + padding: 0; + } + + ${e} input[type="number"]::-webkit-inner-spin-button, + ${e} input[type="number"]::-webkit-outer-spin-button { + -webkit-appearance: none !important; + } + + ${e} input[type="number"] { + -moz-appearance: textfield; + } + + ${e} input[type="search"] { + -webkit-appearance: textfield; + outline-offset: -2px; + } + + ${e} input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none !important; + } + + ${e} ::-webkit-file-upload-button { + -webkit-appearance: button; + font: inherit; + } + + ${e} details { + display: block; + } + + ${e} summary { + display: list-item; + } + + template { + display: none; + } + + [hidden] { + display: none !important; + } + + ${e} :where( + blockquote, + dl, + dd, + h1, + h2, + h3, + h4, + h5, + h6, + hr, + figure, + p, + pre + ) { + margin: 0; + } + + ${e} button { + background: transparent; + padding: 0; + } + + ${e} fieldset { + margin: 0; + padding: 0; + } + + ${e} :where(ol, ul) { + margin: 0; + padding: 0; + } + + ${e} textarea { + resize: vertical; + } + + ${e} :where(button, [role="button"]) { + cursor: pointer; + } + + ${e} button::-moz-focus-inner { + border: 0 !important; + } + + ${e} table { + border-collapse: collapse; + } + + ${e} :where(h1, h2, h3, h4, h5, h6) { + font-size: inherit; + font-weight: inherit; + } + + ${e} :where(button, input, optgroup, select, textarea) { + padding: 0; + line-height: inherit; + color: inherit; + } + + ${e} :where(img, svg, video, canvas, audio, iframe, embed, object) { + display: block; + } + + ${e} :where(img, video) { + max-width: 100%; + height: auto; + } + + [data-js-focus-visible] + :focus:not([data-focus-visible-added]):not( + [data-focus-visible-disabled] + ) { + outline: none; + box-shadow: none; + } + + ${e} select::-ms-expand { + display: none; + } + + ${gb} + `});function bP(e,t){return`${e} returned \`undefined\`. Seems you forgot to wrap component within ${t}`}function mn(e={}){const{name:t,strict:r=!0,hookName:n="useContext",providerName:o="Provider",errorMessage:i,defaultValue:a}=e,s=S.createContext(a);s.displayName=t;function l(){var u;const c=S.useContext(s);if(!c&&r){const d=new Error(i??bP(n,o));throw d.name="ContextError",(u=Error.captureStackTrace)==null||u.call(Error,d,l),d}return c}return[s.Provider,l,s]}var[SP,xP]=mn({strict:!1,name:"PortalManagerContext"});function yb(e){const{children:t,zIndex:r}=e;return E.jsx(SP,{value:{zIndex:r},children:t})}yb.displayName="PortalManager";var Bl=globalThis!=null&&globalThis.document?S.useLayoutEffect:S.useEffect,[bb,wP]=mn({strict:!1,name:"PortalContext"}),Xh="chakra-portal",kP=".chakra-portal",CP=e=>E.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),_P=e=>{const{appendToParentPortal:t,children:r}=e,[n,o]=S.useState(null),i=S.useRef(null),[,a]=S.useState({});S.useEffect(()=>a({}),[]);const s=wP(),l=xP();Bl(()=>{if(!n)return;const c=n.ownerDocument,d=t?s??c.body:c.body;if(!d)return;i.current=c.createElement("div"),i.current.className=Xh,d.appendChild(i.current),a({});const f=i.current;return()=>{d.contains(f)&&d.removeChild(f)}},[n]);const u=l!=null&&l.zIndex?E.jsx(CP,{zIndex:l==null?void 0:l.zIndex,children:r}):r;return i.current?Nh.createPortal(E.jsx(bb,{value:i.current,children:u}),i.current):E.jsx("span",{ref:c=>{c&&o(c)}})},PP=e=>{const{children:t,containerRef:r,appendToParentPortal:n}=e,o=r.current,i=o??(typeof window<"u"?document.body:void 0),a=S.useMemo(()=>{const l=o==null?void 0:o.ownerDocument.createElement("div");return l&&(l.className=Xh),l},[o]),[,s]=S.useState({});return Bl(()=>s({}),[]),Bl(()=>{if(!(!a||!i))return i.appendChild(a),()=>{i.removeChild(a)}},[a,i]),i&&a?Nh.createPortal(E.jsx(bb,{value:n?a:null,children:t}),a):null};function ja(e){const t={appendToParentPortal:!0,...e},{containerRef:r,...n}=t;return r?E.jsx(PP,{containerRef:r,...n}):E.jsx(_P,{...n})}ja.className=Xh;ja.selector=kP;ja.displayName="Portal";function TP(){const e=S.useContext(wa);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return e}var zu=S.createContext({});zu.displayName="ColorModeContext";function Qh(){const e=S.useContext(zu);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}var ks={light:"chakra-ui-light",dark:"chakra-ui-dark"};function EP(e={}){const{preventTransition:t=!0}=e,r={setDataset:n=>{const o=t?r.preventTransition():void 0;document.documentElement.dataset.theme=n,document.documentElement.style.colorScheme=n,o==null||o()},setClassName(n){document.body.classList.add(n?ks.dark:ks.light),document.body.classList.remove(n?ks.light:ks.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(n){var o;return((o=r.query().matches)!=null?o:n==="dark")?"dark":"light"},addListener(n){const o=r.query(),i=a=>{n(a.matches?"dark":"light")};return typeof o.addListener=="function"?o.addListener(i):o.addEventListener("change",i),()=>{typeof o.removeListener=="function"?o.removeListener(i):o.removeEventListener("change",i)}},preventTransition(){const n=document.createElement("style");return n.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(n),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(n)})})}}};return r}var $P="chakra-ui-color-mode";function AP(e){return{ssr:!1,type:"localStorage",get(t){if(!(globalThis!=null&&globalThis.document))return t;let r;try{r=localStorage.getItem(e)||t}catch{}return r||t},set(t){try{localStorage.setItem(e,t)}catch{}}}}var RP=AP($P),jl=()=>{};function Cv(e,t){return e.type==="cookie"&&e.ssr?e.get(t):t}function Sb(e){const{value:t,children:r,options:{useSystemColorMode:n,initialColorMode:o,disableTransitionOnChange:i}={},colorModeManager:a=RP}=e,s=o==="dark"?"dark":"light",[l,u]=S.useState(()=>Cv(a,s)),[c,d]=S.useState(()=>Cv(a)),{getSystemTheme:f,setClassName:p,setDataset:v,addListener:y}=S.useMemo(()=>EP({preventTransition:i}),[i]),x=o==="system"&&!l?c:l,m=S.useCallback(C=>{const _=C==="system"?f():C;u(_),p(_==="dark"),v(_),a.set(_)},[a,f,p,v]);Bl(()=>{o==="system"&&d(f())},[]),S.useEffect(()=>{const C=a.get();if(C){m(C);return}if(o==="system"){m("system");return}m(s)},[a,s,o,m]);const h=S.useCallback(()=>{m(x==="dark"?"light":"dark")},[x,m]);S.useEffect(()=>{if(n)return y(m)},[n,y,m]);const g=S.useMemo(()=>({colorMode:t??x,toggleColorMode:t?jl:h,setColorMode:t?jl:m,forced:t!==void 0}),[x,h,m,t]);return E.jsx(zu.Provider,{value:g,children:r})}Sb.displayName="ColorModeProvider";function xb(e){const t=S.useMemo(()=>({colorMode:"dark",toggleColorMode:jl,setColorMode:jl,forced:!0}),[]);return E.jsx(zu.Provider,{value:t,...e})}xb.displayName="DarkMode";var MP=new Set(["dark","light","system"]);function zP(e){let t=e;return MP.has(t)||(t="light"),t}function FP(e={}){const{initialColorMode:t="light",type:r="localStorage",storageKey:n="chakra-ui-color-mode"}=e,o=zP(t),i=r==="cookie",a=`(function(){try{var a=function(o){var l="(prefers-color-scheme: dark)",v=window.matchMedia(l).matches?"dark":"light",e=o==="system"?v:o,d=document.documentElement,m=document.body,i="chakra-ui-light",n="chakra-ui-dark",s=e==="dark";return m.classList.add(s?n:i),m.classList.remove(s?i:n),d.style.colorScheme=e,d.dataset.theme=e,e},u=a,h="${o}",r="${n}",t=document.cookie.match(new RegExp("(^| )".concat(r,"=([^;]+)"))),c=t?t[2]:null;c?a(c):document.cookie="".concat(r,"=").concat(a(h),"; max-age=31536000; path=/")}catch(a){}})(); + `,s=`(function(){try{var a=function(c){var v="(prefers-color-scheme: dark)",h=window.matchMedia(v).matches?"dark":"light",r=c==="system"?h:c,o=document.documentElement,s=document.body,l="chakra-ui-light",d="chakra-ui-dark",i=r==="dark";return s.classList.add(i?d:l),s.classList.remove(i?l:d),o.style.colorScheme=r,o.dataset.theme=r,r},n=a,m="${o}",e="${n}",t=localStorage.getItem(e);t?a(t):localStorage.setItem(e,a(m))}catch(a){}})(); + `;return`!${i?a:s}`.trim()}function DP(e={}){const{nonce:t}=e;return E.jsx("script",{id:"chakra-script",nonce:t,dangerouslySetInnerHTML:{__html:FP(e)}})}function IP(){const e=Qh(),t=TP();return{...e,theme:t}}function LP(e,t,r){var n,o;if(t==null)return t;const i=a=>{var s,l;return(l=(s=e.__breakpoints)==null?void 0:s.asArray)==null?void 0:l[a]};return(o=(n=i(t))!=null?n:i(r))!=null?o:r}function OP(e,t,r){var n,o;if(t==null)return t;const i=a=>{var s,l;return(l=(s=e.__cssMap)==null?void 0:s[a])==null?void 0:l.value};return(o=(n=i(t))!=null?n:i(r))!=null?o:r}function pB(e,t,r){const n=Array.isArray(t)?t:[t],o=Array.isArray(r)?r:[r];return i=>{const a=o.filter(Boolean),s=n.map((l,u)=>{var c,d;if(e==="breakpoints")return LP(i,l,(c=a[u])!=null?c:l);const f=`${e}.${l}`;return OP(i,f,(d=a[u])!=null?d:l)});return Array.isArray(t)?s:s[0]}}var Be=(...e)=>e.filter(Boolean).join(" ");function Kt(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}function lr(e,...t){return BP(e)?e(...t):e}var BP=e=>typeof e=="function",_v=e=>e?"":void 0,mB=e=>e?!0:void 0;function Ei(...e){return function(r){e.some(n=>(n==null||n(r),r==null?void 0:r.defaultPrevented))}}function vB(...e){return function(r){e.forEach(n=>{n==null||n(r)})}}var Nl={exports:{}};Nl.exports;(function(e,t){var r=200,n="__lodash_hash_undefined__",o=800,i=16,a=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",p="[object Function]",v="[object GeneratorFunction]",y="[object Map]",x="[object Number]",m="[object Null]",h="[object Object]",g="[object Proxy]",C="[object RegExp]",_="[object Set]",$="[object String]",T="[object Undefined]",A="[object WeakMap]",M="[object ArrayBuffer]",I="[object DataView]",ee="[object Float32Array]",ze="[object Float64Array]",Pe="[object Int8Array]",oe="[object Int16Array]",ue="[object Int32Array]",He="[object Uint8Array]",it="[object Uint8ClampedArray]",z="[object Uint16Array]",N="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,B=/^\[object .+?Constructor\]$/,ne=/^(?:0|[1-9]\d*)$/,U={};U[ee]=U[ze]=U[Pe]=U[oe]=U[ue]=U[He]=U[it]=U[z]=U[N]=!0,U[s]=U[l]=U[M]=U[c]=U[I]=U[d]=U[f]=U[p]=U[y]=U[x]=U[h]=U[C]=U[_]=U[$]=U[A]=!1;var Ge=typeof os=="object"&&os&&os.Object===Object&&os,Xt=typeof self=="object"&&self&&self.Object===Object&&self,we=Ge||Xt||Function("return this")(),Fe=t&&!t.nodeType&&t,mt=Fe&&!0&&e&&!e.nodeType&&e,Qt=mt&&mt.exports===Fe,Ot=Qt&&Ge.process,qt=function(){try{var b=mt&&mt.require&&mt.require("util").types;return b||Ot&&Ot.binding&&Ot.binding("util")}catch{}}(),ai=qt&&qt.isTypedArray;function Xa(b,w,P){switch(P.length){case 0:return b.call(w);case 1:return b.call(w,P[0]);case 2:return b.call(w,P[0],P[1]);case 3:return b.call(w,P[0],P[1],P[2])}return b.apply(w,P)}function Fw(b,w){for(var P=-1,F=Array(b);++P-1}function rk(b,w){var P=this.__data__,F=es(P,b);return F<0?(++this.size,P.push([b,w])):P[F][1]=w,this}vr.prototype.clear=Zw,vr.prototype.delete=Jw,vr.prototype.get=ek,vr.prototype.has=tk,vr.prototype.set=rk;function qn(b){var w=-1,P=b==null?0:b.length;for(this.clear();++w1?P[K-1]:void 0,he=K>2?P[2]:void 0;for(ie=b.length>3&&typeof ie=="function"?(K--,ie):void 0,he&&Rk(P[0],P[1],he)&&(ie=K<3?void 0:ie,K=1),w=Object(w);++F-1&&b%1==0&&b0){if(++w>=o)return arguments[0]}else w=0;return b.apply(void 0,arguments)}}function Bk(b){if(b!=null){try{return qa.call(b)}catch{}try{return b+""}catch{}}return""}function ns(b,w){return b===w||b!==b&&w!==w}var ec=Xp(function(){return arguments}())?Xp:function(b){return li(b)&&mr.call(b,"callee")&&!Vw.call(b,"callee")},tc=Array.isArray;function rc(b){return b!=null&&em(b.length)&&!nc(b)}function jk(b){return li(b)&&rc(b)}var Jp=Uw||Hk;function nc(b){if(!bn(b))return!1;var w=ts(b);return w==p||w==v||w==u||w==g}function em(b){return typeof b=="number"&&b>-1&&b%1==0&&b<=a}function bn(b){var w=typeof b;return b!=null&&(w=="object"||w=="function")}function li(b){return b!=null&&typeof b=="object"}function Nk(b){if(!li(b)||ts(b)!=h)return!1;var w=Hp(b);if(w===null)return!0;var P=mr.call(w,"constructor")&&w.constructor;return typeof P=="function"&&P instanceof P&&qa.call(P)==jw}var tm=ai?Dw(ai):gk;function Vk(b){return Pk(b,rm(b))}function rm(b){return rc(b)?hk(b,!0):yk(b)}var Wk=Tk(function(b,w,P,F){Qp(b,w,P,F)});function Uk(b){return function(){return b}}function nm(b){return b}function Hk(){return!1}e.exports=Wk})(Nl,Nl.exports);var jP=Nl.exports;const Ft=Gf(jP);var NP=e=>/!(important)?$/.test(e),Pv=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,VP=(e,t)=>r=>{const n=String(t),o=NP(n),i=Pv(n),a=e?`${e}.${i}`:i;let s=Kt(r.__cssMap)&&a in r.__cssMap?r.__cssMap[a].varRef:t;return s=Pv(s),o?`${s} !important`:s};function qh(e){const{scale:t,transform:r,compose:n}=e;return(i,a)=>{var s;const l=VP(t,i)(a);let u=(s=r==null?void 0:r(l,a))!=null?s:l;return n&&(u=n(u,a)),u}}var Cs=(...e)=>t=>e.reduce((r,n)=>n(r),t);function Et(e,t){return r=>{const n={property:r,scale:e};return n.transform=qh({scale:e,transform:t}),n}}var WP=({rtl:e,ltr:t})=>r=>r.direction==="rtl"?e:t;function UP(e){const{property:t,scale:r,transform:n}=e;return{scale:r,property:WP(t),transform:r?qh({scale:r,compose:n}):n}}var wb=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function HP(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...wb].join(" ")}function GP(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...wb].join(" ")}var KP={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},YP={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function XP(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var QP={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},hf={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},qP=new Set(Object.values(hf)),pf=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),ZP=e=>e.trim();function JP(e,t){if(e==null||pf.has(e))return e;if(!(mf(e)||pf.has(e)))return`url('${e}')`;const o=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),i=o==null?void 0:o[1],a=o==null?void 0:o[2];if(!i||!a)return e;const s=i.includes("-gradient")?i:`${i}-gradient`,[l,...u]=a.split(",").map(ZP).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in hf?hf[l]:l;u.unshift(c);const d=u.map(f=>{if(qP.has(f))return f;const p=f.indexOf(" "),[v,y]=p!==-1?[f.substr(0,p),f.substr(p+1)]:[f],x=mf(y)?y:y&&y.split(" "),m=`colors.${v}`,h=m in t.__cssMap?t.__cssMap[m].varRef:v;return x?[h,...Array.isArray(x)?x:[x]].join(" "):h});return`${s}(${d.join(", ")})`}var mf=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),eT=(e,t)=>JP(e,t??{});function tT(e){return/^var\(--.+\)$/.test(e)}var rT=e=>{const t=parseFloat(e.toString()),r=e.toString().replace(String(t),"");return{unitless:!r,value:t,unit:r}},Jt=e=>t=>`${e}(${t})`,G={filter(e){return e!=="auto"?e:KP},backdropFilter(e){return e!=="auto"?e:YP},ring(e){return XP(G.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?HP():e==="auto-gpu"?GP():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=rT(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const r={left:"right",right:"left"};return t.direction==="rtl"?r[e]:e},degree(e){if(tT(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:eT,blur:Jt("blur"),opacity:Jt("opacity"),brightness:Jt("brightness"),contrast:Jt("contrast"),dropShadow:Jt("drop-shadow"),grayscale:Jt("grayscale"),hueRotate:e=>Jt("hue-rotate")(G.degree(e)),invert:Jt("invert"),saturate:Jt("saturate"),sepia:Jt("sepia"),bgImage(e){return e==null||mf(e)||pf.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:r,divide:n}=(t=QP[e])!=null?t:{},o={flexDirection:e};return r&&(o[r]=1),n&&(o[n]=1),o}},k={borderWidths:Et("borderWidths"),borderStyles:Et("borderStyles"),colors:Et("colors"),borders:Et("borders"),gradients:Et("gradients",G.gradient),radii:Et("radii",G.px),space:Et("space",Cs(G.vh,G.px)),spaceT:Et("space",Cs(G.vh,G.px)),degreeT(e){return{property:e,transform:G.degree}},prop(e,t,r){return{property:e,scale:t,...t&&{transform:qh({scale:t,transform:r})}}},propT(e,t){return{property:e,transform:t}},sizes:Et("sizes",Cs(G.vh,G.px)),sizesT:Et("sizes",Cs(G.vh,G.fraction)),shadows:Et("shadows"),logical:UP,blur:Et("blur",G.blur)},el={background:k.colors("background"),backgroundColor:k.colors("backgroundColor"),backgroundImage:k.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:G.bgClip},bgSize:k.prop("backgroundSize"),bgPosition:k.prop("backgroundPosition"),bg:k.colors("background"),bgColor:k.colors("backgroundColor"),bgPos:k.prop("backgroundPosition"),bgRepeat:k.prop("backgroundRepeat"),bgAttachment:k.prop("backgroundAttachment"),bgGradient:k.gradients("backgroundImage"),bgClip:{transform:G.bgClip}};Object.assign(el,{bgImage:el.backgroundImage,bgImg:el.backgroundImage});var X={border:k.borders("border"),borderWidth:k.borderWidths("borderWidth"),borderStyle:k.borderStyles("borderStyle"),borderColor:k.colors("borderColor"),borderRadius:k.radii("borderRadius"),borderTop:k.borders("borderTop"),borderBlockStart:k.borders("borderBlockStart"),borderTopLeftRadius:k.radii("borderTopLeftRadius"),borderStartStartRadius:k.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:k.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:k.radii("borderTopRightRadius"),borderStartEndRadius:k.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:k.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:k.borders("borderRight"),borderInlineEnd:k.borders("borderInlineEnd"),borderBottom:k.borders("borderBottom"),borderBlockEnd:k.borders("borderBlockEnd"),borderBottomLeftRadius:k.radii("borderBottomLeftRadius"),borderBottomRightRadius:k.radii("borderBottomRightRadius"),borderLeft:k.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:k.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:k.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:k.borders(["borderLeft","borderRight"]),borderInline:k.borders("borderInline"),borderY:k.borders(["borderTop","borderBottom"]),borderBlock:k.borders("borderBlock"),borderTopWidth:k.borderWidths("borderTopWidth"),borderBlockStartWidth:k.borderWidths("borderBlockStartWidth"),borderTopColor:k.colors("borderTopColor"),borderBlockStartColor:k.colors("borderBlockStartColor"),borderTopStyle:k.borderStyles("borderTopStyle"),borderBlockStartStyle:k.borderStyles("borderBlockStartStyle"),borderBottomWidth:k.borderWidths("borderBottomWidth"),borderBlockEndWidth:k.borderWidths("borderBlockEndWidth"),borderBottomColor:k.colors("borderBottomColor"),borderBlockEndColor:k.colors("borderBlockEndColor"),borderBottomStyle:k.borderStyles("borderBottomStyle"),borderBlockEndStyle:k.borderStyles("borderBlockEndStyle"),borderLeftWidth:k.borderWidths("borderLeftWidth"),borderInlineStartWidth:k.borderWidths("borderInlineStartWidth"),borderLeftColor:k.colors("borderLeftColor"),borderInlineStartColor:k.colors("borderInlineStartColor"),borderLeftStyle:k.borderStyles("borderLeftStyle"),borderInlineStartStyle:k.borderStyles("borderInlineStartStyle"),borderRightWidth:k.borderWidths("borderRightWidth"),borderInlineEndWidth:k.borderWidths("borderInlineEndWidth"),borderRightColor:k.colors("borderRightColor"),borderInlineEndColor:k.colors("borderInlineEndColor"),borderRightStyle:k.borderStyles("borderRightStyle"),borderInlineEndStyle:k.borderStyles("borderInlineEndStyle"),borderTopRadius:k.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:k.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:k.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:k.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(X,{rounded:X.borderRadius,roundedTop:X.borderTopRadius,roundedTopLeft:X.borderTopLeftRadius,roundedTopRight:X.borderTopRightRadius,roundedTopStart:X.borderStartStartRadius,roundedTopEnd:X.borderStartEndRadius,roundedBottom:X.borderBottomRadius,roundedBottomLeft:X.borderBottomLeftRadius,roundedBottomRight:X.borderBottomRightRadius,roundedBottomStart:X.borderEndStartRadius,roundedBottomEnd:X.borderEndEndRadius,roundedLeft:X.borderLeftRadius,roundedRight:X.borderRightRadius,roundedStart:X.borderInlineStartRadius,roundedEnd:X.borderInlineEndRadius,borderStart:X.borderInlineStart,borderEnd:X.borderInlineEnd,borderTopStartRadius:X.borderStartStartRadius,borderTopEndRadius:X.borderStartEndRadius,borderBottomStartRadius:X.borderEndStartRadius,borderBottomEndRadius:X.borderEndEndRadius,borderStartRadius:X.borderInlineStartRadius,borderEndRadius:X.borderInlineEndRadius,borderStartWidth:X.borderInlineStartWidth,borderEndWidth:X.borderInlineEndWidth,borderStartColor:X.borderInlineStartColor,borderEndColor:X.borderInlineEndColor,borderStartStyle:X.borderInlineStartStyle,borderEndStyle:X.borderInlineEndStyle});var nT={color:k.colors("color"),textColor:k.colors("color"),fill:k.colors("fill"),stroke:k.colors("stroke")},vf={boxShadow:k.shadows("boxShadow"),mixBlendMode:!0,blendMode:k.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:k.prop("backgroundBlendMode"),opacity:!0};Object.assign(vf,{shadow:vf.boxShadow});var oT={filter:{transform:G.filter},blur:k.blur("--chakra-blur"),brightness:k.propT("--chakra-brightness",G.brightness),contrast:k.propT("--chakra-contrast",G.contrast),hueRotate:k.propT("--chakra-hue-rotate",G.hueRotate),invert:k.propT("--chakra-invert",G.invert),saturate:k.propT("--chakra-saturate",G.saturate),dropShadow:k.propT("--chakra-drop-shadow",G.dropShadow),backdropFilter:{transform:G.backdropFilter},backdropBlur:k.blur("--chakra-backdrop-blur"),backdropBrightness:k.propT("--chakra-backdrop-brightness",G.brightness),backdropContrast:k.propT("--chakra-backdrop-contrast",G.contrast),backdropHueRotate:k.propT("--chakra-backdrop-hue-rotate",G.hueRotate),backdropInvert:k.propT("--chakra-backdrop-invert",G.invert),backdropSaturate:k.propT("--chakra-backdrop-saturate",G.saturate)},Vl={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:G.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:k.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:k.space("gap"),rowGap:k.space("rowGap"),columnGap:k.space("columnGap")};Object.assign(Vl,{flexDir:Vl.flexDirection});var kb={gridGap:k.space("gridGap"),gridColumnGap:k.space("gridColumnGap"),gridRowGap:k.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},iT={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:G.outline},outlineOffset:!0,outlineColor:k.colors("outlineColor")},At={width:k.sizesT("width"),inlineSize:k.sizesT("inlineSize"),height:k.sizes("height"),blockSize:k.sizes("blockSize"),boxSize:k.sizes(["width","height"]),minWidth:k.sizes("minWidth"),minInlineSize:k.sizes("minInlineSize"),minHeight:k.sizes("minHeight"),minBlockSize:k.sizes("minBlockSize"),maxWidth:k.sizes("maxWidth"),maxInlineSize:k.sizes("maxInlineSize"),maxHeight:k.sizes("maxHeight"),maxBlockSize:k.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var r,n,o;return{[`@media screen and (min-width: ${(o=(n=(r=t.__breakpoints)==null?void 0:r.get(e))==null?void 0:n.minW)!=null?o:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var r,n,o;return{[`@media screen and (max-width: ${(o=(n=(r=t.__breakpoints)==null?void 0:r.get(e))==null?void 0:n._minW)!=null?o:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:k.propT("float",G.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(At,{w:At.width,h:At.height,minW:At.minWidth,maxW:At.maxWidth,minH:At.minHeight,maxH:At.maxHeight,overscroll:At.overscrollBehavior,overscrollX:At.overscrollBehaviorX,overscrollY:At.overscrollBehaviorY});var aT={listStyleType:!0,listStylePosition:!0,listStylePos:k.prop("listStylePosition"),listStyleImage:!0,listStyleImg:k.prop("listStyleImage")};function sT(e,t,r,n){const o=typeof t=="string"?t.split("."):[t];for(n=0;n{const t=new WeakMap;return(n,o,i,a)=>{if(typeof n>"u")return e(n,o,i);t.has(n)||t.set(n,new Map);const s=t.get(n);if(s.has(o))return s.get(o);const l=e(n,o,i,a);return s.set(o,l),l}},uT=lT(sT),cT={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},dT={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},zc=(e,t,r)=>{const n={},o=uT(e,t,{});for(const i in o)i in r&&r[i]!=null||(n[i]=o[i]);return n},fT={srOnly:{transform(e){return e===!0?cT:e==="focusable"?dT:{}}},layerStyle:{processResult:!0,transform:(e,t,r)=>zc(t,`layerStyles.${e}`,r)},textStyle:{processResult:!0,transform:(e,t,r)=>zc(t,`textStyles.${e}`,r)},apply:{processResult:!0,transform:(e,t,r)=>zc(t,e,r)}},Gi={position:!0,pos:k.prop("position"),zIndex:k.prop("zIndex","zIndices"),inset:k.spaceT("inset"),insetX:k.spaceT(["left","right"]),insetInline:k.spaceT("insetInline"),insetY:k.spaceT(["top","bottom"]),insetBlock:k.spaceT("insetBlock"),top:k.spaceT("top"),insetBlockStart:k.spaceT("insetBlockStart"),bottom:k.spaceT("bottom"),insetBlockEnd:k.spaceT("insetBlockEnd"),left:k.spaceT("left"),insetInlineStart:k.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:k.spaceT("right"),insetInlineEnd:k.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Gi,{insetStart:Gi.insetInlineStart,insetEnd:Gi.insetInlineEnd});var hT={ring:{transform:G.ring},ringColor:k.colors("--chakra-ring-color"),ringOffset:k.prop("--chakra-ring-offset-width"),ringOffsetColor:k.colors("--chakra-ring-offset-color"),ringInset:k.prop("--chakra-ring-inset")},de={margin:k.spaceT("margin"),marginTop:k.spaceT("marginTop"),marginBlockStart:k.spaceT("marginBlockStart"),marginRight:k.spaceT("marginRight"),marginInlineEnd:k.spaceT("marginInlineEnd"),marginBottom:k.spaceT("marginBottom"),marginBlockEnd:k.spaceT("marginBlockEnd"),marginLeft:k.spaceT("marginLeft"),marginInlineStart:k.spaceT("marginInlineStart"),marginX:k.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:k.spaceT("marginInline"),marginY:k.spaceT(["marginTop","marginBottom"]),marginBlock:k.spaceT("marginBlock"),padding:k.space("padding"),paddingTop:k.space("paddingTop"),paddingBlockStart:k.space("paddingBlockStart"),paddingRight:k.space("paddingRight"),paddingBottom:k.space("paddingBottom"),paddingBlockEnd:k.space("paddingBlockEnd"),paddingLeft:k.space("paddingLeft"),paddingInlineStart:k.space("paddingInlineStart"),paddingInlineEnd:k.space("paddingInlineEnd"),paddingX:k.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:k.space("paddingInline"),paddingY:k.space(["paddingTop","paddingBottom"]),paddingBlock:k.space("paddingBlock")};Object.assign(de,{m:de.margin,mt:de.marginTop,mr:de.marginRight,me:de.marginInlineEnd,marginEnd:de.marginInlineEnd,mb:de.marginBottom,ml:de.marginLeft,ms:de.marginInlineStart,marginStart:de.marginInlineStart,mx:de.marginX,my:de.marginY,p:de.padding,pt:de.paddingTop,py:de.paddingY,px:de.paddingX,pb:de.paddingBottom,pl:de.paddingLeft,ps:de.paddingInlineStart,paddingStart:de.paddingInlineStart,pr:de.paddingRight,pe:de.paddingInlineEnd,paddingEnd:de.paddingInlineEnd});var pT={textDecorationColor:k.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:k.shadows("textShadow")},mT={clipPath:!0,transform:k.propT("transform",G.transform),transformOrigin:!0,translateX:k.spaceT("--chakra-translate-x"),translateY:k.spaceT("--chakra-translate-y"),skewX:k.degreeT("--chakra-skew-x"),skewY:k.degreeT("--chakra-skew-y"),scaleX:k.prop("--chakra-scale-x"),scaleY:k.prop("--chakra-scale-y"),scale:k.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:k.degreeT("--chakra-rotate")},vT={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:k.prop("transitionDuration","transition.duration"),transitionProperty:k.prop("transitionProperty","transition.property"),transitionTimingFunction:k.prop("transitionTimingFunction","transition.easing")},gT={fontFamily:k.prop("fontFamily","fonts"),fontSize:k.prop("fontSize","fontSizes",G.px),fontWeight:k.prop("fontWeight","fontWeights"),lineHeight:k.prop("lineHeight","lineHeights"),letterSpacing:k.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},yT={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:k.spaceT("scrollMargin"),scrollMarginTop:k.spaceT("scrollMarginTop"),scrollMarginBottom:k.spaceT("scrollMarginBottom"),scrollMarginLeft:k.spaceT("scrollMarginLeft"),scrollMarginRight:k.spaceT("scrollMarginRight"),scrollMarginX:k.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:k.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:k.spaceT("scrollPadding"),scrollPaddingTop:k.spaceT("scrollPaddingTop"),scrollPaddingBottom:k.spaceT("scrollPaddingBottom"),scrollPaddingLeft:k.spaceT("scrollPaddingLeft"),scrollPaddingRight:k.spaceT("scrollPaddingRight"),scrollPaddingX:k.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:k.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function Cb(e){return Kt(e)&&e.reference?e.reference:String(e)}var Fu=(e,...t)=>t.map(Cb).join(` ${e} `).replace(/calc/g,""),Tv=(...e)=>`calc(${Fu("+",...e)})`,Ev=(...e)=>`calc(${Fu("-",...e)})`,gf=(...e)=>`calc(${Fu("*",...e)})`,$v=(...e)=>`calc(${Fu("/",...e)})`,Av=e=>{const t=Cb(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:gf(t,-1)},Pn=Object.assign(e=>({add:(...t)=>Pn(Tv(e,...t)),subtract:(...t)=>Pn(Ev(e,...t)),multiply:(...t)=>Pn(gf(e,...t)),divide:(...t)=>Pn($v(e,...t)),negate:()=>Pn(Av(e)),toString:()=>e.toString()}),{add:Tv,subtract:Ev,multiply:gf,divide:$v,negate:Av});function bT(e,t="-"){return e.replace(/\s+/g,t)}function ST(e){const t=bT(e.toString());return wT(xT(t))}function xT(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function wT(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function kT(e,t=""){return[t,e].filter(Boolean).join("-")}function CT(e,t){return`var(${e}${t?`, ${t}`:""})`}function _T(e,t=""){return ST(`--${kT(e,t)}`)}function O(e,t,r){const n=_T(e,r);return{variable:n,reference:CT(n,t)}}function PT(e,t){const r={};for(const n of t){if(Array.isArray(n)){const[o,i]=n;r[o]=O(`${e}-${o}`,i);continue}r[n]=O(`${e}-${n}`)}return r}function TT(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function ET(e){const t=parseFloat(e.toString()),r=e.toString().replace(String(t),"");return{unitless:!r,value:t,unit:r}}function yf(e){if(e==null)return e;const{unitless:t}=ET(e);return t||typeof e=="number"?`${e}px`:e}var _b=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,Zh=e=>Object.fromEntries(Object.entries(e).sort(_b));function Rv(e){const t=Zh(e);return Object.assign(Object.values(t),t)}function $T(e){const t=Object.keys(Zh(e));return new Set(t)}function Mv(e){var t;if(!e)return e;e=(t=yf(e))!=null?t:e;const r=-.02;return typeof e=="number"?`${e+r}`:e.replace(/(\d+\.?\d*)/u,n=>`${parseFloat(n)+r}`)}function $i(e,t){const r=["@media screen"];return e&&r.push("and",`(min-width: ${yf(e)})`),t&&r.push("and",`(max-width: ${yf(t)})`),r.join(" ")}function AT(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const r=Rv(e),n=Object.entries(e).sort(_b).map(([a,s],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?Mv(d):void 0,{_minW:Mv(s),breakpoint:a,minW:s,maxW:d,maxWQuery:$i(null,d),minWQuery:$i(s),minMaxQuery:$i(s,d)}}),o=$T(e),i=Array.from(o.values());return{keys:o,normalized:r,isResponsive(a){const s=Object.keys(a);return s.length>0&&s.every(l=>o.has(l))},asObject:Zh(e),asArray:Rv(e),details:n,get(a){return n.find(s=>s.breakpoint===a)},media:[null,...r.map(a=>$i(a)).slice(1)],toArrayValue(a){if(!Kt(a))throw new Error("toArrayValue: value must be an object");const s=i.map(l=>{var u;return(u=a[l])!=null?u:null});for(;TT(s)===null;)s.pop();return s},toObjectValue(a){if(!Array.isArray(a))throw new Error("toObjectValue: value must be an array");return a.reduce((s,l,u)=>{const c=i[u];return c!=null&&l!=null&&(s[c]=l),s},{})}}}var je={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},Br=e=>Pb(t=>e(t,"&"),"[role=group]","[data-group]",".group"),gr=e=>Pb(t=>e(t,"~ &"),"[data-peer]",".peer"),Pb=(e,...t)=>t.map(e).join(", "),Du={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:Br(je.hover),_peerHover:gr(je.hover),_groupFocus:Br(je.focus),_peerFocus:gr(je.focus),_groupFocusVisible:Br(je.focusVisible),_peerFocusVisible:gr(je.focusVisible),_groupActive:Br(je.active),_peerActive:gr(je.active),_groupDisabled:Br(je.disabled),_peerDisabled:gr(je.disabled),_groupInvalid:Br(je.invalid),_peerInvalid:gr(je.invalid),_groupChecked:Br(je.checked),_peerChecked:gr(je.checked),_groupFocusWithin:Br(je.focusWithin),_peerFocusWithin:gr(je.focusWithin),_peerPlaceholderShown:gr(je.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},Tb=Object.keys(Du);function zv(e,t){return O(String(e).replace(/\./g,"-"),void 0,t)}function RT(e,t){let r={};const n={};for(const[o,i]of Object.entries(e)){const{isSemantic:a,value:s}=i,{variable:l,reference:u}=zv(o,t==null?void 0:t.cssVarPrefix);if(!a){if(o.startsWith("space")){const f=o.split("."),[p,...v]=f,y=`${p}.-${v.join(".")}`,x=Pn.negate(s),m=Pn.negate(u);n[y]={value:x,var:l,varRef:m}}r[l]=s,n[o]={value:s,var:l,varRef:u};continue}const c=f=>{const v=[String(o).split(".")[0],f].join(".");if(!e[v])return f;const{reference:x}=zv(v,t==null?void 0:t.cssVarPrefix);return x},d=Kt(s)?s:{default:s};r=Ft(r,Object.entries(d).reduce((f,[p,v])=>{var y,x;if(!v)return f;const m=c(`${v}`);if(p==="default")return f[l]=m,f;const h=(x=(y=Du)==null?void 0:y[p])!=null?x:p;return f[h]={[l]:m},f},{})),n[o]={value:u,var:l,varRef:u}}return{cssVars:r,cssMap:n}}function MT(e,t=[]){const r=Object.assign({},e);for(const n of t)n in r&&delete r[n];return r}function zT(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r}function FT(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function Fv(e,t,r={}){const{stop:n,getKey:o}=r;function i(a,s=[]){var l;if(FT(a)||Array.isArray(a)){const u={};for(const[c,d]of Object.entries(a)){const f=(l=o==null?void 0:o(c))!=null?l:c,p=[...s,f];if(n!=null&&n(a,p))return t(a,s);u[f]=i(d,p)}return u}return t(a,s)}return i(e)}var DT=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function IT(e){return zT(e,DT)}function LT(e){return e.semanticTokens}function OT(e){const{__cssMap:t,__cssVars:r,__breakpoints:n,...o}=e;return o}var BT=e=>Tb.includes(e)||e==="default";function jT({tokens:e,semanticTokens:t}){const r={};return Fv(e,(n,o)=>{n!=null&&(r[o.join(".")]={isSemantic:!1,value:n})}),Fv(t,(n,o)=>{n!=null&&(r[o.join(".")]={isSemantic:!0,value:n})},{stop:n=>Object.keys(n).every(BT)}),r}function NT(e){var t;const r=OT(e),n=IT(r),o=LT(r),i=jT({tokens:n,semanticTokens:o}),a=(t=r.config)==null?void 0:t.cssVarPrefix,{cssMap:s,cssVars:l}=RT(i,{cssVarPrefix:a});return Object.assign(r,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:s,__breakpoints:AT(r.breakpoints)}),r}var Jh=Ft({},el,X,nT,Vl,At,oT,hT,iT,kb,fT,Gi,vf,de,yT,gT,pT,mT,aT,vT),VT=Object.assign({},de,At,Vl,kb,Gi),gB=Object.keys(VT),WT=[...Object.keys(Jh),...Tb],UT={...Jh,...Du},HT=e=>e in UT,GT=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:r,toArrayValue:n,media:o}=t.__breakpoints,i={};for(const a in e){let s=lr(e[a],t);if(s==null)continue;if(s=Kt(s)&&r(s)?n(s):s,!Array.isArray(s)){i[a]=s;continue}const l=s.slice(0,o.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!YT(t),QT=(e,t)=>{var r,n;if(t==null)return t;const o=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},i=l=>{var u;return(u=o(l))!=null?u:l},[a,s]=KT(t);return t=(n=(r=o(a))!=null?r:i(s))!=null?n:i(t),t};function qT(e){const{configs:t={},pseudos:r={},theme:n}=e,o=(i,a=!1)=>{var s,l,u;const c=lr(i,n),d=GT(c)(n);let f={};for(let p in d){const v=d[p];let y=lr(v,n);p in r&&(p=r[p]),XT(p,y)&&(y=QT(n,y));let x=t[p];if(x===!0&&(x={property:p}),Kt(y)){f[p]=(s=f[p])!=null?s:{},f[p]=Ft({},f[p],o(y,!0));continue}let m=(u=(l=x==null?void 0:x.transform)==null?void 0:l.call(x,y,n,c))!=null?u:y;m=x!=null&&x.processResult?o(m,!0):m;const h=lr(x==null?void 0:x.property,n);if(!a&&(x!=null&&x.static)){const g=lr(x.static,n);f=Ft({},f,g)}if(h&&Array.isArray(h)){for(const g of h)f[g]=m;continue}if(h){h==="&"&&Kt(m)?f=Ft({},f,m):f[h]=m;continue}if(Kt(m)){f=Ft({},f,m);continue}f[p]=m}return f};return o}var Eb=e=>t=>qT({theme:t,pseudos:Du,configs:Jh})(e);function le(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function ZT(e,t){if(Array.isArray(e))return e;if(Kt(e))return t(e);if(e!=null)return[e]}function JT(e,t){for(let r=t+1;r{Ft(u,{[g]:f?h[g]:{[m]:h[g]}})});continue}if(!p){f?Ft(u,h):u[m]=h;continue}u[m]=h}}return u}}function tE(e){return t=>{var r;const{variant:n,size:o,theme:i}=t,a=eE(i);return Ft({},lr((r=e.baseStyle)!=null?r:{},t),a(e,"sizes",o,t),a(e,"variants",n,t))}}function yB(e,t,r){var n,o,i;return(i=(o=(n=e.__cssMap)==null?void 0:n[`${t}.${r}`])==null?void 0:o.varRef)!=null?i:r}function Iu(e){return MT(e,["styleConfig","size","variant","colorScheme"])}var rE=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function nE(e){return Kt(e)?rE.every(t=>Object.prototype.hasOwnProperty.call(e,t)):!1}var oE={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},iE={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},aE={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},sE={property:oE,easing:iE,duration:aE},lE=sE,uE={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},cE=uE,dE={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},fE=dE,hE={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},pE=hE,mE={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},vE=mE,gE={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},yE=gE,bE={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},SE=bE,xE={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},wE=xE,kE={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},$b=kE,Ab={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},CE={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},_E={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},PE={...Ab,...CE,container:_E},Rb=PE,TE={breakpoints:pE,zIndices:cE,radii:yE,blur:wE,colors:vE,...$b,sizes:Rb,shadows:SE,space:Ab,borders:fE,transition:lE},{defineMultiStyleConfig:EE,definePartsStyle:Ai}=le(["stepper","step","title","description","indicator","separator","icon","number"]),Sr=O("stepper-indicator-size"),go=O("stepper-icon-size"),yo=O("stepper-title-font-size"),Ri=O("stepper-description-font-size"),bi=O("stepper-accent-color"),$E=Ai(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[bi.variable]:`colors.${e}.500`,_dark:{[bi.variable]:`colors.${e}.200`}},title:{fontSize:yo.reference,fontWeight:"medium"},description:{fontSize:Ri.reference,color:"chakra-subtle-text"},number:{fontSize:yo.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:go.reference,height:go.reference},indicator:{flexShrink:0,borderRadius:"full",width:Sr.reference,height:Sr.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:bi.reference},"&[data-status=complete]":{bg:bi.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:bi.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${Sr.reference} - 8px)`,top:`calc(${Sr.reference} + 4px)`,insetStart:`calc(${Sr.reference} / 2 - 1px)`}}})),AE=EE({baseStyle:$E,sizes:{xs:Ai({stepper:{[Sr.variable]:"sizes.4",[go.variable]:"sizes.3",[yo.variable]:"fontSizes.xs",[Ri.variable]:"fontSizes.xs"}}),sm:Ai({stepper:{[Sr.variable]:"sizes.6",[go.variable]:"sizes.4",[yo.variable]:"fontSizes.sm",[Ri.variable]:"fontSizes.xs"}}),md:Ai({stepper:{[Sr.variable]:"sizes.8",[go.variable]:"sizes.5",[yo.variable]:"fontSizes.md",[Ri.variable]:"fontSizes.sm"}}),lg:Ai({stepper:{[Sr.variable]:"sizes.10",[go.variable]:"sizes.6",[yo.variable]:"fontSizes.lg",[Ri.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function J(e,t={}){let r=!1;function n(){if(!r){r=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function o(...c){n();for(const d of c)t[d]=l(d);return J(e,t)}function i(...c){for(const d of c)d in t||(t[d]=l(d));return J(e,t)}function a(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.selector]))}function s(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.className]))}function l(c){const p=`chakra-${(["container","root"].includes(c??"")?[e]:[e,c]).filter(Boolean).join("__")}`;return{className:p,selector:`.${p}`,toString:()=>c}}return{parts:o,toPart:l,extend:i,selectors:a,classnames:s,get keys(){return Object.keys(t)},__type:{}}}var RE=J("accordion").parts("root","container","button","panel").extend("icon"),ME=J("alert").parts("title","description","container").extend("icon","spinner"),zE=J("avatar").parts("label","badge","container").extend("excessLabel","group"),FE=J("breadcrumb").parts("link","item","container").extend("separator");J("button").parts();var DE=J("checkbox").parts("control","icon","container").extend("label");J("progress").parts("track","filledTrack").extend("label");var IE=J("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),LE=J("editable").parts("preview","input","textarea"),OE=J("form").parts("container","requiredIndicator","helperText"),BE=J("formError").parts("text","icon"),jE=J("input").parts("addon","field","element","group"),NE=J("list").parts("container","item","icon"),VE=J("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),WE=J("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),UE=J("numberinput").parts("root","field","stepperGroup","stepper");J("pininput").parts("field");var HE=J("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),GE=J("progress").parts("label","filledTrack","track"),KE=J("radio").parts("container","control","label"),YE=J("select").parts("field","icon"),XE=J("slider").parts("container","track","thumb","filledTrack","mark"),QE=J("stat").parts("container","label","helpText","number","icon"),qE=J("switch").parts("container","track","thumb","label"),ZE=J("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),JE=J("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),e$=J("tag").parts("container","label","closeButton"),t$=J("card").parts("container","header","body","footer");J("stepper").parts("stepper","step","title","description","indicator","separator","icon","number");function Rn(e,t,r){return Math.min(Math.max(e,r),t)}class r$ extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Mi=r$;function ep(e){if(typeof e!="string")throw new Mi(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=c$.test(e)?i$(e):e;const r=a$.exec(t);if(r){const a=Array.from(r).slice(1);return[...a.slice(0,3).map(s=>parseInt(ka(s,2),16)),parseInt(ka(a[3]||"f",2),16)/255]}const n=s$.exec(t);if(n){const a=Array.from(n).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,16)),parseInt(a[3]||"ff",16)/255]}const o=l$.exec(t);if(o){const a=Array.from(o).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,10)),parseFloat(a[3]||"1")]}const i=u$.exec(t);if(i){const[a,s,l,u]=Array.from(i).slice(1).map(parseFloat);if(Rn(0,100,s)!==s)throw new Mi(e);if(Rn(0,100,l)!==l)throw new Mi(e);return[...d$(a,s,l),Number.isNaN(u)?1:u]}throw new Mi(e)}function n$(e){let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return(t>>>0)%2341}const Dv=e=>parseInt(e.replace(/_/g,""),36),o$="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const r=Dv(t.substring(0,3)),n=Dv(t.substring(3)).toString(16);let o="";for(let i=0;i<6-n.length;i++)o+="0";return e[r]=`${o}${n}`,e},{});function i$(e){const t=e.toLowerCase().trim(),r=o$[n$(t)];if(!r)throw new Mi(e);return`#${r}`}const ka=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),a$=new RegExp(`^#${ka("([a-f0-9])",3)}([a-f0-9])?$`,"i"),s$=new RegExp(`^#${ka("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),l$=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${ka(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),u$=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,c$=/^[a-z]+$/i,Iv=e=>Math.round(e*255),d$=(e,t,r)=>{let n=r/100;if(t===0)return[n,n,n].map(Iv);const o=(e%360+360)%360/60,i=(1-Math.abs(2*n-1))*(t/100),a=i*(1-Math.abs(o%2-1));let s=0,l=0,u=0;o>=0&&o<1?(s=i,l=a):o>=1&&o<2?(s=a,l=i):o>=2&&o<3?(l=i,u=a):o>=3&&o<4?(l=a,u=i):o>=4&&o<5?(s=a,u=i):o>=5&&o<6&&(s=i,u=a);const c=n-i/2,d=s+c,f=l+c,p=u+c;return[d,f,p].map(Iv)};function f$(e,t,r,n){return`rgba(${Rn(0,255,e).toFixed()}, ${Rn(0,255,t).toFixed()}, ${Rn(0,255,r).toFixed()}, ${parseFloat(Rn(0,1,n).toFixed(3))})`}function h$(e,t){const[r,n,o,i]=ep(e);return f$(r,n,o,i-t)}function p$(e){const[t,r,n,o]=ep(e);let i=a=>{const s=Rn(0,255,a).toString(16);return s.length===1?`0${s}`:s};return`#${i(t)}${i(r)}${i(n)}${o<1?i(Math.round(o*255)):""}`}function m$(e,t,r,n,o){for(t=t.split?t.split("."):t,n=0;nObject.keys(e).length===0,et=(e,t,r)=>{const n=m$(e,`colors.${t}`,t);try{return p$(n),n}catch{return r??"#000000"}},g$=e=>{const[t,r,n]=ep(e);return(t*299+r*587+n*114)/1e3},y$=e=>t=>{const r=et(t,e);return g$(r)<128?"dark":"light"},b$=e=>t=>y$(e)(t)==="dark",Qo=(e,t)=>r=>{const n=et(r,e);return h$(n,1-t)};function Lv(e="1rem",t="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( + 45deg, + ${t} 25%, + transparent 25%, + transparent 50%, + ${t} 50%, + ${t} 75%, + transparent 75%, + transparent + )`,backgroundSize:`${e} ${e}`}}var S$=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function x$(e){const t=S$();return!e||v$(e)?t:e.string&&e.colors?k$(e.string,e.colors):e.string&&!e.colors?w$(e.string):e.colors&&!e.string?C$(e.colors):t}function w$(e){let t=0;if(e.length===0)return t.toString();for(let n=0;n>n*8&255;r+=`00${o.toString(16)}`.substr(-2)}return r}function k$(e,t){let r=0;if(e.length===0)return t[0];for(let n=0;nr.colorMode==="dark"?t:e}function tp(e){const{orientation:t,vertical:r,horizontal:n}=e;return t?t==="vertical"?r:n:{}}function Mb(e){return Kt(e)&&e.reference?e.reference:String(e)}var Lu=(e,...t)=>t.map(Mb).join(` ${e} `).replace(/calc/g,""),Ov=(...e)=>`calc(${Lu("+",...e)})`,Bv=(...e)=>`calc(${Lu("-",...e)})`,bf=(...e)=>`calc(${Lu("*",...e)})`,jv=(...e)=>`calc(${Lu("/",...e)})`,Nv=e=>{const t=Mb(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:bf(t,-1)},xr=Object.assign(e=>({add:(...t)=>xr(Ov(e,...t)),subtract:(...t)=>xr(Bv(e,...t)),multiply:(...t)=>xr(bf(e,...t)),divide:(...t)=>xr(jv(e,...t)),negate:()=>xr(Nv(e)),toString:()=>e.toString()}),{add:Ov,subtract:Bv,multiply:bf,divide:jv,negate:Nv});function _$(e){return!Number.isInteger(parseFloat(e.toString()))}function P$(e,t="-"){return e.replace(/\s+/g,t)}function zb(e){const t=P$(e.toString());return t.includes("\\.")?e:_$(e)?t.replace(".","\\."):e}function T$(e,t=""){return[t,zb(e)].filter(Boolean).join("-")}function E$(e,t){return`var(${zb(e)}${t?`, ${t}`:""})`}function $$(e,t=""){return`--${T$(e,t)}`}function Me(e,t){const r=$$(e,t==null?void 0:t.prefix);return{variable:r,reference:E$(r,A$(t==null?void 0:t.fallback))}}function A$(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:R$,definePartsStyle:tl}=le(qE.keys),Ki=Me("switch-track-width"),Dn=Me("switch-track-height"),Fc=Me("switch-track-diff"),M$=xr.subtract(Ki,Dn),Sf=Me("switch-thumb-x"),Si=Me("switch-bg"),z$=e=>{const{colorScheme:t}=e;return{borderRadius:"full",p:"0.5",width:[Ki.reference],height:[Dn.reference],transitionProperty:"common",transitionDuration:"fast",[Si.variable]:"colors.gray.300",_dark:{[Si.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[Si.variable]:`colors.${t}.500`,_dark:{[Si.variable]:`colors.${t}.200`}},bg:Si.reference}},F$={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[Dn.reference],height:[Dn.reference],_checked:{transform:`translateX(${Sf.reference})`}},D$=tl(e=>({container:{[Fc.variable]:M$,[Sf.variable]:Fc.reference,_rtl:{[Sf.variable]:xr(Fc).negate().toString()}},track:z$(e),thumb:F$})),I$={sm:tl({container:{[Ki.variable]:"1.375rem",[Dn.variable]:"sizes.3"}}),md:tl({container:{[Ki.variable]:"1.875rem",[Dn.variable]:"sizes.4"}}),lg:tl({container:{[Ki.variable]:"2.875rem",[Dn.variable]:"sizes.6"}})},L$=R$({baseStyle:D$,sizes:I$,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:O$,definePartsStyle:Do}=le(ZE.keys),B$=Do({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),Wl={"&[data-is-numeric=true]":{textAlign:"end"}},j$=Do(e=>{const{colorScheme:t}=e;return{th:{color:L("gray.600","gray.400")(e),borderBottom:"1px",borderColor:L(`${t}.100`,`${t}.700`)(e),...Wl},td:{borderBottom:"1px",borderColor:L(`${t}.100`,`${t}.700`)(e),...Wl},caption:{color:L("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),N$=Do(e=>{const{colorScheme:t}=e;return{th:{color:L("gray.600","gray.400")(e),borderBottom:"1px",borderColor:L(`${t}.100`,`${t}.700`)(e),...Wl},td:{borderBottom:"1px",borderColor:L(`${t}.100`,`${t}.700`)(e),...Wl},caption:{color:L("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:L(`${t}.100`,`${t}.700`)(e)},td:{background:L(`${t}.100`,`${t}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),V$={simple:j$,striped:N$,unstyled:{}},W$={sm:Do({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:Do({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:Do({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},U$=O$({baseStyle:B$,variants:V$,sizes:W$,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),st=O("tabs-color"),Ut=O("tabs-bg"),_s=O("tabs-border-color"),{defineMultiStyleConfig:H$,definePartsStyle:fr}=le(JE.keys),G$=e=>{const{orientation:t}=e;return{display:t==="vertical"?"flex":"block"}},K$=e=>{const{isFitted:t}=e;return{flex:t?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},Y$=e=>{const{align:t="start",orientation:r}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[t],flexDirection:r==="vertical"?"column":"row"}},X$={p:4},Q$=fr(e=>({root:G$(e),tab:K$(e),tablist:Y$(e),tabpanel:X$})),q$={sm:fr({tab:{py:1,px:4,fontSize:"sm"}}),md:fr({tab:{fontSize:"md",py:2,px:4}}),lg:fr({tab:{fontSize:"lg",py:3,px:4}})},Z$=fr(e=>{const{colorScheme:t,orientation:r}=e,n=r==="vertical",o=n?"borderStart":"borderBottom",i=n?"marginStart":"marginBottom";return{tablist:{[o]:"2px solid",borderColor:"inherit"},tab:{[o]:"2px solid",borderColor:"transparent",[i]:"-2px",_selected:{[st.variable]:`colors.${t}.600`,_dark:{[st.variable]:`colors.${t}.300`},borderColor:"currentColor"},_active:{[Ut.variable]:"colors.gray.200",_dark:{[Ut.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:st.reference,bg:Ut.reference}}}),J$=fr(e=>{const{colorScheme:t}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[_s.variable]:"transparent",_selected:{[st.variable]:`colors.${t}.600`,[_s.variable]:"colors.white",_dark:{[st.variable]:`colors.${t}.300`,[_s.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:_s.reference},color:st.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),e5=fr(e=>{const{colorScheme:t}=e;return{tab:{border:"1px solid",borderColor:"inherit",[Ut.variable]:"colors.gray.50",_dark:{[Ut.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[Ut.variable]:"colors.white",[st.variable]:`colors.${t}.600`,_dark:{[Ut.variable]:"colors.gray.800",[st.variable]:`colors.${t}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:st.reference,bg:Ut.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),t5=fr(e=>{const{colorScheme:t,theme:r}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:et(r,`${t}.700`),bg:et(r,`${t}.100`)}}}}),r5=fr(e=>{const{colorScheme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[st.variable]:"colors.gray.600",_dark:{[st.variable]:"inherit"},_selected:{[st.variable]:"colors.white",[Ut.variable]:`colors.${t}.600`,_dark:{[st.variable]:"colors.gray.800",[Ut.variable]:`colors.${t}.300`}},color:st.reference,bg:Ut.reference}}}),n5=fr({}),o5={line:Z$,enclosed:J$,"enclosed-colored":e5,"soft-rounded":t5,"solid-rounded":r5,unstyled:n5},i5=H$({baseStyle:Q$,sizes:q$,variants:o5,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),Ce=PT("badge",["bg","color","shadow"]),a5={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:Ce.bg.reference,color:Ce.color.reference,boxShadow:Ce.shadow.reference},s5=e=>{const{colorScheme:t,theme:r}=e,n=Qo(`${t}.500`,.6)(r);return{[Ce.bg.variable]:`colors.${t}.500`,[Ce.color.variable]:"colors.white",_dark:{[Ce.bg.variable]:n,[Ce.color.variable]:"colors.whiteAlpha.800"}}},l5=e=>{const{colorScheme:t,theme:r}=e,n=Qo(`${t}.200`,.16)(r);return{[Ce.bg.variable]:`colors.${t}.100`,[Ce.color.variable]:`colors.${t}.800`,_dark:{[Ce.bg.variable]:n,[Ce.color.variable]:`colors.${t}.200`}}},u5=e=>{const{colorScheme:t,theme:r}=e,n=Qo(`${t}.200`,.8)(r);return{[Ce.color.variable]:`colors.${t}.500`,_dark:{[Ce.color.variable]:n},[Ce.shadow.variable]:`inset 0 0 0px 1px ${Ce.color.reference}`}},c5={solid:s5,subtle:l5,outline:u5},Yi={baseStyle:a5,variants:c5,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:d5,definePartsStyle:In}=le(e$.keys),Vv=O("tag-bg"),Wv=O("tag-color"),Dc=O("tag-shadow"),rl=O("tag-min-height"),nl=O("tag-min-width"),ol=O("tag-font-size"),il=O("tag-padding-inline"),f5={fontWeight:"medium",lineHeight:1.2,outline:0,[Wv.variable]:Ce.color.reference,[Vv.variable]:Ce.bg.reference,[Dc.variable]:Ce.shadow.reference,color:Wv.reference,bg:Vv.reference,boxShadow:Dc.reference,borderRadius:"md",minH:rl.reference,minW:nl.reference,fontSize:ol.reference,px:il.reference,_focusVisible:{[Dc.variable]:"shadows.outline"}},h5={lineHeight:1.2,overflow:"visible"},p5={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},m5=In({container:f5,label:h5,closeButton:p5}),v5={sm:In({container:{[rl.variable]:"sizes.5",[nl.variable]:"sizes.5",[ol.variable]:"fontSizes.xs",[il.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:In({container:{[rl.variable]:"sizes.6",[nl.variable]:"sizes.6",[ol.variable]:"fontSizes.sm",[il.variable]:"space.2"}}),lg:In({container:{[rl.variable]:"sizes.8",[nl.variable]:"sizes.8",[ol.variable]:"fontSizes.md",[il.variable]:"space.3"}})},g5={subtle:In(e=>{var t;return{container:(t=Yi.variants)==null?void 0:t.subtle(e)}}),solid:In(e=>{var t;return{container:(t=Yi.variants)==null?void 0:t.solid(e)}}),outline:In(e=>{var t;return{container:(t=Yi.variants)==null?void 0:t.outline(e)}})},y5=d5({variants:g5,baseStyle:m5,sizes:v5,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:Cr,defineMultiStyleConfig:b5}=le(jE.keys),bo=O("input-height"),So=O("input-font-size"),xo=O("input-padding"),wo=O("input-border-radius"),S5=Cr({addon:{height:bo.reference,fontSize:So.reference,px:xo.reference,borderRadius:wo.reference},field:{width:"100%",height:bo.reference,fontSize:So.reference,px:xo.reference,borderRadius:wo.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),jr={lg:{[So.variable]:"fontSizes.lg",[xo.variable]:"space.4",[wo.variable]:"radii.md",[bo.variable]:"sizes.12"},md:{[So.variable]:"fontSizes.md",[xo.variable]:"space.4",[wo.variable]:"radii.md",[bo.variable]:"sizes.10"},sm:{[So.variable]:"fontSizes.sm",[xo.variable]:"space.3",[wo.variable]:"radii.sm",[bo.variable]:"sizes.8"},xs:{[So.variable]:"fontSizes.xs",[xo.variable]:"space.2",[wo.variable]:"radii.sm",[bo.variable]:"sizes.6"}},x5={lg:Cr({field:jr.lg,group:jr.lg}),md:Cr({field:jr.md,group:jr.md}),sm:Cr({field:jr.sm,group:jr.sm}),xs:Cr({field:jr.xs,group:jr.xs})};function rp(e){const{focusBorderColor:t,errorBorderColor:r}=e;return{focusBorderColor:t||L("blue.500","blue.300")(e),errorBorderColor:r||L("red.500","red.300")(e)}}var w5=Cr(e=>{const{theme:t}=e,{focusBorderColor:r,errorBorderColor:n}=rp(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:L("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:et(t,n),boxShadow:`0 0 0 1px ${et(t,n)}`},_focusVisible:{zIndex:1,borderColor:et(t,r),boxShadow:`0 0 0 1px ${et(t,r)}`}},addon:{border:"1px solid",borderColor:L("inherit","whiteAlpha.50")(e),bg:L("gray.100","whiteAlpha.300")(e)}}}),k5=Cr(e=>{const{theme:t}=e,{focusBorderColor:r,errorBorderColor:n}=rp(e);return{field:{border:"2px solid",borderColor:"transparent",bg:L("gray.100","whiteAlpha.50")(e),_hover:{bg:L("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:et(t,n)},_focusVisible:{bg:"transparent",borderColor:et(t,r)}},addon:{border:"2px solid",borderColor:"transparent",bg:L("gray.100","whiteAlpha.50")(e)}}}),C5=Cr(e=>{const{theme:t}=e,{focusBorderColor:r,errorBorderColor:n}=rp(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:et(t,n),boxShadow:`0px 1px 0px 0px ${et(t,n)}`},_focusVisible:{borderColor:et(t,r),boxShadow:`0px 1px 0px 0px ${et(t,r)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),_5=Cr({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),P5={outline:w5,filled:k5,flushed:C5,unstyled:_5},Z=b5({baseStyle:S5,sizes:x5,variants:P5,defaultProps:{size:"md",variant:"outline"}}),Uv,T5={...(Uv=Z.baseStyle)==null?void 0:Uv.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},Hv,Gv,E5={outline:e=>{var t,r;return(r=(t=Z.variants)==null?void 0:t.outline(e).field)!=null?r:{}},flushed:e=>{var t,r;return(r=(t=Z.variants)==null?void 0:t.flushed(e).field)!=null?r:{}},filled:e=>{var t,r;return(r=(t=Z.variants)==null?void 0:t.filled(e).field)!=null?r:{}},unstyled:(Gv=(Hv=Z.variants)==null?void 0:Hv.unstyled.field)!=null?Gv:{}},Kv,Yv,Xv,Qv,qv,Zv,Jv,eg,$5={xs:(Yv=(Kv=Z.sizes)==null?void 0:Kv.xs.field)!=null?Yv:{},sm:(Qv=(Xv=Z.sizes)==null?void 0:Xv.sm.field)!=null?Qv:{},md:(Zv=(qv=Z.sizes)==null?void 0:qv.md.field)!=null?Zv:{},lg:(eg=(Jv=Z.sizes)==null?void 0:Jv.lg.field)!=null?eg:{}},A5={baseStyle:T5,sizes:$5,variants:E5,defaultProps:{size:"md",variant:"outline"}},Ps=Me("tooltip-bg"),Ic=Me("tooltip-fg"),R5=Me("popper-arrow-bg"),M5={bg:Ps.reference,color:Ic.reference,[Ps.variable]:"colors.gray.700",[Ic.variable]:"colors.whiteAlpha.900",_dark:{[Ps.variable]:"colors.gray.300",[Ic.variable]:"colors.gray.900"},[R5.variable]:Ps.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},z5={baseStyle:M5},{defineMultiStyleConfig:F5,definePartsStyle:zi}=le(GE.keys),D5=e=>{const{colorScheme:t,theme:r,isIndeterminate:n,hasStripe:o}=e,i=L(Lv(),Lv("1rem","rgba(0,0,0,0.1)"))(e),a=L(`${t}.500`,`${t}.200`)(e),s=`linear-gradient( + to right, + transparent 0%, + ${et(r,a)} 50%, + transparent 100% + )`;return{...!n&&o&&i,...n?{bgImage:s}:{bgColor:a}}},I5={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},L5=e=>({bg:L("gray.100","whiteAlpha.300")(e)}),O5=e=>({transitionProperty:"common",transitionDuration:"slow",...D5(e)}),B5=zi(e=>({label:I5,filledTrack:O5(e),track:L5(e)})),j5={xs:zi({track:{h:"1"}}),sm:zi({track:{h:"2"}}),md:zi({track:{h:"3"}}),lg:zi({track:{h:"4"}})},N5=F5({sizes:j5,baseStyle:B5,defaultProps:{size:"md",colorScheme:"blue"}}),V5=e=>typeof e=="function";function rt(e,...t){return V5(e)?e(...t):e}var{definePartsStyle:al,defineMultiStyleConfig:W5}=le(DE.keys),Xi=O("checkbox-size"),U5=e=>{const{colorScheme:t}=e;return{w:Xi.reference,h:Xi.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:L(`${t}.500`,`${t}.200`)(e),borderColor:L(`${t}.500`,`${t}.200`)(e),color:L("white","gray.900")(e),_hover:{bg:L(`${t}.600`,`${t}.300`)(e),borderColor:L(`${t}.600`,`${t}.300`)(e)},_disabled:{borderColor:L("gray.200","transparent")(e),bg:L("gray.200","whiteAlpha.300")(e),color:L("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:L(`${t}.500`,`${t}.200`)(e),borderColor:L(`${t}.500`,`${t}.200`)(e),color:L("white","gray.900")(e)},_disabled:{bg:L("gray.100","whiteAlpha.100")(e),borderColor:L("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:L("red.500","red.300")(e)}}},H5={_disabled:{cursor:"not-allowed"}},G5={userSelect:"none",_disabled:{opacity:.4}},K5={transitionProperty:"transform",transitionDuration:"normal"},Y5=al(e=>({icon:K5,container:H5,control:rt(U5,e),label:G5})),X5={sm:al({control:{[Xi.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:al({control:{[Xi.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:al({control:{[Xi.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},Ul=W5({baseStyle:Y5,sizes:X5,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:Q5,definePartsStyle:sl}=le(KE.keys),q5=e=>{var t;const r=(t=rt(Ul.baseStyle,e))==null?void 0:t.control;return{...r,borderRadius:"full",_checked:{...r==null?void 0:r._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},Z5=sl(e=>{var t,r,n,o;return{label:(r=(t=Ul).baseStyle)==null?void 0:r.call(t,e).label,container:(o=(n=Ul).baseStyle)==null?void 0:o.call(n,e).container,control:q5(e)}}),J5={md:sl({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:sl({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:sl({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},eA=Q5({baseStyle:Z5,sizes:J5,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:tA,definePartsStyle:rA}=le(YE.keys),Ts=O("select-bg"),tg,nA={...(tg=Z.baseStyle)==null?void 0:tg.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:Ts.reference,[Ts.variable]:"colors.white",_dark:{[Ts.variable]:"colors.gray.700"},"> option, > optgroup":{bg:Ts.reference}},oA={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},iA=rA({field:nA,icon:oA}),Es={paddingInlineEnd:"8"},rg,ng,og,ig,ag,sg,lg,ug,aA={lg:{...(rg=Z.sizes)==null?void 0:rg.lg,field:{...(ng=Z.sizes)==null?void 0:ng.lg.field,...Es}},md:{...(og=Z.sizes)==null?void 0:og.md,field:{...(ig=Z.sizes)==null?void 0:ig.md.field,...Es}},sm:{...(ag=Z.sizes)==null?void 0:ag.sm,field:{...(sg=Z.sizes)==null?void 0:sg.sm.field,...Es}},xs:{...(lg=Z.sizes)==null?void 0:lg.xs,field:{...(ug=Z.sizes)==null?void 0:ug.xs.field,...Es},icon:{insetEnd:"1"}}},sA=tA({baseStyle:iA,sizes:aA,variants:Z.variants,defaultProps:Z.defaultProps}),Lc=O("skeleton-start-color"),Oc=O("skeleton-end-color"),lA={[Lc.variable]:"colors.gray.100",[Oc.variable]:"colors.gray.400",_dark:{[Lc.variable]:"colors.gray.800",[Oc.variable]:"colors.gray.600"},background:Lc.reference,borderColor:Oc.reference,opacity:.7,borderRadius:"sm"},uA={baseStyle:lA},Bc=O("skip-link-bg"),cA={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[Bc.variable]:"colors.white",_dark:{[Bc.variable]:"colors.gray.700"},bg:Bc.reference}},dA={baseStyle:cA},{defineMultiStyleConfig:fA,definePartsStyle:Ou}=le(XE.keys),Ca=O("slider-thumb-size"),_a=O("slider-track-size"),Yr=O("slider-bg"),hA=e=>{const{orientation:t}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...tp({orientation:t,vertical:{h:"100%"},horizontal:{w:"100%"}})}},pA=e=>({...tp({orientation:e.orientation,horizontal:{h:_a.reference},vertical:{w:_a.reference}}),overflow:"hidden",borderRadius:"sm",[Yr.variable]:"colors.gray.200",_dark:{[Yr.variable]:"colors.whiteAlpha.200"},_disabled:{[Yr.variable]:"colors.gray.300",_dark:{[Yr.variable]:"colors.whiteAlpha.300"}},bg:Yr.reference}),mA=e=>{const{orientation:t}=e;return{...tp({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:Ca.reference,h:Ca.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},vA=e=>{const{colorScheme:t}=e;return{width:"inherit",height:"inherit",[Yr.variable]:`colors.${t}.500`,_dark:{[Yr.variable]:`colors.${t}.200`},bg:Yr.reference}},gA=Ou(e=>({container:hA(e),track:pA(e),thumb:mA(e),filledTrack:vA(e)})),yA=Ou({container:{[Ca.variable]:"sizes.4",[_a.variable]:"sizes.1"}}),bA=Ou({container:{[Ca.variable]:"sizes.3.5",[_a.variable]:"sizes.1"}}),SA=Ou({container:{[Ca.variable]:"sizes.2.5",[_a.variable]:"sizes.0.5"}}),xA={lg:yA,md:bA,sm:SA},wA=fA({baseStyle:gA,sizes:xA,defaultProps:{size:"md",colorScheme:"blue"}}),Tn=Me("spinner-size"),kA={width:[Tn.reference],height:[Tn.reference]},CA={xs:{[Tn.variable]:"sizes.3"},sm:{[Tn.variable]:"sizes.4"},md:{[Tn.variable]:"sizes.6"},lg:{[Tn.variable]:"sizes.8"},xl:{[Tn.variable]:"sizes.12"}},_A={baseStyle:kA,sizes:CA,defaultProps:{size:"md"}},{defineMultiStyleConfig:PA,definePartsStyle:Fb}=le(QE.keys),TA={fontWeight:"medium"},EA={opacity:.8,marginBottom:"2"},$A={verticalAlign:"baseline",fontWeight:"semibold"},AA={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},RA=Fb({container:{},label:TA,helpText:EA,number:$A,icon:AA}),MA={md:Fb({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},zA=PA({baseStyle:RA,sizes:MA,defaultProps:{size:"md"}}),jc=O("kbd-bg"),FA={[jc.variable]:"colors.gray.100",_dark:{[jc.variable]:"colors.whiteAlpha.100"},bg:jc.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},DA={baseStyle:FA},IA={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},LA={baseStyle:IA},{defineMultiStyleConfig:OA,definePartsStyle:BA}=le(NE.keys),jA={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},NA=BA({icon:jA}),VA=OA({baseStyle:NA}),{defineMultiStyleConfig:WA,definePartsStyle:UA}=le(VE.keys),rr=O("menu-bg"),Nc=O("menu-shadow"),HA={[rr.variable]:"#fff",[Nc.variable]:"shadows.sm",_dark:{[rr.variable]:"colors.gray.700",[Nc.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:rr.reference,boxShadow:Nc.reference},GA={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[rr.variable]:"colors.gray.100",_dark:{[rr.variable]:"colors.whiteAlpha.100"}},_active:{[rr.variable]:"colors.gray.200",_dark:{[rr.variable]:"colors.whiteAlpha.200"}},_expanded:{[rr.variable]:"colors.gray.100",_dark:{[rr.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:rr.reference},KA={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},YA={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},XA={opacity:.6},QA={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},qA={transitionProperty:"common",transitionDuration:"normal"},ZA=UA({button:qA,list:HA,item:GA,groupTitle:KA,icon:YA,command:XA,divider:QA}),JA=WA({baseStyle:ZA}),{defineMultiStyleConfig:eR,definePartsStyle:xf}=le(WE.keys),Vc=O("modal-bg"),Wc=O("modal-shadow"),tR={bg:"blackAlpha.600",zIndex:"modal"},rR=e=>{const{isCentered:t,scrollBehavior:r}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:t?"center":"flex-start",overflow:r==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},nR=e=>{const{isCentered:t,scrollBehavior:r}=e;return{borderRadius:"md",color:"inherit",my:t?"auto":"16",mx:t?"auto":void 0,zIndex:"modal",maxH:r==="inside"?"calc(100% - 7.5rem)":void 0,[Vc.variable]:"colors.white",[Wc.variable]:"shadows.lg",_dark:{[Vc.variable]:"colors.gray.700",[Wc.variable]:"shadows.dark-lg"},bg:Vc.reference,boxShadow:Wc.reference}},oR={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},iR={position:"absolute",top:"2",insetEnd:"3"},aR=e=>{const{scrollBehavior:t}=e;return{px:"6",py:"2",flex:"1",overflow:t==="inside"?"auto":void 0}},sR={px:"6",py:"4"},lR=xf(e=>({overlay:tR,dialogContainer:rt(rR,e),dialog:rt(nR,e),header:oR,closeButton:iR,body:rt(aR,e),footer:sR}));function jt(e){return xf(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var uR={xs:jt("xs"),sm:jt("sm"),md:jt("md"),lg:jt("lg"),xl:jt("xl"),"2xl":jt("2xl"),"3xl":jt("3xl"),"4xl":jt("4xl"),"5xl":jt("5xl"),"6xl":jt("6xl"),full:jt("full")},cR=eR({baseStyle:lR,sizes:uR,defaultProps:{size:"md"}}),{defineMultiStyleConfig:dR,definePartsStyle:Db}=le(UE.keys),np=Me("number-input-stepper-width"),Ib=Me("number-input-input-padding"),fR=xr(np).add("0.5rem").toString(),Uc=Me("number-input-bg"),Hc=Me("number-input-color"),Gc=Me("number-input-border-color"),hR={[np.variable]:"sizes.6",[Ib.variable]:fR},pR=e=>{var t,r;return(r=(t=rt(Z.baseStyle,e))==null?void 0:t.field)!=null?r:{}},mR={width:np.reference},vR={borderStart:"1px solid",borderStartColor:Gc.reference,color:Hc.reference,bg:Uc.reference,[Hc.variable]:"colors.chakra-body-text",[Gc.variable]:"colors.chakra-border-color",_dark:{[Hc.variable]:"colors.whiteAlpha.800",[Gc.variable]:"colors.whiteAlpha.300"},_active:{[Uc.variable]:"colors.gray.200",_dark:{[Uc.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},gR=Db(e=>{var t;return{root:hR,field:(t=rt(pR,e))!=null?t:{},stepperGroup:mR,stepper:vR}});function $s(e){var t,r,n;const o=(t=Z.sizes)==null?void 0:t[e],i={lg:"md",md:"md",sm:"sm",xs:"sm"},a=(n=(r=o.field)==null?void 0:r.fontSize)!=null?n:"md",s=$b.fontSizes[a];return Db({field:{...o.field,paddingInlineEnd:Ib.reference,verticalAlign:"top"},stepper:{fontSize:xr(s).multiply(.75).toString(),_first:{borderTopEndRadius:i[e]},_last:{borderBottomEndRadius:i[e],mt:"-1px",borderTopWidth:1}}})}var yR={xs:$s("xs"),sm:$s("sm"),md:$s("md"),lg:$s("lg")},bR=dR({baseStyle:gR,sizes:yR,variants:Z.variants,defaultProps:Z.defaultProps}),cg,SR={...(cg=Z.baseStyle)==null?void 0:cg.field,textAlign:"center"},xR={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},dg,fg,wR={outline:e=>{var t,r,n;return(n=(r=rt((t=Z.variants)==null?void 0:t.outline,e))==null?void 0:r.field)!=null?n:{}},flushed:e=>{var t,r,n;return(n=(r=rt((t=Z.variants)==null?void 0:t.flushed,e))==null?void 0:r.field)!=null?n:{}},filled:e=>{var t,r,n;return(n=(r=rt((t=Z.variants)==null?void 0:t.filled,e))==null?void 0:r.field)!=null?n:{}},unstyled:(fg=(dg=Z.variants)==null?void 0:dg.unstyled.field)!=null?fg:{}},kR={baseStyle:SR,sizes:xR,variants:wR,defaultProps:Z.defaultProps},{defineMultiStyleConfig:CR,definePartsStyle:_R}=le(HE.keys),As=Me("popper-bg"),PR=Me("popper-arrow-bg"),hg=Me("popper-arrow-shadow-color"),TR={zIndex:10},ER={[As.variable]:"colors.white",bg:As.reference,[PR.variable]:As.reference,[hg.variable]:"colors.gray.200",_dark:{[As.variable]:"colors.gray.700",[hg.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},$R={px:3,py:2,borderBottomWidth:"1px"},AR={px:3,py:2},RR={px:3,py:2,borderTopWidth:"1px"},MR={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},zR=_R({popper:TR,content:ER,header:$R,body:AR,footer:RR,closeButton:MR}),FR=CR({baseStyle:zR}),{definePartsStyle:wf,defineMultiStyleConfig:DR}=le(IE.keys),Kc=O("drawer-bg"),Yc=O("drawer-box-shadow");function eo(e){return wf(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var IR={bg:"blackAlpha.600",zIndex:"modal"},LR={display:"flex",zIndex:"modal",justifyContent:"center"},OR=e=>{const{isFullHeight:t}=e;return{...t&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[Kc.variable]:"colors.white",[Yc.variable]:"shadows.lg",_dark:{[Kc.variable]:"colors.gray.700",[Yc.variable]:"shadows.dark-lg"},bg:Kc.reference,boxShadow:Yc.reference}},BR={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},jR={position:"absolute",top:"2",insetEnd:"3"},NR={px:"6",py:"2",flex:"1",overflow:"auto"},VR={px:"6",py:"4"},WR=wf(e=>({overlay:IR,dialogContainer:LR,dialog:rt(OR,e),header:BR,closeButton:jR,body:NR,footer:VR})),UR={xs:eo("xs"),sm:eo("md"),md:eo("lg"),lg:eo("2xl"),xl:eo("4xl"),full:eo("full")},HR=DR({baseStyle:WR,sizes:UR,defaultProps:{size:"xs"}}),{definePartsStyle:GR,defineMultiStyleConfig:KR}=le(LE.keys),YR={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},XR={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},QR={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},qR=GR({preview:YR,input:XR,textarea:QR}),ZR=KR({baseStyle:qR}),{definePartsStyle:JR,defineMultiStyleConfig:eM}=le(OE.keys),Io=O("form-control-color"),tM={marginStart:"1",[Io.variable]:"colors.red.500",_dark:{[Io.variable]:"colors.red.300"},color:Io.reference},rM={mt:"2",[Io.variable]:"colors.gray.600",_dark:{[Io.variable]:"colors.whiteAlpha.600"},color:Io.reference,lineHeight:"normal",fontSize:"sm"},nM=JR({container:{width:"100%",position:"relative"},requiredIndicator:tM,helperText:rM}),oM=eM({baseStyle:nM}),{definePartsStyle:iM,defineMultiStyleConfig:aM}=le(BE.keys),Lo=O("form-error-color"),sM={[Lo.variable]:"colors.red.500",_dark:{[Lo.variable]:"colors.red.300"},color:Lo.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},lM={marginEnd:"0.5em",[Lo.variable]:"colors.red.500",_dark:{[Lo.variable]:"colors.red.300"},color:Lo.reference},uM=iM({text:sM,icon:lM}),cM=aM({baseStyle:uM}),dM={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},fM={baseStyle:dM},hM={fontFamily:"heading",fontWeight:"bold"},pM={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},mM={baseStyle:hM,sizes:pM,defaultProps:{size:"xl"}},{defineMultiStyleConfig:vM,definePartsStyle:gM}=le(FE.keys),Xc=O("breadcrumb-link-decor"),yM={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:Xc.reference,[Xc.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[Xc.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},bM=gM({link:yM}),SM=vM({baseStyle:bM}),xM={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},Lb=e=>{const{colorScheme:t,theme:r}=e;if(t==="gray")return{color:L("gray.800","whiteAlpha.900")(e),_hover:{bg:L("gray.100","whiteAlpha.200")(e)},_active:{bg:L("gray.200","whiteAlpha.300")(e)}};const n=Qo(`${t}.200`,.12)(r),o=Qo(`${t}.200`,.24)(r);return{color:L(`${t}.600`,`${t}.200`)(e),bg:"transparent",_hover:{bg:L(`${t}.50`,n)(e)},_active:{bg:L(`${t}.100`,o)(e)}}},wM=e=>{const{colorScheme:t}=e,r=L("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?r:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...rt(Lb,e)}},kM={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},CM=e=>{var t;const{colorScheme:r}=e;if(r==="gray"){const l=L("gray.100","whiteAlpha.200")(e);return{bg:l,color:L("gray.800","whiteAlpha.900")(e),_hover:{bg:L("gray.200","whiteAlpha.300")(e),_disabled:{bg:l}},_active:{bg:L("gray.300","whiteAlpha.400")(e)}}}const{bg:n=`${r}.500`,color:o="white",hoverBg:i=`${r}.600`,activeBg:a=`${r}.700`}=(t=kM[r])!=null?t:{},s=L(n,`${r}.200`)(e);return{bg:s,color:L(o,"gray.800")(e),_hover:{bg:L(i,`${r}.300`)(e),_disabled:{bg:s}},_active:{bg:L(a,`${r}.400`)(e)}}},_M=e=>{const{colorScheme:t}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:L(`${t}.500`,`${t}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:L(`${t}.700`,`${t}.500`)(e)}}},PM={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},TM={ghost:Lb,outline:wM,solid:CM,link:_M,unstyled:PM},EM={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},$M={baseStyle:xM,variants:TM,sizes:EM,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:Ln,defineMultiStyleConfig:AM}=le(t$.keys),Hl=O("card-bg"),Tr=O("card-padding"),Ob=O("card-shadow"),ll=O("card-radius"),Bb=O("card-border-width","0"),jb=O("card-border-color"),RM=Ln({container:{[Hl.variable]:"colors.chakra-body-bg",backgroundColor:Hl.reference,boxShadow:Ob.reference,borderRadius:ll.reference,color:"chakra-body-text",borderWidth:Bb.reference,borderColor:jb.reference},body:{padding:Tr.reference,flex:"1 1 0%"},header:{padding:Tr.reference},footer:{padding:Tr.reference}}),MM={sm:Ln({container:{[ll.variable]:"radii.base",[Tr.variable]:"space.3"}}),md:Ln({container:{[ll.variable]:"radii.md",[Tr.variable]:"space.5"}}),lg:Ln({container:{[ll.variable]:"radii.xl",[Tr.variable]:"space.7"}})},zM={elevated:Ln({container:{[Ob.variable]:"shadows.base",_dark:{[Hl.variable]:"colors.gray.700"}}}),outline:Ln({container:{[Bb.variable]:"1px",[jb.variable]:"colors.chakra-border-color"}}),filled:Ln({container:{[Hl.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[Tr.variable]:0},header:{[Tr.variable]:0},footer:{[Tr.variable]:0}}},FM=AM({baseStyle:RM,variants:zM,sizes:MM,defaultProps:{variant:"elevated",size:"md"}}),Qi=Me("close-button-size"),xi=Me("close-button-bg"),DM={w:[Qi.reference],h:[Qi.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[xi.variable]:"colors.blackAlpha.100",_dark:{[xi.variable]:"colors.whiteAlpha.100"}},_active:{[xi.variable]:"colors.blackAlpha.200",_dark:{[xi.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:xi.reference},IM={lg:{[Qi.variable]:"sizes.10",fontSize:"md"},md:{[Qi.variable]:"sizes.8",fontSize:"xs"},sm:{[Qi.variable]:"sizes.6",fontSize:"2xs"}},LM={baseStyle:DM,sizes:IM,defaultProps:{size:"md"}},{variants:OM,defaultProps:BM}=Yi,jM={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:Ce.bg.reference,color:Ce.color.reference,boxShadow:Ce.shadow.reference},NM={baseStyle:jM,variants:OM,defaultProps:BM},VM={w:"100%",mx:"auto",maxW:"prose",px:"4"},WM={baseStyle:VM},UM={opacity:.6,borderColor:"inherit"},HM={borderStyle:"solid"},GM={borderStyle:"dashed"},KM={solid:HM,dashed:GM},YM={baseStyle:UM,variants:KM,defaultProps:{variant:"solid"}},{definePartsStyle:XM,defineMultiStyleConfig:QM}=le(RE.keys),qM={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},ZM={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},JM={pt:"2",px:"4",pb:"5"},ez={fontSize:"1.25em"},tz=XM({container:qM,button:ZM,panel:JM,icon:ez}),rz=QM({baseStyle:tz}),{definePartsStyle:Na,defineMultiStyleConfig:nz}=le(ME.keys),xt=O("alert-fg"),Dr=O("alert-bg"),oz=Na({container:{bg:Dr.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:xt.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:xt.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function op(e){const{theme:t,colorScheme:r}=e,n=Qo(`${r}.200`,.16)(t);return{light:`colors.${r}.100`,dark:n}}var iz=Na(e=>{const{colorScheme:t}=e,r=op(e);return{container:{[xt.variable]:`colors.${t}.600`,[Dr.variable]:r.light,_dark:{[xt.variable]:`colors.${t}.200`,[Dr.variable]:r.dark}}}}),az=Na(e=>{const{colorScheme:t}=e,r=op(e);return{container:{[xt.variable]:`colors.${t}.600`,[Dr.variable]:r.light,_dark:{[xt.variable]:`colors.${t}.200`,[Dr.variable]:r.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:xt.reference}}}),sz=Na(e=>{const{colorScheme:t}=e,r=op(e);return{container:{[xt.variable]:`colors.${t}.600`,[Dr.variable]:r.light,_dark:{[xt.variable]:`colors.${t}.200`,[Dr.variable]:r.dark},pt:"2",borderTopWidth:"4px",borderTopColor:xt.reference}}}),lz=Na(e=>{const{colorScheme:t}=e;return{container:{[xt.variable]:"colors.white",[Dr.variable]:`colors.${t}.600`,_dark:{[xt.variable]:"colors.gray.900",[Dr.variable]:`colors.${t}.200`},color:xt.reference}}}),uz={subtle:iz,"left-accent":az,"top-accent":sz,solid:lz},cz=nz({baseStyle:oz,variants:uz,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:Nb,defineMultiStyleConfig:dz}=le(zE.keys),Oo=O("avatar-border-color"),qi=O("avatar-bg"),Pa=O("avatar-font-size"),qo=O("avatar-size"),fz={borderRadius:"full",border:"0.2em solid",borderColor:Oo.reference,[Oo.variable]:"white",_dark:{[Oo.variable]:"colors.gray.800"}},hz={bg:qi.reference,fontSize:Pa.reference,width:qo.reference,height:qo.reference,lineHeight:"1",[qi.variable]:"colors.gray.200",_dark:{[qi.variable]:"colors.whiteAlpha.400"}},pz=e=>{const{name:t,theme:r}=e,n=t?x$({string:t}):"colors.gray.400",o=b$(n)(r);let i="white";return o||(i="gray.800"),{bg:qi.reference,fontSize:Pa.reference,color:i,borderColor:Oo.reference,verticalAlign:"top",width:qo.reference,height:qo.reference,"&:not([data-loaded])":{[qi.variable]:n},[Oo.variable]:"colors.white",_dark:{[Oo.variable]:"colors.gray.800"}}},mz={fontSize:Pa.reference,lineHeight:"1"},vz=Nb(e=>({badge:rt(fz,e),excessLabel:rt(hz,e),container:rt(pz,e),label:mz}));function Nr(e){const t=e!=="100%"?Rb[e]:void 0;return Nb({container:{[qo.variable]:t??e,[Pa.variable]:`calc(${t??e} / 2.5)`},excessLabel:{[qo.variable]:t??e,[Pa.variable]:`calc(${t??e} / 2.5)`}})}var gz={"2xs":Nr(4),xs:Nr(6),sm:Nr(8),md:Nr(12),lg:Nr(16),xl:Nr(24),"2xl":Nr(32),full:Nr("100%")},yz=dz({baseStyle:vz,sizes:gz,defaultProps:{size:"md"}}),bz={Accordion:rz,Alert:cz,Avatar:yz,Badge:Yi,Breadcrumb:SM,Button:$M,Checkbox:Ul,CloseButton:LM,Code:NM,Container:WM,Divider:YM,Drawer:HR,Editable:ZR,Form:oM,FormError:cM,FormLabel:fM,Heading:mM,Input:Z,Kbd:DA,Link:LA,List:VA,Menu:JA,Modal:cR,NumberInput:bR,PinInput:kR,Popover:FR,Progress:N5,Radio:eA,Select:sA,Skeleton:uA,SkipLink:dA,Slider:wA,Spinner:_A,Stat:zA,Switch:L$,Table:U$,Tabs:i5,Tag:y5,Textarea:A5,Tooltip:z5,Card:FM,Stepper:AE},Sz={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},xz={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},wz="ltr",kz={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},Vb={semanticTokens:Sz,direction:wz,...TE,components:bz,styles:xz,config:kz};function Fi(e){return typeof e=="function"}function Cz(...e){return t=>e.reduce((r,n)=>n(r),t)}var _z=e=>function(...r){let n=[...r],o=r[r.length-1];return nE(o)&&n.length>1?n=n.slice(0,n.length-1):o=e,Cz(...n.map(i=>a=>Fi(i)?i(a):Tz(a,i)))(o)},Pz=_z(Vb);function Tz(...e){return Ft({},...e,Wb)}function Wb(e,t,r,n){if((Fi(e)||Fi(t))&&Object.prototype.hasOwnProperty.call(n,r))return(...o)=>{const i=Fi(e)?e(...o):e,a=Fi(t)?t(...o):t;return Ft({},i,a,Wb)}}function Ez(e,t){const r={};return Object.keys(e).forEach(n=>{t.includes(n)||(r[n]=e[n])}),r}function $z(e,t,r,n){const o=typeof t=="string"?t.split("."):[t];for(n=0;n{const t=new WeakMap;return(n,o,i,a)=>{if(typeof n>"u")return e(n,o,i);t.has(n)||t.set(n,new Map);const s=t.get(n);if(s.has(o))return s.get(o);const l=e(n,o,i,a);return s.set(o,l),l}},Ub=Az($z);function Hb(e,t){const r={};return Object.keys(e).forEach(n=>{const o=e[n];t(o,n,e)&&(r[n]=o)}),r}var Gb=e=>Hb(e,t=>t!=null);function Rz(e){return typeof e=="function"}function Kb(e,...t){return Rz(e)?e(...t):e}function bB(...e){return function(r){e.some(n=>(n==null||n(r),r==null?void 0:r.defaultPrevented))}}var Mz=typeof Element<"u",zz=typeof Map=="function",Fz=typeof Set=="function",Dz=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function ul(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,n,o;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!ul(e[n],t[n]))return!1;return!0}var i;if(zz&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i=e.entries();!(n=i.next()).done;)if(!t.has(n.value[0]))return!1;for(i=e.entries();!(n=i.next()).done;)if(!ul(n.value[1],t.get(n.value[0])))return!1;return!0}if(Fz&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i=e.entries();!(n=i.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(Dz&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(e[n]!==t[n])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[n]))return!1;if(Mz&&e instanceof Element)return!1;for(n=r;n--!==0;)if(!((o[n]==="_owner"||o[n]==="__v"||o[n]==="__o")&&e.$$typeof)&&!ul(e[o[n]],t[o[n]]))return!1;return!0}return e!==e&&t!==t}var Iz=function(t,r){try{return ul(t,r)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}};const Lz=Gf(Iz);function Yb(e,t={}){var r;const{styleConfig:n,...o}=t,{theme:i,colorMode:a}=IP(),s=e?Ub(i,`components.${e}`):void 0,l=n||s,u=Ft({theme:i,colorMode:a},(r=l==null?void 0:l.defaultProps)!=null?r:{},Gb(Ez(o,["children"]))),c=S.useRef({});if(l){const f=tE(l)(u);Lz(c.current,f)||(c.current=f)}return c.current}function Bu(e,t={}){return Yb(e,t)}function Xb(e,t={}){return Yb(e,t)}var Oz=new Set([...WT,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),Bz=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function jz(e){return Bz.has(e)||!Oz.has(e)}function Nz(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const r={...e};for(const n of t)if(n!=null)for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&(o in r&&delete r[o],r[o]=n[o]);return r}var Vz=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Wz=ob(function(e){return Vz.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),Uz=Wz,Hz=function(t){return t!=="theme"},pg=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?Uz:Hz},mg=function(t,r,n){var o;if(r){var i=r.shouldForwardProp;o=t.__emotion_forwardProp&&i?function(a){return t.__emotion_forwardProp(a)&&i(a)}:i}return typeof o!="function"&&n&&(o=t.__emotion_forwardProp),o},Gz=function(t){var r=t.cache,n=t.serialized,o=t.isStringTag;return cb(r,n,o),dP(function(){return db(r,n,o)}),null},Kz=function e(t,r){var n=t.__emotion_real===t,o=n&&t.__emotion_base||t,i,a;r!==void 0&&(i=r.label,a=r.target);var s=mg(t,r,n),l=s||pg(o),u=!l("as");return function(){var c=arguments,d=n&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(i!==void 0&&d.push("label:"+i+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,p=1;pt=>{const{theme:r,css:n,__css:o,sx:i,...a}=t,s=Hb(a,(d,f)=>HT(f)),l=Kb(e,t),u=Nz({},o,l,Gb(s),i),c=Eb(u)(t.theme);return n?[c,n]:c};function Qc(e,t){const{baseStyle:r,...n}=t??{};n.shouldForwardProp||(n.shouldForwardProp=jz);const o=Qz({baseStyle:r}),i=Xz(e,n)(o);return Ar.forwardRef(function(l,u){const{colorMode:c,forced:d}=Qh();return Ar.createElement(i,{ref:u,"data-theme":d?c:void 0,...l})})}function qz(){const e=new Map;return new Proxy(Qc,{apply(t,r,n){return Qc(...n)},get(t,r){return e.has(r)||e.set(r,Qc(r)),e.get(r)}})}var _e=qz();function pt(e){return S.forwardRef(e)}function Qb(e={}){const{strict:t=!0,errorMessage:r="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:n}=e,o=S.createContext(void 0);o.displayName=n;function i(){var a;const s=S.useContext(o);if(!s&&t){const l=new Error(r);throw l.name="ContextError",(a=Error.captureStackTrace)==null||a.call(Error,l,i),l}return s}return[o.Provider,i,o]}function Zz(e){const{cssVarsRoot:t,theme:r,children:n}=e,o=S.useMemo(()=>NT(r),[r]);return E.jsxs(pP,{theme:o,children:[E.jsx(Jz,{root:t}),n]})}function Jz({root:e=":host, :root"}){const t=[e,"[data-theme]"].join(",");return E.jsx(Ba,{styles:r=>({[t]:r.__cssVars})})}Qb({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function SB(e){return Qb({name:`${e}StylesContext`,errorMessage:`useStyles: "styles" is undefined. Seems you forgot to wrap the components in "<${e} />" `})}function e3(){const{colorMode:e}=Qh();return E.jsx(Ba,{styles:t=>{const r=Ub(t,"styles.global"),n=Kb(r,{theme:t,colorMode:e});return n?Eb(n)(t):void 0}})}var qb=S.createContext({getDocument(){return document},getWindow(){return window}});qb.displayName="EnvironmentContext";function Zb(e){const{children:t,environment:r,disabled:n}=e,o=S.useRef(null),i=S.useMemo(()=>r||{getDocument:()=>{var s,l;return(l=(s=o.current)==null?void 0:s.ownerDocument)!=null?l:document},getWindow:()=>{var s,l;return(l=(s=o.current)==null?void 0:s.ownerDocument.defaultView)!=null?l:window}},[r]),a=!n||!r;return E.jsxs(qb.Provider,{value:i,children:[t,a&&E.jsx("span",{id:"__chakra_env",hidden:!0,ref:o})]})}Zb.displayName="EnvironmentProvider";var t3=e=>{const{children:t,colorModeManager:r,portalZIndex:n,resetScope:o,resetCSS:i=!0,theme:a={},environment:s,cssVarsRoot:l,disableEnvironment:u,disableGlobalStyle:c}=e,d=E.jsx(Zb,{environment:s,disabled:u,children:t});return E.jsx(Zz,{theme:a,cssVarsRoot:l,children:E.jsxs(Sb,{colorModeManager:r,options:a.config,children:[i?E.jsx(yP,{scope:o}):E.jsx(gP,{}),!c&&E.jsx(e3,{}),n?E.jsx(yb,{zIndex:n,children:d}):d]})})},r3=(e,t)=>e.find(r=>r.id===t);function gg(e,t){const r=Jb(e,t),n=r?e[r].findIndex(o=>o.id===t):-1;return{position:r,index:n}}function Jb(e,t){for(const[r,n]of Object.entries(e))if(r3(n,t))return r}function n3(e){const t=e.includes("right"),r=e.includes("left");let n="center";return t&&(n="flex-end"),r&&(n="flex-start"),{display:"flex",flexDirection:"column",alignItems:n}}function o3(e){const r=e==="top"||e==="bottom"?"0 auto":void 0,n=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,o=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,i=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",a=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:r,top:n,bottom:o,right:i,left:a}}function i3(e,t=[]){const r=S.useRef(e);return S.useEffect(()=>{r.current=e}),S.useCallback((...n)=>{var o;return(o=r.current)==null?void 0:o.call(r,...n)},t)}function a3(e,t){const r=i3(e);S.useEffect(()=>{if(t==null)return;let n=null;return n=window.setTimeout(()=>{r()},t),()=>{n&&window.clearTimeout(n)}},[t,r])}function yg(e,t){const r=S.useRef(!1),n=S.useRef(!1);S.useEffect(()=>{if(r.current&&n.current)return e();n.current=!0},t),S.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[])}const eS=S.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),ju=S.createContext({}),Va=S.createContext(null),Nu=typeof document<"u",ip=Nu?S.useLayoutEffect:S.useEffect,tS=S.createContext({strict:!1}),ap=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),s3="framerAppearId",rS="data-"+ap(s3);function l3(e,t,r,n){const{visualElement:o}=S.useContext(ju),i=S.useContext(tS),a=S.useContext(Va),s=S.useContext(eS).reducedMotion,l=S.useRef();n=n||i.renderer,!l.current&&n&&(l.current=n(e,{visualState:t,parent:o,props:r,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:s}));const u=l.current;S.useInsertionEffect(()=>{u&&u.update(r,a)});const c=S.useRef(!!r[rS]);return ip(()=>{u&&(u.render(),c.current&&u.animationState&&u.animationState.animateChanges())}),S.useEffect(()=>{u&&(u.updateFeatures(),!c.current&&u.animationState&&u.animationState.animateChanges(),c.current&&(window.HandoffAppearAnimations=!1,c.current=!1))}),u}function ko(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function u3(e,t,r){return S.useCallback(n=>{n&&e.mount&&e.mount(n),t&&(n?t.mount(n):t.unmount()),r&&(typeof r=="function"?r(n):ko(r)&&(r.current=n))},[t])}function Ta(e){return typeof e=="string"||Array.isArray(e)}function Vu(e){return typeof e=="object"&&typeof e.start=="function"}const sp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lp=["initial",...sp];function Wu(e){return Vu(e.animate)||lp.some(t=>Ta(e[t]))}function nS(e){return!!(Wu(e)||e.variants)}function c3(e,t){if(Wu(e)){const{initial:r,animate:n}=e;return{initial:r===!1||Ta(r)?r:void 0,animate:Ta(n)?n:void 0}}return e.inherit!==!1?t:{}}function d3(e){const{initial:t,animate:r}=c3(e,S.useContext(ju));return S.useMemo(()=>({initial:t,animate:r}),[bg(t),bg(r)])}function bg(e){return Array.isArray(e)?e.join(" "):e}const Sg={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ea={};for(const e in Sg)Ea[e]={isEnabled:t=>Sg[e].some(r=>!!t[r])};function f3(e){for(const t in e)Ea[t]={...Ea[t],...e[t]}}const up=S.createContext({}),oS=S.createContext({}),h3=Symbol.for("motionComponentSymbol");function p3({preloadedFeatures:e,createVisualElement:t,useRender:r,useVisualState:n,Component:o}){e&&f3(e);function i(s,l){let u;const c={...S.useContext(eS),...s,layoutId:m3(s)},{isStatic:d}=c,f=d3(s),p=n(s,d);if(!d&&Nu){f.visualElement=l3(o,p,c,t);const v=S.useContext(oS),y=S.useContext(tS).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,y,e,v))}return S.createElement(ju.Provider,{value:f},u&&f.visualElement?S.createElement(u,{visualElement:f.visualElement,...c}):null,r(o,s,u3(p,f.visualElement,l),p,d,f.visualElement))}const a=S.forwardRef(i);return a[h3]=o,a}function m3({layoutId:e}){const t=S.useContext(up).id;return t&&e!==void 0?t+"-"+e:e}function v3(e){function t(n,o={}){return p3(e(n,o))}if(typeof Proxy>"u")return t;const r=new Map;return new Proxy(t,{get:(n,o)=>(r.has(o)||r.set(o,t(o)),r.get(o))})}const g3=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function cp(e){return typeof e!="string"||e.includes("-")?!1:!!(g3.indexOf(e)>-1||/[A-Z]/.test(e))}const Kl={};function y3(e){Object.assign(Kl,e)}const Wa=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Xn=new Set(Wa);function iS(e,{layout:t,layoutId:r}){return Xn.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!Kl[e]||e==="opacity")}const ht=e=>!!(e&&e.getVelocity),b3={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},S3=Wa.length;function x3(e,{enableHardwareAcceleration:t=!0,allowTransformNone:r=!0},n,o){let i="";for(let a=0;at=>typeof t=="string"&&t.startsWith(e),sS=aS("--"),kf=aS("var(--"),w3=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,k3=(e,t)=>t&&typeof e=="number"?t.transform(e):e,cn=(e,t,r)=>Math.min(Math.max(r,e),t),Qn={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Zi={...Qn,transform:e=>cn(0,1,e)},Rs={...Qn,default:1},Ji=e=>Math.round(e*1e5)/1e5,Uu=/(-)?([\d]*\.?[\d])+/g,lS=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,C3=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Ua(e){return typeof e=="string"}const Ha=e=>({test:t=>Ua(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Vr=Ha("deg"),hr=Ha("%"),j=Ha("px"),_3=Ha("vh"),P3=Ha("vw"),xg={...hr,parse:e=>hr.parse(e)/100,transform:e=>hr.transform(e*100)},wg={...Qn,transform:Math.round},uS={borderWidth:j,borderTopWidth:j,borderRightWidth:j,borderBottomWidth:j,borderLeftWidth:j,borderRadius:j,radius:j,borderTopLeftRadius:j,borderTopRightRadius:j,borderBottomRightRadius:j,borderBottomLeftRadius:j,width:j,maxWidth:j,height:j,maxHeight:j,size:j,top:j,right:j,bottom:j,left:j,padding:j,paddingTop:j,paddingRight:j,paddingBottom:j,paddingLeft:j,margin:j,marginTop:j,marginRight:j,marginBottom:j,marginLeft:j,rotate:Vr,rotateX:Vr,rotateY:Vr,rotateZ:Vr,scale:Rs,scaleX:Rs,scaleY:Rs,scaleZ:Rs,skew:Vr,skewX:Vr,skewY:Vr,distance:j,translateX:j,translateY:j,translateZ:j,x:j,y:j,z:j,perspective:j,transformPerspective:j,opacity:Zi,originX:xg,originY:xg,originZ:j,zIndex:wg,fillOpacity:Zi,strokeOpacity:Zi,numOctaves:wg};function dp(e,t,r,n){const{style:o,vars:i,transform:a,transformOrigin:s}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(sS(d)){i[d]=f;continue}const p=uS[d],v=k3(f,p);if(Xn.has(d)){if(l=!0,a[d]=v,!c)continue;f!==(p.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,s[d]=v):o[d]=v}if(t.transform||(l||n?o.transform=x3(e.transform,r,c,n):o.transform&&(o.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:p=0}=s;o.transformOrigin=`${d} ${f} ${p}`}}const fp=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function cS(e,t,r){for(const n in t)!ht(t[n])&&!iS(n,r)&&(e[n]=t[n])}function T3({transformTemplate:e},t,r){return S.useMemo(()=>{const n=fp();return dp(n,t,{enableHardwareAcceleration:!r},e),Object.assign({},n.vars,n.style)},[t])}function E3(e,t,r){const n=e.style||{},o={};return cS(o,n,e),Object.assign(o,T3(e,t,r)),e.transformValues?e.transformValues(o):o}function $3(e,t,r){const n={},o=E3(e,t,r);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=o,n}const A3=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function Yl(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||A3.has(e)}let dS=e=>!Yl(e);function R3(e){e&&(dS=t=>t.startsWith("on")?!Yl(t):e(t))}try{R3(require("@emotion/is-prop-valid").default)}catch{}function M3(e,t,r){const n={};for(const o in e)o==="values"&&typeof e.values=="object"||(dS(o)||r===!0&&Yl(o)||!t&&!Yl(o)||e.draggable&&o.startsWith("onDrag"))&&(n[o]=e[o]);return n}function kg(e,t,r){return typeof e=="string"?e:j.transform(t+r*e)}function z3(e,t,r){const n=kg(t,e.x,e.width),o=kg(r,e.y,e.height);return`${n} ${o}`}const F3={offset:"stroke-dashoffset",array:"stroke-dasharray"},D3={offset:"strokeDashoffset",array:"strokeDasharray"};function I3(e,t,r=1,n=0,o=!0){e.pathLength=1;const i=o?F3:D3;e[i.offset]=j.transform(-n);const a=j.transform(t),s=j.transform(r);e[i.array]=`${a} ${s}`}function hp(e,{attrX:t,attrY:r,attrScale:n,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...u},c,d,f){if(dp(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:v,dimensions:y}=e;p.transform&&(y&&(v.transform=p.transform),delete p.transform),y&&(o!==void 0||i!==void 0||v.transform)&&(v.transformOrigin=z3(y,o!==void 0?o:.5,i!==void 0?i:.5)),t!==void 0&&(p.x=t),r!==void 0&&(p.y=r),n!==void 0&&(p.scale=n),a!==void 0&&I3(p,a,s,l,!1)}const fS=()=>({...fp(),attrs:{}}),pp=e=>typeof e=="string"&&e.toLowerCase()==="svg";function L3(e,t,r,n){const o=S.useMemo(()=>{const i=fS();return hp(i,t,{enableHardwareAcceleration:!1},pp(n),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};cS(i,e.style,e),o.style={...i,...o.style}}return o}function O3(e=!1){return(r,n,o,{latestValues:i},a)=>{const l=(cp(r)?L3:$3)(n,i,a,r),c={...M3(n,typeof r=="string",e),...l,ref:o},{children:d}=n,f=S.useMemo(()=>ht(d)?d.get():d,[d]);return S.createElement(r,{...c,children:f})}}function hS(e,{style:t,vars:r},n,o){Object.assign(e.style,t,o&&o.getProjectionStyles(n));for(const i in r)e.style.setProperty(i,r[i])}const pS=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"]);function mS(e,t,r,n){hS(e,t,void 0,n);for(const o in t.attrs)e.setAttribute(pS.has(o)?o:ap(o),t.attrs[o])}function mp(e,t){const{style:r}=e,n={};for(const o in r)(ht(r[o])||t.style&&ht(t.style[o])||iS(o,e))&&(n[o]=r[o]);return n}function vS(e,t){const r=mp(e,t);for(const n in e)if(ht(e[n])||ht(t[n])){const o=Wa.indexOf(n)!==-1?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n;r[o]=e[n]}return r}function vp(e,t,r,n={},o={}){return typeof t=="function"&&(t=t(r!==void 0?r:e.custom,n,o)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(r!==void 0?r:e.custom,n,o)),t}function gS(e){const t=S.useRef(null);return t.current===null&&(t.current=e()),t.current}const Xl=e=>Array.isArray(e),B3=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),j3=e=>Xl(e)?e[e.length-1]||0:e;function cl(e){const t=ht(e)?e.get():e;return B3(t)?t.toValue():t}function N3({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:r},n,o,i){const a={latestValues:V3(n,o,i,e),renderState:t()};return r&&(a.mount=s=>r(n,s,a)),a}const yS=e=>(t,r)=>{const n=S.useContext(ju),o=S.useContext(Va),i=()=>N3(e,t,n,o);return r?i():gS(i)};function V3(e,t,r,n){const o={},i=n(e,{});for(const f in i)o[f]=cl(i[f]);let{initial:a,animate:s}=e;const l=Wu(e),u=nS(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let c=r?r.initial===!1:!1;c=c||a===!1;const d=c?s:a;return d&&typeof d!="boolean"&&!Vu(d)&&(Array.isArray(d)?d:[d]).forEach(p=>{const v=vp(e,p);if(!v)return;const{transitionEnd:y,transition:x,...m}=v;for(const h in m){let g=m[h];if(Array.isArray(g)){const C=c?g.length-1:0;g=g[C]}g!==null&&(o[h]=g)}for(const h in y)o[h]=y[h]}),o}const xe=e=>e;class Cg{constructor(){this.order=[],this.scheduled=new Set}add(t){if(!this.scheduled.has(t))return this.scheduled.add(t),this.order.push(t),!0}remove(t){const r=this.order.indexOf(t);r!==-1&&(this.order.splice(r,1),this.scheduled.delete(t))}clear(){this.order.length=0,this.scheduled.clear()}}function W3(e){let t=new Cg,r=new Cg,n=0,o=!1,i=!1;const a=new WeakSet,s={schedule:(l,u=!1,c=!1)=>{const d=c&&o,f=d?t:r;return u&&a.add(l),f.add(l)&&d&&o&&(n=t.order.length),l},cancel:l=>{r.remove(l),a.delete(l)},process:l=>{if(o){i=!0;return}if(o=!0,[t,r]=[r,t],r.clear(),n=t.order.length,n)for(let u=0;u(d[f]=W3(()=>r=!0),d),{}),a=d=>i[d].process(o),s=()=>{const d=performance.now();r=!1,o.delta=n?1e3/60:Math.max(Math.min(d-o.timestamp,U3),1),o.timestamp=d,o.isProcessing=!0,Ms.forEach(a),o.isProcessing=!1,r&&t&&(n=!1,e(s))},l=()=>{r=!0,n=!0,o.isProcessing||e(s)};return{schedule:Ms.reduce((d,f)=>{const p=i[f];return d[f]=(v,y=!1,x=!1)=>(r||l(),p.schedule(v,y,x)),d},{}),cancel:d=>Ms.forEach(f=>i[f].cancel(d)),state:o,steps:i}}const{schedule:se,cancel:Ir,state:De,steps:qc}=H3(typeof requestAnimationFrame<"u"?requestAnimationFrame:xe,!0),G3={useVisualState:yS({scrapeMotionValuesFromProps:vS,createRenderState:fS,onMount:(e,t,{renderState:r,latestValues:n})=>{se.read(()=>{try{r.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),se.render(()=>{hp(r,n,{enableHardwareAcceleration:!1},pp(t.tagName),e.transformTemplate),mS(t,r)})}})},K3={useVisualState:yS({scrapeMotionValuesFromProps:mp,createRenderState:fp})};function Y3(e,{forwardMotionProps:t=!1},r,n){return{...cp(e)?G3:K3,preloadedFeatures:r,useRender:O3(t),createVisualElement:n,Component:e}}function _r(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}const bS=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Hu(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const X3=e=>t=>bS(t)&&e(t,Hu(t));function Er(e,t,r,n){return _r(e,t,X3(r),n)}const Q3=(e,t)=>r=>t(e(r)),an=(...e)=>e.reduce(Q3);function SS(e){let t=null;return()=>{const r=()=>{t=null};return t===null?(t=e,r):!1}}const _g=SS("dragHorizontal"),Pg=SS("dragVertical");function xS(e){let t=!1;if(e==="y")t=Pg();else if(e==="x")t=_g();else{const r=_g(),n=Pg();r&&n?t=()=>{r(),n()}:(r&&r(),n&&n())}return t}function wS(){const e=xS(!0);return e?(e(),!1):!0}class vn{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Tg(e,t){const r="pointer"+(t?"enter":"leave"),n="onHover"+(t?"Start":"End"),o=(i,a)=>{if(i.type==="touch"||wS())return;const s=e.getProps();e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",t),s[n]&&se.update(()=>s[n](i,a))};return Er(e.current,r,o,{passive:!e.getProps()[n]})}class q3 extends vn{mount(){this.unmount=an(Tg(this.node,!0),Tg(this.node,!1))}unmount(){}}class Z3 extends vn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=an(_r(this.node.current,"focus",()=>this.onFocus()),_r(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const kS=(e,t)=>t?e===t?!0:kS(e,t.parentElement):!1;function Zc(e,t){if(!t)return;const r=new PointerEvent("pointer"+e);t(r,Hu(r))}class J3 extends vn{constructor(){super(...arguments),this.removeStartListeners=xe,this.removeEndListeners=xe,this.removeAccessibleListeners=xe,this.startPointerPress=(t,r)=>{if(this.removeEndListeners(),this.isPressing)return;const n=this.node.getProps(),i=Er(window,"pointerup",(s,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();se.update(()=>{kS(this.node.current,s.target)?u&&u(s,l):c&&c(s,l)})},{passive:!(n.onTap||n.onPointerUp)}),a=Er(window,"pointercancel",(s,l)=>this.cancelPress(s,l),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=an(i,a),this.startPress(t,r)},this.startAccessiblePress=()=>{const t=i=>{if(i.key!=="Enter"||this.isPressing)return;const a=s=>{s.key!=="Enter"||!this.checkPressEnd()||Zc("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&se.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=_r(this.node.current,"keyup",a),Zc("down",(s,l)=>{this.startPress(s,l)})},r=_r(this.node.current,"keydown",t),n=()=>{this.isPressing&&Zc("cancel",(i,a)=>this.cancelPress(i,a))},o=_r(this.node.current,"blur",n);this.removeAccessibleListeners=an(r,o)}}startPress(t,r){this.isPressing=!0;const{onTapStart:n,whileTap:o}=this.node.getProps();o&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&se.update(()=>n(t,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!wS()}cancelPress(t,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&se.update(()=>n(t,r))}mount(){const t=this.node.getProps(),r=Er(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=_r(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=an(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Cf=new WeakMap,Jc=new WeakMap,e4=e=>{const t=Cf.get(e.target);t&&t(e)},t4=e=>{e.forEach(e4)};function r4({root:e,...t}){const r=e||document;Jc.has(r)||Jc.set(r,{});const n=Jc.get(r),o=JSON.stringify(t);return n[o]||(n[o]=new IntersectionObserver(t4,{root:e,...t})),n[o]}function n4(e,t,r){const n=r4(t);return Cf.set(e,r),n.observe(e),()=>{Cf.delete(e),n.unobserve(e)}}const o4={some:0,all:1};class i4 extends vn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:r,margin:n,amount:o="some",once:i}=t,a={root:r?r.current:void 0,rootMargin:n,threshold:typeof o=="number"?o:o4[o]},s=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return n4(this.node.current,a,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some(a4(t,r))&&this.startObserver()}unmount(){}}function a4({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const s4={inView:{Feature:i4},tap:{Feature:J3},focus:{Feature:Z3},hover:{Feature:q3}};function CS(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;nt[n]=r.get()),t}function u4(e){const t={};return e.values.forEach((r,n)=>t[n]=r.getVelocity()),t}function Gu(e,t,r){const n=e.getProps();return vp(n,t,r!==void 0?r:n.custom,l4(e),u4(e))}let c4=xe,gp=xe;const sn=e=>e*1e3,$r=e=>e/1e3,d4={current:!1},_S=e=>Array.isArray(e)&&typeof e[0]=="number";function PS(e){return!!(!e||typeof e=="string"&&TS[e]||_S(e)||Array.isArray(e)&&e.every(PS))}const Di=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,TS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Di([0,.65,.55,1]),circOut:Di([.55,0,1,.45]),backIn:Di([.31,.01,.66,-.59]),backOut:Di([.33,1.53,.69,.99])};function ES(e){if(e)return _S(e)?Di(e):Array.isArray(e)?e.map(ES):TS[e]}function f4(e,t,r,{delay:n=0,duration:o,repeat:i=0,repeatType:a="loop",ease:s,times:l}={}){const u={[t]:r};l&&(u.offset=l);const c=ES(s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:n,duration:o,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"})}function h4(e,{repeat:t,repeatType:r="loop"}){const n=t&&r!=="loop"&&t%2===1?0:e.length-1;return e[n]}const $S=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,p4=1e-7,m4=12;function v4(e,t,r,n,o){let i,a,s=0;do a=t+(r-t)/2,i=$S(a,n,o)-e,i>0?r=a:t=a;while(Math.abs(i)>p4&&++sv4(i,0,1,e,r);return i=>i===0||i===1?i:$S(o(i),t,n)}const g4=Ga(.42,0,1,1),y4=Ga(0,0,.58,1),AS=Ga(.42,0,.58,1),b4=e=>Array.isArray(e)&&typeof e[0]!="number",RS=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,MS=e=>t=>1-e(1-t),zS=e=>1-Math.sin(Math.acos(e)),yp=MS(zS),S4=RS(yp),FS=Ga(.33,1.53,.69,.99),bp=MS(FS),x4=RS(bp),w4=e=>(e*=2)<1?.5*bp(e):.5*(2-Math.pow(2,-10*(e-1))),k4={linear:xe,easeIn:g4,easeInOut:AS,easeOut:y4,circIn:zS,circInOut:S4,circOut:yp,backIn:bp,backInOut:x4,backOut:FS,anticipate:w4},Eg=e=>{if(Array.isArray(e)){gp(e.length===4);const[t,r,n,o]=e;return Ga(t,r,n,o)}else if(typeof e=="string")return k4[e];return e},Sp=(e,t)=>r=>!!(Ua(r)&&C3.test(r)&&r.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(r,t)),DS=(e,t,r)=>n=>{if(!Ua(n))return n;const[o,i,a,s]=n.match(Uu);return{[e]:parseFloat(o),[t]:parseFloat(i),[r]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},C4=e=>cn(0,255,e),ed={...Qn,transform:e=>Math.round(C4(e))},Mn={test:Sp("rgb","red"),parse:DS("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+ed.transform(e)+", "+ed.transform(t)+", "+ed.transform(r)+", "+Ji(Zi.transform(n))+")"};function _4(e){let t="",r="",n="",o="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),o=e.substring(4,5),t+=t,r+=r,n+=n,o+=o),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:o?parseInt(o,16)/255:1}}const _f={test:Sp("#"),parse:_4,transform:Mn.transform},Co={test:Sp("hsl","hue"),parse:DS("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+hr.transform(Ji(t))+", "+hr.transform(Ji(r))+", "+Ji(Zi.transform(n))+")"},Ze={test:e=>Mn.test(e)||_f.test(e)||Co.test(e),parse:e=>Mn.test(e)?Mn.parse(e):Co.test(e)?Co.parse(e):_f.parse(e),transform:e=>Ua(e)?e:e.hasOwnProperty("red")?Mn.transform(e):Co.transform(e)},ge=(e,t,r)=>-r*e+r*t+e;function td(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function P4({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,t/=100,r/=100;let o=0,i=0,a=0;if(!t)o=i=a=r;else{const s=r<.5?r*(1+t):r+t-r*t,l=2*r-s;o=td(l,s,e+1/3),i=td(l,s,e),a=td(l,s,e-1/3)}return{red:Math.round(o*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:n}}const rd=(e,t,r)=>{const n=e*e;return Math.sqrt(Math.max(0,r*(t*t-n)+n))},T4=[_f,Mn,Co],E4=e=>T4.find(t=>t.test(e));function $g(e){const t=E4(e);let r=t.parse(e);return t===Co&&(r=P4(r)),r}const IS=(e,t)=>{const r=$g(e),n=$g(t),o={...r};return i=>(o.red=rd(r.red,n.red,i),o.green=rd(r.green,n.green,i),o.blue=rd(r.blue,n.blue,i),o.alpha=ge(r.alpha,n.alpha,i),Mn.transform(o))};function $4(e){var t,r;return isNaN(e)&&Ua(e)&&(((t=e.match(Uu))===null||t===void 0?void 0:t.length)||0)+(((r=e.match(lS))===null||r===void 0?void 0:r.length)||0)>0}const LS={regex:w3,countKey:"Vars",token:"${v}",parse:xe},OS={regex:lS,countKey:"Colors",token:"${c}",parse:Ze.parse},BS={regex:Uu,countKey:"Numbers",token:"${n}",parse:Qn.parse};function nd(e,{regex:t,countKey:r,token:n,parse:o}){const i=e.tokenised.match(t);i&&(e["num"+r]=i.length,e.tokenised=e.tokenised.replace(t,n),e.values.push(...i.map(o)))}function Ql(e){const t=e.toString(),r={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return r.value.includes("var(--")&&nd(r,LS),nd(r,OS),nd(r,BS),r}function jS(e){return Ql(e).values}function NS(e){const{values:t,numColors:r,numVars:n,tokenised:o}=Ql(e),i=t.length;return a=>{let s=o;for(let l=0;ltypeof e=="number"?0:e;function R4(e){const t=jS(e);return NS(e)(t.map(A4))}const dn={test:$4,parse:jS,createTransformer:NS,getAnimatableNone:R4},VS=(e,t)=>r=>`${r>0?t:e}`;function WS(e,t){return typeof e=="number"?r=>ge(e,t,r):Ze.test(e)?IS(e,t):e.startsWith("var(")?VS(e,t):HS(e,t)}const US=(e,t)=>{const r=[...e],n=r.length,o=e.map((i,a)=>WS(i,t[a]));return i=>{for(let a=0;a{const r={...e,...t},n={};for(const o in r)e[o]!==void 0&&t[o]!==void 0&&(n[o]=WS(e[o],t[o]));return o=>{for(const i in n)r[i]=n[i](o);return r}},HS=(e,t)=>{const r=dn.createTransformer(t),n=Ql(e),o=Ql(t);return n.numVars===o.numVars&&n.numColors===o.numColors&&n.numNumbers>=o.numNumbers?an(US(n.values,o.values),r):VS(e,t)},$a=(e,t,r)=>{const n=t-e;return n===0?1:(r-e)/n},Ag=(e,t)=>r=>ge(e,t,r);function z4(e){return typeof e=="number"?Ag:typeof e=="string"?Ze.test(e)?IS:HS:Array.isArray(e)?US:typeof e=="object"?M4:Ag}function F4(e,t,r){const n=[],o=r||z4(e[0]),i=e.length-1;for(let a=0;at[0];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=F4(t,n,o),s=a.length,l=u=>{let c=0;if(s>1)for(;cl(cn(e[0],e[i-1],u)):l}function D4(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const o=$a(0,t,n);e.push(ge(r,1,o))}}function I4(e){const t=[0];return D4(t,e.length-1),t}function L4(e,t){return e.map(r=>r*t)}function O4(e,t){return e.map(()=>t||AS).splice(0,e.length-1)}function ql({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const o=b4(n)?n.map(Eg):Eg(n),i={done:!1,value:t[0]},a=L4(r&&r.length===t.length?r:I4(t),e),s=GS(a,t,{ease:Array.isArray(o)?o:O4(t,o)});return{calculatedDuration:e,next:l=>(i.value=s(l),i.done=l>=e,i)}}function KS(e,t){return t?e*(1e3/t):0}const B4=5;function YS(e,t,r){const n=Math.max(t-B4,0);return KS(r-e(n),t-n)}const od=.001,j4=.01,Rg=10,N4=.05,V4=1;function W4({duration:e=800,bounce:t=.25,velocity:r=0,mass:n=1}){let o,i;c4(e<=sn(Rg));let a=1-t;a=cn(N4,V4,a),e=cn(j4,Rg,$r(e)),a<1?(o=u=>{const c=u*a,d=c*e,f=c-r,p=Pf(u,a),v=Math.exp(-d);return od-f/p*v},i=u=>{const d=u*a*e,f=d*r+r,p=Math.pow(a,2)*Math.pow(u,2)*e,v=Math.exp(-d),y=Pf(Math.pow(u,2),a);return(-o(u)+od>0?-1:1)*((f-p)*v)/y}):(o=u=>{const c=Math.exp(-u*e),d=(u-r)*e+1;return-od+c*d},i=u=>{const c=Math.exp(-u*e),d=(r-u)*(e*e);return c*d});const s=5/e,l=H4(o,i,s);if(e=sn(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*n;return{stiffness:u,damping:a*2*Math.sqrt(n*u),duration:e}}}const U4=12;function H4(e,t,r){let n=r;for(let o=1;oe[r]!==void 0)}function Y4(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!Mg(e,K4)&&Mg(e,G4)){const r=W4(e);t={...t,...r,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function XS({keyframes:e,restDelta:t,restSpeed:r,...n}){const o=e[0],i=e[e.length-1],a={done:!1,value:o},{stiffness:s,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=Y4(n),p=c?-$r(c):0,v=l/(2*Math.sqrt(s*u)),y=i-o,x=$r(Math.sqrt(s/u)),m=Math.abs(y)<5;r||(r=m?.01:2),t||(t=m?.005:.5);let h;if(v<1){const g=Pf(x,v);h=C=>{const _=Math.exp(-v*x*C);return i-_*((p+v*x*y)/g*Math.sin(g*C)+y*Math.cos(g*C))}}else if(v===1)h=g=>i-Math.exp(-x*g)*(y+(p+x*y)*g);else{const g=x*Math.sqrt(v*v-1);h=C=>{const _=Math.exp(-v*x*C),$=Math.min(g*C,300);return i-_*((p+v*x*y)*Math.sinh($)+g*y*Math.cosh($))/g}}return{calculatedDuration:f&&d||null,next:g=>{const C=h(g);if(f)a.done=g>=d;else{let _=p;g!==0&&(v<1?_=YS(h,g,C):_=0);const $=Math.abs(_)<=r,T=Math.abs(i-C)<=t;a.done=$&&T}return a.value=a.done?i:C,a}}}function zg({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},p=A=>s!==void 0&&Al,v=A=>s===void 0?l:l===void 0||Math.abs(s-A)-y*Math.exp(-A/n),g=A=>m+h(A),C=A=>{const M=h(A),I=g(A);f.done=Math.abs(M)<=u,f.value=f.done?m:I};let _,$;const T=A=>{p(f.value)&&(_=A,$=XS({keyframes:[f.value,v(f.value)],velocity:YS(g,A,f.value),damping:o,stiffness:i,restDelta:u,restSpeed:c}))};return T(0),{calculatedDuration:null,next:A=>{let M=!1;return!$&&_===void 0&&(M=!0,C(A),T(A)),_!==void 0&&A>_?$.next(A-_):(!M&&C(A),f)}}}const X4=e=>{const t=({timestamp:r})=>e(r);return{start:()=>se.update(t,!0),stop:()=>Ir(t),now:()=>De.isProcessing?De.timestamp:performance.now()}},Fg=2e4;function Dg(e){let t=0;const r=50;let n=e.next(t);for(;!n.done&&t=Fg?1/0:t}const Q4={decay:zg,inertia:zg,tween:ql,keyframes:ql,spring:XS};function Zl({autoplay:e=!0,delay:t=0,driver:r=X4,keyframes:n,type:o="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let p=1,v=!1,y,x;const m=()=>{x=new Promise(B=>{y=B})};m();let h;const g=Q4[o]||ql;let C;g!==ql&&typeof n[0]!="number"&&(C=GS([0,100],n,{clamp:!1}),n=[0,100]);const _=g({...f,keyframes:n});let $;s==="mirror"&&($=g({...f,keyframes:[...n].reverse(),velocity:-(f.velocity||0)}));let T="idle",A=null,M=null,I=null;_.calculatedDuration===null&&i&&(_.calculatedDuration=Dg(_));const{calculatedDuration:ee}=_;let ze=1/0,Pe=1/0;ee!==null&&(ze=ee+a,Pe=ze*(i+1)-a);let oe=0;const ue=B=>{if(M===null)return;p>0&&(M=Math.min(M,B)),p<0&&(M=Math.min(B-Pe/p,M)),A!==null?oe=A:oe=Math.round(B-M)*p;const ne=oe-t*(p>=0?1:-1),U=p>=0?ne<0:ne>Pe;oe=Math.max(ne,0),T==="finished"&&A===null&&(oe=Pe);let Ge=oe,Xt=_;if(i){const Qt=oe/ze;let Ot=Math.floor(Qt),qt=Qt%1;!qt&&Qt>=1&&(qt=1),qt===1&&Ot--,Ot=Math.min(Ot,i+1);const ai=!!(Ot%2);ai&&(s==="reverse"?(qt=1-qt,a&&(qt-=a/ze)):s==="mirror"&&(Xt=$));let Xa=cn(0,1,qt);oe>Pe&&(Xa=s==="reverse"&&ai?1:0),Ge=Xa*ze}const we=U?{done:!1,value:n[0]}:Xt.next(Ge);C&&(we.value=C(we.value));let{done:Fe}=we;!U&&ee!==null&&(Fe=p>=0?oe>=Pe:oe<=0);const mt=A===null&&(T==="finished"||T==="running"&&Fe);return d&&d(we.value),mt&&z(),we},He=()=>{h&&h.stop(),h=void 0},it=()=>{T="idle",He(),y(),m(),M=I=null},z=()=>{T="finished",c&&c(),He(),y()},N=()=>{if(v)return;h||(h=r(ue));const B=h.now();l&&l(),A!==null?M=B-A:(!M||T==="finished")&&(M=B),T==="finished"&&m(),I=M,A=null,T="running",h.start()};e&&N();const V={then(B,ne){return x.then(B,ne)},get time(){return $r(oe)},set time(B){B=sn(B),oe=B,A!==null||!h||p===0?A=B:M=h.now()-B/p},get duration(){const B=_.calculatedDuration===null?Dg(_):_.calculatedDuration;return $r(B)},get speed(){return p},set speed(B){B===p||!h||(p=B,V.time=$r(oe))},get state(){return T},play:N,pause:()=>{T="paused",A=oe},stop:()=>{v=!0,T!=="idle"&&(T="idle",u&&u(),it())},cancel:()=>{I!==null&&ue(I),it()},complete:()=>{T="finished"},sample:B=>(M=0,ue(B))};return V}function q4(e){let t;return()=>(t===void 0&&(t=e()),t)}const Z4=q4(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),J4=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),zs=10,eF=2e4,tF=(e,t)=>t.type==="spring"||e==="backgroundColor"||!PS(t.ease);function rF(e,t,{onUpdate:r,onComplete:n,...o}){if(!(Z4()&&J4.has(t)&&!o.repeatDelay&&o.repeatType!=="mirror"&&o.damping!==0&&o.type!=="inertia"))return!1;let a=!1,s,l;const u=()=>{l=new Promise(h=>{s=h})};u();let{keyframes:c,duration:d=300,ease:f,times:p}=o;if(tF(t,o)){const h=Zl({...o,repeat:0,delay:0});let g={done:!1,value:c[0]};const C=[];let _=0;for(;!g.done&&_v.cancel(),x=()=>{se.update(y),s(),u()};return v.onfinish=()=>{e.set(h4(c,o)),n&&n(),x()},{then(h,g){return l.then(h,g)},attachTimeline(h){return v.timeline=h,v.onfinish=null,xe},get time(){return $r(v.currentTime||0)},set time(h){v.currentTime=sn(h)},get speed(){return v.playbackRate},set speed(h){v.playbackRate=h},get duration(){return $r(d)},play:()=>{a||(v.play(),Ir(y))},pause:()=>v.pause(),stop:()=>{if(a=!0,v.playState==="idle")return;const{currentTime:h}=v;if(h){const g=Zl({...o,autoplay:!1});e.setWithVelocity(g.sample(h-zs).value,g.sample(h).value,zs)}x()},complete:()=>v.finish(),cancel:x}}function nF({keyframes:e,delay:t,onUpdate:r,onComplete:n}){const o=()=>(r&&r(e[e.length-1]),n&&n(),{time:0,speed:1,duration:0,play:xe,pause:xe,stop:xe,then:i=>(i(),Promise.resolve()),cancel:xe,complete:xe});return t?Zl({keyframes:[0,1],duration:0,delay:t,onComplete:o}):o()}const oF={type:"spring",stiffness:500,damping:25,restSpeed:10},iF=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),aF={type:"keyframes",duration:.8},sF={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},lF=(e,{keyframes:t})=>t.length>2?aF:Xn.has(e)?e.startsWith("scale")?iF(t[1]):oF:sF,Tf=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(dn.test(t)||t==="0")&&!t.startsWith("url(")),uF=new Set(["brightness","contrast","saturate","opacity"]);function cF(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=r.match(Uu)||[];if(!n)return e;const o=r.replace(n,"");let i=uF.has(t)?1:0;return n!==r&&(i*=100),t+"("+i+o+")"}const dF=/([a-z-]*)\(.*?\)/g,Ef={...dn,getAnimatableNone:e=>{const t=e.match(dF);return t?t.map(cF).join(" "):e}},fF={...uS,color:Ze,backgroundColor:Ze,outlineColor:Ze,fill:Ze,stroke:Ze,borderColor:Ze,borderTopColor:Ze,borderRightColor:Ze,borderBottomColor:Ze,borderLeftColor:Ze,filter:Ef,WebkitFilter:Ef},xp=e=>fF[e];function QS(e,t){let r=xp(e);return r!==Ef&&(r=dn),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const qS=e=>/^0[^.\s]+$/.test(e);function hF(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||qS(e)}function pF(e,t,r,n){const o=Tf(t,r);let i;Array.isArray(r)?i=[...r]:i=[null,r];const a=n.from!==void 0?n.from:e.get();let s;const l=[];for(let u=0;uo=>{const i=wp(n,e)||{},a=i.delay||n.delay||0;let{elapsed:s=0}=n;s=s-sn(a);const l=pF(t,e,r,i),u=l[0],c=l[l.length-1],d=Tf(e,u),f=Tf(e,c);let p={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...i,delay:-s,onUpdate:v=>{t.set(v),i.onUpdate&&i.onUpdate(v)},onComplete:()=>{o(),i.onComplete&&i.onComplete()}};if(mF(i)||(p={...p,...lF(e,p)}),p.duration&&(p.duration=sn(p.duration)),p.repeatDelay&&(p.repeatDelay=sn(p.repeatDelay)),!d||!f||d4.current||i.type===!1)return nF(p);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const v=rF(t,e,p);if(v)return v}return Zl(p)};function Jl(e){return!!(ht(e)&&e.add)}const ZS=e=>/^\-?\d*\.?\d+$/.test(e);function Cp(e,t){e.indexOf(t)===-1&&e.push(t)}function _p(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}class Pp{constructor(){this.subscriptions=[]}add(t){return Cp(this.subscriptions,t),()=>_p(this.subscriptions,t)}notify(t,r,n){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,r,n);else for(let i=0;i!isNaN(parseFloat(e));class gF{constructor(t,r={}){this.version="10.16.12",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(n,o=!0)=>{this.prev=this.current,this.current=n;const{delta:i,timestamp:a}=De;this.lastUpdated!==a&&(this.timeDelta=i,this.lastUpdated=a,se.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),o&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>se.postRender(this.velocityCheck),this.velocityCheck=({timestamp:n})=>{n!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=vF(this.current),this.owner=r.owner}onChange(t){return this.on("change",t)}on(t,r){this.events[t]||(this.events[t]=new Pp);const n=this.events[t].add(r);return t==="change"?()=>{n(),se.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t,r=!0){!r||!this.passiveEffect?this.updateAndNotify(t,r):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,r,n){this.set(r),this.prev=t,this.timeDelta=n}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?KS(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=t(r),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.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Zo(e,t){return new gF(e,t)}const JS=e=>t=>t.test(e),yF={test:e=>e==="auto",parse:e=>e},ex=[Qn,j,hr,Vr,P3,_3,yF],wi=e=>ex.find(JS(e)),bF=[...ex,Ze,dn],SF=e=>bF.find(JS(e));function xF(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Zo(r))}function wF(e,t){const r=Gu(e,t);let{transitionEnd:n={},transition:o={},...i}=r?e.makeTargetAnimatable(r,!1):{};i={...i,...n};for(const a in i){const s=j3(i[a]);xF(e,a,s)}}function kF(e,t,r){var n,o;const i=Object.keys(t).filter(s=>!e.hasValue(s)),a=i.length;if(a)for(let s=0;sl.remove(d))),u.push(m)}return a&&Promise.all(u).then(()=>{a&&wF(e,a)}),u}function $f(e,t,r={}){const n=Gu(e,t,r.custom);let{transition:o=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(o=r.transitionOverride);const i=n?()=>Promise.all(tx(e,n,r)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=o;return TF(e,t,u+l,c,d,r)}:()=>Promise.resolve(),{when:s}=o;if(s){const[l,u]=s==="beforeChildren"?[i,a]:[a,i];return l().then(()=>u())}else return Promise.all([i(),a(r.delay)])}function TF(e,t,r=0,n=0,o=1,i){const a=[],s=(e.variantChildren.size-1)*n,l=o===1?(u=0)=>u*n:(u=0)=>s-u*n;return Array.from(e.variantChildren).sort(EF).forEach((u,c)=>{u.notify("AnimationStart",t),a.push($f(u,t,{...i,delay:r+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function EF(e,t){return e.sortNodePosition(t)}function $F(e,t,r={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const o=t.map(i=>$f(e,i,r));n=Promise.all(o)}else if(typeof t=="string")n=$f(e,t,r);else{const o=typeof t=="function"?Gu(e,t,r.custom):t;n=Promise.all(tx(e,o,r))}return n.then(()=>e.notify("AnimationComplete",t))}const AF=[...sp].reverse(),RF=sp.length;function MF(e){return t=>Promise.all(t.map(({animation:r,options:n})=>$F(e,r,n)))}function zF(e){let t=MF(e);const r=DF();let n=!0;const o=(l,u)=>{const c=Gu(e,u);if(c){const{transition:d,transitionEnd:f,...p}=c;l={...l,...p,...f}}return l};function i(l){t=l(e)}function a(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],p=new Set;let v={},y=1/0;for(let m=0;my&&_;const I=Array.isArray(C)?C:[C];let ee=I.reduce(o,{});$===!1&&(ee={});const{prevResolvedValues:ze={}}=g,Pe={...ze,...ee},oe=ue=>{M=!0,p.delete(ue),g.needsAnimating[ue]=!0};for(const ue in Pe){const He=ee[ue],it=ze[ue];v.hasOwnProperty(ue)||(He!==it?Xl(He)&&Xl(it)?!CS(He,it)||A?oe(ue):g.protectedKeys[ue]=!0:He!==void 0?oe(ue):p.add(ue):He!==void 0&&p.has(ue)?oe(ue):g.protectedKeys[ue]=!0)}g.prevProp=C,g.prevResolvedValues=ee,g.isActive&&(v={...v,...ee}),n&&e.blockInitialAnimation&&(M=!1),M&&!T&&f.push(...I.map(ue=>({animation:ue,options:{type:h,...l}})))}if(p.size){const m={};p.forEach(h=>{const g=e.getBaseTarget(h);g!==void 0&&(m[h]=g)}),f.push({animation:m})}let x=!!f.length;return n&&c.initial===!1&&!e.manuallyAnimateOnMount&&(x=!1),n=!1,x?t(f):Promise.resolve()}function s(l,u,c){var d;if(r[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(p=>{var v;return(v=p.animationState)===null||v===void 0?void 0:v.setActive(l,u)}),r[l].isActive=u;const f=a(c,l);for(const p in r)r[p].protectedKeys={};return f}return{animateChanges:a,setActive:s,setAnimateFunction:i,getState:()=>r}}function FF(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!CS(t,e):!1}function Sn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function DF(){return{animate:Sn(!0),whileInView:Sn(),whileHover:Sn(),whileTap:Sn(),whileDrag:Sn(),whileFocus:Sn(),exit:Sn()}}class IF extends vn{constructor(t){super(t),t.animationState||(t.animationState=zF(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),Vu(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){}}let LF=0;class OF extends vn{constructor(){super(...arguments),this.id=LF++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r,custom:n}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===o)return;const i=this.node.animationState.setActive("exit",!t,{custom:n??this.node.getProps().custom});r&&!t&&i.then(()=>r(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const BF={animation:{Feature:IF},exit:{Feature:OF}},Ig=(e,t)=>Math.abs(e-t);function jF(e,t){const r=Ig(e.x,t.x),n=Ig(e.y,t.y);return Math.sqrt(r**2+n**2)}class rx{constructor(t,r,{transformPagePoint:n,contextWindow:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const c=ad(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,f=jF(c.offset,{x:0,y:0})>=3;if(!d&&!f)return;const{point:p}=c,{timestamp:v}=De;this.history.push({...p,timestamp:v});const{onStart:y,onMove:x}=this.handlers;d||(y&&y(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,c)},this.handlePointerMove=(c,d)=>{this.lastMoveEvent=c,this.lastMoveEventInfo=id(d,this.transformPagePoint),se.update(this.updatePoint,!0)},this.handlePointerUp=(c,d)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:f,onSessionEnd:p}=this.handlers,v=ad(c.type==="pointercancel"?this.lastMoveEventInfo:id(d,this.transformPagePoint),this.history);this.startEvent&&f&&f(c,v),p&&p(c,v)},!bS(t))return;this.handlers=r,this.transformPagePoint=n,this.contextWindow=o||window;const i=Hu(t),a=id(i,this.transformPagePoint),{point:s}=a,{timestamp:l}=De;this.history=[{...s,timestamp:l}];const{onSessionStart:u}=r;u&&u(t,ad(a,this.history)),this.removeListeners=an(Er(this.contextWindow,"pointermove",this.handlePointerMove),Er(this.contextWindow,"pointerup",this.handlePointerUp),Er(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ir(this.updatePoint)}}function id(e,t){return t?{point:t(e.point)}:e}function Lg(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ad({point:e},t){return{point:e,delta:Lg(e,nx(t)),offset:Lg(e,NF(t)),velocity:VF(t,.1)}}function NF(e){return e[0]}function nx(e){return e[e.length-1]}function VF(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const o=nx(e);for(;r>=0&&(n=e[r],!(o.timestamp-n.timestamp>sn(t)));)r--;if(!n)return{x:0,y:0};const i=$r(o.timestamp-n.timestamp);if(i===0)return{x:0,y:0};const a={x:(o.x-n.x)/i,y:(o.y-n.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function kt(e){return e.max-e.min}function Af(e,t=0,r=.01){return Math.abs(e-t)<=r}function Og(e,t,r,n=.5){e.origin=n,e.originPoint=ge(t.min,t.max,e.origin),e.scale=kt(r)/kt(t),(Af(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=ge(r.min,r.max,e.origin)-e.originPoint,(Af(e.translate)||isNaN(e.translate))&&(e.translate=0)}function ea(e,t,r,n){Og(e.x,t.x,r.x,n?n.originX:void 0),Og(e.y,t.y,r.y,n?n.originY:void 0)}function Bg(e,t,r){e.min=r.min+t.min,e.max=e.min+kt(t)}function WF(e,t,r){Bg(e.x,t.x,r.x),Bg(e.y,t.y,r.y)}function jg(e,t,r){e.min=t.min-r.min,e.max=e.min+kt(t)}function ta(e,t,r){jg(e.x,t.x,r.x),jg(e.y,t.y,r.y)}function UF(e,{min:t,max:r},n){return t!==void 0&&er&&(e=n?ge(r,e,n.max):Math.min(e,r)),e}function Ng(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function HF(e,{top:t,left:r,bottom:n,right:o}){return{x:Ng(e.x,r,o),y:Ng(e.y,t,n)}}function Vg(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.minn?r=$a(t.min,t.max-n,e.min):n>o&&(r=$a(e.min,e.max-o,t.min)),cn(0,1,r)}function YF(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const Rf=.35;function XF(e=Rf){return e===!1?e=0:e===!0&&(e=Rf),{x:Wg(e,"left","right"),y:Wg(e,"top","bottom")}}function Wg(e,t,r){return{min:Ug(e,t),max:Ug(e,r)}}function Ug(e,t){return typeof e=="number"?e:e[t]||0}const Hg=()=>({translate:0,scale:1,origin:0,originPoint:0}),_o=()=>({x:Hg(),y:Hg()}),Gg=()=>({min:0,max:0}),Te=()=>({x:Gg(),y:Gg()});function tr(e){return[e("x"),e("y")]}function ox({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function QF({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function qF(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function sd(e){return e===void 0||e===1}function Mf({scale:e,scaleX:t,scaleY:r}){return!sd(e)||!sd(t)||!sd(r)}function kn(e){return Mf(e)||ix(e)||e.z||e.rotate||e.rotateX||e.rotateY}function ix(e){return Kg(e.x)||Kg(e.y)}function Kg(e){return e&&e!=="0%"}function eu(e,t,r){const n=e-r,o=t*n;return r+o}function Yg(e,t,r,n,o){return o!==void 0&&(e=eu(e,o,n)),eu(e,r,n)+t}function zf(e,t=0,r=1,n,o){e.min=Yg(e.min,t,r,n,o),e.max=Yg(e.max,t,r,n,o)}function ax(e,{x:t,y:r}){zf(e.x,t.translate,t.scale,t.originPoint),zf(e.y,r.translate,r.scale,r.originPoint)}function ZF(e,t,r,n=!1){const o=r.length;if(!o)return;t.x=t.y=1;let i,a;for(let s=0;s1.0000000000001||e<.999999999999?e:1}function Hr(e,t){e.min=e.min+t,e.max=e.max+t}function Qg(e,t,[r,n,o]){const i=t[o]!==void 0?t[o]:.5,a=ge(e.min,e.max,i);zf(e,t[r],t[n],a,t.scale)}const JF=["x","scaleX","originX"],eD=["y","scaleY","originY"];function Po(e,t){Qg(e.x,t,JF),Qg(e.y,t,eD)}function sx(e,t){return ox(qF(e.getBoundingClientRect(),t))}function tD(e,t,r){const n=sx(e,r),{scroll:o}=t;return o&&(Hr(n.x,o.offset.x),Hr(n.y,o.offset.y)),n}const lx=({current:e})=>e?e.ownerDocument.defaultView:null,rD=new WeakMap;class nD{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Te(),this.visualElement=t}start(t,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const o=l=>{this.stopAnimation(),r&&this.snapToCursor(Hu(l,"page").point)},i=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=xS(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),tr(v=>{let y=this.getAxisMotionValue(v).get()||0;if(hr.test(y)){const{projection:x}=this.visualElement;if(x&&x.layout){const m=x.layout.layoutBox[v];m&&(y=kt(m)*(parseFloat(y)/100))}}this.originPoint[v]=y}),f&&se.update(()=>f(l,u),!1,!0);const{animationState:p}=this.visualElement;p&&p.setActive("whileDrag",!0)},a=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:p}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:v}=u;if(d&&this.currentDirection===null){this.currentDirection=oD(v),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,v),this.updateAxis("y",u.point,v),this.visualElement.render(),p&&p(l,u)},s=(l,u)=>this.stop(l,u);this.panSession=new rx(t,{onSessionStart:o,onStart:i,onMove:a,onSessionEnd:s},{transformPagePoint:this.visualElement.getTransformPagePoint(),contextWindow:lx(this.visualElement)})}stop(t,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:i}=this.getProps();i&&se.update(()=>i(t,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(t,r,n){const{drag:o}=this.getProps();if(!n||!Fs(t,o,this.currentDirection))return;const i=this.getAxisMotionValue(t);let a=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(a=UF(a,this.constraints[t],this.elastic[t])),i.set(a)}resolveConstraints(){var t;const{dragConstraints:r,dragElastic:n}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;r&&ko(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&o?this.constraints=HF(o.layoutBox,r):this.constraints=!1,this.elastic=XF(n),i!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&tr(a=>{this.getAxisMotionValue(a)&&(this.constraints[a]=YF(o.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!ko(t))return!1;const n=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const i=tD(n,o.root,this.visualElement.getTransformPagePoint());let a=GF(o.layout.layoutBox,i);if(r){const s=r(QF(a));this.hasMutatedConstraints=!!s,s&&(a=ox(s))}return a}startAnimation(t){const{drag:r,dragMomentum:n,dragElastic:o,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=tr(c=>{if(!Fs(c,r,this.currentDirection))return;let d=l&&l[c]||{};a&&(d={min:0,max:0});const f=o?200:1e6,p=o?40:1e7,v={type:"inertia",velocity:n?t[c]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...d};return this.startAxisValueAnimation(c,v)});return Promise.all(u).then(s)}startAxisValueAnimation(t,r){const n=this.getAxisMotionValue(t);return n.start(kp(t,n,0,r))}stopAnimation(){tr(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const r="_drag"+t.toUpperCase(),n=this.visualElement.getProps(),o=n[r];return o||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){tr(r=>{const{drag:n}=this.getProps();if(!Fs(r,n,this.currentDirection))return;const{projection:o}=this.visualElement,i=this.getAxisMotionValue(r);if(o&&o.layout){const{min:a,max:s}=o.layout.layoutBox[r];i.set(t[r]-ge(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!ko(r)||!n||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};tr(a=>{const s=this.getAxisMotionValue(a);if(s){const l=s.get();o[a]=KF({min:l,max:l},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),tr(a=>{if(!Fs(a,t,null))return;const s=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];s.set(ge(l,u,o[a]))})}addListeners(){if(!this.visualElement.current)return;rD.set(this.visualElement,this);const t=this.visualElement.current,r=Er(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),n=()=>{const{dragConstraints:l}=this.getProps();ko(l)&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,i=o.addEventListener("measure",n);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),n();const a=_r(window,"resize",()=>this.scalePositionWithinConstraints()),s=o.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(tr(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{a(),r(),i(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:o=!1,dragConstraints:i=!1,dragElastic:a=Rf,dragMomentum:s=!0}=t;return{...t,drag:r,dragDirectionLock:n,dragPropagation:o,dragConstraints:i,dragElastic:a,dragMomentum:s}}}function Fs(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function oD(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class iD extends vn{constructor(t){super(t),this.removeGroupControls=xe,this.removeListeners=xe,this.controls=new nD(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||xe}unmount(){this.removeGroupControls(),this.removeListeners()}}const qg=e=>(t,r)=>{e&&se.update(()=>e(t,r))};class aD extends vn{constructor(){super(...arguments),this.removePointerDownListener=xe}onPointerDown(t){this.session=new rx(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lx(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:n,onPanEnd:o}=this.node.getProps();return{onSessionStart:qg(t),onStart:qg(r),onMove:n,onEnd:(i,a)=>{delete this.session,o&&se.update(()=>o(i,a))}}}mount(){this.removePointerDownListener=Er(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function ux(){const e=S.useContext(Va);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:r,register:n}=e,o=S.useId();return S.useEffect(()=>n(o),[]),!t&&r?[!1,()=>r&&r(o)]:[!0]}function sD(){return lD(S.useContext(Va))}function lD(e){return e===null?!0:e.isPresent}const dl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Zg(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ki={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(j.test(e))e=parseFloat(e);else return e;const r=Zg(e,t.target.x),n=Zg(e,t.target.y);return`${r}% ${n}%`}},uD={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,o=dn.parse(e);if(o.length>5)return n;const i=dn.createTransformer(e),a=typeof o[0]!="number"?1:0,s=r.x.scale*t.x,l=r.y.scale*t.y;o[0+a]/=s,o[1+a]/=l;const u=ge(s,l,.5);return typeof o[2+a]=="number"&&(o[2+a]/=u),typeof o[3+a]=="number"&&(o[3+a]/=u),i(o)}};class cD extends Ar.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n,layoutId:o}=this.props,{projection:i}=t;y3(dD),i&&(r.group&&r.group.add(i),n&&n.register&&o&&n.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),dl.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:n,drag:o,isPresent:i}=this.props,a=n.projection;return a&&(a.isPresent=i,o||t.layoutDependency!==r||r===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?a.promote():a.relegate()||se.postRender(()=>{const s=a.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:o}=t;o&&(o.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(o),n&&n.deregister&&n.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function cx(e){const[t,r]=ux(),n=S.useContext(up);return Ar.createElement(cD,{...e,layoutGroup:n,switchLayoutGroup:S.useContext(oS),isPresent:t,safeToRemove:r})}const dD={borderRadius:{...ki,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ki,borderTopRightRadius:ki,borderBottomLeftRadius:ki,borderBottomRightRadius:ki,boxShadow:uD},dx=["TopLeft","TopRight","BottomLeft","BottomRight"],fD=dx.length,Jg=e=>typeof e=="string"?parseFloat(e):e,e0=e=>typeof e=="number"||j.test(e);function hD(e,t,r,n,o,i){o?(e.opacity=ge(0,r.opacity!==void 0?r.opacity:1,pD(n)),e.opacityExit=ge(t.opacity!==void 0?t.opacity:1,0,mD(n))):i&&(e.opacity=ge(t.opacity!==void 0?t.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let a=0;ant?1:r($a(e,t,n))}function r0(e,t){e.min=t.min,e.max=t.max}function $t(e,t){r0(e.x,t.x),r0(e.y,t.y)}function n0(e,t,r,n,o){return e-=t,e=eu(e,1/r,n),o!==void 0&&(e=eu(e,1/o,n)),e}function vD(e,t=0,r=1,n=.5,o,i=e,a=e){if(hr.test(t)&&(t=parseFloat(t),t=ge(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=ge(i.min,i.max,n);e===i&&(s-=t),e.min=n0(e.min,t,r,s,o),e.max=n0(e.max,t,r,s,o)}function o0(e,t,[r,n,o],i,a){vD(e,t[r],t[n],t[o],t.scale,i,a)}const gD=["x","scaleX","originX"],yD=["y","scaleY","originY"];function i0(e,t,r,n){o0(e.x,t,gD,r?r.x:void 0,n?n.x:void 0),o0(e.y,t,yD,r?r.y:void 0,n?n.y:void 0)}function a0(e){return e.translate===0&&e.scale===1}function hx(e){return a0(e.x)&&a0(e.y)}function bD(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function px(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function s0(e){return kt(e.x)/kt(e.y)}class SD{constructor(){this.members=[]}add(t){Cp(this.members,t),t.scheduleRender()}remove(t){if(_p(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){const r=this.members.findIndex(o=>t===o);if(r===0)return!1;let n;for(let o=r;o>=0;o--){const i=this.members[o];if(i.isPresent!==!1){n=i;break}}return n?(this.promote(n),!0):!1}promote(t,r){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,r&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:o}=t.options;o===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:r,resumingFrom:n}=t;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function l0(e,t,r){let n="";const o=e.x.translate/t.x,i=e.y.translate/t.y;if((o||i)&&(n=`translate3d(${o}px, ${i}px, 0) `),(t.x!==1||t.y!==1)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{rotate:l,rotateX:u,rotateY:c}=r;l&&(n+=`rotate(${l}deg) `),u&&(n+=`rotateX(${u}deg) `),c&&(n+=`rotateY(${c}deg) `)}const a=e.x.scale*t.x,s=e.y.scale*t.y;return(a!==1||s!==1)&&(n+=`scale(${a}, ${s})`),n||"none"}const xD=(e,t)=>e.depth-t.depth;class wD{constructor(){this.children=[],this.isDirty=!1}add(t){Cp(this.children,t),this.isDirty=!0}remove(t){_p(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(xD),this.isDirty=!1,this.children.forEach(t)}}function kD(e,t){const r=performance.now(),n=({timestamp:o})=>{const i=o-r;i>=t&&(Ir(n),e(i-t))};return se.read(n,!0),()=>Ir(n)}function CD(e){window.MotionDebug&&window.MotionDebug.record(e)}function _D(e){return e instanceof SVGElement&&e.tagName!=="svg"}function PD(e,t,r){const n=ht(e)?e:Zo(e);return n.start(kp("",n,t,r)),n.animation}const u0=["","X","Y","Z"],TD={visibility:"hidden"},c0=1e3;let ED=0;const Cn={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function mx({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:o}){return class{constructor(a={},s=t==null?void 0:t()){this.id=ED++,this.animationId=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.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Cn.totalNodes=Cn.resolvedTargetDeltas=Cn.recalculatedProjection=0,this.nodes.forEach(RD),this.nodes.forEach(ID),this.nodes.forEach(LD),this.nodes.forEach(MD),CD(Cn)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=kD(f,250),dl.hasAnimatedSinceResize&&(dl.hasAnimatedSinceResize=!1,this.nodes.forEach(f0))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:p,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||c.getDefaultTransition()||VD,{onLayoutAnimationStart:x,onLayoutAnimationComplete:m}=c.getProps(),h=!this.targetLayout||!px(this.targetLayout,v)||p,g=!f&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(h||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,g);const C={...wp(y,"layout"),onPlay:x,onComplete:m};(c.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C)}else f||f0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ir(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(OD),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(zD),this.sharedNodes.forEach(BD)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,se.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){se.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const _=C/1e3;h0(d.x,a.x,_),h0(d.y,a.y,_),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ta(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),jD(this.relativeTarget,this.relativeTargetOrigin,f,_),g&&bD(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=Te()),$t(g,this.relativeTarget)),y&&(this.animationValues=c,hD(c,u,this.latestValues,_,h,m)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ir(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=se.update(()=>{dl.hasAnimatedSinceResize=!0,this.currentAnimation=PD(0,c0,{...a,onUpdate:s=>{this.mixTargetDelta(s),a.onUpdate&&a.onUpdate(s)},onComplete:()=>{a.onComplete&&a.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 a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(c0),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:c}=a;if(!(!s||!l||!u)){if(this!==a&&this.layout&&u&&vx(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Te();const d=kt(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const f=kt(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}$t(s,l),Po(s,c),ea(this.projectionDeltaWithTransform,this.layoutCorrected,s,c)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new SD),this.sharedNodes.get(a).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:l}=a;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(s=!0),!s)return;const u={};for(let c=0;c{var s;return(s=a.currentAnimation)===null||s===void 0?void 0:s.stop()}),this.root.nodes.forEach(d0),this.root.sharedNodes.clear()}}}function $D(e){e.updateLayout()}function AD(e){var t;const r=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&r&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:o}=e.layout,{animationType:i}=e.options,a=r.source!==e.layout.source;i==="size"?tr(d=>{const f=a?r.measuredBox[d]:r.layoutBox[d],p=kt(f);f.min=n[d].min,f.max=f.min+p}):vx(i,r.layoutBox,n)&&tr(d=>{const f=a?r.measuredBox[d]:r.layoutBox[d],p=kt(n[d]);f.max=f.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+p)});const s=_o();ea(s,n,r.layoutBox);const l=_o();a?ea(l,e.applyTransform(o,!0),r.measuredBox):ea(l,n,r.layoutBox);const u=!hx(s);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:p}=d;if(f&&p){const v=Te();ta(v,r.layoutBox,f.layoutBox);const y=Te();ta(y,n,p.layoutBox),px(v,y)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=y,e.relativeTargetOrigin=v,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function RD(e){Cn.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function MD(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function zD(e){e.clearSnapshot()}function d0(e){e.clearMeasurements()}function FD(e){e.isLayoutDirty=!1}function DD(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function f0(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function ID(e){e.resolveTargetDelta()}function LD(e){e.calcProjection()}function OD(e){e.resetRotation()}function BD(e){e.removeLeadSnapshot()}function h0(e,t,r){e.translate=ge(t.translate,0,r),e.scale=ge(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function p0(e,t,r,n){e.min=ge(t.min,r.min,n),e.max=ge(t.max,r.max,n)}function jD(e,t,r,n){p0(e.x,t.x,r.x,n),p0(e.y,t.y,r.y,n)}function ND(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const VD={duration:.45,ease:[.4,0,.1,1]},m0=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),v0=m0("applewebkit/")&&!m0("chrome/")?Math.round:xe;function g0(e){e.min=v0(e.min),e.max=v0(e.max)}function WD(e){g0(e.x),g0(e.y)}function vx(e,t,r){return e==="position"||e==="preserve-aspect"&&!Af(s0(t),s0(r),.2)}const UD=mx({attachResizeListener:(e,t)=>_r(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ld={current:void 0},gx=mx({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ld.current){const e=new UD({});e.mount(window),e.setOptions({layoutScroll:!0}),ld.current=e}return ld.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),HD={pan:{Feature:aD},drag:{Feature:iD,ProjectionNode:gx,MeasureLayout:cx}},GD=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function KD(e){const t=GD.exec(e);if(!t)return[,];const[,r,n]=t;return[r,n]}function Ff(e,t,r=1){const[n,o]=KD(e);if(!n)return;const i=window.getComputedStyle(t).getPropertyValue(n);if(i){const a=i.trim();return ZS(a)?parseFloat(a):a}else return kf(o)?Ff(o,t,r+1):o}function YD(e,{...t},r){const n=e.current;if(!(n instanceof Element))return{target:t,transitionEnd:r};r&&(r={...r}),e.values.forEach(o=>{const i=o.get();if(!kf(i))return;const a=Ff(i,n);a&&o.set(a)});for(const o in t){const i=t[o];if(!kf(i))continue;const a=Ff(i,n);a&&(t[o]=a,r||(r={}),r[o]===void 0&&(r[o]=i))}return{target:t,transitionEnd:r}}const XD=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),yx=e=>XD.has(e),QD=e=>Object.keys(e).some(yx),y0=e=>e===Qn||e===j,b0=(e,t)=>parseFloat(e.split(", ")[t]),S0=(e,t)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const o=n.match(/^matrix3d\((.+)\)$/);if(o)return b0(o[1],t);{const i=n.match(/^matrix\((.+)\)$/);return i?b0(i[1],e):0}},qD=new Set(["x","y","z"]),ZD=Wa.filter(e=>!qD.has(e));function JD(e){const t=[];return ZD.forEach(r=>{const n=e.getValue(r);n!==void 0&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t.length&&e.render(),t}const Jo={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:S0(4,13),y:S0(5,14)};Jo.translateX=Jo.x;Jo.translateY=Jo.y;const eI=(e,t,r)=>{const n=t.measureViewportBox(),o=t.current,i=getComputedStyle(o),{display:a}=i,s={};a==="none"&&t.setStaticValue("display",e.display||"block"),r.forEach(u=>{s[u]=Jo[u](n,i)}),t.render();const l=t.measureViewportBox();return r.forEach(u=>{const c=t.getValue(u);c&&c.jump(s[u]),e[u]=Jo[u](l,i)}),e},tI=(e,t,r={},n={})=>{t={...t},n={...n};const o=Object.keys(t).filter(yx);let i=[],a=!1;const s=[];if(o.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=r[l],d=wi(c);const f=t[l];let p;if(Xl(f)){const v=f.length,y=f[0]===null?1:0;c=f[y],d=wi(c);for(let x=y;x=0?window.pageYOffset:null,u=eI(t,e,s);return i.length&&i.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),Nu&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:n}}else return{target:t,transitionEnd:n}};function rI(e,t,r,n){return QD(t)?tI(e,t,r,n):{target:t,transitionEnd:n}}const nI=(e,t,r,n)=>{const o=YD(e,t,n);return t=o.target,n=o.transitionEnd,rI(e,t,r,n)},Df={current:null},bx={current:!1};function oI(){if(bx.current=!0,!!Nu)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Df.current=e.matches;e.addListener(t),t()}else Df.current=!1}function iI(e,t,r){const{willChange:n}=t;for(const o in t){const i=t[o],a=r[o];if(ht(i))e.addValue(o,i),Jl(n)&&n.add(o);else if(ht(a))e.addValue(o,Zo(i,{owner:e})),Jl(n)&&n.remove(o);else if(a!==i)if(e.hasValue(o)){const s=e.getValue(o);!s.hasAnimated&&s.set(i)}else{const s=e.getStaticValue(o);e.addValue(o,Zo(s!==void 0?s:i,{owner:e}))}}for(const o in r)t[o]===void 0&&e.removeValue(o);return t}const x0=new WeakMap,Sx=Object.keys(Ea),aI=Sx.length,w0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],sI=lp.length;class lI{constructor({parent:t,props:r,presenceContext:n,reducedMotionConfig:o,visualState:i},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},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.scheduleRender=()=>se.render(this.render,!1,!0);const{latestValues:s,renderState:l}=i;this.latestValues=s,this.baseTarget={...s},this.initialValues=r.initial?{...s}:{},this.renderState=l,this.parent=t,this.props=r,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.options=a,this.isControllingVariants=Wu(r),this.isVariantNode=nS(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(r,{});for(const d in c){const f=c[d];s[d]!==void 0&&ht(f)&&(f.set(s[d],!1),Jl(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,r){return{}}mount(t){this.current=t,x0.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),bx.current||oI(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Df.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){x0.delete(this.current),this.projection&&this.projection.unmount(),Ir(this.notifyUpdate),Ir(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,r){const n=Xn.has(t),o=r.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&se.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)}),i=r.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{o(),i()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...r},n,o,i){let a,s;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:i,layoutScroll:f,layoutRoot:p})}return s}updateFeatures(){for(const t in this.features){const r=this.features[t];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Te()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}makeTargetAnimatable(t,r=!0){return this.makeTargetAnimatableFromInstance(t,this.props,r)}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(t)}addValue(t,r){r!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,r)),this.values.set(t,r),this.latestValues[t]=r.get()}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return n===void 0&&r!==void 0&&(n=Zo(r,{owner:this}),this.addValue(t,n)),n}readValue(t){var r;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var r;const{initial:n}=this.props,o=typeof n=="string"||typeof n=="object"?(r=vp(this.props,n))===null||r===void 0?void 0:r[t]:void 0;if(n&&o!==void 0)return o;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!ht(i)?i:this.initialValues[t]!==void 0&&o===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new Pp),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}}class xx extends lI{sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){return t.style?t.style[r]:void 0}removeValueFromRenderState(t,{vars:r,style:n}){delete r[t],delete n[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:r,...n},{transformValues:o},i){let a=_F(n,t||{},this);if(o&&(r&&(r=o(r)),n&&(n=o(n)),a&&(a=o(a))),i){kF(this,n,a);const s=nI(this,n,a,r);r=s.transitionEnd,n=s.target}return{transition:t,transitionEnd:r,...n}}}function uI(e){return window.getComputedStyle(e)}class cI extends xx{readValueFromInstance(t,r){if(Xn.has(r)){const n=xp(r);return n&&n.default||0}else{const n=uI(t),o=(sS(r)?n.getPropertyValue(r):n[r])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:r}){return sx(t,r)}build(t,r,n,o){dp(t,r,n,o.transformTemplate)}scrapeMotionValuesFromProps(t,r){return mp(t,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ht(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}renderInstance(t,r,n,o){hS(t,r,n,o)}}class dI extends xx{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Xn.has(r)){const n=xp(r);return n&&n.default||0}return r=pS.has(r)?r:ap(r),t.getAttribute(r)}measureInstanceViewportBox(){return Te()}scrapeMotionValuesFromProps(t,r){return vS(t,r)}build(t,r,n,o){hp(t,r,n,this.isSVGTag,o.transformTemplate)}renderInstance(t,r,n,o){mS(t,r,n,o)}mount(t){this.isSVGTag=pp(t.tagName),super.mount(t)}}const fI=(e,t)=>cp(e)?new dI(t,{enableHardwareAcceleration:!1}):new cI(t,{enableHardwareAcceleration:!0}),hI={layout:{ProjectionNode:gx,MeasureLayout:cx}},pI={...BF,...s4,...HD,...hI},oi=v3((e,t)=>Y3(e,t,pI,fI));function wx(){const e=S.useRef(!1);return ip(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function mI(){const e=wx(),[t,r]=S.useState(0),n=S.useCallback(()=>{e.current&&r(t+1)},[t]);return[S.useCallback(()=>se.postRender(n),[n]),t]}class vI extends S.Component{getSnapshotBeforeUpdate(t){const r=this.props.childRef.current;if(r&&t.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function gI({children:e,isPresent:t}){const r=S.useId(),n=S.useRef(null),o=S.useRef({width:0,height:0,top:0,left:0});return S.useInsertionEffect(()=>{const{width:i,height:a,top:s,left:l}=o.current;if(t||!n.current||!i||!a)return;n.current.dataset.motionPopId=r;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` + [data-motion-pop-id="${r}"] { + position: absolute !important; + width: ${i}px !important; + height: ${a}px !important; + top: ${s}px !important; + left: ${l}px !important; + } + `),()=>{document.head.removeChild(u)}},[t]),S.createElement(vI,{isPresent:t,childRef:n,sizeRef:o},S.cloneElement(e,{ref:n}))}const ud=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:o,presenceAffectsLayout:i,mode:a})=>{const s=gS(yI),l=S.useId(),u=S.useMemo(()=>({id:l,initial:t,isPresent:r,custom:o,onExitComplete:c=>{s.set(c,!0);for(const d of s.values())if(!d)return;n&&n()},register:c=>(s.set(c,!1),()=>s.delete(c))}),i?void 0:[r]);return S.useMemo(()=>{s.forEach((c,d)=>s.set(d,!1))},[r]),S.useEffect(()=>{!r&&!s.size&&n&&n()},[r]),a==="popLayout"&&(e=S.createElement(gI,{isPresent:r},e)),S.createElement(Va.Provider,{value:u},e)};function yI(){return new Map}function bI(e){return S.useEffect(()=>()=>e(),[])}const _n=e=>e.key||"";function SI(e,t){e.forEach(r=>{const n=_n(r);t.set(n,r)})}function xI(e){const t=[];return S.Children.forEach(e,r=>{S.isValidElement(r)&&t.push(r)}),t}const Ka=({children:e,custom:t,initial:r=!0,onExitComplete:n,exitBeforeEnter:o,presenceAffectsLayout:i=!0,mode:a="sync"})=>{const s=S.useContext(up).forceRender||mI()[0],l=wx(),u=xI(e);let c=u;const d=S.useRef(new Map).current,f=S.useRef(c),p=S.useRef(new Map).current,v=S.useRef(!0);if(ip(()=>{v.current=!1,SI(u,p),f.current=c}),bI(()=>{v.current=!0,p.clear(),d.clear()}),v.current)return S.createElement(S.Fragment,null,c.map(h=>S.createElement(ud,{key:_n(h),isPresent:!0,initial:r?void 0:!1,presenceAffectsLayout:i,mode:a},h)));c=[...c];const y=f.current.map(_n),x=u.map(_n),m=y.length;for(let h=0;h{if(x.indexOf(g)!==-1)return;const C=p.get(g);if(!C)return;const _=y.indexOf(g);let $=h;if(!$){const T=()=>{d.delete(g);const A=Array.from(p.keys()).filter(M=>!x.includes(M));if(A.forEach(M=>p.delete(M)),f.current=u.filter(M=>{const I=_n(M);return I===g||A.includes(I)}),!d.size){if(l.current===!1)return;s(),n&&n()}};$=S.createElement(ud,{key:_n(C),isPresent:!1,onExitComplete:T,custom:t,presenceAffectsLayout:i,mode:a},C),d.set(g,$)}c.splice(_,0,$)}),c=c.map(h=>{const g=h.key;return d.has(g)?h:S.createElement(ud,{key:_n(h),isPresent:!0,presenceAffectsLayout:i,mode:a},h)}),S.createElement(S.Fragment,null,d.size?c:c.map(h=>S.cloneElement(h)))};var wI={initial:e=>{const{position:t}=e,r=["top","bottom"].includes(t)?"y":"x";let n=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(n=1),{opacity:0,[r]:n*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},kx=S.memo(e=>{const{id:t,message:r,onCloseComplete:n,onRequestRemove:o,requestClose:i=!1,position:a="bottom",duration:s=5e3,containerStyle:l,motionVariants:u=wI,toastSpacing:c="0.5rem"}=e,[d,f]=S.useState(s),p=sD();yg(()=>{p||n==null||n()},[p]),yg(()=>{f(s)},[s]);const v=()=>f(null),y=()=>f(s),x=()=>{p&&o()};S.useEffect(()=>{p&&i&&o()},[p,i,o]),a3(x,d);const m=S.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),h=S.useMemo(()=>n3(a),[a]);return E.jsx(oi.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:v,onHoverEnd:y,custom:{position:a},style:h,children:E.jsx(_e.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:m,children:lr(r,{id:t,onClose:x})})})});kx.displayName="ToastComponent";function kI(e,t){var r;const n=e??"bottom",i={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[n];return(r=i==null?void 0:i[t])!=null?r:n}var k0={path:E.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[E.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),E.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),E.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Ya=pt((e,t)=>{const{as:r,viewBox:n,color:o="currentColor",focusable:i=!1,children:a,className:s,__css:l,...u}=e,c=Be("chakra-icon",s),d=Bu("Icon",e),f={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:o,...l,...d},p={ref:t,focusable:i,className:c,__css:f},v=n??k0.viewBox;if(r&&typeof r!="string")return E.jsx(_e.svg,{as:r,...p,...u});const y=a??k0.path;return E.jsx(_e.svg,{verticalAlign:"middle",viewBox:v,...p,...u,children:y})});Ya.displayName="Icon";function CI(e){return E.jsx(Ya,{viewBox:"0 0 24 24",...e,children:E.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function _I(e){return E.jsx(Ya,{viewBox:"0 0 24 24",...e,children:E.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function C0(e){return E.jsx(Ya,{viewBox:"0 0 24 24",...e,children:E.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var PI=vP({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Tp=pt((e,t)=>{const r=Bu("Spinner",e),{label:n="Loading...",thickness:o="2px",speed:i="0.45s",emptyColor:a="transparent",className:s,...l}=Iu(e),u=Be("chakra-spinner",s),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:o,borderBottomColor:a,borderLeftColor:a,animation:`${PI} ${i} linear infinite`,...r};return E.jsx(_e.div,{ref:t,__css:c,className:u,...l,children:n&&E.jsx(_e.span,{srOnly:!0,children:n})})});Tp.displayName="Spinner";var[TI,Ep]=mn({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[EI,$p]=mn({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),Cx={info:{icon:_I,colorScheme:"blue"},warning:{icon:C0,colorScheme:"orange"},success:{icon:CI,colorScheme:"green"},error:{icon:C0,colorScheme:"red"},loading:{icon:Tp,colorScheme:"blue"}};function $I(e){return Cx[e].colorScheme}function AI(e){return Cx[e].icon}var _x=pt(function(t,r){const n=$p(),{status:o}=Ep(),i={display:"inline",...n.description};return E.jsx(_e.div,{ref:r,"data-status":o,...t,className:Be("chakra-alert__desc",t.className),__css:i})});_x.displayName="AlertDescription";function Px(e){const{status:t}=Ep(),r=AI(t),n=$p(),o=t==="loading"?n.spinner:n.icon;return E.jsx(_e.span,{display:"inherit","data-status":t,...e,className:Be("chakra-alert__icon",e.className),__css:o,children:e.children||E.jsx(r,{h:"100%",w:"100%"})})}Px.displayName="AlertIcon";var Tx=pt(function(t,r){const n=$p(),{status:o}=Ep();return E.jsx(_e.div,{ref:r,"data-status":o,...t,className:Be("chakra-alert__title",t.className),__css:n.title})});Tx.displayName="AlertTitle";var Ex=pt(function(t,r){var n;const{status:o="info",addRole:i=!0,...a}=Iu(t),s=(n=t.colorScheme)!=null?n:$I(o),l=Xb("Alert",{...t,colorScheme:s}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return E.jsx(TI,{value:{status:o},children:E.jsx(EI,{value:l,children:E.jsx(_e.div,{"data-status":o,role:i?"alert":void 0,ref:r,...a,className:Be("chakra-alert",t.className),__css:u})})})});Ex.displayName="Alert";function RI(e){return E.jsx(Ya,{focusable:"false","aria-hidden":!0,...e,children:E.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var Ap=pt(function(t,r){const n=Bu("CloseButton",t),{children:o,isDisabled:i,__css:a,...s}=Iu(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return E.jsx(_e.button,{type:"button","aria-label":"Close",ref:r,disabled:i,__css:{...l,...n,...a},...s,children:o||E.jsx(RI,{width:"1em",height:"1em"})})});Ap.displayName="CloseButton";var MI={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},ar=zI(MI);function zI(e){let t=e;const r=new Set,n=o=>{t=o(t),r.forEach(i=>i())};return{getState:()=>t,subscribe:o=>(r.add(o),()=>{n(()=>e),r.delete(o)}),removeToast:(o,i)=>{n(a=>({...a,[i]:a[i].filter(s=>s.id!=o)}))},notify:(o,i)=>{const a=FI(o,i),{position:s,id:l}=a;return n(u=>{var c,d;const p=s.includes("top")?[a,...(c=u[s])!=null?c:[]]:[...(d=u[s])!=null?d:[],a];return{...u,[s]:p}}),l},update:(o,i)=>{o&&n(a=>{const s={...a},{position:l,index:u}=gg(s,o);return l&&u!==-1&&(s[l][u]={...s[l][u],...i,message:$x(i)}),s})},closeAll:({positions:o}={})=>{n(i=>(o??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=i[u].map(c=>({...c,requestClose:!0})),l),{...i}))},close:o=>{n(i=>{const a=Jb(i,o);return a?{...i,[a]:i[a].map(s=>s.id==o?{...s,requestClose:!0}:s)}:i})},isActive:o=>!!gg(ar.getState(),o).position}}var _0=0;function FI(e,t={}){var r,n;_0+=1;const o=(r=t.id)!=null?r:_0,i=(n=t.position)!=null?n:"bottom";return{id:o,message:e,position:i,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>ar.removeToast(String(o),i),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var DI=e=>{const{status:t,variant:r="solid",id:n,title:o,isClosable:i,onClose:a,description:s,colorScheme:l,icon:u}=e,c=n?{root:`toast-${n}`,title:`toast-${n}-title`,description:`toast-${n}-description`}:void 0;return E.jsxs(Ex,{addRole:!1,status:t,variant:r,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[E.jsx(Px,{children:u}),E.jsxs(_e.div,{flex:"1",maxWidth:"100%",children:[o&&E.jsx(Tx,{id:c==null?void 0:c.title,children:o}),s&&E.jsx(_x,{id:c==null?void 0:c.description,display:"block",children:s})]}),i&&E.jsx(Ap,{size:"sm",onClick:a,position:"absolute",insetEnd:1,top:1})]})};function $x(e={}){const{render:t,toastComponent:r=DI}=e;return o=>typeof t=="function"?t({...o,...e}):E.jsx(r,{...o,...e})}function wB(e,t){const r=o=>{var i;return{...t,...o,position:kI((i=o==null?void 0:o.position)!=null?i:t==null?void 0:t.position,e)}},n=o=>{const i=r(o),a=$x(i);return ar.notify(a,i)};return n.update=(o,i)=>{ar.update(o,r(i))},n.promise=(o,i)=>{const a=n({...i.loading,status:"loading",duration:null});o.then(s=>n.update(a,{status:"success",duration:5e3,...lr(i.success,s)})).catch(s=>n.update(a,{status:"error",duration:5e3,...lr(i.error,s)}))},n.closeAll=ar.closeAll,n.close=ar.close,n.isActive=ar.isActive,n}var[II,kB]=mn({name:"ToastOptionsContext",strict:!1}),LI=e=>{const t=S.useSyncExternalStore(ar.subscribe,ar.getState,ar.getState),{motionVariants:r,component:n=kx,portalProps:o}=e,a=Object.keys(t).map(s=>{const l=t[s];return E.jsx("div",{role:"region","aria-live":"polite","aria-label":`Notifications-${s}`,id:`chakra-toast-manager-${s}`,style:o3(s),children:E.jsx(Ka,{initial:!1,children:l.map(u=>E.jsx(n,{motionVariants:r,...u},u.id))})},s)});return E.jsx(ja,{...o,children:a})},OI=e=>function({children:r,theme:n=e,toastOptions:o,...i}){return E.jsxs(t3,{theme:n,...i,children:[E.jsx(II,{value:o==null?void 0:o.defaultOptions,children:r}),E.jsx(LI,{...o})]})},BI=OI(Vb);function jI(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function If(...e){return t=>{e.forEach(r=>{jI(r,t)})}}function NI(...e){return S.useMemo(()=>If(...e),e)}var P0={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},On={enter:{duration:.2,ease:P0.easeOut},exit:{duration:.1,ease:P0.easeIn}},Bn={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},VI={enter:({transition:e,transitionEnd:t,delay:r}={})=>{var n;return{opacity:1,transition:(n=e==null?void 0:e.enter)!=null?n:Bn.enter(On.enter,r),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:r}={})=>{var n;return{opacity:0,transition:(n=e==null?void 0:e.exit)!=null?n:Bn.exit(On.exit,r),transitionEnd:t==null?void 0:t.exit}}},Ax={initial:"exit",animate:"enter",exit:"exit",variants:VI},WI=S.forwardRef(function(t,r){const{unmountOnExit:n,in:o,className:i,transition:a,transitionEnd:s,delay:l,...u}=t,c=o||n?"enter":"exit",d=n?o&&n:!0,f={transition:a,transitionEnd:s,delay:l};return E.jsx(Ka,{custom:f,children:d&&E.jsx(oi.div,{ref:r,className:Be("chakra-fade",i),custom:f,...Ax,animate:c,...u})})});WI.displayName="Fade";var UI={exit:({reverse:e,initialScale:t,transition:r,transitionEnd:n,delay:o})=>{var i;return{opacity:0,...e?{scale:t,transitionEnd:n==null?void 0:n.exit}:{transitionEnd:{scale:t,...n==null?void 0:n.exit}},transition:(i=r==null?void 0:r.exit)!=null?i:Bn.exit(On.exit,o)}},enter:({transitionEnd:e,transition:t,delay:r})=>{var n;return{opacity:1,scale:1,transition:(n=t==null?void 0:t.enter)!=null?n:Bn.enter(On.enter,r),transitionEnd:e==null?void 0:e.enter}}},Rx={initial:"exit",animate:"enter",exit:"exit",variants:UI},HI=S.forwardRef(function(t,r){const{unmountOnExit:n,in:o,reverse:i=!0,initialScale:a=.95,className:s,transition:l,transitionEnd:u,delay:c,...d}=t,f=n?o&&n:!0,p=o||n?"enter":"exit",v={initialScale:a,reverse:i,transition:l,transitionEnd:u,delay:c};return E.jsx(Ka,{custom:v,children:f&&E.jsx(oi.div,{ref:r,className:Be("chakra-offset-slide",s),...Rx,animate:p,custom:v,...d})})});HI.displayName="ScaleFade";var GI={initial:({offsetX:e,offsetY:t,transition:r,transitionEnd:n,delay:o})=>{var i;return{opacity:0,x:e,y:t,transition:(i=r==null?void 0:r.exit)!=null?i:Bn.exit(On.exit,o),transitionEnd:n==null?void 0:n.exit}},enter:({transition:e,transitionEnd:t,delay:r})=>{var n;return{opacity:1,x:0,y:0,transition:(n=e==null?void 0:e.enter)!=null?n:Bn.enter(On.enter,r),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:r,transitionEnd:n,reverse:o,delay:i})=>{var a;const s={x:t,y:e};return{opacity:0,transition:(a=r==null?void 0:r.exit)!=null?a:Bn.exit(On.exit,i),...o?{...s,transitionEnd:n==null?void 0:n.exit}:{transitionEnd:{...s,...n==null?void 0:n.exit}}}}},Ii={initial:"initial",animate:"enter",exit:"exit",variants:GI},KI=S.forwardRef(function(t,r){const{unmountOnExit:n,in:o,reverse:i=!0,className:a,offsetX:s=0,offsetY:l=8,transition:u,transitionEnd:c,delay:d,...f}=t,p=n?o&&n:!0,v=o||n?"enter":"exit",y={offsetX:s,offsetY:l,reverse:i,transition:u,transitionEnd:c,delay:d};return E.jsx(Ka,{custom:y,children:p&&E.jsx(oi.div,{ref:r,className:Be("chakra-offset-slide",a),custom:y,...Ii,animate:v,...f})})});KI.displayName="SlideFade";var[CB,YI]=mn({strict:!1,name:"ButtonGroupContext"});function XI(e){const[t,r]=S.useState(!e);return{ref:S.useCallback(i=>{i&&r(i.tagName==="BUTTON")},[]),type:t?"button":void 0}}function Lf(e){const{children:t,className:r,...n}=e,o=S.isValidElement(t)?S.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,i=Be("chakra-button__icon",r);return E.jsx(_e.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...n,className:i,children:o})}Lf.displayName="ButtonIcon";function Of(e){const{label:t,placement:r,spacing:n="0.5rem",children:o=E.jsx(Tp,{color:"currentColor",width:"1em",height:"1em"}),className:i,__css:a,...s}=e,l=Be("chakra-button__spinner",i),u=r==="start"?"marginEnd":"marginStart",c=S.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[u]:t?n:0,fontSize:"1em",lineHeight:"normal",...a}),[a,t,u,n]);return E.jsx(_e.div,{className:l,...s,__css:c,children:o})}Of.displayName="ButtonSpinner";var Mx=pt((e,t)=>{const r=YI(),n=Bu("Button",{...r,...e}),{isDisabled:o=r==null?void 0:r.isDisabled,isLoading:i,isActive:a,children:s,leftIcon:l,rightIcon:u,loadingText:c,iconSpacing:d="0.5rem",type:f,spinner:p,spinnerPlacement:v="start",className:y,as:x,...m}=Iu(e),h=S.useMemo(()=>{const $={...n==null?void 0:n._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...n,...!!r&&{_focus:$}}},[n,r]),{ref:g,type:C}=XI(x),_={rightIcon:u,leftIcon:l,iconSpacing:d,children:s};return E.jsxs(_e.button,{ref:NI(t,g),as:x,type:f??C,"data-active":_v(a),"data-loading":_v(i),__css:h,className:Be("chakra-button",y),...m,disabled:o||i,children:[i&&v==="start"&&E.jsx(Of,{className:"chakra-button__spinner--start",label:c,placement:"start",spacing:d,children:p}),i?c||E.jsx(_e.span,{opacity:0,children:E.jsx(T0,{..._})}):E.jsx(T0,{..._}),i&&v==="end"&&E.jsx(Of,{className:"chakra-button__spinner--end",label:c,placement:"end",spacing:d,children:p})]})});Mx.displayName="Button";function T0(e){const{leftIcon:t,rightIcon:r,children:n,iconSpacing:o}=e;return E.jsxs(E.Fragment,{children:[t&&E.jsx(Lf,{marginEnd:o,children:t}),n,r&&E.jsx(Lf,{marginStart:o,children:r})]})}function QI(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,i;for(i=0;i=0)&&(r[o]=e[o]);return r}var Bf="data-focus-lock",zx="data-focus-lock-disabled",qI="data-no-focus-lock",ZI="data-autofocus-inside",JI="data-no-autofocus";function eL(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function tL(e,t){var r=S.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=t,r.facade}function Fx(e,t){return tL(t||null,function(r){return e.forEach(function(n){return eL(n,r)})})}var cd={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},sr=function(){return sr=Object.assign||function(t){for(var r,n=1,o=arguments.length;n=0}).sort(bL)},SL=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],Fp=SL.join(","),xL="".concat(Fp,", [data-focus-guard]"),Zx=function(e,t){return pr((e.shadowRoot||e).children).reduce(function(r,n){return r.concat(n.matches(t?xL:Fp)?[n]:[],Zx(n))},[])},wL=function(e,t){var r;return e instanceof HTMLIFrameElement&&(!((r=e.contentDocument)===null||r===void 0)&&r.body)?Ku([e.contentDocument.body],t):[e]},Ku=function(e,t){return e.reduce(function(r,n){var o,i=Zx(n,t),a=(o=[]).concat.apply(o,i.map(function(s){return wL(s,t)}));return r.concat(a,n.parentNode?pr(n.parentNode.querySelectorAll(Fp)).filter(function(s){return s===n}):[])},[])},kL=function(e){var t=e.querySelectorAll("[".concat(ZI,"]"));return pr(t).map(function(r){return Ku([r])}).reduce(function(r,n){return r.concat(n)},[])},Dp=function(e,t){return pr(e).filter(function(r){return Gx(t,r)}).filter(function(r){return vL(r)})},E0=function(e,t){return t===void 0&&(t=new Map),pr(e).filter(function(r){return Kx(t,r)})},Nf=function(e,t,r){return qx(Dp(Ku(e,r),t),!0,r)},$0=function(e,t){return qx(Dp(Ku(e),t),!1)},CL=function(e,t){return Dp(kL(e),t)},Bo=function(e,t){return e.shadowRoot?Bo(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:pr(e.children).some(function(r){var n;if(r instanceof HTMLIFrameElement){var o=(n=r.contentDocument)===null||n===void 0?void 0:n.body;return o?Bo(o,t):!1}return Bo(r,t)})},_L=function(e){for(var t=new Set,r=e.length,n=0;n0&&t.add(o),(i&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(n)}return e.filter(function(a,s){return!t.has(s)})},Jx=function(e){return e.parentNode?Jx(e.parentNode):e},Ip=function(e){var t=tu(e);return t.filter(Boolean).reduce(function(r,n){var o=n.getAttribute(Bf);return r.push.apply(r,o?_L(pr(Jx(n).querySelectorAll("[".concat(Bf,'="').concat(o,'"]:not([').concat(zx,'="disabled"])')))):[n]),r},[])},PL=function(e){try{return e()}catch{return}},Ra=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Ra(t.shadowRoot):t instanceof HTMLIFrameElement&&PL(function(){return t.contentWindow.document})?Ra(t.contentWindow.document):t}},TL=function(e,t){return e===t},EL=function(e,t){return!!pr(e.querySelectorAll("iframe")).some(function(r){return TL(r,t)})},ew=function(e,t){return t===void 0&&(t=Ra(Wx(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:Ip(e).some(function(r){return Bo(r,t)||EL(r,t)})},$L=function(e){e===void 0&&(e=document);var t=Ra(e);return t?pr(e.querySelectorAll("[".concat(qI,"]"))).some(function(r){return Bo(r,t)}):!1},AL=function(e,t){return t.filter(Qx).filter(function(r){return r.name===e.name}).filter(function(r){return r.checked})[0]||e},Lp=function(e,t){return Qx(e)&&e.name?AL(e,t):e},RL=function(e){var t=new Set;return e.forEach(function(r){return t.add(Lp(r,e))}),e.filter(function(r){return t.has(r)})},A0=function(e){return e[0]&&e.length>1?Lp(e[0],e):e[0]},R0=function(e,t){return e.length>1?e.indexOf(Lp(e[t],e)):t},tw="NEW_FOCUS",ML=function(e,t,r,n){var o=e.length,i=e[0],a=e[o-1],s=zp(r);if(!(r&&e.indexOf(r)>=0)){var l=r!==void 0?t.indexOf(r):-1,u=n?t.indexOf(n):l,c=n?e.indexOf(n):-1,d=l-u,f=t.indexOf(i),p=t.indexOf(a),v=RL(t),y=r!==void 0?v.indexOf(r):-1,x=y-(n?v.indexOf(n):l),m=R0(e,0),h=R0(e,o-1);if(l===-1||c===-1)return tw;if(!d&&c>=0)return c;if(l<=f&&s&&Math.abs(d)>1)return h;if(l>=p&&s&&Math.abs(d)>1)return m;if(d&&Math.abs(x)>1)return c;if(l<=f)return h;if(l>p)return m;if(d)return Math.abs(d)>1?c:(o+c+d)%o}},zL=function(e){return function(t){var r,n=(r=Yx(t))===null||r===void 0?void 0:r.autofocus;return t.autofocus||n!==void 0&&n!=="false"||e.indexOf(t)>=0}},FL=function(e,t,r){var n=e.map(function(i){var a=i.node;return a}),o=E0(n.filter(zL(r)));return o&&o.length?A0(o):A0(E0(t))},Vf=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&Vf(e.parentNode.host||e.parentNode,t),t},dd=function(e,t){for(var r=Vf(e),n=Vf(t),o=0;o=0)return i}return!1},rw=function(e,t,r){var n=tu(e),o=tu(t),i=n[0],a=!1;return o.filter(Boolean).forEach(function(s){a=dd(a||s,s)||a,r.filter(Boolean).forEach(function(l){var u=dd(i,l);u&&(!a||Bo(u,a)?a=u:a=dd(u,a))})}),a},DL=function(e,t){return e.reduce(function(r,n){return r.concat(CL(n,t))},[])},IL=function(e,t){var r=new Map;return t.forEach(function(n){return r.set(n.node,n)}),e.map(function(n){return r.get(n)}).filter(yL)},LL=function(e,t){var r=Ra(tu(e).length>0?document:Wx(e).ownerDocument),n=Ip(e).filter(ru),o=rw(r||e,e,n),i=new Map,a=$0(n,i),s=Nf(n,i).filter(function(p){var v=p.node;return ru(v)});if(!(!s[0]&&(s=a,!s[0]))){var l=$0([o],i).map(function(p){var v=p.node;return v}),u=IL(l,s),c=u.map(function(p){var v=p.node;return v}),d=ML(c,l,r,t);if(d===tw){var f=FL(a,c,DL(n,i));if(f)return{node:f};console.warn("focus-lock: cannot find any node to move focus into");return}return d===void 0?d:u[d]}},OL=function(e){var t=Ip(e).filter(ru),r=rw(e,e,t),n=new Map,o=Nf([r],n,!0),i=Nf(t,n).filter(function(a){var s=a.node;return ru(s)}).map(function(a){var s=a.node;return s});return o.map(function(a){var s=a.node,l=a.index;return{node:s,index:l,lockItem:i.indexOf(s)>=0,guard:zp(s)}})},BL=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},fd=0,hd=!1,nw=function(e,t,r){r===void 0&&(r={});var n=LL(e,t);if(!hd&&n){if(fd>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),hd=!0,setTimeout(function(){hd=!1},1);return}fd++,BL(n.node,r.focusOptions),fd--}};function Op(e){setTimeout(e,1)}var jL=function(){return document&&document.activeElement===document.body},NL=function(){return jL()||$L()},jo=null,To=null,No=null,Ma=!1,VL=function(){return!0},WL=function(t){return(jo.whiteList||VL)(t)},UL=function(t,r){No={observerNode:t,portaledElement:r}},HL=function(t){return No&&No.portaledElement===t};function M0(e,t,r,n){var o=null,i=e;do{var a=n[i];if(a.guard)a.node.dataset.focusAutoGuard&&(o=a);else if(a.lockItem){if(i!==e)return;o=null}else break}while((i+=r)!==t);o&&(o.node.tabIndex=0)}var GL=function(t){return t&&"current"in t?t.current:t},KL=function(t){return t?!!Ma:Ma==="meanwhile"},YL=function e(t,r,n){return r&&(r.host===t&&(!r.activeElement||n.contains(r.activeElement))||r.parentNode&&e(t,r.parentNode,n))},XL=function(t,r){return r.some(function(n){return YL(t,n,n)})},nu=function(){var t=!1;if(jo){var r=jo,n=r.observed,o=r.persistentFocus,i=r.autoFocus,a=r.shards,s=r.crossFrame,l=r.focusOptions,u=n||No&&No.portaledElement,c=document&&document.activeElement;if(u){var d=[u].concat(a.map(GL).filter(Boolean));if((!c||WL(c))&&(o||KL(s)||!NL()||!To&&i)&&(u&&!(ew(d)||c&&XL(c,d)||HL(c))&&(document&&!To&&c&&!i?(c.blur&&c.blur(),document.body.focus()):(t=nw(d,To,{focusOptions:l}),No={})),Ma=!1,To=document&&document.activeElement),document){var f=document&&document.activeElement,p=OL(d),v=p.map(function(y){var x=y.node;return x}).indexOf(f);v>-1&&(p.filter(function(y){var x=y.guard,m=y.node;return x&&m.dataset.focusAutoGuard}).forEach(function(y){var x=y.node;return x.removeAttribute("tabIndex")}),M0(v,p.length,1,p),M0(v,-1,-1,p))}}}return t},ow=function(t){nu()&&t&&(t.stopPropagation(),t.preventDefault())},Bp=function(){return Op(nu)},QL=function(t){var r=t.target,n=t.currentTarget;n.contains(r)||UL(n,r)},qL=function(){return null},iw=function(){Ma="just",Op(function(){Ma="meanwhile"})},ZL=function(){document.addEventListener("focusin",ow),document.addEventListener("focusout",Bp),window.addEventListener("blur",iw)},JL=function(){document.removeEventListener("focusin",ow),document.removeEventListener("focusout",Bp),window.removeEventListener("blur",iw)};function eO(e){return e.filter(function(t){var r=t.disabled;return!r})}function tO(e){var t=e.slice(-1)[0];t&&!jo&&ZL();var r=jo,n=r&&t&&t.id===r.id;jo=t,r&&!n&&(r.onDeactivation(),e.filter(function(o){var i=o.id;return i===r.id}).length||r.returnFocus(!t)),t?(To=null,(!n||r.observed!==t.observed)&&t.onActivation(),nu(),Op(nu)):(JL(),To=null)}jx.assignSyncMedium(QL);Nx.assignMedium(Bp);oL.assignMedium(function(e){return e({moveFocusInside:nw,focusInside:ew})});const rO=dL(eO,tO)(qL);var aw=S.forwardRef(function(t,r){return S.createElement(Vx,Hn({sideCar:rO,ref:r},t))}),sw=Vx.propTypes||{};sw.sideCar;QI(sw,["sideCar"]);aw.propTypes={};const z0=aw;function lw(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function uw(e){var t;if(!lw(e))return!1;const r=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof r.HTMLElement}function _B(e){var t,r;return(r=(t=cw(e))==null?void 0:t.defaultView)!=null?r:window}function cw(e){return lw(e)?e.ownerDocument:document}function PB(e){return cw(e).activeElement}var dw=e=>e.hasAttribute("tabindex"),nO=e=>dw(e)&&e.tabIndex===-1;function oO(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function fw(e){return e.parentElement&&fw(e.parentElement)?!0:e.hidden}function iO(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function hw(e){if(!uw(e)||fw(e)||oO(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const n={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in n?n[t]():iO(e)?!0:dw(e)}function TB(e){return e?uw(e)&&hw(e)&&!nO(e):!1}var aO=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],sO=aO.join(),lO=e=>e.offsetWidth>0&&e.offsetHeight>0;function uO(e){const t=Array.from(e.querySelectorAll(sO));return t.unshift(e),t.filter(r=>hw(r)&&lO(r))}var F0,cO=(F0=z0.default)!=null?F0:z0,pw=e=>{const{initialFocusRef:t,finalFocusRef:r,contentRef:n,restoreFocus:o,children:i,isDisabled:a,autoFocus:s,persistentFocus:l,lockFocusAcrossFrames:u}=e,c=S.useCallback(()=>{t!=null&&t.current?t.current.focus():n!=null&&n.current&&uO(n.current).length===0&&requestAnimationFrame(()=>{var v;(v=n.current)==null||v.focus()})},[t,n]),d=S.useCallback(()=>{var p;(p=r==null?void 0:r.current)==null||p.focus()},[r]),f=o&&!r;return E.jsx(cO,{crossFrame:u,persistentFocus:l,autoFocus:s,disabled:a,onActivation:c,onDeactivation:d,returnFocus:f,children:i})};pw.displayName="FocusLock";var dO={slideInBottom:{...Ii,custom:{offsetY:16,reverse:!0}},slideInRight:{...Ii,custom:{offsetX:16,reverse:!0}},slideInTop:{...Ii,custom:{offsetY:-16,reverse:!0}},slideInLeft:{...Ii,custom:{offsetX:-16,reverse:!0}},scale:{...Rx,custom:{initialScale:.95,reverse:!0}},none:{}},fO=_e(oi.section),hO=e=>dO[e||"none"],mw=S.forwardRef((e,t)=>{const{preset:r,motionProps:n=hO(r),...o}=e;return E.jsx(fO,{ref:t,...n,...o})});mw.displayName="ModalTransition";var pO=Object.defineProperty,mO=(e,t,r)=>t in e?pO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vO=(e,t,r)=>(mO(e,typeof t!="symbol"?t+"":t,r),r),gO=class{constructor(){vO(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},Wf=new gO;function vw(e,t){const[r,n]=S.useState(0);return S.useEffect(()=>{const o=e.current;if(o){if(t){const i=Wf.add(o);n(i)}return()=>{Wf.remove(o),n(0)}}},[t,e]),r}var yO=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},to=new WeakMap,Ds=new WeakMap,Is={},pd=0,gw=function(e){return e&&(e.host||gw(e.parentNode))},bO=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=gw(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},SO=function(e,t,r,n){var o=bO(t,Array.isArray(e)?e:[e]);Is[r]||(Is[r]=new WeakMap);var i=Is[r],a=[],s=new Set,l=new Set(o),u=function(d){!d||s.has(d)||(s.add(d),u(d.parentNode))};o.forEach(u);var c=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else{var p=f.getAttribute(n),v=p!==null&&p!=="false",y=(to.get(f)||0)+1,x=(i.get(f)||0)+1;to.set(f,y),i.set(f,x),a.push(f),y===1&&v&&Ds.set(f,!0),x===1&&f.setAttribute(r,"true"),v||f.setAttribute(n,"true")}})};return c(t),s.clear(),pd++,function(){a.forEach(function(d){var f=to.get(d)-1,p=i.get(d)-1;to.set(d,f),i.set(d,p),f||(Ds.has(d)||d.removeAttribute(n),Ds.delete(d)),p||d.removeAttribute(r)}),pd--,pd||(to=new WeakMap,to=new WeakMap,Ds=new WeakMap,Is={})}},xO=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),o=t||yO(e);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),SO(n,o,r,"aria-hidden")):function(){return null}};function wO(e){const{isOpen:t,onClose:r,id:n,closeOnOverlayClick:o=!0,closeOnEsc:i=!0,useInert:a=!0,onOverlayClick:s,onEsc:l}=e,u=S.useRef(null),c=S.useRef(null),[d,f,p]=CO(n,"chakra-modal","chakra-modal--header","chakra-modal--body");kO(u,t&&a);const v=vw(u,t),y=S.useRef(null),x=S.useCallback(M=>{y.current=M.target},[]),m=S.useCallback(M=>{M.key==="Escape"&&(M.stopPropagation(),i&&(r==null||r()),l==null||l())},[i,r,l]),[h,g]=S.useState(!1),[C,_]=S.useState(!1),$=S.useCallback((M={},I=null)=>({role:"dialog",...M,ref:If(I,u),id:d,tabIndex:-1,"aria-modal":!0,"aria-labelledby":h?f:void 0,"aria-describedby":C?p:void 0,onClick:Ei(M.onClick,ee=>ee.stopPropagation())}),[p,C,d,f,h]),T=S.useCallback(M=>{M.stopPropagation(),y.current===M.target&&Wf.isTopModal(u.current)&&(o&&(r==null||r()),s==null||s())},[r,o,s]),A=S.useCallback((M={},I=null)=>({...M,ref:If(I,c),onClick:Ei(M.onClick,T),onKeyDown:Ei(M.onKeyDown,m),onMouseDown:Ei(M.onMouseDown,x)}),[m,x,T]);return{isOpen:t,onClose:r,headerId:f,bodyId:p,setBodyMounted:_,setHeaderMounted:g,dialogRef:u,overlayRef:c,getDialogProps:$,getDialogContainerProps:A,index:v}}function kO(e,t){const r=e.current;S.useEffect(()=>{if(!(!e.current||!t))return xO(e.current)},[t,e,r])}function CO(e,...t){const r=S.useId(),n=e||r;return S.useMemo(()=>t.map(o=>`${o}-${n}`),[n,t])}var[_O,ii]=mn({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[PO,Gn]=mn({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),yw=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:r,children:n,autoFocus:o,trapFocus:i,initialFocusRef:a,finalFocusRef:s,returnFocusOnClose:l,blockScrollOnMount:u,allowPinchZoom:c,preserveScrollBarGap:d,motionPreset:f,lockFocusAcrossFrames:p,onCloseComplete:v}=t,y=Xb("Modal",t),m={...wO(t),autoFocus:o,trapFocus:i,initialFocusRef:a,finalFocusRef:s,returnFocusOnClose:l,blockScrollOnMount:u,allowPinchZoom:c,preserveScrollBarGap:d,motionPreset:f,lockFocusAcrossFrames:p};return E.jsx(PO,{value:m,children:E.jsx(_O,{value:y,children:E.jsx(Ka,{onExitComplete:v,children:m.isOpen&&E.jsx(ja,{...r,children:n})})})})};yw.displayName="Modal";var fl="right-scroll-bar-position",hl="width-before-scroll-bar",TO="with-scroll-bars-hidden",EO="--removed-body-scroll-bar-size",bw=Ox(),md=function(){},Yu=S.forwardRef(function(e,t){var r=S.useRef(null),n=S.useState({onScrollCapture:md,onWheelCapture:md,onTouchMoveCapture:md}),o=n[0],i=n[1],a=e.forwardProps,s=e.children,l=e.className,u=e.removeScrollBar,c=e.enabled,d=e.shards,f=e.sideCar,p=e.noIsolation,v=e.inert,y=e.allowPinchZoom,x=e.as,m=x===void 0?"div":x,h=e.gapMode,g=Dx(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=f,_=Fx([r,t]),$=sr(sr({},g),o);return S.createElement(S.Fragment,null,c&&S.createElement(C,{sideCar:bw,removeScrollBar:u,shards:d,noIsolation:p,inert:v,setCallbacks:i,allowPinchZoom:!!y,lockRef:r,gapMode:h}),a?S.cloneElement(S.Children.only(s),sr(sr({},$),{ref:_})):S.createElement(m,sr({},$,{className:l,ref:_}),s))});Yu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Yu.classNames={fullWidth:hl,zeroRight:fl};var D0,$O=function(){if(D0)return D0;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function AO(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=$O();return t&&e.setAttribute("nonce",t),e}function RO(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function MO(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var zO=function(){var e=0,t=null;return{add:function(r){e==0&&(t=AO())&&(RO(t,r),MO(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},FO=function(){var e=zO();return function(t,r){S.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Sw=function(){var e=FO(),t=function(r){var n=r.styles,o=r.dynamic;return e(n,o),null};return t},DO={left:0,top:0,right:0,gap:0},vd=function(e){return parseInt(e||"",10)||0},IO=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[vd(r),vd(n),vd(o)]},LO=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return DO;var t=IO(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},OO=Sw(),BO=function(e,t,r,n){var o=e.left,i=e.top,a=e.right,s=e.gap;return r===void 0&&(r="margin"),` + .`.concat(TO,` { + overflow: hidden `).concat(n,`; + padding-right: `).concat(s,"px ").concat(n,`; + } + body { + overflow: hidden `).concat(n,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&` + padding-left: `.concat(o,`px; + padding-top: `).concat(i,`px; + padding-right: `).concat(a,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(s,"px ").concat(n,`; + `),r==="padding"&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),` + } + + .`).concat(fl,` { + right: `).concat(s,"px ").concat(n,`; + } + + .`).concat(hl,` { + margin-right: `).concat(s,"px ").concat(n,`; + } + + .`).concat(fl," .").concat(fl,` { + right: 0 `).concat(n,`; + } + + .`).concat(hl," .").concat(hl,` { + margin-right: 0 `).concat(n,`; + } + + body { + `).concat(EO,": ").concat(s,`px; + } +`)},jO=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,o=n===void 0?"margin":n,i=S.useMemo(function(){return LO(o)},[o]);return S.createElement(OO,{styles:BO(i,!t,o,r?"":"!important")})},Uf=!1;if(typeof window<"u")try{var Ls=Object.defineProperty({},"passive",{get:function(){return Uf=!0,!0}});window.addEventListener("test",Ls,Ls),window.removeEventListener("test",Ls,Ls)}catch{Uf=!1}var ro=Uf?{passive:!1}:!1,NO=function(e){return e.tagName==="TEXTAREA"},xw=function(e,t){var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!NO(e)&&r[t]==="visible")},VO=function(e){return xw(e,"overflowY")},WO=function(e){return xw(e,"overflowX")},I0=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=ww(e,n);if(o){var i=kw(e,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},UO=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},HO=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},ww=function(e,t){return e==="v"?VO(t):WO(t)},kw=function(e,t){return e==="v"?UO(t):HO(t)},GO=function(e,t){return e==="h"&&t==="rtl"?-1:1},KO=function(e,t,r,n,o){var i=GO(e,window.getComputedStyle(t).direction),a=i*n,s=r.target,l=t.contains(s),u=!1,c=a>0,d=0,f=0;do{var p=kw(e,s),v=p[0],y=p[1],x=p[2],m=y-x-i*v;(v||m)&&ww(e,s)&&(d+=m,f+=v),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(u=!0),u},Os=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},L0=function(e){return[e.deltaX,e.deltaY]},O0=function(e){return e&&"current"in e?e.current:e},YO=function(e,t){return e[0]===t[0]&&e[1]===t[1]},XO=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},QO=0,no=[];function qO(e){var t=S.useRef([]),r=S.useRef([0,0]),n=S.useRef(),o=S.useState(QO++)[0],i=S.useState(Sw)[0],a=S.useRef(e);S.useEffect(function(){a.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var y=rL([e.lockRef.current],(e.shards||[]).map(O0),!0).filter(Boolean);return y.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),y.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=S.useCallback(function(y,x){if("touches"in y&&y.touches.length===2)return!a.current.allowPinchZoom;var m=Os(y),h=r.current,g="deltaX"in y?y.deltaX:h[0]-m[0],C="deltaY"in y?y.deltaY:h[1]-m[1],_,$=y.target,T=Math.abs(g)>Math.abs(C)?"h":"v";if("touches"in y&&T==="h"&&$.type==="range")return!1;var A=I0(T,$);if(!A)return!0;if(A?_=T:(_=T==="v"?"h":"v",A=I0(T,$)),!A)return!1;if(!n.current&&"changedTouches"in y&&(g||C)&&(n.current=_),!_)return!0;var M=n.current||_;return KO(M,x,y,M==="h"?g:C,!0)},[]),l=S.useCallback(function(y){var x=y;if(!(!no.length||no[no.length-1]!==i)){var m="deltaY"in x?L0(x):Os(x),h=t.current.filter(function(_){return _.name===x.type&&(_.target===x.target||x.target===_.shadowParent)&&YO(_.delta,m)})[0];if(h&&h.should){x.cancelable&&x.preventDefault();return}if(!h){var g=(a.current.shards||[]).map(O0).filter(Boolean).filter(function(_){return _.contains(x.target)}),C=g.length>0?s(x,g[0]):!a.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),u=S.useCallback(function(y,x,m,h){var g={name:y,delta:x,target:m,should:h,shadowParent:ZO(m)};t.current.push(g),setTimeout(function(){t.current=t.current.filter(function(C){return C!==g})},1)},[]),c=S.useCallback(function(y){r.current=Os(y),n.current=void 0},[]),d=S.useCallback(function(y){u(y.type,L0(y),y.target,s(y,e.lockRef.current))},[]),f=S.useCallback(function(y){u(y.type,Os(y),y.target,s(y,e.lockRef.current))},[]);S.useEffect(function(){return no.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,ro),document.addEventListener("touchmove",l,ro),document.addEventListener("touchstart",c,ro),function(){no=no.filter(function(y){return y!==i}),document.removeEventListener("wheel",l,ro),document.removeEventListener("touchmove",l,ro),document.removeEventListener("touchstart",c,ro)}},[]);var p=e.removeScrollBar,v=e.inert;return S.createElement(S.Fragment,null,v?S.createElement(i,{styles:XO(o)}):null,p?S.createElement(jO,{gapMode:e.gapMode}):null)}function ZO(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const JO=nL(bw,qO);var Cw=S.forwardRef(function(e,t){return S.createElement(Yu,sr({},e,{ref:t,sideCar:JO}))});Cw.classNames=Yu.classNames;const eB=Cw;function tB(e){const{autoFocus:t,trapFocus:r,dialogRef:n,initialFocusRef:o,blockScrollOnMount:i,allowPinchZoom:a,finalFocusRef:s,returnFocusOnClose:l,preserveScrollBarGap:u,lockFocusAcrossFrames:c,isOpen:d}=Gn(),[f,p]=ux();S.useEffect(()=>{!f&&p&&setTimeout(p)},[f,p]);const v=vw(n,d);return E.jsx(pw,{autoFocus:t,isDisabled:!r,initialFocusRef:o,finalFocusRef:s,restoreFocus:l,contentRef:n,lockFocusAcrossFrames:c,children:E.jsx(eB,{removeScrollBar:!u,allowPinchZoom:a,enabled:v===1&&i,forwardProps:!0,children:e.children})})}var _w=pt((e,t)=>{const{className:r,children:n,containerProps:o,motionProps:i,...a}=e,{getDialogProps:s,getDialogContainerProps:l}=Gn(),u=s(a,t),c=l(o),d=Be("chakra-modal__content",r),f=ii(),p={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...f.dialog},v={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...f.dialogContainer},{motionPreset:y}=Gn();return E.jsx(tB,{children:E.jsx(_e.div,{...c,className:"chakra-modal__content-container",tabIndex:-1,__css:v,children:E.jsx(mw,{preset:y,motionProps:i,className:d,...u,__css:p,children:n})})})});_w.displayName="ModalContent";function rB(e){const{leastDestructiveRef:t,...r}=e;return E.jsx(yw,{...r,initialFocusRef:t})}var nB=pt((e,t)=>E.jsx(_w,{ref:t,role:"alertdialog",...e})),Pw=pt((e,t)=>{const{className:r,...n}=e,o=Be("chakra-modal__footer",r),a={display:"flex",alignItems:"center",justifyContent:"flex-end",...ii().footer};return E.jsx(_e.footer,{ref:t,...n,__css:a,className:o})});Pw.displayName="ModalFooter";var Tw=pt((e,t)=>{const{className:r,...n}=e,{headerId:o,setHeaderMounted:i}=Gn();S.useEffect(()=>(i(!0),()=>i(!1)),[i]);const a=Be("chakra-modal__header",r),l={flex:0,...ii().header};return E.jsx(_e.header,{ref:t,className:a,id:o,...n,__css:l})});Tw.displayName="ModalHeader";var oB=_e(oi.div),Ew=pt((e,t)=>{const{className:r,transition:n,motionProps:o,...i}=e,a=Be("chakra-modal__overlay",r),l={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...ii().overlay},{motionPreset:u}=Gn(),d=o||(u==="none"?{}:Ax);return E.jsx(oB,{...d,__css:l,ref:t,className:a,...i})});Ew.displayName="ModalOverlay";var $w=pt((e,t)=>{const{className:r,...n}=e,{bodyId:o,setBodyMounted:i}=Gn();S.useEffect(()=>(i(!0),()=>i(!1)),[i]);const a=Be("chakra-modal__body",r),s=ii();return E.jsx(_e.div,{ref:t,className:a,id:o,...n,__css:s.body})});$w.displayName="ModalBody";var Aw=pt((e,t)=>{const{onClick:r,className:n,...o}=e,{onClose:i}=Gn(),a=Be("chakra-modal__close-btn",n),s=ii();return E.jsx(Ap,{ref:t,__css:s.closeButton,className:a,onClick:Ei(r,l=>{l.stopPropagation(),i()}),...o})});Aw.displayName="ModalCloseButton";const Rw=S.createContext(void 0),EB=()=>{const e=S.useContext(Rw);if(!e)throw new Error("useDialog must be used within a DialogProvider");return e},iB=({children:e})=>{const[t,r]=S.useState(!1),[n,o]=S.useState(""),[i,a]=S.useState([]),[s,l]=S.useState(!1),[u,c]=S.useState(!0),d=Ar.useRef(null),f=S.useCallback((v,y,x)=>{o(v),a(y??[]),r(!0),l((x==null?void 0:x.hideCloseIcon)??!1),c((x==null?void 0:x.closeOnOverlayClick)??!0)},[]),p=S.useCallback(()=>{r(!1)},[]);return E.jsxs(Rw.Provider,{value:{showDialog:f},children:[e,t&&E.jsx(rB,{isOpen:t,leastDestructiveRef:d,onClose:p,size:"xl",closeOnOverlayClick:u,children:E.jsx(xb,{children:E.jsx(Ew,{children:E.jsxs(nB,{className:"workspace_manager",children:[E.jsx(Tw,{fontSize:"lg",fontWeight:"bold"}),s?null:E.jsx(Aw,{}),E.jsx($w,{whiteSpace:"pre-wrap",children:n}),E.jsx(Pw,{children:i.map((v,y)=>v&&E.jsx(Mx,{colorScheme:v.colorScheme??"gray",onClick:()=>{v.onClick(),p()},iconSpacing:1,leftIcon:v.icon,ml:3,children:v.label},y))})]})})})})]})},Mw=String.raw,aB=Mw` + :root, + :host { + --chakra-vh: 100vh; + --toast-z-index: 17000000; + } + + @supports (height: -webkit-fill-available) { + :root, + :host { + --chakra-vh: -webkit-fill-available; + } + } + + @supports (height: -moz-fill-available) { + :root, + :host { + --chakra-vh: -moz-fill-available; + } + } + + @supports (height: 100dvh) { + :root, + :host { + --chakra-vh: 100dvh; + } + } +`,sB=({scope:e=""})=>E.jsx(Ba,{styles:Mw` + ${e} { + font-family: var(--chakra-fonts-body); + color: var(--chakra-colors-chakra-body-text); + background: var(--chakra-colors-chakra-body-bg); + transition-property: background-color; + transition-duration: var(--chakra-transition-duration-normal); + line-height: var(--chakra-lineHeights-base); + } + ${e} *, ${e} ::before, ${e} ::after { + border-color: var(--chakra-colors-chakra-border-color); + } + + ${e} :where(html) { + line-height: 1.5; + -webkit-text-size-adjust: 100%; + font-family: system-ui, sans-serif; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + -moz-osx-font-smoothing: grayscale; + touch-action: manipulation; + } + + ${e} :where(body) { + position: relative; + min-height: 100%; + margin: 0; + font-feature-settings: "kern"; + } + + ${e} :where(*, *::before, *::after) { + border-width: 0; + border-style: solid; + box-sizing: border-box; + word-wrap: break-word; + } + + ${e} :where(main) { + display: block; + } + + ${e} hr { + border-top-width: 1px; + box-sizing: content-box; + height: 0; + overflow: visible; + } + + ${e} :where(pre, code, kbd,samp) { + font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; + font-size: 1em; + } + + ${e} a { + background-color: transparent; + color: inherit; + text-decoration: inherit; + } + + ${e} abbr[title] { + border-bottom: none; + text-decoration: underline; + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; + } + + ${e} :where(b, strong) { + font-weight: bold; + } + + ${e} small { + font-size: 80%; + } + + ${e} :where(sub,sup) { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; + } + + ${e} sub { + bottom: -0.25em; + } + + ${e} :where(sup) { + top: -0.5em; + } + + ${e} :where(img) { + border-style: none; + } + + ${e} :where(button, input, optgroup, select, textarea) { + font-family: inherit; + font-size: 100%; + line-height: 1.15; + margin: 0; + } + + ${e} :where(button, input) { + overflow: visible; + } + + ${e} :where(button, select) { + text-transform: none; + } + + ${e} :where( + button::-moz-focus-inner, + [type="button"]::-moz-focus-inner, + [type="reset"]::-moz-focus-inner, + [type="submit"]::-moz-focus-inner + ) { + border-style: none; + padding: 0; + } + + ${e} fieldset { + padding: 0.35em 0.75em 0.625em; + } + + ${e} legend { + box-sizing: border-box; + color: inherit; + display: table; + max-width: 100%; + padding: 0; + white-space: normal; + } + + ${e} progress { + vertical-align: baseline; + } + + ${e} textarea { + overflow: auto; + } + + ${e} :where([type="checkbox"], [type="radio"]) { + box-sizing: border-box; + padding: 0; + } + + ${e} input[type="number"]::-webkit-inner-spin-button, + ${e} input[type="number"]::-webkit-outer-spin-button { + -webkit-appearance: none !important; + } + + ${e} input[type="number"] { + -moz-appearance: textfield; + } + + ${e} input[type="search"] { + -webkit-appearance: textfield; + outline-offset: -2px; + } + + ${e} input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none !important; + } + + ${e} ::-webkit-file-upload-button { + -webkit-appearance: button; + font: inherit; + } + + ${e} details { + display: block; + } + + ${e} summary { + display: list-item; + } + + ${e} template { + display: none; + } + + [hidden] { + display: none !important; + } + + ${e} :where( + blockquote, + dl, + dd, + h1, + h2, + h3, + h4, + h5, + h6, + hr, + figure, + p, + pre + ) { + margin: 0; + } + + ${e} :where(button) { + background: transparent; + padding: 0; + } + + ${e} fieldset { + margin: 0; + padding: 0; + } + + ${e} :where(ol, ul) { + margin: 0; + padding: 0; + } + + ${e} textarea { + resize: vertical; + } + + ${e} :where(button, [role="button"]) { + cursor: pointer; + } + + ${e} button::-moz-focus-inner { + border: 0 !important; + } + + ${e} table { + border-collapse: collapse; + } + + ${e} :where(h1, h2, h3, h4, h5, h6) { + font-size: inherit; + font-weight: inherit; + } + + ${e} :where(button, input, optgroup, select, textarea) { + padding: 0; + line-height: inherit; + color: inherit; + } + + ${e} :where(img, svg, video, canvas, audio, iframe, embed, object) { + display: block; + } + + ${e} :where(img, video) { + max-width: 100%; + height: auto; + } + + ${e} [data-js-focus-visible] + :focus:not([data-focus-visible-added]):not( + [data-focus-visible-disabled] + ) { + outline: none; + box-shadow: none; + } + + ${e} select::-ms-expand { + display: none; + } + + ${aB} + `}),zw=document.createElement("div");document.body.append(zw);const lB=Ar.lazy(()=>Xk(()=>import("./App-1AImvRpr.js").then(e=>e.aJ),__vite__mapDeps([0,1])).then(({default:e})=>({default:e}))),uB={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e7,sticky:11e6,banner:12e6,overlay:13e6,modal:14e6,popover:15e6,skipLink:16e6,toast:17e6,tooltip:18e6},cB=Pz({zIndices:uB,components:{Card:{baseStyle:e=>({container:{backgroundColor:e.colorMode==="dark"?"#171B21":"#F6F8FA"}})}}});gd.createRoot(zw).render(E.jsx(Ar.StrictMode,{children:E.jsxs(BI,{resetCSS:!1,disableGlobalStyle:!0,theme:cB,children:[E.jsx(sB,{scope:".workspace_manager"}),E.jsx(DP,{initialColorMode:"dark"}),E.jsx(iB,{children:E.jsx(S.Suspense,{children:E.jsx(lB,{})})})]})}));const Hf=document.body,dB={attributes:!0,attributeFilter:["class"]},fB=function(e,t){const r=document.documentElement;r.style.colorScheme==="dark"&&r.style.removeProperty("color-scheme");for(const n of e)if(n.type==="attributes"&&n.attributeName==="class")for(const o of Hf.classList)o.includes("chakra")&&Hf.classList.remove(o)},hB=new MutationObserver(fB);hB.observe(Hf,dB);export{vP as $,PB as A,CB as B,TB as C,_B as D,TP as E,lr as F,oi as G,vB as H,Ya as I,Ap as J,yB as K,Ka as L,yw as M,Ew as N,_w as O,ja as P,Tw as Q,Aw as R,$w as S,Pw as T,xb as U,EB as V,os as W,Ar as X,pB as Y,Qh as Z,Xk as _,kB as a,Tp as a0,rB as a1,nB as a2,gB as a3,mn as b,wB as c,i3 as d,Be as e,pt as f,_e as g,Mx as h,SB as i,E as j,Xb as k,_v as l,If as m,Bu as n,Iu as o,mB as p,Ei as q,S as r,Gf as s,uw as t,IP as u,bB as v,Kt as w,yg as x,Bl as y,uO as z}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["workspace_web/App-1AImvRpr.js","workspace_web/assets/App-JXePnJiV.css"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/ui/src/components/DropdownTitle.tsx b/ui/src/components/DropdownTitle.tsx index 6e3e5ca..1783d75 100644 --- a/ui/src/components/DropdownTitle.tsx +++ b/ui/src/components/DropdownTitle.tsx @@ -44,7 +44,6 @@ import CreateVersionDialog from "./CreateVersionDialog"; import HoverMenu from "./HoverMenu"; const ShareDialog = lazy(() => import("../share/ShareDialog")); import { TOPBAR_BUTTON_HEIGHT } from "../const"; -import DownloadSpaceJsonDialog from "../spacejson/DownloadSpaceJsonDialog"; import { downloadJsonFile } from "../utils/downloadJsonFile"; import { SharedTopbarButton } from "../share/SharedTopbarButton"; import { app } from "../utils/comfyapp"; @@ -186,13 +185,6 @@ export default function DropdownTitle() { > Versions History - {/* setRoute("downloadSpaceJson")} - icon={} - iconSpacing={1} - > - Save runnable workflow🧪 - */} setRoute("share")} icon={} @@ -212,7 +204,6 @@ export default function DropdownTitle() { {route == "versionHistory" && ( setRoute("root")} /> )} - {route == "downloadSpaceJson" && } {route === "saveAsModal" && ( diff --git a/ui/src/model-manager/missing-models-drawer/MissingModelItem.tsx b/ui/src/model-manager/missing-models-drawer/MissingModelItem.tsx index ae88f1e..bf10ada 100644 --- a/ui/src/model-manager/missing-models-drawer/MissingModelItem.tsx +++ b/ui/src/model-manager/missing-models-drawer/MissingModelItem.tsx @@ -14,7 +14,7 @@ import { useEffect, useState } from "react"; import { COMFYSPACE_TRACKING_FIELD_NAME } from "../../const"; import type { DepsResult, - ModelFile, + ModelDep, } from "../../spacejson/handleDownloadSpaceJson"; import { indexdb } from "../../db-tables/indexdb"; import { app } from "../../utils/comfyapp"; @@ -32,8 +32,8 @@ export interface MissingModel { interface Props { model: MissingModel; - setSelectedModelDeps: (deps: ModelFile[]) => void; - selectedModelDeps: ModelFile[]; + setSelectedModelDeps: (deps: ModelDep[]) => void; + selectedModelDeps: ModelDep[]; foldersList: Record; setFoldersList: (folders: Record) => void; } @@ -46,7 +46,7 @@ export default function MissingModelItem({ setFoldersList, }: Props) { const [suggestedModel, setSuggestedModel] = useState< - ModelFile | { existingModel: string } + ModelDep | { existingModel: string } >(); const modelDeps: DepsResult["models"] = app.graph.extra?.[COMFYSPACE_TRACKING_FIELD_NAME]?.deps?.models; @@ -76,7 +76,7 @@ export default function MissingModelItem({ const selectedModelNames = selectedModelDeps.map((dep) => dep.filename); function isExistingModel( - model: ModelFile | { existingModel: string }, + model: ModelDep | { existingModel: string }, ): model is { existingModel: string } { return (model as { existingModel: string }).existingModel != null; } diff --git a/ui/src/model-manager/missing-models-drawer/MissingModelsListDrawer.tsx b/ui/src/model-manager/missing-models-drawer/MissingModelsListDrawer.tsx index 73bd8b0..1746f1d 100644 --- a/ui/src/model-manager/missing-models-drawer/MissingModelsListDrawer.tsx +++ b/ui/src/model-manager/missing-models-drawer/MissingModelsListDrawer.tsx @@ -12,7 +12,7 @@ import { import { useCallback, useContext, useEffect, useState } from "react"; import MissingModelItem from "./MissingModelItem"; import { DRAWER_Z_INDEX } from "../../const"; -import type { ModelFile } from "../../spacejson/handleDownloadSpaceJson"; +import type { ModelDep } from "../../spacejson/handleDownloadSpaceJson"; import { getAllFoldersList } from "../../Api"; import { installModelsApi } from "../api/modelsApi"; import { getCivitApiKey } from "../../utils/civitUtils"; @@ -40,7 +40,7 @@ export default function MissingModelsListDrawer({ app.canvasEl.removeEventListener("click", onClose); }; }, []); - const [selectedModelDeps, setSelectedModelDeps] = useState([]); + const [selectedModelDeps, setSelectedModelDeps] = useState([]); const [foldersList, setFoldersList] = useState>({}); const { setRoute } = useContext(WorkspaceContext); const loadData = useCallback(async () => { @@ -77,7 +77,7 @@ export default function MissingModelsListDrawer({ } installModelsApi({ file_hash: model.fileHash ?? undefined, - filename: model.filename, + filename: model.name, save_path: foldersList[model.fileFolder][0], url, force_filename: true, diff --git a/ui/src/model-manager/topbar/ModelManagerTopbar.tsx b/ui/src/model-manager/topbar/ModelManagerTopbar.tsx index 1a80c68..f62e674 100644 --- a/ui/src/model-manager/topbar/ModelManagerTopbar.tsx +++ b/ui/src/model-manager/topbar/ModelManagerTopbar.tsx @@ -13,10 +13,6 @@ import type { ModelsListRespItemFromApi } from "../types"; import InatallModelsModal from "../install-models/InstallModelsModal"; import { TOPBAR_BUTTON_HEIGHT } from "../../const"; -const AddMissingModelsButton = lazy( - () => import("./InstallMissingModelsButton"), -); - export default function ModelManagerTopbar() { const { setRoute, route } = useContext(WorkspaceContext); @@ -75,11 +71,6 @@ export default function ModelManagerTopbar() { > Models -
- - - -
{route === "modelList" && ( setRoute("root")} /> )} diff --git a/ui/src/share/ShareDialog.tsx b/ui/src/share/ShareDialog.tsx index 029e292..615bbc1 100644 --- a/ui/src/share/ShareDialog.tsx +++ b/ui/src/share/ShareDialog.tsx @@ -19,7 +19,7 @@ import { useToast, } from "@chakra-ui/react"; import { WorkflowPrivacy, WorkflowVersion } from "../types/dbTypes"; -import { useEffect, useRef, useState } from "react"; +import { useContext, useEffect, useRef, useState } from "react"; import CustomSelector from "../components/CustomSelector"; import { IconCopy, IconExternalLink } from "@tabler/icons-react"; import { @@ -37,10 +37,17 @@ import { privacyOptions, } from "./shareUtils"; -import ShareDialogWorkflowVersionRadio from "./ShareDialogWorkflowVersionRadio"; import ResourceDepsForm from "../spacejson/ResourceDepsForm"; import { app } from "../utils/comfyapp"; import { useStateRef } from "../customHooks/useStateRef"; +import { nanoid } from "nanoid"; +import { WorkspaceContext } from "../WorkspaceContext"; +import { + DepsResult, + WorkspaceInfoDeps, +} from "../spacejson/handleDownloadSpaceJson"; +import { fetchApi } from "../Api"; +import { COMFYSPACE_TRACKING_FIELD_NAME } from "../const"; interface Props { onClose: () => void; @@ -50,7 +57,9 @@ export default function ShareDialog({ onClose }: Props) { const [versionName, setVersionName, versionNameRef] = useStateRef( "v" + getCurDateString(), ); - const [localVersions, setLocalVersions] = useState([]); + const { saveCurWorkflow, setRoute } = useContext(WorkspaceContext); + const [deps, setDeps] = useState(); + const [uploadingImage, setUploadingImage] = useState(false); const [loading, setLoading] = useState(false); const cloudHost = userSettingsTable?.settings?.cloudHost; const [privacy, setPrivacy, privacyRef] = @@ -61,7 +70,6 @@ export default function ShareDialog({ onClose }: Props) { const cloudHostRef = useRef(""); const workflow = workflowsTable?.curWorkflow; const toast = useToast(); - const formRef = useRef(null); const [enableDeps, setEnableDeps] = useState(true); const handleShareWorkflowSuccess = async (event: MessageEvent) => { const detail = event.data; @@ -73,7 +81,6 @@ export default function ShareDialog({ onClose }: Props) { } const localID = detail.localWorkflowID; - const localVerID = detail.localVersionID; const cloudVersionID = detail.version.id; const cloudID = detail.version.workflowID; @@ -81,15 +88,9 @@ export default function ShareDialog({ onClose }: Props) { localID && (await workflowsTable?.updateMetaInfo(localID, { cloudID: cloudID, - cloudOrigin: event.origin, privacy: privacyRef.current, })); - localVerID && - cloudVersionID && - (await workflowVersionsTable?.update(localVerID, { - cloudID: cloudVersionID, - cloudOrigin: event.origin, - })); + loadData(); window.open( cloudHostRef.current + "/workflow/" + cloudID + "/" + cloudVersionID, @@ -100,18 +101,8 @@ export default function ShareDialog({ onClose }: Props) { useEffect(() => { loadData(); window.addEventListener("message", handleShareWorkflowSuccess); - const shareDepsToCloud = (event: any) => { - if (event.detail) { - pushToCloud(event.detail ? JSON.stringify(event.detail) : undefined); - } - }; - window.addEventListener("workspace_info_deps_updated", shareDepsToCloud); return () => { window.removeEventListener("message", handleShareWorkflowSuccess); - window.removeEventListener( - "workspace_info_deps_updated", - shareDepsToCloud, - ); }; }, []); @@ -128,9 +119,6 @@ export default function ShareDialog({ onClose }: Props) { setPrivacy(privacy); }); } - workflowVersionsTable?.listByWorkflowID(workflow!.id).then((vers) => { - setLocalVersions(vers); - }); }; const copyTextToClipboard = (text: string) => { navigator.clipboard @@ -155,30 +143,14 @@ export default function ShareDialog({ onClose }: Props) { ? ((await userSettingsTable?.getSetting("cloudHost")) as string) : "http://localhost:3000"; let nodeDefs: Object; - let version: WorkflowVersion | undefined; - try { - nodeDefs = getNodeDefs(); - if (selectedVersion === "new_version") { - version = await workflowVersionsTable?.add({ - workflowID: workflow!.id, - name: versionNameRef.current, - createTime: Date.now(), - json: jsonToShare ?? JSON.stringify(app.graph.serialize()), - }); - } else { - version = await workflowVersionsTable?.get(selectedVersion); - } - if (!version) { - alert(`Failed to find version: ${selectedVersion}, please try again.`); - setLoading(false); - return; - } - } catch (e) { - console.error(e); - setLoading(false); - alert("Failed to share workflow, please try again."); - return; - } + nodeDefs = getNodeDefs(); + const version: WorkflowVersion = { + id: nanoid(), + workflowID: workflow!.id, + name: versionNameRef.current, + createTime: Date.now(), + json: jsonToShare ?? JSON.stringify(app.graph.serialize()), + }; const protocol = window.location.protocol; const baseHost = window.location.host; const baseUrl = `${protocol}//${baseHost}`; @@ -207,12 +179,47 @@ export default function ShareDialog({ onClose }: Props) { }; window.addEventListener("message", handleChildReady); }; + const onShare = async () => { - if (enableDeps) { - formRef.current?.requestSubmit(); - } else { - pushToCloud(); + // upload images + setUploadingImage(true); + const imageDepsToUpload = Object.values(deps?.images ?? {}) + .filter((i) => !i.url) + .map((i) => i.filename); + const imageDeps = deps?.images ?? {}; + + if (imageDepsToUpload.length) { + const uploadResp = await fetchApi("/workspace/upload_image", { + method: "POST", + body: JSON.stringify({ + images: imageDepsToUpload, + }), + }); + const json = (await uploadResp.json()) as Record; + Object.keys(json).forEach((key) => { + if (imageDeps?.[key]) { + imageDeps[key].url = json[key]; + } + }); } + setUploadingImage(false); + + const graph = app.graph.serialize(); + (graph.extra ||= {})[COMFYSPACE_TRACKING_FIELD_NAME] ||= {}; + graph.extra[COMFYSPACE_TRACKING_FIELD_NAME].deps = { + models: deps?.models ?? {}, + images: imageDeps ?? {}, + nodeRepos: deps?.nodeRepos ?? [], + } as WorkspaceInfoDeps; + await app + .graphToPrompt(app.graph) + .then((data: { output: any; workflow: any }) => { + graph.extra[COMFYSPACE_TRACKING_FIELD_NAME].apiPrompt = data.output; + }); + + await saveCurWorkflow(); + + pushToCloud(JSON.stringify(graph)); }; const cloudWorkflowID = workflowsTable?.curWorkflow?.cloudID; @@ -311,17 +318,6 @@ export default function ShareDialog({ onClose }: Props) { Version Name - - {/* {localVersions.slice(0, 4).map((ver) => { - return ( - - ); - })} */} @@ -330,17 +326,18 @@ export default function ShareDialog({ onClose }: Props) { onChange={() => setEnableDeps(!enableDeps)} fontWeight={"600"} > - Share Resource Links + Share input images - {enableDeps && ( - <> - - You can disable reource sharing if you don't want to resolve - submit errors - - - - )} + + + If enabled your input images will be uploaded and shared to{" "} + {cloudHost} + + diff --git a/ui/src/spacejson/DownloadSpaceJsonDialog.tsx b/ui/src/spacejson/DownloadSpaceJsonDialog.tsx deleted file mode 100644 index 122a35d..0000000 --- a/ui/src/spacejson/DownloadSpaceJsonDialog.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { useContext, useRef } from "react"; -import { WorkspaceContext } from "../WorkspaceContext"; -import { - Badge, - Button, - HStack, - Heading, - Modal, - ModalBody, - ModalContent, - Text, - Tooltip, -} from "@chakra-ui/react"; -import { IconInfoCircle } from "@tabler/icons-react"; -import ResourceDepsForm from "./ResourceDepsForm"; - -export default function DownloadSpaceJsonDialog() { - const { setRoute } = useContext(WorkspaceContext); - const formRef = useRef(null); - return ( - setRoute("root")} size={"xl"}> - - - - Add Resouce Dependencies - - - - - - - Export runnable workflow - - - - - - - - - ); -} diff --git a/ui/src/spacejson/ResourceDepsForm.tsx b/ui/src/spacejson/ResourceDepsForm.tsx index 957de4c..bf61522 100644 --- a/ui/src/spacejson/ResourceDepsForm.tsx +++ b/ui/src/spacejson/ResourceDepsForm.tsx @@ -1,335 +1,63 @@ -import { - forwardRef, - useCallback, - useContext, - useEffect, - useState, -} from "react"; -import { WorkspaceContext } from "../WorkspaceContext"; -import { - Button, - Flex, - HStack, - Heading, - IconButton, - Image, - Input, - Spinner, - Stack, - Tag, - Text, - Tooltip, -} from "@chakra-ui/react"; +import { useCallback, useEffect } from "react"; + +import { HStack, Heading, Image, Spinner, Stack } from "@chakra-ui/react"; import { DepsResult, - ModelFile, - WorkspaceInfoDeps, extractAndFetchFileNames, } from "./handleDownloadSpaceJson"; -import { IconExternalLink, IconPencil, IconRefresh } from "@tabler/icons-react"; -import { getHgModelInfoUrlFromDownloadUrl } from "../utils/civitUtils"; -import { fetchApi, getAllModelsList } from "../Api"; -import { COMFYSPACE_TRACKING_FIELD_NAME } from "../const"; -import { indexdb } from "../db-tables/indexdb"; + import { app } from "../utils/comfyapp"; -export default forwardRef( - function ResourceDepsForm(_props, ref) { - const { saveCurWorkflow, setRoute } = useContext(WorkspaceContext); - const [deps, setDeps] = useState(); - const [errors, setErrors] = useState>({}); - const [uploadingImage, setUploadingImage] = useState(false); - - const init = useCallback(async () => { - const graph = app.graph.serialize(); - extractAndFetchFileNames(graph.nodes ?? []).then((depsRes) => { - setDeps(depsRes); - }); - }, []); - - const onRefreshModelsList = useCallback(async () => { - setDeps(undefined); - await getAllModelsList(); - window.addEventListener("model_list_updated", () => { - init(); - window.removeEventListener("model_list_updated", () => {}); - }); - }, []); - - useEffect(() => { - init(); - }, []); - - const validateURL = (url: string) => { - const pattern = new RegExp( - "^(https?:\\/\\/)?" + - "((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + - "((\\d{1,3}\\.){3}\\d{1,3}))" + - "(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + - "(\\?[;&a-z\\d%_.~+=-]*)?" + - "(\\#[-a-z\\d_]*)?$", - "i", - ); - return !!pattern.test(url); - }; - - const handleSubmit = async (event: any) => { - event.preventDefault(); - event.stopPropagation(); - - const formData = new FormData(event.target); - // validate model deps and save model urls to db - const saveModelUrlDBPromises: Promise[] = - Object.values(deps?.models ?? {}).map(async (model) => { - const inputDownloadUrl = formData.get(model.filename)?.toString(); - if (inputDownloadUrl?.length) { - // because the models table is storing filename without extension as id, which should be migrated - const baseName = getBaseFileName(model.filename); - await indexdb.models.update(baseName + "@" + model.fileFolder, { - downloadUrl: inputDownloadUrl, - }); - } - const infoUrl = model.infoUrl?.length - ? model.infoUrl - : inputDownloadUrl - ? getHgModelInfoUrlFromDownloadUrl(inputDownloadUrl) - : null; - return { - filename: model.filename, - nodeType: model.nodeType, - fileHash: model.fileHash, - fileFolder: model.fileFolder, - downloadUrl: inputDownloadUrl ?? model.downloadUrl ?? null, - infoUrl: infoUrl ?? null, - inputName: model.inputName, - }; - }) ?? []; - const modelDepsArr = await Promise.all(saveModelUrlDBPromises); - if (!validateModelDeps(modelDepsArr)) { - return; - } - setErrors({}); - - // upload images - setUploadingImage(true); - const imageDepsToUpload = Object.values(deps?.images ?? {}) - .filter((i) => !i.url) - .map((i) => i.filename); - const imageDeps = deps?.images ?? {}; - - if (imageDepsToUpload.length) { - const uploadResp = await fetchApi("/workspace/upload_image", { - method: "POST", - body: JSON.stringify({ - images: imageDepsToUpload, - }), - }); - const json = (await uploadResp.json()) as Record; - Object.keys(json).forEach((key) => { - if (imageDeps?.[key]) { - imageDeps[key].url = json[key]; - } - }); - } - setUploadingImage(false); - - // save deps to graph - const modelDeps: WorkspaceInfoDeps["models"] = {}; - modelDepsArr.forEach((model) => { - modelDeps[model.filename] = model; - }); - const graph = app.graph.serialize(); - (graph.extra ||= {})[COMFYSPACE_TRACKING_FIELD_NAME] ||= {}; - graph.extra[COMFYSPACE_TRACKING_FIELD_NAME].deps = { - models: modelDeps, - images: imageDeps ?? {}, - nodeRepos: deps?.nodeRepos ?? [], - } as WorkspaceInfoDeps; - await app - .graphToPrompt(app.graph) - .then((data: { output: any; workflow: any }) => { - graph.extra[COMFYSPACE_TRACKING_FIELD_NAME].apiPrompt = data.output; - }); - - await saveCurWorkflow(); - window.dispatchEvent( - new CustomEvent("workspace_info_deps_updated", { - detail: graph, - }), - ); - console.log("graph", graph); - }; - - const validateModelDeps = useCallback((modelDeps: ModelFile[]) => { - let isValid = true; - modelDeps.forEach((model) => { - const key = model.filename; - if (!model.downloadUrl) { - setErrors((prev) => ({ - ...prev, - [key]: "Invalid URL", - })); - isValid = false; - return; - } - if (!validateURL(model.downloadUrl)) { - setErrors((prev) => ({ ...prev, [key]: "Invalid URL" })); - isValid = false; - return; - } - if (!model.fileFolder) { - setErrors((prev) => ({ - ...prev, - [key]: "Model file not found, please re-scan models folder", - })); - isValid = false; - return; - } - }); - return isValid; - }, []); - - const imageDepsArr = Object.values(deps?.images ?? {}); - const modelDepsArr = Object.values(deps?.models ?? []); - if (!deps) { - return ; - } - - return ( -
- - - Models ({modelDepsArr.length}) - {modelDepsArr.map((modelFile, index) => ( - - ))} - - - {imageDepsArr.length > 0 && ( - - - Images ({imageDepsArr.length}) - {/* Will be uploaded as url */} -

Will be uploaded as url

-
- {uploadingImage && ( - - Uploading - - )} - {imageDepsArr.map((image) => ( - -

{image.filename}

- -
- ))} -
- )} -
-
- ); - }, -); - -function getBaseFileName(filename: string) { - const parts = filename.split("."); - if (parts.length > 1) { - parts.pop(); - return parts.join("."); - } else { - return filename; - } -} - -function ModelDepsItem({ - modelFile, - errors, - onClickRefetchModelList, +export default function ResourceDepsForm({ + deps, + setDeps, + uploadingImage, }: { - modelFile: DepsResult["models"][0]; - errors: Record; - onClickRefetchModelList: () => void; + deps: DepsResult | null; + setDeps: (deps: DepsResult) => void; + uploadingImage: boolean; }) { - const inputKey = modelFile.filename; - const [isEditing, setIsEditing] = useState(!modelFile.downloadUrl); + const init = useCallback(async () => { + const graph = app.graph.serialize(); + extractAndFetchFileNames(graph.nodes ?? []).then((depsRes) => { + setDeps(depsRes); + }); + }, []); - if (!modelFile.fileFolder) { - return ( - - -

{modelFile.filename}

- - Model file not found - -
- -
- ); + useEffect(() => { + init(); + }, []); + + const imageDepsArr = Object.values(deps?.images ?? {}); + if (!deps) { + return ; } + return ( - - - - {modelFile.fileFolder} - - - {modelFile.downloadUrl ? ( + + {imageDepsArr.length > 0 && ( + - - {modelFile.filename} - - - } - size={"xs"} - onClick={() => setIsEditing(!isEditing)} - /> + Images ({imageDepsArr.length}) + {/* Will be uploaded as url */} +

Will be uploaded as url

- ) : ( - + {uploadingImage && ( - {modelFile.filename} ❓ + Uploading - - )} -
- - - - - - - {errors[inputKey]} + )} + {imageDepsArr.map((image) => ( + +

{image.filename}

+ +
+ ))} +
+ )} ); } diff --git a/ui/src/spacejson/handleDownloadSpaceJson.ts b/ui/src/spacejson/handleDownloadSpaceJson.ts index 7b28a9d..2350974 100644 --- a/ui/src/spacejson/handleDownloadSpaceJson.ts +++ b/ui/src/spacejson/handleDownloadSpaceJson.ts @@ -13,13 +13,18 @@ type LiteNode = { widgets_values?: Array; }; -export type ModelFile = { - filename: string; - fileFolder: string | null; - fileHash: string | null; - downloadUrl: string | null; +export type ModelDep = { + name: string; + folder: string | null; + hash: string | null; + url: string | null; + // TODO: will be deperecated + filename?: string; + fileFolder?: string | null; + fileHash?: string | null; + downloadUrl?: string | null; // optional info - infoUrl: string | null; + infoUrl?: string | null; nodeType?: string; inputName?: string; }; @@ -40,12 +45,12 @@ export type DepsResult = { nodeRepos: NodeRepo[]; }; -export type DepsResultModel = ModelFile & { +export type DepsResultModel = ModelDep & { length: number; }; export type WorkspaceInfoDeps = { - models: Record; + models: Record; images: DepsResult["images"]; nodeRepos: DepsResult["nodeRepos"]; }; @@ -57,20 +62,18 @@ async function fetchModelData( ): Promise { const res = (await indexdb.models.where("fileName").equals(filename).toArray()) ?? []; + console.log("fetch modeldata", res); const first = res.at(0); const modelFile: DepsResultModel = { - filename, + name: filename, nodeType, - fileHash: first?.fileHash ?? null, - fileFolder: first?.fileFolder ?? null, - downloadUrl: first?.civitModelVersionID + hash: first?.fileHash ?? null, + folder: first?.fileFolder ?? null, + url: first?.civitModelVersionID ? getCivitModelDownloadUrl(first.civitModelVersionID) : first?.downloadUrl ?? null, inputName: inputName, length: res.length, - infoUrl: first?.civitModelID - ? getCivitModelPageUrl(first.civitModelID, first.civitModelVersionID) - : getHgModelInfoUrlFromDownloadUrl(first?.downloadUrl ?? "") ?? null, }; return modelFile; } @@ -94,13 +97,9 @@ export async function extractAndFetchFileNames( if (typeof value != "string") return; // Check if it's a model file if (modelFileExtensions.some((ext) => value.endsWith(ext))) { - if (curDeps?.models?.[value]) { - modelPromises.push(Promise.resolve(curDeps.models[value])); - } else { - modelPromises.push( - fetchModelData(value, node.class_type, inputName), - ); - } + modelPromises.push( + fetchModelData(value, node.class_type, inputName), + ); } // Check if it's an image file if (imageFileExtensions.some((ext) => value.endsWith(ext))) { @@ -134,10 +133,7 @@ export async function extractAndFetchFileNames( const models = await Promise.all(modelPromises); const modelsMap: Record = {}; models.forEach((model) => { - // if (model.nodeType) { - // model.gitRepo = reposMapping[model.nodeType]; - // } - modelsMap[model.filename] = model; + modelsMap[model.name] = model; }); const nodeRepos: Record = {}; Object.values(reposMapping).forEach((repo) => { From 705633b9d9c3b1a59178dddb73b01efaf926fc83 Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Wed, 5 Jun 2024 19:37:47 +0800 Subject: [PATCH 08/13] fix share dialog, cleaner --- dist/workspace_web/App-1AImvRpr.js | 27 - .../AppIsDirtyEventListener-xmtnIvLQ.js | 1 - dist/workspace_web/GalleryModal-XNUSEfqI.js | 1 - dist/workspace_web/IconCopy-DxyTNBlz.js | 1 - dist/workspace_web/IconSearch-qxAzDzhT.js | 1 - dist/workspace_web/MediaPreview-muJLkZRm.js | 1 - .../ModelManagerTopbar-4hMR9SRa.js | 1 - .../RecentFilesDrawer-g7Y8NeOQ.js | 5 - dist/workspace_web/ShareDialog-t7mRPVSb.js | 1 - .../workspace_web/SpotlightSearch-crj3ER75.js | 1 - dist/workspace_web/assets/App-JXePnJiV.css | 1 - .../assets/ModelManagerTopbar--iv3sdjQ.css | 1 - dist/workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js | 1 - dist/workspace_web/chunk-7D6N5TE5-fihyubSX.js | 1 - dist/workspace_web/chunk-JARCRF6W-UyOcndjS.js | 1 - dist/workspace_web/chunk-NTCQBYKE-HH_ifqNx.js | 1 - dist/workspace_web/chunk-VTV6N5LE-7BSZDdqw.js | 1 - dist/workspace_web/civitUtils-uJNBxoFV.js | 1 - dist/workspace_web/input.js | 688 ------------------ dist/workspace_web/useDebounceFn-ld478fd0.js | 1 - ui/src/share/ShareDialog.tsx | 105 ++- ui/src/spacejson/ResourceDepsForm.tsx | 11 +- 22 files changed, 52 insertions(+), 801 deletions(-) delete mode 100644 dist/workspace_web/App-1AImvRpr.js delete mode 100644 dist/workspace_web/AppIsDirtyEventListener-xmtnIvLQ.js delete mode 100644 dist/workspace_web/GalleryModal-XNUSEfqI.js delete mode 100644 dist/workspace_web/IconCopy-DxyTNBlz.js delete mode 100644 dist/workspace_web/IconSearch-qxAzDzhT.js delete mode 100644 dist/workspace_web/MediaPreview-muJLkZRm.js delete mode 100644 dist/workspace_web/ModelManagerTopbar-4hMR9SRa.js delete mode 100644 dist/workspace_web/RecentFilesDrawer-g7Y8NeOQ.js delete mode 100644 dist/workspace_web/ShareDialog-t7mRPVSb.js delete mode 100644 dist/workspace_web/SpotlightSearch-crj3ER75.js delete mode 100644 dist/workspace_web/assets/App-JXePnJiV.css delete mode 100644 dist/workspace_web/assets/ModelManagerTopbar--iv3sdjQ.css delete mode 100644 dist/workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js delete mode 100644 dist/workspace_web/chunk-7D6N5TE5-fihyubSX.js delete mode 100644 dist/workspace_web/chunk-JARCRF6W-UyOcndjS.js delete mode 100644 dist/workspace_web/chunk-NTCQBYKE-HH_ifqNx.js delete mode 100644 dist/workspace_web/chunk-VTV6N5LE-7BSZDdqw.js delete mode 100644 dist/workspace_web/civitUtils-uJNBxoFV.js delete mode 100644 dist/workspace_web/input.js delete mode 100644 dist/workspace_web/useDebounceFn-ld478fd0.js diff --git a/dist/workspace_web/App-1AImvRpr.js b/dist/workspace_web/App-1AImvRpr.js deleted file mode 100644 index aaebc13..0000000 --- a/dist/workspace_web/App-1AImvRpr.js +++ /dev/null @@ -1,27 +0,0 @@ -var fl=Object.defineProperty;var hl=(t,e,n)=>e in t?fl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Se=(t,e,n)=>(hl(t,typeof e!="symbol"?e+"":e,n),n);import{u as pl,a as ml,r as j,c as yl,b as et,m as Te,d as Bt,f as fe,e as ke,j as O,B as vl,g as de,h as Le,i as gl,o as tt,k as jt,l as ot,I as Ur,n as Kr,p as no,q as Oe,s as xa,t as wl,v as bl,w as _l,x as $r,y as kl,z as xl,A as El,C as Cl,D as Sl,E as ss,F as Ea,G as as,H as Ca,J as Ol,K as Il,L as Dl,P as Sa,_ as At,M as is,N as ls,O as cs,Q as us,R as ds,S as fs,T as hs,U as Oa,V as Ia,W as Xn,X as Da}from"./input.js";function Pl(t){return t!=null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function Pa(t){var e;return Pl(t)&&(e=t.ownerDocument)!=null?e:document}function jl(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Al=jl();function Nl(t){const e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function ja(t){const{theme:e}=pl(),n=ml();return j.useMemo(()=>yl(e.direction,{...n,...t}),[t,e.direction,n])}var Fl=Object.defineProperty,Rl=(t,e,n)=>e in t?Fl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,De=(t,e,n)=>(Rl(t,typeof e!="symbol"?e+"":e,n),n);function qs(t){return t.sort((e,n)=>{const r=e.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var Tl=t=>typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE;function Hs(t,e,n){let r=t+1;return n&&r>=e&&(r=0),r}function Vs(t,e,n){let r=t-1;return n&&r<0&&(r=e),r}var wo=typeof window<"u"?j.useLayoutEffect:j.useEffect,kr=t=>t,Bl=class{constructor(){De(this,"descendants",new Map),De(this,"register",t=>{if(t!=null)return Tl(t)?this.registerNode(t):e=>{this.registerNode(e,t)}}),De(this,"unregister",t=>{this.descendants.delete(t);const e=qs(Array.from(this.descendants.keys()));this.assignIndex(e)}),De(this,"destroy",()=>{this.descendants.clear()}),De(this,"assignIndex",t=>{this.descendants.forEach(e=>{const n=t.indexOf(e.node);e.index=n,e.node.dataset.index=e.index.toString()})}),De(this,"count",()=>this.descendants.size),De(this,"enabledCount",()=>this.enabledValues().length),De(this,"values",()=>Array.from(this.descendants.values()).sort((e,n)=>e.index-n.index)),De(this,"enabledValues",()=>this.values().filter(t=>!t.disabled)),De(this,"item",t=>{if(this.count()!==0)return this.values()[t]}),De(this,"enabledItem",t=>{if(this.enabledCount()!==0)return this.enabledValues()[t]}),De(this,"first",()=>this.item(0)),De(this,"firstEnabled",()=>this.enabledItem(0)),De(this,"last",()=>this.item(this.descendants.size-1)),De(this,"lastEnabled",()=>{const t=this.enabledValues().length-1;return this.enabledItem(t)}),De(this,"indexOf",t=>{var e,n;return t&&(n=(e=this.descendants.get(t))==null?void 0:e.index)!=null?n:-1}),De(this,"enabledIndexOf",t=>t==null?-1:this.enabledValues().findIndex(e=>e.node.isSameNode(t))),De(this,"next",(t,e=!0)=>{const n=Hs(t,this.count(),e);return this.item(n)}),De(this,"nextEnabled",(t,e=!0)=>{const n=this.item(t);if(!n)return;const r=this.enabledIndexOf(n.node),o=Hs(r,this.enabledCount(),e);return this.enabledItem(o)}),De(this,"prev",(t,e=!0)=>{const n=Vs(t,this.count()-1,e);return this.item(n)}),De(this,"prevEnabled",(t,e=!0)=>{const n=this.item(t);if(!n)return;const r=this.enabledIndexOf(n.node),o=Vs(r,this.enabledCount()-1,e);return this.enabledItem(o)}),De(this,"registerNode",(t,e)=>{if(!t||this.descendants.has(t))return;const n=Array.from(this.descendants.keys()).concat(t),r=qs(n);e!=null&&e.disabled&&(e.disabled=!!e.disabled);const o={node:t,index:-1,...e};this.descendants.set(t,o),this.assignIndex(r)})}};function Ml(){const t=j.useRef(new Bl);return wo(()=>()=>t.current.destroy()),t.current}var[zl,Aa]=et({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function Ll(t){const e=Aa(),[n,r]=j.useState(-1),o=j.useRef(null);wo(()=>()=>{o.current&&e.unregister(o.current)},[]),wo(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=kr(t?e.register(t):e.register);return{descendants:e,index:n,enabledIndex:e.enabledIndexOf(o.current),register:Te(s,o)}}function Na(){return[kr(zl),()=>kr(Aa()),()=>Ml(),o=>Ll(o)]}function Fa(t){const{value:e,defaultValue:n,onChange:r,shouldUpdate:o=(p,h)=>p!==h}=t,s=Bt(r),i=Bt(o),[a,l]=j.useState(n),u=e!==void 0,c=u?e:a,d=Bt(p=>{const b=typeof p=="function"?p(c):p;i(c,b)&&(u||l(b),s(b))},[u,s,c,i]);return[c,d]}function ps(t){return j.Children.toArray(t).filter(e=>j.isValidElement(e))}var Wl={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},Ul={horizontal:t=>({"& > *:not(style) ~ *:not(style)":{marginStart:t}}),vertical:t=>({"& > *:not(style) ~ *:not(style)":{marginTop:t}})},Ra=fe(function(e,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:a="0.5rem",isAttached:l,isDisabled:u,orientation:c="horizontal",...d}=e,p=ke("chakra-button__group",i),h=j.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:u}),[r,o,s,u]);let b={display:"inline-flex",...l?Wl[c]:Ul[c](a)};const f=c==="vertical";return O.jsx(vl,{value:h,children:O.jsx(de.div,{ref:n,role:"group",__css:b,className:p,"data-attached":l?"":void 0,"data-orientation":c,flexDir:f?"column":void 0,...d})})});Ra.displayName="ButtonGroup";var jn=fe((t,e)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=t,a=n||r,l=j.isValidElement(a)?j.cloneElement(a,{"aria-hidden":!0,focusable:!1}):null;return O.jsx(Le,{padding:"0",borderRadius:o?"full":void 0,ref:e,"aria-label":s,...i,children:l})});jn.displayName="IconButton";var[Kl,Ta]=gl("Card"),$l=fe(function(e,n){const{className:r,...o}=e,s=Ta();return O.jsx(de.div,{ref:n,className:ke("chakra-card__body",r),__css:s.body,...o})}),ql=fe(function(e,n){const{className:r,...o}=e,s=Ta();return O.jsx(de.div,{ref:n,className:ke("chakra-card__header",r),__css:s.header,...o})}),Hl=fe(function(e,n){const{className:r,children:o,direction:s="column",justify:i,align:a,...l}=tt(e),u=jt("Card",e);return O.jsx(de.div,{ref:n,className:ke("chakra-card",r),__css:{display:"flex",flexDirection:s,justifyContent:i,alignItems:a,position:"relative",minWidth:0,wordWrap:"break-word",...u.container},...l,children:O.jsx(Kl,{value:u,children:o})})}),[Vl,Ba]=et({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Zl,hn]=et({strict:!1,name:"FormControlContext"});function Gl(t){const{id:e,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=t,a=j.useId(),l=e||`field-${a}`,u=`${l}-label`,c=`${l}-feedback`,d=`${l}-helptext`,[p,h]=j.useState(!1),[b,f]=j.useState(!1),[y,m]=j.useState(!1),w=j.useCallback((E={},N=null)=>({id:d,...E,ref:Te(N,D=>{D&&f(!0)})}),[d]),_=j.useCallback((E={},N=null)=>({...E,ref:N,"data-focus":ot(y),"data-disabled":ot(o),"data-invalid":ot(r),"data-readonly":ot(s),id:E.id!==void 0?E.id:u,htmlFor:E.htmlFor!==void 0?E.htmlFor:l}),[l,o,y,r,s,u]),k=j.useCallback((E={},N=null)=>({id:c,...E,ref:Te(N,D=>{D&&h(!0)}),"aria-live":"polite"}),[c]),x=j.useCallback((E={},N=null)=>({...E,...i,ref:N,role:"group","data-focus":ot(y),"data-disabled":ot(o),"data-invalid":ot(r),"data-readonly":ot(s)}),[i,o,y,r,s]),I=j.useCallback((E={},N=null)=>({...E,ref:N,role:"presentation","aria-hidden":!0,children:E.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!y,onFocus:()=>m(!0),onBlur:()=>m(!1),hasFeedbackText:p,setHasFeedbackText:h,hasHelpText:b,setHasHelpText:f,id:l,labelId:u,feedbackId:c,helpTextId:d,htmlProps:i,getHelpTextProps:w,getErrorMessageProps:k,getRootProps:x,getLabelProps:_,getRequiredIndicatorProps:I}}var qr=fe(function(e,n){const r=jt("Form",e),o=tt(e),{getRootProps:s,htmlProps:i,...a}=Gl(o),l=ke("chakra-form-control",e.className);return O.jsx(Zl,{value:a,children:O.jsx(Vl,{value:r,children:O.jsx(de.div,{...s({},n),className:l,__css:r.container})})})});qr.displayName="FormControl";var Yl=fe(function(e,n){const r=hn(),o=Ba(),s=ke("chakra-form__helper-text",e.className);return O.jsx(de.div,{...r==null?void 0:r.getHelpTextProps(e,n),__css:o.helperText,className:s})});Yl.displayName="FormHelperText";var[Jl,Xl]=et({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Hr=fe((t,e)=>{const n=jt("FormError",t),r=tt(t),o=hn();return o!=null&&o.isInvalid?O.jsx(Jl,{value:n,children:O.jsx(de.div,{...o==null?void 0:o.getErrorMessageProps(r,e),className:ke("chakra-form__error-message",t.className),__css:{display:"flex",alignItems:"center",...n.text}})}):null});Hr.displayName="FormErrorMessage";var Ql=fe((t,e)=>{const n=Xl(),r=hn();if(!(r!=null&&r.isInvalid))return null;const o=ke("chakra-form__error-icon",t.className);return O.jsx(Ur,{ref:e,"aria-hidden":!0,...t,__css:n.icon,className:o,children:O.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})});Ql.displayName="FormErrorIcon";var Vr=fe(function(e,n){var r;const o=Kr("FormLabel",e),s=tt(e),{className:i,children:a,requiredIndicator:l=O.jsx(Ma,{}),optionalIndicator:u=null,...c}=s,d=hn(),p=(r=d==null?void 0:d.getLabelProps(c,n))!=null?r:{ref:n,...c};return O.jsxs(de.label,{...p,className:ke("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[a,d!=null&&d.isRequired?l:u]})});Vr.displayName="FormLabel";var Ma=fe(function(e,n){const r=hn(),o=Ba();if(!(r!=null&&r.isRequired))return null;const s=ke("chakra-form__required-indicator",e.className);return O.jsx(de.span,{...r==null?void 0:r.getRequiredIndicatorProps(e,n),__css:o.requiredIndicator,className:s})});Ma.displayName="RequiredIndicator";function ec(t){const{isDisabled:e,isInvalid:n,isReadOnly:r,isRequired:o,...s}=tc(t);return{...s,disabled:e,readOnly:r,required:o,"aria-invalid":no(n),"aria-required":no(o),"aria-readonly":no(r)}}function tc(t){var e,n,r;const o=hn(),{id:s,disabled:i,readOnly:a,required:l,isRequired:u,isInvalid:c,isReadOnly:d,isDisabled:p,onFocus:h,onBlur:b,...f}=t,y=t["aria-describedby"]?[t["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&y.push(o.feedbackId),o!=null&&o.hasHelpText&&y.push(o.helpTextId),{...f,"aria-describedby":y.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(e=i??p)!=null?e:o==null?void 0:o.isDisabled,isReadOnly:(n=a??d)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=l??u)!=null?r:o==null?void 0:o.isRequired,isInvalid:c??(o==null?void 0:o.isInvalid),onFocus:Oe(o==null?void 0:o.onFocus,h),onBlur:Oe(o==null?void 0:o.onBlur,b)}}function nn(t,e,n,r){const o=Bt(n);return j.useEffect(()=>{const s=typeof t=="function"?t():t??document;if(!(!n||!s))return s.addEventListener(e,o,r),()=>{s.removeEventListener(e,o,r)}},[e,t,r,o,n]),()=>{const s=typeof t=="function"?t():t??document;s==null||s.removeEventListener(e,o,r)}}function nc(t){return"current"in t}var za=()=>typeof window<"u";function rc(){var t;const e=navigator.userAgentData;return(t=e==null?void 0:e.platform)!=null?t:navigator.platform}var oc=t=>za()&&t.test(navigator.vendor),sc=t=>za()&&t.test(rc()),ac=()=>sc(/mac|iphone|ipad|ipod/i),ic=()=>ac()&&oc(/apple/i);function lc(t){const{ref:e,elements:n,enabled:r}=t,o=()=>{var s,i;return(i=(s=e.current)==null?void 0:s.ownerDocument)!=null?i:document};nn(o,"pointerdown",s=>{if(!ic()||!r)return;const i=s.target,l=(n??[e]).some(u=>{const c=nc(u)?u.current:u;return(c==null?void 0:c.contains(i))||c===i});o().activeElement!==i&&l&&(s.preventDefault(),i.focus())})}var La={exports:{}},cc="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",uc=cc,dc=uc;function Wa(){}function Ua(){}Ua.resetWarningCache=Wa;var fc=function(){function t(r,o,s,i,a,l){if(l!==dc){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Ua,resetWarningCache:Wa};return n.PropTypes=n,n};La.exports=fc();var hc=La.exports;const Ft=xa(hc);function pc(t){const e=t.ownerDocument.defaultView||window,{overflow:n,overflowX:r,overflowY:o}=e.getComputedStyle(t);return/auto|scroll|overlay|hidden/.test(n+o+r)}function mc(t){return t.localName==="html"?t:t.assignedSlot||t.parentElement||t.ownerDocument.documentElement}function Ka(t){return["html","body","#document"].includes(t.localName)?t.ownerDocument.body:wl(t)&&pc(t)?t:Ka(mc(t))}var yc=Al?j.useLayoutEffect:j.useEffect;function bo(t,e=[]){const n=j.useRef(t);return yc(()=>{n.current=t}),j.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},e)}function vc(t){const{ref:e,handler:n,enabled:r=!0}=t,o=bo(n),i=j.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;j.useEffect(()=>{if(!r)return;const a=d=>{ro(d,e)&&(i.isPointerDown=!0)},l=d=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&ro(d,e)&&(i.isPointerDown=!1,o(d))},u=d=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&ro(d,e)&&(i.isPointerDown=!1,o(d))},c=Pa(e.current);return c.addEventListener("mousedown",a,!0),c.addEventListener("mouseup",l,!0),c.addEventListener("touchstart",a,!0),c.addEventListener("touchend",u,!0),()=>{c.removeEventListener("mousedown",a,!0),c.removeEventListener("mouseup",l,!0),c.removeEventListener("touchstart",a,!0),c.removeEventListener("touchend",u,!0)}},[n,e,o,i,r])}function ro(t,e){var n;const r=t.target;return r&&!Pa(r).contains(r)?!1:!((n=e.current)!=null&&n.contains(r))}function gc(t,e){const n=j.useId();return j.useMemo(()=>t||[e,n].filter(Boolean).join("-"),[t,e,n])}function wc(t,e){const n=t!==void 0;return[n,n&&typeof t<"u"?t:e]}function bc(t={}){const{onClose:e,onOpen:n,isOpen:r,id:o}=t,s=bo(n),i=bo(e),[a,l]=j.useState(t.defaultIsOpen||!1),[u,c]=wc(r,a),d=gc(o,"disclosure"),p=j.useCallback(()=>{u||l(!1),i==null||i()},[u,i]),h=j.useCallback(()=>{u||l(!0),s==null||s()},[u,s]),b=j.useCallback(()=>{(c?p:h)()},[c,h,p]);return{isOpen:!!c,onOpen:h,onClose:p,onToggle:b,isControlled:u,getButtonProps:(f={})=>({...f,"aria-expanded":c,"aria-controls":d,onClick:bl(f.onClick,b)}),getDisclosureProps:(f={})=>({...f,hidden:!c,id:d})}}var Un=fe(function(e,n){const{htmlSize:r,...o}=e,s=jt("Input",o),i=tt(o),a=ec(i),l=ke("chakra-input",e.className);return O.jsx(de.input,{size:r,...a,__css:s.field,ref:n,className:l})});Un.displayName="Input";Un.id="Input";function _c(t,e){return Array.isArray(t)?t.map(n=>n===null?null:e(n)):_l(t)?Object.keys(t).reduce((n,r)=>(n[r]=e(t[r]),n),{}):t!=null?e(t):null}var Mt=fe(function(e,n){const r=Kr("Text",e),{className:o,align:s,decoration:i,casing:a,...l}=tt(e),u=Nl({textAlign:e.align,textDecoration:e.decoration,textTransform:e.casing});return O.jsx(de.p,{ref:n,className:ke("chakra-text",e.className),...u,...l,__css:r})});Mt.displayName="Text";var _o=t=>O.jsx(de.div,{className:"chakra-stack__divider",...t,__css:{...t.__css,borderWidth:0,alignSelf:"stretch",borderColor:"inherit",width:"auto",height:"auto"}});_o.displayName="StackDivider";var $a=t=>O.jsx(de.div,{className:"chakra-stack__item",...t,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...t.__css}});$a.displayName="StackItem";function kc(t){const{spacing:e,direction:n}=t,r={column:{my:e,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:e,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:e,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:e,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":_c(n,o=>r[o])}}var rn=fe((t,e)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:a,children:l,divider:u,className:c,shouldWrapChildren:d,...p}=t,h=n?"row":r??"column",b=j.useMemo(()=>kc({spacing:i,direction:h}),[i,h]),f=!!u,y=!d&&!f,m=j.useMemo(()=>{const _=ps(l);return y?_:_.map((k,x)=>{const I=typeof k.key<"u"?k.key:x,E=x+1===_.length,D=d?O.jsx($a,{children:k},I):k;if(!f)return D;const R=j.cloneElement(u,{__css:b}),K=E?null:R;return O.jsxs(j.Fragment,{children:[D,K]},I)})},[u,b,f,y,d,l]),w=ke("chakra-stack",c);return O.jsx(de.div,{ref:e,display:"flex",alignItems:o,justifyContent:s,flexDirection:h,flexWrap:a,gap:f?void 0:i,className:w,...p,children:m})});rn.displayName="Stack";var zt=fe((t,e)=>O.jsx(rn,{align:"center",...t,direction:"row",ref:e}));zt.displayName="HStack";var ms=fe(function(e,n){const r=Kr("Heading",e),{className:o,...s}=tt(e);return O.jsx(de.h2,{ref:n,className:ke("chakra-heading",e.className),...s,__css:r})});ms.displayName="Heading";var St=de("div");St.displayName="Box";var qa=fe(function(e,n){const{size:r,centerContent:o=!0,...s}=e,i=o?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return O.jsx(St,{ref:n,boxSize:r,__css:{...i,flexShrink:0,flexGrow:0},...s})});qa.displayName="Square";var xc=fe(function(e,n){const{size:r,...o}=e;return O.jsx(qa,{size:r,ref:n,borderRadius:"9999px",...o})});xc.displayName="Circle";var xn=fe(function(e,n){const{direction:r,align:o,justify:s,wrap:i,basis:a,grow:l,shrink:u,...c}=e,d={display:"flex",flexDirection:r,alignItems:o,justifyContent:s,flexWrap:i,flexBasis:a,flexGrow:l,flexShrink:u};return O.jsx(de.div,{ref:n,__css:d,...c})});xn.displayName="Flex";function Ec(t){const{key:e}=t;return e.length===1||e.length>1&&/[^a-zA-Z0-9]/.test(e)}function Cc(t={}){const{timeout:e=300,preventDefault:n=()=>!0}=t,[r,o]=j.useState([]),s=j.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},a=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},e)};j.useEffect(()=>i,[]);function l(u){return c=>{if(c.key==="Backspace"){const d=[...r];d.pop(),o(d);return}if(Ec(c)){const d=r.concat(c.key);n(c)&&(c.preventDefault(),c.stopPropagation()),o(d),u(d.join("")),a()}}}return l}function Sc(t,e,n,r){if(e==null)return r;if(!r)return t.find(i=>n(i).toLowerCase().startsWith(e.toLowerCase()));const o=t.filter(s=>n(s).toLowerCase().startsWith(e.toLowerCase()));if(o.length>0){let s;return o.includes(r)?(s=o.indexOf(r)+1,s===o.length&&(s=0),o[s]):(s=t.indexOf(o[0]),t[s])}return r}function Oc(){const t=j.useRef(new Map),e=t.current,n=j.useCallback((o,s,i,a)=>{t.current.set(i,{type:s,el:o,options:a}),o.addEventListener(s,i,a)},[]),r=j.useCallback((o,s,i,a)=>{o.removeEventListener(s,i,a),t.current.delete(i)},[]);return j.useEffect(()=>()=>{e.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,e]),{add:n,remove:r}}function oo(t){const e=t.target,{tagName:n,isContentEditable:r}=e;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function Ha(t={}){const{ref:e,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:a,onClick:l,onKeyDown:u,onKeyUp:c,tabIndex:d,onMouseOver:p,onMouseLeave:h,...b}=t,[f,y]=j.useState(!0),[m,w]=j.useState(!1),_=Oc(),k=A=>{A&&A.tagName!=="BUTTON"&&y(!1)},x=f?d:d||0,I=n&&!r,E=j.useCallback(A=>{if(n){A.stopPropagation(),A.preventDefault();return}A.currentTarget.focus(),l==null||l(A)},[n,l]),N=j.useCallback(A=>{m&&oo(A)&&(A.preventDefault(),A.stopPropagation(),w(!1),_.remove(document,"keyup",N,!1))},[m,_]),D=j.useCallback(A=>{if(u==null||u(A),n||A.defaultPrevented||A.metaKey||!oo(A.nativeEvent)||f)return;const X=o&&A.key==="Enter";s&&A.key===" "&&(A.preventDefault(),w(!0)),X&&(A.preventDefault(),A.currentTarget.click()),_.add(document,"keyup",N,!1)},[n,f,u,o,s,_,N]),R=j.useCallback(A=>{if(c==null||c(A),n||A.defaultPrevented||A.metaKey||!oo(A.nativeEvent)||f)return;s&&A.key===" "&&(A.preventDefault(),w(!1),A.currentTarget.click())},[s,f,n,c]),K=j.useCallback(A=>{A.button===0&&(w(!1),_.remove(document,"mouseup",K,!1))},[_]),P=j.useCallback(A=>{if(A.button!==0)return;if(n){A.stopPropagation(),A.preventDefault();return}f||w(!0),A.currentTarget.focus({preventScroll:!0}),_.add(document,"mouseup",K,!1),i==null||i(A)},[n,f,i,_,K]),B=j.useCallback(A=>{A.button===0&&(f||w(!1),a==null||a(A))},[a,f]),v=j.useCallback(A=>{if(n){A.preventDefault();return}p==null||p(A)},[n,p]),T=j.useCallback(A=>{m&&(A.preventDefault(),w(!1)),h==null||h(A)},[m,h]),H=Te(e,k);return f?{...b,ref:H,type:"button","aria-disabled":I?void 0:n,disabled:I,onClick:E,onMouseDown:i,onMouseUp:a,onKeyUp:c,onKeyDown:u,onMouseOver:p,onMouseLeave:h}:{...b,ref:H,role:"button","data-active":ot(m),"aria-disabled":n?"true":void 0,tabIndex:I?void 0:x,onClick:E,onMouseDown:P,onMouseUp:B,onKeyUp:R,onKeyDown:D,onMouseOver:v,onMouseLeave:T}}function Ic(t){const e=t.current;if(!e)return!1;const n=El(e);return!n||e.contains(n)?!1:!!Cl(n)}function Va(t,e){const{shouldFocus:n,visible:r,focusRef:o}=e,s=n&&!r;$r(()=>{if(!s||Ic(t))return;const i=(o==null?void 0:o.current)||t.current;let a;if(i)return a=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(a)}},[s,t,o])}var Dc={preventScroll:!0,shouldFocus:!1};function Pc(t,e=Dc){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=e,i=jc(t)?t.current:t,a=o&&s,l=j.useRef(a),u=j.useRef(s);kl(()=>{!u.current&&s&&(l.current=a),u.current=s},[s,a]);const c=j.useCallback(()=>{if(!(!s||!i||!l.current)&&(l.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var d;(d=n.current)==null||d.focus({preventScroll:r})});else{const d=xl(i);d.length>0&&requestAnimationFrame(()=>{d[0].focus({preventScroll:r})})}},[s,r,i,n]);$r(()=>{c()},[c]),nn(i,"transitionend",c)}function jc(t){return"current"in t}var Jt=(t,e)=>({var:t,varRef:e?`var(${t}, ${e})`:`var(${t})`}),Ae={arrowShadowColor:Jt("--popper-arrow-shadow-color"),arrowSize:Jt("--popper-arrow-size","8px"),arrowSizeHalf:Jt("--popper-arrow-size-half"),arrowBg:Jt("--popper-arrow-bg"),transformOrigin:Jt("--popper-transform-origin"),arrowOffset:Jt("--popper-arrow-offset")};function Ac(t){if(t.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(t.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(t.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(t.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var Nc={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},Fc=t=>Nc[t],Zs={scroll:!0,resize:!0};function Rc(t){let e;return typeof t=="object"?e={enabled:!0,options:{...Zs,...t}}:e={enabled:t,options:Zs},e}var Tc={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:t})=>{t.styles.popper.width=`${t.rects.reference.width}px`},effect:({state:t})=>()=>{const e=t.elements.reference;t.elements.popper.style.width=`${e.offsetWidth}px`}},Bc={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:t})=>{Gs(t)},effect:({state:t})=>()=>{Gs(t)}},Gs=t=>{t.elements.popper.style.setProperty(Ae.transformOrigin.var,Fc(t.placement))},Mc={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:t})=>{zc(t)}},zc=t=>{var e;if(!t.placement)return;const n=Lc(t.placement);if((e=t.elements)!=null&&e.arrow&&n){Object.assign(t.elements.arrow.style,{[n.property]:n.value,width:Ae.arrowSize.varRef,height:Ae.arrowSize.varRef,zIndex:-1});const r={[Ae.arrowSizeHalf.var]:`calc(${Ae.arrowSize.varRef} / 2 - 1px)`,[Ae.arrowOffset.var]:`calc(${Ae.arrowSizeHalf.varRef} * -1)`};for(const o in r)t.elements.arrow.style.setProperty(o,r[o])}},Lc=t=>{if(t.startsWith("top"))return{property:"bottom",value:Ae.arrowOffset.varRef};if(t.startsWith("bottom"))return{property:"top",value:Ae.arrowOffset.varRef};if(t.startsWith("left"))return{property:"right",value:Ae.arrowOffset.varRef};if(t.startsWith("right"))return{property:"left",value:Ae.arrowOffset.varRef}},Wc={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:t})=>{Ys(t)},effect:({state:t})=>()=>{Ys(t)}},Ys=t=>{if(!t.elements.arrow)return;const e=t.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!e)return;const n=Ac(t.placement);n&&e.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(e.style,{transform:"rotate(45deg)",background:Ae.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},Uc={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},Kc={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function $c(t,e="ltr"){var n,r;const o=((n=Uc[t])==null?void 0:n[e])||t;return e==="ltr"?o:(r=Kc[t])!=null?r:o}var Ue="top",Xe="bottom",Qe="right",Ke="left",ys="auto",Kn=[Ue,Xe,Qe,Ke],ln="start",An="end",qc="clippingParents",Za="viewport",wn="popper",Hc="reference",Js=Kn.reduce(function(t,e){return t.concat([e+"-"+ln,e+"-"+An])},[]),Ga=[].concat(Kn,[ys]).reduce(function(t,e){return t.concat([e,e+"-"+ln,e+"-"+An])},[]),Vc="beforeRead",Zc="read",Gc="afterRead",Yc="beforeMain",Jc="main",Xc="afterMain",Qc="beforeWrite",eu="write",tu="afterWrite",nu=[Vc,Zc,Gc,Yc,Jc,Xc,Qc,eu,tu];function lt(t){return t?(t.nodeName||"").toLowerCase():null}function Ve(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function qt(t){var e=Ve(t).Element;return t instanceof e||t instanceof Element}function Je(t){var e=Ve(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function vs(t){if(typeof ShadowRoot>"u")return!1;var e=Ve(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function ru(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},s=e.elements[n];!Je(s)||!lt(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var a=o[i];a===!1?s.removeAttribute(i):s.setAttribute(i,a===!0?"":a)}))})}function ou(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],s=e.attributes[r]||{},i=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=i.reduce(function(l,u){return l[u]="",l},{});!Je(o)||!lt(o)||(Object.assign(o.style,a),Object.keys(s).forEach(function(l){o.removeAttribute(l)}))})}}const su={name:"applyStyles",enabled:!0,phase:"write",fn:ru,effect:ou,requires:["computeStyles"]};function it(t){return t.split("-")[0]}var Lt=Math.max,xr=Math.min,cn=Math.round;function ko(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Ya(){return!/^((?!chrome|android).)*safari/i.test(ko())}function un(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),o=1,s=1;e&&Je(t)&&(o=t.offsetWidth>0&&cn(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&cn(r.height)/t.offsetHeight||1);var i=qt(t)?Ve(t):window,a=i.visualViewport,l=!Ya()&&n,u=(r.left+(l&&a?a.offsetLeft:0))/o,c=(r.top+(l&&a?a.offsetTop:0))/s,d=r.width/o,p=r.height/s;return{width:d,height:p,top:c,right:u+d,bottom:c+p,left:u,x:u,y:c}}function gs(t){var e=un(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function Ja(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&vs(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function vt(t){return Ve(t).getComputedStyle(t)}function au(t){return["table","td","th"].indexOf(lt(t))>=0}function Nt(t){return((qt(t)?t.ownerDocument:t.document)||window.document).documentElement}function Zr(t){return lt(t)==="html"?t:t.assignedSlot||t.parentNode||(vs(t)?t.host:null)||Nt(t)}function Xs(t){return!Je(t)||vt(t).position==="fixed"?null:t.offsetParent}function iu(t){var e=/firefox/i.test(ko()),n=/Trident/i.test(ko());if(n&&Je(t)){var r=vt(t);if(r.position==="fixed")return null}var o=Zr(t);for(vs(o)&&(o=o.host);Je(o)&&["html","body"].indexOf(lt(o))<0;){var s=vt(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function $n(t){for(var e=Ve(t),n=Xs(t);n&&au(n)&&vt(n).position==="static";)n=Xs(n);return n&&(lt(n)==="html"||lt(n)==="body"&&vt(n).position==="static")?e:n||iu(t)||e}function ws(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function En(t,e,n){return Lt(t,xr(e,n))}function lu(t,e,n){var r=En(t,e,n);return r>n?n:r}function Xa(){return{top:0,right:0,bottom:0,left:0}}function Qa(t){return Object.assign({},Xa(),t)}function ei(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var cu=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Qa(typeof e!="number"?e:ei(e,Kn))};function uu(t){var e,n=t.state,r=t.name,o=t.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,a=it(n.placement),l=ws(a),u=[Ke,Qe].indexOf(a)>=0,c=u?"height":"width";if(!(!s||!i)){var d=cu(o.padding,n),p=gs(s),h=l==="y"?Ue:Ke,b=l==="y"?Xe:Qe,f=n.rects.reference[c]+n.rects.reference[l]-i[l]-n.rects.popper[c],y=i[l]-n.rects.reference[l],m=$n(s),w=m?l==="y"?m.clientHeight||0:m.clientWidth||0:0,_=f/2-y/2,k=d[h],x=w-p[c]-d[b],I=w/2-p[c]/2+_,E=En(k,I,x),N=l;n.modifiersData[r]=(e={},e[N]=E,e.centerOffset=E-I,e)}}function du(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||Ja(e.elements.popper,o)&&(e.elements.arrow=o))}const fu={name:"arrow",enabled:!0,phase:"main",fn:uu,effect:du,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function dn(t){return t.split("-")[1]}var hu={top:"auto",right:"auto",bottom:"auto",left:"auto"};function pu(t,e){var n=t.x,r=t.y,o=e.devicePixelRatio||1;return{x:cn(n*o)/o||0,y:cn(r*o)/o||0}}function Qs(t){var e,n=t.popper,r=t.popperRect,o=t.placement,s=t.variation,i=t.offsets,a=t.position,l=t.gpuAcceleration,u=t.adaptive,c=t.roundOffsets,d=t.isFixed,p=i.x,h=p===void 0?0:p,b=i.y,f=b===void 0?0:b,y=typeof c=="function"?c({x:h,y:f}):{x:h,y:f};h=y.x,f=y.y;var m=i.hasOwnProperty("x"),w=i.hasOwnProperty("y"),_=Ke,k=Ue,x=window;if(u){var I=$n(n),E="clientHeight",N="clientWidth";if(I===Ve(n)&&(I=Nt(n),vt(I).position!=="static"&&a==="absolute"&&(E="scrollHeight",N="scrollWidth")),I=I,o===Ue||(o===Ke||o===Qe)&&s===An){k=Xe;var D=d&&I===x&&x.visualViewport?x.visualViewport.height:I[E];f-=D-r.height,f*=l?1:-1}if(o===Ke||(o===Ue||o===Xe)&&s===An){_=Qe;var R=d&&I===x&&x.visualViewport?x.visualViewport.width:I[N];h-=R-r.width,h*=l?1:-1}}var K=Object.assign({position:a},u&&hu),P=c===!0?pu({x:h,y:f},Ve(n)):{x:h,y:f};if(h=P.x,f=P.y,l){var B;return Object.assign({},K,(B={},B[k]=w?"0":"",B[_]=m?"0":"",B.transform=(x.devicePixelRatio||1)<=1?"translate("+h+"px, "+f+"px)":"translate3d("+h+"px, "+f+"px, 0)",B))}return Object.assign({},K,(e={},e[k]=w?f+"px":"",e[_]=m?h+"px":"",e.transform="",e))}function mu(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:it(e.placement),variation:dn(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Qs(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:i,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Qs(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const yu={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:mu,data:{}};var Qn={passive:!0};function vu(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,a=i===void 0?!0:i,l=Ve(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&u.forEach(function(c){c.addEventListener("scroll",n.update,Qn)}),a&&l.addEventListener("resize",n.update,Qn),function(){s&&u.forEach(function(c){c.removeEventListener("scroll",n.update,Qn)}),a&&l.removeEventListener("resize",n.update,Qn)}}const gu={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:vu,data:{}};var wu={left:"right",right:"left",bottom:"top",top:"bottom"};function cr(t){return t.replace(/left|right|bottom|top/g,function(e){return wu[e]})}var bu={start:"end",end:"start"};function ea(t){return t.replace(/start|end/g,function(e){return bu[e]})}function bs(t){var e=Ve(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function _s(t){return un(Nt(t)).left+bs(t).scrollLeft}function _u(t,e){var n=Ve(t),r=Nt(t),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;var u=Ya();(u||!u&&e==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:s,height:i,x:a+_s(t),y:l}}function ku(t){var e,n=Nt(t),r=bs(t),o=(e=t.ownerDocument)==null?void 0:e.body,s=Lt(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Lt(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+_s(t),l=-r.scrollTop;return vt(o||n).direction==="rtl"&&(a+=Lt(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:a,y:l}}function ks(t){var e=vt(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function ti(t){return["html","body","#document"].indexOf(lt(t))>=0?t.ownerDocument.body:Je(t)&&ks(t)?t:ti(Zr(t))}function Cn(t,e){var n;e===void 0&&(e=[]);var r=ti(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),s=Ve(r),i=o?[s].concat(s.visualViewport||[],ks(r)?r:[]):r,a=e.concat(i);return o?a:a.concat(Cn(Zr(i)))}function xo(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function xu(t,e){var n=un(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function ta(t,e,n){return e===Za?xo(_u(t,n)):qt(e)?xu(e,n):xo(ku(Nt(t)))}function Eu(t){var e=Cn(Zr(t)),n=["absolute","fixed"].indexOf(vt(t).position)>=0,r=n&&Je(t)?$n(t):t;return qt(r)?e.filter(function(o){return qt(o)&&Ja(o,r)&<(o)!=="body"}):[]}function Cu(t,e,n,r){var o=e==="clippingParents"?Eu(t):[].concat(e),s=[].concat(o,[n]),i=s[0],a=s.reduce(function(l,u){var c=ta(t,u,r);return l.top=Lt(c.top,l.top),l.right=xr(c.right,l.right),l.bottom=xr(c.bottom,l.bottom),l.left=Lt(c.left,l.left),l},ta(t,i,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function ni(t){var e=t.reference,n=t.element,r=t.placement,o=r?it(r):null,s=r?dn(r):null,i=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(o){case Ue:l={x:i,y:e.y-n.height};break;case Xe:l={x:i,y:e.y+e.height};break;case Qe:l={x:e.x+e.width,y:a};break;case Ke:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var u=o?ws(o):null;if(u!=null){var c=u==="y"?"height":"width";switch(s){case ln:l[u]=l[u]-(e[c]/2-n[c]/2);break;case An:l[u]=l[u]+(e[c]/2-n[c]/2);break}}return l}function Nn(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,s=n.strategy,i=s===void 0?t.strategy:s,a=n.boundary,l=a===void 0?qc:a,u=n.rootBoundary,c=u===void 0?Za:u,d=n.elementContext,p=d===void 0?wn:d,h=n.altBoundary,b=h===void 0?!1:h,f=n.padding,y=f===void 0?0:f,m=Qa(typeof y!="number"?y:ei(y,Kn)),w=p===wn?Hc:wn,_=t.rects.popper,k=t.elements[b?w:p],x=Cu(qt(k)?k:k.contextElement||Nt(t.elements.popper),l,c,i),I=un(t.elements.reference),E=ni({reference:I,element:_,strategy:"absolute",placement:o}),N=xo(Object.assign({},_,E)),D=p===wn?N:I,R={top:x.top-D.top+m.top,bottom:D.bottom-x.bottom+m.bottom,left:x.left-D.left+m.left,right:D.right-x.right+m.right},K=t.modifiersData.offset;if(p===wn&&K){var P=K[o];Object.keys(R).forEach(function(B){var v=[Qe,Xe].indexOf(B)>=0?1:-1,T=[Ue,Xe].indexOf(B)>=0?"y":"x";R[B]+=P[T]*v})}return R}function Su(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?Ga:l,c=dn(r),d=c?a?Js:Js.filter(function(b){return dn(b)===c}):Kn,p=d.filter(function(b){return u.indexOf(b)>=0});p.length===0&&(p=d);var h=p.reduce(function(b,f){return b[f]=Nn(t,{placement:f,boundary:o,rootBoundary:s,padding:i})[it(f)],b},{});return Object.keys(h).sort(function(b,f){return h[b]-h[f]})}function Ou(t){if(it(t)===ys)return[];var e=cr(t);return[ea(t),e,ea(e)]}function Iu(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,a=i===void 0?!0:i,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,p=n.altBoundary,h=n.flipVariations,b=h===void 0?!0:h,f=n.allowedAutoPlacements,y=e.options.placement,m=it(y),w=m===y,_=l||(w||!b?[cr(y)]:Ou(y)),k=[y].concat(_).reduce(function(J,G){return J.concat(it(G)===ys?Su(e,{placement:G,boundary:c,rootBoundary:d,padding:u,flipVariations:b,allowedAutoPlacements:f}):G)},[]),x=e.rects.reference,I=e.rects.popper,E=new Map,N=!0,D=k[0],R=0;R=0,T=v?"width":"height",H=Nn(e,{placement:K,boundary:c,rootBoundary:d,altBoundary:p,padding:u}),A=v?B?Qe:Ke:B?Xe:Ue;x[T]>I[T]&&(A=cr(A));var X=cr(A),$=[];if(s&&$.push(H[P]<=0),a&&$.push(H[A]<=0,H[X]<=0),$.every(function(J){return J})){D=K,N=!1;break}E.set(K,$)}if(N)for(var ne=b?3:1,z=function(G){var me=k.find(function(we){var ie=E.get(we);if(ie)return ie.slice(0,G).every(function(ue){return ue})});if(me)return D=me,"break"},M=ne;M>0;M--){var te=z(M);if(te==="break")break}e.placement!==D&&(e.modifiersData[r]._skip=!0,e.placement=D,e.reset=!0)}}const Du={name:"flip",enabled:!0,phase:"main",fn:Iu,requiresIfExists:["offset"],data:{_skip:!1}};function na(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function ra(t){return[Ue,Qe,Xe,Ke].some(function(e){return t[e]>=0})}function Pu(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,s=e.modifiersData.preventOverflow,i=Nn(e,{elementContext:"reference"}),a=Nn(e,{altBoundary:!0}),l=na(i,r),u=na(a,o,s),c=ra(l),d=ra(u);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const ju={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Pu};function Au(t,e,n){var r=it(t),o=[Ke,Ue].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,i=s[0],a=s[1];return i=i||0,a=(a||0)*o,[Ke,Qe].indexOf(r)>=0?{x:a,y:i}:{x:i,y:a}}function Nu(t){var e=t.state,n=t.options,r=t.name,o=n.offset,s=o===void 0?[0,0]:o,i=Ga.reduce(function(c,d){return c[d]=Au(d,e.rects,s),c},{}),a=i[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=i}const Fu={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Nu};function Ru(t){var e=t.state,n=t.name;e.modifiersData[n]=ni({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Tu={name:"popperOffsets",enabled:!0,phase:"read",fn:Ru,data:{}};function Bu(t){return t==="x"?"y":"x"}function Mu(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,a=i===void 0?!1:i,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,p=n.tether,h=p===void 0?!0:p,b=n.tetherOffset,f=b===void 0?0:b,y=Nn(e,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),m=it(e.placement),w=dn(e.placement),_=!w,k=ws(m),x=Bu(k),I=e.modifiersData.popperOffsets,E=e.rects.reference,N=e.rects.popper,D=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,R=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),K=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,P={x:0,y:0};if(I){if(s){var B,v=k==="y"?Ue:Ke,T=k==="y"?Xe:Qe,H=k==="y"?"height":"width",A=I[k],X=A+y[v],$=A-y[T],ne=h?-N[H]/2:0,z=w===ln?E[H]:N[H],M=w===ln?-N[H]:-E[H],te=e.elements.arrow,J=h&&te?gs(te):{width:0,height:0},G=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Xa(),me=G[v],we=G[T],ie=En(0,E[H],J[H]),ue=_?E[H]/2-ne-ie-me-R.mainAxis:z-ie-me-R.mainAxis,_e=_?-E[H]/2+ne+ie+we+R.mainAxis:M+ie+we+R.mainAxis,ye=e.elements.arrow&&$n(e.elements.arrow),pe=ye?k==="y"?ye.clientTop||0:ye.clientLeft||0:0,xe=(B=K==null?void 0:K[k])!=null?B:0,g=A+ue-xe-pe,U=A+_e-xe,W=En(h?xr(X,g):X,A,h?Lt($,U):$);I[k]=W,P[k]=W-A}if(a){var S,C=k==="x"?Ue:Ke,F=k==="x"?Xe:Qe,V=I[x],Z=x==="y"?"height":"width",L=V+y[C],Q=V-y[F],re=[Ue,Ke].indexOf(m)!==-1,ee=(S=K==null?void 0:K[x])!=null?S:0,se=re?L:V-E[Z]-N[Z]-ee+R.altAxis,ve=re?V+E[Z]+N[Z]-ee-R.altAxis:Q,he=h&&re?lu(se,V,ve):En(h?se:L,V,h?ve:Q);I[x]=he,P[x]=he-V}e.modifiersData[r]=P}}const zu={name:"preventOverflow",enabled:!0,phase:"main",fn:Mu,requiresIfExists:["offset"]};function Lu(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Wu(t){return t===Ve(t)||!Je(t)?bs(t):Lu(t)}function Uu(t){var e=t.getBoundingClientRect(),n=cn(e.width)/t.offsetWidth||1,r=cn(e.height)/t.offsetHeight||1;return n!==1||r!==1}function Ku(t,e,n){n===void 0&&(n=!1);var r=Je(e),o=Je(e)&&Uu(e),s=Nt(e),i=un(t,o,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((lt(e)!=="body"||ks(s))&&(a=Wu(e)),Je(e)?(l=un(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=_s(s))),{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function $u(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&o(l)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||o(s)}),r}function qu(t){var e=$u(t);return nu.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function Hu(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function Vu(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var oa={placement:"bottom",modifiers:[],strategy:"absolute"};function sa(){for(var t=arguments.length,e=new Array(t),n=0;n{}),_=j.useCallback(()=>{var R;!e||!b.current||!f.current||((R=w.current)==null||R.call(w),y.current=Yu(b.current,f.current,{placement:m,modifiers:[Wc,Mc,Bc,{...Tc,enabled:!!p},{name:"eventListeners",...Rc(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:a??[0,l]}},{name:"flip",enabled:!!u,options:{padding:8}},{name:"preventOverflow",enabled:!!d,options:{boundary:c}},...n??[]],strategy:o}),y.current.forceUpdate(),w.current=y.current.destroy)},[m,e,n,p,i,s,a,l,u,d,c,o]);j.useEffect(()=>()=>{var R;!b.current&&!f.current&&((R=y.current)==null||R.destroy(),y.current=null)},[]);const k=j.useCallback(R=>{b.current=R,_()},[_]),x=j.useCallback((R={},K=null)=>({...R,ref:Te(k,K)}),[k]),I=j.useCallback(R=>{f.current=R,_()},[_]),E=j.useCallback((R={},K=null)=>({...R,ref:Te(I,K),style:{...R.style,position:o,minWidth:p?void 0:"max-content",inset:"0 auto auto 0"}}),[o,I,p]),N=j.useCallback((R={},K=null)=>{const{size:P,shadowColor:B,bg:v,style:T,...H}=R;return{...H,ref:K,"data-popper-arrow":"",style:Ju(R)}},[]),D=j.useCallback((R={},K=null)=>({...R,ref:K,"data-popper-arrow-inner":""}),[]);return{update(){var R;(R=y.current)==null||R.update()},forceUpdate(){var R;(R=y.current)==null||R.forceUpdate()},transformOrigin:Ae.transformOrigin.varRef,referenceRef:k,popperRef:I,getPopperProps:E,getArrowProps:N,getArrowInnerProps:D,getReferenceProps:x}}function Ju(t){const{size:e,shadowColor:n,bg:r,style:o}=t,s={...o,position:"absolute"};return e&&(s["--popper-arrow-size"]=e),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function Es(t={}){const{onClose:e,onOpen:n,isOpen:r,id:o}=t,s=Bt(n),i=Bt(e),[a,l]=j.useState(t.defaultIsOpen||!1),u=r!==void 0?r:a,c=r!==void 0,d=j.useId(),p=o??`disclosure-${d}`,h=j.useCallback(()=>{c||l(!1),i==null||i()},[c,i]),b=j.useCallback(()=>{c||l(!0),s==null||s()},[c,s]),f=j.useCallback(()=>{u?h():b()},[u,b,h]);function y(w={}){return{...w,"aria-expanded":u,"aria-controls":p,onClick(_){var k;(k=w.onClick)==null||k.call(w,_),f()}}}function m(w={}){return{...w,hidden:!u,id:p}}return{isOpen:u,onOpen:b,onClose:h,onToggle:f,isControlled:c,getButtonProps:y,getDisclosureProps:m}}function Xu(t){const{ref:e,handler:n,enabled:r=!0}=t,o=Bt(n),i=j.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;j.useEffect(()=>{if(!r)return;const a=d=>{so(d,e)&&(i.isPointerDown=!0)},l=d=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&so(d,e)&&(i.isPointerDown=!1,o(d))},u=d=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&so(d,e)&&(i.isPointerDown=!1,o(d))},c=ri(e.current);return c.addEventListener("mousedown",a,!0),c.addEventListener("mouseup",l,!0),c.addEventListener("touchstart",a,!0),c.addEventListener("touchend",u,!0),()=>{c.removeEventListener("mousedown",a,!0),c.removeEventListener("mouseup",l,!0),c.removeEventListener("touchstart",a,!0),c.removeEventListener("touchend",u,!0)}},[n,e,o,i,r])}function so(t,e){var n;const r=t.target;return r&&!ri(r).contains(r)?!1:!((n=e.current)!=null&&n.contains(r))}function ri(t){var e;return(e=t==null?void 0:t.ownerDocument)!=null?e:document}function oi(t){const{isOpen:e,ref:n}=t,[r,o]=j.useState(e),[s,i]=j.useState(!1);return j.useEffect(()=>{s||(o(e),i(!0))},[e,s,r]),nn(()=>n.current,"animationend",()=>{o(e)}),{present:!(e?!1:!r),onComplete(){var l;const u=Sl(n.current),c=new u.CustomEvent("animationend",{bubbles:!0});(l=n.current)==null||l.dispatchEvent(c)}}}function Cs(t){const{wasSelected:e,enabled:n,isSelected:r,mode:o="unmount"}=t;return!!(!n||r||o==="keepMounted"&&e)}var[Qu,ed,td,nd]=Na(),[rd,qn]=et({strict:!1,name:"MenuContext"});function od(t,...e){const n=j.useId(),r=t||n;return j.useMemo(()=>e.map(o=>`${o}-${r}`),[r,e])}function si(t){var e;return(e=t==null?void 0:t.ownerDocument)!=null?e:document}function aa(t){return si(t).activeElement===t}function sd(t={}){const{id:e,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:a,defaultIsOpen:l,onClose:u,onOpen:c,placement:d="bottom-start",lazyBehavior:p="unmount",direction:h,computePositionOnMount:b=!1,...f}=t,y=j.useRef(null),m=j.useRef(null),w=td(),_=j.useCallback(()=>{requestAnimationFrame(()=>{var te;(te=y.current)==null||te.focus({preventScroll:!1})})},[]),k=j.useCallback(()=>{const te=setTimeout(()=>{var J;if(o)(J=o.current)==null||J.focus();else{const G=w.firstEnabled();G&&B(G.index)}});X.current.add(te)},[w,o]),x=j.useCallback(()=>{const te=setTimeout(()=>{const J=w.lastEnabled();J&&B(J.index)});X.current.add(te)},[w]),I=j.useCallback(()=>{c==null||c(),s?k():_()},[s,k,_,c]),{isOpen:E,onOpen:N,onClose:D,onToggle:R}=Es({isOpen:a,defaultIsOpen:l,onClose:u,onOpen:I});Xu({enabled:E&&r,ref:y,handler:te=>{var J;(J=m.current)!=null&&J.contains(te.target)||D()}});const K=xs({...f,enabled:E||b,placement:d,direction:h}),[P,B]=j.useState(-1);$r(()=>{E||B(-1)},[E]),Va(y,{focusRef:m,visible:E,shouldFocus:!0});const v=oi({isOpen:E,ref:y}),[T,H]=od(e,"menu-button","menu-list"),A=j.useCallback(()=>{N(),_()},[N,_]),X=j.useRef(new Set([]));j.useEffect(()=>{const te=X.current;return()=>{te.forEach(J=>clearTimeout(J)),te.clear()}},[]);const $=j.useCallback(()=>{N(),k()},[k,N]),ne=j.useCallback(()=>{N(),x()},[N,x]),z=j.useCallback(()=>{var te,J;const G=si(y.current),me=(te=y.current)==null?void 0:te.contains(G.activeElement);if(!(E&&!me))return;const ie=(J=w.item(P))==null?void 0:J.node;ie==null||ie.focus({preventScroll:!0})},[E,P,w]),M=j.useRef(null);return{openAndFocusMenu:A,openAndFocusFirstItem:$,openAndFocusLastItem:ne,onTransitionEnd:z,unstable__animationState:v,descendants:w,popper:K,buttonId:T,menuId:H,forceUpdate:K.forceUpdate,orientation:"vertical",isOpen:E,onToggle:R,onOpen:N,onClose:D,menuRef:y,buttonRef:m,focusedIndex:P,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:B,isLazy:i,lazyBehavior:p,initialFocusRef:o,rafId:M}}function op(t={},e=null){const n=qn(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,a=j.useCallback(l=>{const u=l.key,d={Enter:s,ArrowDown:s,ArrowUp:i}[u];d&&(l.preventDefault(),l.stopPropagation(),d(l))},[s,i]);return{...t,ref:Te(n.buttonRef,e,o.referenceRef),id:n.buttonId,"data-active":ot(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:Oe(t.onClick,r),onKeyDown:Oe(t.onKeyDown,a)}}function Eo(t){var e;return ld(t)&&!!((e=t==null?void 0:t.getAttribute("role"))!=null&&e.startsWith("menuitem"))}function ad(t={},e=null){const n=qn();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:i,onClose:a,menuId:l,isLazy:u,lazyBehavior:c,unstable__animationState:d}=n,p=ed(),h=Cc({preventDefault:m=>m.key!==" "&&Eo(m.target)}),b=j.useCallback(m=>{if(!m.currentTarget.contains(m.target))return;const w=m.key,k={Tab:I=>I.preventDefault(),Escape:a,ArrowDown:()=>{const I=p.nextEnabled(r);I&&o(I.index)},ArrowUp:()=>{const I=p.prevEnabled(r);I&&o(I.index)}}[w];if(k){m.preventDefault(),k(m);return}const x=h(I=>{const E=Sc(p.values(),I,N=>{var D,R;return(R=(D=N==null?void 0:N.node)==null?void 0:D.textContent)!=null?R:""},p.item(r));if(E){const N=p.indexOf(E.node);o(N)}});Eo(m.target)&&x(m)},[p,r,h,a,o]),f=j.useRef(!1);i&&(f.current=!0);const y=Cs({wasSelected:f.current,enabled:u,mode:c,isSelected:d.present});return{...t,ref:Te(s,e),children:y?t.children:null,tabIndex:-1,role:"menu",id:l,style:{...t.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:Oe(t.onKeyDown,b)}}function id(t={}){const{popper:e,isOpen:n}=qn();return e.getPopperProps({...t,style:{visibility:n?"visible":"hidden",...t.style}})}function ai(t={},e=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:a,isFocusable:l,closeOnSelect:u,type:c,...d}=t,p=qn(),{setFocusedIndex:h,focusedIndex:b,closeOnSelect:f,onClose:y,menuRef:m,isOpen:w,menuId:_,rafId:k}=p,x=j.useRef(null),I=`${_}-menuitem-${j.useId()}`,{index:E,register:N}=nd({disabled:a&&!l}),D=j.useCallback(A=>{n==null||n(A),!a&&h(E)},[h,E,a,n]),R=j.useCallback(A=>{r==null||r(A),x.current&&!aa(x.current)&&D(A)},[D,r]),K=j.useCallback(A=>{o==null||o(A),!a&&h(-1)},[h,a,o]),P=j.useCallback(A=>{s==null||s(A),Eo(A.currentTarget)&&(u??f)&&y()},[y,s,f,u]),B=j.useCallback(A=>{i==null||i(A),h(E)},[h,i,E]),v=E===b,T=a&&!l;$r(()=>{if(w)return v&&!T&&x.current?(k.current&&cancelAnimationFrame(k.current),k.current=requestAnimationFrame(()=>{var A;(A=x.current)==null||A.focus({preventScroll:!0}),k.current=null})):m.current&&!aa(m.current)&&m.current.focus({preventScroll:!0}),()=>{k.current&&cancelAnimationFrame(k.current)}},[v,T,m,w]);const H=Ha({onClick:P,onFocus:B,onMouseEnter:D,onMouseMove:R,onMouseLeave:K,ref:Te(N,x,e),isDisabled:a,isFocusable:l});return{...d,...H,type:c??H.type,id:I,role:"menuitem",tabIndex:v?0:-1}}function sp(t={},e=null){const{type:n="radio",isChecked:r,...o}=t;return{...ai(o,e),role:`menuitem${n}`,"aria-checked":r}}function ap(t={}){const{children:e,type:n="radio",value:r,defaultValue:o,onChange:s,...i}=t,l=n==="radio"?"":[],[u,c]=Fa({defaultValue:o??l,value:r,onChange:s}),d=j.useCallback(b=>{if(n==="radio"&&typeof u=="string"&&c(b),n==="checkbox"&&Array.isArray(u)){const f=u.includes(b)?u.filter(y=>y!==b):u.concat(b);c(f)}},[u,c,n]),h=ps(e).map(b=>{if(b.type.id!=="MenuItemOption")return b;const f=m=>{var w,_;d(b.props.value),(_=(w=b.props).onClick)==null||_.call(w,m)},y=n==="radio"?b.props.value===u:u.includes(b.props.value);return j.cloneElement(b,{type:n,onClick:f,isChecked:y})});return{...i,children:h}}function ld(t){var e;if(!cd(t))return!1;const n=(e=t.ownerDocument.defaultView)!=null?e:window;return t instanceof n.HTMLElement}function cd(t){return t!=null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}var[ud,Gr]=et({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Ss=t=>{const{children:e}=t,n=jt("Menu",t),r=tt(t),{direction:o}=ss(),{descendants:s,...i}=sd({...r,direction:o}),a=j.useMemo(()=>i,[i]),{isOpen:l,onClose:u,forceUpdate:c}=a;return O.jsx(Qu,{value:s,children:O.jsx(rd,{value:a,children:O.jsx(ud,{value:n,children:Ea(e,{isOpen:l,onClose:u,forceUpdate:c})})})})};Ss.displayName="Menu";var ii=fe((t,e)=>{const n=Gr();return O.jsx(de.span,{ref:e,...t,__css:n.command,className:"chakra-menu__command"})});ii.displayName="MenuCommand";var dd=fe((t,e)=>{const{type:n,...r}=t,o=Gr(),s=r.as||n?n??void 0:"button",i=j.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return O.jsx(de.button,{ref:e,type:s,...r,__css:i})}),li=t=>{const{className:e,children:n,...r}=t,o=Gr(),s=j.Children.only(n),i=j.isValidElement(s)?j.cloneElement(s,{focusable:"false","aria-hidden":!0,className:ke("chakra-menu__icon",s.props.className)}):null,a=ke("chakra-menu__icon-wrapper",e);return O.jsx(de.span,{className:a,...r,__css:o.icon,children:i})};li.displayName="MenuIcon";var bt=fe((t,e)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...a}=t,l=ai(a,e),c=n||o?O.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return O.jsxs(dd,{...l,className:ke("chakra-menu__menuitem",l.className),children:[n&&O.jsx(li,{fontSize:"0.8em",marginEnd:r,children:n}),c,o&&O.jsx(ii,{marginStart:s,children:o})]})});bt.displayName="MenuItem";var fd={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},hd=de(as.div),Os=fe(function(e,n){var r,o;const{rootProps:s,motionProps:i,...a}=e,{isOpen:l,onTransitionEnd:u,unstable__animationState:c}=qn(),d=ad(a,n),p=id(s),h=Gr();return O.jsx(de.div,{...p,__css:{zIndex:(o=e.zIndex)!=null?o:(r=h.list)==null?void 0:r.zIndex},children:O.jsx(hd,{variants:fd,initial:!1,animate:l?"enter":"exit",__css:{outline:0,...h.list},...i,className:ke("chakra-menu__menu-list",d.className),...d,onUpdate:u,onAnimationComplete:Ca(c.onComplete,d.onAnimationComplete)})})});Os.displayName="MenuList";var[pd,Hn]=et({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[md,Is]=et({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function ci(t){const e=j.Children.only(t.children),{getTriggerProps:n}=Hn();return j.cloneElement(e,n(e.props,e.ref))}ci.displayName="PopoverTrigger";var Xt={click:"click",hover:"hover"};function yd(t={}){const{closeOnBlur:e=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:a,arrowShadowColor:l,trigger:u=Xt.click,openDelay:c=200,closeDelay:d=200,isLazy:p,lazyBehavior:h="unmount",computePositionOnMount:b,...f}=t,{isOpen:y,onClose:m,onOpen:w,onToggle:_}=Es(t),k=j.useRef(null),x=j.useRef(null),I=j.useRef(null),E=j.useRef(!1),N=j.useRef(!1);y&&(N.current=!0);const[D,R]=j.useState(!1),[K,P]=j.useState(!1),B=j.useId(),v=o??B,[T,H,A,X]=["popover-trigger","popover-content","popover-header","popover-body"].map(U=>`${U}-${v}`),{referenceRef:$,getArrowProps:ne,getPopperProps:z,getArrowInnerProps:M,forceUpdate:te}=xs({...f,enabled:y||!!b}),J=oi({isOpen:y,ref:I});lc({enabled:y,ref:x}),Va(I,{focusRef:x,visible:y,shouldFocus:s&&u===Xt.click}),Pc(I,{focusRef:r,visible:y,shouldFocus:i&&u===Xt.click});const G=Cs({wasSelected:N.current,enabled:p,mode:h,isSelected:J.present}),me=j.useCallback((U={},W=null)=>{const S={...U,style:{...U.style,transformOrigin:Ae.transformOrigin.varRef,[Ae.arrowSize.var]:a?`${a}px`:void 0,[Ae.arrowShadowColor.var]:l},ref:Te(I,W),children:G?U.children:null,id:H,tabIndex:-1,role:"dialog",onKeyDown:Oe(U.onKeyDown,C=>{n&&C.key==="Escape"&&m()}),onBlur:Oe(U.onBlur,C=>{const F=ia(C),V=ao(I.current,F),Z=ao(x.current,F);y&&e&&(!V&&!Z)&&m()}),"aria-labelledby":D?A:void 0,"aria-describedby":K?X:void 0};return u===Xt.hover&&(S.role="tooltip",S.onMouseEnter=Oe(U.onMouseEnter,()=>{E.current=!0}),S.onMouseLeave=Oe(U.onMouseLeave,C=>{C.nativeEvent.relatedTarget!==null&&(E.current=!1,setTimeout(()=>m(),d))})),S},[G,H,D,A,K,X,u,n,m,y,e,d,l,a]),we=j.useCallback((U={},W=null)=>z({...U,style:{visibility:y?"visible":"hidden",...U.style}},W),[y,z]),ie=j.useCallback((U,W=null)=>({...U,ref:Te(W,k,$)}),[k,$]),ue=j.useRef(),_e=j.useRef(),ye=j.useCallback(U=>{k.current==null&&$(U)},[$]),pe=j.useCallback((U={},W=null)=>{const S={...U,ref:Te(x,W,ye),id:T,"aria-haspopup":"dialog","aria-expanded":y,"aria-controls":H};return u===Xt.click&&(S.onClick=Oe(U.onClick,_)),u===Xt.hover&&(S.onFocus=Oe(U.onFocus,()=>{ue.current===void 0&&w()}),S.onBlur=Oe(U.onBlur,C=>{const F=ia(C),V=!ao(I.current,F);y&&e&&V&&m()}),S.onKeyDown=Oe(U.onKeyDown,C=>{C.key==="Escape"&&m()}),S.onMouseEnter=Oe(U.onMouseEnter,()=>{E.current=!0,ue.current=window.setTimeout(()=>w(),c)}),S.onMouseLeave=Oe(U.onMouseLeave,()=>{E.current=!1,ue.current&&(clearTimeout(ue.current),ue.current=void 0),_e.current=window.setTimeout(()=>{E.current===!1&&m()},d)})),S},[T,y,H,u,ye,_,w,e,m,c,d]);j.useEffect(()=>()=>{ue.current&&clearTimeout(ue.current),_e.current&&clearTimeout(_e.current)},[]);const xe=j.useCallback((U={},W=null)=>({...U,id:A,ref:Te(W,S=>{R(!!S)})}),[A]),g=j.useCallback((U={},W=null)=>({...U,id:X,ref:Te(W,S=>{P(!!S)})}),[X]);return{forceUpdate:te,isOpen:y,onAnimationComplete:J.onComplete,onClose:m,getAnchorProps:ie,getArrowProps:ne,getArrowInnerProps:M,getPopoverPositionerProps:we,getPopoverProps:me,getTriggerProps:pe,getHeaderProps:xe,getBodyProps:g}}function ao(t,e){return t===e||(t==null?void 0:t.contains(e))}function ia(t){var e;const n=t.currentTarget.ownerDocument.activeElement;return(e=t.relatedTarget)!=null?e:n}function ui(t){const e=jt("Popover",t),{children:n,...r}=tt(t),o=ss(),s=yd({...r,direction:o.direction});return O.jsx(pd,{value:s,children:O.jsx(md,{value:e,children:Ea(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}ui.displayName="Popover";var di=fe(function(e,n){const{getBodyProps:r}=Hn(),o=Is();return O.jsx(de.div,{...r(e,n),className:ke("chakra-popover__body",e.className),__css:o.body})});di.displayName="PopoverBody";var fi=fe(function(e,n){const{onClose:r}=Hn(),o=Is();return O.jsx(Ol,{size:"sm",onClick:r,className:ke("chakra-popover__close-btn",e.className),__css:o.closeButton,ref:n,...e})});fi.displayName="PopoverCloseButton";function vd(t){if(t)return{enter:{...t.enter,visibility:"visible"},exit:{...t.exit,transitionEnd:{visibility:"hidden"}}}}var gd={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},wd=de(as.section),hi=fe(function(e,n){const{variants:r=gd,...o}=e,{isOpen:s}=Hn();return O.jsx(wd,{ref:n,variants:vd(r),initial:!1,animate:s?"enter":"exit",...o})});hi.displayName="PopoverTransition";var pi=fe(function(e,n){const{rootProps:r,motionProps:o,...s}=e,{getPopoverProps:i,getPopoverPositionerProps:a,onAnimationComplete:l}=Hn(),u=Is(),c={position:"relative",display:"flex",flexDirection:"column",...u.content};return O.jsx(de.div,{...a(r),__css:u.popper,className:"chakra-popover__popper",children:O.jsx(hi,{...o,...i(s,n),onAnimationComplete:Ca(l,s.onAnimationComplete),className:ke("chakra-popover__content",e.className),__css:c})})});pi.displayName="PopoverContent";var[bd,_d,kd,xd]=Na();function Ed(t){var e;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:a="unmount",orientation:l="horizontal",direction:u="ltr",...c}=t,[d,p]=j.useState(n??0),[h,b]=Fa({defaultValue:n??0,value:o,onChange:r});j.useEffect(()=>{o!=null&&p(o)},[o]);const f=kd(),y=j.useId();return{id:`tabs-${(e=t.id)!=null?e:y}`,selectedIndex:h,focusedIndex:d,setSelectedIndex:b,setFocusedIndex:p,isManual:s,isLazy:i,lazyBehavior:a,orientation:l,descendants:f,direction:u,htmlProps:c}}var[Cd,Yr]=et({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function Sd(t){const{focusedIndex:e,orientation:n,direction:r}=Yr(),o=_d(),s=j.useCallback(i=>{const a=()=>{var w;const _=o.nextEnabled(e);_&&((w=_.node)==null||w.focus())},l=()=>{var w;const _=o.prevEnabled(e);_&&((w=_.node)==null||w.focus())},u=()=>{var w;const _=o.firstEnabled();_&&((w=_.node)==null||w.focus())},c=()=>{var w;const _=o.lastEnabled();_&&((w=_.node)==null||w.focus())},d=n==="horizontal",p=n==="vertical",h=i.key,b=r==="ltr"?"ArrowLeft":"ArrowRight",f=r==="ltr"?"ArrowRight":"ArrowLeft",m={[b]:()=>d&&l(),[f]:()=>d&&a(),ArrowDown:()=>p&&a(),ArrowUp:()=>p&&l(),Home:u,End:c}[h];m&&(i.preventDefault(),m(i))},[o,e,n,r]);return{...t,role:"tablist","aria-orientation":n,onKeyDown:Oe(t.onKeyDown,s)}}function Od(t){const{isDisabled:e=!1,isFocusable:n=!1,...r}=t,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:a,selectedIndex:l}=Yr(),{index:u,register:c}=xd({disabled:e&&!n}),d=u===l,p=()=>{o(u)},h=()=>{a(u),!s&&!(e&&n)&&o(u)},b=Ha({...r,ref:Te(c,t.ref),isDisabled:e,isFocusable:n,onClick:Oe(t.onClick,p)}),f="button";return{...b,id:mi(i,u),role:"tab",tabIndex:d?0:-1,type:f,"aria-selected":d,"aria-controls":yi(i,u),onFocus:e?void 0:Oe(t.onFocus,h)}}var[Id,Dd]=et({});function Pd(t){const e=Yr(),{id:n,selectedIndex:r}=e,s=ps(t.children).map((i,a)=>j.createElement(Id,{key:a,value:{isSelected:a===r,id:yi(n,a),tabId:mi(n,a),selectedIndex:r}},i));return{...t,children:s}}function jd(t){const{children:e,...n}=t,{isLazy:r,lazyBehavior:o}=Yr(),{isSelected:s,id:i,tabId:a}=Dd(),l=j.useRef(!1);s&&(l.current=!0);const u=Cs({wasSelected:l.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:u?e:null,role:"tabpanel","aria-labelledby":a,hidden:!s,id:i}}function mi(t,e){return`${t}--tab-${e}`}function yi(t,e){return`${t}--tabpanel-${e}`}var[Ad,Jr]=et({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),vi=fe(function(e,n){const r=jt("Tabs",e),{children:o,className:s,...i}=tt(e),{htmlProps:a,descendants:l,...u}=Ed(i),c=j.useMemo(()=>u,[u]),{isFitted:d,...p}=a,h={position:"relative",...r.root};return O.jsx(bd,{value:l,children:O.jsx(Cd,{value:c,children:O.jsx(Ad,{value:r,children:O.jsx(de.div,{className:ke("chakra-tabs",s),ref:n,...p,__css:h,children:o})})})})});vi.displayName="Tabs";var gi=fe(function(e,n){const r=Sd({...e,ref:n}),s={display:"flex",...Jr().tablist};return O.jsx(de.div,{...r,className:ke("chakra-tabs__tablist",e.className),__css:s})});gi.displayName="TabList";var Co=fe(function(e,n){const r=jd({...e,ref:n}),o=Jr();return O.jsx(de.div,{outline:"0",...r,className:ke("chakra-tabs__tab-panel",e.className),__css:o.tabpanel})});Co.displayName="TabPanel";var wi=fe(function(e,n){const r=Pd(e),o=Jr();return O.jsx(de.div,{...r,width:"100%",ref:n,className:ke("chakra-tabs__tab-panels",e.className),__css:o.tabpanels})});wi.displayName="TabPanels";var So=fe(function(e,n){const r=Jr(),o=Od({...e,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return O.jsx(de.button,{...o,className:ke("chakra-tabs__tab",e.className),__css:s})});So.displayName="Tab";var[Nd,bi]=et({name:"TagStylesContext",errorMessage:`useTagStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Xr=fe((t,e)=>{const n=jt("Tag",t),r=tt(t),o={display:"inline-flex",verticalAlign:"top",alignItems:"center",maxWidth:"100%",...n.container};return O.jsx(Nd,{value:n,children:O.jsx(de.span,{ref:e,...r,__css:o})})});Xr.displayName="Tag";var Fd=fe((t,e)=>{const n=bi();return O.jsx(de.span,{ref:e,noOfLines:1,...t,__css:n.label})});Fd.displayName="TagLabel";var Rd=fe((t,e)=>O.jsx(Ur,{ref:e,verticalAlign:"top",marginEnd:"0.5rem",...t}));Rd.displayName="TagLeftIcon";var Td=fe((t,e)=>O.jsx(Ur,{ref:e,verticalAlign:"top",marginStart:"0.5rem",...t}));Td.displayName="TagRightIcon";var _i=t=>O.jsx(Ur,{verticalAlign:"inherit",viewBox:"0 0 512 512",...t,children:O.jsx("path",{fill:"currentColor",d:"M289.94 256l95-95A24 24 0 00351 127l-95 95-95-95a24 24 0 00-34 34l95 95-95 95a24 24 0 1034 34l95-95 95 95a24 24 0 0034-34z"})});_i.displayName="TagCloseIcon";var Bd=fe((t,e)=>{const{isDisabled:n,children:r,...o}=t,i={display:"flex",alignItems:"center",justifyContent:"center",outline:"0",...bi().closeButton};return O.jsx(de.button,{ref:e,"aria-label":"close",...o,type:"button",disabled:n,__css:i,children:r||O.jsx(_i,{})})});Bd.displayName="TagCloseButton";var Md={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},Oo=t=>{var e;return((e=t.current)==null?void 0:e.ownerDocument)||document},ur=t=>{var e,n;return((n=(e=t.current)==null?void 0:e.ownerDocument)==null?void 0:n.defaultView)||window};function zd(t={}){const{openDelay:e=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:a=!0,onOpen:l,onClose:u,placement:c,id:d,isOpen:p,defaultIsOpen:h,arrowSize:b=10,arrowShadowColor:f,arrowPadding:y,modifiers:m,isDisabled:w,gutter:_,offset:k,direction:x,...I}=t,{isOpen:E,onOpen:N,onClose:D}=Es({isOpen:p,defaultIsOpen:h,onOpen:l,onClose:u}),{referenceRef:R,getPopperProps:K,getArrowInnerProps:P,getArrowProps:B}=xs({enabled:E,placement:c,arrowPadding:y,modifiers:m,gutter:_,offset:k,direction:x}),v=j.useId(),H=`tooltip-${d??v}`,A=j.useRef(null),X=j.useRef(),$=j.useCallback(()=>{X.current&&(clearTimeout(X.current),X.current=void 0)},[]),ne=j.useRef(),z=j.useCallback(()=>{ne.current&&(clearTimeout(ne.current),ne.current=void 0)},[]),M=j.useCallback(()=>{z(),D()},[D,z]),te=Ld(A,M),J=j.useCallback(()=>{if(!w&&!X.current){E&&te();const pe=ur(A);X.current=pe.setTimeout(N,e)}},[te,w,E,N,e]),G=j.useCallback(()=>{$();const pe=ur(A);ne.current=pe.setTimeout(M,n)},[n,M,$]),me=j.useCallback(()=>{E&&r&&G()},[r,G,E]),we=j.useCallback(()=>{E&&i&&G()},[i,G,E]),ie=j.useCallback(pe=>{E&&pe.key==="Escape"&&G()},[E,G]);nn(()=>Oo(A),"keydown",a?ie:void 0),nn(()=>{if(!s)return null;const pe=A.current;if(!pe)return null;const xe=Ka(pe);return xe.localName==="body"?ur(A):xe},"scroll",()=>{E&&s&&M()},{passive:!0,capture:!0}),j.useEffect(()=>{w&&($(),E&&D())},[w,E,D,$]),j.useEffect(()=>()=>{$(),z()},[$,z]),nn(()=>A.current,"pointerleave",G);const ue=j.useCallback((pe={},xe=null)=>({...pe,ref:Te(A,xe,R),onPointerEnter:Oe(pe.onPointerEnter,U=>{U.pointerType!=="touch"&&J()}),onClick:Oe(pe.onClick,me),onPointerDown:Oe(pe.onPointerDown,we),onFocus:Oe(pe.onFocus,J),onBlur:Oe(pe.onBlur,G),"aria-describedby":E?H:void 0}),[J,G,we,E,H,me,R]),_e=j.useCallback((pe={},xe=null)=>K({...pe,style:{...pe.style,[Ae.arrowSize.var]:b?`${b}px`:void 0,[Ae.arrowShadowColor.var]:f}},xe),[K,b,f]),ye=j.useCallback((pe={},xe=null)=>{const g={...pe.style,position:"relative",transformOrigin:Ae.transformOrigin.varRef};return{ref:xe,...I,...pe,id:H,role:"tooltip",style:g}},[I,H]);return{isOpen:E,show:J,hide:G,getTriggerProps:ue,getTooltipProps:ye,getTooltipPositionerProps:_e,getArrowProps:B,getArrowInnerProps:P}}var io="chakra-ui:close-tooltip";function Ld(t,e){return j.useEffect(()=>{const n=Oo(t);return n.addEventListener(io,e),()=>n.removeEventListener(io,e)},[e,t]),()=>{const n=Oo(t),r=ur(t);n.dispatchEvent(new r.CustomEvent(io))}}function Wd(t,e=[]){const n=Object.assign({},t);for(const r of e)r in n&&delete n[r];return n}function Ud(t,e){const n={};for(const r of e)r in t&&(n[r]=t[r]);return n}var Kd=de(as.div),Ht=fe((t,e)=>{var n,r;const o=Kr("Tooltip",t),s=tt(t),i=ss(),{children:a,label:l,shouldWrapChildren:u,"aria-label":c,hasArrow:d,bg:p,portalProps:h,background:b,backgroundColor:f,bgColor:y,motionProps:m,...w}=s,_=(r=(n=b??f)!=null?n:p)!=null?r:y;if(_){o.bg=_;const K=Il(i,"colors",_);o[Ae.arrowBg.var]=K}const k=zd({...w,direction:i.direction}),x=typeof a=="string"||u;let I;if(x)I=O.jsx(de.span,{display:"inline-block",tabIndex:0,...k.getTriggerProps(),children:a});else{const K=j.Children.only(a);I=j.cloneElement(K,k.getTriggerProps(K.props,K.ref))}const E=!!c,N=k.getTooltipProps({},e),D=E?Wd(N,["role","id"]):N,R=Ud(N,["role","id"]);return l?O.jsxs(O.Fragment,{children:[I,O.jsx(Dl,{children:k.isOpen&&O.jsx(Sa,{...h,children:O.jsx(de.div,{...k.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:O.jsxs(Kd,{variants:Md,initial:"exit",animate:"enter",exit:"exit",...m,...D,__css:o,children:[l,E&&O.jsx(de.span,{srOnly:!0,...R,children:c}),d&&O.jsx(de.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:O.jsx(de.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):O.jsx(O.Fragment,{children:a})});Ht.displayName="Tooltip";const $d="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Fn=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=$d[n[t]&63];return e},Pe=null;const ki=location.pathname.split("/").slice(0,-1).join("/");let Er=null;At(()=>import(ki+"/scripts/api.js"),__vite__mapDeps([])).then(t=>{Er=t==null?void 0:t.api});At(()=>import(ki+"/scripts/app.js"),__vite__mapDeps([])).then(t=>{Pe=t==null?void 0:t.app});function Ie(t,e){if(Er==null)throw console.error("api is null!"),new Error("api is null!");return Er.fetchApi(t,e)}async function qd(t){console.warn("[workspace deprecated] getDB is deprecated",t);try{const e=await Ie(`/workspace/get_db?table=${t}`);return e.ok?await e.json():void 0}catch(e){console.error("Error fetching workspace:",e);return}}async function Hd(t,e){try{return await(await Ie("/workspace/save_db",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:t,json:e})})).text()}catch(n){console.error("Error saving workspace:",n)}}async function ip(t){try{return await(await Ie("/workspace/get_system_dir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({absolute_dir:t??""})})).json()}catch(e){console.error("Error getting workflows dir:",e)}}async function lp(){try{return await(await Ie("/workspace/open_workflow_file_browser",{method:"POST",headers:{"Content-Type":"application/json"}})).json()}catch(t){console.error("Error open workflows folder:",t)}}async function Vd(){const e=await(await Ie("/workspace/get_my_workflows_dir")).json();return e.error&&alert(`Failed to fetch my workflows path: ${e.error}`),e}async function cp(){try{return await(await Ie("/model_manager/get_model_list",{method:"GET",headers:{"Content-Type":"application/json"}})).json()}catch(t){console.error("Error get all models list:",t)}}async function up(){try{return await(await Ie("/model_manager/get_folder_list",{method:"GET",headers:{"Content-Type":"application/json"}})).json()}catch(t){console.error("Error get all models list:",t)}}async function dp(t){try{return await(await Ie("/model_manager/cancel_installation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({save_path:t})})).text()}catch(e){console.error("Error move file:",e)}}async function fp(t,e){try{return await(await Ie("/workspace/copy_json_files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({src:t,dst:e})})).json()}catch(n){console.error("Error copy flows to new directory:",n)}}const Zd="backup",Cr="workspace";let er=null;function Gd(){return new Promise((t,e)=>{const n=indexedDB.open("WorkspaceDB",3);n.onupgradeneeded=r=>{const o=r.target.result;o.objectStoreNames.contains(Cr)||o.createObjectStore(Cr,{keyPath:"id"})},n.onsuccess=r=>{t(r.target.result)},n.onerror=r=>{e(r.target.error)}})}async function Yd(){try{return er==null&&(er=await Gd()),new Promise((t,e)=>{if(er==null)return e("indexDB is null");const o=er.transaction([Cr],"readonly").objectStore(Cr).get(Zd);o.onsuccess=()=>{o.result?t(o.result.value):t(void 0)},o.onerror=()=>e(o.error)})}catch(t){console.error("Error while reading from database:",t)}}async function Jd(){try{return await Yd()}catch(t){console.error("Error retrieving data from IndexedDB:",t)}}const Ee=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ne=Object.keys,Me=Array.isArray;function We(t,e){return typeof e!="object"||Ne(e).forEach(function(n){t[n]=e[n]}),t}typeof Promise>"u"||Ee.Promise||(Ee.Promise=Promise);const Rn=Object.getPrototypeOf,Xd={}.hasOwnProperty;function Ze(t,e){return Xd.call(t,e)}function fn(t,e){typeof e=="function"&&(e=e(Rn(t))),(typeof Reflect>"u"?Ne:Reflect.ownKeys)(e).forEach(n=>{mt(t,n,e[n])})}const xi=Object.defineProperty;function mt(t,e,n,r){xi(t,e,We(n&&Ze(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function on(t){return{from:function(e){return t.prototype=Object.create(e.prototype),mt(t.prototype,"constructor",t),{extend:fn.bind(null,t.prototype)}}}}const Qd=Object.getOwnPropertyDescriptor;function Ds(t,e){let n;return Qd(t,e)||(n=Rn(t))&&Ds(n,e)}const ef=[].slice;function Sr(t,e,n){return ef.call(t,e,n)}function Ei(t,e){return e(t)}function _n(t){if(!t)throw new Error("Assertion Failed")}function Ci(t){Ee.setImmediate?setImmediate(t):setTimeout(t,0)}function Si(t,e){return t.reduce((n,r,o)=>{var s=e(r,o);return s&&(n[s[0]]=s[1]),n},{})}function yt(t,e){if(Ze(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var n=[],r=0,o=e.length;r["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>Ee[t]),nf=Di.map(t=>Ee[t]);Si(Di,t=>[t,!0]);let kt=null;function Vn(t){kt=typeof WeakMap<"u"&&new WeakMap;const e=Io(t);return kt=null,e}function Io(t){if(!t||typeof t!="object")return t;let e=kt&&kt.get(t);if(e)return e;if(Me(t)){e=[],kt&&kt.set(t,e);for(var n=0,r=t.length;n=0)e=t;else{const s=Rn(t);for(var o in e=s===Object.prototype?{}:Object.create(s),kt&&kt.set(t,e),t)Ze(t,o)&&(e[o]=Io(t[o]))}return e}const{toString:rf}={};function Do(t){return rf.call(t).slice(8,-1)}const Po=typeof Symbol<"u"?Symbol.iterator:"@@iterator",of=typeof Po=="symbol"?function(t){var e;return t!=null&&(e=t[Po])&&e.apply(t)}:function(){return null},tn={};function ht(t){var e,n,r,o;if(arguments.length===1){if(Me(t))return t.slice();if(this===tn&&typeof t=="string")return[t];if(o=of(t)){for(n=[];!(r=o.next()).done;)n.push(r.value);return n}if(t==null)return[t];if(typeof(e=t.length)=="number"){for(n=new Array(e);e--;)n[e]=t[e];return n}return[t]}for(e=arguments.length,n=new Array(e);e--;)n[e]=arguments[e];return n}const Ps=typeof Symbol<"u"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1;var ct=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Pi(t,e){ct=t,ji=e}var ji=()=>!0;const sf=!new Error("").stack;function Gt(){if(sf)try{throw Gt.arguments,new Error}catch(t){return t}return new Error}function jo(t,e){var n=t.stack;return n?(e=e||0,n.indexOf(t.name)===0&&(e+=(t.name+t.message).split(` -`).length),n.split(` -`).slice(e).filter(ji).map(r=>` -`+r).join("")):""}var Ai=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],js=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Ai),af={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function sn(t,e){this._e=Gt(),this.name=t,this.message=e}function Ni(t,e){return t+". Errors: "+Object.keys(e).map(n=>e[n].toString()).filter((n,r,o)=>o.indexOf(n)===r).join(` -`)}function Or(t,e,n,r){this._e=Gt(),this.failures=e,this.failedKeys=r,this.successCount=n,this.message=Ni(t,e)}function Sn(t,e){this._e=Gt(),this.name="BulkError",this.failures=Object.keys(e).map(n=>e[n]),this.failuresByPos=e,this.message=Ni(t,e)}on(sn).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+jo(this._e,2))}},toString:function(){return this.name+": "+this.message}}),on(Or).from(sn),on(Sn).from(sn);var As=js.reduce((t,e)=>(t[e]=e+"Error",t),{});const lf=sn;var le=js.reduce((t,e)=>{var n=e+"Error";function r(o,s){this._e=Gt(),this.name=n,o?typeof o=="string"?(this.message=`${o}${s?` - `+s:""}`,this.inner=s||null):typeof o=="object"&&(this.message=`${o.name} ${o.message}`,this.inner=o):(this.message=af[e]||n,this.inner=null)}return on(r).from(lf),t[e]=r,t},{});le.Syntax=SyntaxError,le.Type=TypeError,le.Range=RangeError;var la=Ai.reduce((t,e)=>(t[e+"Error"]=le[e],t),{}),dr=js.reduce((t,e)=>(["Syntax","Type","Range"].indexOf(e)===-1&&(t[e+"Error"]=le[e]),t),{});function be(){}function Tn(t){return t}function cf(t,e){return t==null||t===Tn?e:function(n){return e(t(n))}}function Vt(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function uf(t,e){return t===be?e:function(){var n=t.apply(this,arguments);n!==void 0&&(arguments[0]=n);var r=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var s=e.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?Vt(r,this.onsuccess):r),o&&(this.onerror=this.onerror?Vt(o,this.onerror):o),s!==void 0?s:n}}function df(t,e){return t===be?e:function(){t.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,e.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?Vt(n,this.onsuccess):n),r&&(this.onerror=this.onerror?Vt(r,this.onerror):r)}}function ff(t,e){return t===be?e:function(n){var r=t.apply(this,arguments);We(n,r);var o=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var i=e.apply(this,arguments);return o&&(this.onsuccess=this.onsuccess?Vt(o,this.onsuccess):o),s&&(this.onerror=this.onerror?Vt(s,this.onerror):s),r===void 0?i===void 0?void 0:i:We(r,i)}}function hf(t,e){return t===be?e:function(){return e.apply(this,arguments)!==!1&&t.apply(this,arguments)}}function Ns(t,e){return t===be?e:function(){var n=t.apply(this,arguments);if(n&&typeof n.then=="function"){for(var r=this,o=arguments.length,s=new Array(o);o--;)s[o]=arguments[o];return n.then(function(){return e.apply(r,s)})}return e.apply(this,arguments)}}dr.ModifyError=Or,dr.DexieError=sn,dr.BulkError=Sn;var Bn={};const Fi=100,[Ao,Ir,No]=typeof Promise>"u"?[]:(()=>{let t=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[t,Rn(t),t];const e=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[e,Rn(e),t]})(),Ri=Ir&&Ir.then,fr=Ao&&Ao.constructor,Fs=!!No;var Fo=!1,pf=No?()=>{No.then(tr)}:Ee.setImmediate?setImmediate.bind(null,tr):Ee.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver(()=>{tr(),t=null}).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(tr,0)},On=function(t,e){kn.push([t,e]),Dr&&(pf(),Dr=!1)},Ro=!0,Dr=!0,Wt=[],hr=[],To=null,Bo=Tn,an={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:da,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(t=>{try{da(t[0],t[1])}catch{}})}},ae=an,kn=[],Ut=0,pr=[];function oe(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=be,this._lib=!1;var e=this._PSD=ae;if(ct&&(this._stackHolder=Gt(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==Bn)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&zo(this,this._value))}this._state=null,this._value=null,++e.ref,Bi(this,t)}const Mo={get:function(){var t=ae,e=Pr;function n(r,o){var s=!t.global&&(t!==ae||e!==Pr);const i=s&&!gt();var a=new oe((l,u)=>{Rs(this,new Ti(jr(r,t,s,i),jr(o,t,s,i),l,u,t))});return ct&&Li(a,this),a}return n.prototype=Bn,n},set:function(t){mt(this,"then",t&&t.prototype===Bn?Mo:{get:function(){return t},set:Mo.set})}};function Ti(t,e,n,r,o){this.onFulfilled=typeof t=="function"?t:null,this.onRejected=typeof e=="function"?e:null,this.resolve=n,this.reject=r,this.psd=o}function Bi(t,e){try{e(n=>{if(t._state===null){if(n===t)throw new TypeError("A promise cannot be resolved with itself.");var r=t._lib&&Zn();n&&typeof n.then=="function"?Bi(t,(o,s)=>{n instanceof oe?n._then(o,s):n.then(o,s)}):(t._state=!0,t._value=n,Mi(t)),r&&Gn()}},zo.bind(null,t))}catch(n){zo(t,n)}}function zo(t,e){if(hr.push(e),t._state===null){var n=t._lib&&Zn();e=Bo(e),t._state=!1,t._value=e,ct&&e!==null&&typeof e=="object"&&!e._promise&&function(r,o,s){try{r.apply(null,s)}catch(i){o&&o(i)}}(()=>{var r=Ds(e,"stack");e._promise=t,mt(e,"stack",{get:()=>Fo?r&&(r.get?r.get.apply(e):r.value):t.stack})}),function(r){Wt.some(o=>o._value===r._value)||Wt.push(r)}(t),Mi(t),n&&Gn()}}function Mi(t){var e=t._listeners;t._listeners=[];for(var n=0,r=e.length;n{--Ut==0&&Ts()},[]))}function Rs(t,e){if(t._state!==null){var n=t._state?e.onFulfilled:e.onRejected;if(n===null)return(t._state?e.resolve:e.reject)(t._value);++e.psd.ref,++Ut,On(mf,[n,t,e])}else t._listeners.push(e)}function mf(t,e,n){try{To=e;var r,o=e._value;e._state?r=t(o):(hr.length&&(hr=[]),r=t(o),hr.indexOf(o)===-1&&function(s){for(var i=Wt.length;i;)if(Wt[--i]._value===s._value)return void Wt.splice(i,1)}(e)),n.resolve(r)}catch(s){n.reject(s)}finally{To=null,--Ut==0&&Ts(),--n.psd.ref||n.psd.finalize()}}function zi(t,e,n){if(e.length===n)return e;var r="";if(t._state===!1){var o,s,i=t._value;i!=null?(o=i.name||"Error",s=i.message||i,r=jo(i,0)):(o=i,s=""),e.push(o+(s?": "+s:"")+r)}return ct&&((r=jo(t._stackHolder,2))&&e.indexOf(r)===-1&&e.push(r),t._prev&&zi(t._prev,e,n)),e}function Li(t,e){var n=e?e._numPrev+1:0;n<100&&(t._prev=e,t._numPrev=n)}function tr(){Zn()&&Gn()}function Zn(){var t=Ro;return Ro=!1,Dr=!1,t}function Gn(){var t,e,n;do for(;kn.length>0;)for(t=kn,kn=[],n=t.length,e=0;e0);Ro=!0,Dr=!0}function Ts(){var t=Wt;Wt=[],t.forEach(r=>{r._PSD.onunhandled.call(null,r._value,r)});for(var e=pr.slice(0),n=e.length;n;)e[--n]()}function nr(t){return new oe(Bn,!1,t)}function Ce(t,e){var n=ae;return function(){var r=Zn(),o=ae;try{return It(n,!0),t.apply(this,arguments)}catch(s){e&&e(s)}finally{It(o,!1),r&&Gn()}}}fn(oe.prototype,{then:Mo,_then:function(t,e){Rs(this,new Ti(null,null,t,e,ae))},catch:function(t){if(arguments.length===1)return this.then(null,t);var e=arguments[0],n=arguments[1];return typeof e=="function"?this.then(null,r=>r instanceof e?n(r):nr(r)):this.then(null,r=>r&&r.name===e?n(r):nr(r))},finally:function(t){return this.then(e=>(t(),e),e=>(t(),nr(e)))},stack:{get:function(){if(this._stack)return this._stack;try{Fo=!0;var t=zi(this,[],20).join(` -From previous: `);return this._state!==null&&(this._stack=t),t}finally{Fo=!1}}},timeout:function(t,e){return t<1/0?new oe((n,r)=>{var o=setTimeout(()=>r(new le.Timeout(e)),t);this.then(n,r).finally(clearTimeout.bind(null,o))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&mt(oe.prototype,Symbol.toStringTag,"Dexie.Promise"),an.env=Wi(),fn(oe,{all:function(){var t=ht.apply(null,arguments).map(rr);return new oe(function(e,n){t.length===0&&e([]);var r=t.length;t.forEach((o,s)=>oe.resolve(o).then(i=>{t[s]=i,--r||e(t)},n))})},resolve:t=>{if(t instanceof oe)return t;if(t&&typeof t.then=="function")return new oe((n,r)=>{t.then(n,r)});var e=new oe(Bn,!0,t);return Li(e,To),e},reject:nr,race:function(){var t=ht.apply(null,arguments).map(rr);return new oe((e,n)=>{t.map(r=>oe.resolve(r).then(e,n))})},PSD:{get:()=>ae,set:t=>ae=t},totalEchoes:{get:()=>Pr},newPSD:Ot,usePSD:mn,scheduler:{get:()=>On,set:t=>{On=t}},rejectionMapper:{get:()=>Bo,set:t=>{Bo=t}},follow:(t,e)=>new oe((n,r)=>Ot((o,s)=>{var i=ae;i.unhandleds=[],i.onunhandled=s,i.finalize=Vt(function(){(function(a){function l(){a(),pr.splice(pr.indexOf(l),1)}pr.push(l),++Ut,On(()=>{--Ut==0&&Ts()},[])})(()=>{this.unhandleds.length===0?o():s(this.unhandleds[0])})},i.finalize),t()},e,n,r))}),fr&&(fr.allSettled&&mt(oe,"allSettled",function(){const t=ht.apply(null,arguments).map(rr);return new oe(e=>{t.length===0&&e([]);let n=t.length;const r=new Array(n);t.forEach((o,s)=>oe.resolve(o).then(i=>r[s]={status:"fulfilled",value:i},i=>r[s]={status:"rejected",reason:i}).then(()=>--n||e(r)))})}),fr.any&&typeof AggregateError<"u"&&mt(oe,"any",function(){const t=ht.apply(null,arguments).map(rr);return new oe((e,n)=>{t.length===0&&n(new AggregateError([]));let r=t.length;const o=new Array(r);t.forEach((s,i)=>oe.resolve(s).then(a=>e(a),a=>{o[i]=a,--r||n(new AggregateError(o))}))})}));const Be={awaits:0,echoes:0,id:0};var yf=0,mr=[],lo=0,Pr=0,vf=0;function Ot(t,e,n,r){var o=ae,s=Object.create(o);s.parent=o,s.ref=0,s.global=!1,s.id=++vf;var i=an.env;s.env=Fs?{Promise:oe,PromiseProp:{value:oe,configurable:!0,writable:!0},all:oe.all,race:oe.race,allSettled:oe.allSettled,any:oe.any,resolve:oe.resolve,reject:oe.reject,nthen:ca(i.nthen,s),gthen:ca(i.gthen,s)}:{},e&&We(s,e),++o.ref,s.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=mn(s,t,n,r);return s.ref===0&&s.finalize(),a}function pn(){return Be.id||(Be.id=++yf),++Be.awaits,Be.echoes+=Fi,Be.id}function gt(){return!!Be.awaits&&(--Be.awaits==0&&(Be.id=0),Be.echoes=Be.awaits*Fi,!0)}function rr(t){return Be.echoes&&t&&t.constructor===fr?(pn(),t.then(e=>(gt(),e),e=>(gt(),Fe(e)))):t}function gf(t){++Pr,Be.echoes&&--Be.echoes!=0||(Be.echoes=Be.id=0),mr.push(ae),It(t,!0)}function wf(){var t=mr[mr.length-1];mr.pop(),It(t,!1)}function It(t,e){var n=ae;if((e?!Be.echoes||lo++&&t===ae:!lo||--lo&&t===ae)||Ui(e?gf.bind(null,t):wf),t!==ae&&(ae=t,n===an&&(an.env=Wi()),Fs)){var r=an.env.Promise,o=t.env;Ir.then=o.nthen,r.prototype.then=o.gthen,(n.global||t.global)&&(Object.defineProperty(Ee,"Promise",o.PromiseProp),r.all=o.all,r.race=o.race,r.resolve=o.resolve,r.reject=o.reject,o.allSettled&&(r.allSettled=o.allSettled),o.any&&(r.any=o.any))}}function Wi(){var t=Ee.Promise;return Fs?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(Ee,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:Ir.then,gthen:t.prototype.then}:{}}function mn(t,e,n,r,o){var s=ae;try{return It(t,!0),e(n,r,o)}finally{It(s,!1)}}function Ui(t){Ri.call(Ao,t)}function jr(t,e,n,r){return typeof t!="function"?t:function(){var o=ae;n&&pn(),It(e,!0);try{return t.apply(this,arguments)}finally{It(o,!1),r&&Ui(gt)}}}function ca(t,e){return function(n,r){return t.call(this,jr(n,e),jr(r,e))}}(""+Ri).indexOf("[native code]")===-1&&(pn=gt=be);const ua="unhandledrejection";function da(t,e){var n;try{n=e.onuncatched(t)}catch{}if(n!==!1)try{var r,o={promise:e,reason:t};if(Ee.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(ua,!0,!0),We(r,o)):Ee.CustomEvent&&We(r=new CustomEvent(ua,{detail:o}),o),r&&Ee.dispatchEvent&&(dispatchEvent(r),!Ee.PromiseRejectionEvent&&Ee.onunhandledrejection))try{Ee.onunhandledrejection(r)}catch{}ct&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var Fe=oe.reject;function Lo(t,e,n,r){if(t.idbdb&&(t._state.openComplete||ae.letThrough||t._vip)){var o=t._createTransaction(e,n,t._dbSchema);try{o.create(),t._state.PR1398_maxLoop=3}catch(s){return s.name===As.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>Lo(t,e,n,r))):Fe(s)}return o._promise(e,(s,i)=>Ot(()=>(ae.trans=o,r(s,i,o)))).then(s=>o._completion.then(()=>s))}if(t._state.openComplete)return Fe(new le.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return Fe(new le.DatabaseClosed);t.open().catch(be)}return t._state.dbReadyPromise.then(()=>Lo(t,e,n,r))}const fa="3.2.4",Tt="￿",Wo=-1/0,dt="Invalid key provided. Keys must be of type string, number, Date or Array.",Ki="String expected.",In=[],Qr=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),bf=Qr,_f=Qr,$i=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),eo="__dbnames",co="readonly",uo="readwrite";function Zt(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}const qi={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function or(t){return typeof t!="string"||/\./.test(t)?e=>e:e=>(e[t]===void 0&&t in e&&delete(e=Vn(e))[t],e)}class kf{_trans(e,n,r){const o=this._tx||ae.trans,s=this.name;function i(l,u,c){if(!c.schema[s])throw new le.NotFound("Table "+s+" not part of transaction");return n(c.idbtrans,c)}const a=Zn();try{return o&&o.db===this.db?o===ae.trans?o._promise(e,i,r):Ot(()=>o._promise(e,i,r),{trans:o,transless:ae.transless||ae}):Lo(this.db,e,[this.name],i)}finally{a&&Gn()}}get(e,n){return e&&e.constructor===Object?this.where(e).first(n):this._trans("readonly",r=>this.core.get({trans:r,key:e}).then(o=>this.hook.reading.fire(o))).then(n)}where(e){if(typeof e=="string")return new this.db.WhereClause(this,e);if(Me(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const n=Ne(e);if(n.length===1)return this.where(n[0]).equals(e[n[0]]);const r=this.schema.indexes.concat(this.schema.primKey).filter(u=>u.compound&&n.every(c=>u.keyPath.indexOf(c)>=0)&&u.keyPath.every(c=>n.indexOf(c)>=0))[0];if(r&&this.db._maxKey!==Tt)return this.where(r.name).equals(r.keyPath.map(u=>e[u]));!r&&ct&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);const{idxByName:o}=this.schema,s=this.db._deps.indexedDB;function i(u,c){try{return s.cmp(u,c)===0}catch{return!1}}const[a,l]=n.reduce(([u,c],d)=>{const p=o[d],h=e[d];return[u||p,u||!p?Zt(c,p&&p.multi?b=>{const f=yt(b,d);return Me(f)&&f.some(y=>i(h,y))}:b=>i(h,yt(b,d))):c]},[null,null]);return a?this.where(a.name).equals(e[a.keyPath]).filter(l):r?this.filter(l):this.where(n).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,Me(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;const n=r=>{if(!r)return r;const o=Object.create(e.prototype);for(var s in r)if(Ze(r,s))try{o[s]=r[s]}catch{}return o};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),e}defineClass(){return this.mapToClass(function(e){We(this,e)})}add(e,n){const{auto:r,keyPath:o}=this.schema.primKey;let s=e;return o&&r&&(s=or(o)(e)),this._trans("readwrite",i=>this.core.mutate({trans:i,type:"add",keys:n!=null?[n]:null,values:[s]})).then(i=>i.numFailures?oe.reject(i.failures[0]):i.lastResult).then(i=>{if(o)try{nt(e,o,i)}catch{}return i})}update(e,n){if(typeof e!="object"||Me(e))return this.where(":id").equals(e).modify(n);{const r=yt(e,this.schema.primKey.keyPath);if(r===void 0)return Fe(new le.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?Ne(n).forEach(o=>{nt(e,o,n[o])}):n(e,{value:e,primKey:r})}catch{}return this.where(":id").equals(r).modify(n)}}put(e,n){const{auto:r,keyPath:o}=this.schema.primKey;let s=e;return o&&r&&(s=or(o)(e)),this._trans("readwrite",i=>this.core.mutate({trans:i,type:"put",values:[s],keys:n!=null?[n]:null})).then(i=>i.numFailures?oe.reject(i.failures[0]):i.lastResult).then(i=>{if(o)try{nt(e,o,i)}catch{}return i})}delete(e){return this._trans("readwrite",n=>this.core.mutate({trans:n,type:"delete",keys:[e]})).then(n=>n.numFailures?oe.reject(n.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:qi})).then(e=>e.numFailures?oe.reject(e.failures[0]):void 0)}bulkGet(e){return this._trans("readonly",n=>this.core.getMany({keys:e,trans:n}).then(r=>r.map(o=>this.hook.reading.fire(o))))}bulkAdd(e,n,r){const o=Array.isArray(n)?n:void 0,s=(r=r||(o?void 0:n))?r.allKeys:void 0;return this._trans("readwrite",i=>{const{auto:a,keyPath:l}=this.schema.primKey;if(l&&o)throw new le.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new le.InvalidArgument("Arguments objects and keys must have the same length");const u=e.length;let c=l&&a?e.map(or(l)):e;return this.core.mutate({trans:i,type:"add",keys:o,values:c,wantResults:s}).then(({numFailures:d,results:p,lastResult:h,failures:b})=>{if(d===0)return s?p:h;throw new Sn(`${this.name}.bulkAdd(): ${d} of ${u} operations failed`,b)})})}bulkPut(e,n,r){const o=Array.isArray(n)?n:void 0,s=(r=r||(o?void 0:n))?r.allKeys:void 0;return this._trans("readwrite",i=>{const{auto:a,keyPath:l}=this.schema.primKey;if(l&&o)throw new le.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new le.InvalidArgument("Arguments objects and keys must have the same length");const u=e.length;let c=l&&a?e.map(or(l)):e;return this.core.mutate({trans:i,type:"put",keys:o,values:c,wantResults:s}).then(({numFailures:d,results:p,lastResult:h,failures:b})=>{if(d===0)return s?p:h;throw new Sn(`${this.name}.bulkPut(): ${d} of ${u} operations failed`,b)})})}bulkDelete(e){const n=e.length;return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:e})).then(({numFailures:r,lastResult:o,failures:s})=>{if(r===0)return o;throw new Sn(`${this.name}.bulkDelete(): ${r} of ${n} operations failed`,s)})}}function Dn(t){var e={},n=function(i,a){if(a){for(var l=arguments.length,u=new Array(l-1);--l;)u[l-1]=arguments[l];return e[i].subscribe.apply(null,u),t}if(typeof i=="string")return e[i]};n.addEventType=s;for(var r=1,o=arguments.length;rZt(r(),e()):e,t.justLimit=n&&!r}function yr(t,e){if(t.isPrimKey)return e.primaryKey;const n=e.getIndexByKeyPath(t.index);if(!n)throw new le.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return n}function ha(t,e,n){const r=yr(t,e.schema);return e.openCursor({trans:n,values:!t.keysOnly,reverse:t.dir==="prev",unique:!!t.unique,query:{index:r,range:t.range}})}function sr(t,e,n,r){const o=t.replayFilter?Zt(t.filter,t.replayFilter()):t.filter;if(t.or){const s={},i=(a,l,u)=>{if(!o||o(l,u,p=>l.stop(p),p=>l.fail(p))){var c=l.primaryKey,d=""+c;d==="[object ArrayBuffer]"&&(d=""+new Uint8Array(c)),Ze(s,d)||(s[d]=!0,e(a,l,u))}};return Promise.all([t.or._iterate(i,n),pa(ha(t,r,n),t.algorithm,i,!t.keysOnly&&t.valueMapper)])}return pa(ha(t,r,n),Zt(t.algorithm,o),e,!t.keysOnly&&t.valueMapper)}function pa(t,e,n,r){var o=Ce(r?(s,i,a)=>n(r(s),i,a):n);return t.then(s=>{if(s)return s.start(()=>{var i=()=>s.continue();e&&!e(s,a=>i=a,a=>{s.stop(a),i=be},a=>{s.fail(a),i=be})||o(s.value,s,a=>i=a),i()})})}function ze(t,e){try{const n=ma(t),r=ma(e);if(n!==r)return n==="Array"?1:r==="Array"?-1:n==="binary"?1:r==="binary"?-1:n==="string"?1:r==="string"?-1:n==="Date"?1:r!=="Date"?NaN:-1;switch(n){case"number":case"Date":case"string":return t>e?1:tsr(n,e,r,n.table.core))}count(e){return this._read(n=>{const r=this._ctx,o=r.table.core;if(Qt(r,!0))return o.count({trans:n,query:{index:yr(r,o.schema),range:r.range}}).then(i=>Math.min(i,r.limit));var s=0;return sr(r,()=>(++s,!1),n,o).then(()=>s)}).then(e)}sortBy(e,n){const r=e.split(".").reverse(),o=r[0],s=r.length-1;function i(u,c){return c?i(u[r[c]],c-1):u[o]}var a=this._ctx.dir==="next"?1:-1;function l(u,c){var d=i(u,s),p=i(c,s);return dp?a:0}return this.toArray(function(u){return u.sort(l)}).then(n)}toArray(e){return this._read(n=>{var r=this._ctx;if(r.dir==="next"&&Qt(r,!0)&&r.limit>0){const{valueMapper:o}=r,s=yr(r,r.table.core.schema);return r.table.core.query({trans:n,limit:r.limit,values:!0,query:{index:s,range:r.range}}).then(({result:i})=>o?i.map(o):i)}{const o=[];return sr(r,s=>o.push(s),n,r.table.core).then(()=>o)}},e)}offset(e){var n=this._ctx;return e<=0||(n.offset+=e,Qt(n)?ho(n,()=>{var r=e;return(o,s)=>r===0||(r===1?(--r,!1):(s(()=>{o.advance(r),r=0}),!1))}):ho(n,()=>{var r=e;return()=>--r<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),ho(this._ctx,()=>{var n=e;return function(r,o,s){return--n<=0&&o(s),n>=0}},!0),this}until(e,n){return fo(this._ctx,function(r,o,s){return!e(r.value)||(o(s),n)}),this}first(e){return this.limit(1).toArray(function(n){return n[0]}).then(e)}last(e){return this.reverse().first(e)}filter(e){var n,r;return fo(this._ctx,function(o){return e(o.value)}),n=this._ctx,r=e,n.isMatch=Zt(n.isMatch,r),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,o){e(o.key,o)})}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,o){e(o.primaryKey,o)})}keys(e){var n=this._ctx;n.keysOnly=!n.isMatch;var r=[];return this.each(function(o,s){r.push(s.key)}).then(function(){return r}).then(e)}primaryKeys(e){var n=this._ctx;if(n.dir==="next"&&Qt(n,!0)&&n.limit>0)return this._read(o=>{var s=yr(n,n.table.core.schema);return n.table.core.query({trans:o,values:!1,limit:n.limit,query:{index:s,range:n.range}})}).then(({result:o})=>o).then(e);n.keysOnly=!n.isMatch;var r=[];return this.each(function(o,s){r.push(s.primaryKey)}).then(function(){return r}).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys(function(n){return n[0]}).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,n=e.index&&e.table.schema.idxByName[e.index];if(!n||!n.multi)return this;var r={};return fo(this._ctx,function(o){var s=o.primaryKey.toString(),i=Ze(r,s);return r[s]=!0,!i}),this}modify(e){var n=this._ctx;return this._write(r=>{var o;if(typeof e=="function")o=e;else{var s=Ne(e),i=s.length;o=function(f){for(var y=!1,m=0;m{const{failures:m,numFailures:w}=y;p+=f-w;for(let _ of Ne(m))d.push(m[_])};return this.clone().primaryKeys().then(f=>{const y=m=>{const w=Math.min(c,f.length-m);return a.getMany({trans:r,keys:f.slice(m,m+w),cache:"immutable"}).then(_=>{const k=[],x=[],I=l?[]:null,E=[];for(let D=0;D0&&a.mutate({trans:r,type:"add",values:k}).then(D=>{for(let R in D.failures)E.splice(parseInt(R),1);b(k.length,D)})).then(()=>(x.length>0||N&&typeof e=="object")&&a.mutate({trans:r,type:"put",keys:I,values:x,criteria:N,changeSpec:typeof e!="function"&&e}).then(D=>b(x.length,D))).then(()=>(E.length>0||N&&e===po)&&a.mutate({trans:r,type:"delete",keys:E,criteria:N}).then(D=>b(E.length,D))).then(()=>f.length>m+w&&y(m+c))})};return y(0).then(()=>{if(d.length>0)throw new Or("Error modifying one or more objects",d,p,h);return f.length})})})}delete(){var e=this._ctx,n=e.range;return Qt(e)&&(e.isPrimKey&&!_f||n.type===3)?this._write(r=>{const{primaryKey:o}=e.table.core.schema,s=n;return e.table.core.count({trans:r,query:{index:o,range:s}}).then(i=>e.table.core.mutate({trans:r,type:"deleteRange",range:s}).then(({failures:a,lastResult:l,results:u,numFailures:c})=>{if(c)throw new Or("Could not delete some values",Object.keys(a).map(d=>a[d]),i-c);return i-c}))}):this.modify(po)}}const po=(t,e)=>e.value=null;function Ef(t,e){return te?-1:t===e?0:1}function $e(t,e,n){var r=t instanceof Vi?new t.Collection(t):t;return r._ctx.error=n?new n(e):new TypeError(e),r}function en(t){return new t.Collection(t,()=>Hi("")).limit(0)}function Sf(t,e,n,r,o,s){for(var i=Math.min(t.length,r.length),a=-1,l=0;l=0?t.substr(0,a)+e[a]+n.substr(a+1):null;o(t[l],u)<0&&(a=l)}return itypeof f=="string"))return $e(t,Ki);function p(f){o=function(m){return m==="next"?w=>w.toUpperCase():w=>w.toLowerCase()}(f),s=function(m){return m==="next"?w=>w.toLowerCase():w=>w.toUpperCase()}(f),i=f==="next"?Ef:Cf;var y=n.map(function(m){return{lower:s(m),upper:o(m)}}).sort(function(m,w){return i(m.lower,w.lower)});a=y.map(function(m){return m.upper}),l=y.map(function(m){return m.lower}),u=f,c=f==="next"?"":r}p("next");var h=new t.Collection(t,()=>_t(a[0],l[d-1]+r));h._ondirectionchange=function(f){p(f)};var b=0;return h._addAlgorithm(function(f,y,m){var w=f.key;if(typeof w!="string")return!1;var _=s(w);if(e(_,l,b))return!0;for(var k=null,x=b;x0)&&(k=I)}return y(k!==null?function(){f.continue(k+c)}:m),!1}),h}function _t(t,e,n,r){return{type:2,lower:t,upper:e,lowerOpen:n,upperOpen:r}}function Hi(t){return{type:1,lower:t,upper:t}}class Vi{get Collection(){return this._ctx.table.db.Collection}between(e,n,r,o){r=r!==!1,o=o===!0;try{return this._cmp(e,n)>0||this._cmp(e,n)===0&&(r||o)&&(!r||!o)?en(this):new this.Collection(this,()=>_t(e,n,!r,!o))}catch{return $e(this,dt)}}equals(e){return e==null?$e(this,dt):new this.Collection(this,()=>Hi(e))}above(e){return e==null?$e(this,dt):new this.Collection(this,()=>_t(e,void 0,!0))}aboveOrEqual(e){return e==null?$e(this,dt):new this.Collection(this,()=>_t(e,void 0,!1))}below(e){return e==null?$e(this,dt):new this.Collection(this,()=>_t(void 0,e,!1,!0))}belowOrEqual(e){return e==null?$e(this,dt):new this.Collection(this,()=>_t(void 0,e))}startsWith(e){return typeof e!="string"?$e(this,Ki):this.between(e,e+Tt,!0,!0)}startsWithIgnoreCase(e){return e===""?this.startsWith(e):ar(this,(n,r)=>n.indexOf(r[0])===0,[e],Tt)}equalsIgnoreCase(e){return ar(this,(n,r)=>n===r[0],[e],"")}anyOfIgnoreCase(){var e=ht.apply(tn,arguments);return e.length===0?en(this):ar(this,(n,r)=>r.indexOf(n)!==-1,e,"")}startsWithAnyOfIgnoreCase(){var e=ht.apply(tn,arguments);return e.length===0?en(this):ar(this,(n,r)=>r.some(o=>n.indexOf(o)===0),e,Tt)}anyOf(){const e=ht.apply(tn,arguments);let n=this._cmp;try{e.sort(n)}catch{return $e(this,dt)}if(e.length===0)return en(this);const r=new this.Collection(this,()=>_t(e[0],e[e.length-1]));r._ondirectionchange=s=>{n=s==="next"?this._ascending:this._descending,e.sort(n)};let o=0;return r._addAlgorithm((s,i,a)=>{const l=s.key;for(;n(l,e[o])>0;)if(++o,o===e.length)return i(a),!1;return n(l,e[o])===0||(i(()=>{s.continue(e[o])}),!1)}),r}notEqual(e){return this.inAnyRange([[Wo,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=ht.apply(tn,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch{return $e(this,dt)}const n=e.reduce((r,o)=>r?r.concat([[r[r.length-1][1],o]]):[[Wo,o]],null);return n.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,n){const r=this._cmp,o=this._ascending,s=this._descending,i=this._min,a=this._max;if(e.length===0)return en(this);if(!e.every(w=>w[0]!==void 0&&w[1]!==void 0&&o(w[0],w[1])<=0))return $e(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",le.InvalidArgument);const l=!n||n.includeLowers!==!1,u=n&&n.includeUppers===!0;let c,d=o;function p(w,_){return d(w[0],_[0])}try{c=e.reduce(function(w,_){let k=0,x=w.length;for(;k0){I[0]=i(I[0],_[0]),I[1]=a(I[1],_[1]);break}}return k===x&&w.push(_),w},[]),c.sort(p)}catch{return $e(this,dt)}let h=0;const b=u?w=>o(w,c[h][1])>0:w=>o(w,c[h][1])>=0,f=l?w=>s(w,c[h][0])>0:w=>s(w,c[h][0])>=0;let y=b;const m=new this.Collection(this,()=>_t(c[0][0],c[c.length-1][1],!l,!u));return m._ondirectionchange=w=>{w==="next"?(y=b,d=o):(y=f,d=s),c.sort(p)},m._addAlgorithm((w,_,k)=>{for(var x=w.key;y(x);)if(++h,h===c.length)return _(k),!1;return!!function(I){return!b(I)&&!f(I)}(x)||(this._cmp(x,c[h][1])===0||this._cmp(x,c[h][0])===0||_(()=>{d===o?w.continue(c[h][0]):w.continue(c[h][1])}),!1)}),m}startsWithAnyOf(){const e=ht.apply(tn,arguments);return e.every(n=>typeof n=="string")?e.length===0?en(this):this.inAnyRange(e.map(n=>[n,n+Tt])):$e(this,"startsWithAnyOf() only works with strings")}}function st(t){return Ce(function(e){return Mn(e),t(e.target.error),!1})}function Mn(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}const zn="storagemutated",Et="x-storagemutated-1",Dt=Dn(null,zn);class Of{_lock(){return _n(!ae.global),++this._reculock,this._reculock!==1||ae.global||(ae.lockOwnerFor=this),this}_unlock(){if(_n(!ae.global),--this._reculock==0)for(ae.global||(ae.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{mn(e[1],e[0])}catch{}}return this}_locked(){return this._reculock&&ae.lockOwnerFor!==this}create(e){if(!this.mode)return this;const n=this.db.idbdb,r=this.db._state.dbOpenError;if(_n(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new le.DatabaseClosed(r);case"MissingAPIError":throw new le.MissingAPI(r.message,r);default:throw new le.OpenFailed(r)}if(!this.active)throw new le.TransactionInactive;return _n(this._completion._state===null),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=Ce(o=>{Mn(o),this._reject(e.error)}),e.onabort=Ce(o=>{Mn(o),this.active&&this._reject(new le.Abort(e.error)),this.active=!1,this.on("abort").fire(o)}),e.oncomplete=Ce(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&Dt.storagemutated.fire(e.mutatedParts)}),this}_promise(e,n,r){if(e==="readwrite"&&this.mode!=="readwrite")return Fe(new le.ReadOnly("Transaction is readonly"));if(!this.active)return Fe(new le.TransactionInactive);if(this._locked())return new oe((s,i)=>{this._blockedFuncs.push([()=>{this._promise(e,n,r).then(s,i)},ae])});if(r)return Ot(()=>{var s=new oe((i,a)=>{this._lock();const l=n(i,a,this);l&&l.then&&l.then(i,a)});return s.finally(()=>this._unlock()),s._lib=!0,s});var o=new oe((s,i)=>{var a=n(s,i,this);a&&a.then&&a.then(s,i)});return o._lib=!0,o}_root(){return this.parent?this.parent._root():this}waitFor(e){var n=this._root();const r=oe.resolve(e);if(n._waitingFor)n._waitingFor=n._waitingFor.then(()=>r);else{n._waitingFor=r,n._waitingQueue=[];var o=n.idbtrans.objectStore(n.storeNames[0]);(function i(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(o.get(-1/0).onsuccess=i)})()}var s=n._waitingFor;return new oe((i,a)=>{r.then(l=>n._waitingQueue.push(Ce(i.bind(null,l))),l=>n._waitingQueue.push(Ce(a.bind(null,l)))).finally(()=>{n._waitingFor===s&&(n._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new le.Abort))}table(e){const n=this._memoizedTables||(this._memoizedTables={});if(Ze(n,e))return n[e];const r=this.schema[e];if(!r)throw new le.NotFound("Table "+e+" not part of transaction");const o=new this.db.Table(e,r,this);return o.core=this.db.core.table(e),n[e]=o,o}}function Uo(t,e,n,r,o,s,i){return{name:t,keyPath:e,unique:n,multi:r,auto:o,compound:s,src:(n&&!i?"&":"")+(r?"*":"")+(o?"++":"")+Zi(e)}}function Zi(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function Gi(t,e,n){return{name:t,primKey:e,indexes:n,mappedClass:null,idxByName:Si(n,r=>[r.name,r])}}let Ln=t=>{try{return t.only([[]]),Ln=()=>[[]],[[]]}catch{return Ln=()=>Tt,Tt}};function Ko(t){return t==null?()=>{}:typeof t=="string"?function(e){return e.split(".").length===1?r=>r[e]:r=>yt(r,e)}(t):e=>yt(e,t)}function va(t){return[].slice.call(t)}let If=0;function Pn(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Df(t,e,n){function r(l){if(l.type===3)return null;if(l.type===4)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:u,upper:c,lowerOpen:d,upperOpen:p}=l;return u===void 0?c===void 0?null:e.upperBound(c,!!p):c===void 0?e.lowerBound(u,!!d):e.bound(u,c,!!d,!!p)}const{schema:o,hasGetAll:s}=function(l,u){const c=va(l.objectStoreNames);return{schema:{name:l.name,tables:c.map(d=>u.objectStore(d)).map(d=>{const{keyPath:p,autoIncrement:h}=d,b=Me(p),f=p==null,y={},m={name:d.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:f,compound:b,keyPath:p,autoIncrement:h,unique:!0,extractKey:Ko(p)},indexes:va(d.indexNames).map(w=>d.index(w)).map(w=>{const{name:_,unique:k,multiEntry:x,keyPath:I}=w,E={name:_,compound:Me(I),keyPath:I,unique:k,multiEntry:x,extractKey:Ko(I)};return y[Pn(I)]=E,E}),getIndexByKeyPath:w=>y[Pn(w)]};return y[":id"]=m.primaryKey,p!=null&&(y[Pn(p)]=m.primaryKey),m})},hasGetAll:c.length>0&&"getAll"in u.objectStore(c[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(t,n),i=o.tables.map(l=>function(u){const c=u.name;return{name:c,schema:u,mutate:function({trans:d,type:p,keys:h,values:b,range:f}){return new Promise((y,m)=>{y=Ce(y);const w=d.objectStore(c),_=w.keyPath==null,k=p==="put"||p==="add";if(!k&&p!=="delete"&&p!=="deleteRange")throw new Error("Invalid operation type: "+p);const{length:x}=h||b||{length:1};if(h&&b&&h.length!==b.length)throw new Error("Given keys array must have same length as given values array.");if(x===0)return y({numFailures:0,failures:{},results:[],lastResult:void 0});let I;const E=[],N=[];let D=0;const R=P=>{++D,Mn(P)};if(p==="deleteRange"){if(f.type===4)return y({numFailures:D,failures:N,results:[],lastResult:void 0});f.type===3?E.push(I=w.clear()):E.push(I=w.delete(r(f)))}else{const[P,B]=k?_?[b,h]:[b,null]:[h,null];if(k)for(let v=0;v{const B=P.target.result;E.forEach((v,T)=>v.error!=null&&(N[T]=v.error)),y({numFailures:D,failures:N,results:p==="delete"?h:E.map(v=>v.result),lastResult:B})};I.onerror=P=>{R(P),K(P)},I.onsuccess=K})},getMany:({trans:d,keys:p})=>new Promise((h,b)=>{h=Ce(h);const f=d.objectStore(c),y=p.length,m=new Array(y);let w,_=0,k=0;const x=E=>{const N=E.target;m[N._pos]=N.result,++k===_&&h(m)},I=st(b);for(let E=0;Enew Promise((h,b)=>{h=Ce(h);const f=d.objectStore(c).get(p);f.onsuccess=y=>h(y.target.result),f.onerror=st(b)}),query:function(d){return p=>new Promise((h,b)=>{h=Ce(h);const{trans:f,values:y,limit:m,query:w}=p,_=m===1/0?void 0:m,{index:k,range:x}=w,I=f.objectStore(c),E=k.isPrimaryKey?I:I.index(k.name),N=r(x);if(m===0)return h({result:[]});if(d){const D=y?E.getAll(N,_):E.getAllKeys(N,_);D.onsuccess=R=>h({result:R.target.result}),D.onerror=st(b)}else{let D=0;const R=y||!("openKeyCursor"in E)?E.openCursor(N):E.openKeyCursor(N),K=[];R.onsuccess=P=>{const B=R.result;return B?(K.push(y?B.value:B.primaryKey),++D===m?h({result:K}):void B.continue()):h({result:K})},R.onerror=st(b)}})}(s),openCursor:function({trans:d,values:p,query:h,reverse:b,unique:f}){return new Promise((y,m)=>{y=Ce(y);const{index:w,range:_}=h,k=d.objectStore(c),x=w.isPrimaryKey?k:k.index(w.name),I=b?f?"prevunique":"prev":f?"nextunique":"next",E=p||!("openKeyCursor"in x)?x.openCursor(r(_),I):x.openKeyCursor(r(_),I);E.onerror=st(m),E.onsuccess=Ce(N=>{const D=E.result;if(!D)return void y(null);D.___id=++If,D.done=!1;const R=D.continue.bind(D);let K=D.continuePrimaryKey;K&&(K=K.bind(D));const P=D.advance.bind(D),B=()=>{throw new Error("Cursor not stopped")};D.trans=d,D.stop=D.continue=D.continuePrimaryKey=D.advance=()=>{throw new Error("Cursor not started")},D.fail=Ce(m),D.next=function(){let v=1;return this.start(()=>v--?this.continue():this.stop()).then(()=>this)},D.start=v=>{const T=new Promise((A,X)=>{A=Ce(A),E.onerror=st(X),D.fail=X,D.stop=$=>{D.stop=D.continue=D.continuePrimaryKey=D.advance=B,A($)}}),H=()=>{if(E.result)try{v()}catch(A){D.fail(A)}else D.done=!0,D.start=()=>{throw new Error("Cursor behind last entry")},D.stop()};return E.onsuccess=Ce(A=>{E.onsuccess=H,H()}),D.continue=R,D.continuePrimaryKey=K,D.advance=P,H(),T},y(D)},m)})},count({query:d,trans:p}){const{index:h,range:b}=d;return new Promise((f,y)=>{const m=p.objectStore(c),w=h.isPrimaryKey?m:m.index(h.name),_=r(b),k=_?w.count(_):w.count();k.onsuccess=Ce(x=>f(x.target.result)),k.onerror=st(y)})}}}(l)),a={};return i.forEach(l=>a[l.name]=l),{stack:"dbcore",transaction:t.transaction.bind(t),table(l){if(!a[l])throw new Error(`Table '${l}' not found`);return a[l]},MIN_KEY:-1/0,MAX_KEY:Ln(e),schema:o}}function $o({_novip:t},e){const n=e.db,r=function(o,s,{IDBKeyRange:i,indexedDB:a},l){return{dbcore:function(c,d){return d.reduce((p,{create:h})=>({...p,...h(p)}),c)}(Df(s,i,l),o.dbcore)}}(t._middlewares,n,t._deps,e);t.core=r.dbcore,t.tables.forEach(o=>{const s=o.name;t.core.schema.tables.some(i=>i.name===s)&&(o.core=t.core.table(s),t[s]instanceof t.Table&&(t[s].core=o.core))})}function Ar({_novip:t},e,n,r){n.forEach(o=>{const s=r[o];e.forEach(i=>{const a=Ds(i,o);(!a||"value"in a&&a.value===void 0)&&(i===t.Transaction.prototype||i instanceof t.Transaction?mt(i,o,{get(){return this.table(o)},set(l){xi(this,o,{value:l,writable:!0,configurable:!0,enumerable:!0})}}):i[o]=new t.Table(o,s))})})}function qo({_novip:t},e){e.forEach(n=>{for(let r in n)n[r]instanceof t.Table&&delete n[r]})}function Pf(t,e){return t._cfg.version-e._cfg.version}function jf(t,e,n,r){const o=t._dbSchema,s=t._createTransaction("readwrite",t._storeNames,o);s.create(n),s._completion.catch(r);const i=s._reject.bind(s),a=ae.transless||ae;Ot(()=>{ae.trans=s,ae.transless=a,e===0?(Ne(o).forEach(l=>{mo(n,l,o[l].primKey,o[l].indexes)}),$o(t,n),oe.follow(()=>t.on.populate.fire(s)).catch(i)):function({_novip:l},u,c,d){const p=[],h=l._versions;let b=l._dbSchema=Vo(l,l.idbdb,d),f=!1;const y=h.filter(w=>w._cfg.version>=u);function m(){return p.length?oe.resolve(p.shift()(c.idbtrans)).then(m):oe.resolve()}return y.forEach(w=>{p.push(()=>{const _=b,k=w._cfg.dbschema;Zo(l,_,d),Zo(l,k,d),b=l._dbSchema=k;const x=Yi(_,k);x.add.forEach(E=>{mo(d,E[0],E[1].primKey,E[1].indexes)}),x.change.forEach(E=>{if(E.recreate)throw new le.Upgrade("Not yet support for changing primary key");{const N=d.objectStore(E.name);E.add.forEach(D=>Ho(N,D)),E.change.forEach(D=>{N.deleteIndex(D.name),Ho(N,D)}),E.del.forEach(D=>N.deleteIndex(D))}});const I=w._cfg.contentUpgrade;if(I&&w._cfg.version>u){$o(l,d),c._memoizedTables={},f=!0;let E=Oi(k);x.del.forEach(K=>{E[K]=_[K]}),qo(l,[l.Transaction.prototype]),Ar(l,[l.Transaction.prototype],Ne(E),E),c.schema=E;const N=Ps(I);let D;N&&pn();const R=oe.follow(()=>{if(D=I(c),D&&N){var K=gt.bind(null,null);D.then(K,K)}});return D&&typeof D.then=="function"?oe.resolve(D):R.then(()=>D)}}),p.push(_=>{(!f||!bf)&&function(k,x){[].slice.call(x.db.objectStoreNames).forEach(I=>k[I]==null&&x.db.deleteObjectStore(I))}(w._cfg.dbschema,_),qo(l,[l.Transaction.prototype]),Ar(l,[l.Transaction.prototype],l._storeNames,l._dbSchema),c.schema=l._dbSchema})}),m().then(()=>{var w,_;_=d,Ne(w=b).forEach(k=>{_.db.objectStoreNames.contains(k)||mo(_,k,w[k].primKey,w[k].indexes)})})}(t,e,s,n).catch(i)})}function Yi(t,e){const n={del:[],add:[],change:[]};let r;for(r in t)e[r]||n.del.push(r);for(r in e){const o=t[r],s=e[r];if(o){const i={name:r,def:s,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(s.primKey.keyPath||"")||o.primKey.auto!==s.primKey.auto&&!Qr)i.recreate=!0,n.change.push(i);else{const a=o.idxByName,l=s.idxByName;let u;for(u in a)l[u]||i.del.push(u);for(u in l){const c=a[u],d=l[u];c?c.src!==d.src&&i.change.push(d):i.add.push(d)}(i.del.length>0||i.add.length>0||i.change.length>0)&&n.change.push(i)}}else n.add.push([r,s])}return n}function mo(t,e,n,r){const o=t.db.createObjectStore(e,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(s=>Ho(o,s)),o}function Ho(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function Vo(t,e,n){const r={};return Sr(e.objectStoreNames,0).forEach(o=>{const s=n.objectStore(o);let i=s.keyPath;const a=Uo(Zi(i),i||"",!1,!1,!!s.autoIncrement,i&&typeof i!="string",!0),l=[];for(let c=0;c{if(e[r]!==null){var o=e[r].split(",").map((i,a)=>{const l=(i=i.trim()).replace(/([&*]|\+\+)/g,""),u=/^\[/.test(l)?l.match(/^\[(.*)\]$/)[1].split("+"):l;return Uo(l,u||null,/\&/.test(i),/\*/.test(i),/\+\+/.test(i),Me(u),a===0)}),s=o.shift();if(s.multi)throw new le.Schema("Primary key cannot be multi-valued");o.forEach(i=>{if(i.auto)throw new le.Schema("Only primary key can be marked as autoIncrement (++)");if(!i.keyPath)throw new le.Schema("Index must have a name and cannot be an empty string")}),n[r]=Gi(r,s,o)}})}stores(e){const n=this.db;this._cfg.storesSource=this._cfg.storesSource?We(this._cfg.storesSource,e):e;const r=n._versions,o={};let s={};return r.forEach(i=>{We(o,i._cfg.storesSource),s=i._cfg.dbschema={},i._parseStoresSpec(o,s)}),n._dbSchema=s,qo(n,[n._allTables,n,n.Transaction.prototype]),Ar(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],Ne(s),s),n._storeNames=Ne(s),this}upgrade(e){return this._cfg.contentUpgrade=Ns(this._cfg.contentUpgrade||be,e),this}}function Bs(t,e){let n=t._dbNamesDB;return n||(n=t._dbNamesDB=new Kt(eo,{addons:[],indexedDB:t,IDBKeyRange:e}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Ms(t){return t&&typeof t.databases=="function"}function Go(t){return Ot(function(){return ae.letThrough=!0,t()})}function Nf(){var t;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(e){var n=function(){return indexedDB.databases().finally(e)};t=setInterval(n,100),n()}).finally(function(){return clearInterval(t)}):Promise.resolve()}function Ff(t){const e=t._state,{indexedDB:n}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then(()=>e.dbOpenError?Fe(e.dbOpenError):t);ct&&(e.openCanceller._stackHolder=Gt()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;const r=e.openCanceller;function o(){if(e.openCanceller!==r)throw new le.DatabaseClosed("db.open() was cancelled")}let s=e.dbReadyResolve,i=null,a=!1;return oe.race([r,(typeof navigator>"u"?oe.resolve():Nf()).then(()=>new oe((l,u)=>{if(o(),!n)throw new le.MissingAPI;const c=t.name,d=e.autoSchema?n.open(c):n.open(c,Math.round(10*t.verno));if(!d)throw new le.MissingAPI;d.onerror=st(u),d.onblocked=Ce(t._fireOnBlocked),d.onupgradeneeded=Ce(p=>{if(i=d.transaction,e.autoSchema&&!t._options.allowEmptyDB){d.onerror=Mn,i.abort(),d.result.close();const b=n.deleteDatabase(c);b.onsuccess=b.onerror=Ce(()=>{u(new le.NoSuchDatabase(`Database ${c} doesnt exist`))})}else{i.onerror=st(u);var h=p.oldVersion>Math.pow(2,62)?0:p.oldVersion;a=h<1,t._novip.idbdb=d.result,jf(t,h/10,i,u)}},u),d.onsuccess=Ce(()=>{i=null;const p=t._novip.idbdb=d.result,h=Sr(p.objectStoreNames);if(h.length>0)try{const f=p.transaction((b=h).length===1?b[0]:b,"readonly");e.autoSchema?function({_novip:y},m,w){y.verno=m.version/10;const _=y._dbSchema=Vo(0,m,w);y._storeNames=Sr(m.objectStoreNames,0),Ar(y,[y._allTables],Ne(_),_)}(t,p,f):(Zo(t,t._dbSchema,f),function(y,m){const w=Yi(Vo(0,y.idbdb,m),y._dbSchema);return!(w.add.length||w.change.some(_=>_.add.length||_.change.length))}(t,f)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),$o(t,f)}catch{}var b;In.push(t),p.onversionchange=Ce(f=>{e.vcFired=!0,t.on("versionchange").fire(f)}),p.onclose=Ce(f=>{t.on("close").fire(f)}),a&&function({indexedDB:f,IDBKeyRange:y},m){!Ms(f)&&m!==eo&&Bs(f,y).put({name:m}).catch(be)}(t._deps,c),l()},u)}))]).then(()=>(o(),e.onReadyBeingFired=[],oe.resolve(Go(()=>t.on.ready.fire(t.vip))).then(function l(){if(e.onReadyBeingFired.length>0){let u=e.onReadyBeingFired.reduce(Ns,be);return e.onReadyBeingFired=[],oe.resolve(Go(()=>u(t.vip))).then(l)}}))).finally(()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1}).then(()=>t).catch(l=>{e.dbOpenError=l;try{i&&i.abort()}catch{}return r===e.openCanceller&&t._close(),Fe(l)}).finally(()=>{e.openComplete=!0,s()})}function Yo(t){var e=s=>t.next(s),n=o(e),r=o(s=>t.throw(s));function o(s){return i=>{var a=s(i),l=a.value;return a.done?l:l&&typeof l.then=="function"?l.then(n,r):Me(l)?Promise.all(l).then(n,r):n(l)}}return o(e)()}function Rf(t,e,n){var r=arguments.length;if(r<2)throw new le.InvalidArgument("Too few arguments");for(var o=new Array(r-1);--r;)o[r-1]=arguments[r];return n=o.pop(),[t,Ii(o),n]}function Ji(t,e,n,r,o){return oe.resolve().then(()=>{const s=ae.transless||ae,i=t._createTransaction(e,n,t._dbSchema,r),a={trans:i,transless:s};if(r)i.idbtrans=r.idbtrans;else try{i.create(),t._state.PR1398_maxLoop=3}catch(d){return d.name===As.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>Ji(t,e,n,null,o))):Fe(d)}const l=Ps(o);let u;l&&pn();const c=oe.follow(()=>{if(u=o.call(i,i),u)if(l){var d=gt.bind(null,null);u.then(d,d)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=Yo(u))},a);return(u&&typeof u.then=="function"?oe.resolve(u).then(d=>i.active?d:Fe(new le.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):c.then(()=>u)).then(d=>(r&&i._resolve(),i._completion.then(()=>d))).catch(d=>(i._reject(d),Fe(d)))})}function ir(t,e,n){const r=Me(t)?t.slice():[t];for(let o=0;o0,m={...p,isVirtual:y,keyTail:d,keyLength:f,extractKey:Ko(c),unique:!y&&p.unique};return b.push(m),m.isPrimaryKey||s.push(m),f>1&&i(f===2?c[0]:c.slice(0,f-1),d+1,p),b.sort((w,_)=>w.keyTail-_.keyTail),m}const a=i(r.primaryKey.keyPath,0,r.primaryKey);o[":id"]=[a];for(const c of r.indexes)i(c.keyPath,0,c);function l(c){const d=c.query.index;return d.isVirtual?{...c,query:{index:d,range:(p=c.query.range,h=d.keyTail,{type:p.type===1?2:p.type,lower:ir(p.lower,p.lowerOpen?t.MAX_KEY:t.MIN_KEY,h),lowerOpen:!0,upper:ir(p.upper,p.upperOpen?t.MIN_KEY:t.MAX_KEY,h),upperOpen:!0})}}:c;var p,h}return{...n,schema:{...r,primaryKey:a,indexes:s,getIndexByKeyPath:function(c){const d=o[Pn(c)];return d&&d[0]}},count:c=>n.count(l(c)),query:c=>n.query(l(c)),openCursor(c){const{keyTail:d,isVirtual:p,keyLength:h}=c.query.index;return p?n.openCursor(l(c)).then(b=>b&&function(f){return Object.create(f,{continue:{value:function(m){m!=null?f.continue(ir(m,c.reverse?t.MAX_KEY:t.MIN_KEY,d)):c.unique?f.continue(f.key.slice(0,h).concat(c.reverse?t.MIN_KEY:t.MAX_KEY,d)):f.continue()}},continuePrimaryKey:{value(m,w){f.continuePrimaryKey(ir(m,t.MAX_KEY,d),w)}},primaryKey:{get:()=>f.primaryKey},key:{get(){const m=f.key;return h===1?m[0]:m.slice(0,h)}},value:{get:()=>f.value}})}(b)):n.openCursor(c)}}}}}};function zs(t,e,n,r){return n=n||{},r=r||"",Ne(t).forEach(o=>{if(Ze(e,o)){var s=t[o],i=e[o];if(typeof s=="object"&&typeof i=="object"&&s&&i){const a=Do(s);a!==Do(i)?n[r+o]=e[o]:a==="Object"?zs(s,i,n,r+o+"."):s!==i&&(n[r+o]=e[o])}else s!==i&&(n[r+o]=e[o])}else n[r+o]=void 0}),Ne(e).forEach(o=>{Ze(t,o)||(n[r+o]=e[o])}),n}const Bf={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>({...t,table(e){const n=t.table(e),{primaryKey:r}=n.schema;return{...n,mutate(s){const i=ae.trans,{deleting:a,creating:l,updating:u}=i.table(e).hook;switch(s.type){case"add":if(l.fire===be)break;return i._promise("readwrite",()=>c(s),!0);case"put":if(l.fire===be&&u.fire===be)break;return i._promise("readwrite",()=>c(s),!0);case"delete":if(a.fire===be)break;return i._promise("readwrite",()=>c(s),!0);case"deleteRange":if(a.fire===be)break;return i._promise("readwrite",()=>function(p){return d(p.trans,p.range,1e4)}(s),!0)}return n.mutate(s);function c(p){const h=ae.trans,b=p.keys||function(f,y){return y.type==="delete"?y.keys:y.keys||y.values.map(f.extractKey)}(r,p);if(!b)throw new Error("Keys missing");return(p=p.type==="add"||p.type==="put"?{...p,keys:b}:{...p}).type!=="delete"&&(p.values=[...p.values]),p.keys&&(p.keys=[...p.keys]),function(f,y,m){return y.type==="add"?Promise.resolve([]):f.getMany({trans:y.trans,keys:m,cache:"immutable"})}(n,p,b).then(f=>{const y=b.map((m,w)=>{const _=f[w],k={onerror:null,onsuccess:null};if(p.type==="delete")a.fire.call(k,m,_,h);else if(p.type==="add"||_===void 0){const x=l.fire.call(k,m,p.values[w],h);m==null&&x!=null&&(m=x,p.keys[w]=m,r.outbound||nt(p.values[w],r.keyPath,m))}else{const x=zs(_,p.values[w]),I=u.fire.call(k,x,m,_,h);if(I){const E=p.values[w];Object.keys(I).forEach(N=>{Ze(E,N)?E[N]=I[N]:nt(E,N,I[N])})}}return k});return n.mutate(p).then(({failures:m,results:w,numFailures:_,lastResult:k})=>{for(let x=0;x(y.forEach(w=>w.onerror&&w.onerror(m)),Promise.reject(m)))})}function d(p,h,b){return n.query({trans:p,values:!1,query:{index:r,range:h},limit:b}).then(({result:f})=>c({type:"delete",keys:f,trans:p}).then(y=>y.numFailures>0?Promise.reject(y.failures[0]):f.length({table:e=>{const n=t.table(e);return{...n,getMany:r=>{if(!r.cache)return n.getMany(r);const o=Xi(r.keys,r.trans._cache,r.cache==="clone");return o?oe.resolve(o):n.getMany(r).then(s=>(r.trans._cache={keys:r.keys,values:r.cache==="clone"?Vn(s):s},s))},mutate:r=>(r.type!=="add"&&(r.trans._cache=null),n.mutate(r))}}})};function Ls(t){return!("from"in t)}const ft=function(t,e){if(!this){const n=new ft;return t&&"d"in t&&We(n,t),n}We(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0})};function Wn(t,e,n){const r=ze(e,n);if(isNaN(r))return;if(r>0)throw RangeError();if(Ls(t))return We(t,{from:e,to:n,d:1});const o=t.l,s=t.r;if(ze(n,t.from)<0)return o?Wn(o,e,n):t.l={from:e,to:n,d:1,l:null,r:null},ga(t);if(ze(e,t.to)>0)return s?Wn(s,e,n):t.r={from:e,to:n,d:1,l:null,r:null},ga(t);ze(e,t.from)<0&&(t.from=e,t.l=null,t.d=s?s.d+1:1),ze(n,t.to)>0&&(t.to=n,t.r=null,t.d=t.l?t.l.d+1:1);const i=!t.r;o&&!t.l&&Nr(t,o),s&&i&&Nr(t,s)}function Nr(t,e){Ls(e)||function n(r,{from:o,to:s,l:i,r:a}){Wn(r,o,s),i&&n(r,i),a&&n(r,a)}(t,e)}function zf(t,e){const n=Jo(e);let r=n.next();if(r.done)return!1;let o=r.value;const s=Jo(t);let i=s.next(o.from),a=i.value;for(;!r.done&&!i.done;){if(ze(a.from,o.to)<=0&&ze(a.to,o.from)>=0)return!0;ze(o.from,a.from)<0?o=(r=n.next(a.from)).value:a=(i=s.next(o.from)).value}return!1}function Jo(t){let e=Ls(t)?null:{s:0,n:t};return{next(n){const r=arguments.length>0;for(;e;)switch(e.s){case 0:if(e.s=1,r)for(;e.n.l&&ze(n,e.n.from)<0;)e={up:e,n:e.n.l,s:1};else for(;e.n.l;)e={up:e,n:e.n.l,s:1};case 1:if(e.s=2,!r||ze(n,e.n.to)<=0)return{value:e.n,done:!1};case 2:if(e.n.r){e.s=3,e={up:e,n:e.n.r,s:0};continue}case 3:e=e.up}return{done:!0}}}}function ga(t){var e,n;const r=(((e=t.r)===null||e===void 0?void 0:e.d)||0)-(((n=t.l)===null||n===void 0?void 0:n.d)||0),o=r>1?"r":r<-1?"l":"";if(o){const s=o==="r"?"l":"r",i={...t},a=t[o];t.from=a.from,t.to=a.to,t[o]=a[o],i[o]=a[s],t[s]=i,i.d=wa(i)}t.d=wa(t)}function wa({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}fn(ft.prototype,{add(t){return Nr(this,t),this},addKey(t){return Wn(this,t,t),this},addKeys(t){return t.forEach(e=>Wn(this,e,e)),this},[Po](){return Jo(this)}});const Lf={stack:"dbcore",level:0,create:t=>{const e=t.schema.name,n=new ft(t.MIN_KEY,t.MAX_KEY);return{...t,table:r=>{const o=t.table(r),{schema:s}=o,{primaryKey:i}=s,{extractKey:a,outbound:l}=i,u={...o,mutate:p=>{const h=p.trans,b=h.mutatedParts||(h.mutatedParts={}),f=I=>{const E=`idb://${e}/${r}/${I}`;return b[E]||(b[E]=new ft)},y=f(""),m=f(":dels"),{type:w}=p;let[_,k]=p.type==="deleteRange"?[p.range]:p.type==="delete"?[p.keys]:p.values.length<50?[[],p.values]:[];const x=p.trans._cache;return o.mutate(p).then(I=>{if(Me(_)){w!=="delete"&&(_=I.results),y.addKeys(_);const E=Xi(_,x);E||w==="add"||m.addKeys(_),(E||k)&&function(N,D,R,K){function P(B){const v=N(B.name||"");function T(A){return A!=null?B.extractKey(A):null}const H=A=>B.multiEntry&&Me(A)?A.forEach(X=>v.addKey(X)):v.addKey(A);(R||K).forEach((A,X)=>{const $=R&&T(R[X]),ne=K&&T(K[X]);ze($,ne)!==0&&($!=null&&H($),ne!=null&&H(ne))})}D.indexes.forEach(P)}(f,s,E,k)}else if(_){const E={from:_.lower,to:_.upper};m.add(E),y.add(E)}else y.add(n),m.add(n),s.indexes.forEach(E=>f(E.name).add(n));return I})}},c=({query:{index:p,range:h}})=>{var b,f;return[p,new ft((b=h.lower)!==null&&b!==void 0?b:t.MIN_KEY,(f=h.upper)!==null&&f!==void 0?f:t.MAX_KEY)]},d={get:p=>[i,new ft(p.key)],getMany:p=>[i,new ft().addKeys(p.keys)],count:c,query:c,openCursor:c};return Ne(d).forEach(p=>{u[p]=function(h){const{subscr:b}=ae;if(b){const f=k=>{const x=`idb://${e}/${r}/${k}`;return b[x]||(b[x]=new ft)},y=f(""),m=f(":dels"),[w,_]=d[p](h);if(f(w.name||"").add(_),!w.isPrimaryKey){if(p!=="count"){const k=p==="query"&&l&&h.values&&o.query({...h,values:!1});return o[p].apply(this,arguments).then(x=>{if(p==="query"){if(l&&h.values)return k.then(({result:E})=>(y.addKeys(E),x));const I=h.values?x.result.map(a):x.result;h.values?y.addKeys(I):m.addKeys(I)}else if(p==="openCursor"){const I=x,E=h.values;return I&&Object.create(I,{key:{get:()=>(m.addKey(I.primaryKey),I.key)},primaryKey:{get(){const N=I.primaryKey;return m.addKey(N),N}},value:{get:()=>(E&&y.addKey(I.primaryKey),I.value)}})}return x})}m.add(n)}}return o[p].apply(this,arguments)}}),u}}}};class Kt{constructor(e,n){this._middlewares={},this.verno=0;const r=Kt.dependencies;this._options=n={addons:Kt.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange,...n},this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};const{addons:o}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:be,dbReadyPromise:null,cancelOpen:be,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var i;s.dbReadyPromise=new oe(a=>{s.dbReadyResolve=a}),s.openCanceller=new oe((a,l)=>{s.cancelOpen=l}),this._state=s,this.name=e,this.on=Dn(this,"populate","blocked","versionchange","close",{ready:[Ns,be]}),this.on.ready.subscribe=Ei(this.on.ready.subscribe,a=>(l,u)=>{Kt.vip(()=>{const c=this._state;if(c.openComplete)c.dbOpenError||oe.resolve().then(l),u&&a(l);else if(c.onReadyBeingFired)c.onReadyBeingFired.push(l),u&&a(l);else{a(l);const d=this;u||a(function p(){d.on.ready.unsubscribe(l),d.on.ready.unsubscribe(p)})}})}),this.Collection=(i=this,bn(xf.prototype,function(a,l){this.db=i;let u=qi,c=null;if(l)try{u=l()}catch(b){c=b}const d=a._ctx,p=d.table,h=p.hook.reading.fire;this._ctx={table:p,index:d.index,isPrimKey:!d.index||p.schema.primKey.keyPath&&d.index===p.schema.primKey.name,range:u,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:c,or:d.or,valueMapper:h!==Tn?h:null}})),this.Table=function(a){return bn(kf.prototype,function(l,u,c){this.db=a,this._tx=c,this.name=l,this.schema=u,this.hook=a._allTables[l]?a._allTables[l].hook:Dn(null,{creating:[uf,be],reading:[cf,Tn],updating:[ff,be],deleting:[df,be]})})}(this),this.Transaction=function(a){return bn(Of.prototype,function(l,u,c,d,p){this.db=a,this.mode=l,this.storeNames=u,this.schema=c,this.chromeTransactionDurability=d,this.idbtrans=null,this.on=Dn(this,"complete","error","abort"),this.parent=p||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new oe((h,b)=>{this._resolve=h,this._reject=b}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},h=>{var b=this.active;return this.active=!1,this.on.error.fire(h),this.parent?this.parent._reject(h):b&&this.idbtrans&&this.idbtrans.abort(),Fe(h)})})}(this),this.Version=function(a){return bn(Af.prototype,function(l){this.db=a,this._cfg={version:l,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(a){return bn(Vi.prototype,function(l,u,c){this.db=a,this._ctx={table:l,index:u===":id"?null:u,or:c};const d=a._deps.indexedDB;if(!d)throw new le.MissingAPI;this._cmp=this._ascending=d.cmp.bind(d),this._descending=(p,h)=>d.cmp(h,p),this._max=(p,h)=>d.cmp(p,h)>0?p:h,this._min=(p,h)=>d.cmp(p,h)<0?p:h,this._IDBKeyRange=a._deps.IDBKeyRange})}(this),this.on("versionchange",a=>{a.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()}),this.on("blocked",a=>{!a.newVersion||a.newVersionnew this.Transaction(a,l,u,this._options.chromeTransactionDurability,c),this._fireOnBlocked=a=>{this.on("blocked").fire(a),In.filter(l=>l.name===this.name&&l!==this&&!l._state.vcFired).map(l=>l.on("versionchange").fire(a))},this.use(Tf),this.use(Bf),this.use(Lf),this.use(Mf),this.vip=Object.create(this,{_vip:{value:!0}}),o.forEach(a=>a(this))}version(e){if(isNaN(e)||e<.1)throw new le.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new le.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);const n=this._versions;var r=n.filter(o=>o._cfg.version===e)[0];return r||(r=new this.Version(e),n.push(r),n.sort(Pf),r.stores({}),this._state.autoSchema=!1,r)}_whenReady(e){return this.idbdb&&(this._state.openComplete||ae.letThrough||this._vip)?e():new oe((n,r)=>{if(this._state.openComplete)return r(new le.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void r(new le.DatabaseClosed);this.open().catch(be)}this._state.dbReadyPromise.then(n,r)}).then(e)}use({stack:e,create:n,level:r,name:o}){o&&this.unuse({stack:e,name:o});const s=this._middlewares[e]||(this._middlewares[e]=[]);return s.push({stack:e,create:n,level:r??10,name:o}),s.sort((i,a)=>i.level-a.level),this}unuse({stack:e,name:n,create:r}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter(o=>r?o.create!==r:!!n&&o.name!==n)),this}open(){return Ff(this)}_close(){const e=this._state,n=In.indexOf(this);if(n>=0&&In.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}e.dbReadyPromise=new oe(r=>{e.dbReadyResolve=r}),e.openCanceller=new oe((r,o)=>{e.cancelOpen=o})}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new le.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,n=this._state;return new oe((r,o)=>{const s=()=>{this.close();var i=this._deps.indexedDB.deleteDatabase(this.name);i.onsuccess=Ce(()=>{(function({indexedDB:a,IDBKeyRange:l},u){!Ms(a)&&u!==eo&&Bs(a,l).delete(u).catch(be)})(this._deps,this.name),r()}),i.onerror=st(o),i.onblocked=this._fireOnBlocked};if(e)throw new le.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(s):s()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){const e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return Ne(this._allTables).map(e=>this._allTables[e])}transaction(){const e=Rf.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,n,r){let o=ae.trans;o&&o.db===this&&e.indexOf("!")===-1||(o=null);const s=e.indexOf("?")!==-1;let i,a;e=e.replace("!","").replace("?","");try{if(a=n.map(u=>{var c=u instanceof this.Table?u.name:u;if(typeof c!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return c}),e=="r"||e===co)i=co;else{if(e!="rw"&&e!=uo)throw new le.InvalidArgument("Invalid transaction mode: "+e);i=uo}if(o){if(o.mode===co&&i===uo){if(!s)throw new le.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o=null}o&&a.forEach(u=>{if(o&&o.storeNames.indexOf(u)===-1){if(!s)throw new le.SubTransaction("Table "+u+" not included in parent transaction.");o=null}}),s&&o&&!o.active&&(o=null)}}catch(u){return o?o._promise(null,(c,d)=>{d(u)}):Fe(u)}const l=Ji.bind(null,this,i,a,o,r);return o?o._promise(i,l,"lock"):ae.trans?mn(ae.transless,()=>this._whenReady(l)):this._whenReady(l)}table(e){if(!Ze(this._allTables,e))throw new le.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}const Wf=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class Uf{constructor(e){this._subscribe=e}subscribe(e,n,r){return this._subscribe(e&&typeof e!="function"?e:{next:e,error:n,complete:r})}[Wf](){return this}}function Qi(t,e){return Ne(e).forEach(n=>{Nr(t[n]||(t[n]=new ft),e[n])}),t}function Kf(t){let e,n=!1;const r=new Uf(o=>{const s=Ps(t);let i=!1,a={},l={};const u={get closed(){return i},unsubscribe:()=>{i=!0,Dt.storagemutated.unsubscribe(h)}};o.start&&o.start(u);let c=!1,d=!1;function p(){return Ne(l).some(f=>a[f]&&zf(a[f],l[f]))}const h=f=>{Qi(a,f),p()&&b()},b=()=>{if(c||i)return;a={};const f={},y=function(m){s&&pn();const w=()=>Ot(t,{subscr:m,trans:null}),_=ae.trans?mn(ae.transless,w):w();return s&&_.then(gt,gt),_}(f);d||(Dt(zn,h),d=!0),c=!0,Promise.resolve(y).then(m=>{n=!0,e=m,c=!1,i||(p()?b():(a={},l=f,o.next&&o.next(m)))},m=>{c=!1,n=!1,o.error&&o.error(m),u.unsubscribe()})};return b(),u});return r.hasValue=()=>n,r.getValue=()=>e,r}let Xo;try{Xo={indexedDB:Ee.indexedDB||Ee.mozIndexedDB||Ee.webkitIndexedDB||Ee.msIndexedDB,IDBKeyRange:Ee.IDBKeyRange||Ee.webkitIDBKeyRange}}catch{Xo={indexedDB:null,IDBKeyRange:null}}const Rt=Kt;function vr(t){let e=pt;try{pt=!0,Dt.storagemutated.fire(t)}finally{pt=e}}fn(Rt,{...dr,delete:t=>new Rt(t,{addons:[]}).delete(),exists:t=>new Rt(t,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(t){try{return function({indexedDB:e,IDBKeyRange:n}){return Ms(e)?Promise.resolve(e.databases()).then(r=>r.map(o=>o.name).filter(o=>o!==eo)):Bs(e,n).toCollection().primaryKeys()}(Rt.dependencies).then(t)}catch{return Fe(new le.MissingAPI)}},defineClass:()=>function(t){We(this,t)},ignoreTransaction:t=>ae.trans?mn(ae.transless,t):t(),vip:Go,async:function(t){return function(){try{var e=Yo(t.apply(this,arguments));return e&&typeof e.then=="function"?e:oe.resolve(e)}catch(n){return Fe(n)}}},spawn:function(t,e,n){try{var r=Yo(t.apply(n,e||[]));return r&&typeof r.then=="function"?r:oe.resolve(r)}catch(o){return Fe(o)}},currentTransaction:{get:()=>ae.trans||null},waitFor:function(t,e){const n=oe.resolve(typeof t=="function"?Rt.ignoreTransaction(t):t).timeout(e||6e4);return ae.trans?ae.trans.waitFor(n):n},Promise:oe,debug:{get:()=>ct,set:t=>{Pi(t,t==="dexie"?()=>!0:$i)}},derive:on,extend:We,props:fn,override:Ei,Events:Dn,on:Dt,liveQuery:Kf,extendObservabilitySet:Qi,getByKeyPath:yt,setByKeyPath:nt,delByKeyPath:function(t,e){typeof e=="string"?nt(t,e,void 0):"length"in e&&[].map.call(e,function(n){nt(t,n,void 0)})},shallowClone:Oi,deepClone:Vn,getObjectDiff:zs,cmp:ze,asap:Ci,minKey:Wo,addons:[],connections:In,errnames:As,dependencies:Xo,semVer:fa,version:fa.split(".").map(t=>parseInt(t)).reduce((t,e,n)=>t+e/Math.pow(10,2*n))}),Rt.maxKey=Ln(Rt.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(Dt(zn,t=>{if(!pt){let e;Qr?(e=document.createEvent("CustomEvent"),e.initCustomEvent(Et,!0,!0,t)):e=new CustomEvent(Et,{detail:t}),pt=!0,dispatchEvent(e),pt=!1}}),addEventListener(Et,({detail:t})=>{pt||vr(t)}));let pt=!1;if(typeof BroadcastChannel<"u"){const t=new BroadcastChannel(Et);typeof t.unref=="function"&&t.unref(),Dt(zn,e=>{pt||t.postMessage(e)}),t.onmessage=e=>{e.data&&vr(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){Dt(zn,e=>{try{pt||(typeof localStorage<"u"&&localStorage.setItem(Et,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(n=>n.postMessage({type:Et,changedParts:e})))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",e=>{if(e.key===Et){const n=JSON.parse(e.newValue);n&&vr(n.changedParts)}});const t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",function({data:e}){e&&e.type===Et&&vr(e.changedParts)})}oe.rejectionMapper=function(t,e){if(!t||t instanceof sn||t instanceof TypeError||t instanceof SyntaxError||!t.name||!la[t.name])return t;var n=new la[t.name](e||t.message,t);return"stack"in t&&mt(n,"stack",{get:function(){return this.inner.stack}}),n},Pi(ct,$i);var $f=(t=>(t.SAVE="save",t.SAVE_AS="saveAs",t.openSpotlightSearch="openSpotlightSearch",t))($f||{}),gr=(t=>(t.MOVE_TO_ROOT_FOLDER="moveToRootFolder",t.DELETE="delete",t))(gr||{});const qf="comfyui_workspace_db";class Hf extends Kt{constructor(){super(qf);Se(this,"workflows");Se(this,"changelogs");Se(this,"media");Se(this,"folders");Se(this,"tags");Se(this,"userSettings");Se(this,"models");Se(this,"cache");Se(this,"workflowVersions");this.version(1).stores({workflows:"&id, name, parentFolderID",changelogs:"&id, workflowID",media:"&id, workflowID",folders:"&id, name, parentFolderID",tags:"&name",userSettings:"&id",models:"&id, fileName, fileHash",cache:"&id"}).upgrade(n=>{}),this.version(2).stores({workflows:"&id, name, parentFolderID,cloudID",changelogs:"&id, workflowID",media:"&id, workflowID",folders:"&id, name, parentFolderID",tags:"&name",userSettings:"&id",models:"&id, fileName, fileHash",cache:"&id",workflowVersions:"&id, name, workflowID,cloudID"}).upgrade(n=>{})}}const ce=new Hf;class Yt{constructor(e){Se(this,"tableName");this.tableName=e}async saveDiskDB(){const e=await ce[this.tableName].toArray(),n={};e.forEach(r=>{r.id?n[r.id]=r:r.name?n[r.name]=r:console.error("TableBaseModel should have id or name")});try{Hd(this.tableName,JSON.stringify(n))}catch(r){console.error("error saving disk db",r)}}async add(e){return e.id||(e.id=Fn()),e.createTime||(e.createTime=Date.now()),await ce[this.tableName].add(e),await this.saveDiskDB(),e}async put(e){return await ce[this.tableName].put(e),await this.saveDiskDB(),e}async bulkPut(e){await ce[this.tableName].bulkPut(e),this.saveDiskDB()}async update(e,n){return await ce[this.tableName].update(e,n),this.saveDiskDB(),await this.get(e)??null}async listAll(){return await ce[this.tableName].toArray()}async filter(e){return await ce[this.tableName].filter(e).toArray()}async batchQuery(e){return await ce[this.tableName].bulkGet(e)}async getRecords(){console.warn("[DEPRECATED] getRecords() call, should only be used for one-time backfill for indexdb",this.tableName);const e=await qd(this.tableName);let n;try{n=e!=null?JSON.parse(e):null}catch{}if(n==null){const r=await Jd()??"{}";n=JSON.parse(r)[this.tableName]}return n??{}}async get(e){return await ce[this.tableName].get(e)}async delete(e){await ce[this.tableName].delete(e),this.saveDiskDB()}async listByIndex(e,n){return await ce[this.tableName].where(e).equals(n).toArray()}}const Vf=80,Tr=class Tr extends Yt{constructor(){super("changelogs")}static async load(){return new Tr}async listByWorkflowID(e){return await ce.changelogs.where("workflowID").equals(e).reverse().sortBy("createTime")}async getLastestByWorkflowID(e){return(await this.listByWorkflowID(e))[0]}async create(e){const n=await this.getLastestByWorkflowID(e.workflowID);if(n!=null&&n.json===e.json)return null;const r={id:Fn(),json:e.json,workflowID:e.workflowID,createTime:Date.now(),isAutoSave:e.isAutoSave};return await ce.changelogs.add(r),await this.deleteLogsExceedLimit(e.workflowID),r}async deleteLogsExceedLimit(e){var o;const n=await ce.changelogs.where("workflowID").equals(e).reverse().sortBy("createTime"),r=((o=Y==null?void 0:Y.settings)==null?void 0:o.maximumChangelogNumber)??Vf;if(n.length>r){const s=n.slice(r);await ce.changelogs.bulkDelete(s.map(i=>i.id))}}};Se(Tr,"TABLE_NAME","changelogs");let Qo=Tr;const hp="CWM_WORKFLOWS_SORT_TYPE";var at=(t=>(t.RECENTLY_OPENED="recentlyOpened",t.RECENTLY_MODIFIED="newest",t.OLDEST_MODIFIED="oldest",t.AZ="name A-Z",t.ZA="name Z-A",t))(at||{});const pp=[{title:"Import Workflows",type:"file"},{title:"Import Folder",type:"folder"}];function el(t,e=!0,n=!1,r="-"){const o=new Date(t),s=String(o.getDate()).padStart(2,"0"),i=String(o.getMonth()+1).padStart(2,"0"),a=o.getFullYear(),l=String(o.getHours()).padStart(2,"0"),u=String(o.getMinutes()).padStart(2,"0"),c=String(o.getSeconds()).padStart(2,"0"),d=`${i}${r}${s}${r}${a}`;return e?d+` ${l}:${u}`:n?d+`:${c}`:d}const wr=(t,e=at.RECENTLY_MODIFIED)=>{const n=[...t];switch(e){case at.AZ:n.sort((r,o)=>r.name.localeCompare(o.name));break;case at.ZA:n.sort((r,o)=>o.name.localeCompare(r.name));break;case at.RECENTLY_MODIFIED:n.sort((r,o)=>o.updateTime-r.updateTime);break;case at.OLDEST_MODIFIED:n.sort((r,o)=>r.updateTime-o.updateTime);break;case at.RECENTLY_OPENED:n.sort((r,o)=>(o.lastOpenedTime??0)-(r.lastOpenedTime??0));break}return n};function Zf(t){const e=t.nodes,n=new Array,r=new Map,o=new Array;for(let s=0;s{var n;const e=(n=Y==null?void 0:Y.settings)==null?void 0:n.shortcuts;if(!e)return!1;for(const r in e){const s=e[r].split("+"),i={Control:t.ctrlKey,Shift:t.shiftKey,Alt:t.altKey,Command:t.metaKey,[t.key.toUpperCase()]:!0};for(const a in i)i[a]||delete i[a];if(s.length===Object.keys(i).length&&s.every(a=>i[a]))return r}};function vp(t){const e=["png","jpg","jpeg","gif","bmp","webp"],n=t.split(".").pop();return n!=null&&e.includes(n)}function Gf(t){return`/workspace/view_media?filename=${t}`}function ba(){const e=window.location.hash.slice(1).split("/").find(n=>n.includes("workspaceId@"));return e?e.split("@")[1]:null}function tl(t){const e=window.location.hash.slice(1).split("/"),n=e.findIndex(o=>o.includes("workspaceId@")),r=`workspaceId@${t}`;return n>=0?e[n]=r:e.push(r),`${e.join("/")}`}const Yf=t=>{const e=tl(t);window.open(`${window.location.origin}/#${e}`)},nl={last_node_id:9,last_link_id:9,nodes:[{id:7,type:"CLIPTextEncode",pos:[413,389],size:{0:425.27801513671875,1:180.6060791015625},flags:{},order:3,mode:0,inputs:[{name:"clip",type:"CLIP",link:5}],outputs:[{name:"CONDITIONING",type:"CONDITIONING",links:[6],slot_index:0}],properties:{},widgets_values:["text, watermark"]},{id:6,type:"CLIPTextEncode",pos:[415,186],size:{0:422.84503173828125,1:164.31304931640625},flags:{},order:2,mode:0,inputs:[{name:"clip",type:"CLIP",link:3}],outputs:[{name:"CONDITIONING",type:"CONDITIONING",links:[4],slot_index:0}],properties:{},widgets_values:["beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"]},{id:5,type:"EmptyLatentImage",pos:[473,609],size:{0:315,1:106},flags:{},order:1,mode:0,outputs:[{name:"LATENT",type:"LATENT",links:[2],slot_index:0}],properties:{},widgets_values:[512,512,1]},{id:3,type:"KSampler",pos:[863,186],size:{0:315,1:262},flags:{},order:4,mode:0,inputs:[{name:"model",type:"MODEL",link:1},{name:"positive",type:"CONDITIONING",link:4},{name:"negative",type:"CONDITIONING",link:6},{name:"latent_image",type:"LATENT",link:2}],outputs:[{name:"LATENT",type:"LATENT",links:[7],slot_index:0}],properties:{},widgets_values:[0x8e7ff42ed37e,!0,20,8,"euler","normal",1]},{id:8,type:"VAEDecode",pos:[1209,188],size:{0:210,1:46},flags:{},order:5,mode:0,inputs:[{name:"samples",type:"LATENT",link:7},{name:"vae",type:"VAE",link:8}],outputs:[{name:"IMAGE",type:"IMAGE",links:[9],slot_index:0}],properties:{}},{id:9,type:"SaveImage",pos:[1451,189],size:{0:210,1:26},flags:{},order:6,mode:0,inputs:[{name:"images",type:"IMAGE",link:9}],properties:{}},{id:4,type:"CheckpointLoaderSimple",pos:[26,474],size:{0:315,1:98},flags:{},order:0,mode:0,outputs:[{name:"MODEL",type:"MODEL",links:[1],slot_index:0},{name:"CLIP",type:"CLIP",links:[3,5],slot_index:1},{name:"VAE",type:"VAE",links:[8],slot_index:2}],properties:{},widgets_values:["v1-5-pruned-emaonly.ckpt"]}],links:[[1,4,0,3,0,"MODEL"],[2,5,0,3,3,"LATENT"],[3,4,1,6,0,"CLIP"],[4,6,0,3,1,"CONDITIONING"],[5,4,1,7,0,"CLIP"],[6,7,0,3,2,"CONDITIONING"],[7,3,0,8,0,"LATENT"],[8,4,2,8,1,"VAE"],[9,8,0,9,0,"IMAGE"]],groups:[],config:{},extra:{},version:.4},xt="workspace_info",Jf=9999999,yo="upgrade_to_2way_sync",Ws=28,gp="SHORTCUT_TRIGGER_EVENT";function br(...t){const e=t.filter(n=>n!=="").join("/");return Pt(e)}function Pt(t){let n=t.split("/").filter(r=>r!=="").join("/").replace(/\\/g,"/");return n=n.replace(/^\/+/,""),n}function vo(t){return br(t.parentFolderID??"",t.name+".json")}var Ye;(t=>{async function e(l,u){try{const d=await(await Ie("/workspace/file/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:vo(l),newParentPath:u})})).json();return d.error?(alert("Error moving file: "+d.error),!1):!0}catch(c){console.error("Error deleting file:",c)}}t.moveWorkflow=e;async function n(l,u){try{const d=await(await Ie("/workspace/file/gen_unique_name",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:br(u??"",l)})})).json();return d.error?(console.error("Error getting unique name:",d.error),null):d.uniqueName}catch(c){console.error("Error deleting file:",c)}return null}t.genFileUniqueName=n;async function r({parentFolderID:l,name:u},c){try{const p=await(await Ie("/workspace/file/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:br(l??"",u+".json"),newName:c})})).json();return p.error?(alert("Error rename file: "+p.error),!1):!0}catch(d){console.error("Error deleting file:",d)}}t.renameWorkflow=r;async function o(l){const u=l.json,c=JSON.parse(u);c.extra[xt]==null&&(c.extra[xt]={}),c.extra[xt].id=l.id;const p=await(await Ie("/workspace/file/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:vo(l),json:JSON.stringify(c)})})).json();if(p.error)throw console.error("Error saving file:",p.error),alert(`"Error saving file: ${p.error} - - 👉Please try "Save as" from "Files" dropdown menu - `),new Error(p.error);return p}t.saveWorkflow=o;async function s(l){try{return await(await Ie("/workspace/delete_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:vo(l),deleteEmptyFolder:!1})})).text()}catch(u){alert("Error deleting workflow .json file: "+u),console.error("Error deleting file:",u)}}t.deleteWorkflow=s;async function i({parentFolderID:l,name:u,json:c,id:d}){var b;let p=JSON.parse(c);p.extra==null&&(p.extra={}),p.extra[xt]==null&&(p.extra[xt]={}),p.extra[xt].id=d;const h={parentFolderPath:Pt(l??""),name:u,json:JSON.stringify(p)};try{const y=await(await Ie("/workspace/create_workflow_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).json();return y.name&&await((b=ce.workflows)==null?void 0:b.update(d,{name:y.name})),y}catch(f){return console.error(`Error creating file <${d}> at "${l}"`,f),alert(`Error creating file <${d}> at "${l}"`),{}}}t.createWorkflow=i;async function a({parentFolderID:l,name:u,id:c}){const d=br(l??"",u+".json");try{const h=await(await Ie("/workspace/get_workflow_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:d,id:c})})).json();return h.error&&(console.error(`Error getting file <${c}> at "${d}"`,h.error),alert({message:`Error getting file <${c}> at "${d}"`,level:"error"})),h}catch(p){return console.error(`Erro finding file <${c}> at "${d}"`,p),{}}}t.getFile=a})(Ye||(Ye={}));async function Us(t,e=!1,n=!1){try{return await(await Ie("/workspace/file/scan_my_workflows_folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Pt(t),recursive:e,metaInfoOnly:n})})).json()}catch(r){return console.error("Error scan local new files:",r),[]}}async function Xf(t,e){const n=Pt(t??""),o=(await Us(n)).map(async a=>{var c;const l=a.name,u=[n,l].join("/");return Qf(a)?{id:Pt(u),name:a.name,parentFolderID:n,type:"folder",createTime:Date.now(),updateTime:Date.now()}:{...await((c=ce.workflows)==null?void 0:c.get(a.id).catch(h=>(console.error("Error getting workflow from indexdb",h),null)))??{createTime:Date.now(),updateTime:Date.now()},id:a.id,json:a.json??"{}",name:l.replace(/\.json$/,""),parentFolderID:n,createTime:a.createTime}}),s=await Promise.all(o);ce.workflows.bulkPut(s.filter(a=>!nh(a)));const i=s.filter(a=>a!=null);return wr(i,e??at.RECENTLY_MODIFIED)}function Qf(t){return"type"in t&&t.type==="folder"}const Br=class Br extends Yt{constructor(){super("workflows");Se(this,"_curWorkflow",null)}get curWorkflow(){return this._curWorkflow}static async load(){return new Br}updateCurWorkflowID(n){if(n==null){this._curWorkflow=null;return}this.get(n).then(r=>{this._curWorkflow=r??null})}updateCurWorkflow(n){this._curWorkflow=n}async latestVersionCheck(){if(this._curWorkflow){const n=await ce.workflows.get(this._curWorkflow.id);return n?(n==null?void 0:n.updateTime)===this._curWorkflow.updateTime:!0}return!0}async listByIndex(n,r){const o=await super.listByIndex(n,r);return await(Y==null?void 0:Y.getSetting("twoWaySync"))?(await Promise.all(o.map(async a=>await this.get(a.id)))).filter(a=>a!=null):o}async generateUniqueName(n,r){if(await(Y==null?void 0:Y.getSetting("twoWaySync"))){const l=await Ye.genFileUniqueName((n??"Untitled Flow")+".json",r??"");return(l==null?void 0:l.replace(/\.json$/,""))??"Untitled Flow"}let s=n??"Untitled Flow";const a=(await this.listAll()??[]).filter(l=>l.parentFolderID==r).map(l=>l.name);if(a.includes(s)){let l=2,u=!0;for(;u;)a.includes(`${s} ${l}`)?l++:(s=`${s} ${l}`,u=!1)}return s}async createFlow(n){const{name:r}=n,o=await this.generateUniqueName(r,n.parentFolderID??void 0),s=Date.now(),i={...n,id:n.id??Fn(),json:n.json??JSON.stringify(nl),name:o,updateTime:n.updateTime??s,createTime:n.createTime??s};return await ce.workflows.add(i),this.saveDiskDB(),await(Y==null?void 0:Y.getSetting("twoWaySync"))?(await Ye.createWorkflow(i),await this.get(i.id)):i}async update(n,r){throw new Error("Method not allowed.")}async updateTopFields(n,r){return this._update(n,r)}async updateMetaInfo(n,r){return this._update(n,r)}async _update(n,r){await ce.workflows.update(n,r);const o=await ce.workflows.get(n)??null;return this._curWorkflow&&this._curWorkflow.id===n&&(this._curWorkflow=o),this.saveDiskDB(),o}async updateFolder(n,r){const o=await(Y==null?void 0:Y.getSetting("twoWaySync")),s=await this.get(n);!await this.updateMetaInfo(n,r)||!s||o&&await Ye.moveWorkflow(s,r.parentFolderID)}async genLastManualSavedJson(n){const r=await(He==null?void 0:He.getLastestByWorkflowID(n));return r==null?void 0:r.json}async updateName(n,r){const o=await this.get(n);return await(Y==null?void 0:Y.getSetting("twoWaySync"))&&o&&await Ye.renameWorkflow(o,r.name+".json"),await this.updateMetaInfo(n,r)}async updateFlow(n,r){const o=await this.get(n,!1);if(o==null)return;const s=JSON.stringify(o.json),i=JSON.stringify(r.json);if(s===i)return;const a=await this._update(n,{updateTime:Date.now(),json:r.json});await(Y==null?void 0:Y.getSetting("twoWaySync"))&&a&&await Ye.saveWorkflow(a)}async batchCreateFlows(n=[],r=!1,o){var i,a;const s=[];for(const l of n){const u=l.name&&r?l.name:await this.generateUniqueName(l.name,o),c=Fn(),d=Date.now(),p={id:c,name:u,json:l.json,parentFolderID:o,updateTime:d,createTime:d,tags:[]};if(s.push(p),await(Y==null?void 0:Y.getSetting("twoWaySync")))try{const b=JSON.parse(l.json),f=(a=(i=b==null?void 0:b.extra)==null?void 0:i[xt])==null?void 0:a.id;f&&(await this.get(f)||(p.id=f)),Ye.createWorkflow(p)}catch(b){console.error("batchCreateFlows error",b)}}try{await ce.workflows.bulkAdd(s),this.saveDiskDB()}catch(l){console.error("batchCreateFlows error",l)}}async deleteFlow(n){const r=await this.get(n);r&&await(Y==null?void 0:Y.getSetting("twoWaySync"))&&await Ye.deleteWorkflow(r),await ce.workflows.delete(n),this.saveDiskDB()}async batchDeleteFlow(n){const r=await ce.workflows.bulkGet(n);for(const o of r){if(!o)return;await(Y==null?void 0:Y.getSetting("twoWaySync"))&&await Ye.deleteWorkflow(o)}await ce.workflows.bulkDelete(n),this.saveDiskDB()}async listFolderContent(n,r){if(await(Y==null?void 0:Y.getSetting("twoWaySync"))){const l=await Xf(n??null);return wr(l,r??at.RECENTLY_MODIFIED)}const s=await this.listAll().then(l=>l.filter(u=>u.parentFolderID==n))??[],i=await(qe==null?void 0:qe.listAll().then(l=>l.filter(u=>u.parentFolderID==n)))??[],a=[...s,...i];return wr(a,r??at.RECENTLY_MODIFIED)}async get(n,r=!0){const o=await(Y==null?void 0:Y.getSetting("twoWaySync")),s=await ce.workflows.get(n);if(!o||!r)return s;if(s==null)return;const i=await Ye.getFile({parentFolderID:s.parentFolderID??null,name:s.name,id:s.id});if(i.json)return{...s,json:JSON.stringify(i.json)}}async listAll(n){const r=await(Y==null?void 0:Y.getSetting("twoWaySync"));let o;if(r){const i=(await Us("",!0)).filter(a=>(a==null?void 0:a.type)==="workflow").map(async a=>{const l=await ce.workflows.get(a.id);return a.updateTime=(l==null?void 0:l.updateTime)??Date.now(),l!=null&&l.lastOpenedTime&&(a.lastOpenedTime=l==null?void 0:l.lastOpenedTime),a});o=await Promise.all(i)}else o=await ce.workflows.toArray();return n?wr(o,n):o}async updateLastOpenedTime(n){await ce.workflows.update(n,{lastOpenedTime:Date.now()})}};Se(Br,"TABLE_NAME","workflows");let es=Br;var Ct;(t=>{async function e({parentFolderID:a,name:l}){return Pt(`${a??""}/${l}`)}t.genFolderRelPath=e;async function n(a){await Ie("/workspace/folder/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Pt(a.id)})})}t.createFolder=n;async function r(a,l){const c=await(await Ie("/workspace/folder/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder:a,newParentPath:l})})).json();c.error&&alert("Failed to move folder: "+c.error)}t.moveFolder=r;async function o(a){try{return await(await Ie("/workspace/folder/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})})).text()}catch(l){console.error("Error deleting file:",l)}}t.deleteFolder=o;async function s(a){try{const u=await(await Ie("/workspace/file/count_files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})})).json();return u.error&&console.error("Error counting files:",u.error),u.count}catch(l){console.error("Error renaming file:",l)}return null}t.genFilesCountInFolder=s;async function i(a,l){try{const c=await(await Ie("/workspace/folder/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({absPath:a,newName:l})})).json();c.error&&alert("Failed to rename folder: "+c.error)}catch(u){console.error("Error renaming file:",u)}}t.renameFolder=i})(Ct||(Ct={}));const Mr=class Mr extends Yt{constructor(){super("folders")}static async load(){return new Mr}async create(e){const n=await this.generateUniqueName(e.name,e.parentFolderID),r=await(Y==null?void 0:Y.getSetting("twoWaySync")),o=await Ct.genFolderRelPath({name:n,parentFolderID:e.parentFolderID??""}),s={id:r?o:Fn(),name:n,parentFolderID:e.parentFolderID??null,updateTime:Date.now(),createTime:Date.now(),type:"folder"};return r?await Ct.createFolder(s):(await ce.folders.add(s),this.saveDiskDB()),s}async update(e,n){if(await(Y==null?void 0:Y.getSetting("twoWaySync")))return"parentFolderID"in n&&await Ct.moveFolder(e,n.parentFolderID??""),"name"in n&&await Ct.renameFolder(e,n.name??""),null;const o=await this.get(e);if(o==null)return null;"name"in n&&n.name!=o.name;const s="parentFolderID"in n&&n.parentFolderID!=o.parentFolderID,i={...o,...n};return n.name!=null&&(i.updateTime=Date.now()),s&&(n.name=await this.generateUniqueName(i.name,i.parentFolderID??void 0)),await ce.folders.update(e,n),this.saveDiskDB(),i}async deleteFolder(e,n=gr.DELETE){if(await(Y==null?void 0:Y.getSetting("twoWaySync"))){await Us(e,!0,!0).then(a=>{a.forEach(l=>{l.type==="workflow"&&(q==null||q.deleteFlow(l.id))})}),await Ct.deleteFolder(e);return}const o=await(q==null?void 0:q.listAll())??[],s=await this.listAll(),i=[e];for(;i.length>0;){const a=i.shift();if(a){for(const u of o)if(u.parentFolderID===a)switch(n){case gr.DELETE:await(q==null?void 0:q.deleteFlow(u.id));break;case gr.MOVE_TO_ROOT_FOLDER:await(q==null?void 0:q.updateFolder(u.id,{parentFolderID:void 0}));break}await ce.folders.delete(a);const l=s.filter(u=>u.parentFolderID===a).map(u=>u.id);l.length&&i.push(...l)}}this.saveDiskDB()}async generateUniqueName(e,n){if(await(Y==null?void 0:Y.getSetting("twoWaySync")))return await Ye.genFileUniqueName(e??"New folder",n??"")??"New folder";let o=e??"New folder";const s=await this.listAll().then(i=>i.filter(a=>a.parentFolderID==n).map(a=>a.name));if(s.includes(o)){let i=2,a=!0;for(;a;)s.includes(`${o} ${i}`)?i++:(o=`${o} ${i}`,a=!1)}return o}};Se(Mr,"TABLE_NAME","folders");let ts=Mr;class rl extends Yt{constructor(){super("media")}async listByWorkflowID(e){return await ce.media.where("workflowID").equals(e).reverse().sortBy("createTime")}async create(e){if(e.localPath.split(".").pop()==null)return null;const r={id:e.localPath,localPath:e.localPath,workflowID:e.workflowID,createTime:Date.now()};return await(q==null?void 0:q.updateMetaInfo(e.workflowID,{latestImage:r.localPath})),ce.media.put(r),this.saveDiskDB(),r}async delete(e){var n,r;super.delete(e),((n=q==null?void 0:q.curWorkflow)==null?void 0:n.coverMediaPath)===e&&(q==null||q.updateMetaInfo(q.curWorkflow.id,{coverMediaPath:void 0})),((r=q==null?void 0:q.curWorkflow)==null?void 0:r.latestImage)===e&&(q==null||q.updateMetaInfo(q.curWorkflow.id,{latestImage:void 0}))}}Se(rl,"TABLE_NAME","media");const wp=["Checkpoint","TextualInversion","Hypernetwork","LORA","Controlnet","Upscaler","VAE"],eh={Checkpoint:"checkpoints",TextualInversion:"embeddings",Hypernetwork:"hypernetworks",LORA:"loras",Controlnet:"controlnet",Upscaler:"upscale_models",VAE:"vae"};function bp(t){return t.modelVersions!==void 0}function th(t){var e;return((e=t.files)==null?void 0:e[0])!==void 0}function _p(t,e){var r,o,s,i,a,l;if(!t)return;let n;return th(t)?n={id:t.id,SHA256:(o=(r=t.files)==null?void 0:r[0].hashes)==null?void 0:o.SHA256,name:(s=t.files)==null?void 0:s[0].name,sizeKB:(a=(i=t.files)==null?void 0:i[0])==null?void 0:a.sizeKB}:n={id:t.id,SHA256:(l=t.hashes)==null?void 0:l[2],name:`${e} ${t.name}`},n}const zr=class zr extends Yt{constructor(){super("userSettings");Se(this,"defaultSettings");Se(this,"DEFAULT_USER","guest");Se(this,"_autoSave",!1);Se(this,"_settings");this.defaultSettings={id:this.DEFAULT_USER,topBarStyle:{top:0,left:0},myWorkflowsDir:"",shortcuts:{save:"Shift+S",saveAs:"Control+Alt+S",openSpotlightSearch:"Control+P"},defaultFolders:eh,autoSave:!1,autoSaveDuration:3,twoWaySync:!1,foldersOnTop:!1,cloudHost:"https://www.nodecafe.org",overwriteCurWorkflowWhenDroppingFileToCanvas:!1,maximumChangelogNumber:80,hideCoverImage:!1,disableUnsavedWarning:!1}}get settings(){return this._settings}get autoSave(){return this._autoSave}async getSetting(n){const r=await this.get(this.DEFAULT_USER);return n==="shortcuts"&&(r!=null&&r.shortcuts)?{...this.defaultSettings.shortcuts,...r.shortcuts}:(r==null?void 0:r[n])??this.defaultSettings[n]}async upsert(n){const o={...await this.get(this.DEFAULT_USER)??this.defaultSettings,...n};await this.put(o),this._settings={...this.defaultSettings,...o}}static async load(){const n=new zr,r=await Vd();return n.defaultSettings.myWorkflowsDir=r.path,await n.get(n.DEFAULT_USER).then(o=>{n._autoSave=(o==null?void 0:o.autoSave)??!1,n._settings={...n.defaultSettings,...o}}),n.defaultSettings.cloudHost.includes("comfyspace.art")&&await n.upsert({cloudHost:n.defaultSettings.cloudHost}),n}};Se(zr,"TABLE_NAME","userSettings");let ns=zr;const Lr=class Lr extends Yt{constructor(){super("tags")}static async load(){return new Lr}};Se(Lr,"TABLE_NAME","tags");let rs=Lr;const Wr=class Wr extends Yt{constructor(){super("workflowVersions")}static async load(){return new Wr}async listByWorkflowID(e){return await ce[this.tableName].where("workflowID").equals(e).reverse().sortBy("createTime")??[]}async getLatestByWorkflowID(e){const n=await this.listByWorkflowID(e);return n!=null&&n.length?n[0]:null}};Se(Wr,"TABLE_NAME","workflowVersions");let os=Wr;function nh(t){return"type"in t&&t.type==="folder"}let q=null,_r=null,Y=null,qe=null,He=null,$t=null,ge=null;async function rh(){const t=async()=>{q=await es.load()},e=async()=>{_r=await rs.load()},n=async()=>{Y=await ns.load()},r=async()=>{qe=await ts.load()},o=async()=>{He=await Qo.load()},s=async()=>{$t=new rl},i=async()=>{ge=await os.load()};await Promise.all([t(),e(),n(),r(),o(),s(),i()]),localStorage.getItem("WORKSPACE_INDEXDB_BACKFILL")!=="true"&&(await oh(),localStorage.setItem("WORKSPACE_INDEXDB_BACKFILL","true"))}async function oh(){const t=async()=>{try{const a=await(q==null?void 0:q.getRecords());a&&await ce.workflows.bulkPut(Object.values(a))}catch(a){console.error(a)}},e=async()=>{try{const a=await(qe==null?void 0:qe.getRecords());a&&await ce.folders.bulkPut(Object.values(a))}catch(a){console.error(a)}},n=async()=>{try{const a=await($t==null?void 0:$t.getRecords());a&&await ce.media.bulkPut(Object.values(a))}catch(a){console.error(a)}},r=async()=>{try{const a=await(He==null?void 0:He.getRecords());a&&await ce.changelogs.bulkPut(Object.values(a))}catch(a){console.error(a)}},o=async()=>{try{const a=await(_r==null?void 0:_r.getRecords());a&&await ce.tags.bulkPut(Object.values(a))}catch(a){console.error(a)}},s=async()=>{try{const a=Y,l=await a.getRecords().then(u=>u[a.DEFAULT_USER]?u[a.DEFAULT_USER]:u);await ce.userSettings.put({...a.defaultSettings,...l})}catch(a){console.error(a)}},i=async()=>{try{const a=await(ge==null?void 0:ge.getRecords());a&&await ce.workflowVersions.bulkPut(Object.values(a))}catch(a){console.error(a)}};await Promise.all([t(),e(),n(),r(),o(),s(),i()])}const wt=j.createContext({curFlowID:null,loadWorkflowID:()=>{},saveCurWorkflow:async()=>{},discardUnsavedChanges:async()=>{},isDirty:!1,loadNewWorkflow:()=>{},loadFilePath:()=>{},setRoute:()=>{},route:"root",curVersion:null,setIsDirty:()=>{},setCurVersion:()=>{},setCurFlowIDAndName:()=>{}}),kp=j.createContext({refreshFolderStamp:0,setRefreshFolderStamp:()=>{}}),go={x:0,y:0};function sh({children:t,onDragEnd:e,dragIconId:n}){const r=j.useRef(go),o=j.useRef(!1),[s,i]=j.useState(go),a=d=>{var p,h,b;if(!(!(d.target instanceof Element)||!(d.target.parentNode instanceof Element))&&[(p=d.target)==null?void 0:p.id,(b=(h=d.target)==null?void 0:h.parentNode)==null?void 0:b.id].includes(n)){r.current={x:d.clientX,y:d.clientY},o.current=!0,window.addEventListener("mousemove",l),window.addEventListener("mouseup",u);const f=document.getElementsByTagName("body")[0];f.style.userSelect="none"}},l=j.useCallback(d=>{const p={x:d.clientX-r.current.x,y:d.clientY-r.current.y};i(p)},[]),u=j.useCallback(()=>{i(p=>(setTimeout(()=>{e(p)},0),go)),o.current=!1;const d=document.getElementsByTagName("body")[0];d.style.userSelect="auto",window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",u)},[e,l]),c={transform:`translate(${s.x}px, ${s.y}px)`,zIndex:o.current?1e3:1};return O.jsx("div",{style:c,onMouseDown:a,children:t})}var ah={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"},ih=Object.defineProperty,lh=Object.defineProperties,ch=Object.getOwnPropertyDescriptors,Fr=Object.getOwnPropertySymbols,ol=Object.prototype.hasOwnProperty,sl=Object.prototype.propertyIsEnumerable,_a=(t,e,n)=>e in t?ih(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ka=(t,e)=>{for(var n in e||(e={}))ol.call(e,n)&&_a(t,n,e[n]);if(Fr)for(var n of Fr(e))sl.call(e,n)&&_a(t,n,e[n]);return t},uh=(t,e)=>lh(t,ch(e)),dh=(t,e)=>{var n={};for(var r in t)ol.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Fr)for(var r of Fr(t))e.indexOf(r)<0&&sl.call(t,r)&&(n[r]=t[r]);return n},Re=(t,e,n)=>{const r=j.forwardRef((o,s)=>{var i=o,{color:a="currentColor",size:l=24,stroke:u=2,children:c}=i,d=dh(i,["color","size","stroke","children"]);return j.createElement("svg",ka(uh(ka({ref:s},ah),{width:l,height:l,stroke:a,strokeWidth:u,className:`tabler-icon tabler-icon-${t}`}),d),[...n.map(([p,h])=>j.createElement(p,h)),...c||[]])});return r.propTypes={color:Ft.string,size:Ft.oneOfType([Ft.string,Ft.number]),stroke:Ft.oneOfType([Ft.string,Ft.number])},r.displayName=`${e}`,r},fh=Re("arrow-back-up-double","IconArrowBackUpDouble",[["path",{d:"M13 14l-4 -4l4 -4",key:"svg-0"}],["path",{d:"M8 14l-4 -4l4 -4",key:"svg-1"}],["path",{d:"M9 10h7a4 4 0 1 1 0 8h-1",key:"svg-2"}]]),hh=Re("chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]),Rr=Re("device-floppy","IconDeviceFloppy",[["path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2",key:"svg-0"}],["path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M14 4l0 4l-6 0l0 -4",key:"svg-2"}]]),ph=Re("download","IconDownload",[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 11l5 5l5 -5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]]),mh=Re("external-link","IconExternalLink",[["path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",key:"svg-0"}],["path",{d:"M11 13l9 -9",key:"svg-1"}],["path",{d:"M15 4h5v5",key:"svg-2"}]]),yh=Re("folder","IconFolder",[["path",{d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2",key:"svg-0"}]]),vh=Re("grip-vertical","IconGripVertical",[["path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]]),gh=Re("history","IconHistory",[["path",{d:"M12 8l0 4l2 2",key:"svg-0"}],["path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5",key:"svg-1"}]]),wh=Re("link","IconLink",[["path",{d:"M9 15l6 -6",key:"svg-0"}],["path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464",key:"svg-1"}],["path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463",key:"svg-2"}]]),al=Re("lock","IconLock",[["path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z",key:"svg-0"}],["path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-4a4 4 0 1 1 8 0v4",key:"svg-2"}]]),bh=Re("photo","IconPhoto",[["path",{d:"M15 8h.01",key:"svg-0"}],["path",{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z",key:"svg-1"}],["path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5",key:"svg-2"}],["path",{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3",key:"svg-3"}]]),_h=Re("plus","IconPlus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]),kh=Re("share-2","IconShare2",[["path",{d:"M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1",key:"svg-0"}],["path",{d:"M12 14v-11",key:"svg-1"}],["path",{d:"M9 6l3 -3l3 3",key:"svg-2"}]]),xh=Re("trash","IconTrash",[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]]),il=Re("triangle-inverted-filled","IconTriangleInvertedFilled",[["path",{d:"M20.118 3h-16.225a2.914 2.914 0 0 0 -2.503 4.371l8.116 13.549a2.917 2.917 0 0 0 4.987 .005l8.11 -13.539a2.914 2.914 0 0 0 -2.486 -4.386z",fill:"currentColor",key:"svg-0",strokeWidth:"0"}]]),Eh=Re("versions","IconVersions",[["path",{d:"M10 5m0 2a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M7 7l0 10",key:"svg-1"}],["path",{d:"M4 8l0 8",key:"svg-2"}]]),Ch=Re("world","IconWorld",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M3.6 9h16.8",key:"svg-1"}],["path",{d:"M3.6 15h16.8",key:"svg-2"}],["path",{d:"M11.5 3a17 17 0 0 0 0 18",key:"svg-3"}],["path",{d:"M12.5 3a17 17 0 0 1 0 18",key:"svg-4"}]]),Sh=Re("x","IconX",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);function Oh(t){const{promptMessage:e="Are you sure you want to delete this?",variant:n="ghost",onDelete:r,isDisabled:o=!1,tooltipText:s}=t;return O.jsx(ui,{isLazy:!0,placement:"auto",gutter:0,children:({onClose:i})=>O.jsxs(O.Fragment,{children:[O.jsx(ci,{children:O.jsx(St,{children:O.jsx(Ht,{hasArrow:!0,label:s,placement:"bottom",children:O.jsx(jn,{"aria-label":"Delete confirm",size:"sm",icon:O.jsx(xh,{color:"#F56565",size:"20px"}),isDisabled:o,variant:n})})})}),O.jsxs(pi,{children:[O.jsx(fi,{onClick:i}),O.jsxs(di,{children:[O.jsx(Mt,{mb:4,pr:4,fontWeight:600,children:e}),O.jsx(Le,{colorScheme:"red",size:"sm",onClick:()=>{r(),i()},children:"Yes, delete"})]})]})]})})}function Ih({onClose:t}){ja();const{curFlowID:e,isDirty:n,loadWorkflowID:r,curVersion:o}=j.useContext(wt),[s,i]=j.useState(0),[a,l]=j.useState(null),[u,c]=j.useState([]),[d,p]=j.useState([]),h=async y=>{var x;const m=await(q==null?void 0:q.get(y)),w=await(He==null?void 0:He.listByWorkflowID(y));c(w??[]);const _=w==null?void 0:w.filter(I=>I.json===(m==null?void 0:m.json)),k=(x=_==null?void 0:_[0])==null?void 0:x.id;k&&l(k)},b=async()=>{const y=await(ge==null?void 0:ge.listByWorkflowID(e))??[];p(y)},f=y=>{ge==null||ge.delete(y).then(()=>{b()})};return j.useEffect(()=>{switch(s){case 0:b();break;case 1:h(e);break}},[s]),j.useEffect(()=>(Pe.canvasEl.addEventListener("click",t),()=>{Pe.canvasEl.removeEventListener("click",t)}),[s]),O.jsxs(Hl,{width:430,height:"100vh",gap:0,position:"fixed",top:0,left:0,zIndex:1e3,children:[O.jsx(ql,{pb:1,mb:0,children:O.jsxs(xn,{justifyContent:"space-between",alignItems:"center",children:[O.jsx(ms,{size:"md",children:"Version History"}),O.jsx(jn,{size:"sm",icon:O.jsx(Sh,{}),onClick:t,variant:"ghost","aria-label":"close version history"})]})}),O.jsx($l,{overflowY:"auto",gap:0,children:O.jsxs(vi,{isFitted:!0,variant:"enclosed",onChange:i,colorScheme:"teal",children:[O.jsxs(gi,{mb:"1em",children:[O.jsx(So,{children:"Versions"}),O.jsx(So,{children:"Change History"})]}),O.jsxs(wi,{children:[O.jsx(Co,{children:O.jsx(rn,{divider:O.jsx(_o,{}),spacing:2,children:d==null?void 0:d.map(y=>O.jsxs(xn,{w:"100%",mb:1,justify:"space-between",backgroundColor:y.id===(o==null?void 0:o.id)?"teal.300":void 0,borderRadius:4,children:[O.jsxs(rn,{textAlign:"left",gap:0,children:[O.jsx(Mt,{fontWeight:"500",children:y.name??"untitled"}),O.jsxs(Mt,{color:"GrayText",fontSize:"sm",children:["Created: ",el(y.createTime)]})]}),O.jsxs(xn,{alignItems:"center",gap:2,children:[O.jsx(Le,{size:"sm",onClick:()=>{if(n){alert("You have unsaved changes, please save or discard your changes to proceed switching version, in case losing your changes.");return}Pe.loadGraphData(JSON.parse(y.json)),r(e,y.id),t()},children:"Load"}),O.jsx(Oh,{promptMessage:"Are you sure you want to delete this version?",onDelete:()=>{f(y.id)}})]})]},y.id))})}),O.jsxs(Co,{children:[O.jsx(Mt,{mb:4,children:"All the saved changes of this workflow"}),O.jsx(rn,{divider:O.jsx(_o,{}),spacing:2,children:u==null?void 0:u.map(y=>O.jsxs(zt,{justifyContent:"space-between",children:[O.jsxs(Le,{size:"sm",variant:"ghost",onClick:()=>{if(n){alert("You have unsaved changes, please save or discard your changes to proceed switching version, in case losing your changes.");return}Pe.loadGraphData(JSON.parse(y.json)),q==null||q.updateFlow(e,{json:y.json}),t()},isActive:y.id===a,children:["Saved at ",new Date(y.createTime).toLocaleString()]},y.id),y.isAutoSave?O.jsx(Xr,{colorScheme:"teal",size:"sm",children:"Auto save"}):null]},y.id))})]})]})]})})]})}function Dh({workflowId:t,onClose:e}){const[n,r]=j.useState(""),[o,s]=j.useState(""),i=l=>{r(l.target.value),o&&s("")},a=async()=>{const l=n.trim();if(r(l),(await(ge==null?void 0:ge.listByWorkflowID(t))??[]).some(c=>c.name===l))s("The name is duplicated, please modify it and submit again.");else{const c=JSON.stringify(Pe.graph.serialize());await(ge==null?void 0:ge.add({name:n,workflowID:t,createTime:Date.now(),json:c})),e()}};return O.jsxs(is,{isOpen:!0,onClose:e,children:[O.jsx(ls,{}),O.jsxs(cs,{children:[O.jsx(us,{children:"Create Version"}),O.jsx(ds,{}),O.jsx(fs,{children:O.jsxs(qr,{isInvalid:!!o,children:[O.jsx(Vr,{children:"Name"}),O.jsx(Un,{value:n,onChange:i,autoFocus:!0,onKeyUp:l=>{l.code==="Enter"&&!o&&n&&a()}}),o&&O.jsx(Hr,{children:o})]})}),O.jsxs(hs,{children:[O.jsx(Le,{colorScheme:"teal",mr:3,onClick:a,isDisabled:!n||!!o,children:"Create"}),O.jsx(Le,{onClick:e,children:"Cancel"})]})]})]})}function Ph({options:t,menuButton:e,isOpen:n,onClose:r}){const o=j.useRef(null);return vc({ref:o,handler:()=>r()}),O.jsxs(St,{position:"relative",children:[O.jsx(St,{children:e}),n&&O.jsx(St,{ref:o,mt:"8px",shadow:"md",p:"2",position:"absolute",zIndex:"dropdown",children:t})]})}function jh({menuButton:t,menuContent:e,onClose:n}){const r=j.useRef(),[o,s]=j.useState(!1),i=()=>{r.current=setTimeout(()=>s(!1),400)},a=()=>{s(!0),clearTimeout(r.current),r.current=void 0};return O.jsx(Ph,{isOpen:o,onClose:i,menuButton:O.jsx(St,{"aria-label":"menu",onClick:a,onMouseEnter:a,onMouseLeave:i,children:t}),options:O.jsx(Ss,{isOpen:!0,children:O.jsx(Os,{minWidth:150,zIndex:1e3,onMouseEnter:a,onMouseLeave:i,children:e})})})}function Ah(t,e){const n=new Blob([t],{type:"application/json"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${e}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}function xp(t){const e=new Uint8Array(t);return window.crypto.getRandomValues(e),Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}const Ep=[{label:"Private",value:"PRIVATE",icon:O.jsx(al,{})},{label:"Unlisted, anyone with the link can view",value:"UNLISTED",icon:O.jsx(wh,{})},{label:"Public",value:"PUBLIC",icon:O.jsx(Ch,{})}],Cp=()=>{const t=Pe.graph._nodes,e={};for(let n of t)if(n.type in LiteGraph.registered_node_types){const r=structuredClone(LiteGraph.registered_node_types[n.type].nodeData);if(r==null)continue;for(let o in r.input){const s=r.input[o];for(let i in s){const a=s[i];Array.isArray(a[0])&&(a[0]=["value_1","value_2"])}}e[n.type]=r}return e};async function Nh(t){const e=t.cloudOrigin;if(!e)throw Error("cloudURL is required");return fetch(e+`/api/getWorkflow?id=${t.cloudID}`).then(n=>n.json()).then(n=>{var o;return((o=n.data)==null?void 0:o.privacy)??"PRIVATE"})}function Sp({privacy:t,showEmoji:e=!1}){let n;return t==="PRIVATE"?(n="Private",e&&(n="🔒 Private")):t==="UNLISTED"?(n="Unlisted",e&&(n="🔗 Unlisted")):t==="PUBLIC"&&(n="Public",e&&(n="🌐 Public")),O.jsx("span",{children:n})}function Fh({}){const[t,e]=j.useState(),[n,r]=j.useState(),{curFlowID:o}=j.useContext(wt);return j.useEffect(()=>{o&&(q==null||q.get(o).then(s=>{s!=null&&s.cloudID?(e(s.cloudOrigin+"/workflow/"+s.cloudID),Nh(s).then(i=>{r(i)})):e(void 0)}))},[o]),t?O.jsx("a",{href:t,style:{textDecoration:"none"},target:"_blank",children:O.jsx(Oa,{children:O.jsx(Xr,{children:n==="PUBLIC"?"🌐":n==="UNLISTED"?"🔗":"🔒"})})}):null}const Rh=j.lazy(()=>At(()=>import("./ShareDialog-t7mRPVSb.js"),__vite__mapDeps([0,1,2,3,4,5])));function Th(){var k;const{curFlowID:t,loadWorkflowID:e,discardUnsavedChanges:n,saveCurWorkflow:r,setRoute:o,route:s}=j.useContext(wt),[i,a]=j.useState(!1),[l,u]=j.useState(""),[c,d]=j.useState(""),[p,h]=j.useState(),[b,f]=j.useState({save:"",saveAs:""});j.useEffect(()=>{t&&(q==null||q.get(t).then(x=>{u((x==null?void 0:x.name)??""),h(x)})),Y==null||Y.getSetting("shortcuts").then(x=>{f(x)})},[t]);const y=x=>{u(x.target.value),c&&d("")},m=async()=>{if(!t){alert("Flow ID is required");return}const x=JSON.stringify(Pe.graph.serialize()),I=await(q==null?void 0:q.createFlow({json:x,name:l,parentFolderID:p==null?void 0:p.parentFolderID}));I&&await e(I.id,null,!0),w()},w=()=>{o("root")},_=j.useCallback(async()=>{const x=q==null?void 0:q.curWorkflow;if(!x){alert("No current workflow!");return}const I=Pe.graph.serialize(),E=JSON.stringify(I,null,2);Ah(E,x.name)},[t]);return O.jsxs(O.Fragment,{children:[O.jsx(jh,{menuButton:O.jsx(Oa,{children:O.jsxs(Le,{px:1,height:Ws+"px","aria-label":"menu",size:"sm",backgroundColor:"#434554",children:["File",O.jsx(hh,{size:20})]})}),menuContent:O.jsx(Ss,{isOpen:!0,children:O.jsxs(Os,{minWidth:150,zIndex:1e3,children:[O.jsx(bt,{onClick:()=>r(),icon:O.jsx(Rr,{size:20}),iconSpacing:1,command:b.save,children:"Save"}),!((k=Y==null?void 0:Y.settings)!=null&&k.autoSave)&&O.jsx(Ht,{label:"Revert workflow to your last saved version. You will lose all changes made since your last save.",children:O.jsx(bt,{onClick:n,icon:O.jsx(fh,{size:20}),iconSpacing:1,children:"Discard unsaved changes"})}),O.jsx(bt,{onClick:_,icon:O.jsx(ph,{size:20}),iconSpacing:1,children:"Download"}),O.jsx(bt,{onClick:()=>o("saveAsModal"),icon:O.jsx(Rr,{size:20}),iconSpacing:1,command:b.saveAs,children:"Save As"}),O.jsx(bt,{onClick:()=>a(!0),icon:O.jsx(Eh,{size:20}),iconSpacing:1,children:"Create Version"}),O.jsx(bt,{onClick:()=>o("versionHistory"),icon:O.jsx(gh,{size:20}),iconSpacing:1,children:"Versions History"}),O.jsx(bt,{onClick:()=>o("share"),icon:O.jsx(kh,{size:20}),iconSpacing:1,alignItems:"center",children:O.jsxs(zt,{children:[O.jsx("p",{children:"Share"})," ",O.jsx(Xr,{size:"sm",children:"🧪beta"}),O.jsx(Fh,{})]})})]})})}),s==="share"&&O.jsx(Rh,{onClose:()=>o("root")}),s=="versionHistory"&&O.jsx(Ih,{onClose:()=>o("root")}),s==="saveAsModal"&&O.jsxs(is,{isOpen:!0,onClose:w,children:[O.jsx(ls,{}),O.jsxs(cs,{children:[O.jsx(us,{children:"Save As"}),O.jsx(ds,{}),O.jsx(fs,{children:O.jsxs(qr,{isInvalid:!!c,children:[O.jsx(Vr,{children:"Workflow name"}),O.jsx(Un,{value:l,onChange:y,autoFocus:!0,onKeyUp:x=>{x.code==="Enter"&&!c&&l&&m()}}),c&&O.jsx(Hr,{children:c})]})}),O.jsxs(hs,{children:[O.jsx(Le,{colorScheme:"teal",mr:3,onClick:m,isDisabled:!l||!!c,children:"Save"}),O.jsx(Le,{onClick:w,children:"Cancel"})]})]})]}),i&&O.jsx(Dh,{workflowId:t,onClose:()=>a(!1)})]})}function Bh({displayName:t,updateFlowName:e,isDirty:n}){const{isOpen:r,onOpen:o,onClose:s}=bc(),{curFlowID:i}=j.useContext(wt),[a,l]=j.useState(t),[u,c]=j.useState(""),d=()=>{l(t),o()},p=f=>{l(f.target.value),u&&c("")},h=async()=>{var f;if(i){const y=a.trim();if(l(y),t===y)return b();await(q==null?void 0:q.generateUniqueName(y,((f=q.curWorkflow)==null?void 0:f.parentFolderID)??""))!==y?c("The name is duplicated, please modify it and submit again."):(await(q==null?void 0:q.updateName(i,{name:y})),e(y),b())}},b=()=>{c(""),s()};return i==null?null:O.jsxs(zt,{children:[O.jsx(Ht,{label:t,placement:"bottom",children:O.jsxs(Mt,{as:"div",color:"white",onClick:d,maxW:160,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[O.jsx("div",{style:{width:8,display:"inline-block"},children:O.jsx(Mt,{as:"span",children:n&&"* "})}),t]})}),O.jsxs(is,{isOpen:r,onClose:b,children:[O.jsx(ls,{}),O.jsxs(cs,{children:[O.jsx(us,{children:"Edit workflow name"}),O.jsx(ds,{}),O.jsx(fs,{children:O.jsxs(qr,{isInvalid:!!u,children:[O.jsx(Vr,{children:"Workflow name"}),O.jsx(Un,{value:a,onChange:p,autoFocus:!0,onKeyUp:f=>{f.code==="Enter"&&!u&&a&&h()}}),u&&O.jsx(Hr,{children:u})]})}),O.jsxs(hs,{children:[O.jsx(Le,{colorScheme:"teal",mr:3,onClick:h,isDisabled:!a||!!u,children:"Save"}),O.jsx(Le,{onClick:b,children:"Cancel"})]})]})]})]})}function Mh({}){const{setRoute:t,curVersion:e,isDirty:n,setCurVersion:r}=j.useContext(wt);return j.useEffect(()=>{n&&e&&(e==null?void 0:e.name.endsWith("*"))===!1&&(r==null||r({...e,name:e.name+"*"}))},[n]),e?O.jsx(xn,{alignItems:"center",children:O.jsx(Ra,{size:"sm",isAttached:!0,variant:"outline",children:O.jsx(Le,{rightIcon:O.jsx(il,{size:10}),onClick:()=>t("versionHistory"),children:e.name})})}):null}function zh(){const{loadNewWorkflow:t,setCurFlowIDAndName:e,curFlowID:n}=j.useContext(wt),r=async()=>{const o=JSON.stringify(Pe.graph.serialize()),s=prompt("Enter workflow name","Untitled");if(!s)return;const i=await(q==null?void 0:q.createFlow({json:o,name:s}));i&&e(i)};return O.jsx(Ht,{label:n?"New workflow":"Save workflow",children:O.jsx(Le,{size:"sm",variant:"outline",colorScheme:"teal","aria-label":"new workflow",height:Ws+"px",onClick:()=>n?t():r(),px:1,children:n?O.jsx(_h,{size:16,color:"white"}):O.jsx(Rr,{size:16,color:"white"})})})}const Lh=j.lazy(()=>At(()=>import("./AppIsDirtyEventListener-xmtnIvLQ.js"),__vite__mapDeps([6,1,7]))),Wh=j.lazy(()=>At(()=>import("./ModelManagerTopbar-4hMR9SRa.js"),__vite__mapDeps([8,1,2,3,9,10,11]))),Uh=j.lazy(()=>At(()=>import("./SpotlightSearch-crj3ER75.js"),__vite__mapDeps([12,1,7,13,14])));function Kh({curFlowName:t,setCurFlowName:e}){var c;const{isDirty:n,saveCurWorkflow:r,setRoute:o,curFlowID:s,route:i}=j.useContext(wt),[a,l]=j.useState(),u=j.useCallback((d,p=!1)=>{const{top:h=0,left:b=0}=a||{};let{top:f=0,left:y=0}=d??{};f+=h,y+=b;const m=document.documentElement.clientWidth,w=document.documentElement.clientHeight,_=document.getElementById("workspaceManagerPanel"),k=(_==null?void 0:_.offsetWidth)||392;f+36>w&&(f=w-36),y+k>=m&&(y=m-k),l({top:Math.max(0,f),left:Math.max(0,y)}),p&&(Y==null||Y.upsert({topBarStyle:{top:f,left:y}}))},[a]);return j.useEffect(()=>{Y==null||Y.getSetting("topBarStyle").then(d=>{u(d,!1)})},[]),a?O.jsx(sh,{onDragEnd:d=>{u({top:d.y,left:d.x},!0)},dragIconId:"dragPanelIcon",children:O.jsxs(zt,{style:{padding:2,position:"fixed",...a},justifyContent:"space-between",alignItems:"center",gap:2,draggable:!1,id:"workspaceManagerPanel",className:"workspaceManagerPanel",children:[O.jsx(Le,{size:"sm","aria-label":"workspace folder",height:Ws+"px",onClick:()=>o("recentFlows"),px:2,children:O.jsxs(zt,{gap:1,children:[O.jsx(yh,{size:21}),O.jsx(il,{size:8})]})}),O.jsx(j.Suspense,{fallback:O.jsx("div",{style:{width:"60px"}}),children:O.jsx(Wh,{})}),O.jsx(zh,{}),O.jsx(Bh,{isDirty:n,displayName:t??"",updateFlowName:d=>{e(d),requestAnimationFrame(()=>{u()})}}),((c=q==null?void 0:q.curWorkflow)==null?void 0:c.saveLock)&&O.jsx(al,{color:"#FFF",size:20}),s&&O.jsxs(zt,{gap:"4px",children:[O.jsx(Ht,{label:"Open gallery",children:O.jsx(jn,{onClick:()=>o("gallery"),icon:O.jsx(bh,{size:22,color:"white"}),size:"sm","aria-label":"open gallery",variant:"ghost"})}),O.jsx(Th,{})]}),s&&n?O.jsx(Ht,{label:"Save workflow",children:O.jsx(jn,{onClick:()=>r(),icon:O.jsx(Rr,{size:23,color:"white"}),size:"xs",paddingY:4,"aria-label":"save workspace",variant:"ghost"})}):O.jsx("div",{style:{width:1}}),O.jsx(Mh,{}),O.jsx(Lh,{}),O.jsx(vh,{id:"dragPanelIcon",className:"dragPanelIcon",cursor:"move",size:15,color:"#FFF"}),i==="spotlightSearch"&&O.jsx(Uh,{})]})}):null}function $h(){const{showDialog:t}=Ia(),{loadWorkflowID:e}=j.useContext(wt),n=async(o,s)=>{var u,c;const{workflow:i,version:a}=o.detail;if(!i.id||!a.id)return;const l=(u=await(q==null?void 0:q.listByIndex("cloudID",i.id)))==null?void 0:u.at(0);if(l){const d=(c=await(ge==null?void 0:ge.listByIndex("cloudID",a.id)))==null?void 0:c.at(0);if(d)await e(l.id,d.id);else{const p=await(ge==null?void 0:ge.add({id:a.id,cloudID:a.id,workflowID:l.id,cloudOrigin:s,name:a.name,authorID:a.authorID,json:a.json}));p&&e(l.id,p.id)}}else{const d=await(q==null?void 0:q.createFlow({cloudID:i.id,cloudOrigin:s,name:i.name,json:a.json,updateTime:Date.now()}));if(!d){alert("Failed to add workflow to local db");return}const p=await(ge==null?void 0:ge.put({id:a.id,cloudID:a.id,workflowID:d.id,cloudOrigin:s,name:a.name,json:a.json,authorID:a.authorID,createTime:Date.now()}));await e(d.id,p==null?void 0:p.id)}},r=async o=>{const s=o.data;if(qh(s)){const i=o.origin;t(`Open workflow "${s.detail.workflow.name}", version "${s.detail.version.name}" from ${i}`,[{label:"Open",colorScheme:"teal",onClick:()=>{n(s,i)}}])}};return j.useEffect(()=>{window.opener&&window.opener.postMessage("comfyui_workspace_manager_connected","*"),window.addEventListener("message",r)},[]),null}function qh(t){return t.type==="workspace_open_workflow"}const Hh=t=>typeof t=="function",Vh=t=>{const[e,n]=j.useState(t),r=j.useRef(e),o=j.useCallback(s=>{r.current=Hh(s)?s(r.current):s,n(r.current)},[]);return[e,o,r]};function lr(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ll={exports:{}};/*! - -JSZip v3.10.1 - A JavaScript class for generating and reading zip files - - -(c) 2009-2016 Stuart Knightley -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. - -JSZip uses the library pako released under the MIT license : -https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(t,e){(function(n){t.exports=n()})(function(){return function n(r,o,s){function i(u,c){if(!o[u]){if(!r[u]){var d=typeof lr=="function"&&lr;if(!c&&d)return d(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var h=o[u]={exports:{}};r[u][0].call(h.exports,function(b){var f=r[u][1][b];return i(f||b)},h,h.exports,n,r,o,s)}return o[u].exports}for(var a=typeof lr=="function"&&lr,l=0;l>2,h=(3&u)<<4|c>>4,b=1<_?(15&c)<<2|d>>6:64,f=2<_?63&d:64,y.push(a.charAt(p)+a.charAt(h)+a.charAt(b)+a.charAt(f));return y.join("")},o.decode=function(l){var u,c,d,p,h,b,f=0,y=0,m="data:";if(l.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");var w,_=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&_--,l.charAt(l.length-2)===a.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(w=i.uint8array?new Uint8Array(0|_):new Array(0|_);f>4,c=(15&p)<<4|(h=a.indexOf(l.charAt(f++)))>>2,d=(3&h)<<6|(b=a.indexOf(l.charAt(f++))),w[y++]=u,h!==64&&(w[y++]=c),b!==64&&(w[y++]=d);return w}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),i=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(c,d,p,h,b){this.compressedSize=c,this.uncompressedSize=d,this.crc32=p,this.compression=h,this.compressedContent=b}u.prototype={getContentWorker:function(){var c=new i(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return c.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new i(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(c,d,p){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var s=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var s=n("./utils"),i=function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(u,c,d,p){var h=i,b=p+d;u^=-1;for(var f=p;f>>8^h[255&(u^c[f])];return-1^u}(0|l,a,a.length,0):function(u,c,d,p){var h=i,b=p+d;u^=-1;for(var f=p;f>>8^h[255&(u^c.charCodeAt(f))];return-1^u}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=s?"uint8array":"array";function c(d,p){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,d.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(p){d.push({data:p,meta:d.meta})}},o.compressWorker=function(d){return new c("Deflate",d)},o.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(h,b){var f,y="";for(f=0;f>>=8;return y}function i(h,b,f,y,m,w){var _,k,x=h.file,I=h.compression,E=w!==u.utf8encode,N=a.transformTo("string",w(x.name)),D=a.transformTo("string",u.utf8encode(x.name)),R=x.comment,K=a.transformTo("string",w(R)),P=a.transformTo("string",u.utf8encode(R)),B=D.length!==x.name.length,v=P.length!==R.length,T="",H="",A="",X=x.dir,$=x.date,ne={crc32:0,compressedSize:0,uncompressedSize:0};b&&!f||(ne.crc32=h.crc32,ne.compressedSize=h.compressedSize,ne.uncompressedSize=h.uncompressedSize);var z=0;b&&(z|=8),E||!B&&!v||(z|=2048);var M=0,te=0;X&&(M|=16),m==="UNIX"?(te=798,M|=function(G,me){var we=G;return G||(we=me?16893:33204),(65535&we)<<16}(x.unixPermissions,X)):(te=20,M|=function(G){return 63&(G||0)}(x.dosPermissions)),_=$.getUTCHours(),_<<=6,_|=$.getUTCMinutes(),_<<=5,_|=$.getUTCSeconds()/2,k=$.getUTCFullYear()-1980,k<<=4,k|=$.getUTCMonth()+1,k<<=5,k|=$.getUTCDate(),B&&(H=s(1,1)+s(c(N),4)+D,T+="up"+s(H.length,2)+H),v&&(A=s(1,1)+s(c(K),4)+P,T+="uc"+s(A.length,2)+A);var J="";return J+=` -\0`,J+=s(z,2),J+=I.magic,J+=s(_,2),J+=s(k,2),J+=s(ne.crc32,4),J+=s(ne.compressedSize,4),J+=s(ne.uncompressedSize,4),J+=s(N.length,2),J+=s(T.length,2),{fileRecord:d.LOCAL_FILE_HEADER+J+N+T,dirRecord:d.CENTRAL_FILE_HEADER+s(te,2)+J+s(K.length,2)+"\0\0\0\0"+s(M,4)+s(y,4)+N+T+K}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),c=n("../crc32"),d=n("../signature");function p(h,b,f,y){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=b,this.zipPlatform=f,this.encodeFileName=y,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(h){var b=h.meta.percent||0,f=this.entriesCount,y=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,l.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:f?(b+100*(f-y-1))/f:100}}))},p.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var b=this.streamFiles&&!h.file.dir;if(b){var f=i(h,b,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(h){this.accumulate=!1;var b=this.streamFiles&&!h.file.dir,f=i(h,b,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),b)this.push({data:function(y){return d.DATA_DESCRIPTOR+s(y.crc32,4)+s(y.compressedSize,4)+s(y.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var h=this.bytesWritten,b=0;b=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),c=n("./Uint8ArrayReader");r.exports=function(d){var p=s.getTypeOf(d);return s.checkSupport(p),p!=="string"||i.uint8array?p==="nodebuffer"?new u(d):i.uint8array?new c(s.transformTo("uint8array",d)):new a(s.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),i=n("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}i.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:i.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=i(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(l){i.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,i),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}i.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(l){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=s.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}s.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var l=0;l "+i:i}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),i=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),c=n("../external"),d=null;if(u.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(b,f){return new c.Promise(function(y,m){var w=[],_=b._internalType,k=b._outputType,x=b._mimeType;b.on("data",function(I,E){w.push(I),f&&f(E)}).on("error",function(I){w=[],m(I)}).on("end",function(){try{var I=function(E,N,D){switch(E){case"blob":return s.newBlob(s.transformTo("arraybuffer",N),D);case"base64":return l.encode(N);default:return s.transformTo(E,N)}}(k,function(E,N){var D,R=0,K=null,P=0;for(D=0;D"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(s),o.blob=i.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),i=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(h){return i.nodebuffer?a.newBufferFrom(h,"utf-8"):function(b){var f,y,m,w,_,k=b.length,x=0;for(w=0;w>>6:(y<65536?f[_++]=224|y>>>12:(f[_++]=240|y>>>18,f[_++]=128|y>>>12&63),f[_++]=128|y>>>6&63),f[_++]=128|63&y);return f}(h)},o.utf8decode=function(h){return i.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(b){var f,y,m,w,_=b.length,k=new Array(2*_);for(f=y=0;f<_;)if((m=b[f++])<128)k[y++]=m;else if(4<(w=u[m]))k[y++]=65533,f+=w-1;else{for(m&=w===2?31:w===3?15:7;1>10&1023,k[y++]=56320|1023&m)}return k.length!==y&&(k.subarray?k=k.subarray(0,y):k.length=y),s.applyFromCharCode(k)}(h=s.transformTo(i.uint8array?"uint8array":"array",h))},s.inherits(d,l),d.prototype.processChunk=function(h){var b=s.transformTo(i.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var f=b;(b=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),b.set(f,this.leftOver.length)}else b=this.leftOver.concat(b);this.leftOver=null}var y=function(w,_){var k;for((_=_||w.length)>w.length&&(_=w.length),k=_-1;0<=k&&(192&w[k])==128;)k--;return k<0||k===0?_:k+u[w[k]]>_?k:_}(b),m=b;y!==b.length&&(i.uint8array?(m=b.subarray(0,y),this.leftOver=b.subarray(y,b.length)):(m=b.slice(0,y),this.leftOver=b.slice(y,b.length))),this.push({data:o.utf8decode(m),meta:h.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=d,s.inherits(p,l),p.prototype.processChunk=function(h){this.push({data:o.utf8encode(h.data),meta:h.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(f){return f}function c(f,y){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var b,f,y,m=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?p[y++]=224|h>>>12:(p[y++]=240|h>>>18,p[y++]=128|h>>>12&63),p[y++]=128|h>>>6&63),p[y++]=128|63&h);return p},o.buf2binstring=function(d){return c(d,d.length)},o.binstring2buf=function(d){for(var p=new s.Buf8(d.length),h=0,b=p.length;h>10&1023,w[b++]=56320|1023&f)}return c(w,b)},o.utf8border=function(d,p){var h;for((p=p||d.length)>d.length&&(p=d.length),h=p-1;0<=h&&(192&d[h])==128;)h--;return h<0||h===0?p:h+l[d[h]]>p?h:p}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,a,l){for(var u=65535&s|0,c=s>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3>>1:i>>>1;a[l]=i}return a}();r.exports=function(i,a,l,u){var c=s,d=u+l;i^=-1;for(var p=u;p>>8^c[255&(i^a[p])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),c=n("./messages"),d=0,p=4,h=0,b=-2,f=-1,y=4,m=2,w=8,_=9,k=286,x=30,I=19,E=2*k+1,N=15,D=3,R=258,K=R+D+1,P=42,B=113,v=1,T=2,H=3,A=4;function X(g,U){return g.msg=c[U],U}function $(g){return(g<<1)-(4g.avail_out&&(W=g.avail_out),W!==0&&(i.arraySet(g.output,U.pending_buf,U.pending_out,W,g.next_out),g.next_out+=W,U.pending_out+=W,g.total_out+=W,g.avail_out-=W,U.pending-=W,U.pending===0&&(U.pending_out=0))}function M(g,U){a._tr_flush_block(g,0<=g.block_start?g.block_start:-1,g.strstart-g.block_start,U),g.block_start=g.strstart,z(g.strm)}function te(g,U){g.pending_buf[g.pending++]=U}function J(g,U){g.pending_buf[g.pending++]=U>>>8&255,g.pending_buf[g.pending++]=255&U}function G(g,U){var W,S,C=g.max_chain_length,F=g.strstart,V=g.prev_length,Z=g.nice_match,L=g.strstart>g.w_size-K?g.strstart-(g.w_size-K):0,Q=g.window,re=g.w_mask,ee=g.prev,se=g.strstart+R,ve=Q[F+V-1],he=Q[F+V];g.prev_length>=g.good_match&&(C>>=2),Z>g.lookahead&&(Z=g.lookahead);do if(Q[(W=U)+V]===he&&Q[W+V-1]===ve&&Q[W]===Q[F]&&Q[++W]===Q[F+1]){F+=2,W++;do;while(Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&Q[++F]===Q[++W]&&FL&&--C!=0);return V<=g.lookahead?V:g.lookahead}function me(g){var U,W,S,C,F,V,Z,L,Q,re,ee=g.w_size;do{if(C=g.window_size-g.lookahead-g.strstart,g.strstart>=ee+(ee-K)){for(i.arraySet(g.window,g.window,ee,ee,0),g.match_start-=ee,g.strstart-=ee,g.block_start-=ee,U=W=g.hash_size;S=g.head[--U],g.head[U]=ee<=S?S-ee:0,--W;);for(U=W=ee;S=g.prev[--U],g.prev[U]=ee<=S?S-ee:0,--W;);C+=ee}if(g.strm.avail_in===0)break;if(V=g.strm,Z=g.window,L=g.strstart+g.lookahead,Q=C,re=void 0,re=V.avail_in,Q=D)for(F=g.strstart-g.insert,g.ins_h=g.window[F],g.ins_h=(g.ins_h<=D&&(g.ins_h=(g.ins_h<=D)if(S=a._tr_tally(g,g.strstart-g.match_start,g.match_length-D),g.lookahead-=g.match_length,g.match_length<=g.max_lazy_match&&g.lookahead>=D){for(g.match_length--;g.strstart++,g.ins_h=(g.ins_h<=D&&(g.ins_h=(g.ins_h<=D&&g.match_length<=g.prev_length){for(C=g.strstart+g.lookahead-D,S=a._tr_tally(g,g.strstart-1-g.prev_match,g.prev_length-D),g.lookahead-=g.prev_length-1,g.prev_length-=2;++g.strstart<=C&&(g.ins_h=(g.ins_h<g.pending_buf_size-5&&(W=g.pending_buf_size-5);;){if(g.lookahead<=1){if(me(g),g.lookahead===0&&U===d)return v;if(g.lookahead===0)break}g.strstart+=g.lookahead,g.lookahead=0;var S=g.block_start+W;if((g.strstart===0||g.strstart>=S)&&(g.lookahead=g.strstart-S,g.strstart=S,M(g,!1),g.strm.avail_out===0)||g.strstart-g.block_start>=g.w_size-K&&(M(g,!1),g.strm.avail_out===0))return v}return g.insert=0,U===p?(M(g,!0),g.strm.avail_out===0?H:A):(g.strstart>g.block_start&&(M(g,!1),g.strm.avail_out),v)}),new ue(4,4,8,4,we),new ue(4,5,16,8,we),new ue(4,6,32,32,we),new ue(4,4,16,16,ie),new ue(8,16,32,32,ie),new ue(8,16,128,128,ie),new ue(8,32,128,256,ie),new ue(32,128,258,1024,ie),new ue(32,258,258,4096,ie)],o.deflateInit=function(g,U){return xe(g,U,w,15,8,0)},o.deflateInit2=xe,o.deflateReset=pe,o.deflateResetKeep=ye,o.deflateSetHeader=function(g,U){return g&&g.state?g.state.wrap!==2?b:(g.state.gzhead=U,h):b},o.deflate=function(g,U){var W,S,C,F;if(!g||!g.state||5>8&255),te(S,S.gzhead.time>>16&255),te(S,S.gzhead.time>>24&255),te(S,S.level===9?2:2<=S.strategy||S.level<2?4:0),te(S,255&S.gzhead.os),S.gzhead.extra&&S.gzhead.extra.length&&(te(S,255&S.gzhead.extra.length),te(S,S.gzhead.extra.length>>8&255)),S.gzhead.hcrc&&(g.adler=u(g.adler,S.pending_buf,S.pending,0)),S.gzindex=0,S.status=69):(te(S,0),te(S,0),te(S,0),te(S,0),te(S,0),te(S,S.level===9?2:2<=S.strategy||S.level<2?4:0),te(S,3),S.status=B);else{var V=w+(S.w_bits-8<<4)<<8;V|=(2<=S.strategy||S.level<2?0:S.level<6?1:S.level===6?2:3)<<6,S.strstart!==0&&(V|=32),V+=31-V%31,S.status=B,J(S,V),S.strstart!==0&&(J(S,g.adler>>>16),J(S,65535&g.adler)),g.adler=1}if(S.status===69)if(S.gzhead.extra){for(C=S.pending;S.gzindex<(65535&S.gzhead.extra.length)&&(S.pending!==S.pending_buf_size||(S.gzhead.hcrc&&S.pending>C&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),z(g),C=S.pending,S.pending!==S.pending_buf_size));)te(S,255&S.gzhead.extra[S.gzindex]),S.gzindex++;S.gzhead.hcrc&&S.pending>C&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),S.gzindex===S.gzhead.extra.length&&(S.gzindex=0,S.status=73)}else S.status=73;if(S.status===73)if(S.gzhead.name){C=S.pending;do{if(S.pending===S.pending_buf_size&&(S.gzhead.hcrc&&S.pending>C&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),z(g),C=S.pending,S.pending===S.pending_buf_size)){F=1;break}F=S.gzindexC&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),F===0&&(S.gzindex=0,S.status=91)}else S.status=91;if(S.status===91)if(S.gzhead.comment){C=S.pending;do{if(S.pending===S.pending_buf_size&&(S.gzhead.hcrc&&S.pending>C&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),z(g),C=S.pending,S.pending===S.pending_buf_size)){F=1;break}F=S.gzindexC&&(g.adler=u(g.adler,S.pending_buf,S.pending-C,C)),F===0&&(S.status=103)}else S.status=103;if(S.status===103&&(S.gzhead.hcrc?(S.pending+2>S.pending_buf_size&&z(g),S.pending+2<=S.pending_buf_size&&(te(S,255&g.adler),te(S,g.adler>>8&255),g.adler=0,S.status=B)):S.status=B),S.pending!==0){if(z(g),g.avail_out===0)return S.last_flush=-1,h}else if(g.avail_in===0&&$(U)<=$(W)&&U!==p)return X(g,-5);if(S.status===666&&g.avail_in!==0)return X(g,-5);if(g.avail_in!==0||S.lookahead!==0||U!==d&&S.status!==666){var Z=S.strategy===2?function(L,Q){for(var re;;){if(L.lookahead===0&&(me(L),L.lookahead===0)){if(Q===d)return v;break}if(L.match_length=0,re=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++,re&&(M(L,!1),L.strm.avail_out===0))return v}return L.insert=0,Q===p?(M(L,!0),L.strm.avail_out===0?H:A):L.last_lit&&(M(L,!1),L.strm.avail_out===0)?v:T}(S,U):S.strategy===3?function(L,Q){for(var re,ee,se,ve,he=L.window;;){if(L.lookahead<=R){if(me(L),L.lookahead<=R&&Q===d)return v;if(L.lookahead===0)break}if(L.match_length=0,L.lookahead>=D&&0L.lookahead&&(L.match_length=L.lookahead)}if(L.match_length>=D?(re=a._tr_tally(L,1,L.match_length-D),L.lookahead-=L.match_length,L.strstart+=L.match_length,L.match_length=0):(re=a._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++),re&&(M(L,!1),L.strm.avail_out===0))return v}return L.insert=0,Q===p?(M(L,!0),L.strm.avail_out===0?H:A):L.last_lit&&(M(L,!1),L.strm.avail_out===0)?v:T}(S,U):s[S.level].func(S,U);if(Z!==H&&Z!==A||(S.status=666),Z===v||Z===H)return g.avail_out===0&&(S.last_flush=-1),h;if(Z===T&&(U===1?a._tr_align(S):U!==5&&(a._tr_stored_block(S,0,0,!1),U===3&&(ne(S.head),S.lookahead===0&&(S.strstart=0,S.block_start=0,S.insert=0))),z(g),g.avail_out===0))return S.last_flush=-1,h}return U!==p?h:S.wrap<=0?1:(S.wrap===2?(te(S,255&g.adler),te(S,g.adler>>8&255),te(S,g.adler>>16&255),te(S,g.adler>>24&255),te(S,255&g.total_in),te(S,g.total_in>>8&255),te(S,g.total_in>>16&255),te(S,g.total_in>>24&255)):(J(S,g.adler>>>16),J(S,65535&g.adler)),z(g),0=W.w_size&&(F===0&&(ne(W.head),W.strstart=0,W.block_start=0,W.insert=0),Q=new i.Buf8(W.w_size),i.arraySet(Q,U,re-W.w_size,W.w_size,0),U=Q,re=W.w_size),V=g.avail_in,Z=g.next_in,L=g.input,g.avail_in=re,g.next_in=0,g.input=U,me(W);W.lookahead>=D;){for(S=W.strstart,C=W.lookahead-(D-1);W.ins_h=(W.ins_h<>>=D=N>>>24,_-=D,(D=N>>>16&255)===0)T[c++]=65535&N;else{if(!(16&D)){if(!(64&D)){N=k[(65535&N)+(w&(1<>>=D,_-=D),_<15&&(w+=v[l++]<<_,_+=8,w+=v[l++]<<_,_+=8),N=x[w&E];n:for(;;){if(w>>>=D=N>>>24,_-=D,!(16&(D=N>>>16&255))){if(!(64&D)){N=x[(65535&N)+(w&(1<>>=D,_-=D,(D=c-d)>3,w&=(1<<(_-=R<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(P>>>8&65280)+((65280&P)<<8)+((255&P)<<24)}function w(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(P){var B;return P&&P.state?(B=P.state,P.total_in=P.total_out=B.total=0,P.msg="",B.wrap&&(P.adler=1&B.wrap),B.mode=b,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new s.Buf32(f),B.distcode=B.distdyn=new s.Buf32(y),B.sane=1,B.back=-1,p):h}function k(P){var B;return P&&P.state?((B=P.state).wsize=0,B.whave=0,B.wnext=0,_(P)):h}function x(P,B){var v,T;return P&&P.state?(T=P.state,B<0?(v=0,B=-B):(v=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15=A.wsize?(s.arraySet(A.window,B,v-A.wsize,A.wsize,0),A.wnext=0,A.whave=A.wsize):(T<(H=A.wsize-A.wnext)&&(H=T),s.arraySet(A.window,B,v-T,H,A.wnext),(T-=H)?(s.arraySet(A.window,B,v-T,T,0),A.wnext=T,A.whave=A.wsize):(A.wnext+=H,A.wnext===A.wsize&&(A.wnext=0),A.whave>>8&255,v.check=a(v.check,F,2,0),M=z=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&z)<<8)+(z>>8))%31){P.msg="incorrect header check",v.mode=30;break}if((15&z)!=8){P.msg="unknown compression method",v.mode=30;break}if(M-=4,g=8+(15&(z>>>=4)),v.wbits===0)v.wbits=g;else if(g>v.wbits){P.msg="invalid window size",v.mode=30;break}v.dmax=1<>8&1),512&v.flags&&(F[0]=255&z,F[1]=z>>>8&255,v.check=a(v.check,F,2,0)),M=z=0,v.mode=3;case 3:for(;M<32;){if($===0)break e;$--,z+=T[A++]<>>8&255,F[2]=z>>>16&255,F[3]=z>>>24&255,v.check=a(v.check,F,4,0)),M=z=0,v.mode=4;case 4:for(;M<16;){if($===0)break e;$--,z+=T[A++]<>8),512&v.flags&&(F[0]=255&z,F[1]=z>>>8&255,v.check=a(v.check,F,2,0)),M=z=0,v.mode=5;case 5:if(1024&v.flags){for(;M<16;){if($===0)break e;$--,z+=T[A++]<>>8&255,v.check=a(v.check,F,2,0)),M=z=0}else v.head&&(v.head.extra=null);v.mode=6;case 6:if(1024&v.flags&&($<(G=v.length)&&(G=$),G&&(v.head&&(g=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),s.arraySet(v.head.extra,T,A,G,g)),512&v.flags&&(v.check=a(v.check,T,G,A)),$-=G,A+=G,v.length-=G),v.length))break e;v.length=0,v.mode=7;case 7:if(2048&v.flags){if($===0)break e;for(G=0;g=T[A+G++],v.head&&g&&v.length<65536&&(v.head.name+=String.fromCharCode(g)),g&&G<$;);if(512&v.flags&&(v.check=a(v.check,T,G,A)),$-=G,A+=G,g)break e}else v.head&&(v.head.name=null);v.length=0,v.mode=8;case 8:if(4096&v.flags){if($===0)break e;for(G=0;g=T[A+G++],v.head&&g&&v.length<65536&&(v.head.comment+=String.fromCharCode(g)),g&&G<$;);if(512&v.flags&&(v.check=a(v.check,T,G,A)),$-=G,A+=G,g)break e}else v.head&&(v.head.comment=null);v.mode=9;case 9:if(512&v.flags){for(;M<16;){if($===0)break e;$--,z+=T[A++]<>9&1,v.head.done=!0),P.adler=v.check=0,v.mode=12;break;case 10:for(;M<32;){if($===0)break e;$--,z+=T[A++]<>>=7&M,M-=7&M,v.mode=27;break}for(;M<3;){if($===0)break e;$--,z+=T[A++]<>>=1)){case 0:v.mode=14;break;case 1:if(R(v),v.mode=20,B!==6)break;z>>>=2,M-=2;break e;case 2:v.mode=17;break;case 3:P.msg="invalid block type",v.mode=30}z>>>=2,M-=2;break;case 14:for(z>>>=7&M,M-=7&M;M<32;){if($===0)break e;$--,z+=T[A++]<>>16^65535)){P.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&z,M=z=0,v.mode=15,B===6)break e;case 15:v.mode=16;case 16:if(G=v.length){if($>>=5,M-=5,v.ndist=1+(31&z),z>>>=5,M-=5,v.ncode=4+(15&z),z>>>=4,M-=4,286>>=3,M-=3}for(;v.have<19;)v.lens[V[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,W={bits:v.lenbits},U=u(0,v.lens,0,19,v.lencode,0,v.work,W),v.lenbits=W.bits,U){P.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have>>16&255,_e=65535&C,!((ie=C>>>24)<=M);){if($===0)break e;$--,z+=T[A++]<>>=ie,M-=ie,v.lens[v.have++]=_e;else{if(_e===16){for(S=ie+2;M>>=ie,M-=ie,v.have===0){P.msg="invalid bit length repeat",v.mode=30;break}g=v.lens[v.have-1],G=3+(3&z),z>>>=2,M-=2}else if(_e===17){for(S=ie+3;M>>=ie)),z>>>=3,M-=3}else{for(S=ie+7;M>>=ie)),z>>>=7,M-=7}if(v.have+G>v.nlen+v.ndist){P.msg="invalid bit length repeat",v.mode=30;break}for(;G--;)v.lens[v.have++]=g}}if(v.mode===30)break;if(v.lens[256]===0){P.msg="invalid code -- missing end-of-block",v.mode=30;break}if(v.lenbits=9,W={bits:v.lenbits},U=u(c,v.lens,0,v.nlen,v.lencode,0,v.work,W),v.lenbits=W.bits,U){P.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,W={bits:v.distbits},U=u(d,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,W),v.distbits=W.bits,U){P.msg="invalid distances set",v.mode=30;break}if(v.mode=20,B===6)break e;case 20:v.mode=21;case 21:if(6<=$&&258<=ne){P.next_out=X,P.avail_out=ne,P.next_in=A,P.avail_in=$,v.hold=z,v.bits=M,l(P,J),X=P.next_out,H=P.output,ne=P.avail_out,A=P.next_in,T=P.input,$=P.avail_in,z=v.hold,M=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;ue=(C=v.lencode[z&(1<>>16&255,_e=65535&C,!((ie=C>>>24)<=M);){if($===0)break e;$--,z+=T[A++]<>ye)])>>>16&255,_e=65535&C,!(ye+(ie=C>>>24)<=M);){if($===0)break e;$--,z+=T[A++]<>>=ye,M-=ye,v.back+=ye}if(z>>>=ie,M-=ie,v.back+=ie,v.length=_e,ue===0){v.mode=26;break}if(32&ue){v.back=-1,v.mode=12;break}if(64&ue){P.msg="invalid literal/length code",v.mode=30;break}v.extra=15&ue,v.mode=22;case 22:if(v.extra){for(S=v.extra;M>>=v.extra,M-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;ue=(C=v.distcode[z&(1<>>16&255,_e=65535&C,!((ie=C>>>24)<=M);){if($===0)break e;$--,z+=T[A++]<>ye)])>>>16&255,_e=65535&C,!(ye+(ie=C>>>24)<=M);){if($===0)break e;$--,z+=T[A++]<>>=ye,M-=ye,v.back+=ye}if(z>>>=ie,M-=ie,v.back+=ie,64&ue){P.msg="invalid distance code",v.mode=30;break}v.offset=_e,v.extra=15&ue,v.mode=24;case 24:if(v.extra){for(S=v.extra;M>>=v.extra,M-=v.extra,v.back+=v.extra}if(v.offset>v.dmax){P.msg="invalid distance too far back",v.mode=30;break}v.mode=25;case 25:if(ne===0)break e;if(G=J-ne,v.offset>G){if((G=v.offset-G)>v.whave&&v.sane){P.msg="invalid distance too far back",v.mode=30;break}me=G>v.wnext?(G-=v.wnext,v.wsize-G):v.wnext-G,G>v.length&&(G=v.length),we=v.window}else we=H,me=X-v.offset,G=v.length;for(neE?(D=me[we+y[B]],M[te+y[B]]):(D=96,0),w=1<>X)+(_-=w)]=N<<24|D<<16|R|0,_!==0;);for(w=1<>=1;if(w!==0?(z&=w-1,z+=w):z=0,B++,--J[P]==0){if(P===T)break;P=d[p+y[B]]}if(H>>7)]}function te(C,F){C.pending_buf[C.pending++]=255&F,C.pending_buf[C.pending++]=F>>>8&255}function J(C,F,V){C.bi_valid>m-V?(C.bi_buf|=F<>m-C.bi_valid,C.bi_valid+=V-m):(C.bi_buf|=F<>>=1,V<<=1,0<--F;);return V>>>1}function we(C,F,V){var Z,L,Q=new Array(y+1),re=0;for(Z=1;Z<=y;Z++)Q[Z]=re=re+V[Z-1]<<1;for(L=0;L<=F;L++){var ee=C[2*L+1];ee!==0&&(C[2*L]=me(Q[ee]++,ee))}}function ie(C){var F;for(F=0;F>1;1<=V;V--)ye(C,Q,V);for(L=se;V=C.heap[1],C.heap[1]=C.heap[C.heap_len--],ye(C,Q,1),Z=C.heap[1],C.heap[--C.heap_max]=V,C.heap[--C.heap_max]=Z,Q[2*L]=Q[2*V]+Q[2*Z],C.depth[L]=(C.depth[V]>=C.depth[Z]?C.depth[V]:C.depth[Z])+1,Q[2*V+1]=Q[2*Z+1]=L,C.heap[1]=L++,ye(C,Q,1),2<=C.heap_len;);C.heap[--C.heap_max]=C.heap[1],function(he,Ge){var yn,rt,vn,je,Yn,to,ut=Ge.dyn_tree,Ks=Ge.max_code,cl=Ge.stat_desc.static_tree,ul=Ge.stat_desc.has_stree,dl=Ge.stat_desc.extra_bits,$s=Ge.stat_desc.extra_base,gn=Ge.stat_desc.max_length,Jn=0;for(je=0;je<=y;je++)he.bl_count[je]=0;for(ut[2*he.heap[he.heap_max]+1]=0,yn=he.heap_max+1;yn>=7;L>>=1)if(1&ve&&ee.dyn_ltree[2*se]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(se=32;se>>3,(Q=C.static_len+3+7>>>3)<=L&&(L=Q)):L=Q=V+5,V+4<=L&&F!==-1?S(C,F,V,Z):C.strategy===4||Q===L?(J(C,2+(Z?1:0),3),pe(C,K,P)):(J(C,4+(Z?1:0),3),function(ee,se,ve,he){var Ge;for(J(ee,se-257,5),J(ee,ve-1,5),J(ee,he-4,4),Ge=0;Ge>>8&255,C.pending_buf[C.d_buf+2*C.last_lit+1]=255&F,C.pending_buf[C.l_buf+C.last_lit]=255&V,C.last_lit++,F===0?C.dyn_ltree[2*V]++:(C.matches++,F--,C.dyn_ltree[2*(v[V]+d+1)]++,C.dyn_dtree[2*M(F)]++),C.last_lit===C.lit_bufsize-1},o._tr_align=function(C){J(C,2,3),G(C,_,K),function(F){F.bi_valid===16?(te(F,F.bi_buf),F.bi_buf=0,F.bi_valid=0):8<=F.bi_valid&&(F.pending_buf[F.pending++]=255&F.bi_buf,F.bi_buf>>=8,F.bi_valid-=8)}(C)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,a){if(!i.setImmediate){var l,u,c,d,p=1,h={},b=!1,f=i.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(i);y=y&&y.setTimeout?y:i,l={}.toString.call(i.process)==="[object process]"?function(k){process.nextTick(function(){w(k)})}:function(){if(i.postMessage&&!i.importScripts){var k=!0,x=i.onmessage;return i.onmessage=function(){k=!1},i.postMessage("","*"),i.onmessage=x,k}}()?(d="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",_,!1):i.attachEvent("onmessage",_),function(k){i.postMessage(d+k,"*")}):i.MessageChannel?((c=new MessageChannel).port1.onmessage=function(k){w(k.data)},function(k){c.port2.postMessage(k)}):f&&"onreadystatechange"in f.createElement("script")?(u=f.documentElement,function(k){var x=f.createElement("script");x.onreadystatechange=function(){w(k),x.onreadystatechange=null,u.removeChild(x),x=null},u.appendChild(x)}):function(k){setTimeout(w,0,k)},y.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var x=new Array(arguments.length-1),I=0;I"u"?s===void 0?this:s:self)}).call(this,typeof Xn<"u"?Xn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(ll);var Zh=ll.exports;const Gh=xa(Zh);async function Yh(t){let e="",n=t;for(;n!=null;){const r=await(qe==null?void 0:qe.get(n));if(r==null)break;e=`${r.name}/${e}`,n=r.parentFolderID??null}return e}async function Op(t){if(await(Y==null?void 0:Y.getSetting("twoWaySync")))return await Ct.genFilesCountInFolder(t)??0;const n=await(q==null?void 0:q.listAll())??[],r=await(qe==null?void 0:qe.listAll())??[],o=[t];let s=0;for(;o.length>0;){const i=o.shift();if(i){for(const l of n)l.parentFolderID===i&&s++;const a=r.filter(l=>l.parentFolderID===i).map(l=>l.id);a.length&&o.push(...a)}}return s}const Jh=async t=>{const e=`ComfyUI workspace workflows ${el(Date.now())}`,n=new Gh,r=await(Y==null?void 0:Y.getSetting("twoWaySync"));for(const o of t){let s;r?s=o.parentFolderID??"":s=await Yh(o.parentFolderID??null).then(async a=>Pt(a??""));const i=n.folder(s);i==null||i.file(`${o.name}.json`,o.json)}n.generateAsync({type:"blob"}).then(function(o){const s=document.createElement("a");s.href=window.URL.createObjectURL(o),s.download=`${e}.zip`,document.body.appendChild(s),s.click(),document.body.removeChild(s)})};function Xh({myWorkflowsDir:t}){return O.jsxs(rn,{gap:3,children:[O.jsx(ms,{size:"md",children:"🦄 Upgrade to 2.0 - enable two way sync!"}),O.jsx("p",{children:"Your workflows will be synced to and from path:"}),O.jsx("p",{children:O.jsx("b",{children:t})}),O.jsxs("p",{children:["You can manually put workflow files into this folder using File Explorer to sync them with your workspace. You can change this path anytime in Settings ",">"," Workspace Save Directory"]}),O.jsxs("p",{children:[O.jsx("b",{children:"Please download all your workflows before enabling two way sync as a backup!"})," ","So you can manually import some workflows into your workspace in case something unexpected happens."]}),O.jsx(Le,{colorScheme:"teal",variant:"outline",width:"fit-content",onClick:async()=>{const e=await(q==null?void 0:q.listAll());Jh(e??[])},children:"👉 Download All My Workflows"})]})}const Qh=Da.lazy(()=>At(()=>import("./RecentFilesDrawer-g7Y8NeOQ.js"),__vite__mapDeps([15,1,9,3,14,16,13,5]))),ep=Da.lazy(()=>At(()=>import("./GalleryModal-XNUSEfqI.js"),__vite__mapDeps([17,1,16,13,3,10,9,4])));function tp(){const[t,e]=j.useState(null),[n,r]=j.useState("root"),[o,s]=j.useState(!0),[i,a]=j.useState(null),l=j.useRef(null),[u,c]=j.useState(!1),d=j.useRef(null),{showDialog:p}=Ia(),[h,b]=j.useState(!1);j.useRef(!1);const f=ja(),[y,m]=Vh(null),w=j.useCallback(async(v=!1)=>{var H,A;const T=q==null?void 0:q.curWorkflow;if(T){if(!v&&((H=q==null?void 0:q.curWorkflow)!=null&&H.saveLock)){f({title:"The workflow is locked and cannot be saved",status:"warning",duration:3e3});return}const X=JSON.stringify(Pe.graph.serialize());await Promise.all([q==null?void 0:q.updateFlow(T.id,{json:X}),He==null?void 0:He.create({workflowID:T.id,json:X,isAutoSave:!1})]),(A=Y==null?void 0:Y.settings)!=null&&A.autoSave&&f({title:"Saved",status:"success",duration:1e3,isClosable:!0}),c(!1)}},[]),_=async()=>{var T,H,A;if((T=Y==null?void 0:Y.settings)!=null&&T.autoSave){alert("You cannot discard unsaved changes when auto save is enabled");return}if(confirm("Are you sure you want to discard unsaved changes? This will revert current workflow to your last saved version. You will lose all changes made since your last save.")){const X=(H=q==null?void 0:q.curWorkflow)==null?void 0:H.id;if(X==null)return;const $=(A=await(q==null?void 0:q.get(X)))==null?void 0:A.json;$?(q==null||q.updateCurWorkflow({...q.curWorkflow,json:$}),await Pe.loadGraphData(JSON.parse($)),c(!1)):alert("Error: No last saved version found")}},k=v=>{const T=(v==null?void 0:v.id)??null;if(q==null||q.updateCurWorkflow(v),l.current=T,a(T),e((v==null?void 0:v.name)??""),T==null){document.title="ComfyUI",window.location.hash="",localStorage.removeItem("curFlowID");return}if(ba()){const H=tl(T);window.location.hash=H,document.title=v.name+" - ComfyUI"}else localStorage.setItem("curFlowID",T),document.title="ComfyUI - "+v.name;v&&(q==null||q.updateLastOpenedTime(v.id))},x=async()=>{var H,A;localStorage.removeItem("workspace"),localStorage.removeItem("comfyspace");try{await rh()}catch(X){console.error("error loading db",X)}s(!1);const v=ba();if(v==null){const X=localStorage.getItem("workflow");if(X){const ne=(A=(H=JSON.parse(X).extra)==null?void 0:H[xt])==null?void 0:A.id;if(ne){const z=await(q==null?void 0:q.get(ne));z&&k(z),!(z!=null&&z.saveLock)&&z&&z.json!=X&&c(!0)}}}else I(v);Ie("/workspace/deduplicate_workflow_ids"),!await(Y==null?void 0:Y.getSetting("twoWaySync"))&&ce.cache.get(yo).then(async X=>{if((X==null?void 0:X.value)!=="true"){if(await ce.workflows.count()==0){await(Y==null?void 0:Y.upsert({twoWaySync:!0})),await ce.cache.put({id:yo,value:"true"});return}const ne=await(Y==null?void 0:Y.getSetting("myWorkflowsDir"));p(O.jsx(Xh,{myWorkflowsDir:ne??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{await(Y==null?void 0:Y.upsert({twoWaySync:!0})),await(Y==null?void 0:Y.getSetting("twoWaySync"))&&(ce.cache.put({id:yo,value:"true"}),location.reload())},colorScheme:"red"}],{closeOnOverlayClick:!1})}})},I=async(v,T)=>{if(Pe.graph==null)return;const H=await(q==null?void 0:q.get(v));if(H==null){alert("Error: Workflow not found! id: "+v),k(null);return}const A=T?await(ge==null?void 0:ge.get(T)):null;Pe.ui.dialog.close(),A?(m(A),k({...H,json:A.json}),Pe.loadGraphData(JSON.parse(A.json))):(k(H),m(null),Pe.loadGraphData(JSON.parse(H.json))),r("root"),u&&c(!1)},E=async(v,T,H=!1)=>{var A;if(v===null){k(null),Pe.graph.clear();return}if(!u||H||(A=Y==null?void 0:Y.settings)!=null&&A.autoSave||(q==null?void 0:q.curWorkflow)==null){I(v,T);return}N(v)},N=async v=>{var H;const T=[v?{label:"Open in new tab",icon:O.jsx(mh,{}),onClick:()=>{Yf(v)}}:null,{label:"Save",colorScheme:"teal",onClick:async()=>{await w(),v&&I(v)}}];T.push({label:"Discard",colorScheme:"red",onClick:async()=>{v&&I(v)}}),p(`Please save or discard your changes to "${(H=q==null?void 0:q.curWorkflow)==null?void 0:H.name}" before leaving, or your changes will be lost.`,T)},D=async v=>{const T=(v==null?void 0:v.json)??JSON.stringify(nl),H=await(q==null?void 0:q.createFlow({json:T,name:v==null?void 0:v.name}));H&&await E(H.id),r("root")},R=async(v,T=!1)=>{const H=v.split("/").pop()??v;T?w():D({name:H});const A=await fetch(Gf(v)),X=await A.blob(),$=new File([X],H,{type:A.headers.get("Content-Type")||""});await Pe.handleFile($),r("root")},K=async(v,T)=>{const H=await(q==null?void 0:q.get(v));if(H==null)return;const A=await(q==null?void 0:q.createFlow({json:H.json,name:T||H.name,parentFolderID:H.parentFolderID,tags:H.tags}));A&&await E(A.id)},P=j.useCallback(v=>{if(l.current==null)return;let T=v.filename;v.subfolder!=null&&v.subfolder!==""&&(T=v.subfolder+"/"+T),$t==null||$t.create({workflowID:l.current,localPath:T})},[]),B=j.useCallback(()=>{r("root")},[]);return j.useEffect(()=>{x(),b(!0);const v=T=>{var H,A,X,$,ne,z;(X=(A=(H=T.detail)==null?void 0:H.output)==null?void 0:A.images)==null||X.forEach(M=>{M.type==="output"&&P(M)}),(z=(ne=($=T.detail)==null?void 0:$.output)==null?void 0:ne.gifs)==null||z.forEach(M=>{M.type==="output"&&P(M)})};return Er.addEventListener("executed",v),()=>{window.removeEventListener("executed",v)}},[]),o?null:O.jsx(wt.Provider,{value:{curFlowID:i,onDuplicateWorkflow:K,loadWorkflowID:E,discardUnsavedChanges:_,saveCurWorkflow:w,isDirty:u,setIsDirty:c,loadNewWorkflow:D,loadFilePath:R,setRoute:r,route:n,curVersion:y,setCurVersion:m,setCurFlowIDAndName:k},children:O.jsx("div",{ref:d,className:"workspace_manager",children:O.jsxs(Sa,{containerRef:d,children:[O.jsxs(St,{style:{position:"absolute",top:0,right:0,left:0},zIndex:Jf,draggable:!1,children:[O.jsx(Kh,{curFlowName:t,setCurFlowName:e}),h&&n==="recentFlows"&&O.jsx(j.Suspense,{children:O.jsx(Qh,{onClose:B,onClickNewFlow:()=>{D(),r("root")}})}),n==="gallery"&&O.jsx(j.Suspense,{children:O.jsx(ep,{onclose:()=>r("root")})})]}),O.jsx($h,{})]})})})}const Ip=Object.freeze(Object.defineProperty({__proto__:null,default:tp},Symbol.toStringTag,{value:"Module"}));export{Ie as $,hh as A,St as B,pp as C,Oh as D,$f as E,xn as F,yh as G,zt as H,jn as I,qe as J,qr as K,Vr as L,li as M,Hr as N,_h as O,nl as P,Op as Q,kp as R,dd as S,Xr as T,gr as U,nh as V,hp as W,wt as X,mh as Y,Yf as Z,al as _,ap as a,$t as a0,el as a1,at as a2,Pe as a3,Hl as a4,Jf as a5,lp as a6,wr as a7,mp as a8,Fa as a9,wp as aA,Ws as aB,ps as aC,Ep as aD,xp as aE,Cp as aF,Fn as aG,Nh as aH,Sp as aI,Ip as aJ,ec as aa,vp as ab,ms as ac,nn as ad,tc as ae,xt as af,gp as ag,yp as ah,He as ai,Nl as aj,Hn as ak,Is as al,ce as am,cp as an,bp as ao,_p as ap,up as aq,Er as ar,dp as as,bc as at,ui as au,ci as av,pi as aw,fi as ax,Vh as ay,eh as az,op as b,sp as c,Re as d,xh as e,ja as f,rn as g,Mt as h,Ht as i,Un as j,Y as k,Xh as l,_c as m,Vd as n,ip as o,fp as p,_o as q,Ss as r,Os as s,_r as t,Gr as u,bt as v,ph as w,q as x,Sh as y,Jh as z}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["workspace_web/ShareDialog-t7mRPVSb.js","workspace_web/input.js","workspace_web/civitUtils-uJNBxoFV.js","workspace_web/chunk-7D6N5TE5-fihyubSX.js","workspace_web/chunk-VTV6N5LE-7BSZDdqw.js","workspace_web/IconCopy-DxyTNBlz.js","workspace_web/AppIsDirtyEventListener-xmtnIvLQ.js","workspace_web/useDebounceFn-ld478fd0.js","workspace_web/ModelManagerTopbar-4hMR9SRa.js","workspace_web/chunk-JARCRF6W-UyOcndjS.js","workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js","workspace_web/assets/ModelManagerTopbar--iv3sdjQ.css","workspace_web/SpotlightSearch-crj3ER75.js","workspace_web/IconSearch-qxAzDzhT.js","workspace_web/chunk-NTCQBYKE-HH_ifqNx.js","workspace_web/RecentFilesDrawer-g7Y8NeOQ.js","workspace_web/MediaPreview-muJLkZRm.js","workspace_web/GalleryModal-XNUSEfqI.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/workspace_web/AppIsDirtyEventListener-xmtnIvLQ.js b/dist/workspace_web/AppIsDirtyEventListener-xmtnIvLQ.js deleted file mode 100644 index cd10d2a..0000000 --- a/dist/workspace_web/AppIsDirtyEventListener-xmtnIvLQ.js +++ /dev/null @@ -1 +0,0 @@ -import{r as u,j as E}from"./input.js";import{X as x,a3 as r,af as C,x as a,i as W,T as A,E as d,ag as L,ah as R,k as h,ai as j}from"./App-1AImvRpr.js";import{u as O}from"./useDebounceFn-ld478fd0.js";function M(){const{isDirty:p,setIsDirty:k,setRoute:v,saveCurWorkflow:T,setCurFlowIDAndName:b}=u.useContext(x),w=u.useRef(p),[S,D]=u.useState(!1),g=u.useRef(null);u.useEffect(()=>{w.current=p},[p]),u.useEffect(()=>{var n,i;const c=e=>{var s;if(document.visibilityState==="hidden")return;const t=R(e);if(t)switch(t===d.openSpotlightSearch&&e.preventDefault(),window.dispatchEvent(new CustomEvent(L,{detail:{shortcutType:t}})),t){case d.SAVE:T();break;case d.SAVE_AS:v("saveAsModal");break;case d.openSpotlightSearch:v("spotlightSearch");break}else(s=e.target)!=null&&s.matches("input, textarea")&&Object.keys(r.canvas.selected_nodes??{}).length&&m()},o=r.graph.onConfigure;return r.graph.onConfigure=function(){o==null||o.apply(this,arguments),setTimeout(()=>{var t,s,l,f;const e=(s=(t=r.graph.extra)==null?void 0:t[C])==null?void 0:s.id;(e==null||e!=((f=(l=a)==null?void 0:l.curWorkflow)==null?void 0:f.id))&&b(null)},500)},document.addEventListener("click",e=>{Object.keys(r.canvas.selected_nodes??{}).length&&(r.canvas.node_over!=null||r.canvas.node_capturing_input!=null||r.canvas.node_widget!=null)&&m()}),document.addEventListener("keydown",c),(i=(n=h)==null?void 0:n.settings)!=null&&i.autoSave&&h.settings.autoSaveDuration&&(g.current=setInterval(()=>{_()},h.settings.autoSaveDuration*1e3)),()=>{document.removeEventListener("keydown",c),g.current&&clearInterval(g.current)}},[]);const _=async()=>{var o,n,i,e,t,s;if((n=(o=a)==null?void 0:o.curWorkflow)!=null&&n.saveLock||!((e=(i=a)==null?void 0:i.curWorkflow)!=null&&e.id)||!w.current)return;const c=JSON.stringify(r.graph.serialize());await((t=a)==null?void 0:t.updateFlow(a.curWorkflow.id,{json:c})),(s=j)==null||s.create({workflowID:a.curWorkflow.id,isAutoSave:!0,json:c}),k(!1)},I=async()=>{var o,n,i,e,t,s,l,f,y;if((n=(o=a)==null?void 0:o.curWorkflow)!=null&&n.saveLock||w.current)return;const c=r.graph.serialize();JSON.stringify(c)!==((e=(i=a)==null?void 0:i.curWorkflow)==null?void 0:e.json)&&(k(!0),(s=(t=h)==null?void 0:t.settings)!=null&&s.autoSave&&((f=(l=a)==null?void 0:l.curWorkflow)!=null&&f.id)&&!S&&(await((y=a)==null?void 0:y.latestVersionCheck())||D(!0)))},[m,N]=O(I,900);return S?E.jsx(W,{label:"This workflow was changed by another tab, so you are not working on the latest version. Please refresh page to see the latest version of this workflow.",children:E.jsx(A,{colorScheme:"yellow",children:"⚠️Outdated version"})}):null}export{M as default}; diff --git a/dist/workspace_web/GalleryModal-XNUSEfqI.js b/dist/workspace_web/GalleryModal-XNUSEfqI.js deleted file mode 100644 index 8c25d81..0000000 --- a/dist/workspace_web/GalleryModal-XNUSEfqI.js +++ /dev/null @@ -1 +0,0 @@ -import{r as d,d as Se,x as Ht,m as be,b as it,f as O,k as Kt,o as ct,E as Wt,j as r,g as L,n as Yt,e as Xt,V as ut,h as dt,M as Zt,N as qt,O as Jt,Q as Qt,R as en,S as tn}from"./input.js";import{a9 as nn,aa as sn,d as Re,F as m,ab as rn,I as M,j as on,g as Ee,B as ht,h as W,X as oe,a3 as tt,x as R,H as Y,i as A,w as ft,a1 as xt,e as pt,a0 as F,ac as an,y as ln}from"./App-1AImvRpr.js";import{c as je,p as cn,r as nt,v as st,I as un,i as dn,b as hn,d as fn,g as xn,N as pn,a as gn,e as mn,f as vn,h as yn,M as gt,u as wn,S as Sn}from"./MediaPreview-muJLkZRm.js";import{I as bn}from"./chunk-7D6N5TE5-fihyubSX.js";import{S as jn}from"./chunk-3RSXBRAN-gZ_JDRlM.js";import{C as Ae,G as kn}from"./chunk-JARCRF6W-UyOcndjS.js";import{S as rt,L as Ne}from"./chunk-VTV6N5LE-7BSZDdqw.js";import"./IconSearch-qxAzDzhT.js";const mt=1/60*1e3,Pn=typeof performance<"u"?()=>performance.now():()=>Date.now(),vt=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(Pn()),mt);function Cn(e){let t=[],s=[],n=0,o=!1,a=!1;const l=new WeakSet,c={schedule:(i,u=!1,p=!1)=>{const f=p&&o,v=f?t:s;return u&&l.add(i),v.indexOf(i)===-1&&(v.push(i),f&&o&&(n=t.length)),i},cancel:i=>{const u=s.indexOf(i);u!==-1&&s.splice(u,1),l.delete(i)},process:i=>{if(o){a=!0;return}if(o=!0,[t,s]=[s,t],s.length=0,n=t.length,n)for(let u=0;u(e[t]=Cn(()=>X=!0),e),{}),Tn=Z.reduce((e,t)=>{const s=ae[t];return e[t]=(n,o=!1,a=!1)=>(X||Mn(),s.schedule(n,o,a)),e},{}),En=Z.reduce((e,t)=>(e[t]=ae[t].cancel,e),{});Z.reduce((e,t)=>(e[t]=()=>ae[t].process(B),e),{});const Nn=e=>ae[e].process(B),yt=e=>{X=!1,B.delta=Me?mt:Math.max(Math.min(e-B.timestamp,In),1),B.timestamp=e,_e=!0,Z.forEach(Nn),_e=!1,X&&(Me=!1,vt(yt))},Mn=()=>{X=!0,Me=!0,_e||vt(yt)},ot=()=>B;var V=e=>e?"":void 0,ke=e=>e?!0:void 0,q=(...e)=>e.filter(Boolean).join(" ");function Pe(...e){return function(s){e.some(n=>(n==null||n(s),s==null?void 0:s.defaultPrevented))}}function Q(e){const{orientation:t,vertical:s,horizontal:n}=e;return t==="vertical"?s:n}var te={width:0,height:0},ee=e=>e||te;function _n(e){const{orientation:t,thumbPercents:s,thumbRects:n,isReversed:o}=e,a=y=>{var w;const E=(w=n[y])!=null?w:te;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Q({orientation:t,vertical:{bottom:`calc(${s[y]}% - ${E.height/2}px)`},horizontal:{left:`calc(${s[y]}% - ${E.width/2}px)`}})}},l=t==="vertical"?n.reduce((y,w)=>ee(y).height>ee(w).height?y:w,te):n.reduce((y,w)=>ee(y).width>ee(w).width?y:w,te),c={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Q({orientation:t,vertical:l?{paddingLeft:l.width/2,paddingRight:l.width/2}:{},horizontal:l?{paddingTop:l.height/2,paddingBottom:l.height/2}:{}})},i={position:"absolute",...Q({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},u=s.length===1,p=[0,o?100-s[0]:s[0]],f=u?p:s;let v=f[0];!u&&o&&(v=100-v);const g=Math.abs(f[f.length-1]-f[0]),I={...i,...Q({orientation:t,vertical:o?{height:`${g}%`,top:`${v}%`}:{height:`${g}%`,bottom:`${v}%`},horizontal:o?{width:`${g}%`,right:`${v}%`}:{width:`${g}%`,left:`${v}%`}})};return{trackStyle:i,innerTrackStyle:I,rootStyle:c,getThumbStyle:a}}function Dn(e){const{isReversed:t,direction:s,orientation:n}=e;return s==="ltr"||n==="vertical"?t:!t}function zn(e,t,s,n){return e.addEventListener(t,s,n),()=>{e.removeEventListener(t,s,n)}}function Rn(e){const t=Fn(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function wt(e){return!!e.touches}function An(e){return wt(e)&&e.touches.length>1}function Fn(e){var t;return(t=e.view)!=null?t:window}function $n(e,t="page"){const s=e.touches[0]||e.changedTouches[0];return{x:s[`${t}X`],y:s[`${t}Y`]}}function Vn(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function St(e,t="page"){return wt(e)?$n(e,t):Vn(e,t)}function Bn(e){return t=>{const s=Rn(t);(!s||s&&t.button===0)&&e(t)}}function On(e,t=!1){function s(o){e(o,{point:St(o)})}return t?Bn(s):s}function ne(e,t,s,n){return zn(e,t,On(s,t==="pointerdown"),n)}var Ln=Object.defineProperty,Gn=(e,t,s)=>t in e?Ln(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,T=(e,t,s)=>(Gn(e,typeof t!="symbol"?t+"":t,s),s),Un=class{constructor(e,t,s){T(this,"history",[]),T(this,"startEvent",null),T(this,"lastEvent",null),T(this,"lastEventInfo",null),T(this,"handlers",{}),T(this,"removeListeners",()=>{}),T(this,"threshold",3),T(this,"win"),T(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const c=Ce(this.lastEventInfo,this.history),i=this.startEvent!==null,u=Yn(c.offset,{x:0,y:0})>=this.threshold;if(!i&&!u)return;const{timestamp:p}=ot();this.history.push({...c.point,timestamp:p});const{onStart:f,onMove:v}=this.handlers;i||(f==null||f(this.lastEvent,c),this.startEvent=this.lastEvent),v==null||v(this.lastEvent,c)}),T(this,"onPointerMove",(c,i)=>{this.lastEvent=c,this.lastEventInfo=i,Tn.update(this.updatePoint,!0)}),T(this,"onPointerUp",(c,i)=>{const u=Ce(i,this.history),{onEnd:p,onSessionEnd:f}=this.handlers;f==null||f(c,u),this.end(),!(!p||!this.startEvent)&&(p==null||p(c,u))});var n;if(this.win=(n=e.view)!=null?n:window,An(e))return;this.handlers=t,s&&(this.threshold=s),e.stopPropagation(),e.preventDefault();const o={point:St(e)},{timestamp:a}=ot();this.history=[{...o.point,timestamp:a}];const{onSessionStart:l}=t;l==null||l(e,Ce(o,this.history)),this.removeListeners=Wn(ne(this.win,"pointermove",this.onPointerMove),ne(this.win,"pointerup",this.onPointerUp),ne(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),En.update(this.updatePoint)}};function at(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ce(e,t){return{point:e.point,delta:at(e.point,t[t.length-1]),offset:at(e.point,t[0]),velocity:Kn(t,.1)}}var Hn=e=>e*1e3;function Kn(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,n=null;const o=e[e.length-1];for(;s>=0&&(n=e[s],!(o.timestamp-n.timestamp>Hn(t)));)s--;if(!n)return{x:0,y:0};const a=(o.timestamp-n.timestamp)/1e3;if(a===0)return{x:0,y:0};const l={x:(o.x-n.x)/a,y:(o.y-n.y)/a};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function Wn(...e){return t=>e.reduce((s,n)=>n(s),t)}function Ie(e,t){return Math.abs(e-t)}function lt(e){return"x"in e&&"y"in e}function Yn(e,t){if(typeof e=="number"&&typeof t=="number")return Ie(e,t);if(lt(e)&<(t)){const s=Ie(e.x,t.x),n=Ie(e.y,t.y);return Math.sqrt(s**2+n**2)}return 0}function bt(e){const t=d.useRef(null);return t.current=e,t}function Xn(e,t){const{onPan:s,onPanStart:n,onPanEnd:o,onPanSessionStart:a,onPanSessionEnd:l,threshold:c}=t,i=!!(s||n||o||a||l),u=d.useRef(null),p=bt({onSessionStart:a,onSessionEnd:l,onStart:n,onMove:s,onEnd(f,v){u.current=null,o==null||o(f,v)}});d.useEffect(()=>{var f;(f=u.current)==null||f.updateHandlers(p.current)}),d.useEffect(()=>{const f=e.current;if(!f||!i)return;function v(g){u.current=new Un(g,p.current,c)}return ne(f,"pointerdown",v)},[e,i,p,c]),d.useEffect(()=>()=>{var f;(f=u.current)==null||f.end(),u.current=null},[])}function Zn(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const s=e.ownerDocument.defaultView??window,n=new s.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[a]=o;let l,c;if("borderBoxSize"in a){const i=a.borderBoxSize,u=Array.isArray(i)?i[0]:i;l=u.inlineSize,c=u.blockSize}else l=e.offsetWidth,c=e.offsetHeight;t({width:l,height:c})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}var qn=globalThis!=null&&globalThis.document?d.useLayoutEffect:d.useEffect;function Jn(e,t){var s,n;if(!e||!e.parentElement)return;const o=(n=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?n:window,a=new o.MutationObserver(()=>{t()});return a.observe(e.parentElement,{childList:!0}),()=>{a.disconnect()}}function Qn({getNodes:e,observeMutation:t=!0}){const[s,n]=d.useState([]),[o,a]=d.useState(0);return qn(()=>{const l=e(),c=l.map((i,u)=>Zn(i,p=>{n(f=>[...f.slice(0,u),p,...f.slice(u+1)])}));if(t){const i=l[0];c.push(Jn(i,()=>{a(u=>u+1)}))}return()=>{c.forEach(i=>{i==null||i()})}},[o]),s}function es(e){return typeof e=="object"&&e!==null&&"current"in e}function ts(e){const[t]=Qn({observeMutation:!1,getNodes(){return[es(e)?e.current:e]}});return t}function ns(e){var t;const{min:s=0,max:n=100,onChange:o,value:a,defaultValue:l,isReversed:c,direction:i="ltr",orientation:u="horizontal",id:p,isDisabled:f,isReadOnly:v,onChangeStart:g,onChangeEnd:I,step:y=1,getAriaValueText:w,"aria-valuetext":E,"aria-label":$,"aria-labelledby":b,name:_,focusThumbOnChange:Mt=!0,...Fe}=e,$e=Se(g),G=Se(I),Ve=Se(w),C=Dn({isReversed:c,direction:i,orientation:u}),[_t,de]=nn({value:a,defaultValue:l??rs(s,n),onChange:o}),[he,Be]=d.useState(!1),[fe,Oe]=d.useState(!1),xe=!(f||v),pe=(n-s)/10,U=y||(n-s)/100,S=je(_t,s,n),Dt=n-S+s,Le=st(C?Dt:S,s,n),J=u==="vertical",j=bt({min:s,max:n,step:y,isDisabled:f,value:S,isInteractive:xe,isReversed:C,isVertical:J,eventSource:null,focusThumbOnChange:Mt,orientation:u}),ge=d.useRef(null),me=d.useRef(null),Ge=d.useRef(null),zt=d.useId(),Ue=p??zt,[He,Ke]=[`slider-thumb-${Ue}`,`slider-track-${Ue}`],Rt=d.useCallback(h=>{var x,H;if(!ge.current)return;const k=j.current;k.eventSource="pointer";const N=ge.current.getBoundingClientRect(),{clientX:ye,clientY:Lt}=(H=(x=h.touches)==null?void 0:x[0])!=null?H:h,Gt=J?N.bottom-Lt:ye-N.left,Ut=J?N.height:N.width;let we=Gt/Ut;C&&(we=1-we);let K=cn(we,k.min,k.max);return k.step&&(K=parseFloat(nt(K,k.min,k.step))),K=je(K,k.min,k.max),K},[J,C,j]),D=d.useCallback(h=>{const x=j.current;x.isInteractive&&(h=parseFloat(nt(h,x.min,U)),h=je(h,x.min,x.max),de(h))},[U,de,j]),z=d.useMemo(()=>({stepUp(h=U){const x=C?S-h:S+h;D(x)},stepDown(h=U){const x=C?S+h:S-h;D(x)},reset(){D(l||0)},stepTo(h){D(h)}}),[D,C,S,U,l]),We=d.useCallback(h=>{const x=j.current,k={ArrowRight:()=>z.stepUp(),ArrowUp:()=>z.stepUp(),ArrowLeft:()=>z.stepDown(),ArrowDown:()=>z.stepDown(),PageUp:()=>z.stepUp(pe),PageDown:()=>z.stepDown(pe),Home:()=>D(x.min),End:()=>D(x.max)}[h.key];k&&(h.preventDefault(),h.stopPropagation(),k(h),x.eventSource="keyboard")},[z,D,pe,j]),Ye=(t=Ve==null?void 0:Ve(S))!=null?t:E,ve=ts(me),{getThumbStyle:Xe,rootStyle:Ze,trackStyle:qe,innerTrackStyle:Je}=d.useMemo(()=>{const h=j.current,x=ve??{width:0,height:0};return _n({isReversed:C,orientation:h.orientation,thumbRects:[x],thumbPercents:[Le]})},[C,ve,Le,j]),Qe=d.useCallback(()=>{j.current.focusThumbOnChange&&setTimeout(()=>{var x;return(x=me.current)==null?void 0:x.focus()})},[j]);Ht(()=>{const h=j.current;Qe(),h.eventSource==="keyboard"&&(G==null||G(h.value))},[S,G]);function et(h){const x=Rt(h);x!=null&&x!==j.current.value&&de(x)}Xn(Ge,{onPanSessionStart(h){const x=j.current;x.isInteractive&&(Be(!0),Qe(),et(h),$e==null||$e(x.value))},onPanSessionEnd(){const h=j.current;h.isInteractive&&(Be(!1),G==null||G(h.value))},onPan(h){j.current.isInteractive&&et(h)}});const At=d.useCallback((h={},x=null)=>({...h,...Fe,ref:be(x,Ge),tabIndex:-1,"aria-disabled":ke(f),"data-focused":V(fe),style:{...h.style,...Ze}}),[Fe,f,fe,Ze]),Ft=d.useCallback((h={},x=null)=>({...h,ref:be(x,ge),id:Ke,"data-disabled":V(f),style:{...h.style,...qe}}),[f,Ke,qe]),$t=d.useCallback((h={},x=null)=>({...h,ref:x,style:{...h.style,...Je}}),[Je]),Vt=d.useCallback((h={},x=null)=>({...h,ref:be(x,me),role:"slider",tabIndex:xe?0:void 0,id:He,"data-active":V(he),"aria-valuetext":Ye,"aria-valuemin":s,"aria-valuemax":n,"aria-valuenow":S,"aria-orientation":u,"aria-disabled":ke(f),"aria-readonly":ke(v),"aria-label":$,"aria-labelledby":$?void 0:b,style:{...h.style,...Xe(0)},onKeyDown:Pe(h.onKeyDown,We),onFocus:Pe(h.onFocus,()=>Oe(!0)),onBlur:Pe(h.onBlur,()=>Oe(!1))}),[xe,He,he,Ye,s,n,S,u,f,v,$,b,Xe,We]),Bt=d.useCallback((h,x=null)=>{const H=!(h.valuen),k=S>=h.value,N=st(h.value,s,n),ye={position:"absolute",pointerEvents:"none",...ss({orientation:u,vertical:{bottom:C?`${100-N}%`:`${N}%`},horizontal:{left:C?`${100-N}%`:`${N}%`}})};return{...h,ref:x,role:"presentation","aria-hidden":!0,"data-disabled":V(f),"data-invalid":V(!H),"data-highlighted":V(k),style:{...h.style,...ye}}},[f,C,n,s,u,S]),Ot=d.useCallback((h={},x=null)=>({...h,ref:x,type:"hidden",value:S,name:_}),[_,S]);return{state:{value:S,isFocused:fe,isDragging:he},actions:z,getRootProps:At,getTrackProps:Ft,getInnerTrackProps:$t,getThumbProps:Vt,getMarkerProps:Bt,getInputProps:Ot}}function ss(e){const{orientation:t,vertical:s,horizontal:n}=e;return t==="vertical"?s:n}function rs(e,t){return t"}),[as,ie]=it({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),jt=O((e,t)=>{var s;const n={...e,orientation:(s=e==null?void 0:e.orientation)!=null?s:"horizontal"},o=Kt("Slider",n),a=ct(n),{direction:l}=Wt();a.direction=l;const{getInputProps:c,getRootProps:i,...u}=ns(a),p=i(),f=c({},t);return r.jsx(os,{value:u,children:r.jsx(as,{value:o,children:r.jsxs(L.div,{...p,className:q("chakra-slider",n.className),__css:o.container,children:[n.children,r.jsx("input",{...f})]})})})});jt.displayName="Slider";var kt=O((e,t)=>{const{getThumbProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(L.div,{...o,className:q("chakra-slider__thumb",e.className),__css:n.thumb})});kt.displayName="SliderThumb";var Pt=O((e,t)=>{const{getTrackProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(L.div,{...o,className:q("chakra-slider__track",e.className),__css:n.track})});Pt.displayName="SliderTrack";var Ct=O((e,t)=>{const{getInnerTrackProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(L.div,{...o,className:q("chakra-slider__filled-track",e.className),__css:n.filledTrack})});Ct.displayName="SliderFilledTrack";var ls=O((e,t)=>{const{getMarkerProps:s}=le(),n=ie(),o=s(e,t);return r.jsx(L.div,{...o,className:q("chakra-slider__marker",e.className),__css:n.mark})});ls.displayName="SliderMark";function is(e,t=[]){const s=Object.assign({},e);for(const n of t)n in s&&delete s[n];return s}var cs=["h","minH","height","minHeight"],It=O((e,t)=>{const s=Yt("Textarea",e),{className:n,rows:o,...a}=ct(e),l=sn(a),c=o?is(s,cs):s;return r.jsx(L.textarea,{ref:t,rows:o,...l,className:Xt("chakra-textarea",n),__css:c})});It.displayName="Textarea";var us=Re("chevron-left","IconChevronLeft",[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]]),Tt=Re("pin-filled","IconPinFilled",[["path",{d:"M15.113 3.21l.094 .083l5.5 5.5a1 1 0 0 1 -1.175 1.59l-3.172 3.171l-1.424 3.797a1 1 0 0 1 -.158 .277l-.07 .08l-1.5 1.5a1 1 0 0 1 -1.32 .082l-.095 -.083l-2.793 -2.792l-3.793 3.792a1 1 0 0 1 -1.497 -1.32l.083 -.094l3.792 -3.793l-2.792 -2.793a1 1 0 0 1 -.083 -1.32l.083 -.094l1.5 -1.5a1 1 0 0 1 .258 -.187l.098 -.042l3.796 -1.425l3.171 -3.17a1 1 0 0 1 1.497 -1.26z",fill:"currentColor",key:"svg-0",strokeWidth:"0"}]]),Et=Re("pin","IconPin",[["path",{d:"M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4",key:"svg-0"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-1"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-2"}]]);const ds=({setMediaAct:e,media:t,currentNum:s})=>{const n=l=>{const c=(s+l+t.length)%t.length;e&&e(t[c])},o={width:"100%",height:"100%"};if(t.length===0)return r.jsx("p",{children:"No images found, let's start generating 🪄"});const a=t.at(s);return a?r.jsxs(m,{justifyContent:"center",alignItems:"center",position:"relative",width:o.width,height:o.height,overflow:"hidden",children:[r.jsx("div",{style:{position:"absolute",cursor:"pointer",width:"100%",height:"100%"},onClick:()=>{window.open(a.imageUrl)},children:rn(a.imageUrl)?r.jsx(bn,{src:a.imageUrl,alt:`image-${a.id}`,width:"100%",height:"100%",objectFit:"contain"}):r.jsx("video",{style:{objectFit:"contain"},width:"100%",height:"100%",src:a.imageUrl,loop:!0,autoPlay:!0,muted:!0,children:r.jsx("track",{kind:"captions"})})},a.id),r.jsx(M,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Previous image",icon:r.jsx(us,{}),onClick:()=>n(-1),position:"absolute",left:"0",zIndex:"2"}),r.jsx(M,{size:"sm",color:"white",bgColor:"whiteAlpha.400","aria-label":"Next image",icon:r.jsx(un,{}),onClick:()=>n(1),position:"absolute",right:"0",zIndex:"2"})]}):null};function hs(e){const t=e.split(".").pop();return fetch(e).then(s=>{if(!s.ok)throw new Error("Network response was not ok");return s.blob()}).then(async s=>{const n=e.split("/").pop()??"",o=new File([s],n);if(dn(e))return hn(o);if(t==="webp")return fn(o);const a=await xn(o),l=JSON.parse(a==null?void 0:a.prompt),c=JSON.parse(a==null?void 0:a.workflow);return{prompt:l,workflow:c}})}const fs=({inputItem:e})=>r.jsxs(m,{gap:2,children:[r.jsx(m,{gap:1,alignItems:"center",flexBasis:"200px",children:e.label??e.inputName}),r.jsx(on,{value:e.inputValue,onChange:t=>{}})]}),xs=e=>{const t=e.inputItem;return r.jsxs(m,{gap:1,direction:"column",children:[r.jsxs(m,{gap:2,children:[r.jsx(m,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsxs(pn,{width:"100%",step:e==null?void 0:e.step,value:t.inputValue,min:e==null?void 0:e.min,max:e==null?void 0:e.max,onChange:s=>{},children:[r.jsx(gn,{}),r.jsxs(mn,{children:[r.jsx(vn,{}),r.jsx(yn,{})]})]})]}),r.jsx(m,{children:r.jsxs(jt,{maxWidth:"400px",step:e==null?void 0:e.step,value:Number(t.inputValue),min:(e==null?void 0:e.min)??0,max:(e==null?void 0:e.max)??100,onChange:s=>{},children:[r.jsx(Pt,{children:r.jsx(Ct,{})}),r.jsx(kt,{})]})})]})},ps=e=>{var s;const{inputItem:t}=e;return r.jsxs(m,{gap:2,children:[r.jsx(m,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsx(jn,{value:t.inputValue,onChange:n=>{},children:(s=e==null?void 0:e.options)==null?void 0:s.map((n,o)=>r.jsx("option",{value:n,children:n},`select${t.nodeID}${t.inputName}${o}`))})]})},gs=e=>{const t=e.inputItem;return r.jsxs(m,{gap:1,direction:"column",children:[r.jsx(m,{children:t.label??t.inputName}),r.jsx(It,{value:t.inputValue,onChange:s=>{},rows:5})]})};var P=(e=>(e.Input="Input",e.InputSlider="InputSlider",e.Select="Select",e.Textarea="Textarea",e.Checkbox="Checkbox",e.NoSupport="NoSupport",e))(P||{});const ms=e=>r.jsxs(m,{gap:2,children:[r.jsx(m,{gap:1,alignItems:"center",flexBasis:"200px",children:e.inputItem.label??e.inputItem.inputName}),r.jsx(m,{children:"No Support"})]}),vs=e=>{const t=e.inputItem;return r.jsxs(m,{gap:2,children:[r.jsx(m,{gap:1,alignItems:"center",flexBasis:"200px",children:t.label??t.inputName}),r.jsx(Ae,{defaultChecked:!!t.inputValue,onChange:s=>{var n;(n=e==null?void 0:e.updateMetaData)==null||n.call(e,{promptKey:e.promptKey,name:e.name,value:s.target.checked})}})]})},ce=d.createContext({topFields:[],calcInputList:[],showNodeName:!1,updateTopField(){}}),ys={[P.Input]:fs,[P.InputSlider]:xs,[P.Select]:ps,[P.Textarea]:gs,[P.Checkbox]:vs,NoSupport:ms},ws=LiteGraph.registered_node_types;function Ss(e,t){var o,a,l,c,i;const s=(o=ws[e])==null?void 0:o.nodeData,n={...((a=s==null?void 0:s.input)==null?void 0:a.required)??{},...((l=s==null?void 0:s.input)==null?void 0:l.optional)??{}}[t];return(n==null?void 0:n[0])==="STRING"?(c=n==null?void 0:n[1])!=null&&c.multiline?{type:P.Textarea}:{type:P.Input}:(n==null?void 0:n[0])==="BOOLEAN"?{type:P.Checkbox}:(n==null?void 0:n[0])==="FLOAT"?{...(n==null?void 0:n[1])??{},type:P.InputSlider}:(n==null?void 0:n[0])==="INT"?{...(n==null?void 0:n[1])??{},type:P.InputSlider}:Array.isArray(n==null?void 0:n[0])&&((i=n==null?void 0:n[0])!=null&&i.every(u=>typeof u=="string"))?{options:n==null?void 0:n[0],type:P.Select}:{type:P.NoSupport}}const De=({inputItem:e})=>{const t=Ss(e.classType,e.inputName),[s,n]=d.useState(!1),o=ys[t.type??"Input"],{updateTopField:a,topFields:l}=d.useContext(ce),c=e.children[0]==="negative"||e.children[0]==="positive"?`-${e.children[0]}`:"",i={...e,label:e.label??e.inputName+c};return r.jsxs(m,{alignItems:"center",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[r.jsx(M,{size:"xs",onClick:()=>a==null?void 0:a({name:e.inputName,promptKey:e.nodeID,class_type:e.classType}),variant:"ghost",icon:re(l,{name:e.inputName,promptKey:e.nodeID,classType:e.classType})?r.jsx(Tt,{size:14}):r.jsx(Et,{size:14}),"aria-label":"pin"}),r.jsx("div",{style:{flex:1},children:r.jsx(o,{inputItem:i,...t})})]})};function bs(){const{topFields:e,updateTopField:t,calcInputList:s}=d.useContext(ce);return e.length===0?null:r.jsx(r.Fragment,{children:r.jsx(m,{px:2,gap:2,direction:"column",children:e==null?void 0:e.map(n=>{const o=s.find(a=>a.nodeID==n.promptKey&&a.inputName===n.name&&a.classType===n.class_type);return!n.class_type||!o?null:r.jsx(De,{inputItem:o},`formTopField${n.promptKey}${n.name}`)})})})}function js(){const{topFields:e,calcInputList:t,showNodeName:s}=d.useContext(ce),n=d.useCallback(a=>{const l=[];return a.forEach(c=>{const i=l[l.length-1];!i||i[0].nodeID!==c.nodeID||i[0].classType!==c.classType?l.push([c]):i.push(c)}),l},[]);if(d.useEffect(()=>{},[s]),!s)return r.jsx(Ee,{children:t.map(a=>re(e,{name:a.inputName,promptKey:a.nodeID,classType:a.classType})?null:r.jsx(De,{inputItem:a},`form${a.nodeID}${a.inputName}`))});const o=n(t);return r.jsx(Ee,{children:o.map(a=>a[0]?r.jsx(ks,{title:a[0].classType+" #"+a[0].nodeID,children:r.jsx(m,{px:2,gap:1,direction:"column",children:a.map(l=>re(e,{name:l.inputName,promptKey:l.nodeID,classType:l.classType})?null:r.jsx(De,{inputItem:l},`form${l.nodeID}${l.inputName}`))})},a[0].nodeID):null)})}function ks({title:e,children:t}){return r.jsxs(ht,{border:"1px",borderColor:"gray.500",borderRadius:"md",p:4,children:[r.jsx(W,{size:"sm",mb:1,color:"GrayText",children:e}),r.jsx("div",{children:t})]})}let se=[],ze=new Set;function Nt(e,t){if(!ze.has(e.nodeID))return ze.add(e.nodeID),Object.entries(e.inputs).forEach(([s,n])=>{if(Array.isArray(n)){const o=n[0];Nt(t[o],t)}}),Object.entries(e.inputs).forEach(([s,n])=>{Array.isArray(n)||se.push({classType:e.class_type,inputName:s,inputValue:n,nodeID:e.nodeID,children:e.children||[]})}),se}function Ps(e){se=[],ze=new Set;for(const t of Object.keys(e))e[t].nodeID=t,Object.entries(e[t].inputs).forEach(([s,n])=>{if(Array.isArray(n)){const o=n[0],a=e[o];a.children||(a.children=[]),a.children.push(s)}});for(const t of Object.keys(e))Nt(e[t],e);return se}const re=(e,t)=>e==null?void 0:e.some(s=>s.promptKey===(t==null?void 0:t.promptKey)&&s.name===(t==null?void 0:t.name)&&s.class_type===t.classType);function Cs({media:e}){const[t,s]=d.useState([]),{curFlowID:n}=d.useContext(oe),[o,a]=d.useState(),[l,c]=d.useState(!0),[i,u]=d.useState(!0);d.useEffect(()=>{e?hs(`/workspace/view_media?filename=${e.localPath}`).then(g=>{a(g.prompt)}):tt.graphToPrompt(tt.graph).then(g=>{a(g.output)})},[e]),d.useEffect(()=>{if(!o)return;const g=Ps(o);s(g)},[o]);const[p,f]=d.useState([]);d.useEffect(()=>{(async()=>{var g,I;if(n){const y=(I=await((g=R)==null?void 0:g.get(n)))==null?void 0:I.topFieldsConfig;y&&(f(y),c(!1))}})()},[n]);const v=g=>{var I,y;if(re(p,{name:g.name,promptKey:g==null?void 0:g.promptKey,classType:(g==null?void 0:g.class_type)??""})){const w=p.filter(E=>E.name!==g.name||E.promptKey!==g.promptKey);f(w),n&&((I=R)==null||I.updateTopFields(n,{topFieldsConfig:w}))}else{const w=[...p,g];f(w),n&&((y=R)==null||y.updateTopFields(n,{topFieldsConfig:w}))}};return r.jsx(ce.Provider,{value:{topFields:p,showNodeName:i,calcInputList:t,updateTopField:v},children:r.jsxs(m,{direction:"column",align:"stretch",gap:5,children:[r.jsx(bs,{}),r.jsxs(Y,{children:[r.jsx("p",{children:"Show all inputs"}),r.jsx(rt,{isChecked:l,onChange:g=>c(!l)}),r.jsx("p",{children:"Show node names"}),r.jsx(rt,{isChecked:i,onChange:g=>u(!i)})]}),l&&r.jsx(js,{})]})})}const ue=d.createContext({showAllImages:!1,curMedia:null,setCurMedia(){},setMediaList(){},setShowAllImages(){}}),Is=({media:e})=>{var l,c;const[t,s]=d.useState(!1),{setMediaList:n}=d.useContext(ue),{loadFilePath:o}=d.useContext(oe),{showDialog:a}=ut();return d.useEffect(()=>{var i,u;s((e==null?void 0:e.localPath)!=null&&((u=(i=R)==null?void 0:i.curWorkflow)==null?void 0:u.coverMediaPath)===(e==null?void 0:e.localPath))},[e]),e?r.jsxs(m,{flexWrap:"wrap",gap:3,children:[r.jsx(m,{alignItems:"center",gap:2,children:e.localPath&&r.jsxs(r.Fragment,{children:[r.jsx(W,{children:e==null?void 0:e.localPath}),r.jsx(A,{label:"Donwload image from gallery",children:r.jsx(Ne,{href:`/workspace/view_media?filename=${e==null?void 0:e.localPath}`,download:e==null?void 0:e.localPath,children:r.jsx(M,{size:"sm",icon:r.jsx(ft,{size:19}),"aria-label":"donwload image from gallery"})})})]})}),r.jsx(m,{gap:1,alignItems:"center",color:"GrayText",children:!!(e!=null&&e.createTime)&&r.jsx(W,{children:xt((e==null?void 0:e.createTime)??0,!0)})}),r.jsx(A,{label:"Remove image from gallery",children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(pt,{size:19}),"aria-label":"remove image from gallery",colorScheme:"red",onClick:async()=>{var u;confirm("Are you sure to remove this image from gallery? (won't delete image on your disk)")&&(await((u=F)==null?void 0:u.delete(e.id)),n(p=>p.filter(f=>f.id!==e.id)))}})}),((c=(l=R)==null?void 0:l.curWorkflow)==null?void 0:c.id)&&r.jsx(A,{label:"Set as cover",children:r.jsx(M,{size:"sm",variant:"ghost",icon:t?r.jsx(Tt,{size:19}):r.jsx(Et,{size:19}),"aria-label":"set as cover",onClick:async()=>{var i;await((i=R)==null?void 0:i.updateMetaInfo(R.curWorkflow.id,{coverMediaPath:t?void 0:e.localPath})),s(!t)}})}),r.jsx(dt,{onClick:()=>a("How do you want to load this workflow?",[{label:"Load in new workflow",onClick:()=>{o(e.localPath)},colorScheme:"teal"},{label:"Overwrite current workflow",onClick:()=>o(e.localPath,!0),colorScheme:"red"}]),size:"sm",children:"Load"})]}):null},Ts=({media:e})=>r.jsxs(m,{overflowY:"auto",mb:4,direction:"column",gap:2,flex:1,children:[r.jsx(Is,{media:e}),r.jsx(Cs,{media:e??null})]}),Te=120;function Es({mediaList:e}){const{curMedia:t,setCurMedia:s}=d.useContext(ue);return r.jsxs(m,{gap:3,h:"100%",children:[r.jsxs(kn,{gridTemplateRows:e.length<=6?"1fr 20%":"1fr",flex:1,gap:2,children:[r.jsx("div",{style:{height:"56vh"},children:r.jsx(ds,{media:e.map(n=>({id:n.id,imageUrl:`/workspace/view_media?filename=${n.localPath}`})),currentNum:(e==null?void 0:e.findIndex(n=>n.id===(t==null?void 0:t.id)))??0,setMediaAct:n=>s((e==null?void 0:e.find(o=>o.id===n.id))??null)})}),r.jsx(m,{wrap:"wrap",children:e==null?void 0:e.map(n=>r.jsx(ht,{display:"inline-block",p:1,borderRadius:"4px",width:`${Te+3}px`,height:`${Te+3}px`,cursor:"pointer",border:(t==null?void 0:t.id)===n.id?"1px solid gray":"",onClick:()=>s(n),children:r.jsx(gt,{mediaLocalPath:n.localPath,size:Te,objectFit:"contain",hideBrokenImage:!0,onBrokenLink:()=>{var o;(o=F)==null||o.delete(n.id)}})},`image-bottom-${n.id}`))})]}),r.jsx(Ts,{media:t??void 0})]})}const Ns=({media:e,isSelecting:t,selectedID:s,onClickMedia:n})=>{const{curFlowID:a,loadFilePath:l}=d.useContext(oe),{showDialog:c}=ut();if(e.localPath==null||a==null)return null;const i=r.jsxs(Ne,{isExternal:!0,onClick:()=>n(e),position:"relative",children:[t&&r.jsx(Ae,{isChecked:s.includes(e.id),position:"absolute",top:2,left:2}),r.jsx(gt,{mediaLocalPath:e.localPath,size:180,onBrokenLink:()=>{var u;(u=F)==null||u.delete(e.id)},hideBrokenImage:!0,autoPlay:!0,isPreview:!0})]});return r.jsxs(Ee,{width:180,mb:2,children:[r.jsx(A,{label:xt(e.createTime,!0),children:i}),r.jsx(A,{label:e.localPath,children:r.jsx(W,{color:"GrayText",noOfLines:1,children:e.localPath})}),r.jsxs(Y,{hidden:t,gap:0,children:[r.jsx(dt,{flexGrow:1,onClick:()=>c("How do you want to load this workflow?",[{label:"Load in new workflow",onClick:()=>{l(e.localPath)},colorScheme:"teal"},{label:"Overwrite current workflow",onClick:()=>l(e.localPath,!0),colorScheme:"red"}]),size:"sm",children:"Load"}),r.jsx(A,{label:"Donwload image from gallery",children:r.jsx(Ne,{href:`/workspace/view_media?filename=${e.localPath}`,download:e.localPath,children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(ft,{size:19}),"aria-label":"donwload image from gallery"})})}),r.jsx(A,{label:"Remove image from gallery",children:r.jsx(M,{size:"sm",variant:"ghost",icon:r.jsx(pt,{size:19}),"aria-label":"remove image from gallery",colorScheme:"red",onClick:async()=>{var p;confirm("Are you sure to remove this image from gallery? (won't delete image on your disk)")&&await((p=F)==null?void 0:p.delete(e.id))}})})]})]})},Ms=Ns;function _s({searchQuery:e}){const[t,s]=d.useState([]),{setCurMedia:n,setShowAllImages:o,setMediaList:a}=d.useContext(ue);d.useEffect(()=>{var c,i;e===""?(c=F)==null||c.listAll().then(u=>{s(u.slice(0,50)??[])}):(i=F)==null||i.filter(u=>{var p;return((p=u.workflowJSON)==null?void 0:p.includes(e))??!1}).then(u=>{s(u)})},[e]);const l=c=>{a([c].concat(t.filter(i=>i.id!==c.id))),n(c),o(!1)};return r.jsx(Y,{wrap:"wrap",children:t.map(c=>r.jsx(Ms,{selectedID:[],media:c,isSelecting:!1,onClickMedia:l},c.id))})}function Gs({onclose:e}){const{curFlowID:t}=d.useContext(oe),[s,n]=d.useState(""),[o,a]=d.useState([]),[l,c]=d.useState(!1),[i,u]=d.useState([]),[p,f]=d.useState(),[v,g]=d.useState(""),I=wn(v,300),[y,w]=d.useState(!1),E=async()=>{var _;if(t==null)return;const b=await((_=F)==null?void 0:_.listByWorkflowID(t));u(b??[]),b!=null&&b.length&&f(b[0])};if(d.useEffect(()=>{var b;E(),t&&((b=R)==null||b.get(t).then(_=>{_&&n(_.name)}))},[]),t==null)return null;const $=i.length>0&&o.length===i.length;return r.jsx(ue.Provider,{value:{curMedia:p??null,setCurMedia:f,setMediaList:u,showAllImages:y,setShowAllImages:w},children:r.jsxs(Zt,{isOpen:!0,onClose:e,blockScrollOnMount:!0,children:[r.jsx(qt,{}),r.jsxs(Jt,{width:"90%",maxWidth:"90vw",height:"90vh",children:[r.jsxs(Qt,{children:[r.jsxs(Y,{gap:2,mb:2,children:[r.jsxs(an,{size:"md",mr:2,children:["Gallery - ",s]}),r.jsx(Sn,{searchValue:v,onUpdateSearchValue:b=>{g(b),y||w(!0)},placeholder:"Search prompt, model name, etc.",style:{width:"300px"}})]}),l&&r.jsxs(Y,{gap:3,children:[r.jsx(Ae,{isChecked:$,onChange:()=>{a($?[]:i.map(b=>b.id))},children:"All"}),r.jsxs(W,{fontSize:16,children:[o.length," Selected"]}),r.jsx(M,{size:"sm",icon:r.jsx(ln,{size:19}),onClick:()=>c(!1),"aria-label":"cancel"})]})]}),r.jsx(en,{}),r.jsx(tn,{overflowY:"auto",children:y?r.jsx(_s,{searchQuery:I}):r.jsx(Es,{mediaList:i})})]})]})})}export{Gs as default}; diff --git a/dist/workspace_web/IconCopy-DxyTNBlz.js b/dist/workspace_web/IconCopy-DxyTNBlz.js deleted file mode 100644 index fd6d107..0000000 --- a/dist/workspace_web/IconCopy-DxyTNBlz.js +++ /dev/null @@ -1 +0,0 @@ -import{d as a}from"./App-1AImvRpr.js";var p=a("copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]);export{p as I}; diff --git a/dist/workspace_web/IconSearch-qxAzDzhT.js b/dist/workspace_web/IconSearch-qxAzDzhT.js deleted file mode 100644 index aa1ff67..0000000 --- a/dist/workspace_web/IconSearch-qxAzDzhT.js +++ /dev/null @@ -1 +0,0 @@ -import{d as a}from"./App-1AImvRpr.js";var r=a("search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]);export{r as I}; diff --git a/dist/workspace_web/MediaPreview-muJLkZRm.js b/dist/workspace_web/MediaPreview-muJLkZRm.js deleted file mode 100644 index eeaae23..0000000 --- a/dist/workspace_web/MediaPreview-muJLkZRm.js +++ /dev/null @@ -1 +0,0 @@ -import{d as D,r as l,j as v,I as Ee,x as Te,y as je,m as ae,q as _,p as se,b as Pe,f as T,g as Y,k as Be,o as Ke,e as Ve}from"./input.js";import{ad as Ge,ae as We,d as Le,B as qe,I as ze,y as He,j as Xe,ab as $e}from"./App-1AImvRpr.js";import{I as Ye}from"./IconSearch-qxAzDzhT.js";import{I as Je}from"./chunk-7D6N5TE5-fihyubSX.js";function Qe(t){const e=parseFloat(t);return typeof e!="number"||Number.isNaN(e)?0:e}function ie(t,e){let r=Qe(t);const a=10**(e??10);return r=Math.round(r*a)/a,e?r.toFixed(e):r.toString()}function ue(t){if(!Number.isFinite(t))return 0;let e=1,r=0;for(;Math.round(t*e)/e!==t;)e*=10,r+=1;return r}function Ct(t,e,r){return(t-e)*100/(r-e)}function It(t,e,r){return(r-e)*t+e}function St(t,e,r){const a=Math.round((t-e)/r)*r+e,i=ue(r);return ie(a,i)}function Ze(t,e,r){return t==null?t:(r{var g;return a==null?"":(g=oe(a,s,r))!=null?g:""}),x=typeof i<"u",h=x?i:m,I=Me(P(h),s),S=r??I,A=l.useCallback(g=>{g!==h&&(x||w(g.toString()),c==null||c(g.toString(),P(g)))},[c,x,h]),k=l.useCallback(g=>{let b=g;return f&&(b=Ze(b,u,o)),ie(b,S)},[S,f,o,u]),j=l.useCallback((g=s)=>{let b;h===""?b=P(g):b=P(h)+g,b=k(b),A(b)},[k,s,A,h]),B=l.useCallback((g=s)=>{let b;h===""?b=P(-g):b=P(h)-g,b=k(b),A(b)},[k,s,A,h]),K=l.useCallback(()=>{var g;let b;a==null?b="":b=(g=oe(a,s,r))!=null?g:u,A(b)},[a,r,s,A,u]),Q=l.useCallback(g=>{var b;const ee=(b=oe(g,s,S))!=null?b:u;A(ee)},[S,s,A,u]),V=P(h);return{isOutOfRange:V>o||Vv.jsx(Ee,{viewBox:"0 0 24 24",...t,children:v.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),nt=t=>v.jsx(Ee,{viewBox:"0 0 24 24",...t,children:v.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function _e(t,e,r,a){l.useEffect(()=>{var i;if(!t.current||!a)return;const s=(i=t.current.ownerDocument.defaultView)!=null?i:window,u=Array.isArray(e)?e:[e],o=new s.MutationObserver(f=>{for(const c of f)c.type==="attributes"&&c.attributeName&&u.includes(c.attributeName)&&r(c)});return o.observe(t.current,{attributes:!0,attributeFilter:u}),()=>o.disconnect()})}function rt(t,e){const r=D(t);l.useEffect(()=>{let a=null;const i=()=>r();return e!==null&&(a=window.setInterval(i,e)),()=>{a&&window.clearInterval(a)}},[e,r])}var at=50,ke=300;function st(t,e){const[r,a]=l.useState(!1),[i,s]=l.useState(null),[u,o]=l.useState(!0),f=l.useRef(null),c=()=>clearTimeout(f.current);rt(()=>{i==="increment"&&t(),i==="decrement"&&e()},r?at:null);const m=l.useCallback(()=>{u&&t(),f.current=setTimeout(()=>{o(!1),a(!0),s("increment")},ke)},[t,u]),w=l.useCallback(()=>{u&&e(),f.current=setTimeout(()=>{o(!1),a(!0),s("decrement")},ke)},[e,u]),x=l.useCallback(()=>{o(!0),a(!1),c()},[]);return l.useEffect(()=>()=>c(),[]),{up:m,down:w,stop:x,isSpinning:r}}var ot=/^[Ee0-9+\-.]$/;function ut(t){return ot.test(t)}function it(t,e){if(t.key==null)return!0;const r=t.ctrlKey||t.altKey||t.metaKey;return!(t.key.length===1)||r?!0:e(t.key)}function lt(t={}){const{focusInputOnChange:e=!0,clampValueOnBlur:r=!0,keepWithinRange:a=!0,min:i=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:u=1,isReadOnly:o,isDisabled:f,isRequired:c,isInvalid:m,pattern:w="[0-9]*(.[0-9]+)?",inputMode:x="decimal",allowMouseWheel:h,id:I,onChange:S,precision:A,name:k,"aria-describedby":j,"aria-label":B,"aria-labelledby":K,onFocus:Q,onBlur:V,onInvalid:ce,getAriaValueText:fe,isValidCharacter:Z,format:g,parse:b,...ee}=t,te=D(Q),de=D(V),R=D(ce),G=D(Z??ut),ne=D(fe),d=et(t),{update:U,increment:pe,decrement:me}=d,[Fe,re]=l.useState(!1),W=!(o||f),E=l.useRef(null),L=l.useRef(null),be=l.useRef(null),ge=l.useRef(null),q=l.useCallback(n=>n.split("").filter(G).join(""),[G]),z=l.useCallback(n=>{var p;return(p=b==null?void 0:b(n))!=null?p:n},[b]),F=l.useCallback(n=>{var p;return((p=g==null?void 0:g(n))!=null?p:n).toString()},[g]);Te(()=>{(d.valueAsNumber>s||d.valueAsNumber{if(!E.current)return;if(E.current.value!=d.value){const p=z(E.current.value);d.setValue(q(p))}},[z,q]);const H=l.useCallback((n=u)=>{W&&pe(n)},[pe,W,u]),X=l.useCallback((n=u)=>{W&&me(n)},[me,W,u]),N=st(H,X);_e(be,"disabled",N.stop,N.isSpinning),_e(ge,"disabled",N.stop,N.isSpinning);const he=l.useCallback(n=>{if(n.nativeEvent.isComposing)return;const y=z(n.currentTarget.value);U(q(y)),L.current={start:n.currentTarget.selectionStart,end:n.currentTarget.selectionEnd}},[U,q,z]),ve=l.useCallback(n=>{var p,y,C;te==null||te(n),L.current&&(n.target.selectionStart=(y=L.current.start)!=null?y:(p=n.currentTarget.value)==null?void 0:p.length,n.currentTarget.selectionEnd=(C=L.current.end)!=null?C:n.currentTarget.selectionStart)},[te]),ye=l.useCallback(n=>{if(n.nativeEvent.isComposing)return;it(n,G)||n.preventDefault();const p=we(n)*u,y=n.key,M={ArrowUp:()=>H(p),ArrowDown:()=>X(p),Home:()=>U(i),End:()=>U(s)}[y];M&&(n.preventDefault(),M(n))},[G,u,H,X,U,i,s]),we=n=>{let p=1;return(n.metaKey||n.ctrlKey)&&(p=.1),n.shiftKey&&(p=10),p},xe=l.useMemo(()=>{const n=ne==null?void 0:ne(d.value);if(n!=null)return n;const p=d.value.toString();return p||void 0},[d.value,ne]),Ne=l.useCallback(()=>{let n=d.value;if(d.value==="")return;/^[eE]/.test(d.value.toString())?d.setValue(""):(d.valueAsNumbers&&(n=s),d.cast(n))},[d,s,i]),Ce=l.useCallback(()=>{re(!1),r&&Ne()},[r,re,Ne]),$=l.useCallback(()=>{e&&requestAnimationFrame(()=>{var n;(n=E.current)==null||n.focus()})},[e]),Ie=l.useCallback(n=>{n.preventDefault(),N.up(),$()},[$,N]),Se=l.useCallback(n=>{n.preventDefault(),N.down(),$()},[$,N]);Ge(()=>E.current,"wheel",n=>{var p,y;const M=((y=(p=E.current)==null?void 0:p.ownerDocument)!=null?y:document).activeElement===E.current;if(!h||!M)return;n.preventDefault();const O=we(n)*u,Ae=Math.sign(n.deltaY);Ae===-1?H(O):Ae===1&&X(O)},{passive:!1});const Re=l.useCallback((n={},p=null)=>{const y=f||a&&d.isAtMax;return{...n,ref:ae(p,be),role:"button",tabIndex:-1,onPointerDown:_(n.onPointerDown,C=>{C.button!==0||y||Ie(C)}),onPointerLeave:_(n.onPointerLeave,N.stop),onPointerUp:_(n.onPointerUp,N.stop),disabled:y,"aria-disabled":se(y)}},[d.isAtMax,a,Ie,N.stop,f]),Ue=l.useCallback((n={},p=null)=>{const y=f||a&&d.isAtMin;return{...n,ref:ae(p,ge),role:"button",tabIndex:-1,onPointerDown:_(n.onPointerDown,C=>{C.button!==0||y||Se(C)}),onPointerLeave:_(n.onPointerLeave,N.stop),onPointerUp:_(n.onPointerUp,N.stop),disabled:y,"aria-disabled":se(y)}},[d.isAtMin,a,Se,N.stop,f]),Oe=l.useCallback((n={},p=null)=>{var y,C,M,O;return{name:k,inputMode:x,type:"text",pattern:w,"aria-labelledby":K,"aria-label":B,"aria-describedby":j,id:I,disabled:f,...n,readOnly:(y=n.readOnly)!=null?y:o,"aria-readonly":(C=n.readOnly)!=null?C:o,"aria-required":(M=n.required)!=null?M:c,required:(O=n.required)!=null?O:c,ref:ae(E,p),value:F(d.value),role:"spinbutton","aria-valuemin":i,"aria-valuemax":s,"aria-valuenow":Number.isNaN(d.valueAsNumber)?void 0:d.valueAsNumber,"aria-invalid":se(m??d.isOutOfRange),"aria-valuetext":xe,autoComplete:"off",autoCorrect:"off",onChange:_(n.onChange,he),onKeyDown:_(n.onKeyDown,ye),onFocus:_(n.onFocus,ve,()=>re(!0)),onBlur:_(n.onBlur,de,Ce)}},[k,x,w,K,B,F,j,I,f,c,o,m,d.value,d.valueAsNumber,d.isOutOfRange,i,s,xe,he,ye,ve,de,Ce]);return{value:F(d.value),valueAsNumber:d.valueAsNumber,isFocused:Fe,isDisabled:f,isReadOnly:o,getIncrementButtonProps:Re,getDecrementButtonProps:Ue,getInputProps:Oe,htmlProps:ee}}var[ct,J]=Pe({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[ft,le]=Pe({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),dt=T(function(e,r){const a=Be("NumberInput",e),i=Ke(e),s=We(i),{htmlProps:u,...o}=lt(s),f=l.useMemo(()=>o,[o]);return v.jsx(ft,{value:f,children:v.jsx(ct,{value:a,children:v.jsx(Y.div,{...u,ref:r,className:Ve("chakra-numberinput",e.className),__css:{position:"relative",zIndex:0,...a.root}})})})});dt.displayName="NumberInput";var pt=T(function(e,r){const a=J();return v.jsx(Y.div,{"aria-hidden":!0,ref:r,...e,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...a.stepperGroup}})});pt.displayName="NumberInputStepper";var mt=T(function(e,r){const{getInputProps:a}=le(),i=a(e,r),s=J();return v.jsx(Y.input,{...i,className:Ve("chakra-numberinput__field",e.className),__css:{width:"100%",...s.field}})});mt.displayName="NumberInputField";var De=Y("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),bt=T(function(e,r){var a;const i=J(),{getDecrementButtonProps:s}=le(),u=s(e,r);return v.jsx(De,{...u,__css:i.stepper,children:(a=e.children)!=null?a:v.jsx(tt,{})})});bt.displayName="NumberDecrementStepper";var gt=T(function(e,r){var a;const{getIncrementButtonProps:i}=le(),s=i(e,r),u=J();return v.jsx(De,{...s,__css:u.stepper,children:(a=e.children)!=null?a:v.jsx(nt,{})})});gt.displayName="NumberIncrementStepper";var At=Le("chevron-right","IconChevronRight",[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]]);const _t=(t,e)=>{const[r,a]=l.useState(t);return l.useEffect(()=>{const i=setTimeout(()=>{a(t)},e);return()=>{clearTimeout(i)}},[t,e]),r},ht={position:"absolute",marginLeft:"10px",width:"20px",height:"20px",top:"50%",color:"#A0AEC0",transform:"translateY(-50%)"};function kt(t){const{searchValue:e,onUpdateSearchValue:r,style:a}=t,i=e!=="";return v.jsxs(qe,{style:{position:"relative",...a},mb:2,children:[v.jsx(Ye,{style:ht}),i&&v.jsx(ze,{size:"xs",position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",cursor:"pointer",background:"none",zIndex:"100",icon:v.jsx(He,{width:15,height:15}),onClick:()=>r(""),"aria-label":"clear input button"}),v.jsx(Xe,{placeholder:t.placeholder??"Search",size:"sm",paddingLeft:"35px",paddingBlock:"5px",value:e,onChange:({target:s})=>r(s.value)})]})}function Et(t){return new Promise((e,r)=>{const a=new FileReader;a.onload=i=>{const s=new Uint8Array(i.target.result),u=new DataView(s.buffer);u.getUint32(0)!==2303741511&&(console.error("Not a valid PNG file"),r());let o=8;const f={};for(;oString.fromCharCode(S)).join("");f[x]=I}o+=12+c}e(f)},a.readAsArrayBuffer(t)})}function vt(t){const e=new Uint16Array(t.slice(0,2))[0]===18761;function r(u,o,f){const c=t.slice(u,u+f);if(f===2)return new DataView(c.buffer,c.byteOffset,c.byteLength).getUint16(0,o);if(f===4)return new DataView(c.buffer,c.byteOffset,c.byteLength).getUint32(0,o)}const a=r(4,e,4);function i(u){const o=r(u,e,2),f={};for(let c=0;c{const r=new FileReader;r.onload=a=>{var f;const i=new Uint8Array((f=a==null?void 0:a.target)==null?void 0:f.result),s=new DataView(i.buffer);if(s.getUint32(0)!==1380533830||s.getUint32(8)!==1464156752){console.error("Not a valid WEBP file"),e();return}let u=12;const o={};for(;u{const r=new FileReader;r.onload=a=>{const i=new Uint8Array(a.target.result),s=new DataView(i.buffer),u=new TextDecoder;if(s.getUint32(0)==440786851){let o=12;for(;o>8*(4-m)&~(1<<7*m),x=u.decode(i.slice(o+2+m,o+2+m+w)),h=JSON.parse(x);e(h);return}}o+=1}}else if(s.getUint32(4)==1718909296&&s.getUint32(8)==1769172845){let o=i.length-4;for(;o>16;){if(s.getUint32(o)==1684108385&&s.getUint32(o-8)==2841865588){s.getUint32(o+4),s.getUint32(o+8);const f=s.getUint32(o-4)-4*4,c=u.decode(i.slice(o+12,o+12+f)),m=JSON.parse(c);e(m);return}o-=1}}else{console.error("Unknown magic: "+s.getUint32(0)),e();return}},r.readAsArrayBuffer(t)})}function Dt({mediaLocalPath:t,size:e,isPreview:r,autoPlay:a,hideBrokenImage:i,objectFit:s,onBrokenLink:u}){const[o,f]=l.useState(!0);return l.useEffect(()=>{i&&(async()=>{try{if((await fetch(r?`/workspace/preview_media?filename=${t}`:`/workspace/view_media?filename=${t}`)).status==404){f(!1),u==null||u();return}}catch(m){console.error("Error checking media exists",m)}})()},[]),o?$e(t)?v.jsx(Je,{borderRadius:3,boxSize:`${e}px`,objectFit:s??"cover",src:`/workspace/view_media?filename=${t}`,alt:"workflow image renamed or moved from output folder"}):v.jsx("div",{style:{width:e+"px",height:e+"px",overflow:"hidden",position:"relative"},children:v.jsx("video",{width:e,height:e,src:`/workspace/view_media?filename=${t}`,loop:!0,autoPlay:a??!1,muted:!0,style:{objectFit:"cover",width:"100%",height:"100%"},children:v.jsx("track",{kind:"captions"})})}):null}export{At as I,Dt as M,dt as N,kt as S,mt as a,Mt as b,Ze as c,Pt as d,pt as e,gt as f,Et as g,bt as h,Vt as i,It as p,St as r,_t as u,Ct as v}; diff --git a/dist/workspace_web/ModelManagerTopbar-4hMR9SRa.js b/dist/workspace_web/ModelManagerTopbar-4hMR9SRa.js deleted file mode 100644 index 6ea0e97..0000000 --- a/dist/workspace_web/ModelManagerTopbar-4hMR9SRa.js +++ /dev/null @@ -1 +0,0 @@ -import{f as H,r as m,j as n,g as z,e as re,$ as J,b as qe,o as Ye,k as Qe,h as A,a0 as ae,P as Je,a1 as Xe,N as Le,a2 as Ze,Q as Ie,S as Ee,T as et,Z as tt,M as st,O as nt,R as ot}from"./input.js";import{aj as it,m as rt,ak as at,al as lt,am as $,B as oe,F as R,h as N,i as ie,X as Ae,an as ct,k as V,a3 as G,a4 as Te,a5 as dt,ac as Ne,j as X,H as W,ao as De,ap as xe,g as q,w as ht,aq as Fe,f as Pe,ar as ye,as as ut,at as Oe,au as ft,av as mt,aw as pt,ax as gt,ay as xt,az as ee,aA as yt,aB as wt}from"./App-1AImvRpr.js";import{f as le,s as vt,g as jt}from"./civitUtils-uJNBxoFV.js";import{I as ze}from"./chunk-7D6N5TE5-fihyubSX.js";import{G as Mt,C as _t}from"./chunk-JARCRF6W-UyOcndjS.js";import{api as ce}from"/scripts/api.js";import{S as Z}from"./chunk-3RSXBRAN-gZ_JDRlM.js";var Be=H(function(e,s){const{spacing:o="0.5rem",spacingX:i,spacingY:r,children:a,justify:c,direction:l,align:d,className:h,shouldWrapChildren:f,...u}=e,g=m.useMemo(()=>f?m.Children.map(a,(p,x)=>n.jsx(de,{children:p},x)):a,[a,f]);return n.jsx(z.div,{ref:s,className:re("chakra-wrap",h),...u,children:n.jsx(z.ul,{className:"chakra-wrap__list",__css:{display:"flex",flexWrap:"wrap",justifyContent:c,alignItems:d,flexDirection:l,listStyleType:"none",gap:o,columnGap:i,rowGap:r,padding:"0"},children:g})})});Be.displayName="Wrap";var de=H(function(e,s){const{className:o,...i}=e;return n.jsx(z.li,{ref:s,__css:{display:"flex",alignItems:"flex-start"},className:re("chakra-wrap__listitem",o),...i})});de.displayName="WrapItem";function we(t){return rt(t,e=>e==="auto"?"auto":`span ${e}/span ${e}`)}var Re=H(function(e,s){const{area:o,colSpan:i,colStart:r,colEnd:a,rowEnd:c,rowSpan:l,rowStart:d,...h}=e,f=it({gridArea:o,gridColumn:we(i),gridRow:we(l),gridColumnStart:r,gridColumnEnd:a,gridRowStart:d,gridRowEnd:c});return n.jsx(z.div,{ref:s,__css:f,...h})});Re.displayName="GridItem";var te=(t,e)=>e?`${t}.${e}, ${e}`:void 0;function We(t){var e;const{bg:s,bgColor:o,backgroundColor:i,shadow:r,boxShadow:a,shadowColor:c}=t,{getArrowProps:l,getArrowInnerProps:d}=at(),h=lt(),f=(e=s??o)!=null?e:i,u=r??a;return n.jsx(z.div,{...l(),className:"chakra-popover__arrow-positioner",children:n.jsx(z.div,{className:re("chakra-popover__arrow",t.className),...d(t),__css:{"--popper-arrow-shadow-color":te("colors",c),"--popper-arrow-bg":te("colors",f),"--popper-arrow-shadow":te("shadows",u),...h.arrow}})})}We.displayName="PopoverArrow";function St(t,e,s){return(t-e)*100/(s-e)}J({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});J({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var Ct=J({"0%":{left:"-40%"},"100%":{left:"100%"}}),bt=J({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function kt(t){const{value:e=0,min:s,max:o,valueText:i,getValueText:r,isIndeterminate:a,role:c="progressbar"}=t,l=St(e,s,o);return{bind:{"data-indeterminate":a?"":void 0,"aria-valuemax":o,"aria-valuemin":s,"aria-valuenow":a?void 0:e,"aria-valuetext":(()=>{if(e!=null)return typeof r=="function"?r(e,l):i})(),role:c},percent:l,value:e}}var[Lt,It]=qe({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Et=H((t,e)=>{const{min:s,max:o,value:i,isIndeterminate:r,role:a,...c}=t,l=kt({value:i,min:s,max:o,isIndeterminate:r,role:a}),h={height:"100%",...It().filledTrack};return n.jsx(z.div,{ref:e,style:{width:`${l.percent}%`,...c.style},...l.bind,...c,__css:h})}),$e=H((t,e)=>{var s;const{value:o,min:i=0,max:r=100,hasStripe:a,isAnimated:c,children:l,borderRadius:d,isIndeterminate:h,"aria-label":f,"aria-labelledby":u,"aria-valuetext":g,title:p,role:x,...j}=Ye(t),M=Qe("Progress",t),b=d??((s=M.track)==null?void 0:s.borderRadius),k={animation:`${bt} 1s linear infinite`},D={...!h&&a&&c&&k,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${Ct} 1s ease infinite normal none running`}},C={overflow:"hidden",position:"relative",...M.track};return n.jsx(z.div,{ref:e,borderRadius:b,__css:C,...j,children:n.jsxs(Lt,{value:M,children:[n.jsx(Et,{"aria-label":f,"aria-labelledby":u,"aria-valuetext":g,min:i,max:r,value:o,isIndeterminate:h,css:D,borderRadius:b,title:p,role:x}),l]})})});$e.displayName="Progress";function K(t){return Array.isArray?Array.isArray(t):Ue(t)==="[object Array]"}const At=1/0;function Tt(t){return t==null?"":function(e){if(typeof e=="string")return e;let s=e+"";return s=="0"&&1/e==-At?"-0":s}(t)}function F(t){return typeof t=="string"}function Ke(t){return typeof t=="number"}function Nt(t){return t===!0||t===!1||function(e){return function(s){return typeof s=="object"}(e)&&e!==null}(t)&&Ue(t)=="[object Boolean]"}function T(t){return t!=null}function se(t){return!t.trim().length}function Ue(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Dt=t=>`Missing ${t} property in key`,Ft=t=>`Property 'weight' in key '${t}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class Pt{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(o=>{let i=Ge(o);this._keys.push(i),this._keyMap[i.id]=i,s+=i.weight}),this._keys.forEach(o=>{o.weight/=s})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Ge(t){let e=null,s=null,o=null,i=1,r=null;if(F(t)||K(t))o=t,e=je(t),s=Me(t);else{if(!ve.call(t,"name"))throw new Error(Dt("name"));const a=t.name;if(o=a,ve.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(Ft(a));e=je(a),s=Me(a),r=t.getFn}return{path:e,id:s,weight:i,src:o,getFn:r}}function je(t){return K(t)?t:t.split(".")}function Me(t){return K(t)?t.join("."):t}var v={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx{if(T(r))if(a[c]){const l=r[a[c]];if(!T(l))return;if(c===a.length-1&&(F(l)||Ke(l)||Nt(l)))s.push(Tt(l));else if(K(l)){o=!0;for(let d=0,h=l.length;d{this._keysMap[s.id]=o})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,F(this.docs[0])?this.docs.forEach((e,s)=>{this._addString(e,s)}):this.docs.forEach((e,s)=>{this._addObject(e,s)}),this.norm.clear())}add(e){const s=this.size();F(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let s=e,o=this.size();s{let a=i.getFn?i.getFn(e):this.getFn(e,i.path);if(T(a)){if(K(a)){let c=[];const l=[{nestedArrIndex:-1,value:a}];for(;l.length;){const{nestedArrIndex:d,value:h}=l.pop();if(T(h))if(F(h)&&!se(h)){let f={v:h,i:d,n:this.norm.get(h)};c.push(f)}else K(h)&&h.forEach((f,u)=>{l.push({nestedArrIndex:u,value:f})})}o.$[r]=c}else if(F(a)&&!se(a)){let c={v:a,n:this.norm.get(a)};o.$[r]=c}}}),this.records.push(o)}toJSON(){return{keys:this.keys,records:this.records}}}function Ve(t,e,{getFn:s=v.getFn,fieldNormWeight:o=v.fieldNormWeight}={}){const i=new he({getFn:s,fieldNormWeight:o});return i.setKeys(t.map(Ge)),i.setSources(e),i.create(),i}function Q(t,{errors:e=0,currentLocation:s=0,expectedLocation:o=0,distance:i=v.distance,ignoreLocation:r=v.ignoreLocation}={}){const a=e/t.length;if(r)return a;const c=Math.abs(o-s);return i?a+c/i:c?1:a}const B=32;function zt(t,e,s,{location:o=v.location,distance:i=v.distance,threshold:r=v.threshold,findAllMatches:a=v.findAllMatches,minMatchCharLength:c=v.minMatchCharLength,includeMatches:l=v.includeMatches,ignoreLocation:d=v.ignoreLocation}={}){if(e.length>B)throw new Error(`Pattern length exceeds max of ${B}.`);const h=e.length,f=t.length,u=Math.max(0,Math.min(o,f));let g=r,p=u;const x=c>1||l,j=x?Array(f):[];let M;for(;(M=t.indexOf(e,p))>-1;){let C=Q(e,{currentLocation:M,expectedLocation:u,distance:i,ignoreLocation:d});if(g=Math.min(C,g),p=M+h,x){let L=0;for(;L=O;w-=1){let _=w-1,S=s[t.charAt(_)];if(x&&(j[_]=+!!S),y[w]=(y[w+1]<<1|1)&S,C&&(y[w]|=(b[w+1]|b[w])<<1|1|b[w+1]),y[w]&Y&&(k=Q(e,{errors:C,currentLocation:_,expectedLocation:u,distance:i,ignoreLocation:d}),k<=g)){if(g=k,p=_,p<=u)break;O=Math.max(1,2*u-p)}}if(Q(e,{errors:C+1,currentLocation:u,expectedLocation:u,distance:i,ignoreLocation:d})>g)break;b=y}const D={isMatch:p>=0,score:Math.max(.001,k)};if(x){const C=function(L=[],I=v.minMatchCharLength){let O=[],E=-1,y=-1,w=0;for(let _=L.length;w<_;w+=1){let S=L[w];S&&E===-1?E=w:S||E===-1||(y=w-1,y-E+1>=I&&O.push([E,y]),E=-1)}return L[w-1]&&w-E>=I&&O.push([E,w-1]),O}(j,c);C.length?l&&(D.indices=C):D.isMatch=!1}return D}function Bt(t){let e={};for(let s=0,o=t.length;s{this.chunks.push({pattern:u,alphabet:Bt(u),startIndex:g})},f=this.pattern.length;if(f>B){let u=0;const g=f%B,p=f-g;for(;u{const{isMatch:M,score:b,indices:k}=zt(e,p,x,{location:i+j,distance:r,threshold:a,findAllMatches:c,minMatchCharLength:l,includeMatches:o,ignoreLocation:d});M&&(u=!0),f+=b,M&&k&&(h=[...h,...k])});let g={isMatch:u,score:u?f/this.chunks.length:1};return u&&o&&(g.indices=h),g}}const _e=[];function Se(t,e){for(let s=0,o=_e.length;s{if(!T(o.indices)||!o.indices.length)return;const{indices:i,value:r}=o;let a={indices:i,value:r};o.key&&(a.key=o.key.src),o.idx>-1&&(a.refIndex=o.idx),e.matches.push(a)})}function $t(t,e){e.score=t.score}class U{constructor(e,s={},o){if(this.options={...v,...s},this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new Pt(this.options.keys),this.setCollection(e,o)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof he))throw new Error("Incorrect 'index' type");this._myIndex=s||Ve(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){T(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const s=[];for(let o=0,i=this._docs.length;o{let u=1;f.matches.forEach(({key:g,norm:p,score:x})=>{const j=g?g.weight:null;u*=Math.pow(x===0&&j?Number.EPSILON:x,(j||1)*(h?1:p))}),f.score=u})}(l,{ignoreFieldNorm:c}),r&&l.sort(a),Ke(s)&&s>-1&&(l=l.slice(0,s)),function(d,h,{includeMatches:f=v.includeMatches,includeScore:u=v.includeScore}={}){const g=[];return f&&g.push(Wt),u&&g.push($t),d.map(p=>{const{idx:x}=p,j={item:h[x],refIndex:x};return g.length&&g.forEach(M=>{M(p,j)}),j})}(l,this._docs,{includeMatches:o,includeScore:i})}_searchStringList(e){const s=Se(e,this.options),{records:o}=this._myIndex,i=[];return o.forEach(({v:r,i:a,n:c})=>{if(!T(r))return;const{isMatch:l,score:d,indices:h}=s.searchIn(r);l&&i.push({item:r,idx:a,matches:[{score:d,value:r,norm:c,indices:h}]})}),i}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e){const s=Se(e,this.options),{keys:o,records:i}=this._myIndex,r=[];return i.forEach(({$:a,i:c})=>{if(!T(a))return;let l=[];o.forEach((d,h)=>{l.push(...this._findMatches({key:d,value:a[h],searcher:s}))}),l.length&&r.push({idx:c,item:a,matches:l})}),r}_findMatches({key:e,value:s,searcher:o}){if(!T(s))return[];let i=[];if(K(s))s.forEach(({v:r,i:a,n:c})=>{if(!T(r))return;const{isMatch:l,score:d,indices:h}=o.searchIn(r);l&&i.push({score:d,key:e,value:r,idx:a,norm:c,indices:h})});else{const{v:r,n:a}=s,{isMatch:c,score:l,indices:d}=o.searchIn(r);c&&i.push({score:l,key:e,value:r,norm:a,indices:d})}return i}}U.version="7.0.0",U.createIndex=Ve,U.parseIndex=function(t,{getFn:e=v.getFn,fieldNormWeight:s=v.fieldNormWeight}={}){const{keys:o,records:i}=t,r=new he({getFn:e,fieldNormWeight:s});return r.setKeys(o),r.setIndexRecords(i),r},U.config=v;function Kt({selectedModel:t,setSelectedModel:e,modelTypeList:s}){const o=i=>{e(i)};return n.jsx(Be,{children:s.map(i=>n.jsx(de,{children:n.jsx(A,{colorScheme:"blue",variant:t===i?"solid":"outline",onClick:()=>o(i),size:"sm",children:i})},i))})}const Ut={checkpoints:"CheckpointLoaderSimple",vae:"VAELoader",loras:"LoraLoader",controlnet:"ControlNetLoader",upscale_models:"UpscaleModelLoader"};function Gt({data:t}){const[e,s]=m.useState("https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/27fd7433-cb0a-4a87-88c1-21ccb2b1a842/width=450/00060-881622046.jpeg"),[o,i]=m.useState(!t.file_hash),[r,a]=m.useState();m.useEffect(()=>{i(!t.file_hash),c()},[t.file_hash]);const c=async()=>{var h;const d=await $.models.get(t.model_name+"@"+t.model_type);if(d!=null&&(a(d),(h=d.imageUrl)!=null&&h.length&&s(d.imageUrl)),!(d!=null&&d.imageUrl)&&t.file_hash!=null)try{const f=await le(t.file_hash),u=f.imageUrl;u&&s(u);const g={id:t.model_name+"@"+t.model_type,fileHash:t.file_hash,fileFolder:t.model_type,fileName:t.model_name+t.model_extension,modelName:f.modelName??null,civitModelID:f.civitModelID,civitModelVersionID:f.civitModelVersionID,imageUrl:u??null};a(g)}catch{}t.preview&&s(t.preview)},l=d=>{const h=Ut[t.model_type];h&&(d.dataTransfer.setData("eventName","WorkspaceManagerAddNode"),d.dataTransfer.setData("modelRelativePath",t.model_name+t.model_extension),d.dataTransfer.setData("nodeType",h))};return n.jsxs(oe,{children:[n.jsxs(oe,{position:"relative",borderRadius:4,draggable:!0,onDragStart:l,children:[o?n.jsx(R,{bg:"rgba(0, 0, 0, 0.5)",height:178,justifyContent:"center",alignItems:"center",children:n.jsx(ae,{})}):n.jsx(ze,{src:e,draggable:!1,boxSize:"100%",height:150,objectFit:"cover",borderRadius:4,cursor:(r==null?void 0:r.civitModelID)!=null?"pointer":"auto",onClick:()=>{(r==null?void 0:r.civitModelID)==null||(r==null?void 0:r.civitModelVersionID)==null||window.open(`https://civitai.com/models/${r==null?void 0:r.civitModelID}?modelVersionId=${r==null?void 0:r.civitModelVersionID}`)}}),n.jsx(N,{position:"absolute",bottom:"0",left:"0",right:"0",color:"white",fontSize:14})]}),n.jsx(ie,{label:n.jsxs("span",{children:[t.model_name+t.model_extension,n.jsx("br",{}),t.date.toLocaleDateString()]}),children:n.jsx(N,{textAlign:"center",p:"1",fontSize:14,noOfLines:2,children:t.model_name+t.model_extension})})]})}function Vt({list:t}){return n.jsx(Mt,{templateColumns:"repeat(3, minmax(0, 1fr))",gap:1,marginTop:2,children:t.map(e=>n.jsx(Re,{children:n.jsx(Gt,{data:e})},e.model_name+e.date.getTime()))})}function Ht(){const{setRoute:t}=m.useContext(Ae);return n.jsx(n.Fragment,{children:n.jsx(A,{size:"sm",colorScheme:"teal",onClick:()=>t("installModels"),children:"Install Models"})})}const qt=()=>{const[t,e]=m.useState(["checkpoints"]),[s,o]=m.useState([]),[i,r]=m.useState(!0);m.useEffect(()=>{a(),ce.addEventListener("model_list",async l=>{c(l.detail)})},[]);const a=async()=>{const l=await ct();c(l)},c=async l=>{if(!l)return;r(!1);const d=Array.from(new Set(l.map(f=>f.model_type))),h=d.indexOf("checkpoints");h>=0&&d.splice(h,1),d.unshift("checkpoints"),e(d),o(l.map(f=>({...f,date:new Date(f.date*1e3)})))};return{modelTypeList:t,modelsList:s,loading:i}};function Yt(){const[t,e]=m.useState(!1),s=()=>{var a;(a=V)==null||a.getSetting("showNsfwModelThumbnail").then(c=>{e(c??!1)})};m.useEffect(()=>{s()},[]);const o=a=>{var l;const c=a.target.checked;(l=V)==null||l.upsert({showNsfwModelThumbnail:c}).then(()=>{s(),i(),window.dispatchEvent(new Event("showNsfwModelThumbnail"))})},i=async()=>{const a=await $.models.toArray();for(let c=0;c{try{if(a.fileHash==null)return;const l=(await le(a.fileHash)).imageUrl;$.models.update(a.id,{imageUrl:l??null})}catch{}};return n.jsx(_t,{isChecked:t,onChange:o,children:"Show NSFW"})}function Qt(){const t=async e=>{if(e.dataTransfer.getData("eventName")!=="WorkspaceManagerAddNode")return;const o=e.dataTransfer.getData("modelRelativePath"),i=e.dataTransfer.getData("nodeType"),r=LiteGraph.createNode(i);r.pos=[e.canvasX,e.canvasY],r.configure({widgets_values:[o]}),G.graph.add(r)};return m.useEffect(()=>(G.canvasEl.addEventListener("drop",t),()=>{G.canvasEl.removeEventListener("drop",t)}),[]),null}function Jt({onClose:t}){const[e,s]=m.useState("checkpoints"),[o,i]=m.useState(""),[r,a]=m.useState("name"),{loading:c,modelTypeList:l,modelsList:d}=qt(),[h,f]=m.useState([]),[u,g]=m.useState([]);m.useEffect(()=>{x();async function x(){const j=await $.models.toArray();f(d.map(M=>({...M,db:j.find(b=>b.id===M.model_name+"@"+M.model_type)})))}},[d]),m.useEffect(()=>{let x=[];o.length?x=new U(h,{keys:["model_name","db.modelName"]}).search(o).map(b=>b.item):x=d.filter(j=>j.model_type===e).sort((j,M)=>r==="name"?j.model_name.localeCompare(M.model_name):M.date.getTime()-j.date.getTime()),g(x)},[e,d,o,r,h]),m.useEffect(()=>(G.canvasEl.addEventListener("click",t),()=>{G.canvasEl.removeEventListener("click",t)}),[t]);const p=440;return n.jsx(Je,{children:n.jsxs(oe,{style:{width:p},children:[n.jsxs(Te,{width:p,height:"100vh",p:4,gap:2,position:"fixed",top:0,left:0,shadow:"xl",zIndex:dt,overflowY:"auto",children:[n.jsxs(R,{justifyContent:"space-between",alignContent:"center",py:3,children:[n.jsx(Ne,{size:"md",mr:2,children:"Models"}),n.jsx(Ht,{})]}),n.jsx(R,{gap:4,justifyContent:"center",alignItems:"center",mb:1,children:n.jsx(X,{size:"sm",placeholder:"Search",value:o,onChange:x=>i(x.target.value)})}),n.jsxs(R,{gap:4,justifyContent:"space-between",alignItems:"center",mb:1,children:[!o.length&&n.jsxs(W,{children:[n.jsx("span",{children:"Sort By"}),n.jsxs(Z,{value:r,size:"sm",width:"120px",onChange:x=>a(x.target.value),children:[n.jsx("option",{value:"name",children:"Name"}),n.jsx("option",{value:"date",children:"Date"})]})]}),n.jsx(Yt,{})]}),!o.length&&n.jsx(Kt,{modelTypeList:l,setSelectedModel:s,selectedModel:e}),n.jsx(Vt,{list:u}),c&&n.jsx(R,{justifyContent:"center",alignItems:"center",height:"100%",children:n.jsx(ae,{})})]}),n.jsx(Qt,{})]})})}const Xt=async t=>{try{const s=await(await ce.fetchApi("/model_manager/install_model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).text();window.dispatchEvent(new CustomEvent("model_install_message",{detail:s}))}catch(e){console.error("Failed to connect to the server:",e)}};function Ce(t,e=1){const i=t/1024;return i>=1024?(i/1024).toFixed(e)+" GB":i.toFixed(e)+" MB"}function be(t,e){if(!t||t.length===0)return;let s=t.find(o=>o.nsfw==="None"||o.nsfwLevel===1);return e&&(s=s??t[0]),s}function Zt(t,e=280,s){var o,i,r,a;if(t){if(t.images)return`https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/${(o=be(t.images,s))==null?void 0:o.url}/width=${e}/`;if(De(t))return(a=be((r=(i=t.modelVersions)==null?void 0:i.at(0))==null?void 0:r.images,s))==null?void 0:a.url}}const ne=280;function es({model:t,onClickInstallModel:e,installing:s}){var u,g;const[o,i]=m.useState();m.useEffect(()=>{p();async function p(){var j;const x=await((j=V)==null?void 0:j.getSetting("showNsfwModelThumbnail"));i(Zt(t,ne,x))}},[t]);const r=De(t)?t.modelVersions:t.versions,[a,c]=m.useState(((u=r==null?void 0:r[0])==null?void 0:u.name)??""),l=r==null?void 0:r.find(p=>(p==null?void 0:p.name)===a),d=()=>{window.open(`https://civitai.com/models/${t.id}`)},h=m.useCallback(()=>{if(l==null){console.error("no file is find by name",a);return}e(xe(l,t.name),t)},[a]),f=(g=xe(l))==null?void 0:g.sizeKB;return n.jsxs(Te,{width:ne,justifyContent:"space-between",mb:2,gap:1,children:[n.jsx(ze,{borderRadius:3,boxSize:ne+"px",objectFit:"cover",src:o,alt:"model cover image",cursor:"pointer",onClick:()=>d()}),n.jsxs(q,{p:1,children:[n.jsx(ie,{label:t.name,children:n.jsx(N,{fontWeight:500,noOfLines:1,children:t.name})}),n.jsxs(R,{justifyContent:"space-between",alignItems:"center",children:[n.jsx(A,{borderRadius:14,noOfLines:1,size:"xs",colorScheme:"teal",maxWidth:"40%",flexShrink:1,variant:"outline",px:1,cursor:"text",children:n.jsx(N,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:t.type})}),n.jsx(A,{leftIcon:n.jsx(ht,{size:18}),iconSpacing:1,borderRadius:10,size:"sm",py:1,colorScheme:"teal",type:"submit",onClick:()=>h(),isDisabled:!!(a&&s.includes(a)),children:"Install"})]}),n.jsxs(W,{children:[n.jsx(Z,{size:"md",style:{paddingLeft:4},onChange:p=>{c(p.target.value)},children:r==null?void 0:r.map(p=>{const x=p==null?void 0:p.name;return x?n.jsx("option",{value:x,style:{padding:0},children:x},p.id):null})}),f&&n.jsx(ie,{label:Ce(f),children:n.jsx(N,{flexShrink:1,noOfLines:1,width:"40%",children:Ce(f)})})]})]})]})}function ts({searchQuery:t,setSearchQuery:e,onSearch:s}){return n.jsxs(R,{gap:1,alignItems:"center",grow:1,children:[n.jsx(X,{placeholder:"Search models in CivitAI",width:"60%",value:t,onChange:o=>e(o.target.value),onKeyUp:o=>{o.code==="Enter"&&s()}}),n.jsx(A,{size:"sm",onClick:()=>s(),colorScheme:"teal",children:"Search"})]})}function ss({isOpen:t,fileSelected:e,onClose:s,selectFolder:o}){const[i,r]=m.useState(""),[a,c]=m.useState([]),[l,d]=m.useState(""),h=m.useRef(null);m.useEffect(()=>{f()},[]);const f=async()=>{const u=await Fe();u&&(["custom_nodes","config","saved_prompts"].forEach(g=>{delete u[g]}),c(Object.values(u).flatMap(g=>g)))};return n.jsx(Xe,{isOpen:t,leastDestructiveRef:h,onClose:s,children:n.jsx(Le,{children:n.jsxs(Ze,{children:[n.jsx(Ie,{fontSize:"lg",fontWeight:"bold",children:"Choose Folder"}),n.jsx(Ee,{children:n.jsxs(q,{spacing:4,children:[!e&&n.jsxs(n.Fragment,{children:[n.jsx(N,{children:"Model download url"}),n.jsx(X,{placeholder:"https://civitai.com/api/download/models/311399",onChange:u=>d(u.target.value),value:l})]}),n.jsx(N,{children:"Choose model install folder"}),n.jsx(Z,{placeholder:"Select option",value:i,onChange:u=>r(u.target.value),children:a.map(u=>n.jsx("option",{value:u,children:u},u))})]})}),n.jsxs(et,{children:[n.jsx(A,{ref:h,onClick:s,children:"Cancel"}),n.jsx(A,{onClick:()=>o(i,l),ml:3,isDisabled:l.length===0,children:"Confirm"})]})]})})})}function ns(){const{colorMode:t}=tt(),e=Pe(),[s,o]=m.useState([]);return m.useEffect(()=>{ye.addEventListener("download_progress",i=>{o(i.detail)}),ye.addEventListener("download_error",i=>{e({title:"Download Error",description:i.detail,status:"error",duration:4e3,isClosable:!0})})},[]),n.jsx(q,{spacing:5,pos:"absolute",bottom:"0",left:"0",width:"50%",zIndex:80,backgroundColor:t==="light"?"white":"#242424",paddingX:5,pt:2,children:s.map(({save_path:i,progress:r})=>n.jsxs(W,{children:[n.jsx(N,{fontSize:16,width:"40%",children:i.replace(/^.*[\\/]/,"")}),n.jsx($e,{isIndeterminate:!r,hasStripe:!0,width:"50%",value:r}),n.jsxs(N,{fontSize:16,width:"10%",children:[r.toFixed(1),"%"]}),n.jsx(A,{variant:"outline",size:"sm",colorScheme:"red",onClick:()=>ut(i),children:"Cancel"})]},i))})}function os(){const[t,e]=m.useState(""),{onOpen:s,onClose:o,isOpen:i}=Oe(),r=()=>{vt(t),o()};return n.jsxs(ft,{isOpen:i,onOpen:s,onClose:o,placement:"right",closeOnBlur:!1,children:[n.jsx(mt,{children:n.jsx(A,{size:"sm",py:1,mr:8,children:"Set Civitai API Key"})}),n.jsxs(pt,{p:5,children:[n.jsx(We,{}),n.jsx(gt,{}),n.jsxs(q,{spacing:4,children:[n.jsx(N,{fontSize:14,children:"Some Civitai.com models require user login to download, you will nedd a Civitai API key to download in that case"}),n.jsx(X,{value:t,onChange:a=>e(a.target.value),placeholder:"API Key"}),n.jsx(A,{size:"sm",py:1,mr:8,onClick:r,children:"Save"})]})]})]})}var ke={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};async function is(t,e){var a,c;const s={queries:[{q:t,indexUid:"models_v9",facets:["category.name","checkpointType","fileFormats","lastVersionAtUnix","tags.name","type","user.username","version.baseModel"],attributesToHighlight:["*"],highlightPreTag:"__ais-highlight__",highlightPostTag:"__/ais-highlight__",limit:80,offset:0}]};return e&&(s.queries[0].filter=[[`"type"="${e}"`]]),((c=(a=await(await fetch(ke.VITE_CMODEL_SEARCH_URL,{headers:{"Content-Type":"application/json",Authorization:ke.VITE_CMODEL_APP_KEY},method:"POST",body:JSON.stringify(s)})).json())==null?void 0:a.results)==null?void 0:c.at(0)).hits??[]}function rs({onclose:t,searchQuery:e="",modelType:s}){const[o,i]=m.useState([]),[r,a]=m.useState(!1),[c,l]=m.useState(s),d=Pe(),[h,f]=m.useState([]),[u,g]=m.useState(e),{isOpen:p,onOpen:x,onClose:j}=Oe(),[M,b,k]=xt(),[P,Y]=m.useState({}),[D,C]=m.useState(ee),L=m.useCallback(async()=>{var S;a(!0);const y=await is(u,c);i(y);const w=await Fe();w&&Y(w);const _=await((S=V)==null?void 0:S.getSetting("defaultFolders"));_&&C(_),a(!1)},[u,c]),I=(y,w)=>{var fe,me,pe,ge;if(!((fe=k.current)!=null&&fe.id)&&!w){console.error("no url to download");return}let _=w??`https://civitai.com/api/download/models/${(me=k.current)==null?void 0:me.id}`,S=(pe=k.current)==null?void 0:pe.name;if(!S&&(S=_.split("/").pop(),!S)){console.error("downloadUrl is malformed");return}d({title:"Installing...",description:S,status:"info",duration:4e3,isClosable:!0}),S!=null&&f(He=>[...He,S??""]);const ue=jt();ue&&(_+=`?token=${ue}`),Xt({file_hash:(ge=k.current)==null?void 0:ge.SHA256,filename:S,save_path:y,url:_}),b(void 0),j()},O=async(y,w)=>{const _=D[w.type];b(y),_==null?x():I(_)},E=async(y,w)=>{var S;const _={...D,[y]:w};await((S=V)==null?void 0:S.upsert({defaultFolders:_})),C(_)};return m.useEffect(()=>{L()},[c]),n.jsxs(n.Fragment,{children:[n.jsxs(st,{isOpen:!0,onClose:t,blockScrollOnMount:!0,children:[n.jsx(Le,{}),n.jsxs(nt,{width:"90%",maxWidth:"90vw",height:"90vh",children:[n.jsxs(Ie,{pb:1,children:[n.jsxs(W,{gap:2,mb:2,alignItems:"center",children:[n.jsx(Ne,{size:"md",mr:2,children:"Models"}),n.jsx(ts,{searchQuery:u,setSearchQuery:g,onSearch:L}),n.jsx(A,{size:"sm",py:1,mr:8,onClick:x,children:"Custom URL Install"}),n.jsx(os,{})]}),n.jsxs(W,{gap:2,wrap:"wrap",children:[n.jsx(A,{size:"sm",py:1,onClick:()=>{l(void 0)},isActive:c==null,children:"All"}),yt.map(y=>n.jsx(A,{size:"sm",py:1,isActive:c===y,onClick:()=>{l(y)},children:y},y)),c&&P[ee[c]]&&n.jsxs(W,{ml:"auto",children:[n.jsx(N,{fontSize:17,whiteSpace:"nowrap",children:"Default Download Folder:"}),n.jsx(Z,{value:D[c],onChange:y=>E(c,y.target.value),children:P[ee[c]].map(y=>n.jsx("option",{value:y,children:y},y))})]})]}),r&&n.jsx(ae,{thickness:"4px",emptyColor:"gray.200",color:"pink.500",size:"lg"})]}),n.jsx(ot,{}),n.jsxs(Ee,{overflowY:"auto",children:[n.jsx(W,{wrap:"wrap",children:o==null?void 0:o.map(y=>n.jsx(es,{model:y,onClickInstallModel:O,installing:h},y.id))}),n.jsx(ns,{})]})]})]}),n.jsx(ss,{fileSelected:!!M,isOpen:p,onClose:j,selectFolder:(y,w)=>{I(y,k.current?void 0:w)}})]})}function ms(){const{setRoute:t,route:e}=m.useContext(Ae);return m.useEffect(()=>{ce.addEventListener("model_list",async s=>{var r;const o=(r=s.detail)==null?void 0:r.map(async a=>{const c=await $.models.get(a.model_name+"@"+a.model_type);if(c!=null&&c.fileHash)return c;let l={id:a.model_name+"@"+a.model_type,modelName:null,fileHash:a.file_hash??null,fileFolder:a.model_type,fileName:a.model_name+a.model_extension};if(!a.file_hash)return l;const d=await le(a.file_hash);return l={...l,modelName:d.modelName??null,civitModelID:d.civitModelID,civitModelVersionID:d.civitModelVersionID,imageUrl:d.imageUrl??null},l}),i=(await Promise.all(o)).filter(a=>a!=null);await $.models.clear(),await $.models.bulkPut(i.filter(a=>a!=null)),window.dispatchEvent(new CustomEvent("model_list_updated"))})},[]),n.jsxs(q,{style:{position:"relative"},children:[n.jsx(A,{size:"sm",backgroundColor:"#434554",color:"white",colorScheme:"blue","aria-label":"My models",onClick:()=>t("modelList"),px:1,height:wt+"px",children:"Models"}),e==="modelList"&&n.jsx(Jt,{onClose:()=>t("root")}),e==="installModels"&&n.jsx(rs,{modelType:"Checkpoint",onclose:()=>t("root")})]})}export{ms as default}; diff --git a/dist/workspace_web/RecentFilesDrawer-g7Y8NeOQ.js b/dist/workspace_web/RecentFilesDrawer-g7Y8NeOQ.js deleted file mode 100644 index 6b15f0a..0000000 --- a/dist/workspace_web/RecentFilesDrawer-g7Y8NeOQ.js +++ /dev/null @@ -1,5 +0,0 @@ -import{f as Q,E as qe,j as e,Y as Je,e as ie,g as we,r,M as re,N as le,O as ce,Q as de,R as ue,S as he,V as ve,h as W,Z as ke,T as Qe}from"./input.js";import{m as Le,u as Ae,a as et,b as tt,c as st,S as nt,M as at,d as A,H as z,T as We,I as P,t as je,e as Ne,f as Y,E as me,g as B,h as L,i as R,j as pe,k as C,R as H,l as ot,n as Me,B as _,F as Z,o as Fe,p as it,q as rt,r as ee,s as te,v as N,w as lt,D as Pe,x as T,y as Re,z as ct,A as Se,C as dt,G as _e,J as G,K as ut,L as ht,N as pt,O as Be,P as gt,Q as mt,U as ft,V as U,W as ye,X as Ce,Y as xt,Z as jt,_ as $e,$ as yt,a0 as wt,a1 as vt,a2 as J,a3 as oe,a4 as kt,a5 as St,a6 as Ct,a7 as fe,a8 as bt}from"./App-1AImvRpr.js";import{G as It,C as q}from"./chunk-JARCRF6W-UyOcndjS.js";import{V as Ke}from"./chunk-NTCQBYKE-HH_ifqNx.js";import{N as Mt,a as Ft,g as Dt,I as Et,M as Tt,u as Ot,S as zt}from"./MediaPreview-muJLkZRm.js";import{I as Lt}from"./IconCopy-DxyTNBlz.js";import"./chunk-7D6N5TE5-fihyubSX.js";import"./IconSearch-qxAzDzhT.js";var Ge=Q(function(t,l){const{columns:o,spacingX:n,spacingY:a,spacing:u,minChildWidth:p,...i}=t,h=qe(),d=p?Wt(p,h):Nt(o);return e.jsx(It,{ref:l,gap:u,columnGap:n,rowGap:a,templateColumns:d,...i})});Ge.displayName="SimpleGrid";function At(s){return typeof s=="number"?`${s}px`:s}function Wt(s,t){return Le(s,l=>{const o=Je("sizes",l,At(l))(t);return l===null?null:`repeat(auto-fit, minmax(${o}, 1fr))`})}function Nt(s){return Le(s,t=>t===null?null:`repeat(${t}, minmax(0, 1fr))`)}var He=Q((s,t)=>{const{title:l,children:o,className:n,...a}=s,u=ie("chakra-menu__group__title",n),p=Ae();return e.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[l&&e.jsx(we.p,{className:u,...a,__css:p.groupTitle,children:l}),o]})});He.displayName="MenuGroup";var Ve=s=>{const{className:t,title:l,...o}=s,n=et(o);return e.jsx(He,{title:l,className:ie("chakra-menu__option-group",t),...n})};Ve.displayName="MenuOptionGroup";var Pt=Q((s,t)=>{const l=Ae();return e.jsx(we.button,{ref:t,...s,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...l.button}})}),se=Q((s,t)=>{const{children:l,as:o,...n}=s,a=tt(n,t),u=o||Pt;return e.jsx(u,{...a,className:ie("chakra-menu__menu-button",s.className),children:e.jsx(we.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:s.children})})});se.displayName="MenuButton";var Rt=s=>e.jsx("svg",{viewBox:"0 0 14 14",width:"1em",height:"1em",...s,children:e.jsx("polygon",{fill:"currentColor",points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})}),be=Q((s,t)=>{const{icon:l,iconSpacing:o="0.75rem",...n}=s,a=st(n,t);return e.jsxs(nt,{...a,className:ie("chakra-menu__menuitem-option",n.className),children:[l!==null&&e.jsx(at,{fontSize:"0.8em",marginEnd:o,opacity:s.isChecked?1:0,children:l||e.jsx(Rt,{})}),e.jsx("span",{style:{flex:1},children:a.children})]})});be.id="MenuItemOption";be.displayName="MenuItemOption";var _t=A("chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]),Bt=A("dots-vertical","IconDotsVertical",[["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]),$t=A("edit","IconEdit",[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]]),De=A("file-import","IconFileImport",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M5 13v-8a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-5.5m-9.5 -2h7m-3 -3l3 3l-3 3",key:"svg-1"}]]),Kt=A("file","IconFile",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}]]),Ue=A("folder-plus","IconFolderPlus",[["path",{d:"M12 19h-7a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v3.5",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}]]),Gt=A("list-check","IconListCheck",[["path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5",key:"svg-0"}],["path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5",key:"svg-1"}],["path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5",key:"svg-2"}],["path",{d:"M11 6l9 0",key:"svg-3"}],["path",{d:"M11 12l9 0",key:"svg-4"}],["path",{d:"M11 18l9 0",key:"svg-5"}]]),Ht=A("lock-open","IconLockOpen",[["path",{d:"M5 11m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M12 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-5a4 4 0 0 1 8 0",key:"svg-2"}]]),Vt=A("menu-2","IconMenu2",[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M4 12l16 0",key:"svg-1"}],["path",{d:"M4 18l16 0",key:"svg-2"}]]),Ut=A("moon","IconMoon",[["path",{d:"M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z",key:"svg-0"}]]),Zt=A("pencil","IconPencil",[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]]),Yt=A("settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]),Xt=A("sun","IconSun",[["path",{d:"M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7",key:"svg-1"}]]),qt=A("tag","IconTag",[["path",{d:"M7.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3z",key:"svg-1"}]]),Jt=A("upload","IconUpload",[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 9l5 -5l5 5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]]);function Qt({onclose:s}){const[t,l]=r.useState([]),o=async()=>{var a;const n=await((a=je)==null?void 0:a.listAll());l(n??[])};return r.useEffect(()=>{o()},[]),e.jsxs(re,{isOpen:!0,onClose:s,children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"My Tags"}),e.jsx(ue,{}),e.jsx(he,{children:t.map(n=>e.jsxs(z,{children:[e.jsx(We,{children:n.name}),e.jsx(P,{onClick:async()=>{var a;await((a=je)==null?void 0:a.delete(n.name)),o()},"aria-label":"delete-tag",colorScheme:"red",variant:"ghost",icon:e.jsx(Ne,{})})]}))})]})]})}function es(){const s=Y(),t=r.useRef([{title:"Save current workflow",key:me.SAVE},{title:"Save as current workflow",key:me.SAVE_AS},{title:"Open spotlight search",key:me.openSpotlightSearch}]),[l,o]=r.useState({save:"",saveAs:"",openSpotlightSearch:""}),[n,a]=r.useState(),u=async(i,h)=>{var g;i.preventDefault();let d="";if(i.ctrlKey&&(d+="Control+"),i.metaKey&&(d+="Command+"),i.shiftKey&&(d+="Shift+"),i.altKey&&(d+="Alt+"),d.length>0&&!["Control","Shift","Alt","Meta"].includes(i.key)){d+=i.key.toUpperCase();const m={...l};delete m[h],Object.values(m).includes(d)?s({title:"Shortcut key conflict",description:`The shortcut key 「${d}」 is already used, please - modify it.`,status:"info",duration:3e3,position:"top",isClosable:!1}):(await((g=C)==null?void 0:g.upsert({shortcuts:{...l,[h]:d}})),p())}},p=()=>{var i;(i=C)==null||i.getSetting("shortcuts").then(h=>{var g;const d=h??((g=C)==null?void 0:g.defaultSettings.shortcuts);o({...l,...d})})};return r.useEffect(()=>{p()},[]),e.jsxs(B,{children:[e.jsx(L,{children:"Keyboard Shortcut"}),t.current.map(i=>e.jsxs(z,{children:[e.jsx(L,{fontSize:"sm",w:170,children:i.title}),e.jsx(R,{label:"Press shortcut key combinations to setup",placement:"bottom",hasArrow:!0,isOpen:n===i.key,children:e.jsx(pe,{value:l[i.key],onKeyDown:h=>{u(h,i.key)},onFocus:()=>{a(i.key)},onBlur:()=>{a(void 0)},placeholder:"Press a key combination",readOnly:!0,width:"auto",flex:1})})]},i.key))]})}function ts(){const{setRefreshFolderStamp:s}=r.useContext(H),[t,l]=r.useState(!1),o=()=>{var a;(a=C)==null||a.getSetting("foldersOnTop").then(u=>{l(!!u)})},n=a=>{var p;const u=a.target.checked;(p=C)==null||p.upsert({foldersOnTop:u}).then(()=>{o(),s(Date.now())})};return r.useEffect(()=>{o()},[]),e.jsx(B,{children:e.jsx(q,{isChecked:t,onChange:n,children:"Folders always on top"})})}function ss(){const[s,t]=r.useState(!1),[l,o]=r.useState(""),{showDialog:n}=ve(),a=()=>{var p,i;(p=C)==null||p.getSetting("myWorkflowsDir").then(h=>{o(h??"undefined")}),(i=C)==null||i.getSetting("twoWaySync").then(h=>{t(h??!1)})};r.useEffect(()=>{a()},[]);const u=async p=>{var h,d;if(!p.target.checked){await((h=C)==null?void 0:h.upsert({twoWaySync:p.target.checked})),a();return}const i=await((d=C)==null?void 0:d.getSetting("myWorkflowsDir"));n(e.jsx(ot,{myWorkflowsDir:i??"undefined"}),[{label:"I have downloaded all my workflows and ready to enable",onClick:async()=>{var g;await((g=C)==null?void 0:g.upsert({twoWaySync:!0})),a()},colorScheme:"red"}])};return e.jsxs(B,{children:[e.jsx(L,{children:"Only for legacy two way sync users to get back their data. Do not disable two way sync if you have already enabled it. It may cause some unexpected issues."}),e.jsx(q,{isChecked:s,onChange:u,children:"Enable two way sync"})]})}function Ee({settingKey:s,text:t,defaultChecked:l=!1}){const[o,n]=r.useState(l),a=Y(),u=()=>{var p;(p=C)==null||p.getSetting(s).then(i=>{n(!!i)})};return r.useEffect(()=>{u()},[]),e.jsx(B,{children:e.jsx(q,{isChecked:o,onChange:async p=>{var i;await((i=C)==null?void 0:i.upsert({[s]:p.target.checked})),u(),a({title:"Setting saved. Please refresh to see the changes.",status:"success",duration:3e3,isClosable:!0})},children:t})})}function ns(){const[s,t]=r.useState(!1),[l,o]=r.useState(!1),[n,a]=r.useState([]),[u,p]=r.useState(""),[i,h]=r.useState([]),[d,g]=r.useState(!1),[m,c]=r.useState(!1),[f,v]=r.useState(!1),S=r.useRef(null),w=Y();ve();const b=f?"\\":"/";r.useEffect(()=>{var j;Me().then(k=>{p(k.path??""),v(k.os==="win32")}),(j=C)==null||j.getSetting("twoWaySync").then(k=>{g(k??!1)})},[]);const F=async j=>{const{dir_path:k="",dir_contents:E=[],error:V=""}=await Fe(j??"");return V.includes("Operation not permitted")?(c(!0),O(),{isError:!0}):{dirList:E,dirPath:k}},y=async()=>{const{isError:j=!1,dirList:k=[]}=await F(u);j||(a(k),o(!0),h(u&&u.split(b).filter(E=>!!E)||[]))},O=()=>{o(!1),t(!1),h([])},$=async(j,k=!1,E=!1)=>{var x,I;if(k){const{path:M}=await Me();M&&await it(M,j)}await((x=C)==null?void 0:x.upsert({myWorkflowsDir:j}));const V=await((I=C)==null?void 0:I.getSetting("myWorkflowsDir"))??"";p(V),E&&c(!1),O()},K=async j=>{if(j){const{error:E=""}=await Fe(j);if(E.includes("Not a directory")){w({title:"The directory address you entered is invalid, please re-enter it.",status:"warning",duration:5e3,position:"top",isClosable:!0});return}}const k=j??`${f?"":b}${i.join(b)}`;$(k,!1,!!j)},X=async()=>{const{dirPath:j,dirList:k}=await F("");h(j.split(b).filter(E=>!!E)),a(k)},ne=async(j,k)=>{var I;let E="";j===-1&&k?E=`${f?"":b}${i.concat([k]).join(b)}`:E=`${f?"":b}${i.slice(0,j+1).join(b)}`;const{isError:V=!1,dirList:x=[]}=await F(E);V||(a(x),h(f?E.split(b):(I=E.slice(1))==null?void 0:I.split(b)))},ae=e.jsxs(_,{textAlign:"end",mb:4,children:[e.jsx(pe,{placeholder:"Please enter the absolute path directory address",ref:S,mt:2,mb:2}),e.jsx(W,{colorScheme:"teal",mr:3,size:"sm",onClick:()=>{var j,k;(j=S==null?void 0:S.current)!=null&&j.value&&K((k=S==null?void 0:S.current)==null?void 0:k.value)},children:"Save"})]}),ge=()=>{o(!0),t(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs(_,{mb:4,children:[e.jsx(L,{mb:2,fontWeight:500,children:"My Workflows Save Directory"}),l?s?ae:e.jsxs(Ke,{spacing:2,alignItems:"start",children:[e.jsx(B,{spacing:"2px",direction:"row",wrap:"wrap",children:i.map((j,k)=>e.jsxs("span",{children:[k>0&&b,e.jsx(W,{colorScheme:"teal",variant:"link",minW:1,onClick:()=>{ne(k)},children:j},`${j}-${k}`)]},j))}),e.jsx(Ge,{columns:2,spacing:3,maxHeight:500,width:"100%",overflowY:"auto",children:n.map((j,k)=>e.jsx(W,{size:"sm",leftIcon:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.2rem",height:"1.2rem"},children:e.jsx("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"})}),justifyContent:"start",onClick:()=>{ne(-1,j)},children:j},`${j}-${k}`))}),e.jsxs(_,{w:"100%",textAlign:"end",children:[e.jsx(W,{colorScheme:"teal",size:"sm",onClick:()=>{K()},children:"Save"}),e.jsx(W,{size:"sm",onClick:X,mr:2,ml:2,children:"Reset"}),e.jsx(W,{size:"sm",onClick:O,children:"Cancel"})]})]}):e.jsxs(Z,{children:[e.jsx(We,{overflowWrap:"anywhere",children:u}),e.jsx(R,{label:d?"Choose folder":"Enable two way sync to link local folder",children:e.jsx(P,{"aria-label":"Select folder",size:"sm",ml:2,isDisabled:!d,icon:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.4rem",height:"1.4srem"},children:e.jsx("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"})}),onClick:y})}),e.jsx(R,{label:d?"Input absolute path":"Enable two way sync to link local folder",children:e.jsx(P,{isDisabled:!d,"aria-label":"Enter folder address",size:"sm",ml:2,icon:e.jsx($t,{size:19}),onClick:ge,variant:"ghost"})})]})]}),e.jsxs(re,{isOpen:m,onClose:()=>c(!1),size:"xl",children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"Kind tips"}),e.jsx(ue,{}),e.jsx(he,{children:e.jsxs(_,{children:[navigator.userAgent.indexOf("Mac OS X")!==-1?e.jsxs(L,{fontWeight:500,children:["There is no permission to access the folder. You need to grant full disk access permission to the terminal that starts the ComfyUI program. For details, refer to the",e.jsx(W,{colorScheme:"teal",variant:"link",as:"a",ml:2,target:"_block",href:`https://stackoverflow.com/questions/58479686/permissionerror-errno-1-operation-not-permitted-after-macos - -catalina-update`,children:"Document"}),", or you can manually enter the absolute path of the folder in the input box below to save."]}):e.jsx(L,{fontWeight:500,children:"You do not have permission to access the folder. It is recommended that you manually enter the absolute path address of the required folder."}),ae]})})]})]})]})}function Ze({label:s,settingKey:t}){const[l,o]=r.useState(200),n=Y(),a=i=>{if(!i.length){o(0);return}o(parseInt(i))},u=async()=>{var i;l<0&&o(0),await((i=C)==null?void 0:i.upsert({[t]:Number(l)})),n({title:"Setting saved",status:"success",duration:3e3,isClosable:!0})},p=()=>{var i;(i=C)==null||i.getSetting(t).then(h=>{o(h)})};return r.useEffect(()=>{p()},[]),e.jsxs(B,{children:[e.jsx(L,{children:s}),e.jsx(Mt,{defaultValue:200,min:0,keepWithinRange:!0,placeholder:"Enter a number",maxWidth:"300px",value:l,onChange:i=>a(i),onBlur:()=>{u()},onKeyUp:i=>{i.key==="Enter"&&u()},children:e.jsx(Ft,{})})]})}function as(){const[s,t]=r.useState(!1),l=Y(),o=()=>{var n;(n=C)==null||n.getSetting("autoSave").then(a=>{t(!!a)})};return r.useEffect(()=>{o()},[]),e.jsxs(B,{children:[e.jsx(q,{isChecked:s,onChange:async n=>{var a;await((a=C)==null?void 0:a.upsert({autoSave:n.target.checked})),o(),l({title:"Setting saved",status:"success",duration:3e3,isClosable:!0})},children:"Enable auto save workflow"}),s&&e.jsx(Ze,{label:"Auto save duration (auto save workflow every X seconds)",settingKey:"autoSaveDuration"})]})}function os(){const s=r.useRef(null),t=Y(),l=()=>{var o;(o=C)==null||o.getSetting("cloudHost").then(n=>{var a;(a=s.current)==null||a.setAttribute("value",n??"")})};return r.useEffect(()=>{l()},[]),e.jsxs(B,{children:[e.jsx(L,{children:"For enterprise paid user only. Hosting site of the shared workflow."}),e.jsxs(Z,{gap:2,alignItems:"center",children:[e.jsx(pe,{ref:s,onBlur:()=>{var o,n,a;console.log("onBlur",(o=s.current)==null?void 0:o.value),(a=C)==null||a.upsert({cloudHost:(n=s.current)==null?void 0:n.value}),l(),t({title:"Setting saved. Please refresh to see the changes.",status:"success",duration:4e3})}}),e.jsx(W,{size:"sm",onClick:()=>{var o,n,a;(n=s.current)==null||n.setAttribute("value",(o=C)==null?void 0:o.defaultSettings.cloudHost),(a=s.current)==null||a.blur()},children:"Reset"})]})]})}function is({onClose:s}){return e.jsx(e.Fragment,{children:e.jsxs(re,{isOpen:!0,onClose:s,size:"xl",children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"Settings"}),e.jsx(ue,{}),e.jsx(he,{pb:14,children:e.jsx(z,{children:e.jsxs(Ke,{divider:e.jsx(rt,{borderColor:"gray.500"}),spacing:4,align:"stretch",w:"100%",children:[e.jsx(ns,{}),e.jsx(as,{}),e.jsx(es,{}),e.jsx(ss,{}),e.jsx(ts,{}),e.jsx(Ee,{settingKey:"overwriteCurWorkflowWhenDroppingFileToCanvas",text:"Overwrite current workflow when drag and drop workflow file to canvas"}),e.jsx(Ze,{label:`Maximum number of save change history to store. This does not include - versions that you created by "Create Version", which are always stored - and has no limit.`,settingKey:"maximumChangelogNumber"}),e.jsx(Ee,{settingKey:"hideCoverImage",text:"Hide thumbnail image in workflow list"}),e.jsx(os,{})]})})})]})]})})}const xe=16;function rs({}){const[s,t]=r.useState(!1),[l,o]=r.useState(!1),{colorMode:n,toggleColorMode:a}=ke();return e.jsxs(e.Fragment,{children:[e.jsxs(ee,{isLazy:!0,children:[e.jsx(se,{as:P,"aria-label":"Options",icon:e.jsx(Vt,{}),size:"sm",variant:"outline"}),e.jsxs(te,{children:[e.jsx(N,{onClick:()=>o(!0),icon:e.jsx(Yt,{size:16}),fontSize:16,children:"Settings"}),e.jsx(N,{onClick:()=>t(!0),icon:e.jsx(qt,{size:xe}),fontSize:16,children:"Manage Tags"}),e.jsxs(N,{onClick:a,icon:n==="light"?e.jsx(Ut,{size:xe}):e.jsx(Xt,{size:xe}),fontSize:16,children:[n==="light"?"Dark":"Light"," Mode"]})]})]}),s&&e.jsx(Qt,{onclose:()=>t(!1)}),l&&e.jsx(is,{onClose:()=>o(!1)})]})}function ls(s){const{multipleState:t,changeMultipleState:l,selectedKeys:o,isSelectedAll:n,batchOperationCallback:a}=s,u=async()=>{var h;const i=await((h=T)==null?void 0:h.batchQuery(o))??[];ct(i)},p=o.length===0;return e.jsx(z,{spacing:2,wrap:"wrap",mb:0,children:t?e.jsxs(e.Fragment,{children:[e.jsx(q,{isChecked:n,onChange:i=>{a("selectAll",i.target.checked)}}),e.jsx(R,{hasArrow:!0,label:"Download Zip",placement:"bottom",children:e.jsx(P,{isDisabled:p,"aria-label":"Batch export",size:"sm",icon:e.jsx(lt,{size:21}),onClick:u})}),e.jsx(R,{hasArrow:!0,label:"Batch deletion",children:e.jsx(Pe,{isDisabled:p,variant:"solid",promptMessage:`Are you sure you want to delete these ${o.length} checked workflows?`,tooltipText:"Delete selected",onDelete:async()=>{var i;await((i=T)==null?void 0:i.batchDeleteFlow(o)),a("batchDelete")}})}),o.length>0&&e.jsx(L,{fontWeight:600,children:`Selected ${o.length}`}),e.jsx(R,{hasArrow:!0,label:"Exit multi-select",children:e.jsx(P,{"aria-label":"Close multi-select operation",size:"sm",icon:e.jsx(Re,{}),onClick:()=>{l(!1)}})})]}):e.jsx(R,{hasArrow:!0,label:"Select multiple",placement:"bottom-start",children:e.jsx(P,{"aria-label":"Start multi-select operation",size:"sm",variant:"outline",icon:e.jsx(Gt,{size:21}),onClick:()=>{l(!0)}})})})}const Te=6;function cs({setSelectedTag:s,selectedTag:t}){const[l,o]=r.useState(!1),[n,a]=r.useState([]);return r.useEffect(()=>{var u;(u=je)==null||u.listAll().then(p=>{a(p)})},[]),e.jsxs(z,{spacing:2,wrap:"wrap",mb:0,children:[t!=null&&e.jsx(P,{"aria-label":"Close",size:"sm",icon:e.jsx(Re,{}),onClick:()=>{s(void 0)}}),n.slice(0,l?void 0:Te).map(u=>e.jsx(W,{variant:"solid",width:"auto",flexShrink:0,size:"sm",borderRadius:15,py:4,onClick:()=>{s(u.name)},isActive:t===u.name,children:u.name},u.name)),(n.length??0)>Te&&e.jsx(P,{"aria-label":"Show-all-tags",size:"sm",icon:l?e.jsx(_t,{}):e.jsx(Se,{}),onClick:()=>o(!l)})]})}function Ye({parentFolderID:s,onlyImportFile:t=!1}){const{onRefreshFilesList:l}=r.useContext(H),[o,n]=r.useState("file"),a=r.useRef(null),u=d=>{var g;n(d),d==="folder"?a.current.setAttribute("webkitdirectory",""):a.current.removeAttribute("webkitdirectory"),(g=a.current)==null||g.click()},p=async d=>{var g;if(d.type==="image/png"){const m=await Dt(d),c=m==null?void 0:m.workflow;if(c)return{json:c,name:d.name.replace(".png","")}}else if(d.type==="application/json"||(g=d.name)!=null&&g.endsWith(".json"))return await new Promise((m,c)=>{const f=new FileReader;f.onload=v=>{var S;try{const w=(S=v.target)==null?void 0:S.result;typeof w=="string"?m({json:w,name:d.name.replace(".json","")}):c(new Error("File content is not a string"))}catch(w){c(w)}},f.onerror=c,f.readAsText(d)});return null},i=async d=>{var m,c;const g=[d];for(;g.length>0;){const f=g.shift();if(f&&!f.isFile){const v=await((m=G)==null?void 0:m.create({name:f.name,parentFolderID:f.parentFolderID}));if(f.children&&f.children.length){const S=[];f.children.forEach(w=>{w.isFile&&w.file?S.push(w.file):(w.parentFolderID=v==null?void 0:v.id,g.push(w))}),S.length&&await((c=T)==null?void 0:c.batchCreateFlows(S,void 0,v==null?void 0:v.id))}}}l==null||l()},h=async d=>{var m;const g=d.target.files;if(g)if(o==="folder"){const c={name:g[0].webkitRelativePath.split("/")[0],isFile:!1,children:[]};for(const f of g)if(f.name!==".DS_Store"){const v=f.webkitRelativePath.split("/");let S=c.children??[];for(let w=1;wy.name===b);if(!F){if(F={name:b,isFile:w===v.length-1,children:w===v.length-1?void 0:[]},F.isFile){const y=await p(f);y&&(F.file=y)}S.push(F)}F&&!F.isFile&&(S=F.children)}}i(c)}else{const c=[];for(const f of g){const v=await p(f);v&&c.push(v)}c.length&&(await((m=T)==null?void 0:m.batchCreateFlows(c,void 0,s)),l&&l())}};return e.jsxs(e.Fragment,{children:[t?e.jsx(N,{onClick:d=>{d.stopPropagation(),u("file")},icon:e.jsx(De,{size:19}),children:"Import workflows"}):e.jsxs(ee,{closeOnSelect:!0,children:[e.jsx(se,{as:W,leftIcon:e.jsx(De,{size:18}),variant:"outline",iconSpacing:1,size:"sm",colorScheme:"teal",children:"Import"}),e.jsx(te,{children:dt.map((d,g)=>e.jsx(N,{onClick:()=>{u(d.type)},iconSpacing:2,icon:d.type==="folder"?e.jsx(_e,{size:18}):e.jsx(Kt,{size:18}),children:d.title},g))})]}),e.jsx("input",{style:{display:"none"},ref:a,type:"file",accept:".json,image/png",multiple:!0,onChange:h,onClick:d=>{d.stopPropagation()}})]})}function ds({folder:s,onclose:t}){const[l,o]=r.useState(s.name),[n,a]=r.useState(""),{onRefreshFilesList:u}=r.useContext(H),p=h=>{o(h.target.value),n&&a("")},i=async()=>{var g,m;const h=l.trim();if(o(h),h===s.name)return t();await((g=G)==null?void 0:g.generateUniqueName(h,s.parentFolderID??""))!==h?a("The name is duplicated, please modify it and submit again."):(await((m=G)==null?void 0:m.update(s.id,{name:h})),u&&u(),t())};return e.jsxs(re,{isOpen:!0,onClose:t,children:[e.jsx(le,{}),e.jsxs(ce,{children:[e.jsx(de,{children:"Edit folder name"}),e.jsx(ue,{}),e.jsx(he,{children:e.jsxs(ut,{isInvalid:!!n,children:[e.jsx(ht,{children:"Folder name"}),e.jsx(pe,{value:l,onChange:p,autoFocus:!0,onKeyUp:h=>{h.code==="Enter"&&!n&&l&&i()}}),n&&e.jsx(pt,{children:n})]})}),e.jsxs(Qe,{children:[e.jsx(W,{colorScheme:"teal",mr:3,onClick:i,isDisabled:!l||!!n,children:"Save"}),e.jsx(W,{onClick:t,children:"Cancel"})]})]})]})}function us({menuPosition:s,isopen:t,folder:l,onClose:o}){const[n,a]=r.useState(!1),{onRefreshFilesList:u}=r.useContext(H),{showDialog:p}=ve(),i=async m=>{var c;m.stopPropagation(),await((c=G)==null?void 0:c.create({name:"New Folder",parentFolderID:l.id})),u&&u()},h=async m=>{var c;m.stopPropagation(),await((c=T)==null?void 0:c.createFlow({json:JSON.stringify(gt),parentFolderID:l.id})),u&&u()},d=async m=>{m.stopPropagation();const c=await mt(l.id);p(`Do you want to delete the ${c} files inside the folder too?`,[{label:"Delete all files",colorScheme:"red",onClick:()=>{g(ft.DELETE)}}])},g=async m=>{var c;await((c=G)==null?void 0:c.deleteFolder(l.id,m)),o(),u&&u()};return e.jsxs(e.Fragment,{children:[e.jsx(_,{position:"absolute",top:s.y,left:s.x,children:e.jsx(ee,{isOpen:t,onClose:o,isLazy:!0,lazyBehavior:"keepMounted",children:e.jsxs(te,{children:[e.jsx(N,{icon:e.jsx(Zt,{size:19}),onClick:m=>{m.preventDefault(),m.stopPropagation(),a(!0)},children:"Rename"}),e.jsx(N,{icon:e.jsx(Ne,{size:19}),onClick:d,children:"Delete"}),e.jsx(N,{onClick:i,icon:e.jsx(Ue,{size:19}),children:"New folder"}),e.jsx(N,{onClick:h,icon:e.jsx(Be,{size:19}),children:"New file"}),e.jsx(Ye,{parentFolderID:l.id,onlyImportFile:!0})]})})}),n&&e.jsx(ds,{folder:l,onclose:()=>a(!1)})]})}const Oe=r.memo(function({folder:t}){const[l,o]=r.useState(!1),[n,a]=r.useState(t.isCollapse??!0),[u,p]=r.useState([]),[i,h]=r.useState({x:0,y:0}),[d,g]=r.useState(!1),{colorMode:m}=ke(),{draggingFile:c,setDraggingFile:f,refreshFolderStamp:v,onRefreshFilesList:S}=r.useContext(H),w=m==="light"?{backgroundColor:"#E2E8F0"}:{backgroundColor:"#4A5568"};r.useEffect(()=>{var y;n||(y=T)==null||y.listFolderContent(t.id,window.localStorage.getItem(ye)).then(O=>{p(O)})},[t.id,v,n]);const b=y=>{y.preventDefault(),h({x:y.clientX,y:y.clientY}),g(!0)},F=async y=>{var O,$;if(y.preventDefault(),y.stopPropagation(),!c)return o(!1);if(U(c)){if(c.id===t.id)return o(!1);await((O=G)==null?void 0:O.update(c.id,{parentFolderID:t.id}))}else U(c)||await(($=T)==null?void 0:$.updateFolder(c.id,{parentFolderID:t.id}));await(S==null?void 0:S()),o(!1)};return r.useEffect(()=>{var y;!!t.isCollapse!==n&&((y=G)==null||y.update(t.id,{isCollapse:n}))},[n]),r.useEffect(()=>{var X;const y=(X=T)==null?void 0:X.curWorkflow,O=(y==null?void 0:y.parentFolderID)+"/",$=t.id+"/";O.startsWith($)&&a(!1)},[]),e.jsxs(B,{children:[e.jsxs(z,{w:"100%",as:"button",py:1,onClick:()=>{a(!n)},onContextMenu:b,draggable:"true",onDragOver:y=>{y.preventDefault(),y.stopPropagation(),o(!0)},onDragLeave:y=>{y.preventDefault(),y.stopPropagation(),o(!1)},onDragStart:()=>f==null?void 0:f(t),onDrop:F,_hover:w,style:l||d?w:void 0,className:"droppable",children:[e.jsxs(z,{gap:1,children:[n?e.jsx(Et,{size:20}):e.jsx(Se,{size:20}),e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#EFC54D",style:{width:"1.2rem",height:"1.2rem"},children:e.jsx("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"})})]}),e.jsx(L,{children:t.name})]}),e.jsx(us,{isopen:d,menuPosition:i,onClose:()=>g(!1),folder:t}),!n&&e.jsx(B,{ml:4,gap:0,children:e.jsx(Xe,{items:u})})]})});function hs({workflow:s}){const t=r.useRef(null),l=Y(),{onDuplicateWorkflow:o}=r.useContext(Ce),[n,a]=r.useState(s.saveLock??!1),u=async()=>{var h;const i=!n;a(i),await((h=T)==null?void 0:h.updateMetaInfo(s.id,{saveLock:i})),l({title:`${i?"Locked":"Unlocked"} successfully`,status:"success",duration:2e3})},p=async i=>{const h=i.target.files;if(!h)return;const d=new FormData;Array.from(h).forEach((g,m)=>{d.append(`images[${m}]`,g,g.name)}),d.append("subfolder","workspace_manager"),await yt("/workspace/images/save",{method:"POST",body:d}),Array.from(h).forEach(async g=>{var c,f;const m=`workspace_manager/${g.name}`;(c=wt)==null||c.create({workflowID:s.id,localPath:m}),(f=T)==null||f.updateMetaInfo(s.id,{coverMediaPath:m})})};return e.jsxs(e.Fragment,{children:[e.jsxs(ee,{isLazy:!0,closeOnSelect:!1,placement:"right",gutter:0,children:[e.jsx(se,{border:0,as:P,"aria-label":"Options",icon:e.jsx(Bt,{size:20}),size:"sm",variant:"outline"}),e.jsxs(te,{zIndex:101,children:[e.jsx(N,{icon:e.jsx(Lt,{}),onClick:()=>o&&o(s.id),children:"Duplicate"}),e.jsx(N,{icon:e.jsx(xt,{size:20}),onClick:()=>jt(s.id),children:"Open in new tab"}),e.jsx(R,{hasArrow:!0,label:n?"Unlock workflow, allow modifying":"Lock workflow, prevent modifying",placement:"bottom",children:e.jsx(N,{icon:n?e.jsx($e,{}):e.jsx(Ht,{}),onClick:u,children:n?"Unlock":"Lock"})}),e.jsx(N,{icon:e.jsx(Jt,{}),onClick:()=>{var i;(i=t.current)==null||i.click()},children:"Upload Thumbnail Image"})]})]}),e.jsx("input",{style:{display:"none"},ref:t,type:"file",accept:".json,image/png",multiple:!0,onChange:p,onClick:i=>{i.stopPropagation()}})]})}function ps({workflow:s}){const{onDeleteFlow:t}=r.useContext(H);return e.jsxs(Z,{justifyContent:"flex-end",children:[e.jsx(Pe,{promptMessage:"Are you sure you want to delete this workflow?",onDelete:()=>{t&&t(s.id)}}),e.jsx(hs,{workflow:s})]})}const ze=r.memo(function({workflow:t}){var v,S,w,b;const{colorMode:l}=ke(),{setDraggingFile:o,isMultiSelecting:n,onMultiSelectFlow:a,multiSelectedFlowsID:u}=r.useContext(H),p=u&&u.length>0&&u.includes(t.id),{curFlowID:i,loadWorkflowID:h}=r.useContext(Ce),d=i===t.id,g=l==="light"?"gray.200":"#4A5568",[m,c]=r.useState(!1),f=e.jsx(_,{flexShrink:1,flexGrow:1,backgroundColor:d?"teal.200":void 0,color:d&&!n?"#333":void 0,draggable:!n,onDragStart:()=>o==null?void 0:o(t),borderRadius:6,px:1,py:"5px",onClick:()=>{!n&&h(t.id)},_hover:{bg:g},children:e.jsxs(z,{flexGrow:1,children:[!((S=(v=C)==null?void 0:v.settings)!=null&&S.hideCoverImage)&&(((w=t.coverMediaPath)==null?void 0:w.length)||((b=t.latestImage)==null?void 0:b.length))&&e.jsx(Tt,{mediaLocalPath:t.coverMediaPath??t.latestImage??"",size:60,hideBrokenImage:!0,isPreview:!0}),e.jsx(_,{textAlign:"left",gap:0,justifyContent:"space-between",flexGrow:1,children:e.jsxs(Z,{alignItems:"center",children:[e.jsx(L,{fontWeight:"500",noOfLines:1,wordBreak:"break-all",children:t.name??"untitled"}),t.saveLock&&e.jsx($e,{size:18,style:{display:"inline-block"}})]})})]})});return e.jsx(z,{w:"100%",justify:"space-between",borderBottom:"1px solid",borderColor:l=="dark"?"gray.700":"gray.200",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:n?e.jsx(q,{isChecked:p,spacing:4,onChange:F=>{a&&a(t.id,F.target.checked)},children:f}):e.jsxs(e.Fragment,{children:[f,e.jsx(_,{width:"fit-content",children:m?e.jsx(ps,{workflow:t}):e.jsx(L,{color:"GrayText",fontSize:"sm",children:vt(t.updateTime,!1,!1,"/")})})]})})});function Xe({items:s}){var m;const[t,l]=r.useState(!1),o=s.filter(U),n=s.filter(c=>!U(c)),a=(m=n[0])==null?void 0:m.parentFolderID,[u,p]=r.useState(!1),{onRefreshFilesList:i,draggingFile:h,refreshFolderStamp:d}=r.useContext(H),g=async c=>{var f,v;if(c.preventDefault(),c.stopPropagation(),!h)return p(!1);if(U(h)){if(h.id===a)return p(!1);await((f=G)==null?void 0:f.update(h.id,{parentFolderID:a}))}else await((v=T)==null?void 0:v.updateFolder(h.id,{parentFolderID:a}));await(i==null?void 0:i()),p(!1)};return r.useEffect(()=>{var c;(c=C)==null||c.getSetting("foldersOnTop").then(f=>{l(f??!1)})},[d]),e.jsxs(e.Fragment,{children:[t&&o.map(c=>e.jsx(Oe,{folder:c},c.id)),e.jsx(_,{border:u?"2px dashed #718096":"2px dashed transparent",onDragOver:c=>{c.preventDefault(),c.stopPropagation(),p(!0)},onDragLeave:c=>{c.preventDefault(),c.stopPropagation(),p(!1)},onDrop:g,className:"droppable",children:t?n.map(c=>e.jsx(ze,{workflow:c},c.id)):s.map(c=>U(c)?e.jsx(Oe,{folder:c},c.id):e.jsx(ze,{workflow:c},c.id))})]})}function ks({onClose:s,onClickNewFlow:t}){const[l,o]=r.useState([]),n=r.useRef([]),{loadWorkflowID:a,curFlowID:u}=r.useContext(Ce),[p,i]=r.useState(),[h,d]=r.useState(!1),[g,m]=r.useState([]),[c,f]=r.useState(0),[v,S]=r.useState(""),w=Ot(v,400),b=r.useRef(null),[F,y]=r.useState(null),O=r.useRef(window.localStorage.getItem(ye)??J.RECENTLY_MODIFIED),$=!!p||!!w.length,K=async()=>{var I,M;const x=await((I=T)==null?void 0:I.listFolderContent())??[];o(fe(x,O.current)),f(Date.now()),n.current=await((M=T)==null?void 0:M.listAll())??[]},X=()=>{const x=n.current.filter(I=>{var Ie;let M=!0,D=!0;return p&&(M=!!((Ie=I.tags)!=null&&Ie.includes(p))),w&&(D=!!I.name.toLocaleLowerCase().includes(w.toLocaleLowerCase())),M&&D});o(fe(x,O.current))},ne=x=>{o(fe(l,x)),O.current=x,window.localStorage.setItem(ye,x),!$&&f(Date.now())};r.useEffect(()=>{$?X():K()},[w,p]);const ae=r.useCallback(async x=>{var I,M,D;await((I=T)==null?void 0:I.deleteFlow(x)),((D=(M=T)==null?void 0:M.curWorkflow)==null?void 0:D.id)===x&&await(a==null?void 0:a(null)),await K()},[p,w]);r.useEffect(()=>{const x=async I=>{var M;if(b.current){const D=await((M=T)==null?void 0:M.get(b.current));D&&D.json&&bt(D.json,[I.canvasX,I.canvasY])}};return oe.canvasEl.addEventListener("drop",x),oe.canvasEl.addEventListener("click",s),()=>{oe.canvasEl.removeEventListener("drop",x),oe.canvasEl.removeEventListener("click",s)}},[]);const ge=r.useCallback((x,I)=>{m(M=>{const D=[...M];return I?D.push(x):D.splice(D.indexOf(x),1),D})},[]),j=(x,I)=>{var M;switch(x){case"batchDelete":u&&((M=T)==null||M.get(u).then(D=>{D||a==null||a(null)})),K(),d(!1),m([]);return;case"selectAll":m(I?n.current.map(D=>D.id):[]);return}},k=x=>{y(x),U(x)||(b.current=x.id)},E=x=>{S(x)},V=450;return e.jsx(H.Provider,{value:{onRefreshFilesList:K,draggingFile:F??void 0,setDraggingFile:k,isMultiSelecting:h,onMultiSelectFlow:ge,multiSelectedFlowsID:g,onDeleteFlow:ae,refreshFolderStamp:c,setRefreshFolderStamp:f},children:e.jsx(_,{style:{width:V},children:e.jsxs(kt,{width:V,height:"100vh",pl:2,pr:2,pt:4,gap:4,position:"absolute",top:0,left:0,shadow:"xl",zIndex:St,children:[e.jsxs(Z,{alignItems:"center",justifyContent:"space-between",children:[e.jsxs(z,{gap:4,children:[e.jsx(z,{gap:2,children:e.jsx(L,{fontSize:19,fontWeight:600,children:"🦄Workspace"})}),e.jsx(Ye,{}),e.jsx(R,{label:"Open workspace save directory",children:e.jsx(P,{"aria-label":"Open workspace save directory",size:"sm",icon:e.jsx(_e,{}),variant:"outline",colorScheme:"teal",onClick:()=>Ct()})}),e.jsx(R,{label:"New workflow",children:e.jsx(P,{"aria-label":"New workflow",size:"sm",icon:e.jsx(Be,{}),variant:"outline",colorScheme:"teal",onClick:t})})]}),e.jsx(z,{alignItems:"center",children:e.jsx(rs,{})})]}),e.jsxs(Z,{direction:"column",h:"calc(100% - 64px)",children:[e.jsx(cs,{selectedTag:p,setSelectedTag:i}),e.jsxs(z,{mb:2,mt:2,p:0,justifyContent:"space-between",children:[e.jsxs(z,{children:[e.jsx(ls,{multipleState:h,changeMultipleState:x=>{d(x),!x&&m([])},selectedKeys:g,isSelectedAll:g.length===n.current.length,batchOperationCallback:j}),!h&&e.jsx(R,{hasArrow:!0,label:"New folder",placement:"bottom-start",children:e.jsx(P,{size:"sm",variant:"outline",icon:e.jsx(Ue,{size:21}),onClick:async()=>{var x;await((x=G)==null?void 0:x.create({name:"New Folder"})),K()},"aria-label":"new folder button"})})]}),e.jsxs(ee,{closeOnSelect:!0,children:[e.jsx(se,{as:W,variant:"ghost",size:"xs",pr:0,rightIcon:e.jsx(Se,{size:"16"}),children:e.jsxs(z,{children:[e.jsx(L,{children:"Sort by:"}),e.jsx(L,{display:"inline-block",children:O.current})]})}),e.jsx(te,{children:e.jsx(Ve,{value:O.current,type:"radio",onChange:x=>ne(x),children:[J.RECENTLY_MODIFIED,J.OLDEST_MODIFIED,J.AZ,J.ZA].map((x,I)=>e.jsx(be,{value:x,children:x},I))})})]})]}),e.jsx(zt,{searchValue:v,onUpdateSearchValue:E}),e.jsx(Z,{overflowY:"auto",overflowX:"hidden",direction:"column",style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:e.jsx(Xe,{items:l})})]})]})})})}export{ks as default}; diff --git a/dist/workspace_web/ShareDialog-t7mRPVSb.js b/dist/workspace_web/ShareDialog-t7mRPVSb.js deleted file mode 100644 index 371600c..0000000 --- a/dist/workspace_web/ShareDialog-t7mRPVSb.js +++ /dev/null @@ -1 +0,0 @@ -import{f as oe,n as pe,o as fe,j as e,g as te,e as ae,r as l,m as me,w as X,b as ge,h as L,a0 as Z,M as we,N as xe,O as je,Q as ve,S as ye}from"./input.js";import{B as be,A as ke,a4 as Se,a3 as P,af as z,am as Ce,g as W,H as G,ac as Ie,ay as ee,X as Re,f as De,k as H,F as se,aD as Ee,j as Ne,x as F,$ as Pe,aE as Te,aF as We,aG as _e,aH as Fe,h as Me,T as Oe,aI as ze,Y as Le}from"./App-1AImvRpr.js";import{a as Ae}from"./civitUtils-uJNBxoFV.js";import{I as He}from"./chunk-7D6N5TE5-fihyubSX.js";import{S as Ge,L as $e}from"./chunk-VTV6N5LE-7BSZDdqw.js";import{I as Be}from"./IconCopy-DxyTNBlz.js";var ne=oe(function(n,c){const i=pe("Badge",n),{className:s,...r}=fe(n);return e.jsx(te.span,{ref:c,className:ae("chakra-badge",n.className),...r,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...i}})});ne.displayName="Badge";function Ue(t){return t&&X(t)&&X(t.target)}function Ve(t={}){const{onChange:n,value:c,defaultValue:i,name:s,isDisabled:r,isFocusable:o,isNative:k,...h}=t,[S,v]=l.useState(i||""),w=typeof c<"u",p=w?c:S,x=l.useRef(null),a=l.useCallback(()=>{const m=x.current;if(!m)return;let j="input:not(:disabled):checked";const T=m.querySelector(j);if(T){T.focus();return}j="input:not(:disabled)";const E=m.querySelector(j);E==null||E.focus()},[]),y=`radio-${l.useId()}`,C=s||y,I=l.useCallback(m=>{const j=Ue(m)?m.target.value:m;w||v(j),n==null||n(String(j))},[n,w]),f=l.useCallback((m={},j=null)=>({...m,ref:me(j,x),role:"radiogroup"}),[]),A=l.useCallback((m={},j=null)=>({...m,ref:j,name:C,[k?"checked":"isChecked"]:p!=null?m.value===p:void 0,onChange(E){I(E)},"data-radiogroup":!0}),[k,C,I,p]);return{getRootProps:f,getRadioProps:A,name:C,ref:x,focus:a,setValue:v,value:p,onChange:I,isDisabled:r,isFocusable:o,htmlProps:h}}var[Ke,ns]=ge({name:"RadioGroupContext",strict:!1}),re=oe((t,n)=>{const{colorScheme:c,size:i,variant:s,children:r,className:o,isDisabled:k,isFocusable:h,...S}=t,{value:v,onChange:w,getRootProps:p,name:x,htmlProps:a}=Ve(S),R=l.useMemo(()=>({name:x,size:i,onChange:w,colorScheme:c,value:v,variant:s,isDisabled:k,isFocusable:h}),[x,i,w,c,v,s,k,h]);return e.jsx(Ke,{value:R,children:e.jsx(te.div,{...p(a,n),className:ae("chakra-radio-group",o),children:r})})});re.displayName="RadioGroup";function qe({options:t,value:n,onChange:c}){const[i,s]=l.useState(!1),r=l.useRef(null),o=t.find(h=>h.value===n);l.useEffect(()=>{const h=S=>{r.current&&!r.current.contains(S.target)&&s(!1)};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[r]);const k=()=>s(!i);return e.jsxs(be,{position:"relative",children:[e.jsx(L,{onClick:k,rightIcon:e.jsx(ke,{}),leftIcon:o==null?void 0:o.icon,children:o==null?void 0:o.label}),i&&e.jsx(Se,{gap:4,ref:r,mt:"2",shadow:"md",borderWidth:"1px",p:"2",position:"absolute",zIndex:100,children:t.map(h=>e.jsx(L,{onClick:()=>{s(!1),c(h.value)},leftIcon:h.icon,justifyContent:"flex-start",variant:"ghost",width:"full",children:h.label},h.label))})]})}async function Je(t,n,c){const i=await Ce.models.where("fileName").equals(t).toArray()??[];console.log("fetch modeldata",i);const s=i.at(0);return{name:t,nodeType:n,hash:(s==null?void 0:s.fileHash)??null,folder:(s==null?void 0:s.fileFolder)??null,url:s!=null&&s.civitModelVersionID?Ae(s.civitModelVersionID):(s==null?void 0:s.downloadUrl)??null,inputName:c,length:i.length}}async function Ye(t){var p,x;let n=[],c={};const i=[".ckpt",".pt",".bin",".pth",".safetensors"],s=[".jpeg",".jpg",".png",".gif",".webp"],r=(x=(p=P.graph.extra)==null?void 0:p[z])==null?void 0:x.deps,o=await P.graphToPrompt();Object.values(o.output).forEach(a=>{a.inputs&&Object.keys(a.inputs).forEach(R=>{var C,I;const y=(C=a.inputs)==null?void 0:C[R];typeof y=="string"&&(i.some(f=>y.endsWith(f))&&n.push(Je(y,a.class_type,R)),s.some(f=>y.endsWith(f))&&(c[y]=((I=r==null?void 0:r.images)==null?void 0:I[y])??{filename:y,nodeType:a.class_type}))})});const h=await fetch("workspace/fetch_node_repos",{method:"POST",body:JSON.stringify({nodes:t.map(a=>a.type)})}).then(a=>a.ok?a.json():[]).catch(a=>(console.error("Error fetching node repos",a),[])),S=await Promise.all(n),v={};S.forEach(a=>{v[a.name]=a});const w={};return Object.values(h).forEach(a=>{w[a.gitRepo]=a}),{models:v,images:c,nodeRepos:Object.values(w)}}function Qe({deps:t,setDeps:n,uploadingImage:c}){const i=l.useCallback(async()=>{const r=P.graph.serialize();Ye(r.nodes??[]).then(o=>{n(o)})},[]);l.useEffect(()=>{i()},[]);const s=Object.values((t==null?void 0:t.images)??{});return t?e.jsx(W,{gap:5,children:s.length>0&&e.jsxs(W,{children:[e.jsxs(G,{children:[e.jsxs(Ie,{size:"sm",children:["Images (",s.length,")"]}),e.jsx("p",{style:{color:"GrayText"},children:"Will be uploaded as url"})]}),c&&e.jsxs("span",{children:[e.jsx(Z,{size:"md",color:"teal.400"})," Uploading"]}),s.map(r=>e.jsxs(W,{children:[e.jsx("p",{children:r.filename}),e.jsx(He,{width:250,src:`/workspace/view_media?filename=${r.filename}&isPreview=true&isInput=true`})]},r.filename))]})}):e.jsx(Z,{size:"md",color:"teal.400"})}function rs({onClose:t}){var $,B,U,V,K;const[n,c,i]=ee("v"+Xe()),{saveCurWorkflow:s,setRoute:r}=l.useContext(Re),[o,k]=l.useState(),[h,S]=l.useState(!1),[v,w]=l.useState(!1),p=(B=($=H)==null?void 0:$.settings)==null?void 0:B.cloudHost,[x,a,R]=ee("PRIVATE"),[y,C]=l.useState("new_version"),I=l.useRef(""),f=(U=F)==null?void 0:U.curWorkflow,A=De(),[m,j]=l.useState(!0),T=async d=>{var b;const u=d.data;if(u.type!=="share_workflow_success")return;const g=u.localWorkflowID,N=u.version.id,D=u.version.workflowID;D&&g&&await((b=F)==null?void 0:b.updateMetaInfo(g,{cloudID:D,privacy:R.current})),E(),window.open(I.current+"/workflow/"+D+"/"+N,"_blank"),w(!1)};l.useEffect(()=>(E(),window.addEventListener("message",T),()=>{window.removeEventListener("message",T)}),[]);const E=async()=>{var u;const d=await((u=H)==null?void 0:u.getSetting("cloudHost"));d&&(I.current=d),f!=null&&f.cloudID&&f.cloudOrigin&&Fe(f).then(g=>{a(g)})},ie=d=>{navigator.clipboard.writeText(d).then(()=>{A({title:"Copied to clipboard",status:"success",duration:2e3,isClosable:!0})}).catch(u=>{console.error("Failed to copy text: ",u)})},le=async d=>{var J;w(!0);const u=Te(32),g=await((J=H)==null?void 0:J.getSetting("cloudHost"));let N;N=We();const D={id:_e(),workflowID:f.id,name:i.current,createTime:Date.now(),json:d??JSON.stringify(P.graph.serialize())},b=window.location.protocol,O=window.location.host,_=`${b}//${O}`,de=g+`/share_workflow_confirm/${u}?redirectUrl=${_}`,ue=window.open(de,"Share Workflow","width=800,height=800"),q=Y=>{var Q;if(Y.origin===g&&Y.data==="child_ready"){const he=(Q=F)==null?void 0:Q.curWorkflow;ue.postMessage({workflow:he,version:D,nodeDefs:N,privacy:R.current},g),window.removeEventListener("message",q)}};window.addEventListener("message",q)},ce=async()=>{var N,D;S(!0);const d=Object.values((o==null?void 0:o.images)??{}).filter(b=>!b.url).map(b=>b.filename),u=(o==null?void 0:o.images)??{};if(d.length){const O=await(await Pe("/workspace/upload_image",{method:"POST",body:JSON.stringify({images:d})})).json();Object.keys(O).forEach(_=>{u!=null&&u[_]&&(u[_].url=O[_])})}S(!1);const g=P.graph.serialize();(N=g.extra||(g.extra={}))[D=z]||(N[D]={}),g.extra[z].deps={models:(o==null?void 0:o.models)??{},images:u??{},nodeRepos:(o==null?void 0:o.nodeRepos)??[]},await P.graphToPrompt(P.graph).then(b=>{g.extra[z].apiPrompt=b.output}),await s(),le(JSON.stringify(g))},M=(K=(V=F)==null?void 0:V.curWorkflow)==null?void 0:K.cloudID;return e.jsxs(we,{isOpen:!0,onClose:t,size:"lg",children:[e.jsx(xe,{}),e.jsxs(je,{width:["98%","90%","50%"],maxWidth:"600px",children:[e.jsxs(ve,{children:[e.jsxs(se,{justifyContent:"space-between",children:[e.jsxs("p",{children:['Share "',f==null?void 0:f.name,'"']}),e.jsx(L,{colorScheme:"teal",onClick:ce,size:"sm",isDisabled:v,children:v?"Sharing":"Share"})]}),p&&e.jsxs(Me,{fontSize:16,color:"GrayText",fontWeight:400,children:["Share to ",new URL(p).host]})]}),e.jsx(ye,{pb:10,children:e.jsxs(W,{gap:5,children:[M==null?e.jsx(qe,{options:Ee,value:x,onChange:d=>{a(d)}}):e.jsx(Oe,{variant:"outline",borderRadius:"full",width:"fit-content",children:e.jsx(ze,{privacy:x,showEmoji:!0})}),M&&e.jsxs(G,{spacing:2,color:"teal.400",children:[e.jsxs($e,{wordBreak:"break-all",href:p+"/workflow/"+M,isExternal:!0,children:[p+"/workflow/"+M," ",e.jsx(Le,{size:20,style:{display:"inline-block",verticalAlign:"middle"}})]}),e.jsx(L,{size:"sm",leftIcon:e.jsx(Be,{size:18}),onClick:()=>{var d,u;ie(p+"/workflow/"+((u=(d=F)==null?void 0:d.curWorkflow)==null?void 0:u.cloudID))},children:"Copy link"})]}),e.jsx(re,{gap:4,onChange:d=>{C(d)},value:y,children:e.jsx(W,{children:e.jsxs(G,{mb:5,alignItems:"center",children:[e.jsx(Ne,{value:n,width:"60%",onFocus:()=>{C("new_version")},onChange:d=>{c(d.target.value)}}),e.jsx(se,{color:"green",children:e.jsx(ne,{colorScheme:"purple",children:"Version Name"})})]})})}),e.jsxs(W,{borderRadius:6,borderWidth:"1px",p:2,children:[e.jsx(Ge,{isChecked:m,onChange:()=>j(!m),fontWeight:"600",children:"Share input images"}),e.jsxs("span",{style:{color:"GrayText"},children:["If enabled your input images will be uploaded and shared to"," ",p]}),e.jsx(Qe,{deps:o??null,setDeps:k,uploadingImage:h})]})]})})]})]})}function Xe(){const t=new Date,n=t.getFullYear(),c=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${n}-${c}-${i}`}export{rs as default}; diff --git a/dist/workspace_web/SpotlightSearch-crj3ER75.js b/dist/workspace_web/SpotlightSearch-crj3ER75.js deleted file mode 100644 index 18a83a9..0000000 --- a/dist/workspace_web/SpotlightSearch-crj3ER75.js +++ /dev/null @@ -1 +0,0 @@ -import{b as X,f as L,k as Z,o as $,e as w,r as g,j as n,g as A,Z as q,M as J,O as Q,a0 as ee,h as te}from"./input.js";import{aC as ne,aj as se,X as re,ay as T,ag as G,H as ae,j as oe,h as O,a1 as ie,x as ce,a2 as le,E as ue,k as D}from"./App-1AImvRpr.js";import{u as pe}from"./useDebounceFn-ld478fd0.js";import{I as de}from"./IconSearch-qxAzDzhT.js";import{V as he}from"./chunk-NTCQBYKE-HH_ifqNx.js";var[me,ge]=X({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),M=L(function(a,u){const r=Z("Input",a),{children:c,className:l,...I}=$(a),x=w("chakra-input__group",l),t={},E=ne(c),o=r.field;E.forEach(s=>{var p,y;r&&(o&&s.type.id==="InputLeftElement"&&(t.paddingStart=(p=o.height)!=null?p:o.h),o&&s.type.id==="InputRightElement"&&(t.paddingEnd=(y=o.height)!=null?y:o.h),s.type.id==="InputRightAddon"&&(t.borderEndRadius=0),s.type.id==="InputLeftAddon"&&(t.borderStartRadius=0))});const f=E.map(s=>{var p,y;const R=se({size:((p=s.props)==null?void 0:p.size)||a.size,variant:((y=s.props)==null?void 0:y.variant)||a.variant});return s.type.id!=="Input"?g.cloneElement(s,R):g.cloneElement(s,Object.assign(R,t,s.props))});return n.jsx(A.div,{className:x,ref:u,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...I,children:n.jsx(me,{value:r,children:f})})});M.displayName="InputGroup";var Se=A("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),C=L(function(a,u){var r,c;const{placement:l="left",...I}=a,x=ge(),t=x.field,o={[l==="left"?"insetStart":"insetEnd"]:"0",width:(r=t==null?void 0:t.height)!=null?r:t==null?void 0:t.h,height:(c=t==null?void 0:t.height)!=null?c:t==null?void 0:t.h,fontSize:t==null?void 0:t.fontSize,...x.element};return n.jsx(Se,{ref:u,__css:o,...I})});C.id="InputElement";C.displayName="InputElement";var P=L(function(a,u){const{className:r,...c}=a,l=w("chakra-input__left-element",r);return n.jsx(C,{ref:u,placement:"left",className:l,...c})});P.id="InputLeftElement";P.displayName="InputLeftElement";var K=L(function(a,u){const{className:r,...c}=a,l=w("chakra-input__right-element",r);return n.jsx(C,{ref:u,placement:"right",className:l,...c})});K.id="InputRightElement";K.displayName="InputRightElement";function Ie(){const{colorMode:S}=q(),{loadWorkflowID:a,setRoute:u}=g.useContext(re),[r,c]=g.useState([]),[l,I,x]=T(""),t=g.useRef([]),[E,o,f]=T([]),[s,p]=g.useState(!1),[y,R,b]=T(0),v=g.useRef({lastPressedKey:"",spotlightSearchShortcutFirstKey:"",spotlightSearchShortcutLastKey:""}),z=()=>{u("root")},_=e=>{a(e.id),z()},H=()=>{const e=r.filter(i=>!!i.name.toLocaleLowerCase().includes(x.current.toLocaleLowerCase()));o(e),R(0),p(!1)},[U,W]=pe(H,300),V=e=>{I(e.target.value),e.target.value?(U(),!s&&p(!0)):(p(!1),W(),o(t.current))},B=()=>s?null:l&&E.length===0?n.jsx(O,{ml:2,children:"No matching results"}):n.jsx(n.Fragment,{children:E.map((e,i)=>n.jsxs(te,{colorScheme:"teal",variant:"ghost",size:"sm",justifyContent:"start",px:2,color:S==="light"?"#1A202C":"rgba(255, 255, 255, 0.92)",onClick:()=>{_(e)},minH:"26px",isActive:i===y,children:[e.name,e.updateTime&&n.jsxs(O,{color:S==="light"?"GrayText":"rgb(255, 255, 255, 0.6)",ml:2,fontSize:"sm",children:["Updated: ",ie(e.updateTime)]})]},e.id))}),Y=async()=>{var k;const e=h=>h.map(m=>({type:"workflow",updateTime:(m==null?void 0:m.updateTime)??Date.now(),id:m.id,name:m.name.replace(/\.json$/,"")}))??[],i=await((k=ce)==null?void 0:k.listAll(le.RECENTLY_OPENED))??[];c(e(i));const d=e(i.slice(0,20));t.current=d,o(d)},N=e=>{R(i=>{const d=i+e;return d<0?f.current.length-1:d>f.current.length-1?0:d})};return g.useEffect(()=>{var k;Y(),(k=D)==null||k.getSetting("shortcuts").then(h=>{var F;const j=(h.openSpotlightSearch??((F=D)==null?void 0:F.defaultSettings.shortcuts.openSpotlightSearch)).split("+");v.current.spotlightSearchShortcutFirstKey=j[0]==="Command"?"Meta":j[0],v.current.spotlightSearchShortcutLastKey=j[j.length-1]});const e=h=>{h.key===v.current.spotlightSearchShortcutFirstKey&&v.current.lastPressedKey===v.current.spotlightSearchShortcutLastKey&&b.current>0&&f.current[b.current]&&_(f.current[b.current])},i=h=>{const m=h.key.toUpperCase();switch(v.current.lastPressedKey=m,m){case"ARROWDOWN":N(1);break;case"ARROWUP":N(-1);break;case"ENTER":_(f.current[b.current]);break}},d=h=>{switch(h.detail.shortcutType){case ue.openSpotlightSearch:N(1);break}};return document.addEventListener("keyup",e),document.addEventListener("keydown",i),window.addEventListener(G,d),()=>{document.removeEventListener("keyup",e),document.removeEventListener("keydown",i),window.removeEventListener(G,d)}},[]),n.jsx(J,{isOpen:!0,onClose:z,size:"xl",children:n.jsxs(Q,{bg:S==="light"?"rgba(255, 255, 255, 0.8)":"rgb(45, 55, 72, 0.8)",backdropFilter:"auto",backdropBlur:"8px",children:[n.jsxs(ae,{spacing:1,px:4,py:2,borderBottom:"1px",borderColor:"gray.400",children:[n.jsx(de,{size:20}),n.jsxs(M,{children:[n.jsx(oe,{value:l,onChange:V,autoFocus:!0,variant:"unstyled",fontSize:18}),s&&n.jsx(K,{h:"27px",children:n.jsx(ee,{size:"sm"})})]})]}),n.jsx(he,{spacing:1,align:"stretch",px:2,py:2,maxHeight:"calc(100vh - 200px)",overflowY:"auto",children:B()})]})})}export{Ie as default}; diff --git a/dist/workspace_web/assets/App-JXePnJiV.css b/dist/workspace_web/assets/App-JXePnJiV.css deleted file mode 100644 index 70b9d44..0000000 --- a/dist/workspace_web/assets/App-JXePnJiV.css +++ /dev/null @@ -1 +0,0 @@ -.dragPanelIcon{display:none!important}.workspaceManagerPanel:hover .dragPanelIcon{display:block!important} diff --git a/dist/workspace_web/assets/ModelManagerTopbar--iv3sdjQ.css b/dist/workspace_web/assets/ModelManagerTopbar--iv3sdjQ.css deleted file mode 100644 index b4ab834..0000000 --- a/dist/workspace_web/assets/ModelManagerTopbar--iv3sdjQ.css +++ /dev/null @@ -1 +0,0 @@ -.drag-model-manager-top-bar-icon{visibility:hidden!important}.model-manager-top-bar:hover .drag-model-manager-top-bar-icon{visibility:visible!important} diff --git a/dist/workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js b/dist/workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js deleted file mode 100644 index 87490be..0000000 --- a/dist/workspace_web/chunk-3RSXBRAN-gZ_JDRlM.js +++ /dev/null @@ -1 +0,0 @@ -import{f as x,j as l,g as i,e as b,k as C,o as E,l as I,r as f,a3 as P}from"./input.js";import{aa as z}from"./App-1AImvRpr.js";var v=x(function(o,s){const{children:t,placeholder:n,className:r,...a}=o;return l.jsxs(i.select,{...a,ref:s,className:b("chakra-select",r),children:[n&&l.jsx("option",{value:"",children:n}),t]})});v.displayName="SelectField";function F(e,o){const s={},t={};for(const[n,r]of Object.entries(e))o.includes(n)?s[n]=r:t[n]=r;return[s,t]}var H=x((e,o)=>{var s;const t=C("Select",e),{rootProps:n,placeholder:r,icon:a,color:c,height:_,h:d,minH:h,minHeight:y,iconColor:p,iconSize:u,...j}=E(e),[g,N]=F(j,P),m=z(N),k={width:"100%",height:"fit-content",position:"relative",color:c},w={paddingEnd:"2rem",...t.field,_focus:{zIndex:"unset",...(s=t.field)==null?void 0:s._focus}};return l.jsxs(i.div,{className:"chakra-select__wrapper",__css:k,...g,...n,children:[l.jsx(v,{ref:o,height:d??_,minH:h??y,placeholder:r,...m,__css:w,children:e.children}),l.jsx(S,{"data-disabled":I(m.disabled),...(p||c)&&{color:p||c},__css:t.icon,...u&&{fontSize:u},children:a})]})});H.displayName="Select";var M=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),R=i("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),S=e=>{const{children:o=l.jsx(M,{}),...s}=e,t=f.cloneElement(o,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(R,{...s,className:"chakra-select__icon-wrapper",children:f.isValidElement(o)?t:null})};S.displayName="SelectIcon";export{H as S}; diff --git a/dist/workspace_web/chunk-7D6N5TE5-fihyubSX.js b/dist/workspace_web/chunk-7D6N5TE5-fihyubSX.js deleted file mode 100644 index a1a0ab0..0000000 --- a/dist/workspace_web/chunk-7D6N5TE5-fihyubSX.js +++ /dev/null @@ -1 +0,0 @@ -import{f as ce,j as W,r as i,y as A,g as oe,d as T,x as ye,l as r,q as m,m as re}from"./input.js";import{ae as pe}from"./App-1AImvRpr.js";var z=ce(function(n,t){const{htmlWidth:o,htmlHeight:d,alt:l,...v}=n;return W.jsx("img",{width:o,height:d,ref:t,alt:l,...v})});z.displayName="NativeImage";function Ee(e){const{loading:n,src:t,srcSet:o,onLoad:d,onError:l,crossOrigin:v,sizes:w,ignoreFallback:L}=e,[h,k]=i.useState("pending");i.useEffect(()=>{k(t?"loading":"pending")},[t]);const f=i.useRef(),I=i.useCallback(()=>{if(!t)return;y();const s=new Image;s.src=t,v&&(s.crossOrigin=v),o&&(s.srcset=o),w&&(s.sizes=w),n&&(s.loading=n),s.onload=p=>{y(),k("loaded"),d==null||d(p)},s.onerror=p=>{y(),k("failed"),l==null||l(p)},f.current=s},[t,v,o,w,d,l,n]),y=()=>{f.current&&(f.current.onload=null,f.current.onerror=null,f.current=null)};return A(()=>{if(!L)return h==="loading"&&I(),()=>{y()}},[h,I,L]),L?"loaded":h}var we=(e,n)=>e!=="loaded"&&n==="beforeLoadOrError"||e==="failed"&&n==="onError";function Le(e,n=[]){const t=Object.assign({},e);for(const o of n)o in t&&delete t[o];return t}var Ce=ce(function(n,t){const{fallbackSrc:o,fallback:d,src:l,srcSet:v,align:w,fit:L,loading:h,ignoreFallback:k,crossOrigin:f,fallbackStrategy:I="beforeLoadOrError",referrerPolicy:y,...s}=n,p=o!==void 0||d!==void 0,P=h!=null||k||!p,B=Ee({...n,crossOrigin:f,ignoreFallback:P}),K=we(B,I),D={ref:t,objectFit:L,objectPosition:w,...P?s:Le(s,["onError","onLoad"])};return K?d||W.jsx(oe.img,{as:z,className:"chakra-image__placeholder",src:o,...D}):W.jsx(oe.img,{as:z,src:l,srcSet:v,crossOrigin:f,loading:h,referrerPolicy:y,className:"chakra-image",...D})});Ce.displayName="Image";var Ie={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},Fe=()=>typeof document<"u",se=!1,M=null,C=!1,$=!1,G=new Set;function J(e,n){G.forEach(t=>t(e,n))}var Se=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function Pe(e){return!(e.metaKey||!Se&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ie(e){C=!0,Pe(e)&&(M="keyboard",J("keyboard",e))}function S(e){if(M="pointer",e.type==="mousedown"||e.type==="pointerdown"){C=!0;const n=e.composedPath?e.composedPath()[0]:e.target;let t=!1;try{t=n.matches(":focus-visible")}catch{}if(t)return;J("pointer",e)}}function De(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function Re(e){De(e)&&(C=!0,M="virtual")}function xe(e){e.target===window||e.target===document||(!C&&!$&&(M="virtual",J("virtual",e)),C=!1,$=!1)}function Me(){C=!1,$=!0}function le(){return M!=="pointer"}function Be(){if(!Fe()||se)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...t){C=!0,e.apply(this,t)},document.addEventListener("keydown",ie,!0),document.addEventListener("keyup",ie,!0),document.addEventListener("click",Re,!0),window.addEventListener("focus",xe,!0),window.addEventListener("blur",Me,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",S,!0),document.addEventListener("pointermove",S,!0),document.addEventListener("pointerup",S,!0)):(document.addEventListener("mousedown",S,!0),document.addEventListener("mousemove",S,!0),document.addEventListener("mouseup",S,!0)),se=!0}function Ke(e){Be(),e(le());const n=()=>e(le());return G.add(n),()=>{G.delete(n)}}function Oe(e,n=[]){const t=Object.assign({},e);for(const o of n)o in t&&delete t[o];return t}function Ue(e={}){const n=pe(e),{isDisabled:t,isReadOnly:o,isRequired:d,isInvalid:l,id:v,onBlur:w,onFocus:L,"aria-describedby":h}=n,{defaultChecked:k,isChecked:f,isFocusable:I,onChange:y,isIndeterminate:s,name:p,value:P,tabIndex:B=void 0,"aria-label":K,"aria-labelledby":D,"aria-invalid":U,...de}=e,V=Oe(de,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),q=T(y),Q=T(w),X=T(L),[O,ue]=i.useState(!1),[E,j]=i.useState(!1),[R,Y]=i.useState(!1),[x,F]=i.useState(!1);i.useEffect(()=>Ke(ue),[]);const b=i.useRef(null),[Z,fe]=i.useState(!0),[me,N]=i.useState(!!k),_=f!==void 0,c=_?f:me,ee=i.useCallback(a=>{if(o||t){a.preventDefault();return}_||N(c?a.target.checked:s?!0:a.target.checked),q==null||q(a)},[o,t,c,_,s,q]);A(()=>{b.current&&(b.current.indeterminate=!!s)},[s]),ye(()=>{t&&j(!1)},[t,j]),A(()=>{const a=b.current;if(!(a!=null&&a.form))return;const u=()=>{N(!!k)};return a.form.addEventListener("reset",u),()=>{var g;return(g=a.form)==null?void 0:g.removeEventListener("reset",u)}},[]);const te=t&&!I,ae=i.useCallback(a=>{a.key===" "&&F(!0)},[F]),ne=i.useCallback(a=>{a.key===" "&&F(!1)},[F]);A(()=>{if(!b.current)return;b.current.checked!==c&&N(b.current.checked)},[b.current]);const ve=i.useCallback((a={},u=null)=>{const g=H=>{E&&H.preventDefault(),F(!0)};return{...a,ref:u,"data-active":r(x),"data-hover":r(R),"data-checked":r(c),"data-focus":r(E),"data-focus-visible":r(E&&O),"data-indeterminate":r(s),"data-disabled":r(t),"data-invalid":r(l),"data-readonly":r(o),"aria-hidden":!0,onMouseDown:m(a.onMouseDown,g),onMouseUp:m(a.onMouseUp,()=>F(!1)),onMouseEnter:m(a.onMouseEnter,()=>Y(!0)),onMouseLeave:m(a.onMouseLeave,()=>Y(!1))}},[x,c,t,E,O,R,s,l,o]),be=i.useCallback((a={},u=null)=>({...a,ref:u,"data-active":r(x),"data-hover":r(R),"data-checked":r(c),"data-focus":r(E),"data-focus-visible":r(E&&O),"data-indeterminate":r(s),"data-disabled":r(t),"data-invalid":r(l),"data-readonly":r(o)}),[x,c,t,E,O,R,s,l,o]),ge=i.useCallback((a={},u=null)=>({...V,...a,ref:re(u,g=>{g&&fe(g.tagName==="LABEL")}),onClick:m(a.onClick,()=>{var g;Z||((g=b.current)==null||g.click(),requestAnimationFrame(()=>{var H;(H=b.current)==null||H.focus({preventScroll:!0})}))}),"data-disabled":r(t),"data-checked":r(c),"data-invalid":r(l)}),[V,t,c,l,Z]),he=i.useCallback((a={},u=null)=>({...a,ref:re(b,u),type:"checkbox",name:p,value:P,id:v,tabIndex:B,onChange:m(a.onChange,ee),onBlur:m(a.onBlur,Q,()=>j(!1)),onFocus:m(a.onFocus,X,()=>j(!0)),onKeyDown:m(a.onKeyDown,ae),onKeyUp:m(a.onKeyUp,ne),required:d,checked:c,disabled:te,readOnly:o,"aria-label":K,"aria-labelledby":D,"aria-invalid":U?!!U:l,"aria-describedby":h,"aria-disabled":t,style:Ie}),[p,P,v,ee,Q,X,ae,ne,d,c,te,o,K,D,U,l,h,t,B]),ke=i.useCallback((a={},u=null)=>({...a,ref:u,onMouseDown:m(a.onMouseDown,je),"data-disabled":r(t),"data-checked":r(c),"data-invalid":r(l)}),[c,t,l]);return{state:{isInvalid:l,isFocused:E,isChecked:c,isActive:x,isHovered:R,isIndeterminate:s,isDisabled:t,isReadOnly:o,isRequired:d},getRootProps:ge,getCheckboxProps:ve,getIndicatorProps:be,getInputProps:he,getLabelProps:ke,htmlProps:V}}function je(e){e.preventDefault(),e.stopPropagation()}export{Ce as I,Ue as u}; diff --git a/dist/workspace_web/chunk-JARCRF6W-UyOcndjS.js b/dist/workspace_web/chunk-JARCRF6W-UyOcndjS.js deleted file mode 100644 index 1ef7f96..0000000 --- a/dist/workspace_web/chunk-JARCRF6W-UyOcndjS.js +++ /dev/null @@ -1 +0,0 @@ -import{b as D,r as h,j as t,g as i,$ as v,f as j,k as T,o as $,H as B,e as E}from"./input.js";import{u as z}from"./chunk-7D6N5TE5-fihyubSX.js";var[Z,F]=D({name:"CheckboxGroupContext",strict:!1});function M(o){const[s,n]=h.useState(o),[e,r]=h.useState(!1);return o!==s&&(r(!0),n(o)),e}function W(o){return t.jsx(i.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...o,children:t.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function X(o){return t.jsx(i.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...o,children:t.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function H(o){const{isIndeterminate:s,isChecked:n,...e}=o,r=s?X:W;return n||s?t.jsx(i.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:t.jsx(r,{...e})}):null}var L={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},O={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},q=v({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),J=v({from:{opacity:0},to:{opacity:1}}),K=v({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Q=j(function(s,n){const e=F(),r={...e,...s},a=T("Checkbox",r),c=$(s),{spacing:x="0.5rem",className:C,children:m,iconColor:u,iconSize:d,icon:k=t.jsx(H,{}),isChecked:f,isDisabled:g=e==null?void 0:e.isDisabled,onChange:p,inputProps:w,..._}=c;let y=f;e!=null&&e.value&&c.value&&(y=e.value.includes(c.value));let b=p;e!=null&&e.onChange&&c.value&&(b=B(e.onChange,p));const{state:l,getInputProps:A,getCheckboxProps:S,getLabelProps:G,getRootProps:P}=z({..._,isDisabled:g,isChecked:y,onChange:b}),I=M(l.isChecked),R=h.useMemo(()=>({animation:I?l.isIndeterminate?`${J} 20ms linear, ${K} 200ms linear`:`${q} 200ms linear`:void 0,fontSize:d,color:u,...a.icon}),[u,d,I,l.isIndeterminate,a.icon]),N=h.cloneElement(k,{__css:R,isIndeterminate:l.isIndeterminate,isChecked:l.isChecked});return t.jsxs(i.label,{__css:{...O,...a.container},className:E("chakra-checkbox",C),...P(),children:[t.jsx("input",{className:"chakra-checkbox__input",...A(w,n)}),t.jsx(i.span,{__css:{...L,...a.control},className:"chakra-checkbox__control",...S(),children:N}),m&&t.jsx(i.span,{className:"chakra-checkbox__label",...G(),__css:{marginStart:x,...a.label},children:m})]})});Q.displayName="Checkbox";var U=j(function(s,n){const{templateAreas:e,gap:r,rowGap:a,columnGap:c,column:x,row:C,autoFlow:m,autoRows:u,templateRows:d,autoColumns:k,templateColumns:f,...g}=s,p={display:"grid",gridTemplateAreas:e,gridGap:r,gridRowGap:a,gridColumnGap:c,gridAutoColumns:k,gridColumn:x,gridRow:C,gridAutoFlow:m,gridAutoRows:u,gridTemplateRows:d,gridTemplateColumns:f};return t.jsx(i.div,{ref:n,__css:p,...g})});U.displayName="Grid";export{Q as C,U as G}; diff --git a/dist/workspace_web/chunk-NTCQBYKE-HH_ifqNx.js b/dist/workspace_web/chunk-NTCQBYKE-HH_ifqNx.js deleted file mode 100644 index 0b92a57..0000000 --- a/dist/workspace_web/chunk-NTCQBYKE-HH_ifqNx.js +++ /dev/null @@ -1 +0,0 @@ -import{g as t}from"./App-1AImvRpr.js";import{f as o,j as s}from"./input.js";var e=o((a,r)=>s.jsx(t,{align:"center",...a,direction:"column",ref:r}));e.displayName="VStack";export{e as V}; diff --git a/dist/workspace_web/chunk-VTV6N5LE-7BSZDdqw.js b/dist/workspace_web/chunk-VTV6N5LE-7BSZDdqw.js deleted file mode 100644 index 7aff80b..0000000 --- a/dist/workspace_web/chunk-VTV6N5LE-7BSZDdqw.js +++ /dev/null @@ -1 +0,0 @@ -import{f as l,n as f,o as h,j as e,g as n,e as m,k as y,r as o}from"./input.js";import{u as w}from"./chunk-7D6N5TE5-fihyubSX.js";var N=l(function(a,i){const s=f("Link",a),{className:c,isExternal:t,...r}=h(a);return e.jsx(n.a,{target:t?"_blank":void 0,rel:t?"noopener":void 0,ref:i,className:m("chakra-link",c),...r,__css:s})});N.displayName="Link";var j=l(function(a,i){const s=y("Switch",a),{spacing:c="0.5rem",children:t,...r}=h(a),{getIndicatorProps:u,getInputProps:p,getCheckboxProps:x,getRootProps:_,getLabelProps:g}=w(r),b=o.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...s.container}),[s.container]),S=o.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...s.track}),[s.track]),d=o.useMemo(()=>({userSelect:"none",marginStart:c,...s.label}),[c,s.label]);return e.jsxs(n.label,{..._(),className:m("chakra-switch",a.className),__css:b,children:[e.jsx("input",{className:"chakra-switch__input",...p({},i)}),e.jsx(n.span,{...x(),className:"chakra-switch__track",__css:S,children:e.jsx(n.span,{__css:s.thumb,className:"chakra-switch__thumb",...u()})}),t&&e.jsx(n.span,{className:"chakra-switch__label",...g(),__css:d,children:t})]})});j.displayName="Switch";export{N as L,j as S}; diff --git a/dist/workspace_web/civitUtils-uJNBxoFV.js b/dist/workspace_web/civitUtils-uJNBxoFV.js deleted file mode 100644 index 5ec75e1..0000000 --- a/dist/workspace_web/civitUtils-uJNBxoFV.js +++ /dev/null @@ -1 +0,0 @@ -import{k as m}from"./App-1AImvRpr.js";const r="WORKSPACE_CIVIT_API_KEY_STORAGE_KEY";function g(){return localStorage.getItem(r)}function h(e){localStorage.setItem(r,e)}function v(e){return`https://civitai.com/api/download/models/${e}`}async function w(e){var s,a,n;try{const l=`https://civitai.com/api/v1/model-versions/by-hash/${e}`,t=await(await fetch(l)).json();let i;if(await((s=m)==null?void 0:s.getSetting("showNsfwModelThumbnail"))===!0)i=(n=(a=t==null?void 0:t.images)==null?void 0:a[0])==null?void 0:n.url;else if(!t.model.nsfw){const o=t.images.find(c=>c.nsfwLevel==1);i=o==null?void 0:o.url}return{modelName:t.model.name,civitModelID:String(t.modelId),civitModelVersionID:String(t.id),imageUrl:i??void 0}}catch{return{}}}export{v as a,w as f,g,h as s}; diff --git a/dist/workspace_web/input.js b/dist/workspace_web/input.js deleted file mode 100644 index ee91be9..0000000 --- a/dist/workspace_web/input.js +++ /dev/null @@ -1,688 +0,0 @@ -function Gk(e,t){for(var r=0;rn[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const Kk="modulepreload",Yk=function(e){return"/"+e},im={},Xk=function(t,r,n){if(!r||r.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(r.map(i=>{if(i=Yk(i),i in im)return;im[i]=!0;const a=i.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!n)for(let c=o.length-1;c>=0;c--){const d=o[c];if(d.href===i&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${s}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":Kk,a||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),a)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t()).catch(i=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i})};var os=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var B0={exports:{}},ou={},j0={exports:{}},W={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var za=Symbol.for("react.element"),Qk=Symbol.for("react.portal"),qk=Symbol.for("react.fragment"),Zk=Symbol.for("react.strict_mode"),Jk=Symbol.for("react.profiler"),eC=Symbol.for("react.provider"),tC=Symbol.for("react.context"),rC=Symbol.for("react.forward_ref"),nC=Symbol.for("react.suspense"),oC=Symbol.for("react.memo"),iC=Symbol.for("react.lazy"),am=Symbol.iterator;function aC(e){return e===null||typeof e!="object"?null:(e=am&&e[am]||e["@@iterator"],typeof e=="function"?e:null)}var N0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},V0=Object.assign,W0={};function ei(e,t,r){this.props=e,this.context=t,this.refs=W0,this.updater=r||N0}ei.prototype.isReactComponent={};ei.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ei.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function U0(){}U0.prototype=ei.prototype;function Kf(e,t,r){this.props=e,this.context=t,this.refs=W0,this.updater=r||N0}var Yf=Kf.prototype=new U0;Yf.constructor=Kf;V0(Yf,ei.prototype);Yf.isPureReactComponent=!0;var sm=Array.isArray,H0=Object.prototype.hasOwnProperty,Xf={current:null},G0={key:!0,ref:!0,__self:!0,__source:!0};function K0(e,t,r){var n,o={},i=null,a=null;if(t!=null)for(n in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)H0.call(t,n)&&!G0.hasOwnProperty(n)&&(o[n]=t[n]);var s=arguments.length-2;if(s===1)o.children=r;else if(1>>1,ne=z[B];if(0>>1;Bo(Xt,V))weo(Fe,Xt)?(z[B]=Fe,z[we]=V,B=we):(z[B]=Xt,z[Ge]=V,B=Ge);else if(weo(Fe,V))z[B]=Fe,z[we]=V,B=we;else break e}}return N}function o(z,N){var V=z.sortIndex-N.sortIndex;return V!==0?V:z.id-N.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,p=!1,v=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(z){for(var N=r(u);N!==null;){if(N.callback===null)n(u);else if(N.startTime<=z)n(u),N.sortIndex=N.expirationTime,t(l,N);else break;N=r(u)}}function C(z){if(y=!1,g(z),!v)if(r(l)!==null)v=!0,He(_);else{var N=r(u);N!==null&&it(C,N.startTime-z)}}function _(z,N){v=!1,y&&(y=!1,m(A),A=-1),p=!0;var V=f;try{for(g(N),d=r(l);d!==null&&(!(d.expirationTime>N)||z&&!ee());){var B=d.callback;if(typeof B=="function"){d.callback=null,f=d.priorityLevel;var ne=B(d.expirationTime<=N);N=e.unstable_now(),typeof ne=="function"?d.callback=ne:d===r(l)&&n(l),g(N)}else n(l);d=r(l)}if(d!==null)var U=!0;else{var Ge=r(u);Ge!==null&&it(C,Ge.startTime-N),U=!1}return U}finally{d=null,f=V,p=!1}}var $=!1,T=null,A=-1,M=5,I=-1;function ee(){return!(e.unstable_now()-Iz||125B?(z.sortIndex=V,t(u,z),r(l)===null&&z===r(u)&&(y?(m(A),A=-1):y=!0,it(C,V-B))):(z.sortIndex=ne,t(l,z),v||p||(v=!0,He(_))),z},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(z){var N=f;return function(){var V=f;f=N;try{return z.apply(this,arguments)}finally{f=V}}}})(q0);Q0.exports=q0;var gC=Q0.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Z0=S,wt=gC;function R(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yd=Object.prototype.hasOwnProperty,yC=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,cm={},dm={};function bC(e){return yd.call(dm,e)?!0:yd.call(cm,e)?!1:yC.test(e)?dm[e]=!0:(cm[e]=!0,!1)}function SC(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function xC(e,t,r,n){if(t===null||typeof t>"u"||SC(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function ot(e,t,r,n,o,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=o,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var Ue={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ue[e]=new ot(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ue[t]=new ot(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ue[e]=new ot(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ue[e]=new ot(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ue[e]=new ot(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ue[e]=new ot(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ue[e]=new ot(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ue[e]=new ot(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ue[e]=new ot(e,5,!1,e.toLowerCase(),null,!1,!1)});var qf=/[\-:]([a-z])/g;function Zf(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(qf,Zf);Ue[t]=new ot(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(qf,Zf);Ue[t]=new ot(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(qf,Zf);Ue[t]=new ot(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ue[e]=new ot(e,1,!1,e.toLowerCase(),null,!1,!1)});Ue.xlinkHref=new ot("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ue[e]=new ot(e,1,!1,e.toLowerCase(),null,!0,!0)});function Jf(e,t,r,n){var o=Ue.hasOwnProperty(t)?Ue[t]:null;(o!==null?o.type!==0:n||!(2s||o[a]!==i[s]){var l=` -`+o[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{lc=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Ci(e):""}function wC(e){switch(e.tag){case 5:return Ci(e.type);case 16:return Ci("Lazy");case 13:return Ci("Suspense");case 19:return Ci("SuspenseList");case 0:case 2:case 15:return e=uc(e.type,!1),e;case 11:return e=uc(e.type.render,!1),e;case 1:return e=uc(e.type,!0),e;default:return""}}function wd(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case io:return"Fragment";case oo:return"Portal";case bd:return"Profiler";case eh:return"StrictMode";case Sd:return"Suspense";case xd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ty:return(e.displayName||"Context")+".Consumer";case ey:return(e._context.displayName||"Context")+".Provider";case th:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case rh:return t=e.displayName||null,t!==null?t:wd(e.type)||"Memo";case Wr:t=e._payload,e=e._init;try{return wd(e(t))}catch{}}return null}function kC(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return wd(t);case 8:return t===eh?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ln(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ny(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function CC(e){var t=ny(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ss(e){e._valueTracker||(e._valueTracker=CC(e))}function oy(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=ny(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function pl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function kd(e,t){var r=t.checked;return be({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function hm(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=ln(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function iy(e,t){t=t.checked,t!=null&&Jf(e,"checked",t,!1)}function Cd(e,t){iy(e,t);var r=ln(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?_d(e,t.type,r):t.hasOwnProperty("defaultValue")&&_d(e,t.type,ln(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function pm(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function _d(e,t,r){(t!=="number"||pl(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var _i=Array.isArray;function Eo(e,t,r,n){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=ls.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function na(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Li={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},_C=["Webkit","ms","Moz","O"];Object.keys(Li).forEach(function(e){_C.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Li[t]=Li[e]})});function uy(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Li.hasOwnProperty(e)&&Li[e]?(""+t).trim():t+"px"}function cy(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=uy(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,o):e[r]=o}}var PC=be({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ed(e,t){if(t){if(PC[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(R(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(R(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(R(61))}if(t.style!=null&&typeof t.style!="object")throw Error(R(62))}}function $d(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ad=null;function nh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Rd=null,$o=null,Ao=null;function gm(e){if(e=Ia(e)){if(typeof Rd!="function")throw Error(R(280));var t=e.stateNode;t&&(t=uu(t),Rd(e.stateNode,e.type,t))}}function dy(e){$o?Ao?Ao.push(e):Ao=[e]:$o=e}function fy(){if($o){var e=$o,t=Ao;if(Ao=$o=null,gm(e),t)for(e=0;e>>=0,e===0?32:31-(LC(e)/OC|0)|0}var us=64,cs=4194304;function Pi(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function yl(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,o=e.suspendedLanes,i=e.pingedLanes,a=r&268435455;if(a!==0){var s=a&~o;s!==0?n=Pi(s):(i&=a,i!==0&&(n=Pi(i)))}else a=r&~o,a!==0?n=Pi(a):i!==0&&(n=Pi(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&o)&&(o=n&-n,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function Fa(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ht(t),e[t]=r}function VC(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=Bi),Pm=" ",Tm=!1;function My(e,t){switch(e){case"keyup":return v2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zy(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ao=!1;function y2(e,t){switch(e){case"compositionend":return zy(t);case"keypress":return t.which!==32?null:(Tm=!0,Pm);case"textInput":return e=t.data,e===Pm&&Tm?null:e;default:return null}}function b2(e,t){if(ao)return e==="compositionend"||!dh&&My(e,t)?(e=Ay(),Vs=lh=Xr=null,ao=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Rm(r)}}function Ly(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ly(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Oy(){for(var e=window,t=pl();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=pl(e.document)}return t}function fh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function E2(e){var t=Oy(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Ly(r.ownerDocument.documentElement,r)){if(n!==null&&fh(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=r.textContent.length,i=Math.min(n.start,o);n=n.end===void 0?i:Math.min(n.end,o),!e.extend&&i>n&&(o=n,n=i,i=o),o=Mm(r,i);var a=Mm(r,n);o&&a&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,so=null,Ld=null,Ni=null,Od=!1;function zm(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Od||so==null||so!==pl(n)||(n=so,"selectionStart"in n&&fh(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Ni&&ua(Ni,n)||(Ni=n,n=xl(Ld,"onSelect"),0co||(e.current=Ud[co],Ud[co]=null,co--)}function ae(e,t){co++,Ud[co]=e.current,e.current=t}var un={},qe=hn(un),ut=hn(!1),jn=un;function Wo(e,t){var r=e.type.contextTypes;if(!r)return un;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in r)o[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function ct(e){return e=e.childContextTypes,e!=null}function kl(){fe(ut),fe(qe)}function jm(e,t,r){if(qe.current!==un)throw Error(R(168));ae(qe,t),ae(ut,r)}function Ky(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var o in n)if(!(o in t))throw Error(R(108,kC(e)||"Unknown",o));return be({},r,n)}function Cl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||un,jn=qe.current,ae(qe,e),ae(ut,ut.current),!0}function Nm(e,t,r){var n=e.stateNode;if(!n)throw Error(R(169));r?(e=Ky(e,t,jn),n.__reactInternalMemoizedMergedChildContext=e,fe(ut),fe(qe),ae(qe,e)):fe(ut),ae(ut,r)}var br=null,cu=!1,kc=!1;function Yy(e){br===null?br=[e]:br.push(e)}function j2(e){cu=!0,Yy(e)}function pn(){if(!kc&&br!==null){kc=!0;var e=0,t=te;try{var r=br;for(te=1;e>=a,o-=a,wr=1<<32-Ht(t)+o|r<A?(M=T,T=null):M=T.sibling;var I=f(m,T,g[A],C);if(I===null){T===null&&(T=M);break}e&&T&&I.alternate===null&&t(m,T),h=i(I,h,A),$===null?_=I:$.sibling=I,$=I,T=M}if(A===g.length)return r(m,T),me&&xn(m,A),_;if(T===null){for(;AA?(M=T,T=null):M=T.sibling;var ee=f(m,T,I.value,C);if(ee===null){T===null&&(T=M);break}e&&T&&ee.alternate===null&&t(m,T),h=i(ee,h,A),$===null?_=ee:$.sibling=ee,$=ee,T=M}if(I.done)return r(m,T),me&&xn(m,A),_;if(T===null){for(;!I.done;A++,I=g.next())I=d(m,I.value,C),I!==null&&(h=i(I,h,A),$===null?_=I:$.sibling=I,$=I);return me&&xn(m,A),_}for(T=n(m,T);!I.done;A++,I=g.next())I=p(T,m,A,I.value,C),I!==null&&(e&&I.alternate!==null&&T.delete(I.key===null?A:I.key),h=i(I,h,A),$===null?_=I:$.sibling=I,$=I);return e&&T.forEach(function(ze){return t(m,ze)}),me&&xn(m,A),_}function x(m,h,g,C){if(typeof g=="object"&&g!==null&&g.type===io&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case as:e:{for(var _=g.key,$=h;$!==null;){if($.key===_){if(_=g.type,_===io){if($.tag===7){r(m,$.sibling),h=o($,g.props.children),h.return=m,m=h;break e}}else if($.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Wr&&Ym(_)===$.type){r(m,$.sibling),h=o($,g.props),h.ref=mi(m,$,g),h.return=m,m=h;break e}r(m,$);break}else t(m,$);$=$.sibling}g.type===io?(h=Fn(g.props.children,m.mode,C,g.key),h.return=m,m=h):(C=Qs(g.type,g.key,g.props,null,m.mode,C),C.ref=mi(m,h,g),C.return=m,m=C)}return a(m);case oo:e:{for($=g.key;h!==null;){if(h.key===$)if(h.tag===4&&h.stateNode.containerInfo===g.containerInfo&&h.stateNode.implementation===g.implementation){r(m,h.sibling),h=o(h,g.children||[]),h.return=m,m=h;break e}else{r(m,h);break}else t(m,h);h=h.sibling}h=Rc(g,m.mode,C),h.return=m,m=h}return a(m);case Wr:return $=g._init,x(m,h,$(g._payload),C)}if(_i(g))return v(m,h,g,C);if(ci(g))return y(m,h,g,C);gs(m,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,h!==null&&h.tag===6?(r(m,h.sibling),h=o(h,g),h.return=m,m=h):(r(m,h),h=Ac(g,m.mode,C),h.return=m,m=h),a(m)):r(m,h)}return x}var Ho=r1(!0),n1=r1(!1),La={},cr=hn(La),ha=hn(La),pa=hn(La);function An(e){if(e===La)throw Error(R(174));return e}function xh(e,t){switch(ae(pa,t),ae(ha,e),ae(cr,La),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Td(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Td(t,e)}fe(cr),ae(cr,t)}function Go(){fe(cr),fe(ha),fe(pa)}function o1(e){An(pa.current);var t=An(cr.current),r=Td(t,e.type);t!==r&&(ae(ha,e),ae(cr,r))}function wh(e){ha.current===e&&(fe(cr),fe(ha))}var ve=hn(0);function Al(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Cc=[];function kh(){for(var e=0;er?r:4,e(!0);var n=_c.transition;_c.transition={};try{e(!1),t()}finally{te=r,_c.transition=n}}function S1(){return Lt().memoizedState}function U2(e,t,r){var n=nn(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},x1(e))w1(t,r);else if(r=Zy(e,t,r,n),r!==null){var o=tt();Gt(r,e,n,o),k1(r,t,n)}}function H2(e,t,r){var n=nn(e),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(x1(e))w1(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,s=i(a,r);if(o.hasEagerState=!0,o.eagerState=s,Yt(s,a)){var l=t.interleaved;l===null?(o.next=o,bh(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}r=Zy(e,t,o,n),r!==null&&(o=tt(),Gt(r,e,n,o),k1(r,t,n))}}function x1(e){var t=e.alternate;return e===ye||t!==null&&t===ye}function w1(e,t){Vi=Rl=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function k1(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,ih(e,r)}}var Ml={readContext:It,useCallback:Ke,useContext:Ke,useEffect:Ke,useImperativeHandle:Ke,useInsertionEffect:Ke,useLayoutEffect:Ke,useMemo:Ke,useReducer:Ke,useRef:Ke,useState:Ke,useDebugValue:Ke,useDeferredValue:Ke,useTransition:Ke,useMutableSource:Ke,useSyncExternalStore:Ke,useId:Ke,unstable_isNewReconciler:!1},G2={readContext:It,useCallback:function(e,t){return er().memoizedState=[e,t===void 0?null:t],e},useContext:It,useEffect:Qm,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Gs(4194308,4,m1.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Gs(4194308,4,e,t)},useInsertionEffect:function(e,t){return Gs(4,2,e,t)},useMemo:function(e,t){var r=er();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=er();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=U2.bind(null,ye,e),[n.memoizedState,e]},useRef:function(e){var t=er();return e={current:e},t.memoizedState=e},useState:Xm,useDebugValue:Eh,useDeferredValue:function(e){return er().memoizedState=e},useTransition:function(){var e=Xm(!1),t=e[0];return e=W2.bind(null,e[1]),er().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ye,o=er();if(me){if(r===void 0)throw Error(R(407));r=r()}else{if(r=t(),Le===null)throw Error(R(349));Vn&30||s1(n,t,r)}o.memoizedState=r;var i={value:r,getSnapshot:t};return o.queue=i,Qm(u1.bind(null,n,i,e),[e]),n.flags|=2048,ga(9,l1.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=er(),t=Le.identifierPrefix;if(me){var r=kr,n=wr;r=(n&~(1<<32-Ht(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=ma++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=a.createElement(r,{is:n.is}):(e=a.createElement(r),r==="select"&&(a=e,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):e=a.createElementNS(e,r),e[ir]=t,e[fa]=n,M1(e,t,!1,!1),t.stateNode=e;e:{switch(a=$d(r,n),r){case"dialog":ce("cancel",e),ce("close",e),o=n;break;case"iframe":case"object":case"embed":ce("load",e),o=n;break;case"video":case"audio":for(o=0;oYo&&(t.flags|=128,n=!0,vi(i,!1),t.lanes=4194304)}else{if(!n)if(e=Al(a),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),vi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!me)return Ye(t),null}else 2*ke()-i.renderingStartTime>Yo&&r!==1073741824&&(t.flags|=128,n=!0,vi(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(r=i.last,r!==null?r.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ke(),t.sibling=null,r=ve.current,ae(ve,n?r&1|2:r&1),t):(Ye(t),null);case 22:case 23:return Fh(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?gt&1073741824&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),null;case 24:return null;case 25:return null}throw Error(R(156,t.tag))}function e_(e,t){switch(ph(t),t.tag){case 1:return ct(t.type)&&kl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Go(),fe(ut),fe(qe),kh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return wh(t),null;case 13:if(fe(ve),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(R(340));Uo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fe(ve),null;case 4:return Go(),null;case 10:return yh(t.type._context),null;case 22:case 23:return Fh(),null;case 24:return null;default:return null}}var bs=!1,Qe=!1,t_=typeof WeakSet=="function"?WeakSet:Set,D=null;function mo(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Se(e,t,n)}else r.current=null}function rf(e,t,r){try{r()}catch(n){Se(e,t,n)}}var iv=!1;function r_(e,t){if(Bd=bl,e=Oy(),fh(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var o=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var a=0,s=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var p;d!==r||o!==0&&d.nodeType!==3||(s=a+o),d!==i||n!==0&&d.nodeType!==3||(l=a+n),d.nodeType===3&&(a+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===e)break t;if(f===r&&++u===o&&(s=a),f===i&&++c===n&&(l=a),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}r=s===-1||l===-1?null:{start:s,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(jd={focusedElem:e,selectionRange:r},bl=!1,D=t;D!==null;)if(t=D,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,D=e;else for(;D!==null;){t=D;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var y=v.memoizedProps,x=v.memoizedState,m=t.stateNode,h=m.getSnapshotBeforeUpdate(t.elementType===t.type?y:Nt(t.type,y),x);m.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(R(163))}}catch(C){Se(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,D=e;break}D=t.return}return v=iv,iv=!1,v}function Wi(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&rf(t,r,i)}o=o.next}while(o!==n)}}function hu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function nf(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function D1(e){var t=e.alternate;t!==null&&(e.alternate=null,D1(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ir],delete t[fa],delete t[Wd],delete t[O2],delete t[B2])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function I1(e){return e.tag===5||e.tag===3||e.tag===4}function av(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||I1(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function of(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=wl));else if(n!==4&&(e=e.child,e!==null))for(of(e,t,r),e=e.sibling;e!==null;)of(e,t,r),e=e.sibling}function af(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(af(e,t,r),e=e.sibling;e!==null;)af(e,t,r),e=e.sibling}var Ne=null,Vt=!1;function Or(e,t,r){for(r=r.child;r!==null;)L1(e,t,r),r=r.sibling}function L1(e,t,r){if(ur&&typeof ur.onCommitFiberUnmount=="function")try{ur.onCommitFiberUnmount(iu,r)}catch{}switch(r.tag){case 5:Qe||mo(r,t);case 6:var n=Ne,o=Vt;Ne=null,Or(e,t,r),Ne=n,Vt=o,Ne!==null&&(Vt?(e=Ne,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ne.removeChild(r.stateNode));break;case 18:Ne!==null&&(Vt?(e=Ne,r=r.stateNode,e.nodeType===8?wc(e.parentNode,r):e.nodeType===1&&wc(e,r),sa(e)):wc(Ne,r.stateNode));break;case 4:n=Ne,o=Vt,Ne=r.stateNode.containerInfo,Vt=!0,Or(e,t,r),Ne=n,Vt=o;break;case 0:case 11:case 14:case 15:if(!Qe&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){o=n=n.next;do{var i=o,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&rf(r,t,a),o=o.next}while(o!==n)}Or(e,t,r);break;case 1:if(!Qe&&(mo(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Se(r,t,s)}Or(e,t,r);break;case 21:Or(e,t,r);break;case 22:r.mode&1?(Qe=(n=Qe)||r.memoizedState!==null,Or(e,t,r),Qe=n):Or(e,t,r);break;default:Or(e,t,r)}}function sv(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new t_),t.forEach(function(n){var o=d_.bind(null,e,n);r.has(n)||(r.add(n),n.then(o,o))})}}function Bt(e,t){var r=t.deletions;if(r!==null)for(var n=0;no&&(o=a),n&=~i}if(n=o,n=ke()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*o_(n/1960))-n,10e?16:e,Qr===null)var n=!1;else{if(e=Qr,Qr=null,Dl=0,Y&6)throw Error(R(331));var o=Y;for(Y|=4,D=e.current;D!==null;){var i=D,a=i.child;if(D.flags&16){var s=i.deletions;if(s!==null){for(var l=0;lke()-Mh?zn(e,0):Rh|=r),dt(e,t)}function H1(e,t){t===0&&(e.mode&1?(t=cs,cs<<=1,!(cs&130023424)&&(cs=4194304)):t=1);var r=tt();e=zr(e,t),e!==null&&(Fa(e,t,r),dt(e,r))}function c_(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),H1(e,r)}function d_(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,o=e.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(R(314))}n!==null&&n.delete(t),H1(e,r)}var G1;G1=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||ut.current)lt=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return lt=!1,Z2(e,t,r);lt=!!(e.flags&131072)}else lt=!1,me&&t.flags&1048576&&Xy(t,Pl,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Ks(e,t),e=t.pendingProps;var o=Wo(t,qe.current);Mo(t,r),o=_h(null,t,n,e,o,r);var i=Ph();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ct(n)?(i=!0,Cl(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Sh(t),o.updater=du,t.stateNode=o,o._reactInternals=t,Xd(t,n,e,r),t=Zd(null,t,n,!0,i,r)):(t.tag=0,me&&i&&hh(t),Je(null,t,o,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Ks(e,t),e=t.pendingProps,o=n._init,n=o(n._payload),t.type=n,o=t.tag=h_(n),e=Nt(n,e),o){case 0:t=qd(null,t,n,e,r);break e;case 1:t=rv(null,t,n,e,r);break e;case 11:t=ev(null,t,n,e,r);break e;case 14:t=tv(null,t,n,Nt(n.type,e),r);break e}throw Error(R(306,n,""))}return t;case 0:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Nt(n,o),qd(e,t,n,o,r);case 1:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Nt(n,o),rv(e,t,n,o,r);case 3:e:{if($1(t),e===null)throw Error(R(387));n=t.pendingProps,i=t.memoizedState,o=i.element,Jy(e,t),$l(t,n,null,r);var a=t.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Ko(Error(R(423)),t),t=nv(e,t,n,r,o);break e}else if(n!==o){o=Ko(Error(R(424)),t),t=nv(e,t,n,r,o);break e}else for(yt=en(t.stateNode.containerInfo.firstChild),bt=t,me=!0,Wt=null,r=n1(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Uo(),n===o){t=Fr(e,t,r);break e}Je(e,t,n,r)}t=t.child}return t;case 5:return o1(t),e===null&&Gd(t),n=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,a=o.children,Nd(n,o)?a=null:i!==null&&Nd(n,i)&&(t.flags|=32),E1(e,t),Je(e,t,a,r),t.child;case 6:return e===null&&Gd(t),null;case 13:return A1(e,t,r);case 4:return xh(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ho(t,null,n,r):Je(e,t,n,r),t.child;case 11:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Nt(n,o),ev(e,t,n,o,r);case 7:return Je(e,t,t.pendingProps,r),t.child;case 8:return Je(e,t,t.pendingProps.children,r),t.child;case 12:return Je(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,o=t.pendingProps,i=t.memoizedProps,a=o.value,ae(Tl,n._currentValue),n._currentValue=a,i!==null)if(Yt(i.value,a)){if(i.children===o.children&&!ut.current){t=Fr(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){a=i.child;for(var l=s.firstContext;l!==null;){if(l.context===n){if(i.tag===1){l=Pr(-1,r&-r),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),Kd(i.return,r,t),s.lanes|=r;break}l=l.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(R(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),Kd(a,r,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Je(e,t,o.children,r),t=t.child}return t;case 9:return o=t.type,n=t.pendingProps.children,Mo(t,r),o=It(o),n=n(o),t.flags|=1,Je(e,t,n,r),t.child;case 14:return n=t.type,o=Nt(n,t.pendingProps),o=Nt(n.type,o),tv(e,t,n,o,r);case 15:return P1(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Nt(n,o),Ks(e,t),t.tag=1,ct(n)?(e=!0,Cl(t)):e=!1,Mo(t,r),t1(t,n,o),Xd(t,n,o,r),Zd(null,t,n,!0,e,r);case 19:return R1(e,t,r);case 22:return T1(e,t,r)}throw Error(R(156,t.tag))};function K1(e,t){return by(e,t)}function f_(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zt(e,t,r,n){return new f_(e,t,r,n)}function Ih(e){return e=e.prototype,!(!e||!e.isReactComponent)}function h_(e){if(typeof e=="function")return Ih(e)?1:0;if(e!=null){if(e=e.$$typeof,e===th)return 11;if(e===rh)return 14}return 2}function on(e,t){var r=e.alternate;return r===null?(r=zt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Qs(e,t,r,n,o,i){var a=2;if(n=e,typeof e=="function")Ih(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case io:return Fn(r.children,o,i,t);case eh:a=8,o|=8;break;case bd:return e=zt(12,r,t,o|2),e.elementType=bd,e.lanes=i,e;case Sd:return e=zt(13,r,t,o),e.elementType=Sd,e.lanes=i,e;case xd:return e=zt(19,r,t,o),e.elementType=xd,e.lanes=i,e;case ry:return mu(r,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ey:a=10;break e;case ty:a=9;break e;case th:a=11;break e;case rh:a=14;break e;case Wr:a=16,n=null;break e}throw Error(R(130,e==null?e:typeof e,""))}return t=zt(a,r,t,o),t.elementType=e,t.type=n,t.lanes=i,t}function Fn(e,t,r,n){return e=zt(7,e,n,t),e.lanes=r,e}function mu(e,t,r,n){return e=zt(22,e,n,t),e.elementType=ry,e.lanes=r,e.stateNode={isHidden:!1},e}function Ac(e,t,r){return e=zt(6,e,null,t),e.lanes=r,e}function Rc(e,t,r){return t=zt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function p_(e,t,r,n,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=dc(0),this.expirationTimes=dc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dc(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Lh(e,t,r,n,o,i,a,s,l){return e=new p_(e,t,r,s,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=zt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sh(i),e}function m_(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(q1)}catch(e){console.error(e)}}q1(),X0.exports=Ct;var Nh=X0.exports,mv=Nh;gd.createRoot=mv.createRoot,gd.hydrateRoot=mv.hydrateRoot;function S_(e){if(e.sheet)return e.sheet;for(var t=0;t0?Ve(ni,--ft):0,Xo--,Ee===10&&(Xo=1,xu--),Ee}function St(){return Ee=ft2||Sa(Ee)>3?"":" "}function z_(e,t){for(;--t&&St()&&!(Ee<48||Ee>102||Ee>57&&Ee<65||Ee>70&&Ee<97););return Oa(e,qs()+(t<6&&dr()==32&&St()==32))}function ff(e){for(;St();)switch(Ee){case e:return ft;case 34:case 39:e!==34&&e!==39&&ff(Ee);break;case 40:e===41&&ff(e);break;case 92:St();break}return ft}function F_(e,t){for(;St()&&e+Ee!==57;)if(e+Ee===84&&dr()===47)break;return"/*"+Oa(t,ft-1)+"*"+Su(e===47?e:St())}function D_(e){for(;!Sa(dr());)St();return Oa(e,ft)}function I_(e){return nb(Js("",null,null,null,[""],e=rb(e),0,[0],e))}function Js(e,t,r,n,o,i,a,s,l){for(var u=0,c=0,d=a,f=0,p=0,v=0,y=1,x=1,m=1,h=0,g="",C=o,_=i,$=n,T=g;x;)switch(v=h,h=St()){case 40:if(v!=108&&Ve(T,d-1)==58){df(T+=q(Zs(h),"&","&\f"),"&\f")!=-1&&(m=-1);break}case 34:case 39:case 91:T+=Zs(h);break;case 9:case 10:case 13:case 32:T+=M_(v);break;case 92:T+=z_(qs()-1,7);continue;case 47:switch(dr()){case 42:case 47:ws(L_(F_(St(),qs()),t,r),l);break;default:T+="/"}break;case 123*y:s[u++]=nr(T)*m;case 125*y:case 59:case 0:switch(h){case 0:case 125:x=0;case 59+c:m==-1&&(T=q(T,/\f/g,"")),p>0&&nr(T)-d&&ws(p>32?gv(T+";",n,r,d-1):gv(q(T," ","")+";",n,r,d-2),l);break;case 59:T+=";";default:if(ws($=vv(T,t,r,u,c,o,s,g,C=[],_=[],d),i),h===123)if(c===0)Js(T,t,$,$,C,i,d,s,_);else switch(f===99&&Ve(T,3)===110?100:f){case 100:case 108:case 109:case 115:Js(e,$,$,n&&ws(vv(e,$,$,0,0,o,s,g,o,C=[],d),_),o,_,d,s,n?C:_);break;default:Js(T,$,$,$,[""],_,0,s,_)}}u=c=p=0,y=m=1,g=T="",d=a;break;case 58:d=1+nr(T),p=v;default:if(y<1){if(h==123)--y;else if(h==125&&y++==0&&R_()==125)continue}switch(T+=Su(h),h*y){case 38:m=c>0?1:(T+="\f",-1);break;case 44:s[u++]=(nr(T)-1)*m,m=1;break;case 64:dr()===45&&(T+=Zs(St())),f=dr(),c=d=nr(g=T+=D_(qs())),h++;break;case 45:v===45&&nr(T)==2&&(y=0)}}return i}function vv(e,t,r,n,o,i,a,s,l,u,c){for(var d=o-1,f=o===0?i:[""],p=Uh(f),v=0,y=0,x=0;v0?f[m]+" "+h:q(h,/&\f/g,f[m])))&&(l[x++]=g);return wu(e,t,r,o===0?Vh:s,l,u,c)}function L_(e,t,r){return wu(e,t,r,Z1,Su(A_()),ba(e,2,-2),0)}function gv(e,t,r,n){return wu(e,t,r,Wh,ba(e,0,n),ba(e,n+1,-1),n)}function Fo(e,t){for(var r="",n=Uh(e),o=0;o6)switch(Ve(e,t+1)){case 109:if(Ve(e,t+4)!==45)break;case 102:return q(e,/(.+:)(.+)-([^]+)/,"$1"+Q+"$2-$3$1"+Ol+(Ve(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~df(e,"stretch")?ib(q(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ve(e,t+1)!==115)break;case 6444:switch(Ve(e,nr(e)-3-(~df(e,"!important")&&10))){case 107:return q(e,":",":"+Q)+e;case 101:return q(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Q+(Ve(e,14)===45?"inline-":"")+"box$3$1"+Q+"$2$3$1"+Xe+"$2box$3")+e}break;case 5936:switch(Ve(e,t+11)){case 114:return Q+e+Xe+q(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Q+e+Xe+q(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Q+e+Xe+q(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Q+e+Xe+e+e}return e}var G_=function(t,r,n,o){if(t.length>-1&&!t.return)switch(t.type){case Wh:t.return=ib(t.value,t.length);break;case J1:return Fo([yi(t,{value:q(t.value,"@","@"+Q)})],o);case Vh:if(t.length)return $_(t.props,function(i){switch(E_(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Fo([yi(t,{props:[q(i,/:(read-\w+)/,":"+Ol+"$1")]})],o);case"::placeholder":return Fo([yi(t,{props:[q(i,/:(plac\w+)/,":"+Q+"input-$1")]}),yi(t,{props:[q(i,/:(plac\w+)/,":"+Ol+"$1")]}),yi(t,{props:[q(i,/:(plac\w+)/,Xe+"input-$1")]})],o)}return""})}},K_=[G_],Y_=function(t){var r=t.key;if(r==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(y){var x=y.getAttribute("data-emotion");x.indexOf(" ")!==-1&&(document.head.appendChild(y),y.setAttribute("data-s",""))})}var o=t.stylisPlugins||K_,i={},a,s=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+r+' "]'),function(y){for(var x=y.getAttribute("data-emotion").split(" "),m=1;m=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var aP={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},sP=/[A-Z]|^ms/g,lP=/_EMO_([^_]+?)_([^]*?)_EMO_/g,fb=function(t){return t.charCodeAt(1)===45},Sv=function(t){return t!=null&&typeof t!="boolean"},Mc=ob(function(e){return fb(e)?e:e.replace(sP,"-$&").toLowerCase()}),xv=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(lP,function(n,o,i){return or={name:o,styles:i,next:or},o})}return aP[t]!==1&&!fb(t)&&typeof r=="number"&&r!==0?r+"px":r};function xa(e,t,r){if(r==null)return"";if(r.__emotion_styles!==void 0)return r;switch(typeof r){case"boolean":return"";case"object":{if(r.anim===1)return or={name:r.name,styles:r.styles,next:or},r.name;if(r.styles!==void 0){var n=r.next;if(n!==void 0)for(;n!==void 0;)or={name:n.name,styles:n.styles,next:or},n=n.next;var o=r.styles+";";return o}return uP(e,t,r)}case"function":{if(e!==void 0){var i=or,a=r(e);return or=i,xa(e,t,a)}break}}if(t==null)return r;var s=t[r];return s!==void 0?s:r}function uP(e,t,r){var n="";if(Array.isArray(r))for(var o=0;oE.jsx(Ba,{styles:gb}),yP=({scope:e=""})=>E.jsx(Ba,{styles:vb` - html { - line-height: 1.5; - -webkit-text-size-adjust: 100%; - font-family: system-ui, sans-serif; - -webkit-font-smoothing: antialiased; - text-rendering: optimizeLegibility; - -moz-osx-font-smoothing: grayscale; - touch-action: manipulation; - } - - body { - position: relative; - min-height: 100%; - margin: 0; - font-feature-settings: "kern"; - } - - ${e} :where(*, *::before, *::after) { - border-width: 0; - border-style: solid; - box-sizing: border-box; - word-wrap: break-word; - } - - main { - display: block; - } - - ${e} hr { - border-top-width: 1px; - box-sizing: content-box; - height: 0; - overflow: visible; - } - - ${e} :where(pre, code, kbd,samp) { - font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; - font-size: 1em; - } - - ${e} a { - background-color: transparent; - color: inherit; - text-decoration: inherit; - } - - ${e} abbr[title] { - border-bottom: none; - text-decoration: underline; - -webkit-text-decoration: underline dotted; - text-decoration: underline dotted; - } - - ${e} :where(b, strong) { - font-weight: bold; - } - - ${e} small { - font-size: 80%; - } - - ${e} :where(sub,sup) { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; - } - - ${e} sub { - bottom: -0.25em; - } - - ${e} sup { - top: -0.5em; - } - - ${e} img { - border-style: none; - } - - ${e} :where(button, input, optgroup, select, textarea) { - font-family: inherit; - font-size: 100%; - line-height: 1.15; - margin: 0; - } - - ${e} :where(button, input) { - overflow: visible; - } - - ${e} :where(button, select) { - text-transform: none; - } - - ${e} :where( - button::-moz-focus-inner, - [type="button"]::-moz-focus-inner, - [type="reset"]::-moz-focus-inner, - [type="submit"]::-moz-focus-inner - ) { - border-style: none; - padding: 0; - } - - ${e} fieldset { - padding: 0.35em 0.75em 0.625em; - } - - ${e} legend { - box-sizing: border-box; - color: inherit; - display: table; - max-width: 100%; - padding: 0; - white-space: normal; - } - - ${e} progress { - vertical-align: baseline; - } - - ${e} textarea { - overflow: auto; - } - - ${e} :where([type="checkbox"], [type="radio"]) { - box-sizing: border-box; - padding: 0; - } - - ${e} input[type="number"]::-webkit-inner-spin-button, - ${e} input[type="number"]::-webkit-outer-spin-button { - -webkit-appearance: none !important; - } - - ${e} input[type="number"] { - -moz-appearance: textfield; - } - - ${e} input[type="search"] { - -webkit-appearance: textfield; - outline-offset: -2px; - } - - ${e} input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none !important; - } - - ${e} ::-webkit-file-upload-button { - -webkit-appearance: button; - font: inherit; - } - - ${e} details { - display: block; - } - - ${e} summary { - display: list-item; - } - - template { - display: none; - } - - [hidden] { - display: none !important; - } - - ${e} :where( - blockquote, - dl, - dd, - h1, - h2, - h3, - h4, - h5, - h6, - hr, - figure, - p, - pre - ) { - margin: 0; - } - - ${e} button { - background: transparent; - padding: 0; - } - - ${e} fieldset { - margin: 0; - padding: 0; - } - - ${e} :where(ol, ul) { - margin: 0; - padding: 0; - } - - ${e} textarea { - resize: vertical; - } - - ${e} :where(button, [role="button"]) { - cursor: pointer; - } - - ${e} button::-moz-focus-inner { - border: 0 !important; - } - - ${e} table { - border-collapse: collapse; - } - - ${e} :where(h1, h2, h3, h4, h5, h6) { - font-size: inherit; - font-weight: inherit; - } - - ${e} :where(button, input, optgroup, select, textarea) { - padding: 0; - line-height: inherit; - color: inherit; - } - - ${e} :where(img, svg, video, canvas, audio, iframe, embed, object) { - display: block; - } - - ${e} :where(img, video) { - max-width: 100%; - height: auto; - } - - [data-js-focus-visible] - :focus:not([data-focus-visible-added]):not( - [data-focus-visible-disabled] - ) { - outline: none; - box-shadow: none; - } - - ${e} select::-ms-expand { - display: none; - } - - ${gb} - `});function bP(e,t){return`${e} returned \`undefined\`. Seems you forgot to wrap component within ${t}`}function mn(e={}){const{name:t,strict:r=!0,hookName:n="useContext",providerName:o="Provider",errorMessage:i,defaultValue:a}=e,s=S.createContext(a);s.displayName=t;function l(){var u;const c=S.useContext(s);if(!c&&r){const d=new Error(i??bP(n,o));throw d.name="ContextError",(u=Error.captureStackTrace)==null||u.call(Error,d,l),d}return c}return[s.Provider,l,s]}var[SP,xP]=mn({strict:!1,name:"PortalManagerContext"});function yb(e){const{children:t,zIndex:r}=e;return E.jsx(SP,{value:{zIndex:r},children:t})}yb.displayName="PortalManager";var Bl=globalThis!=null&&globalThis.document?S.useLayoutEffect:S.useEffect,[bb,wP]=mn({strict:!1,name:"PortalContext"}),Xh="chakra-portal",kP=".chakra-portal",CP=e=>E.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),_P=e=>{const{appendToParentPortal:t,children:r}=e,[n,o]=S.useState(null),i=S.useRef(null),[,a]=S.useState({});S.useEffect(()=>a({}),[]);const s=wP(),l=xP();Bl(()=>{if(!n)return;const c=n.ownerDocument,d=t?s??c.body:c.body;if(!d)return;i.current=c.createElement("div"),i.current.className=Xh,d.appendChild(i.current),a({});const f=i.current;return()=>{d.contains(f)&&d.removeChild(f)}},[n]);const u=l!=null&&l.zIndex?E.jsx(CP,{zIndex:l==null?void 0:l.zIndex,children:r}):r;return i.current?Nh.createPortal(E.jsx(bb,{value:i.current,children:u}),i.current):E.jsx("span",{ref:c=>{c&&o(c)}})},PP=e=>{const{children:t,containerRef:r,appendToParentPortal:n}=e,o=r.current,i=o??(typeof window<"u"?document.body:void 0),a=S.useMemo(()=>{const l=o==null?void 0:o.ownerDocument.createElement("div");return l&&(l.className=Xh),l},[o]),[,s]=S.useState({});return Bl(()=>s({}),[]),Bl(()=>{if(!(!a||!i))return i.appendChild(a),()=>{i.removeChild(a)}},[a,i]),i&&a?Nh.createPortal(E.jsx(bb,{value:n?a:null,children:t}),a):null};function ja(e){const t={appendToParentPortal:!0,...e},{containerRef:r,...n}=t;return r?E.jsx(PP,{containerRef:r,...n}):E.jsx(_P,{...n})}ja.className=Xh;ja.selector=kP;ja.displayName="Portal";function TP(){const e=S.useContext(wa);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return e}var zu=S.createContext({});zu.displayName="ColorModeContext";function Qh(){const e=S.useContext(zu);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}var ks={light:"chakra-ui-light",dark:"chakra-ui-dark"};function EP(e={}){const{preventTransition:t=!0}=e,r={setDataset:n=>{const o=t?r.preventTransition():void 0;document.documentElement.dataset.theme=n,document.documentElement.style.colorScheme=n,o==null||o()},setClassName(n){document.body.classList.add(n?ks.dark:ks.light),document.body.classList.remove(n?ks.light:ks.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(n){var o;return((o=r.query().matches)!=null?o:n==="dark")?"dark":"light"},addListener(n){const o=r.query(),i=a=>{n(a.matches?"dark":"light")};return typeof o.addListener=="function"?o.addListener(i):o.addEventListener("change",i),()=>{typeof o.removeListener=="function"?o.removeListener(i):o.removeEventListener("change",i)}},preventTransition(){const n=document.createElement("style");return n.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(n),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(n)})})}}};return r}var $P="chakra-ui-color-mode";function AP(e){return{ssr:!1,type:"localStorage",get(t){if(!(globalThis!=null&&globalThis.document))return t;let r;try{r=localStorage.getItem(e)||t}catch{}return r||t},set(t){try{localStorage.setItem(e,t)}catch{}}}}var RP=AP($P),jl=()=>{};function Cv(e,t){return e.type==="cookie"&&e.ssr?e.get(t):t}function Sb(e){const{value:t,children:r,options:{useSystemColorMode:n,initialColorMode:o,disableTransitionOnChange:i}={},colorModeManager:a=RP}=e,s=o==="dark"?"dark":"light",[l,u]=S.useState(()=>Cv(a,s)),[c,d]=S.useState(()=>Cv(a)),{getSystemTheme:f,setClassName:p,setDataset:v,addListener:y}=S.useMemo(()=>EP({preventTransition:i}),[i]),x=o==="system"&&!l?c:l,m=S.useCallback(C=>{const _=C==="system"?f():C;u(_),p(_==="dark"),v(_),a.set(_)},[a,f,p,v]);Bl(()=>{o==="system"&&d(f())},[]),S.useEffect(()=>{const C=a.get();if(C){m(C);return}if(o==="system"){m("system");return}m(s)},[a,s,o,m]);const h=S.useCallback(()=>{m(x==="dark"?"light":"dark")},[x,m]);S.useEffect(()=>{if(n)return y(m)},[n,y,m]);const g=S.useMemo(()=>({colorMode:t??x,toggleColorMode:t?jl:h,setColorMode:t?jl:m,forced:t!==void 0}),[x,h,m,t]);return E.jsx(zu.Provider,{value:g,children:r})}Sb.displayName="ColorModeProvider";function xb(e){const t=S.useMemo(()=>({colorMode:"dark",toggleColorMode:jl,setColorMode:jl,forced:!0}),[]);return E.jsx(zu.Provider,{value:t,...e})}xb.displayName="DarkMode";var MP=new Set(["dark","light","system"]);function zP(e){let t=e;return MP.has(t)||(t="light"),t}function FP(e={}){const{initialColorMode:t="light",type:r="localStorage",storageKey:n="chakra-ui-color-mode"}=e,o=zP(t),i=r==="cookie",a=`(function(){try{var a=function(o){var l="(prefers-color-scheme: dark)",v=window.matchMedia(l).matches?"dark":"light",e=o==="system"?v:o,d=document.documentElement,m=document.body,i="chakra-ui-light",n="chakra-ui-dark",s=e==="dark";return m.classList.add(s?n:i),m.classList.remove(s?i:n),d.style.colorScheme=e,d.dataset.theme=e,e},u=a,h="${o}",r="${n}",t=document.cookie.match(new RegExp("(^| )".concat(r,"=([^;]+)"))),c=t?t[2]:null;c?a(c):document.cookie="".concat(r,"=").concat(a(h),"; max-age=31536000; path=/")}catch(a){}})(); - `,s=`(function(){try{var a=function(c){var v="(prefers-color-scheme: dark)",h=window.matchMedia(v).matches?"dark":"light",r=c==="system"?h:c,o=document.documentElement,s=document.body,l="chakra-ui-light",d="chakra-ui-dark",i=r==="dark";return s.classList.add(i?d:l),s.classList.remove(i?l:d),o.style.colorScheme=r,o.dataset.theme=r,r},n=a,m="${o}",e="${n}",t=localStorage.getItem(e);t?a(t):localStorage.setItem(e,a(m))}catch(a){}})(); - `;return`!${i?a:s}`.trim()}function DP(e={}){const{nonce:t}=e;return E.jsx("script",{id:"chakra-script",nonce:t,dangerouslySetInnerHTML:{__html:FP(e)}})}function IP(){const e=Qh(),t=TP();return{...e,theme:t}}function LP(e,t,r){var n,o;if(t==null)return t;const i=a=>{var s,l;return(l=(s=e.__breakpoints)==null?void 0:s.asArray)==null?void 0:l[a]};return(o=(n=i(t))!=null?n:i(r))!=null?o:r}function OP(e,t,r){var n,o;if(t==null)return t;const i=a=>{var s,l;return(l=(s=e.__cssMap)==null?void 0:s[a])==null?void 0:l.value};return(o=(n=i(t))!=null?n:i(r))!=null?o:r}function pB(e,t,r){const n=Array.isArray(t)?t:[t],o=Array.isArray(r)?r:[r];return i=>{const a=o.filter(Boolean),s=n.map((l,u)=>{var c,d;if(e==="breakpoints")return LP(i,l,(c=a[u])!=null?c:l);const f=`${e}.${l}`;return OP(i,f,(d=a[u])!=null?d:l)});return Array.isArray(t)?s:s[0]}}var Be=(...e)=>e.filter(Boolean).join(" ");function Kt(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}function lr(e,...t){return BP(e)?e(...t):e}var BP=e=>typeof e=="function",_v=e=>e?"":void 0,mB=e=>e?!0:void 0;function Ei(...e){return function(r){e.some(n=>(n==null||n(r),r==null?void 0:r.defaultPrevented))}}function vB(...e){return function(r){e.forEach(n=>{n==null||n(r)})}}var Nl={exports:{}};Nl.exports;(function(e,t){var r=200,n="__lodash_hash_undefined__",o=800,i=16,a=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",p="[object Function]",v="[object GeneratorFunction]",y="[object Map]",x="[object Number]",m="[object Null]",h="[object Object]",g="[object Proxy]",C="[object RegExp]",_="[object Set]",$="[object String]",T="[object Undefined]",A="[object WeakMap]",M="[object ArrayBuffer]",I="[object DataView]",ee="[object Float32Array]",ze="[object Float64Array]",Pe="[object Int8Array]",oe="[object Int16Array]",ue="[object Int32Array]",He="[object Uint8Array]",it="[object Uint8ClampedArray]",z="[object Uint16Array]",N="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,B=/^\[object .+?Constructor\]$/,ne=/^(?:0|[1-9]\d*)$/,U={};U[ee]=U[ze]=U[Pe]=U[oe]=U[ue]=U[He]=U[it]=U[z]=U[N]=!0,U[s]=U[l]=U[M]=U[c]=U[I]=U[d]=U[f]=U[p]=U[y]=U[x]=U[h]=U[C]=U[_]=U[$]=U[A]=!1;var Ge=typeof os=="object"&&os&&os.Object===Object&&os,Xt=typeof self=="object"&&self&&self.Object===Object&&self,we=Ge||Xt||Function("return this")(),Fe=t&&!t.nodeType&&t,mt=Fe&&!0&&e&&!e.nodeType&&e,Qt=mt&&mt.exports===Fe,Ot=Qt&&Ge.process,qt=function(){try{var b=mt&&mt.require&&mt.require("util").types;return b||Ot&&Ot.binding&&Ot.binding("util")}catch{}}(),ai=qt&&qt.isTypedArray;function Xa(b,w,P){switch(P.length){case 0:return b.call(w);case 1:return b.call(w,P[0]);case 2:return b.call(w,P[0],P[1]);case 3:return b.call(w,P[0],P[1],P[2])}return b.apply(w,P)}function Fw(b,w){for(var P=-1,F=Array(b);++P-1}function rk(b,w){var P=this.__data__,F=es(P,b);return F<0?(++this.size,P.push([b,w])):P[F][1]=w,this}vr.prototype.clear=Zw,vr.prototype.delete=Jw,vr.prototype.get=ek,vr.prototype.has=tk,vr.prototype.set=rk;function qn(b){var w=-1,P=b==null?0:b.length;for(this.clear();++w1?P[K-1]:void 0,he=K>2?P[2]:void 0;for(ie=b.length>3&&typeof ie=="function"?(K--,ie):void 0,he&&Rk(P[0],P[1],he)&&(ie=K<3?void 0:ie,K=1),w=Object(w);++F-1&&b%1==0&&b0){if(++w>=o)return arguments[0]}else w=0;return b.apply(void 0,arguments)}}function Bk(b){if(b!=null){try{return qa.call(b)}catch{}try{return b+""}catch{}}return""}function ns(b,w){return b===w||b!==b&&w!==w}var ec=Xp(function(){return arguments}())?Xp:function(b){return li(b)&&mr.call(b,"callee")&&!Vw.call(b,"callee")},tc=Array.isArray;function rc(b){return b!=null&&em(b.length)&&!nc(b)}function jk(b){return li(b)&&rc(b)}var Jp=Uw||Hk;function nc(b){if(!bn(b))return!1;var w=ts(b);return w==p||w==v||w==u||w==g}function em(b){return typeof b=="number"&&b>-1&&b%1==0&&b<=a}function bn(b){var w=typeof b;return b!=null&&(w=="object"||w=="function")}function li(b){return b!=null&&typeof b=="object"}function Nk(b){if(!li(b)||ts(b)!=h)return!1;var w=Hp(b);if(w===null)return!0;var P=mr.call(w,"constructor")&&w.constructor;return typeof P=="function"&&P instanceof P&&qa.call(P)==jw}var tm=ai?Dw(ai):gk;function Vk(b){return Pk(b,rm(b))}function rm(b){return rc(b)?hk(b,!0):yk(b)}var Wk=Tk(function(b,w,P,F){Qp(b,w,P,F)});function Uk(b){return function(){return b}}function nm(b){return b}function Hk(){return!1}e.exports=Wk})(Nl,Nl.exports);var jP=Nl.exports;const Ft=Gf(jP);var NP=e=>/!(important)?$/.test(e),Pv=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,VP=(e,t)=>r=>{const n=String(t),o=NP(n),i=Pv(n),a=e?`${e}.${i}`:i;let s=Kt(r.__cssMap)&&a in r.__cssMap?r.__cssMap[a].varRef:t;return s=Pv(s),o?`${s} !important`:s};function qh(e){const{scale:t,transform:r,compose:n}=e;return(i,a)=>{var s;const l=VP(t,i)(a);let u=(s=r==null?void 0:r(l,a))!=null?s:l;return n&&(u=n(u,a)),u}}var Cs=(...e)=>t=>e.reduce((r,n)=>n(r),t);function Et(e,t){return r=>{const n={property:r,scale:e};return n.transform=qh({scale:e,transform:t}),n}}var WP=({rtl:e,ltr:t})=>r=>r.direction==="rtl"?e:t;function UP(e){const{property:t,scale:r,transform:n}=e;return{scale:r,property:WP(t),transform:r?qh({scale:r,compose:n}):n}}var wb=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function HP(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...wb].join(" ")}function GP(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...wb].join(" ")}var KP={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},YP={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function XP(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var QP={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},hf={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},qP=new Set(Object.values(hf)),pf=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),ZP=e=>e.trim();function JP(e,t){if(e==null||pf.has(e))return e;if(!(mf(e)||pf.has(e)))return`url('${e}')`;const o=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),i=o==null?void 0:o[1],a=o==null?void 0:o[2];if(!i||!a)return e;const s=i.includes("-gradient")?i:`${i}-gradient`,[l,...u]=a.split(",").map(ZP).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in hf?hf[l]:l;u.unshift(c);const d=u.map(f=>{if(qP.has(f))return f;const p=f.indexOf(" "),[v,y]=p!==-1?[f.substr(0,p),f.substr(p+1)]:[f],x=mf(y)?y:y&&y.split(" "),m=`colors.${v}`,h=m in t.__cssMap?t.__cssMap[m].varRef:v;return x?[h,...Array.isArray(x)?x:[x]].join(" "):h});return`${s}(${d.join(", ")})`}var mf=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),eT=(e,t)=>JP(e,t??{});function tT(e){return/^var\(--.+\)$/.test(e)}var rT=e=>{const t=parseFloat(e.toString()),r=e.toString().replace(String(t),"");return{unitless:!r,value:t,unit:r}},Jt=e=>t=>`${e}(${t})`,G={filter(e){return e!=="auto"?e:KP},backdropFilter(e){return e!=="auto"?e:YP},ring(e){return XP(G.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?HP():e==="auto-gpu"?GP():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=rT(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const r={left:"right",right:"left"};return t.direction==="rtl"?r[e]:e},degree(e){if(tT(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:eT,blur:Jt("blur"),opacity:Jt("opacity"),brightness:Jt("brightness"),contrast:Jt("contrast"),dropShadow:Jt("drop-shadow"),grayscale:Jt("grayscale"),hueRotate:e=>Jt("hue-rotate")(G.degree(e)),invert:Jt("invert"),saturate:Jt("saturate"),sepia:Jt("sepia"),bgImage(e){return e==null||mf(e)||pf.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:r,divide:n}=(t=QP[e])!=null?t:{},o={flexDirection:e};return r&&(o[r]=1),n&&(o[n]=1),o}},k={borderWidths:Et("borderWidths"),borderStyles:Et("borderStyles"),colors:Et("colors"),borders:Et("borders"),gradients:Et("gradients",G.gradient),radii:Et("radii",G.px),space:Et("space",Cs(G.vh,G.px)),spaceT:Et("space",Cs(G.vh,G.px)),degreeT(e){return{property:e,transform:G.degree}},prop(e,t,r){return{property:e,scale:t,...t&&{transform:qh({scale:t,transform:r})}}},propT(e,t){return{property:e,transform:t}},sizes:Et("sizes",Cs(G.vh,G.px)),sizesT:Et("sizes",Cs(G.vh,G.fraction)),shadows:Et("shadows"),logical:UP,blur:Et("blur",G.blur)},el={background:k.colors("background"),backgroundColor:k.colors("backgroundColor"),backgroundImage:k.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:G.bgClip},bgSize:k.prop("backgroundSize"),bgPosition:k.prop("backgroundPosition"),bg:k.colors("background"),bgColor:k.colors("backgroundColor"),bgPos:k.prop("backgroundPosition"),bgRepeat:k.prop("backgroundRepeat"),bgAttachment:k.prop("backgroundAttachment"),bgGradient:k.gradients("backgroundImage"),bgClip:{transform:G.bgClip}};Object.assign(el,{bgImage:el.backgroundImage,bgImg:el.backgroundImage});var X={border:k.borders("border"),borderWidth:k.borderWidths("borderWidth"),borderStyle:k.borderStyles("borderStyle"),borderColor:k.colors("borderColor"),borderRadius:k.radii("borderRadius"),borderTop:k.borders("borderTop"),borderBlockStart:k.borders("borderBlockStart"),borderTopLeftRadius:k.radii("borderTopLeftRadius"),borderStartStartRadius:k.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:k.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:k.radii("borderTopRightRadius"),borderStartEndRadius:k.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:k.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:k.borders("borderRight"),borderInlineEnd:k.borders("borderInlineEnd"),borderBottom:k.borders("borderBottom"),borderBlockEnd:k.borders("borderBlockEnd"),borderBottomLeftRadius:k.radii("borderBottomLeftRadius"),borderBottomRightRadius:k.radii("borderBottomRightRadius"),borderLeft:k.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:k.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:k.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:k.borders(["borderLeft","borderRight"]),borderInline:k.borders("borderInline"),borderY:k.borders(["borderTop","borderBottom"]),borderBlock:k.borders("borderBlock"),borderTopWidth:k.borderWidths("borderTopWidth"),borderBlockStartWidth:k.borderWidths("borderBlockStartWidth"),borderTopColor:k.colors("borderTopColor"),borderBlockStartColor:k.colors("borderBlockStartColor"),borderTopStyle:k.borderStyles("borderTopStyle"),borderBlockStartStyle:k.borderStyles("borderBlockStartStyle"),borderBottomWidth:k.borderWidths("borderBottomWidth"),borderBlockEndWidth:k.borderWidths("borderBlockEndWidth"),borderBottomColor:k.colors("borderBottomColor"),borderBlockEndColor:k.colors("borderBlockEndColor"),borderBottomStyle:k.borderStyles("borderBottomStyle"),borderBlockEndStyle:k.borderStyles("borderBlockEndStyle"),borderLeftWidth:k.borderWidths("borderLeftWidth"),borderInlineStartWidth:k.borderWidths("borderInlineStartWidth"),borderLeftColor:k.colors("borderLeftColor"),borderInlineStartColor:k.colors("borderInlineStartColor"),borderLeftStyle:k.borderStyles("borderLeftStyle"),borderInlineStartStyle:k.borderStyles("borderInlineStartStyle"),borderRightWidth:k.borderWidths("borderRightWidth"),borderInlineEndWidth:k.borderWidths("borderInlineEndWidth"),borderRightColor:k.colors("borderRightColor"),borderInlineEndColor:k.colors("borderInlineEndColor"),borderRightStyle:k.borderStyles("borderRightStyle"),borderInlineEndStyle:k.borderStyles("borderInlineEndStyle"),borderTopRadius:k.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:k.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:k.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:k.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(X,{rounded:X.borderRadius,roundedTop:X.borderTopRadius,roundedTopLeft:X.borderTopLeftRadius,roundedTopRight:X.borderTopRightRadius,roundedTopStart:X.borderStartStartRadius,roundedTopEnd:X.borderStartEndRadius,roundedBottom:X.borderBottomRadius,roundedBottomLeft:X.borderBottomLeftRadius,roundedBottomRight:X.borderBottomRightRadius,roundedBottomStart:X.borderEndStartRadius,roundedBottomEnd:X.borderEndEndRadius,roundedLeft:X.borderLeftRadius,roundedRight:X.borderRightRadius,roundedStart:X.borderInlineStartRadius,roundedEnd:X.borderInlineEndRadius,borderStart:X.borderInlineStart,borderEnd:X.borderInlineEnd,borderTopStartRadius:X.borderStartStartRadius,borderTopEndRadius:X.borderStartEndRadius,borderBottomStartRadius:X.borderEndStartRadius,borderBottomEndRadius:X.borderEndEndRadius,borderStartRadius:X.borderInlineStartRadius,borderEndRadius:X.borderInlineEndRadius,borderStartWidth:X.borderInlineStartWidth,borderEndWidth:X.borderInlineEndWidth,borderStartColor:X.borderInlineStartColor,borderEndColor:X.borderInlineEndColor,borderStartStyle:X.borderInlineStartStyle,borderEndStyle:X.borderInlineEndStyle});var nT={color:k.colors("color"),textColor:k.colors("color"),fill:k.colors("fill"),stroke:k.colors("stroke")},vf={boxShadow:k.shadows("boxShadow"),mixBlendMode:!0,blendMode:k.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:k.prop("backgroundBlendMode"),opacity:!0};Object.assign(vf,{shadow:vf.boxShadow});var oT={filter:{transform:G.filter},blur:k.blur("--chakra-blur"),brightness:k.propT("--chakra-brightness",G.brightness),contrast:k.propT("--chakra-contrast",G.contrast),hueRotate:k.propT("--chakra-hue-rotate",G.hueRotate),invert:k.propT("--chakra-invert",G.invert),saturate:k.propT("--chakra-saturate",G.saturate),dropShadow:k.propT("--chakra-drop-shadow",G.dropShadow),backdropFilter:{transform:G.backdropFilter},backdropBlur:k.blur("--chakra-backdrop-blur"),backdropBrightness:k.propT("--chakra-backdrop-brightness",G.brightness),backdropContrast:k.propT("--chakra-backdrop-contrast",G.contrast),backdropHueRotate:k.propT("--chakra-backdrop-hue-rotate",G.hueRotate),backdropInvert:k.propT("--chakra-backdrop-invert",G.invert),backdropSaturate:k.propT("--chakra-backdrop-saturate",G.saturate)},Vl={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:G.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:k.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:k.space("gap"),rowGap:k.space("rowGap"),columnGap:k.space("columnGap")};Object.assign(Vl,{flexDir:Vl.flexDirection});var kb={gridGap:k.space("gridGap"),gridColumnGap:k.space("gridColumnGap"),gridRowGap:k.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},iT={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:G.outline},outlineOffset:!0,outlineColor:k.colors("outlineColor")},At={width:k.sizesT("width"),inlineSize:k.sizesT("inlineSize"),height:k.sizes("height"),blockSize:k.sizes("blockSize"),boxSize:k.sizes(["width","height"]),minWidth:k.sizes("minWidth"),minInlineSize:k.sizes("minInlineSize"),minHeight:k.sizes("minHeight"),minBlockSize:k.sizes("minBlockSize"),maxWidth:k.sizes("maxWidth"),maxInlineSize:k.sizes("maxInlineSize"),maxHeight:k.sizes("maxHeight"),maxBlockSize:k.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var r,n,o;return{[`@media screen and (min-width: ${(o=(n=(r=t.__breakpoints)==null?void 0:r.get(e))==null?void 0:n.minW)!=null?o:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var r,n,o;return{[`@media screen and (max-width: ${(o=(n=(r=t.__breakpoints)==null?void 0:r.get(e))==null?void 0:n._minW)!=null?o:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:k.propT("float",G.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(At,{w:At.width,h:At.height,minW:At.minWidth,maxW:At.maxWidth,minH:At.minHeight,maxH:At.maxHeight,overscroll:At.overscrollBehavior,overscrollX:At.overscrollBehaviorX,overscrollY:At.overscrollBehaviorY});var aT={listStyleType:!0,listStylePosition:!0,listStylePos:k.prop("listStylePosition"),listStyleImage:!0,listStyleImg:k.prop("listStyleImage")};function sT(e,t,r,n){const o=typeof t=="string"?t.split("."):[t];for(n=0;n{const t=new WeakMap;return(n,o,i,a)=>{if(typeof n>"u")return e(n,o,i);t.has(n)||t.set(n,new Map);const s=t.get(n);if(s.has(o))return s.get(o);const l=e(n,o,i,a);return s.set(o,l),l}},uT=lT(sT),cT={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},dT={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},zc=(e,t,r)=>{const n={},o=uT(e,t,{});for(const i in o)i in r&&r[i]!=null||(n[i]=o[i]);return n},fT={srOnly:{transform(e){return e===!0?cT:e==="focusable"?dT:{}}},layerStyle:{processResult:!0,transform:(e,t,r)=>zc(t,`layerStyles.${e}`,r)},textStyle:{processResult:!0,transform:(e,t,r)=>zc(t,`textStyles.${e}`,r)},apply:{processResult:!0,transform:(e,t,r)=>zc(t,e,r)}},Gi={position:!0,pos:k.prop("position"),zIndex:k.prop("zIndex","zIndices"),inset:k.spaceT("inset"),insetX:k.spaceT(["left","right"]),insetInline:k.spaceT("insetInline"),insetY:k.spaceT(["top","bottom"]),insetBlock:k.spaceT("insetBlock"),top:k.spaceT("top"),insetBlockStart:k.spaceT("insetBlockStart"),bottom:k.spaceT("bottom"),insetBlockEnd:k.spaceT("insetBlockEnd"),left:k.spaceT("left"),insetInlineStart:k.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:k.spaceT("right"),insetInlineEnd:k.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Gi,{insetStart:Gi.insetInlineStart,insetEnd:Gi.insetInlineEnd});var hT={ring:{transform:G.ring},ringColor:k.colors("--chakra-ring-color"),ringOffset:k.prop("--chakra-ring-offset-width"),ringOffsetColor:k.colors("--chakra-ring-offset-color"),ringInset:k.prop("--chakra-ring-inset")},de={margin:k.spaceT("margin"),marginTop:k.spaceT("marginTop"),marginBlockStart:k.spaceT("marginBlockStart"),marginRight:k.spaceT("marginRight"),marginInlineEnd:k.spaceT("marginInlineEnd"),marginBottom:k.spaceT("marginBottom"),marginBlockEnd:k.spaceT("marginBlockEnd"),marginLeft:k.spaceT("marginLeft"),marginInlineStart:k.spaceT("marginInlineStart"),marginX:k.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:k.spaceT("marginInline"),marginY:k.spaceT(["marginTop","marginBottom"]),marginBlock:k.spaceT("marginBlock"),padding:k.space("padding"),paddingTop:k.space("paddingTop"),paddingBlockStart:k.space("paddingBlockStart"),paddingRight:k.space("paddingRight"),paddingBottom:k.space("paddingBottom"),paddingBlockEnd:k.space("paddingBlockEnd"),paddingLeft:k.space("paddingLeft"),paddingInlineStart:k.space("paddingInlineStart"),paddingInlineEnd:k.space("paddingInlineEnd"),paddingX:k.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:k.space("paddingInline"),paddingY:k.space(["paddingTop","paddingBottom"]),paddingBlock:k.space("paddingBlock")};Object.assign(de,{m:de.margin,mt:de.marginTop,mr:de.marginRight,me:de.marginInlineEnd,marginEnd:de.marginInlineEnd,mb:de.marginBottom,ml:de.marginLeft,ms:de.marginInlineStart,marginStart:de.marginInlineStart,mx:de.marginX,my:de.marginY,p:de.padding,pt:de.paddingTop,py:de.paddingY,px:de.paddingX,pb:de.paddingBottom,pl:de.paddingLeft,ps:de.paddingInlineStart,paddingStart:de.paddingInlineStart,pr:de.paddingRight,pe:de.paddingInlineEnd,paddingEnd:de.paddingInlineEnd});var pT={textDecorationColor:k.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:k.shadows("textShadow")},mT={clipPath:!0,transform:k.propT("transform",G.transform),transformOrigin:!0,translateX:k.spaceT("--chakra-translate-x"),translateY:k.spaceT("--chakra-translate-y"),skewX:k.degreeT("--chakra-skew-x"),skewY:k.degreeT("--chakra-skew-y"),scaleX:k.prop("--chakra-scale-x"),scaleY:k.prop("--chakra-scale-y"),scale:k.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:k.degreeT("--chakra-rotate")},vT={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:k.prop("transitionDuration","transition.duration"),transitionProperty:k.prop("transitionProperty","transition.property"),transitionTimingFunction:k.prop("transitionTimingFunction","transition.easing")},gT={fontFamily:k.prop("fontFamily","fonts"),fontSize:k.prop("fontSize","fontSizes",G.px),fontWeight:k.prop("fontWeight","fontWeights"),lineHeight:k.prop("lineHeight","lineHeights"),letterSpacing:k.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},yT={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:k.spaceT("scrollMargin"),scrollMarginTop:k.spaceT("scrollMarginTop"),scrollMarginBottom:k.spaceT("scrollMarginBottom"),scrollMarginLeft:k.spaceT("scrollMarginLeft"),scrollMarginRight:k.spaceT("scrollMarginRight"),scrollMarginX:k.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:k.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:k.spaceT("scrollPadding"),scrollPaddingTop:k.spaceT("scrollPaddingTop"),scrollPaddingBottom:k.spaceT("scrollPaddingBottom"),scrollPaddingLeft:k.spaceT("scrollPaddingLeft"),scrollPaddingRight:k.spaceT("scrollPaddingRight"),scrollPaddingX:k.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:k.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function Cb(e){return Kt(e)&&e.reference?e.reference:String(e)}var Fu=(e,...t)=>t.map(Cb).join(` ${e} `).replace(/calc/g,""),Tv=(...e)=>`calc(${Fu("+",...e)})`,Ev=(...e)=>`calc(${Fu("-",...e)})`,gf=(...e)=>`calc(${Fu("*",...e)})`,$v=(...e)=>`calc(${Fu("/",...e)})`,Av=e=>{const t=Cb(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:gf(t,-1)},Pn=Object.assign(e=>({add:(...t)=>Pn(Tv(e,...t)),subtract:(...t)=>Pn(Ev(e,...t)),multiply:(...t)=>Pn(gf(e,...t)),divide:(...t)=>Pn($v(e,...t)),negate:()=>Pn(Av(e)),toString:()=>e.toString()}),{add:Tv,subtract:Ev,multiply:gf,divide:$v,negate:Av});function bT(e,t="-"){return e.replace(/\s+/g,t)}function ST(e){const t=bT(e.toString());return wT(xT(t))}function xT(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function wT(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function kT(e,t=""){return[t,e].filter(Boolean).join("-")}function CT(e,t){return`var(${e}${t?`, ${t}`:""})`}function _T(e,t=""){return ST(`--${kT(e,t)}`)}function O(e,t,r){const n=_T(e,r);return{variable:n,reference:CT(n,t)}}function PT(e,t){const r={};for(const n of t){if(Array.isArray(n)){const[o,i]=n;r[o]=O(`${e}-${o}`,i);continue}r[n]=O(`${e}-${n}`)}return r}function TT(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function ET(e){const t=parseFloat(e.toString()),r=e.toString().replace(String(t),"");return{unitless:!r,value:t,unit:r}}function yf(e){if(e==null)return e;const{unitless:t}=ET(e);return t||typeof e=="number"?`${e}px`:e}var _b=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,Zh=e=>Object.fromEntries(Object.entries(e).sort(_b));function Rv(e){const t=Zh(e);return Object.assign(Object.values(t),t)}function $T(e){const t=Object.keys(Zh(e));return new Set(t)}function Mv(e){var t;if(!e)return e;e=(t=yf(e))!=null?t:e;const r=-.02;return typeof e=="number"?`${e+r}`:e.replace(/(\d+\.?\d*)/u,n=>`${parseFloat(n)+r}`)}function $i(e,t){const r=["@media screen"];return e&&r.push("and",`(min-width: ${yf(e)})`),t&&r.push("and",`(max-width: ${yf(t)})`),r.join(" ")}function AT(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const r=Rv(e),n=Object.entries(e).sort(_b).map(([a,s],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?Mv(d):void 0,{_minW:Mv(s),breakpoint:a,minW:s,maxW:d,maxWQuery:$i(null,d),minWQuery:$i(s),minMaxQuery:$i(s,d)}}),o=$T(e),i=Array.from(o.values());return{keys:o,normalized:r,isResponsive(a){const s=Object.keys(a);return s.length>0&&s.every(l=>o.has(l))},asObject:Zh(e),asArray:Rv(e),details:n,get(a){return n.find(s=>s.breakpoint===a)},media:[null,...r.map(a=>$i(a)).slice(1)],toArrayValue(a){if(!Kt(a))throw new Error("toArrayValue: value must be an object");const s=i.map(l=>{var u;return(u=a[l])!=null?u:null});for(;TT(s)===null;)s.pop();return s},toObjectValue(a){if(!Array.isArray(a))throw new Error("toObjectValue: value must be an array");return a.reduce((s,l,u)=>{const c=i[u];return c!=null&&l!=null&&(s[c]=l),s},{})}}}var je={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},Br=e=>Pb(t=>e(t,"&"),"[role=group]","[data-group]",".group"),gr=e=>Pb(t=>e(t,"~ &"),"[data-peer]",".peer"),Pb=(e,...t)=>t.map(e).join(", "),Du={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:Br(je.hover),_peerHover:gr(je.hover),_groupFocus:Br(je.focus),_peerFocus:gr(je.focus),_groupFocusVisible:Br(je.focusVisible),_peerFocusVisible:gr(je.focusVisible),_groupActive:Br(je.active),_peerActive:gr(je.active),_groupDisabled:Br(je.disabled),_peerDisabled:gr(je.disabled),_groupInvalid:Br(je.invalid),_peerInvalid:gr(je.invalid),_groupChecked:Br(je.checked),_peerChecked:gr(je.checked),_groupFocusWithin:Br(je.focusWithin),_peerFocusWithin:gr(je.focusWithin),_peerPlaceholderShown:gr(je.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},Tb=Object.keys(Du);function zv(e,t){return O(String(e).replace(/\./g,"-"),void 0,t)}function RT(e,t){let r={};const n={};for(const[o,i]of Object.entries(e)){const{isSemantic:a,value:s}=i,{variable:l,reference:u}=zv(o,t==null?void 0:t.cssVarPrefix);if(!a){if(o.startsWith("space")){const f=o.split("."),[p,...v]=f,y=`${p}.-${v.join(".")}`,x=Pn.negate(s),m=Pn.negate(u);n[y]={value:x,var:l,varRef:m}}r[l]=s,n[o]={value:s,var:l,varRef:u};continue}const c=f=>{const v=[String(o).split(".")[0],f].join(".");if(!e[v])return f;const{reference:x}=zv(v,t==null?void 0:t.cssVarPrefix);return x},d=Kt(s)?s:{default:s};r=Ft(r,Object.entries(d).reduce((f,[p,v])=>{var y,x;if(!v)return f;const m=c(`${v}`);if(p==="default")return f[l]=m,f;const h=(x=(y=Du)==null?void 0:y[p])!=null?x:p;return f[h]={[l]:m},f},{})),n[o]={value:u,var:l,varRef:u}}return{cssVars:r,cssMap:n}}function MT(e,t=[]){const r=Object.assign({},e);for(const n of t)n in r&&delete r[n];return r}function zT(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r}function FT(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function Fv(e,t,r={}){const{stop:n,getKey:o}=r;function i(a,s=[]){var l;if(FT(a)||Array.isArray(a)){const u={};for(const[c,d]of Object.entries(a)){const f=(l=o==null?void 0:o(c))!=null?l:c,p=[...s,f];if(n!=null&&n(a,p))return t(a,s);u[f]=i(d,p)}return u}return t(a,s)}return i(e)}var DT=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function IT(e){return zT(e,DT)}function LT(e){return e.semanticTokens}function OT(e){const{__cssMap:t,__cssVars:r,__breakpoints:n,...o}=e;return o}var BT=e=>Tb.includes(e)||e==="default";function jT({tokens:e,semanticTokens:t}){const r={};return Fv(e,(n,o)=>{n!=null&&(r[o.join(".")]={isSemantic:!1,value:n})}),Fv(t,(n,o)=>{n!=null&&(r[o.join(".")]={isSemantic:!0,value:n})},{stop:n=>Object.keys(n).every(BT)}),r}function NT(e){var t;const r=OT(e),n=IT(r),o=LT(r),i=jT({tokens:n,semanticTokens:o}),a=(t=r.config)==null?void 0:t.cssVarPrefix,{cssMap:s,cssVars:l}=RT(i,{cssVarPrefix:a});return Object.assign(r,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:s,__breakpoints:AT(r.breakpoints)}),r}var Jh=Ft({},el,X,nT,Vl,At,oT,hT,iT,kb,fT,Gi,vf,de,yT,gT,pT,mT,aT,vT),VT=Object.assign({},de,At,Vl,kb,Gi),gB=Object.keys(VT),WT=[...Object.keys(Jh),...Tb],UT={...Jh,...Du},HT=e=>e in UT,GT=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:r,toArrayValue:n,media:o}=t.__breakpoints,i={};for(const a in e){let s=lr(e[a],t);if(s==null)continue;if(s=Kt(s)&&r(s)?n(s):s,!Array.isArray(s)){i[a]=s;continue}const l=s.slice(0,o.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!YT(t),QT=(e,t)=>{var r,n;if(t==null)return t;const o=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},i=l=>{var u;return(u=o(l))!=null?u:l},[a,s]=KT(t);return t=(n=(r=o(a))!=null?r:i(s))!=null?n:i(t),t};function qT(e){const{configs:t={},pseudos:r={},theme:n}=e,o=(i,a=!1)=>{var s,l,u;const c=lr(i,n),d=GT(c)(n);let f={};for(let p in d){const v=d[p];let y=lr(v,n);p in r&&(p=r[p]),XT(p,y)&&(y=QT(n,y));let x=t[p];if(x===!0&&(x={property:p}),Kt(y)){f[p]=(s=f[p])!=null?s:{},f[p]=Ft({},f[p],o(y,!0));continue}let m=(u=(l=x==null?void 0:x.transform)==null?void 0:l.call(x,y,n,c))!=null?u:y;m=x!=null&&x.processResult?o(m,!0):m;const h=lr(x==null?void 0:x.property,n);if(!a&&(x!=null&&x.static)){const g=lr(x.static,n);f=Ft({},f,g)}if(h&&Array.isArray(h)){for(const g of h)f[g]=m;continue}if(h){h==="&"&&Kt(m)?f=Ft({},f,m):f[h]=m;continue}if(Kt(m)){f=Ft({},f,m);continue}f[p]=m}return f};return o}var Eb=e=>t=>qT({theme:t,pseudos:Du,configs:Jh})(e);function le(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function ZT(e,t){if(Array.isArray(e))return e;if(Kt(e))return t(e);if(e!=null)return[e]}function JT(e,t){for(let r=t+1;r{Ft(u,{[g]:f?h[g]:{[m]:h[g]}})});continue}if(!p){f?Ft(u,h):u[m]=h;continue}u[m]=h}}return u}}function tE(e){return t=>{var r;const{variant:n,size:o,theme:i}=t,a=eE(i);return Ft({},lr((r=e.baseStyle)!=null?r:{},t),a(e,"sizes",o,t),a(e,"variants",n,t))}}function yB(e,t,r){var n,o,i;return(i=(o=(n=e.__cssMap)==null?void 0:n[`${t}.${r}`])==null?void 0:o.varRef)!=null?i:r}function Iu(e){return MT(e,["styleConfig","size","variant","colorScheme"])}var rE=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function nE(e){return Kt(e)?rE.every(t=>Object.prototype.hasOwnProperty.call(e,t)):!1}var oE={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},iE={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},aE={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},sE={property:oE,easing:iE,duration:aE},lE=sE,uE={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},cE=uE,dE={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},fE=dE,hE={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},pE=hE,mE={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},vE=mE,gE={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},yE=gE,bE={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},SE=bE,xE={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},wE=xE,kE={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},$b=kE,Ab={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},CE={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},_E={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},PE={...Ab,...CE,container:_E},Rb=PE,TE={breakpoints:pE,zIndices:cE,radii:yE,blur:wE,colors:vE,...$b,sizes:Rb,shadows:SE,space:Ab,borders:fE,transition:lE},{defineMultiStyleConfig:EE,definePartsStyle:Ai}=le(["stepper","step","title","description","indicator","separator","icon","number"]),Sr=O("stepper-indicator-size"),go=O("stepper-icon-size"),yo=O("stepper-title-font-size"),Ri=O("stepper-description-font-size"),bi=O("stepper-accent-color"),$E=Ai(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[bi.variable]:`colors.${e}.500`,_dark:{[bi.variable]:`colors.${e}.200`}},title:{fontSize:yo.reference,fontWeight:"medium"},description:{fontSize:Ri.reference,color:"chakra-subtle-text"},number:{fontSize:yo.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:go.reference,height:go.reference},indicator:{flexShrink:0,borderRadius:"full",width:Sr.reference,height:Sr.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:bi.reference},"&[data-status=complete]":{bg:bi.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:bi.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${Sr.reference} - 8px)`,top:`calc(${Sr.reference} + 4px)`,insetStart:`calc(${Sr.reference} / 2 - 1px)`}}})),AE=EE({baseStyle:$E,sizes:{xs:Ai({stepper:{[Sr.variable]:"sizes.4",[go.variable]:"sizes.3",[yo.variable]:"fontSizes.xs",[Ri.variable]:"fontSizes.xs"}}),sm:Ai({stepper:{[Sr.variable]:"sizes.6",[go.variable]:"sizes.4",[yo.variable]:"fontSizes.sm",[Ri.variable]:"fontSizes.xs"}}),md:Ai({stepper:{[Sr.variable]:"sizes.8",[go.variable]:"sizes.5",[yo.variable]:"fontSizes.md",[Ri.variable]:"fontSizes.sm"}}),lg:Ai({stepper:{[Sr.variable]:"sizes.10",[go.variable]:"sizes.6",[yo.variable]:"fontSizes.lg",[Ri.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function J(e,t={}){let r=!1;function n(){if(!r){r=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function o(...c){n();for(const d of c)t[d]=l(d);return J(e,t)}function i(...c){for(const d of c)d in t||(t[d]=l(d));return J(e,t)}function a(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.selector]))}function s(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.className]))}function l(c){const p=`chakra-${(["container","root"].includes(c??"")?[e]:[e,c]).filter(Boolean).join("__")}`;return{className:p,selector:`.${p}`,toString:()=>c}}return{parts:o,toPart:l,extend:i,selectors:a,classnames:s,get keys(){return Object.keys(t)},__type:{}}}var RE=J("accordion").parts("root","container","button","panel").extend("icon"),ME=J("alert").parts("title","description","container").extend("icon","spinner"),zE=J("avatar").parts("label","badge","container").extend("excessLabel","group"),FE=J("breadcrumb").parts("link","item","container").extend("separator");J("button").parts();var DE=J("checkbox").parts("control","icon","container").extend("label");J("progress").parts("track","filledTrack").extend("label");var IE=J("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),LE=J("editable").parts("preview","input","textarea"),OE=J("form").parts("container","requiredIndicator","helperText"),BE=J("formError").parts("text","icon"),jE=J("input").parts("addon","field","element","group"),NE=J("list").parts("container","item","icon"),VE=J("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),WE=J("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),UE=J("numberinput").parts("root","field","stepperGroup","stepper");J("pininput").parts("field");var HE=J("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),GE=J("progress").parts("label","filledTrack","track"),KE=J("radio").parts("container","control","label"),YE=J("select").parts("field","icon"),XE=J("slider").parts("container","track","thumb","filledTrack","mark"),QE=J("stat").parts("container","label","helpText","number","icon"),qE=J("switch").parts("container","track","thumb","label"),ZE=J("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),JE=J("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),e$=J("tag").parts("container","label","closeButton"),t$=J("card").parts("container","header","body","footer");J("stepper").parts("stepper","step","title","description","indicator","separator","icon","number");function Rn(e,t,r){return Math.min(Math.max(e,r),t)}class r$ extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Mi=r$;function ep(e){if(typeof e!="string")throw new Mi(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=c$.test(e)?i$(e):e;const r=a$.exec(t);if(r){const a=Array.from(r).slice(1);return[...a.slice(0,3).map(s=>parseInt(ka(s,2),16)),parseInt(ka(a[3]||"f",2),16)/255]}const n=s$.exec(t);if(n){const a=Array.from(n).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,16)),parseInt(a[3]||"ff",16)/255]}const o=l$.exec(t);if(o){const a=Array.from(o).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,10)),parseFloat(a[3]||"1")]}const i=u$.exec(t);if(i){const[a,s,l,u]=Array.from(i).slice(1).map(parseFloat);if(Rn(0,100,s)!==s)throw new Mi(e);if(Rn(0,100,l)!==l)throw new Mi(e);return[...d$(a,s,l),Number.isNaN(u)?1:u]}throw new Mi(e)}function n$(e){let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return(t>>>0)%2341}const Dv=e=>parseInt(e.replace(/_/g,""),36),o$="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const r=Dv(t.substring(0,3)),n=Dv(t.substring(3)).toString(16);let o="";for(let i=0;i<6-n.length;i++)o+="0";return e[r]=`${o}${n}`,e},{});function i$(e){const t=e.toLowerCase().trim(),r=o$[n$(t)];if(!r)throw new Mi(e);return`#${r}`}const ka=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),a$=new RegExp(`^#${ka("([a-f0-9])",3)}([a-f0-9])?$`,"i"),s$=new RegExp(`^#${ka("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),l$=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${ka(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),u$=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,c$=/^[a-z]+$/i,Iv=e=>Math.round(e*255),d$=(e,t,r)=>{let n=r/100;if(t===0)return[n,n,n].map(Iv);const o=(e%360+360)%360/60,i=(1-Math.abs(2*n-1))*(t/100),a=i*(1-Math.abs(o%2-1));let s=0,l=0,u=0;o>=0&&o<1?(s=i,l=a):o>=1&&o<2?(s=a,l=i):o>=2&&o<3?(l=i,u=a):o>=3&&o<4?(l=a,u=i):o>=4&&o<5?(s=a,u=i):o>=5&&o<6&&(s=i,u=a);const c=n-i/2,d=s+c,f=l+c,p=u+c;return[d,f,p].map(Iv)};function f$(e,t,r,n){return`rgba(${Rn(0,255,e).toFixed()}, ${Rn(0,255,t).toFixed()}, ${Rn(0,255,r).toFixed()}, ${parseFloat(Rn(0,1,n).toFixed(3))})`}function h$(e,t){const[r,n,o,i]=ep(e);return f$(r,n,o,i-t)}function p$(e){const[t,r,n,o]=ep(e);let i=a=>{const s=Rn(0,255,a).toString(16);return s.length===1?`0${s}`:s};return`#${i(t)}${i(r)}${i(n)}${o<1?i(Math.round(o*255)):""}`}function m$(e,t,r,n,o){for(t=t.split?t.split("."):t,n=0;nObject.keys(e).length===0,et=(e,t,r)=>{const n=m$(e,`colors.${t}`,t);try{return p$(n),n}catch{return r??"#000000"}},g$=e=>{const[t,r,n]=ep(e);return(t*299+r*587+n*114)/1e3},y$=e=>t=>{const r=et(t,e);return g$(r)<128?"dark":"light"},b$=e=>t=>y$(e)(t)==="dark",Qo=(e,t)=>r=>{const n=et(r,e);return h$(n,1-t)};function Lv(e="1rem",t="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( - 45deg, - ${t} 25%, - transparent 25%, - transparent 50%, - ${t} 50%, - ${t} 75%, - transparent 75%, - transparent - )`,backgroundSize:`${e} ${e}`}}var S$=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function x$(e){const t=S$();return!e||v$(e)?t:e.string&&e.colors?k$(e.string,e.colors):e.string&&!e.colors?w$(e.string):e.colors&&!e.string?C$(e.colors):t}function w$(e){let t=0;if(e.length===0)return t.toString();for(let n=0;n>n*8&255;r+=`00${o.toString(16)}`.substr(-2)}return r}function k$(e,t){let r=0;if(e.length===0)return t[0];for(let n=0;nr.colorMode==="dark"?t:e}function tp(e){const{orientation:t,vertical:r,horizontal:n}=e;return t?t==="vertical"?r:n:{}}function Mb(e){return Kt(e)&&e.reference?e.reference:String(e)}var Lu=(e,...t)=>t.map(Mb).join(` ${e} `).replace(/calc/g,""),Ov=(...e)=>`calc(${Lu("+",...e)})`,Bv=(...e)=>`calc(${Lu("-",...e)})`,bf=(...e)=>`calc(${Lu("*",...e)})`,jv=(...e)=>`calc(${Lu("/",...e)})`,Nv=e=>{const t=Mb(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:bf(t,-1)},xr=Object.assign(e=>({add:(...t)=>xr(Ov(e,...t)),subtract:(...t)=>xr(Bv(e,...t)),multiply:(...t)=>xr(bf(e,...t)),divide:(...t)=>xr(jv(e,...t)),negate:()=>xr(Nv(e)),toString:()=>e.toString()}),{add:Ov,subtract:Bv,multiply:bf,divide:jv,negate:Nv});function _$(e){return!Number.isInteger(parseFloat(e.toString()))}function P$(e,t="-"){return e.replace(/\s+/g,t)}function zb(e){const t=P$(e.toString());return t.includes("\\.")?e:_$(e)?t.replace(".","\\."):e}function T$(e,t=""){return[t,zb(e)].filter(Boolean).join("-")}function E$(e,t){return`var(${zb(e)}${t?`, ${t}`:""})`}function $$(e,t=""){return`--${T$(e,t)}`}function Me(e,t){const r=$$(e,t==null?void 0:t.prefix);return{variable:r,reference:E$(r,A$(t==null?void 0:t.fallback))}}function A$(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:R$,definePartsStyle:tl}=le(qE.keys),Ki=Me("switch-track-width"),Dn=Me("switch-track-height"),Fc=Me("switch-track-diff"),M$=xr.subtract(Ki,Dn),Sf=Me("switch-thumb-x"),Si=Me("switch-bg"),z$=e=>{const{colorScheme:t}=e;return{borderRadius:"full",p:"0.5",width:[Ki.reference],height:[Dn.reference],transitionProperty:"common",transitionDuration:"fast",[Si.variable]:"colors.gray.300",_dark:{[Si.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[Si.variable]:`colors.${t}.500`,_dark:{[Si.variable]:`colors.${t}.200`}},bg:Si.reference}},F$={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[Dn.reference],height:[Dn.reference],_checked:{transform:`translateX(${Sf.reference})`}},D$=tl(e=>({container:{[Fc.variable]:M$,[Sf.variable]:Fc.reference,_rtl:{[Sf.variable]:xr(Fc).negate().toString()}},track:z$(e),thumb:F$})),I$={sm:tl({container:{[Ki.variable]:"1.375rem",[Dn.variable]:"sizes.3"}}),md:tl({container:{[Ki.variable]:"1.875rem",[Dn.variable]:"sizes.4"}}),lg:tl({container:{[Ki.variable]:"2.875rem",[Dn.variable]:"sizes.6"}})},L$=R$({baseStyle:D$,sizes:I$,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:O$,definePartsStyle:Do}=le(ZE.keys),B$=Do({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),Wl={"&[data-is-numeric=true]":{textAlign:"end"}},j$=Do(e=>{const{colorScheme:t}=e;return{th:{color:L("gray.600","gray.400")(e),borderBottom:"1px",borderColor:L(`${t}.100`,`${t}.700`)(e),...Wl},td:{borderBottom:"1px",borderColor:L(`${t}.100`,`${t}.700`)(e),...Wl},caption:{color:L("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),N$=Do(e=>{const{colorScheme:t}=e;return{th:{color:L("gray.600","gray.400")(e),borderBottom:"1px",borderColor:L(`${t}.100`,`${t}.700`)(e),...Wl},td:{borderBottom:"1px",borderColor:L(`${t}.100`,`${t}.700`)(e),...Wl},caption:{color:L("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:L(`${t}.100`,`${t}.700`)(e)},td:{background:L(`${t}.100`,`${t}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),V$={simple:j$,striped:N$,unstyled:{}},W$={sm:Do({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:Do({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:Do({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},U$=O$({baseStyle:B$,variants:V$,sizes:W$,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),st=O("tabs-color"),Ut=O("tabs-bg"),_s=O("tabs-border-color"),{defineMultiStyleConfig:H$,definePartsStyle:fr}=le(JE.keys),G$=e=>{const{orientation:t}=e;return{display:t==="vertical"?"flex":"block"}},K$=e=>{const{isFitted:t}=e;return{flex:t?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},Y$=e=>{const{align:t="start",orientation:r}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[t],flexDirection:r==="vertical"?"column":"row"}},X$={p:4},Q$=fr(e=>({root:G$(e),tab:K$(e),tablist:Y$(e),tabpanel:X$})),q$={sm:fr({tab:{py:1,px:4,fontSize:"sm"}}),md:fr({tab:{fontSize:"md",py:2,px:4}}),lg:fr({tab:{fontSize:"lg",py:3,px:4}})},Z$=fr(e=>{const{colorScheme:t,orientation:r}=e,n=r==="vertical",o=n?"borderStart":"borderBottom",i=n?"marginStart":"marginBottom";return{tablist:{[o]:"2px solid",borderColor:"inherit"},tab:{[o]:"2px solid",borderColor:"transparent",[i]:"-2px",_selected:{[st.variable]:`colors.${t}.600`,_dark:{[st.variable]:`colors.${t}.300`},borderColor:"currentColor"},_active:{[Ut.variable]:"colors.gray.200",_dark:{[Ut.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:st.reference,bg:Ut.reference}}}),J$=fr(e=>{const{colorScheme:t}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[_s.variable]:"transparent",_selected:{[st.variable]:`colors.${t}.600`,[_s.variable]:"colors.white",_dark:{[st.variable]:`colors.${t}.300`,[_s.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:_s.reference},color:st.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),e5=fr(e=>{const{colorScheme:t}=e;return{tab:{border:"1px solid",borderColor:"inherit",[Ut.variable]:"colors.gray.50",_dark:{[Ut.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[Ut.variable]:"colors.white",[st.variable]:`colors.${t}.600`,_dark:{[Ut.variable]:"colors.gray.800",[st.variable]:`colors.${t}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:st.reference,bg:Ut.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),t5=fr(e=>{const{colorScheme:t,theme:r}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:et(r,`${t}.700`),bg:et(r,`${t}.100`)}}}}),r5=fr(e=>{const{colorScheme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[st.variable]:"colors.gray.600",_dark:{[st.variable]:"inherit"},_selected:{[st.variable]:"colors.white",[Ut.variable]:`colors.${t}.600`,_dark:{[st.variable]:"colors.gray.800",[Ut.variable]:`colors.${t}.300`}},color:st.reference,bg:Ut.reference}}}),n5=fr({}),o5={line:Z$,enclosed:J$,"enclosed-colored":e5,"soft-rounded":t5,"solid-rounded":r5,unstyled:n5},i5=H$({baseStyle:Q$,sizes:q$,variants:o5,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),Ce=PT("badge",["bg","color","shadow"]),a5={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:Ce.bg.reference,color:Ce.color.reference,boxShadow:Ce.shadow.reference},s5=e=>{const{colorScheme:t,theme:r}=e,n=Qo(`${t}.500`,.6)(r);return{[Ce.bg.variable]:`colors.${t}.500`,[Ce.color.variable]:"colors.white",_dark:{[Ce.bg.variable]:n,[Ce.color.variable]:"colors.whiteAlpha.800"}}},l5=e=>{const{colorScheme:t,theme:r}=e,n=Qo(`${t}.200`,.16)(r);return{[Ce.bg.variable]:`colors.${t}.100`,[Ce.color.variable]:`colors.${t}.800`,_dark:{[Ce.bg.variable]:n,[Ce.color.variable]:`colors.${t}.200`}}},u5=e=>{const{colorScheme:t,theme:r}=e,n=Qo(`${t}.200`,.8)(r);return{[Ce.color.variable]:`colors.${t}.500`,_dark:{[Ce.color.variable]:n},[Ce.shadow.variable]:`inset 0 0 0px 1px ${Ce.color.reference}`}},c5={solid:s5,subtle:l5,outline:u5},Yi={baseStyle:a5,variants:c5,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:d5,definePartsStyle:In}=le(e$.keys),Vv=O("tag-bg"),Wv=O("tag-color"),Dc=O("tag-shadow"),rl=O("tag-min-height"),nl=O("tag-min-width"),ol=O("tag-font-size"),il=O("tag-padding-inline"),f5={fontWeight:"medium",lineHeight:1.2,outline:0,[Wv.variable]:Ce.color.reference,[Vv.variable]:Ce.bg.reference,[Dc.variable]:Ce.shadow.reference,color:Wv.reference,bg:Vv.reference,boxShadow:Dc.reference,borderRadius:"md",minH:rl.reference,minW:nl.reference,fontSize:ol.reference,px:il.reference,_focusVisible:{[Dc.variable]:"shadows.outline"}},h5={lineHeight:1.2,overflow:"visible"},p5={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},m5=In({container:f5,label:h5,closeButton:p5}),v5={sm:In({container:{[rl.variable]:"sizes.5",[nl.variable]:"sizes.5",[ol.variable]:"fontSizes.xs",[il.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:In({container:{[rl.variable]:"sizes.6",[nl.variable]:"sizes.6",[ol.variable]:"fontSizes.sm",[il.variable]:"space.2"}}),lg:In({container:{[rl.variable]:"sizes.8",[nl.variable]:"sizes.8",[ol.variable]:"fontSizes.md",[il.variable]:"space.3"}})},g5={subtle:In(e=>{var t;return{container:(t=Yi.variants)==null?void 0:t.subtle(e)}}),solid:In(e=>{var t;return{container:(t=Yi.variants)==null?void 0:t.solid(e)}}),outline:In(e=>{var t;return{container:(t=Yi.variants)==null?void 0:t.outline(e)}})},y5=d5({variants:g5,baseStyle:m5,sizes:v5,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:Cr,defineMultiStyleConfig:b5}=le(jE.keys),bo=O("input-height"),So=O("input-font-size"),xo=O("input-padding"),wo=O("input-border-radius"),S5=Cr({addon:{height:bo.reference,fontSize:So.reference,px:xo.reference,borderRadius:wo.reference},field:{width:"100%",height:bo.reference,fontSize:So.reference,px:xo.reference,borderRadius:wo.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),jr={lg:{[So.variable]:"fontSizes.lg",[xo.variable]:"space.4",[wo.variable]:"radii.md",[bo.variable]:"sizes.12"},md:{[So.variable]:"fontSizes.md",[xo.variable]:"space.4",[wo.variable]:"radii.md",[bo.variable]:"sizes.10"},sm:{[So.variable]:"fontSizes.sm",[xo.variable]:"space.3",[wo.variable]:"radii.sm",[bo.variable]:"sizes.8"},xs:{[So.variable]:"fontSizes.xs",[xo.variable]:"space.2",[wo.variable]:"radii.sm",[bo.variable]:"sizes.6"}},x5={lg:Cr({field:jr.lg,group:jr.lg}),md:Cr({field:jr.md,group:jr.md}),sm:Cr({field:jr.sm,group:jr.sm}),xs:Cr({field:jr.xs,group:jr.xs})};function rp(e){const{focusBorderColor:t,errorBorderColor:r}=e;return{focusBorderColor:t||L("blue.500","blue.300")(e),errorBorderColor:r||L("red.500","red.300")(e)}}var w5=Cr(e=>{const{theme:t}=e,{focusBorderColor:r,errorBorderColor:n}=rp(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:L("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:et(t,n),boxShadow:`0 0 0 1px ${et(t,n)}`},_focusVisible:{zIndex:1,borderColor:et(t,r),boxShadow:`0 0 0 1px ${et(t,r)}`}},addon:{border:"1px solid",borderColor:L("inherit","whiteAlpha.50")(e),bg:L("gray.100","whiteAlpha.300")(e)}}}),k5=Cr(e=>{const{theme:t}=e,{focusBorderColor:r,errorBorderColor:n}=rp(e);return{field:{border:"2px solid",borderColor:"transparent",bg:L("gray.100","whiteAlpha.50")(e),_hover:{bg:L("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:et(t,n)},_focusVisible:{bg:"transparent",borderColor:et(t,r)}},addon:{border:"2px solid",borderColor:"transparent",bg:L("gray.100","whiteAlpha.50")(e)}}}),C5=Cr(e=>{const{theme:t}=e,{focusBorderColor:r,errorBorderColor:n}=rp(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:et(t,n),boxShadow:`0px 1px 0px 0px ${et(t,n)}`},_focusVisible:{borderColor:et(t,r),boxShadow:`0px 1px 0px 0px ${et(t,r)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),_5=Cr({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),P5={outline:w5,filled:k5,flushed:C5,unstyled:_5},Z=b5({baseStyle:S5,sizes:x5,variants:P5,defaultProps:{size:"md",variant:"outline"}}),Uv,T5={...(Uv=Z.baseStyle)==null?void 0:Uv.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},Hv,Gv,E5={outline:e=>{var t,r;return(r=(t=Z.variants)==null?void 0:t.outline(e).field)!=null?r:{}},flushed:e=>{var t,r;return(r=(t=Z.variants)==null?void 0:t.flushed(e).field)!=null?r:{}},filled:e=>{var t,r;return(r=(t=Z.variants)==null?void 0:t.filled(e).field)!=null?r:{}},unstyled:(Gv=(Hv=Z.variants)==null?void 0:Hv.unstyled.field)!=null?Gv:{}},Kv,Yv,Xv,Qv,qv,Zv,Jv,eg,$5={xs:(Yv=(Kv=Z.sizes)==null?void 0:Kv.xs.field)!=null?Yv:{},sm:(Qv=(Xv=Z.sizes)==null?void 0:Xv.sm.field)!=null?Qv:{},md:(Zv=(qv=Z.sizes)==null?void 0:qv.md.field)!=null?Zv:{},lg:(eg=(Jv=Z.sizes)==null?void 0:Jv.lg.field)!=null?eg:{}},A5={baseStyle:T5,sizes:$5,variants:E5,defaultProps:{size:"md",variant:"outline"}},Ps=Me("tooltip-bg"),Ic=Me("tooltip-fg"),R5=Me("popper-arrow-bg"),M5={bg:Ps.reference,color:Ic.reference,[Ps.variable]:"colors.gray.700",[Ic.variable]:"colors.whiteAlpha.900",_dark:{[Ps.variable]:"colors.gray.300",[Ic.variable]:"colors.gray.900"},[R5.variable]:Ps.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},z5={baseStyle:M5},{defineMultiStyleConfig:F5,definePartsStyle:zi}=le(GE.keys),D5=e=>{const{colorScheme:t,theme:r,isIndeterminate:n,hasStripe:o}=e,i=L(Lv(),Lv("1rem","rgba(0,0,0,0.1)"))(e),a=L(`${t}.500`,`${t}.200`)(e),s=`linear-gradient( - to right, - transparent 0%, - ${et(r,a)} 50%, - transparent 100% - )`;return{...!n&&o&&i,...n?{bgImage:s}:{bgColor:a}}},I5={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},L5=e=>({bg:L("gray.100","whiteAlpha.300")(e)}),O5=e=>({transitionProperty:"common",transitionDuration:"slow",...D5(e)}),B5=zi(e=>({label:I5,filledTrack:O5(e),track:L5(e)})),j5={xs:zi({track:{h:"1"}}),sm:zi({track:{h:"2"}}),md:zi({track:{h:"3"}}),lg:zi({track:{h:"4"}})},N5=F5({sizes:j5,baseStyle:B5,defaultProps:{size:"md",colorScheme:"blue"}}),V5=e=>typeof e=="function";function rt(e,...t){return V5(e)?e(...t):e}var{definePartsStyle:al,defineMultiStyleConfig:W5}=le(DE.keys),Xi=O("checkbox-size"),U5=e=>{const{colorScheme:t}=e;return{w:Xi.reference,h:Xi.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:L(`${t}.500`,`${t}.200`)(e),borderColor:L(`${t}.500`,`${t}.200`)(e),color:L("white","gray.900")(e),_hover:{bg:L(`${t}.600`,`${t}.300`)(e),borderColor:L(`${t}.600`,`${t}.300`)(e)},_disabled:{borderColor:L("gray.200","transparent")(e),bg:L("gray.200","whiteAlpha.300")(e),color:L("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:L(`${t}.500`,`${t}.200`)(e),borderColor:L(`${t}.500`,`${t}.200`)(e),color:L("white","gray.900")(e)},_disabled:{bg:L("gray.100","whiteAlpha.100")(e),borderColor:L("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:L("red.500","red.300")(e)}}},H5={_disabled:{cursor:"not-allowed"}},G5={userSelect:"none",_disabled:{opacity:.4}},K5={transitionProperty:"transform",transitionDuration:"normal"},Y5=al(e=>({icon:K5,container:H5,control:rt(U5,e),label:G5})),X5={sm:al({control:{[Xi.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:al({control:{[Xi.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:al({control:{[Xi.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},Ul=W5({baseStyle:Y5,sizes:X5,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:Q5,definePartsStyle:sl}=le(KE.keys),q5=e=>{var t;const r=(t=rt(Ul.baseStyle,e))==null?void 0:t.control;return{...r,borderRadius:"full",_checked:{...r==null?void 0:r._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},Z5=sl(e=>{var t,r,n,o;return{label:(r=(t=Ul).baseStyle)==null?void 0:r.call(t,e).label,container:(o=(n=Ul).baseStyle)==null?void 0:o.call(n,e).container,control:q5(e)}}),J5={md:sl({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:sl({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:sl({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},eA=Q5({baseStyle:Z5,sizes:J5,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:tA,definePartsStyle:rA}=le(YE.keys),Ts=O("select-bg"),tg,nA={...(tg=Z.baseStyle)==null?void 0:tg.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:Ts.reference,[Ts.variable]:"colors.white",_dark:{[Ts.variable]:"colors.gray.700"},"> option, > optgroup":{bg:Ts.reference}},oA={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},iA=rA({field:nA,icon:oA}),Es={paddingInlineEnd:"8"},rg,ng,og,ig,ag,sg,lg,ug,aA={lg:{...(rg=Z.sizes)==null?void 0:rg.lg,field:{...(ng=Z.sizes)==null?void 0:ng.lg.field,...Es}},md:{...(og=Z.sizes)==null?void 0:og.md,field:{...(ig=Z.sizes)==null?void 0:ig.md.field,...Es}},sm:{...(ag=Z.sizes)==null?void 0:ag.sm,field:{...(sg=Z.sizes)==null?void 0:sg.sm.field,...Es}},xs:{...(lg=Z.sizes)==null?void 0:lg.xs,field:{...(ug=Z.sizes)==null?void 0:ug.xs.field,...Es},icon:{insetEnd:"1"}}},sA=tA({baseStyle:iA,sizes:aA,variants:Z.variants,defaultProps:Z.defaultProps}),Lc=O("skeleton-start-color"),Oc=O("skeleton-end-color"),lA={[Lc.variable]:"colors.gray.100",[Oc.variable]:"colors.gray.400",_dark:{[Lc.variable]:"colors.gray.800",[Oc.variable]:"colors.gray.600"},background:Lc.reference,borderColor:Oc.reference,opacity:.7,borderRadius:"sm"},uA={baseStyle:lA},Bc=O("skip-link-bg"),cA={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[Bc.variable]:"colors.white",_dark:{[Bc.variable]:"colors.gray.700"},bg:Bc.reference}},dA={baseStyle:cA},{defineMultiStyleConfig:fA,definePartsStyle:Ou}=le(XE.keys),Ca=O("slider-thumb-size"),_a=O("slider-track-size"),Yr=O("slider-bg"),hA=e=>{const{orientation:t}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...tp({orientation:t,vertical:{h:"100%"},horizontal:{w:"100%"}})}},pA=e=>({...tp({orientation:e.orientation,horizontal:{h:_a.reference},vertical:{w:_a.reference}}),overflow:"hidden",borderRadius:"sm",[Yr.variable]:"colors.gray.200",_dark:{[Yr.variable]:"colors.whiteAlpha.200"},_disabled:{[Yr.variable]:"colors.gray.300",_dark:{[Yr.variable]:"colors.whiteAlpha.300"}},bg:Yr.reference}),mA=e=>{const{orientation:t}=e;return{...tp({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:Ca.reference,h:Ca.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},vA=e=>{const{colorScheme:t}=e;return{width:"inherit",height:"inherit",[Yr.variable]:`colors.${t}.500`,_dark:{[Yr.variable]:`colors.${t}.200`},bg:Yr.reference}},gA=Ou(e=>({container:hA(e),track:pA(e),thumb:mA(e),filledTrack:vA(e)})),yA=Ou({container:{[Ca.variable]:"sizes.4",[_a.variable]:"sizes.1"}}),bA=Ou({container:{[Ca.variable]:"sizes.3.5",[_a.variable]:"sizes.1"}}),SA=Ou({container:{[Ca.variable]:"sizes.2.5",[_a.variable]:"sizes.0.5"}}),xA={lg:yA,md:bA,sm:SA},wA=fA({baseStyle:gA,sizes:xA,defaultProps:{size:"md",colorScheme:"blue"}}),Tn=Me("spinner-size"),kA={width:[Tn.reference],height:[Tn.reference]},CA={xs:{[Tn.variable]:"sizes.3"},sm:{[Tn.variable]:"sizes.4"},md:{[Tn.variable]:"sizes.6"},lg:{[Tn.variable]:"sizes.8"},xl:{[Tn.variable]:"sizes.12"}},_A={baseStyle:kA,sizes:CA,defaultProps:{size:"md"}},{defineMultiStyleConfig:PA,definePartsStyle:Fb}=le(QE.keys),TA={fontWeight:"medium"},EA={opacity:.8,marginBottom:"2"},$A={verticalAlign:"baseline",fontWeight:"semibold"},AA={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},RA=Fb({container:{},label:TA,helpText:EA,number:$A,icon:AA}),MA={md:Fb({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},zA=PA({baseStyle:RA,sizes:MA,defaultProps:{size:"md"}}),jc=O("kbd-bg"),FA={[jc.variable]:"colors.gray.100",_dark:{[jc.variable]:"colors.whiteAlpha.100"},bg:jc.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},DA={baseStyle:FA},IA={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},LA={baseStyle:IA},{defineMultiStyleConfig:OA,definePartsStyle:BA}=le(NE.keys),jA={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},NA=BA({icon:jA}),VA=OA({baseStyle:NA}),{defineMultiStyleConfig:WA,definePartsStyle:UA}=le(VE.keys),rr=O("menu-bg"),Nc=O("menu-shadow"),HA={[rr.variable]:"#fff",[Nc.variable]:"shadows.sm",_dark:{[rr.variable]:"colors.gray.700",[Nc.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:rr.reference,boxShadow:Nc.reference},GA={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[rr.variable]:"colors.gray.100",_dark:{[rr.variable]:"colors.whiteAlpha.100"}},_active:{[rr.variable]:"colors.gray.200",_dark:{[rr.variable]:"colors.whiteAlpha.200"}},_expanded:{[rr.variable]:"colors.gray.100",_dark:{[rr.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:rr.reference},KA={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},YA={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},XA={opacity:.6},QA={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},qA={transitionProperty:"common",transitionDuration:"normal"},ZA=UA({button:qA,list:HA,item:GA,groupTitle:KA,icon:YA,command:XA,divider:QA}),JA=WA({baseStyle:ZA}),{defineMultiStyleConfig:eR,definePartsStyle:xf}=le(WE.keys),Vc=O("modal-bg"),Wc=O("modal-shadow"),tR={bg:"blackAlpha.600",zIndex:"modal"},rR=e=>{const{isCentered:t,scrollBehavior:r}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:t?"center":"flex-start",overflow:r==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},nR=e=>{const{isCentered:t,scrollBehavior:r}=e;return{borderRadius:"md",color:"inherit",my:t?"auto":"16",mx:t?"auto":void 0,zIndex:"modal",maxH:r==="inside"?"calc(100% - 7.5rem)":void 0,[Vc.variable]:"colors.white",[Wc.variable]:"shadows.lg",_dark:{[Vc.variable]:"colors.gray.700",[Wc.variable]:"shadows.dark-lg"},bg:Vc.reference,boxShadow:Wc.reference}},oR={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},iR={position:"absolute",top:"2",insetEnd:"3"},aR=e=>{const{scrollBehavior:t}=e;return{px:"6",py:"2",flex:"1",overflow:t==="inside"?"auto":void 0}},sR={px:"6",py:"4"},lR=xf(e=>({overlay:tR,dialogContainer:rt(rR,e),dialog:rt(nR,e),header:oR,closeButton:iR,body:rt(aR,e),footer:sR}));function jt(e){return xf(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var uR={xs:jt("xs"),sm:jt("sm"),md:jt("md"),lg:jt("lg"),xl:jt("xl"),"2xl":jt("2xl"),"3xl":jt("3xl"),"4xl":jt("4xl"),"5xl":jt("5xl"),"6xl":jt("6xl"),full:jt("full")},cR=eR({baseStyle:lR,sizes:uR,defaultProps:{size:"md"}}),{defineMultiStyleConfig:dR,definePartsStyle:Db}=le(UE.keys),np=Me("number-input-stepper-width"),Ib=Me("number-input-input-padding"),fR=xr(np).add("0.5rem").toString(),Uc=Me("number-input-bg"),Hc=Me("number-input-color"),Gc=Me("number-input-border-color"),hR={[np.variable]:"sizes.6",[Ib.variable]:fR},pR=e=>{var t,r;return(r=(t=rt(Z.baseStyle,e))==null?void 0:t.field)!=null?r:{}},mR={width:np.reference},vR={borderStart:"1px solid",borderStartColor:Gc.reference,color:Hc.reference,bg:Uc.reference,[Hc.variable]:"colors.chakra-body-text",[Gc.variable]:"colors.chakra-border-color",_dark:{[Hc.variable]:"colors.whiteAlpha.800",[Gc.variable]:"colors.whiteAlpha.300"},_active:{[Uc.variable]:"colors.gray.200",_dark:{[Uc.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},gR=Db(e=>{var t;return{root:hR,field:(t=rt(pR,e))!=null?t:{},stepperGroup:mR,stepper:vR}});function $s(e){var t,r,n;const o=(t=Z.sizes)==null?void 0:t[e],i={lg:"md",md:"md",sm:"sm",xs:"sm"},a=(n=(r=o.field)==null?void 0:r.fontSize)!=null?n:"md",s=$b.fontSizes[a];return Db({field:{...o.field,paddingInlineEnd:Ib.reference,verticalAlign:"top"},stepper:{fontSize:xr(s).multiply(.75).toString(),_first:{borderTopEndRadius:i[e]},_last:{borderBottomEndRadius:i[e],mt:"-1px",borderTopWidth:1}}})}var yR={xs:$s("xs"),sm:$s("sm"),md:$s("md"),lg:$s("lg")},bR=dR({baseStyle:gR,sizes:yR,variants:Z.variants,defaultProps:Z.defaultProps}),cg,SR={...(cg=Z.baseStyle)==null?void 0:cg.field,textAlign:"center"},xR={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},dg,fg,wR={outline:e=>{var t,r,n;return(n=(r=rt((t=Z.variants)==null?void 0:t.outline,e))==null?void 0:r.field)!=null?n:{}},flushed:e=>{var t,r,n;return(n=(r=rt((t=Z.variants)==null?void 0:t.flushed,e))==null?void 0:r.field)!=null?n:{}},filled:e=>{var t,r,n;return(n=(r=rt((t=Z.variants)==null?void 0:t.filled,e))==null?void 0:r.field)!=null?n:{}},unstyled:(fg=(dg=Z.variants)==null?void 0:dg.unstyled.field)!=null?fg:{}},kR={baseStyle:SR,sizes:xR,variants:wR,defaultProps:Z.defaultProps},{defineMultiStyleConfig:CR,definePartsStyle:_R}=le(HE.keys),As=Me("popper-bg"),PR=Me("popper-arrow-bg"),hg=Me("popper-arrow-shadow-color"),TR={zIndex:10},ER={[As.variable]:"colors.white",bg:As.reference,[PR.variable]:As.reference,[hg.variable]:"colors.gray.200",_dark:{[As.variable]:"colors.gray.700",[hg.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},$R={px:3,py:2,borderBottomWidth:"1px"},AR={px:3,py:2},RR={px:3,py:2,borderTopWidth:"1px"},MR={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},zR=_R({popper:TR,content:ER,header:$R,body:AR,footer:RR,closeButton:MR}),FR=CR({baseStyle:zR}),{definePartsStyle:wf,defineMultiStyleConfig:DR}=le(IE.keys),Kc=O("drawer-bg"),Yc=O("drawer-box-shadow");function eo(e){return wf(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var IR={bg:"blackAlpha.600",zIndex:"modal"},LR={display:"flex",zIndex:"modal",justifyContent:"center"},OR=e=>{const{isFullHeight:t}=e;return{...t&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[Kc.variable]:"colors.white",[Yc.variable]:"shadows.lg",_dark:{[Kc.variable]:"colors.gray.700",[Yc.variable]:"shadows.dark-lg"},bg:Kc.reference,boxShadow:Yc.reference}},BR={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},jR={position:"absolute",top:"2",insetEnd:"3"},NR={px:"6",py:"2",flex:"1",overflow:"auto"},VR={px:"6",py:"4"},WR=wf(e=>({overlay:IR,dialogContainer:LR,dialog:rt(OR,e),header:BR,closeButton:jR,body:NR,footer:VR})),UR={xs:eo("xs"),sm:eo("md"),md:eo("lg"),lg:eo("2xl"),xl:eo("4xl"),full:eo("full")},HR=DR({baseStyle:WR,sizes:UR,defaultProps:{size:"xs"}}),{definePartsStyle:GR,defineMultiStyleConfig:KR}=le(LE.keys),YR={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},XR={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},QR={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},qR=GR({preview:YR,input:XR,textarea:QR}),ZR=KR({baseStyle:qR}),{definePartsStyle:JR,defineMultiStyleConfig:eM}=le(OE.keys),Io=O("form-control-color"),tM={marginStart:"1",[Io.variable]:"colors.red.500",_dark:{[Io.variable]:"colors.red.300"},color:Io.reference},rM={mt:"2",[Io.variable]:"colors.gray.600",_dark:{[Io.variable]:"colors.whiteAlpha.600"},color:Io.reference,lineHeight:"normal",fontSize:"sm"},nM=JR({container:{width:"100%",position:"relative"},requiredIndicator:tM,helperText:rM}),oM=eM({baseStyle:nM}),{definePartsStyle:iM,defineMultiStyleConfig:aM}=le(BE.keys),Lo=O("form-error-color"),sM={[Lo.variable]:"colors.red.500",_dark:{[Lo.variable]:"colors.red.300"},color:Lo.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},lM={marginEnd:"0.5em",[Lo.variable]:"colors.red.500",_dark:{[Lo.variable]:"colors.red.300"},color:Lo.reference},uM=iM({text:sM,icon:lM}),cM=aM({baseStyle:uM}),dM={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},fM={baseStyle:dM},hM={fontFamily:"heading",fontWeight:"bold"},pM={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},mM={baseStyle:hM,sizes:pM,defaultProps:{size:"xl"}},{defineMultiStyleConfig:vM,definePartsStyle:gM}=le(FE.keys),Xc=O("breadcrumb-link-decor"),yM={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:Xc.reference,[Xc.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[Xc.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},bM=gM({link:yM}),SM=vM({baseStyle:bM}),xM={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},Lb=e=>{const{colorScheme:t,theme:r}=e;if(t==="gray")return{color:L("gray.800","whiteAlpha.900")(e),_hover:{bg:L("gray.100","whiteAlpha.200")(e)},_active:{bg:L("gray.200","whiteAlpha.300")(e)}};const n=Qo(`${t}.200`,.12)(r),o=Qo(`${t}.200`,.24)(r);return{color:L(`${t}.600`,`${t}.200`)(e),bg:"transparent",_hover:{bg:L(`${t}.50`,n)(e)},_active:{bg:L(`${t}.100`,o)(e)}}},wM=e=>{const{colorScheme:t}=e,r=L("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?r:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...rt(Lb,e)}},kM={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},CM=e=>{var t;const{colorScheme:r}=e;if(r==="gray"){const l=L("gray.100","whiteAlpha.200")(e);return{bg:l,color:L("gray.800","whiteAlpha.900")(e),_hover:{bg:L("gray.200","whiteAlpha.300")(e),_disabled:{bg:l}},_active:{bg:L("gray.300","whiteAlpha.400")(e)}}}const{bg:n=`${r}.500`,color:o="white",hoverBg:i=`${r}.600`,activeBg:a=`${r}.700`}=(t=kM[r])!=null?t:{},s=L(n,`${r}.200`)(e);return{bg:s,color:L(o,"gray.800")(e),_hover:{bg:L(i,`${r}.300`)(e),_disabled:{bg:s}},_active:{bg:L(a,`${r}.400`)(e)}}},_M=e=>{const{colorScheme:t}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:L(`${t}.500`,`${t}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:L(`${t}.700`,`${t}.500`)(e)}}},PM={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},TM={ghost:Lb,outline:wM,solid:CM,link:_M,unstyled:PM},EM={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},$M={baseStyle:xM,variants:TM,sizes:EM,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:Ln,defineMultiStyleConfig:AM}=le(t$.keys),Hl=O("card-bg"),Tr=O("card-padding"),Ob=O("card-shadow"),ll=O("card-radius"),Bb=O("card-border-width","0"),jb=O("card-border-color"),RM=Ln({container:{[Hl.variable]:"colors.chakra-body-bg",backgroundColor:Hl.reference,boxShadow:Ob.reference,borderRadius:ll.reference,color:"chakra-body-text",borderWidth:Bb.reference,borderColor:jb.reference},body:{padding:Tr.reference,flex:"1 1 0%"},header:{padding:Tr.reference},footer:{padding:Tr.reference}}),MM={sm:Ln({container:{[ll.variable]:"radii.base",[Tr.variable]:"space.3"}}),md:Ln({container:{[ll.variable]:"radii.md",[Tr.variable]:"space.5"}}),lg:Ln({container:{[ll.variable]:"radii.xl",[Tr.variable]:"space.7"}})},zM={elevated:Ln({container:{[Ob.variable]:"shadows.base",_dark:{[Hl.variable]:"colors.gray.700"}}}),outline:Ln({container:{[Bb.variable]:"1px",[jb.variable]:"colors.chakra-border-color"}}),filled:Ln({container:{[Hl.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[Tr.variable]:0},header:{[Tr.variable]:0},footer:{[Tr.variable]:0}}},FM=AM({baseStyle:RM,variants:zM,sizes:MM,defaultProps:{variant:"elevated",size:"md"}}),Qi=Me("close-button-size"),xi=Me("close-button-bg"),DM={w:[Qi.reference],h:[Qi.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[xi.variable]:"colors.blackAlpha.100",_dark:{[xi.variable]:"colors.whiteAlpha.100"}},_active:{[xi.variable]:"colors.blackAlpha.200",_dark:{[xi.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:xi.reference},IM={lg:{[Qi.variable]:"sizes.10",fontSize:"md"},md:{[Qi.variable]:"sizes.8",fontSize:"xs"},sm:{[Qi.variable]:"sizes.6",fontSize:"2xs"}},LM={baseStyle:DM,sizes:IM,defaultProps:{size:"md"}},{variants:OM,defaultProps:BM}=Yi,jM={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:Ce.bg.reference,color:Ce.color.reference,boxShadow:Ce.shadow.reference},NM={baseStyle:jM,variants:OM,defaultProps:BM},VM={w:"100%",mx:"auto",maxW:"prose",px:"4"},WM={baseStyle:VM},UM={opacity:.6,borderColor:"inherit"},HM={borderStyle:"solid"},GM={borderStyle:"dashed"},KM={solid:HM,dashed:GM},YM={baseStyle:UM,variants:KM,defaultProps:{variant:"solid"}},{definePartsStyle:XM,defineMultiStyleConfig:QM}=le(RE.keys),qM={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},ZM={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},JM={pt:"2",px:"4",pb:"5"},ez={fontSize:"1.25em"},tz=XM({container:qM,button:ZM,panel:JM,icon:ez}),rz=QM({baseStyle:tz}),{definePartsStyle:Na,defineMultiStyleConfig:nz}=le(ME.keys),xt=O("alert-fg"),Dr=O("alert-bg"),oz=Na({container:{bg:Dr.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:xt.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:xt.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function op(e){const{theme:t,colorScheme:r}=e,n=Qo(`${r}.200`,.16)(t);return{light:`colors.${r}.100`,dark:n}}var iz=Na(e=>{const{colorScheme:t}=e,r=op(e);return{container:{[xt.variable]:`colors.${t}.600`,[Dr.variable]:r.light,_dark:{[xt.variable]:`colors.${t}.200`,[Dr.variable]:r.dark}}}}),az=Na(e=>{const{colorScheme:t}=e,r=op(e);return{container:{[xt.variable]:`colors.${t}.600`,[Dr.variable]:r.light,_dark:{[xt.variable]:`colors.${t}.200`,[Dr.variable]:r.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:xt.reference}}}),sz=Na(e=>{const{colorScheme:t}=e,r=op(e);return{container:{[xt.variable]:`colors.${t}.600`,[Dr.variable]:r.light,_dark:{[xt.variable]:`colors.${t}.200`,[Dr.variable]:r.dark},pt:"2",borderTopWidth:"4px",borderTopColor:xt.reference}}}),lz=Na(e=>{const{colorScheme:t}=e;return{container:{[xt.variable]:"colors.white",[Dr.variable]:`colors.${t}.600`,_dark:{[xt.variable]:"colors.gray.900",[Dr.variable]:`colors.${t}.200`},color:xt.reference}}}),uz={subtle:iz,"left-accent":az,"top-accent":sz,solid:lz},cz=nz({baseStyle:oz,variants:uz,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:Nb,defineMultiStyleConfig:dz}=le(zE.keys),Oo=O("avatar-border-color"),qi=O("avatar-bg"),Pa=O("avatar-font-size"),qo=O("avatar-size"),fz={borderRadius:"full",border:"0.2em solid",borderColor:Oo.reference,[Oo.variable]:"white",_dark:{[Oo.variable]:"colors.gray.800"}},hz={bg:qi.reference,fontSize:Pa.reference,width:qo.reference,height:qo.reference,lineHeight:"1",[qi.variable]:"colors.gray.200",_dark:{[qi.variable]:"colors.whiteAlpha.400"}},pz=e=>{const{name:t,theme:r}=e,n=t?x$({string:t}):"colors.gray.400",o=b$(n)(r);let i="white";return o||(i="gray.800"),{bg:qi.reference,fontSize:Pa.reference,color:i,borderColor:Oo.reference,verticalAlign:"top",width:qo.reference,height:qo.reference,"&:not([data-loaded])":{[qi.variable]:n},[Oo.variable]:"colors.white",_dark:{[Oo.variable]:"colors.gray.800"}}},mz={fontSize:Pa.reference,lineHeight:"1"},vz=Nb(e=>({badge:rt(fz,e),excessLabel:rt(hz,e),container:rt(pz,e),label:mz}));function Nr(e){const t=e!=="100%"?Rb[e]:void 0;return Nb({container:{[qo.variable]:t??e,[Pa.variable]:`calc(${t??e} / 2.5)`},excessLabel:{[qo.variable]:t??e,[Pa.variable]:`calc(${t??e} / 2.5)`}})}var gz={"2xs":Nr(4),xs:Nr(6),sm:Nr(8),md:Nr(12),lg:Nr(16),xl:Nr(24),"2xl":Nr(32),full:Nr("100%")},yz=dz({baseStyle:vz,sizes:gz,defaultProps:{size:"md"}}),bz={Accordion:rz,Alert:cz,Avatar:yz,Badge:Yi,Breadcrumb:SM,Button:$M,Checkbox:Ul,CloseButton:LM,Code:NM,Container:WM,Divider:YM,Drawer:HR,Editable:ZR,Form:oM,FormError:cM,FormLabel:fM,Heading:mM,Input:Z,Kbd:DA,Link:LA,List:VA,Menu:JA,Modal:cR,NumberInput:bR,PinInput:kR,Popover:FR,Progress:N5,Radio:eA,Select:sA,Skeleton:uA,SkipLink:dA,Slider:wA,Spinner:_A,Stat:zA,Switch:L$,Table:U$,Tabs:i5,Tag:y5,Textarea:A5,Tooltip:z5,Card:FM,Stepper:AE},Sz={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},xz={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},wz="ltr",kz={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},Vb={semanticTokens:Sz,direction:wz,...TE,components:bz,styles:xz,config:kz};function Fi(e){return typeof e=="function"}function Cz(...e){return t=>e.reduce((r,n)=>n(r),t)}var _z=e=>function(...r){let n=[...r],o=r[r.length-1];return nE(o)&&n.length>1?n=n.slice(0,n.length-1):o=e,Cz(...n.map(i=>a=>Fi(i)?i(a):Tz(a,i)))(o)},Pz=_z(Vb);function Tz(...e){return Ft({},...e,Wb)}function Wb(e,t,r,n){if((Fi(e)||Fi(t))&&Object.prototype.hasOwnProperty.call(n,r))return(...o)=>{const i=Fi(e)?e(...o):e,a=Fi(t)?t(...o):t;return Ft({},i,a,Wb)}}function Ez(e,t){const r={};return Object.keys(e).forEach(n=>{t.includes(n)||(r[n]=e[n])}),r}function $z(e,t,r,n){const o=typeof t=="string"?t.split("."):[t];for(n=0;n{const t=new WeakMap;return(n,o,i,a)=>{if(typeof n>"u")return e(n,o,i);t.has(n)||t.set(n,new Map);const s=t.get(n);if(s.has(o))return s.get(o);const l=e(n,o,i,a);return s.set(o,l),l}},Ub=Az($z);function Hb(e,t){const r={};return Object.keys(e).forEach(n=>{const o=e[n];t(o,n,e)&&(r[n]=o)}),r}var Gb=e=>Hb(e,t=>t!=null);function Rz(e){return typeof e=="function"}function Kb(e,...t){return Rz(e)?e(...t):e}function bB(...e){return function(r){e.some(n=>(n==null||n(r),r==null?void 0:r.defaultPrevented))}}var Mz=typeof Element<"u",zz=typeof Map=="function",Fz=typeof Set=="function",Dz=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function ul(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,n,o;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!ul(e[n],t[n]))return!1;return!0}var i;if(zz&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i=e.entries();!(n=i.next()).done;)if(!t.has(n.value[0]))return!1;for(i=e.entries();!(n=i.next()).done;)if(!ul(n.value[1],t.get(n.value[0])))return!1;return!0}if(Fz&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i=e.entries();!(n=i.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(Dz&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(e[n]!==t[n])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[n]))return!1;if(Mz&&e instanceof Element)return!1;for(n=r;n--!==0;)if(!((o[n]==="_owner"||o[n]==="__v"||o[n]==="__o")&&e.$$typeof)&&!ul(e[o[n]],t[o[n]]))return!1;return!0}return e!==e&&t!==t}var Iz=function(t,r){try{return ul(t,r)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}};const Lz=Gf(Iz);function Yb(e,t={}){var r;const{styleConfig:n,...o}=t,{theme:i,colorMode:a}=IP(),s=e?Ub(i,`components.${e}`):void 0,l=n||s,u=Ft({theme:i,colorMode:a},(r=l==null?void 0:l.defaultProps)!=null?r:{},Gb(Ez(o,["children"]))),c=S.useRef({});if(l){const f=tE(l)(u);Lz(c.current,f)||(c.current=f)}return c.current}function Bu(e,t={}){return Yb(e,t)}function Xb(e,t={}){return Yb(e,t)}var Oz=new Set([...WT,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),Bz=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function jz(e){return Bz.has(e)||!Oz.has(e)}function Nz(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const r={...e};for(const n of t)if(n!=null)for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&(o in r&&delete r[o],r[o]=n[o]);return r}var Vz=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Wz=ob(function(e){return Vz.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),Uz=Wz,Hz=function(t){return t!=="theme"},pg=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?Uz:Hz},mg=function(t,r,n){var o;if(r){var i=r.shouldForwardProp;o=t.__emotion_forwardProp&&i?function(a){return t.__emotion_forwardProp(a)&&i(a)}:i}return typeof o!="function"&&n&&(o=t.__emotion_forwardProp),o},Gz=function(t){var r=t.cache,n=t.serialized,o=t.isStringTag;return cb(r,n,o),dP(function(){return db(r,n,o)}),null},Kz=function e(t,r){var n=t.__emotion_real===t,o=n&&t.__emotion_base||t,i,a;r!==void 0&&(i=r.label,a=r.target);var s=mg(t,r,n),l=s||pg(o),u=!l("as");return function(){var c=arguments,d=n&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(i!==void 0&&d.push("label:"+i+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,p=1;pt=>{const{theme:r,css:n,__css:o,sx:i,...a}=t,s=Hb(a,(d,f)=>HT(f)),l=Kb(e,t),u=Nz({},o,l,Gb(s),i),c=Eb(u)(t.theme);return n?[c,n]:c};function Qc(e,t){const{baseStyle:r,...n}=t??{};n.shouldForwardProp||(n.shouldForwardProp=jz);const o=Qz({baseStyle:r}),i=Xz(e,n)(o);return Ar.forwardRef(function(l,u){const{colorMode:c,forced:d}=Qh();return Ar.createElement(i,{ref:u,"data-theme":d?c:void 0,...l})})}function qz(){const e=new Map;return new Proxy(Qc,{apply(t,r,n){return Qc(...n)},get(t,r){return e.has(r)||e.set(r,Qc(r)),e.get(r)}})}var _e=qz();function pt(e){return S.forwardRef(e)}function Qb(e={}){const{strict:t=!0,errorMessage:r="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:n}=e,o=S.createContext(void 0);o.displayName=n;function i(){var a;const s=S.useContext(o);if(!s&&t){const l=new Error(r);throw l.name="ContextError",(a=Error.captureStackTrace)==null||a.call(Error,l,i),l}return s}return[o.Provider,i,o]}function Zz(e){const{cssVarsRoot:t,theme:r,children:n}=e,o=S.useMemo(()=>NT(r),[r]);return E.jsxs(pP,{theme:o,children:[E.jsx(Jz,{root:t}),n]})}function Jz({root:e=":host, :root"}){const t=[e,"[data-theme]"].join(",");return E.jsx(Ba,{styles:r=>({[t]:r.__cssVars})})}Qb({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function SB(e){return Qb({name:`${e}StylesContext`,errorMessage:`useStyles: "styles" is undefined. Seems you forgot to wrap the components in "<${e} />" `})}function e3(){const{colorMode:e}=Qh();return E.jsx(Ba,{styles:t=>{const r=Ub(t,"styles.global"),n=Kb(r,{theme:t,colorMode:e});return n?Eb(n)(t):void 0}})}var qb=S.createContext({getDocument(){return document},getWindow(){return window}});qb.displayName="EnvironmentContext";function Zb(e){const{children:t,environment:r,disabled:n}=e,o=S.useRef(null),i=S.useMemo(()=>r||{getDocument:()=>{var s,l;return(l=(s=o.current)==null?void 0:s.ownerDocument)!=null?l:document},getWindow:()=>{var s,l;return(l=(s=o.current)==null?void 0:s.ownerDocument.defaultView)!=null?l:window}},[r]),a=!n||!r;return E.jsxs(qb.Provider,{value:i,children:[t,a&&E.jsx("span",{id:"__chakra_env",hidden:!0,ref:o})]})}Zb.displayName="EnvironmentProvider";var t3=e=>{const{children:t,colorModeManager:r,portalZIndex:n,resetScope:o,resetCSS:i=!0,theme:a={},environment:s,cssVarsRoot:l,disableEnvironment:u,disableGlobalStyle:c}=e,d=E.jsx(Zb,{environment:s,disabled:u,children:t});return E.jsx(Zz,{theme:a,cssVarsRoot:l,children:E.jsxs(Sb,{colorModeManager:r,options:a.config,children:[i?E.jsx(yP,{scope:o}):E.jsx(gP,{}),!c&&E.jsx(e3,{}),n?E.jsx(yb,{zIndex:n,children:d}):d]})})},r3=(e,t)=>e.find(r=>r.id===t);function gg(e,t){const r=Jb(e,t),n=r?e[r].findIndex(o=>o.id===t):-1;return{position:r,index:n}}function Jb(e,t){for(const[r,n]of Object.entries(e))if(r3(n,t))return r}function n3(e){const t=e.includes("right"),r=e.includes("left");let n="center";return t&&(n="flex-end"),r&&(n="flex-start"),{display:"flex",flexDirection:"column",alignItems:n}}function o3(e){const r=e==="top"||e==="bottom"?"0 auto":void 0,n=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,o=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,i=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",a=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:r,top:n,bottom:o,right:i,left:a}}function i3(e,t=[]){const r=S.useRef(e);return S.useEffect(()=>{r.current=e}),S.useCallback((...n)=>{var o;return(o=r.current)==null?void 0:o.call(r,...n)},t)}function a3(e,t){const r=i3(e);S.useEffect(()=>{if(t==null)return;let n=null;return n=window.setTimeout(()=>{r()},t),()=>{n&&window.clearTimeout(n)}},[t,r])}function yg(e,t){const r=S.useRef(!1),n=S.useRef(!1);S.useEffect(()=>{if(r.current&&n.current)return e();n.current=!0},t),S.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[])}const eS=S.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),ju=S.createContext({}),Va=S.createContext(null),Nu=typeof document<"u",ip=Nu?S.useLayoutEffect:S.useEffect,tS=S.createContext({strict:!1}),ap=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),s3="framerAppearId",rS="data-"+ap(s3);function l3(e,t,r,n){const{visualElement:o}=S.useContext(ju),i=S.useContext(tS),a=S.useContext(Va),s=S.useContext(eS).reducedMotion,l=S.useRef();n=n||i.renderer,!l.current&&n&&(l.current=n(e,{visualState:t,parent:o,props:r,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:s}));const u=l.current;S.useInsertionEffect(()=>{u&&u.update(r,a)});const c=S.useRef(!!r[rS]);return ip(()=>{u&&(u.render(),c.current&&u.animationState&&u.animationState.animateChanges())}),S.useEffect(()=>{u&&(u.updateFeatures(),!c.current&&u.animationState&&u.animationState.animateChanges(),c.current&&(window.HandoffAppearAnimations=!1,c.current=!1))}),u}function ko(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function u3(e,t,r){return S.useCallback(n=>{n&&e.mount&&e.mount(n),t&&(n?t.mount(n):t.unmount()),r&&(typeof r=="function"?r(n):ko(r)&&(r.current=n))},[t])}function Ta(e){return typeof e=="string"||Array.isArray(e)}function Vu(e){return typeof e=="object"&&typeof e.start=="function"}const sp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lp=["initial",...sp];function Wu(e){return Vu(e.animate)||lp.some(t=>Ta(e[t]))}function nS(e){return!!(Wu(e)||e.variants)}function c3(e,t){if(Wu(e)){const{initial:r,animate:n}=e;return{initial:r===!1||Ta(r)?r:void 0,animate:Ta(n)?n:void 0}}return e.inherit!==!1?t:{}}function d3(e){const{initial:t,animate:r}=c3(e,S.useContext(ju));return S.useMemo(()=>({initial:t,animate:r}),[bg(t),bg(r)])}function bg(e){return Array.isArray(e)?e.join(" "):e}const Sg={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ea={};for(const e in Sg)Ea[e]={isEnabled:t=>Sg[e].some(r=>!!t[r])};function f3(e){for(const t in e)Ea[t]={...Ea[t],...e[t]}}const up=S.createContext({}),oS=S.createContext({}),h3=Symbol.for("motionComponentSymbol");function p3({preloadedFeatures:e,createVisualElement:t,useRender:r,useVisualState:n,Component:o}){e&&f3(e);function i(s,l){let u;const c={...S.useContext(eS),...s,layoutId:m3(s)},{isStatic:d}=c,f=d3(s),p=n(s,d);if(!d&&Nu){f.visualElement=l3(o,p,c,t);const v=S.useContext(oS),y=S.useContext(tS).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,y,e,v))}return S.createElement(ju.Provider,{value:f},u&&f.visualElement?S.createElement(u,{visualElement:f.visualElement,...c}):null,r(o,s,u3(p,f.visualElement,l),p,d,f.visualElement))}const a=S.forwardRef(i);return a[h3]=o,a}function m3({layoutId:e}){const t=S.useContext(up).id;return t&&e!==void 0?t+"-"+e:e}function v3(e){function t(n,o={}){return p3(e(n,o))}if(typeof Proxy>"u")return t;const r=new Map;return new Proxy(t,{get:(n,o)=>(r.has(o)||r.set(o,t(o)),r.get(o))})}const g3=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function cp(e){return typeof e!="string"||e.includes("-")?!1:!!(g3.indexOf(e)>-1||/[A-Z]/.test(e))}const Kl={};function y3(e){Object.assign(Kl,e)}const Wa=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Xn=new Set(Wa);function iS(e,{layout:t,layoutId:r}){return Xn.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!Kl[e]||e==="opacity")}const ht=e=>!!(e&&e.getVelocity),b3={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},S3=Wa.length;function x3(e,{enableHardwareAcceleration:t=!0,allowTransformNone:r=!0},n,o){let i="";for(let a=0;at=>typeof t=="string"&&t.startsWith(e),sS=aS("--"),kf=aS("var(--"),w3=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,k3=(e,t)=>t&&typeof e=="number"?t.transform(e):e,cn=(e,t,r)=>Math.min(Math.max(r,e),t),Qn={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Zi={...Qn,transform:e=>cn(0,1,e)},Rs={...Qn,default:1},Ji=e=>Math.round(e*1e5)/1e5,Uu=/(-)?([\d]*\.?[\d])+/g,lS=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,C3=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Ua(e){return typeof e=="string"}const Ha=e=>({test:t=>Ua(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Vr=Ha("deg"),hr=Ha("%"),j=Ha("px"),_3=Ha("vh"),P3=Ha("vw"),xg={...hr,parse:e=>hr.parse(e)/100,transform:e=>hr.transform(e*100)},wg={...Qn,transform:Math.round},uS={borderWidth:j,borderTopWidth:j,borderRightWidth:j,borderBottomWidth:j,borderLeftWidth:j,borderRadius:j,radius:j,borderTopLeftRadius:j,borderTopRightRadius:j,borderBottomRightRadius:j,borderBottomLeftRadius:j,width:j,maxWidth:j,height:j,maxHeight:j,size:j,top:j,right:j,bottom:j,left:j,padding:j,paddingTop:j,paddingRight:j,paddingBottom:j,paddingLeft:j,margin:j,marginTop:j,marginRight:j,marginBottom:j,marginLeft:j,rotate:Vr,rotateX:Vr,rotateY:Vr,rotateZ:Vr,scale:Rs,scaleX:Rs,scaleY:Rs,scaleZ:Rs,skew:Vr,skewX:Vr,skewY:Vr,distance:j,translateX:j,translateY:j,translateZ:j,x:j,y:j,z:j,perspective:j,transformPerspective:j,opacity:Zi,originX:xg,originY:xg,originZ:j,zIndex:wg,fillOpacity:Zi,strokeOpacity:Zi,numOctaves:wg};function dp(e,t,r,n){const{style:o,vars:i,transform:a,transformOrigin:s}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(sS(d)){i[d]=f;continue}const p=uS[d],v=k3(f,p);if(Xn.has(d)){if(l=!0,a[d]=v,!c)continue;f!==(p.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,s[d]=v):o[d]=v}if(t.transform||(l||n?o.transform=x3(e.transform,r,c,n):o.transform&&(o.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:p=0}=s;o.transformOrigin=`${d} ${f} ${p}`}}const fp=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function cS(e,t,r){for(const n in t)!ht(t[n])&&!iS(n,r)&&(e[n]=t[n])}function T3({transformTemplate:e},t,r){return S.useMemo(()=>{const n=fp();return dp(n,t,{enableHardwareAcceleration:!r},e),Object.assign({},n.vars,n.style)},[t])}function E3(e,t,r){const n=e.style||{},o={};return cS(o,n,e),Object.assign(o,T3(e,t,r)),e.transformValues?e.transformValues(o):o}function $3(e,t,r){const n={},o=E3(e,t,r);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=o,n}const A3=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function Yl(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||A3.has(e)}let dS=e=>!Yl(e);function R3(e){e&&(dS=t=>t.startsWith("on")?!Yl(t):e(t))}try{R3(require("@emotion/is-prop-valid").default)}catch{}function M3(e,t,r){const n={};for(const o in e)o==="values"&&typeof e.values=="object"||(dS(o)||r===!0&&Yl(o)||!t&&!Yl(o)||e.draggable&&o.startsWith("onDrag"))&&(n[o]=e[o]);return n}function kg(e,t,r){return typeof e=="string"?e:j.transform(t+r*e)}function z3(e,t,r){const n=kg(t,e.x,e.width),o=kg(r,e.y,e.height);return`${n} ${o}`}const F3={offset:"stroke-dashoffset",array:"stroke-dasharray"},D3={offset:"strokeDashoffset",array:"strokeDasharray"};function I3(e,t,r=1,n=0,o=!0){e.pathLength=1;const i=o?F3:D3;e[i.offset]=j.transform(-n);const a=j.transform(t),s=j.transform(r);e[i.array]=`${a} ${s}`}function hp(e,{attrX:t,attrY:r,attrScale:n,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...u},c,d,f){if(dp(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:v,dimensions:y}=e;p.transform&&(y&&(v.transform=p.transform),delete p.transform),y&&(o!==void 0||i!==void 0||v.transform)&&(v.transformOrigin=z3(y,o!==void 0?o:.5,i!==void 0?i:.5)),t!==void 0&&(p.x=t),r!==void 0&&(p.y=r),n!==void 0&&(p.scale=n),a!==void 0&&I3(p,a,s,l,!1)}const fS=()=>({...fp(),attrs:{}}),pp=e=>typeof e=="string"&&e.toLowerCase()==="svg";function L3(e,t,r,n){const o=S.useMemo(()=>{const i=fS();return hp(i,t,{enableHardwareAcceleration:!1},pp(n),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};cS(i,e.style,e),o.style={...i,...o.style}}return o}function O3(e=!1){return(r,n,o,{latestValues:i},a)=>{const l=(cp(r)?L3:$3)(n,i,a,r),c={...M3(n,typeof r=="string",e),...l,ref:o},{children:d}=n,f=S.useMemo(()=>ht(d)?d.get():d,[d]);return S.createElement(r,{...c,children:f})}}function hS(e,{style:t,vars:r},n,o){Object.assign(e.style,t,o&&o.getProjectionStyles(n));for(const i in r)e.style.setProperty(i,r[i])}const pS=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"]);function mS(e,t,r,n){hS(e,t,void 0,n);for(const o in t.attrs)e.setAttribute(pS.has(o)?o:ap(o),t.attrs[o])}function mp(e,t){const{style:r}=e,n={};for(const o in r)(ht(r[o])||t.style&&ht(t.style[o])||iS(o,e))&&(n[o]=r[o]);return n}function vS(e,t){const r=mp(e,t);for(const n in e)if(ht(e[n])||ht(t[n])){const o=Wa.indexOf(n)!==-1?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n;r[o]=e[n]}return r}function vp(e,t,r,n={},o={}){return typeof t=="function"&&(t=t(r!==void 0?r:e.custom,n,o)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(r!==void 0?r:e.custom,n,o)),t}function gS(e){const t=S.useRef(null);return t.current===null&&(t.current=e()),t.current}const Xl=e=>Array.isArray(e),B3=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),j3=e=>Xl(e)?e[e.length-1]||0:e;function cl(e){const t=ht(e)?e.get():e;return B3(t)?t.toValue():t}function N3({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:r},n,o,i){const a={latestValues:V3(n,o,i,e),renderState:t()};return r&&(a.mount=s=>r(n,s,a)),a}const yS=e=>(t,r)=>{const n=S.useContext(ju),o=S.useContext(Va),i=()=>N3(e,t,n,o);return r?i():gS(i)};function V3(e,t,r,n){const o={},i=n(e,{});for(const f in i)o[f]=cl(i[f]);let{initial:a,animate:s}=e;const l=Wu(e),u=nS(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let c=r?r.initial===!1:!1;c=c||a===!1;const d=c?s:a;return d&&typeof d!="boolean"&&!Vu(d)&&(Array.isArray(d)?d:[d]).forEach(p=>{const v=vp(e,p);if(!v)return;const{transitionEnd:y,transition:x,...m}=v;for(const h in m){let g=m[h];if(Array.isArray(g)){const C=c?g.length-1:0;g=g[C]}g!==null&&(o[h]=g)}for(const h in y)o[h]=y[h]}),o}const xe=e=>e;class Cg{constructor(){this.order=[],this.scheduled=new Set}add(t){if(!this.scheduled.has(t))return this.scheduled.add(t),this.order.push(t),!0}remove(t){const r=this.order.indexOf(t);r!==-1&&(this.order.splice(r,1),this.scheduled.delete(t))}clear(){this.order.length=0,this.scheduled.clear()}}function W3(e){let t=new Cg,r=new Cg,n=0,o=!1,i=!1;const a=new WeakSet,s={schedule:(l,u=!1,c=!1)=>{const d=c&&o,f=d?t:r;return u&&a.add(l),f.add(l)&&d&&o&&(n=t.order.length),l},cancel:l=>{r.remove(l),a.delete(l)},process:l=>{if(o){i=!0;return}if(o=!0,[t,r]=[r,t],r.clear(),n=t.order.length,n)for(let u=0;u(d[f]=W3(()=>r=!0),d),{}),a=d=>i[d].process(o),s=()=>{const d=performance.now();r=!1,o.delta=n?1e3/60:Math.max(Math.min(d-o.timestamp,U3),1),o.timestamp=d,o.isProcessing=!0,Ms.forEach(a),o.isProcessing=!1,r&&t&&(n=!1,e(s))},l=()=>{r=!0,n=!0,o.isProcessing||e(s)};return{schedule:Ms.reduce((d,f)=>{const p=i[f];return d[f]=(v,y=!1,x=!1)=>(r||l(),p.schedule(v,y,x)),d},{}),cancel:d=>Ms.forEach(f=>i[f].cancel(d)),state:o,steps:i}}const{schedule:se,cancel:Ir,state:De,steps:qc}=H3(typeof requestAnimationFrame<"u"?requestAnimationFrame:xe,!0),G3={useVisualState:yS({scrapeMotionValuesFromProps:vS,createRenderState:fS,onMount:(e,t,{renderState:r,latestValues:n})=>{se.read(()=>{try{r.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),se.render(()=>{hp(r,n,{enableHardwareAcceleration:!1},pp(t.tagName),e.transformTemplate),mS(t,r)})}})},K3={useVisualState:yS({scrapeMotionValuesFromProps:mp,createRenderState:fp})};function Y3(e,{forwardMotionProps:t=!1},r,n){return{...cp(e)?G3:K3,preloadedFeatures:r,useRender:O3(t),createVisualElement:n,Component:e}}function _r(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}const bS=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Hu(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const X3=e=>t=>bS(t)&&e(t,Hu(t));function Er(e,t,r,n){return _r(e,t,X3(r),n)}const Q3=(e,t)=>r=>t(e(r)),an=(...e)=>e.reduce(Q3);function SS(e){let t=null;return()=>{const r=()=>{t=null};return t===null?(t=e,r):!1}}const _g=SS("dragHorizontal"),Pg=SS("dragVertical");function xS(e){let t=!1;if(e==="y")t=Pg();else if(e==="x")t=_g();else{const r=_g(),n=Pg();r&&n?t=()=>{r(),n()}:(r&&r(),n&&n())}return t}function wS(){const e=xS(!0);return e?(e(),!1):!0}class vn{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Tg(e,t){const r="pointer"+(t?"enter":"leave"),n="onHover"+(t?"Start":"End"),o=(i,a)=>{if(i.type==="touch"||wS())return;const s=e.getProps();e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",t),s[n]&&se.update(()=>s[n](i,a))};return Er(e.current,r,o,{passive:!e.getProps()[n]})}class q3 extends vn{mount(){this.unmount=an(Tg(this.node,!0),Tg(this.node,!1))}unmount(){}}class Z3 extends vn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=an(_r(this.node.current,"focus",()=>this.onFocus()),_r(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const kS=(e,t)=>t?e===t?!0:kS(e,t.parentElement):!1;function Zc(e,t){if(!t)return;const r=new PointerEvent("pointer"+e);t(r,Hu(r))}class J3 extends vn{constructor(){super(...arguments),this.removeStartListeners=xe,this.removeEndListeners=xe,this.removeAccessibleListeners=xe,this.startPointerPress=(t,r)=>{if(this.removeEndListeners(),this.isPressing)return;const n=this.node.getProps(),i=Er(window,"pointerup",(s,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();se.update(()=>{kS(this.node.current,s.target)?u&&u(s,l):c&&c(s,l)})},{passive:!(n.onTap||n.onPointerUp)}),a=Er(window,"pointercancel",(s,l)=>this.cancelPress(s,l),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=an(i,a),this.startPress(t,r)},this.startAccessiblePress=()=>{const t=i=>{if(i.key!=="Enter"||this.isPressing)return;const a=s=>{s.key!=="Enter"||!this.checkPressEnd()||Zc("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&se.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=_r(this.node.current,"keyup",a),Zc("down",(s,l)=>{this.startPress(s,l)})},r=_r(this.node.current,"keydown",t),n=()=>{this.isPressing&&Zc("cancel",(i,a)=>this.cancelPress(i,a))},o=_r(this.node.current,"blur",n);this.removeAccessibleListeners=an(r,o)}}startPress(t,r){this.isPressing=!0;const{onTapStart:n,whileTap:o}=this.node.getProps();o&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&se.update(()=>n(t,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!wS()}cancelPress(t,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&se.update(()=>n(t,r))}mount(){const t=this.node.getProps(),r=Er(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=_r(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=an(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Cf=new WeakMap,Jc=new WeakMap,e4=e=>{const t=Cf.get(e.target);t&&t(e)},t4=e=>{e.forEach(e4)};function r4({root:e,...t}){const r=e||document;Jc.has(r)||Jc.set(r,{});const n=Jc.get(r),o=JSON.stringify(t);return n[o]||(n[o]=new IntersectionObserver(t4,{root:e,...t})),n[o]}function n4(e,t,r){const n=r4(t);return Cf.set(e,r),n.observe(e),()=>{Cf.delete(e),n.unobserve(e)}}const o4={some:0,all:1};class i4 extends vn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:r,margin:n,amount:o="some",once:i}=t,a={root:r?r.current:void 0,rootMargin:n,threshold:typeof o=="number"?o:o4[o]},s=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return n4(this.node.current,a,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some(a4(t,r))&&this.startObserver()}unmount(){}}function a4({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const s4={inView:{Feature:i4},tap:{Feature:J3},focus:{Feature:Z3},hover:{Feature:q3}};function CS(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;nt[n]=r.get()),t}function u4(e){const t={};return e.values.forEach((r,n)=>t[n]=r.getVelocity()),t}function Gu(e,t,r){const n=e.getProps();return vp(n,t,r!==void 0?r:n.custom,l4(e),u4(e))}let c4=xe,gp=xe;const sn=e=>e*1e3,$r=e=>e/1e3,d4={current:!1},_S=e=>Array.isArray(e)&&typeof e[0]=="number";function PS(e){return!!(!e||typeof e=="string"&&TS[e]||_S(e)||Array.isArray(e)&&e.every(PS))}const Di=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,TS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Di([0,.65,.55,1]),circOut:Di([.55,0,1,.45]),backIn:Di([.31,.01,.66,-.59]),backOut:Di([.33,1.53,.69,.99])};function ES(e){if(e)return _S(e)?Di(e):Array.isArray(e)?e.map(ES):TS[e]}function f4(e,t,r,{delay:n=0,duration:o,repeat:i=0,repeatType:a="loop",ease:s,times:l}={}){const u={[t]:r};l&&(u.offset=l);const c=ES(s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:n,duration:o,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"})}function h4(e,{repeat:t,repeatType:r="loop"}){const n=t&&r!=="loop"&&t%2===1?0:e.length-1;return e[n]}const $S=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,p4=1e-7,m4=12;function v4(e,t,r,n,o){let i,a,s=0;do a=t+(r-t)/2,i=$S(a,n,o)-e,i>0?r=a:t=a;while(Math.abs(i)>p4&&++sv4(i,0,1,e,r);return i=>i===0||i===1?i:$S(o(i),t,n)}const g4=Ga(.42,0,1,1),y4=Ga(0,0,.58,1),AS=Ga(.42,0,.58,1),b4=e=>Array.isArray(e)&&typeof e[0]!="number",RS=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,MS=e=>t=>1-e(1-t),zS=e=>1-Math.sin(Math.acos(e)),yp=MS(zS),S4=RS(yp),FS=Ga(.33,1.53,.69,.99),bp=MS(FS),x4=RS(bp),w4=e=>(e*=2)<1?.5*bp(e):.5*(2-Math.pow(2,-10*(e-1))),k4={linear:xe,easeIn:g4,easeInOut:AS,easeOut:y4,circIn:zS,circInOut:S4,circOut:yp,backIn:bp,backInOut:x4,backOut:FS,anticipate:w4},Eg=e=>{if(Array.isArray(e)){gp(e.length===4);const[t,r,n,o]=e;return Ga(t,r,n,o)}else if(typeof e=="string")return k4[e];return e},Sp=(e,t)=>r=>!!(Ua(r)&&C3.test(r)&&r.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(r,t)),DS=(e,t,r)=>n=>{if(!Ua(n))return n;const[o,i,a,s]=n.match(Uu);return{[e]:parseFloat(o),[t]:parseFloat(i),[r]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},C4=e=>cn(0,255,e),ed={...Qn,transform:e=>Math.round(C4(e))},Mn={test:Sp("rgb","red"),parse:DS("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+ed.transform(e)+", "+ed.transform(t)+", "+ed.transform(r)+", "+Ji(Zi.transform(n))+")"};function _4(e){let t="",r="",n="",o="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),o=e.substring(4,5),t+=t,r+=r,n+=n,o+=o),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:o?parseInt(o,16)/255:1}}const _f={test:Sp("#"),parse:_4,transform:Mn.transform},Co={test:Sp("hsl","hue"),parse:DS("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+hr.transform(Ji(t))+", "+hr.transform(Ji(r))+", "+Ji(Zi.transform(n))+")"},Ze={test:e=>Mn.test(e)||_f.test(e)||Co.test(e),parse:e=>Mn.test(e)?Mn.parse(e):Co.test(e)?Co.parse(e):_f.parse(e),transform:e=>Ua(e)?e:e.hasOwnProperty("red")?Mn.transform(e):Co.transform(e)},ge=(e,t,r)=>-r*e+r*t+e;function td(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function P4({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,t/=100,r/=100;let o=0,i=0,a=0;if(!t)o=i=a=r;else{const s=r<.5?r*(1+t):r+t-r*t,l=2*r-s;o=td(l,s,e+1/3),i=td(l,s,e),a=td(l,s,e-1/3)}return{red:Math.round(o*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:n}}const rd=(e,t,r)=>{const n=e*e;return Math.sqrt(Math.max(0,r*(t*t-n)+n))},T4=[_f,Mn,Co],E4=e=>T4.find(t=>t.test(e));function $g(e){const t=E4(e);let r=t.parse(e);return t===Co&&(r=P4(r)),r}const IS=(e,t)=>{const r=$g(e),n=$g(t),o={...r};return i=>(o.red=rd(r.red,n.red,i),o.green=rd(r.green,n.green,i),o.blue=rd(r.blue,n.blue,i),o.alpha=ge(r.alpha,n.alpha,i),Mn.transform(o))};function $4(e){var t,r;return isNaN(e)&&Ua(e)&&(((t=e.match(Uu))===null||t===void 0?void 0:t.length)||0)+(((r=e.match(lS))===null||r===void 0?void 0:r.length)||0)>0}const LS={regex:w3,countKey:"Vars",token:"${v}",parse:xe},OS={regex:lS,countKey:"Colors",token:"${c}",parse:Ze.parse},BS={regex:Uu,countKey:"Numbers",token:"${n}",parse:Qn.parse};function nd(e,{regex:t,countKey:r,token:n,parse:o}){const i=e.tokenised.match(t);i&&(e["num"+r]=i.length,e.tokenised=e.tokenised.replace(t,n),e.values.push(...i.map(o)))}function Ql(e){const t=e.toString(),r={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return r.value.includes("var(--")&&nd(r,LS),nd(r,OS),nd(r,BS),r}function jS(e){return Ql(e).values}function NS(e){const{values:t,numColors:r,numVars:n,tokenised:o}=Ql(e),i=t.length;return a=>{let s=o;for(let l=0;ltypeof e=="number"?0:e;function R4(e){const t=jS(e);return NS(e)(t.map(A4))}const dn={test:$4,parse:jS,createTransformer:NS,getAnimatableNone:R4},VS=(e,t)=>r=>`${r>0?t:e}`;function WS(e,t){return typeof e=="number"?r=>ge(e,t,r):Ze.test(e)?IS(e,t):e.startsWith("var(")?VS(e,t):HS(e,t)}const US=(e,t)=>{const r=[...e],n=r.length,o=e.map((i,a)=>WS(i,t[a]));return i=>{for(let a=0;a{const r={...e,...t},n={};for(const o in r)e[o]!==void 0&&t[o]!==void 0&&(n[o]=WS(e[o],t[o]));return o=>{for(const i in n)r[i]=n[i](o);return r}},HS=(e,t)=>{const r=dn.createTransformer(t),n=Ql(e),o=Ql(t);return n.numVars===o.numVars&&n.numColors===o.numColors&&n.numNumbers>=o.numNumbers?an(US(n.values,o.values),r):VS(e,t)},$a=(e,t,r)=>{const n=t-e;return n===0?1:(r-e)/n},Ag=(e,t)=>r=>ge(e,t,r);function z4(e){return typeof e=="number"?Ag:typeof e=="string"?Ze.test(e)?IS:HS:Array.isArray(e)?US:typeof e=="object"?M4:Ag}function F4(e,t,r){const n=[],o=r||z4(e[0]),i=e.length-1;for(let a=0;at[0];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=F4(t,n,o),s=a.length,l=u=>{let c=0;if(s>1)for(;cl(cn(e[0],e[i-1],u)):l}function D4(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const o=$a(0,t,n);e.push(ge(r,1,o))}}function I4(e){const t=[0];return D4(t,e.length-1),t}function L4(e,t){return e.map(r=>r*t)}function O4(e,t){return e.map(()=>t||AS).splice(0,e.length-1)}function ql({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const o=b4(n)?n.map(Eg):Eg(n),i={done:!1,value:t[0]},a=L4(r&&r.length===t.length?r:I4(t),e),s=GS(a,t,{ease:Array.isArray(o)?o:O4(t,o)});return{calculatedDuration:e,next:l=>(i.value=s(l),i.done=l>=e,i)}}function KS(e,t){return t?e*(1e3/t):0}const B4=5;function YS(e,t,r){const n=Math.max(t-B4,0);return KS(r-e(n),t-n)}const od=.001,j4=.01,Rg=10,N4=.05,V4=1;function W4({duration:e=800,bounce:t=.25,velocity:r=0,mass:n=1}){let o,i;c4(e<=sn(Rg));let a=1-t;a=cn(N4,V4,a),e=cn(j4,Rg,$r(e)),a<1?(o=u=>{const c=u*a,d=c*e,f=c-r,p=Pf(u,a),v=Math.exp(-d);return od-f/p*v},i=u=>{const d=u*a*e,f=d*r+r,p=Math.pow(a,2)*Math.pow(u,2)*e,v=Math.exp(-d),y=Pf(Math.pow(u,2),a);return(-o(u)+od>0?-1:1)*((f-p)*v)/y}):(o=u=>{const c=Math.exp(-u*e),d=(u-r)*e+1;return-od+c*d},i=u=>{const c=Math.exp(-u*e),d=(r-u)*(e*e);return c*d});const s=5/e,l=H4(o,i,s);if(e=sn(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*n;return{stiffness:u,damping:a*2*Math.sqrt(n*u),duration:e}}}const U4=12;function H4(e,t,r){let n=r;for(let o=1;oe[r]!==void 0)}function Y4(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!Mg(e,K4)&&Mg(e,G4)){const r=W4(e);t={...t,...r,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function XS({keyframes:e,restDelta:t,restSpeed:r,...n}){const o=e[0],i=e[e.length-1],a={done:!1,value:o},{stiffness:s,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=Y4(n),p=c?-$r(c):0,v=l/(2*Math.sqrt(s*u)),y=i-o,x=$r(Math.sqrt(s/u)),m=Math.abs(y)<5;r||(r=m?.01:2),t||(t=m?.005:.5);let h;if(v<1){const g=Pf(x,v);h=C=>{const _=Math.exp(-v*x*C);return i-_*((p+v*x*y)/g*Math.sin(g*C)+y*Math.cos(g*C))}}else if(v===1)h=g=>i-Math.exp(-x*g)*(y+(p+x*y)*g);else{const g=x*Math.sqrt(v*v-1);h=C=>{const _=Math.exp(-v*x*C),$=Math.min(g*C,300);return i-_*((p+v*x*y)*Math.sinh($)+g*y*Math.cosh($))/g}}return{calculatedDuration:f&&d||null,next:g=>{const C=h(g);if(f)a.done=g>=d;else{let _=p;g!==0&&(v<1?_=YS(h,g,C):_=0);const $=Math.abs(_)<=r,T=Math.abs(i-C)<=t;a.done=$&&T}return a.value=a.done?i:C,a}}}function zg({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},p=A=>s!==void 0&&Al,v=A=>s===void 0?l:l===void 0||Math.abs(s-A)-y*Math.exp(-A/n),g=A=>m+h(A),C=A=>{const M=h(A),I=g(A);f.done=Math.abs(M)<=u,f.value=f.done?m:I};let _,$;const T=A=>{p(f.value)&&(_=A,$=XS({keyframes:[f.value,v(f.value)],velocity:YS(g,A,f.value),damping:o,stiffness:i,restDelta:u,restSpeed:c}))};return T(0),{calculatedDuration:null,next:A=>{let M=!1;return!$&&_===void 0&&(M=!0,C(A),T(A)),_!==void 0&&A>_?$.next(A-_):(!M&&C(A),f)}}}const X4=e=>{const t=({timestamp:r})=>e(r);return{start:()=>se.update(t,!0),stop:()=>Ir(t),now:()=>De.isProcessing?De.timestamp:performance.now()}},Fg=2e4;function Dg(e){let t=0;const r=50;let n=e.next(t);for(;!n.done&&t=Fg?1/0:t}const Q4={decay:zg,inertia:zg,tween:ql,keyframes:ql,spring:XS};function Zl({autoplay:e=!0,delay:t=0,driver:r=X4,keyframes:n,type:o="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let p=1,v=!1,y,x;const m=()=>{x=new Promise(B=>{y=B})};m();let h;const g=Q4[o]||ql;let C;g!==ql&&typeof n[0]!="number"&&(C=GS([0,100],n,{clamp:!1}),n=[0,100]);const _=g({...f,keyframes:n});let $;s==="mirror"&&($=g({...f,keyframes:[...n].reverse(),velocity:-(f.velocity||0)}));let T="idle",A=null,M=null,I=null;_.calculatedDuration===null&&i&&(_.calculatedDuration=Dg(_));const{calculatedDuration:ee}=_;let ze=1/0,Pe=1/0;ee!==null&&(ze=ee+a,Pe=ze*(i+1)-a);let oe=0;const ue=B=>{if(M===null)return;p>0&&(M=Math.min(M,B)),p<0&&(M=Math.min(B-Pe/p,M)),A!==null?oe=A:oe=Math.round(B-M)*p;const ne=oe-t*(p>=0?1:-1),U=p>=0?ne<0:ne>Pe;oe=Math.max(ne,0),T==="finished"&&A===null&&(oe=Pe);let Ge=oe,Xt=_;if(i){const Qt=oe/ze;let Ot=Math.floor(Qt),qt=Qt%1;!qt&&Qt>=1&&(qt=1),qt===1&&Ot--,Ot=Math.min(Ot,i+1);const ai=!!(Ot%2);ai&&(s==="reverse"?(qt=1-qt,a&&(qt-=a/ze)):s==="mirror"&&(Xt=$));let Xa=cn(0,1,qt);oe>Pe&&(Xa=s==="reverse"&&ai?1:0),Ge=Xa*ze}const we=U?{done:!1,value:n[0]}:Xt.next(Ge);C&&(we.value=C(we.value));let{done:Fe}=we;!U&&ee!==null&&(Fe=p>=0?oe>=Pe:oe<=0);const mt=A===null&&(T==="finished"||T==="running"&&Fe);return d&&d(we.value),mt&&z(),we},He=()=>{h&&h.stop(),h=void 0},it=()=>{T="idle",He(),y(),m(),M=I=null},z=()=>{T="finished",c&&c(),He(),y()},N=()=>{if(v)return;h||(h=r(ue));const B=h.now();l&&l(),A!==null?M=B-A:(!M||T==="finished")&&(M=B),T==="finished"&&m(),I=M,A=null,T="running",h.start()};e&&N();const V={then(B,ne){return x.then(B,ne)},get time(){return $r(oe)},set time(B){B=sn(B),oe=B,A!==null||!h||p===0?A=B:M=h.now()-B/p},get duration(){const B=_.calculatedDuration===null?Dg(_):_.calculatedDuration;return $r(B)},get speed(){return p},set speed(B){B===p||!h||(p=B,V.time=$r(oe))},get state(){return T},play:N,pause:()=>{T="paused",A=oe},stop:()=>{v=!0,T!=="idle"&&(T="idle",u&&u(),it())},cancel:()=>{I!==null&&ue(I),it()},complete:()=>{T="finished"},sample:B=>(M=0,ue(B))};return V}function q4(e){let t;return()=>(t===void 0&&(t=e()),t)}const Z4=q4(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),J4=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),zs=10,eF=2e4,tF=(e,t)=>t.type==="spring"||e==="backgroundColor"||!PS(t.ease);function rF(e,t,{onUpdate:r,onComplete:n,...o}){if(!(Z4()&&J4.has(t)&&!o.repeatDelay&&o.repeatType!=="mirror"&&o.damping!==0&&o.type!=="inertia"))return!1;let a=!1,s,l;const u=()=>{l=new Promise(h=>{s=h})};u();let{keyframes:c,duration:d=300,ease:f,times:p}=o;if(tF(t,o)){const h=Zl({...o,repeat:0,delay:0});let g={done:!1,value:c[0]};const C=[];let _=0;for(;!g.done&&_v.cancel(),x=()=>{se.update(y),s(),u()};return v.onfinish=()=>{e.set(h4(c,o)),n&&n(),x()},{then(h,g){return l.then(h,g)},attachTimeline(h){return v.timeline=h,v.onfinish=null,xe},get time(){return $r(v.currentTime||0)},set time(h){v.currentTime=sn(h)},get speed(){return v.playbackRate},set speed(h){v.playbackRate=h},get duration(){return $r(d)},play:()=>{a||(v.play(),Ir(y))},pause:()=>v.pause(),stop:()=>{if(a=!0,v.playState==="idle")return;const{currentTime:h}=v;if(h){const g=Zl({...o,autoplay:!1});e.setWithVelocity(g.sample(h-zs).value,g.sample(h).value,zs)}x()},complete:()=>v.finish(),cancel:x}}function nF({keyframes:e,delay:t,onUpdate:r,onComplete:n}){const o=()=>(r&&r(e[e.length-1]),n&&n(),{time:0,speed:1,duration:0,play:xe,pause:xe,stop:xe,then:i=>(i(),Promise.resolve()),cancel:xe,complete:xe});return t?Zl({keyframes:[0,1],duration:0,delay:t,onComplete:o}):o()}const oF={type:"spring",stiffness:500,damping:25,restSpeed:10},iF=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),aF={type:"keyframes",duration:.8},sF={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},lF=(e,{keyframes:t})=>t.length>2?aF:Xn.has(e)?e.startsWith("scale")?iF(t[1]):oF:sF,Tf=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(dn.test(t)||t==="0")&&!t.startsWith("url(")),uF=new Set(["brightness","contrast","saturate","opacity"]);function cF(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=r.match(Uu)||[];if(!n)return e;const o=r.replace(n,"");let i=uF.has(t)?1:0;return n!==r&&(i*=100),t+"("+i+o+")"}const dF=/([a-z-]*)\(.*?\)/g,Ef={...dn,getAnimatableNone:e=>{const t=e.match(dF);return t?t.map(cF).join(" "):e}},fF={...uS,color:Ze,backgroundColor:Ze,outlineColor:Ze,fill:Ze,stroke:Ze,borderColor:Ze,borderTopColor:Ze,borderRightColor:Ze,borderBottomColor:Ze,borderLeftColor:Ze,filter:Ef,WebkitFilter:Ef},xp=e=>fF[e];function QS(e,t){let r=xp(e);return r!==Ef&&(r=dn),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const qS=e=>/^0[^.\s]+$/.test(e);function hF(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||qS(e)}function pF(e,t,r,n){const o=Tf(t,r);let i;Array.isArray(r)?i=[...r]:i=[null,r];const a=n.from!==void 0?n.from:e.get();let s;const l=[];for(let u=0;uo=>{const i=wp(n,e)||{},a=i.delay||n.delay||0;let{elapsed:s=0}=n;s=s-sn(a);const l=pF(t,e,r,i),u=l[0],c=l[l.length-1],d=Tf(e,u),f=Tf(e,c);let p={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...i,delay:-s,onUpdate:v=>{t.set(v),i.onUpdate&&i.onUpdate(v)},onComplete:()=>{o(),i.onComplete&&i.onComplete()}};if(mF(i)||(p={...p,...lF(e,p)}),p.duration&&(p.duration=sn(p.duration)),p.repeatDelay&&(p.repeatDelay=sn(p.repeatDelay)),!d||!f||d4.current||i.type===!1)return nF(p);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const v=rF(t,e,p);if(v)return v}return Zl(p)};function Jl(e){return!!(ht(e)&&e.add)}const ZS=e=>/^\-?\d*\.?\d+$/.test(e);function Cp(e,t){e.indexOf(t)===-1&&e.push(t)}function _p(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}class Pp{constructor(){this.subscriptions=[]}add(t){return Cp(this.subscriptions,t),()=>_p(this.subscriptions,t)}notify(t,r,n){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,r,n);else for(let i=0;i!isNaN(parseFloat(e));class gF{constructor(t,r={}){this.version="10.16.12",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(n,o=!0)=>{this.prev=this.current,this.current=n;const{delta:i,timestamp:a}=De;this.lastUpdated!==a&&(this.timeDelta=i,this.lastUpdated=a,se.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),o&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>se.postRender(this.velocityCheck),this.velocityCheck=({timestamp:n})=>{n!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=vF(this.current),this.owner=r.owner}onChange(t){return this.on("change",t)}on(t,r){this.events[t]||(this.events[t]=new Pp);const n=this.events[t].add(r);return t==="change"?()=>{n(),se.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t,r=!0){!r||!this.passiveEffect?this.updateAndNotify(t,r):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,r,n){this.set(r),this.prev=t,this.timeDelta=n}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?KS(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=t(r),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.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Zo(e,t){return new gF(e,t)}const JS=e=>t=>t.test(e),yF={test:e=>e==="auto",parse:e=>e},ex=[Qn,j,hr,Vr,P3,_3,yF],wi=e=>ex.find(JS(e)),bF=[...ex,Ze,dn],SF=e=>bF.find(JS(e));function xF(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Zo(r))}function wF(e,t){const r=Gu(e,t);let{transitionEnd:n={},transition:o={},...i}=r?e.makeTargetAnimatable(r,!1):{};i={...i,...n};for(const a in i){const s=j3(i[a]);xF(e,a,s)}}function kF(e,t,r){var n,o;const i=Object.keys(t).filter(s=>!e.hasValue(s)),a=i.length;if(a)for(let s=0;sl.remove(d))),u.push(m)}return a&&Promise.all(u).then(()=>{a&&wF(e,a)}),u}function $f(e,t,r={}){const n=Gu(e,t,r.custom);let{transition:o=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(o=r.transitionOverride);const i=n?()=>Promise.all(tx(e,n,r)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=o;return TF(e,t,u+l,c,d,r)}:()=>Promise.resolve(),{when:s}=o;if(s){const[l,u]=s==="beforeChildren"?[i,a]:[a,i];return l().then(()=>u())}else return Promise.all([i(),a(r.delay)])}function TF(e,t,r=0,n=0,o=1,i){const a=[],s=(e.variantChildren.size-1)*n,l=o===1?(u=0)=>u*n:(u=0)=>s-u*n;return Array.from(e.variantChildren).sort(EF).forEach((u,c)=>{u.notify("AnimationStart",t),a.push($f(u,t,{...i,delay:r+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function EF(e,t){return e.sortNodePosition(t)}function $F(e,t,r={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const o=t.map(i=>$f(e,i,r));n=Promise.all(o)}else if(typeof t=="string")n=$f(e,t,r);else{const o=typeof t=="function"?Gu(e,t,r.custom):t;n=Promise.all(tx(e,o,r))}return n.then(()=>e.notify("AnimationComplete",t))}const AF=[...sp].reverse(),RF=sp.length;function MF(e){return t=>Promise.all(t.map(({animation:r,options:n})=>$F(e,r,n)))}function zF(e){let t=MF(e);const r=DF();let n=!0;const o=(l,u)=>{const c=Gu(e,u);if(c){const{transition:d,transitionEnd:f,...p}=c;l={...l,...p,...f}}return l};function i(l){t=l(e)}function a(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],p=new Set;let v={},y=1/0;for(let m=0;my&&_;const I=Array.isArray(C)?C:[C];let ee=I.reduce(o,{});$===!1&&(ee={});const{prevResolvedValues:ze={}}=g,Pe={...ze,...ee},oe=ue=>{M=!0,p.delete(ue),g.needsAnimating[ue]=!0};for(const ue in Pe){const He=ee[ue],it=ze[ue];v.hasOwnProperty(ue)||(He!==it?Xl(He)&&Xl(it)?!CS(He,it)||A?oe(ue):g.protectedKeys[ue]=!0:He!==void 0?oe(ue):p.add(ue):He!==void 0&&p.has(ue)?oe(ue):g.protectedKeys[ue]=!0)}g.prevProp=C,g.prevResolvedValues=ee,g.isActive&&(v={...v,...ee}),n&&e.blockInitialAnimation&&(M=!1),M&&!T&&f.push(...I.map(ue=>({animation:ue,options:{type:h,...l}})))}if(p.size){const m={};p.forEach(h=>{const g=e.getBaseTarget(h);g!==void 0&&(m[h]=g)}),f.push({animation:m})}let x=!!f.length;return n&&c.initial===!1&&!e.manuallyAnimateOnMount&&(x=!1),n=!1,x?t(f):Promise.resolve()}function s(l,u,c){var d;if(r[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(p=>{var v;return(v=p.animationState)===null||v===void 0?void 0:v.setActive(l,u)}),r[l].isActive=u;const f=a(c,l);for(const p in r)r[p].protectedKeys={};return f}return{animateChanges:a,setActive:s,setAnimateFunction:i,getState:()=>r}}function FF(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!CS(t,e):!1}function Sn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function DF(){return{animate:Sn(!0),whileInView:Sn(),whileHover:Sn(),whileTap:Sn(),whileDrag:Sn(),whileFocus:Sn(),exit:Sn()}}class IF extends vn{constructor(t){super(t),t.animationState||(t.animationState=zF(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),Vu(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){}}let LF=0;class OF extends vn{constructor(){super(...arguments),this.id=LF++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r,custom:n}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===o)return;const i=this.node.animationState.setActive("exit",!t,{custom:n??this.node.getProps().custom});r&&!t&&i.then(()=>r(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const BF={animation:{Feature:IF},exit:{Feature:OF}},Ig=(e,t)=>Math.abs(e-t);function jF(e,t){const r=Ig(e.x,t.x),n=Ig(e.y,t.y);return Math.sqrt(r**2+n**2)}class rx{constructor(t,r,{transformPagePoint:n,contextWindow:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const c=ad(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,f=jF(c.offset,{x:0,y:0})>=3;if(!d&&!f)return;const{point:p}=c,{timestamp:v}=De;this.history.push({...p,timestamp:v});const{onStart:y,onMove:x}=this.handlers;d||(y&&y(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,c)},this.handlePointerMove=(c,d)=>{this.lastMoveEvent=c,this.lastMoveEventInfo=id(d,this.transformPagePoint),se.update(this.updatePoint,!0)},this.handlePointerUp=(c,d)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:f,onSessionEnd:p}=this.handlers,v=ad(c.type==="pointercancel"?this.lastMoveEventInfo:id(d,this.transformPagePoint),this.history);this.startEvent&&f&&f(c,v),p&&p(c,v)},!bS(t))return;this.handlers=r,this.transformPagePoint=n,this.contextWindow=o||window;const i=Hu(t),a=id(i,this.transformPagePoint),{point:s}=a,{timestamp:l}=De;this.history=[{...s,timestamp:l}];const{onSessionStart:u}=r;u&&u(t,ad(a,this.history)),this.removeListeners=an(Er(this.contextWindow,"pointermove",this.handlePointerMove),Er(this.contextWindow,"pointerup",this.handlePointerUp),Er(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ir(this.updatePoint)}}function id(e,t){return t?{point:t(e.point)}:e}function Lg(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ad({point:e},t){return{point:e,delta:Lg(e,nx(t)),offset:Lg(e,NF(t)),velocity:VF(t,.1)}}function NF(e){return e[0]}function nx(e){return e[e.length-1]}function VF(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const o=nx(e);for(;r>=0&&(n=e[r],!(o.timestamp-n.timestamp>sn(t)));)r--;if(!n)return{x:0,y:0};const i=$r(o.timestamp-n.timestamp);if(i===0)return{x:0,y:0};const a={x:(o.x-n.x)/i,y:(o.y-n.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function kt(e){return e.max-e.min}function Af(e,t=0,r=.01){return Math.abs(e-t)<=r}function Og(e,t,r,n=.5){e.origin=n,e.originPoint=ge(t.min,t.max,e.origin),e.scale=kt(r)/kt(t),(Af(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=ge(r.min,r.max,e.origin)-e.originPoint,(Af(e.translate)||isNaN(e.translate))&&(e.translate=0)}function ea(e,t,r,n){Og(e.x,t.x,r.x,n?n.originX:void 0),Og(e.y,t.y,r.y,n?n.originY:void 0)}function Bg(e,t,r){e.min=r.min+t.min,e.max=e.min+kt(t)}function WF(e,t,r){Bg(e.x,t.x,r.x),Bg(e.y,t.y,r.y)}function jg(e,t,r){e.min=t.min-r.min,e.max=e.min+kt(t)}function ta(e,t,r){jg(e.x,t.x,r.x),jg(e.y,t.y,r.y)}function UF(e,{min:t,max:r},n){return t!==void 0&&er&&(e=n?ge(r,e,n.max):Math.min(e,r)),e}function Ng(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function HF(e,{top:t,left:r,bottom:n,right:o}){return{x:Ng(e.x,r,o),y:Ng(e.y,t,n)}}function Vg(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.minn?r=$a(t.min,t.max-n,e.min):n>o&&(r=$a(e.min,e.max-o,t.min)),cn(0,1,r)}function YF(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const Rf=.35;function XF(e=Rf){return e===!1?e=0:e===!0&&(e=Rf),{x:Wg(e,"left","right"),y:Wg(e,"top","bottom")}}function Wg(e,t,r){return{min:Ug(e,t),max:Ug(e,r)}}function Ug(e,t){return typeof e=="number"?e:e[t]||0}const Hg=()=>({translate:0,scale:1,origin:0,originPoint:0}),_o=()=>({x:Hg(),y:Hg()}),Gg=()=>({min:0,max:0}),Te=()=>({x:Gg(),y:Gg()});function tr(e){return[e("x"),e("y")]}function ox({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function QF({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function qF(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function sd(e){return e===void 0||e===1}function Mf({scale:e,scaleX:t,scaleY:r}){return!sd(e)||!sd(t)||!sd(r)}function kn(e){return Mf(e)||ix(e)||e.z||e.rotate||e.rotateX||e.rotateY}function ix(e){return Kg(e.x)||Kg(e.y)}function Kg(e){return e&&e!=="0%"}function eu(e,t,r){const n=e-r,o=t*n;return r+o}function Yg(e,t,r,n,o){return o!==void 0&&(e=eu(e,o,n)),eu(e,r,n)+t}function zf(e,t=0,r=1,n,o){e.min=Yg(e.min,t,r,n,o),e.max=Yg(e.max,t,r,n,o)}function ax(e,{x:t,y:r}){zf(e.x,t.translate,t.scale,t.originPoint),zf(e.y,r.translate,r.scale,r.originPoint)}function ZF(e,t,r,n=!1){const o=r.length;if(!o)return;t.x=t.y=1;let i,a;for(let s=0;s1.0000000000001||e<.999999999999?e:1}function Hr(e,t){e.min=e.min+t,e.max=e.max+t}function Qg(e,t,[r,n,o]){const i=t[o]!==void 0?t[o]:.5,a=ge(e.min,e.max,i);zf(e,t[r],t[n],a,t.scale)}const JF=["x","scaleX","originX"],eD=["y","scaleY","originY"];function Po(e,t){Qg(e.x,t,JF),Qg(e.y,t,eD)}function sx(e,t){return ox(qF(e.getBoundingClientRect(),t))}function tD(e,t,r){const n=sx(e,r),{scroll:o}=t;return o&&(Hr(n.x,o.offset.x),Hr(n.y,o.offset.y)),n}const lx=({current:e})=>e?e.ownerDocument.defaultView:null,rD=new WeakMap;class nD{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Te(),this.visualElement=t}start(t,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const o=l=>{this.stopAnimation(),r&&this.snapToCursor(Hu(l,"page").point)},i=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=xS(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),tr(v=>{let y=this.getAxisMotionValue(v).get()||0;if(hr.test(y)){const{projection:x}=this.visualElement;if(x&&x.layout){const m=x.layout.layoutBox[v];m&&(y=kt(m)*(parseFloat(y)/100))}}this.originPoint[v]=y}),f&&se.update(()=>f(l,u),!1,!0);const{animationState:p}=this.visualElement;p&&p.setActive("whileDrag",!0)},a=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:p}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:v}=u;if(d&&this.currentDirection===null){this.currentDirection=oD(v),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,v),this.updateAxis("y",u.point,v),this.visualElement.render(),p&&p(l,u)},s=(l,u)=>this.stop(l,u);this.panSession=new rx(t,{onSessionStart:o,onStart:i,onMove:a,onSessionEnd:s},{transformPagePoint:this.visualElement.getTransformPagePoint(),contextWindow:lx(this.visualElement)})}stop(t,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:i}=this.getProps();i&&se.update(()=>i(t,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(t,r,n){const{drag:o}=this.getProps();if(!n||!Fs(t,o,this.currentDirection))return;const i=this.getAxisMotionValue(t);let a=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(a=UF(a,this.constraints[t],this.elastic[t])),i.set(a)}resolveConstraints(){var t;const{dragConstraints:r,dragElastic:n}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;r&&ko(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&o?this.constraints=HF(o.layoutBox,r):this.constraints=!1,this.elastic=XF(n),i!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&tr(a=>{this.getAxisMotionValue(a)&&(this.constraints[a]=YF(o.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!ko(t))return!1;const n=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const i=tD(n,o.root,this.visualElement.getTransformPagePoint());let a=GF(o.layout.layoutBox,i);if(r){const s=r(QF(a));this.hasMutatedConstraints=!!s,s&&(a=ox(s))}return a}startAnimation(t){const{drag:r,dragMomentum:n,dragElastic:o,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=tr(c=>{if(!Fs(c,r,this.currentDirection))return;let d=l&&l[c]||{};a&&(d={min:0,max:0});const f=o?200:1e6,p=o?40:1e7,v={type:"inertia",velocity:n?t[c]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...d};return this.startAxisValueAnimation(c,v)});return Promise.all(u).then(s)}startAxisValueAnimation(t,r){const n=this.getAxisMotionValue(t);return n.start(kp(t,n,0,r))}stopAnimation(){tr(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const r="_drag"+t.toUpperCase(),n=this.visualElement.getProps(),o=n[r];return o||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){tr(r=>{const{drag:n}=this.getProps();if(!Fs(r,n,this.currentDirection))return;const{projection:o}=this.visualElement,i=this.getAxisMotionValue(r);if(o&&o.layout){const{min:a,max:s}=o.layout.layoutBox[r];i.set(t[r]-ge(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!ko(r)||!n||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};tr(a=>{const s=this.getAxisMotionValue(a);if(s){const l=s.get();o[a]=KF({min:l,max:l},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),tr(a=>{if(!Fs(a,t,null))return;const s=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];s.set(ge(l,u,o[a]))})}addListeners(){if(!this.visualElement.current)return;rD.set(this.visualElement,this);const t=this.visualElement.current,r=Er(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),n=()=>{const{dragConstraints:l}=this.getProps();ko(l)&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,i=o.addEventListener("measure",n);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),n();const a=_r(window,"resize",()=>this.scalePositionWithinConstraints()),s=o.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(tr(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{a(),r(),i(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:o=!1,dragConstraints:i=!1,dragElastic:a=Rf,dragMomentum:s=!0}=t;return{...t,drag:r,dragDirectionLock:n,dragPropagation:o,dragConstraints:i,dragElastic:a,dragMomentum:s}}}function Fs(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function oD(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class iD extends vn{constructor(t){super(t),this.removeGroupControls=xe,this.removeListeners=xe,this.controls=new nD(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||xe}unmount(){this.removeGroupControls(),this.removeListeners()}}const qg=e=>(t,r)=>{e&&se.update(()=>e(t,r))};class aD extends vn{constructor(){super(...arguments),this.removePointerDownListener=xe}onPointerDown(t){this.session=new rx(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lx(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:n,onPanEnd:o}=this.node.getProps();return{onSessionStart:qg(t),onStart:qg(r),onMove:n,onEnd:(i,a)=>{delete this.session,o&&se.update(()=>o(i,a))}}}mount(){this.removePointerDownListener=Er(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function ux(){const e=S.useContext(Va);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:r,register:n}=e,o=S.useId();return S.useEffect(()=>n(o),[]),!t&&r?[!1,()=>r&&r(o)]:[!0]}function sD(){return lD(S.useContext(Va))}function lD(e){return e===null?!0:e.isPresent}const dl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Zg(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ki={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(j.test(e))e=parseFloat(e);else return e;const r=Zg(e,t.target.x),n=Zg(e,t.target.y);return`${r}% ${n}%`}},uD={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,o=dn.parse(e);if(o.length>5)return n;const i=dn.createTransformer(e),a=typeof o[0]!="number"?1:0,s=r.x.scale*t.x,l=r.y.scale*t.y;o[0+a]/=s,o[1+a]/=l;const u=ge(s,l,.5);return typeof o[2+a]=="number"&&(o[2+a]/=u),typeof o[3+a]=="number"&&(o[3+a]/=u),i(o)}};class cD extends Ar.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n,layoutId:o}=this.props,{projection:i}=t;y3(dD),i&&(r.group&&r.group.add(i),n&&n.register&&o&&n.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),dl.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:n,drag:o,isPresent:i}=this.props,a=n.projection;return a&&(a.isPresent=i,o||t.layoutDependency!==r||r===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?a.promote():a.relegate()||se.postRender(()=>{const s=a.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:o}=t;o&&(o.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(o),n&&n.deregister&&n.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function cx(e){const[t,r]=ux(),n=S.useContext(up);return Ar.createElement(cD,{...e,layoutGroup:n,switchLayoutGroup:S.useContext(oS),isPresent:t,safeToRemove:r})}const dD={borderRadius:{...ki,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ki,borderTopRightRadius:ki,borderBottomLeftRadius:ki,borderBottomRightRadius:ki,boxShadow:uD},dx=["TopLeft","TopRight","BottomLeft","BottomRight"],fD=dx.length,Jg=e=>typeof e=="string"?parseFloat(e):e,e0=e=>typeof e=="number"||j.test(e);function hD(e,t,r,n,o,i){o?(e.opacity=ge(0,r.opacity!==void 0?r.opacity:1,pD(n)),e.opacityExit=ge(t.opacity!==void 0?t.opacity:1,0,mD(n))):i&&(e.opacity=ge(t.opacity!==void 0?t.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let a=0;ant?1:r($a(e,t,n))}function r0(e,t){e.min=t.min,e.max=t.max}function $t(e,t){r0(e.x,t.x),r0(e.y,t.y)}function n0(e,t,r,n,o){return e-=t,e=eu(e,1/r,n),o!==void 0&&(e=eu(e,1/o,n)),e}function vD(e,t=0,r=1,n=.5,o,i=e,a=e){if(hr.test(t)&&(t=parseFloat(t),t=ge(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=ge(i.min,i.max,n);e===i&&(s-=t),e.min=n0(e.min,t,r,s,o),e.max=n0(e.max,t,r,s,o)}function o0(e,t,[r,n,o],i,a){vD(e,t[r],t[n],t[o],t.scale,i,a)}const gD=["x","scaleX","originX"],yD=["y","scaleY","originY"];function i0(e,t,r,n){o0(e.x,t,gD,r?r.x:void 0,n?n.x:void 0),o0(e.y,t,yD,r?r.y:void 0,n?n.y:void 0)}function a0(e){return e.translate===0&&e.scale===1}function hx(e){return a0(e.x)&&a0(e.y)}function bD(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function px(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function s0(e){return kt(e.x)/kt(e.y)}class SD{constructor(){this.members=[]}add(t){Cp(this.members,t),t.scheduleRender()}remove(t){if(_p(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){const r=this.members.findIndex(o=>t===o);if(r===0)return!1;let n;for(let o=r;o>=0;o--){const i=this.members[o];if(i.isPresent!==!1){n=i;break}}return n?(this.promote(n),!0):!1}promote(t,r){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,r&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:o}=t.options;o===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:r,resumingFrom:n}=t;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function l0(e,t,r){let n="";const o=e.x.translate/t.x,i=e.y.translate/t.y;if((o||i)&&(n=`translate3d(${o}px, ${i}px, 0) `),(t.x!==1||t.y!==1)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{rotate:l,rotateX:u,rotateY:c}=r;l&&(n+=`rotate(${l}deg) `),u&&(n+=`rotateX(${u}deg) `),c&&(n+=`rotateY(${c}deg) `)}const a=e.x.scale*t.x,s=e.y.scale*t.y;return(a!==1||s!==1)&&(n+=`scale(${a}, ${s})`),n||"none"}const xD=(e,t)=>e.depth-t.depth;class wD{constructor(){this.children=[],this.isDirty=!1}add(t){Cp(this.children,t),this.isDirty=!0}remove(t){_p(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(xD),this.isDirty=!1,this.children.forEach(t)}}function kD(e,t){const r=performance.now(),n=({timestamp:o})=>{const i=o-r;i>=t&&(Ir(n),e(i-t))};return se.read(n,!0),()=>Ir(n)}function CD(e){window.MotionDebug&&window.MotionDebug.record(e)}function _D(e){return e instanceof SVGElement&&e.tagName!=="svg"}function PD(e,t,r){const n=ht(e)?e:Zo(e);return n.start(kp("",n,t,r)),n.animation}const u0=["","X","Y","Z"],TD={visibility:"hidden"},c0=1e3;let ED=0;const Cn={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function mx({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:o}){return class{constructor(a={},s=t==null?void 0:t()){this.id=ED++,this.animationId=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.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Cn.totalNodes=Cn.resolvedTargetDeltas=Cn.recalculatedProjection=0,this.nodes.forEach(RD),this.nodes.forEach(ID),this.nodes.forEach(LD),this.nodes.forEach(MD),CD(Cn)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=kD(f,250),dl.hasAnimatedSinceResize&&(dl.hasAnimatedSinceResize=!1,this.nodes.forEach(f0))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:p,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||c.getDefaultTransition()||VD,{onLayoutAnimationStart:x,onLayoutAnimationComplete:m}=c.getProps(),h=!this.targetLayout||!px(this.targetLayout,v)||p,g=!f&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(h||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,g);const C={...wp(y,"layout"),onPlay:x,onComplete:m};(c.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C)}else f||f0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ir(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(OD),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(zD),this.sharedNodes.forEach(BD)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,se.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){se.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const _=C/1e3;h0(d.x,a.x,_),h0(d.y,a.y,_),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ta(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),jD(this.relativeTarget,this.relativeTargetOrigin,f,_),g&&bD(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=Te()),$t(g,this.relativeTarget)),y&&(this.animationValues=c,hD(c,u,this.latestValues,_,h,m)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ir(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=se.update(()=>{dl.hasAnimatedSinceResize=!0,this.currentAnimation=PD(0,c0,{...a,onUpdate:s=>{this.mixTargetDelta(s),a.onUpdate&&a.onUpdate(s)},onComplete:()=>{a.onComplete&&a.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 a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(c0),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:c}=a;if(!(!s||!l||!u)){if(this!==a&&this.layout&&u&&vx(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Te();const d=kt(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const f=kt(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}$t(s,l),Po(s,c),ea(this.projectionDeltaWithTransform,this.layoutCorrected,s,c)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new SD),this.sharedNodes.get(a).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:l}=a;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(s=!0),!s)return;const u={};for(let c=0;c{var s;return(s=a.currentAnimation)===null||s===void 0?void 0:s.stop()}),this.root.nodes.forEach(d0),this.root.sharedNodes.clear()}}}function $D(e){e.updateLayout()}function AD(e){var t;const r=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&r&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:o}=e.layout,{animationType:i}=e.options,a=r.source!==e.layout.source;i==="size"?tr(d=>{const f=a?r.measuredBox[d]:r.layoutBox[d],p=kt(f);f.min=n[d].min,f.max=f.min+p}):vx(i,r.layoutBox,n)&&tr(d=>{const f=a?r.measuredBox[d]:r.layoutBox[d],p=kt(n[d]);f.max=f.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+p)});const s=_o();ea(s,n,r.layoutBox);const l=_o();a?ea(l,e.applyTransform(o,!0),r.measuredBox):ea(l,n,r.layoutBox);const u=!hx(s);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:p}=d;if(f&&p){const v=Te();ta(v,r.layoutBox,f.layoutBox);const y=Te();ta(y,n,p.layoutBox),px(v,y)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=y,e.relativeTargetOrigin=v,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function RD(e){Cn.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function MD(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function zD(e){e.clearSnapshot()}function d0(e){e.clearMeasurements()}function FD(e){e.isLayoutDirty=!1}function DD(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function f0(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function ID(e){e.resolveTargetDelta()}function LD(e){e.calcProjection()}function OD(e){e.resetRotation()}function BD(e){e.removeLeadSnapshot()}function h0(e,t,r){e.translate=ge(t.translate,0,r),e.scale=ge(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function p0(e,t,r,n){e.min=ge(t.min,r.min,n),e.max=ge(t.max,r.max,n)}function jD(e,t,r,n){p0(e.x,t.x,r.x,n),p0(e.y,t.y,r.y,n)}function ND(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const VD={duration:.45,ease:[.4,0,.1,1]},m0=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),v0=m0("applewebkit/")&&!m0("chrome/")?Math.round:xe;function g0(e){e.min=v0(e.min),e.max=v0(e.max)}function WD(e){g0(e.x),g0(e.y)}function vx(e,t,r){return e==="position"||e==="preserve-aspect"&&!Af(s0(t),s0(r),.2)}const UD=mx({attachResizeListener:(e,t)=>_r(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ld={current:void 0},gx=mx({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ld.current){const e=new UD({});e.mount(window),e.setOptions({layoutScroll:!0}),ld.current=e}return ld.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),HD={pan:{Feature:aD},drag:{Feature:iD,ProjectionNode:gx,MeasureLayout:cx}},GD=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function KD(e){const t=GD.exec(e);if(!t)return[,];const[,r,n]=t;return[r,n]}function Ff(e,t,r=1){const[n,o]=KD(e);if(!n)return;const i=window.getComputedStyle(t).getPropertyValue(n);if(i){const a=i.trim();return ZS(a)?parseFloat(a):a}else return kf(o)?Ff(o,t,r+1):o}function YD(e,{...t},r){const n=e.current;if(!(n instanceof Element))return{target:t,transitionEnd:r};r&&(r={...r}),e.values.forEach(o=>{const i=o.get();if(!kf(i))return;const a=Ff(i,n);a&&o.set(a)});for(const o in t){const i=t[o];if(!kf(i))continue;const a=Ff(i,n);a&&(t[o]=a,r||(r={}),r[o]===void 0&&(r[o]=i))}return{target:t,transitionEnd:r}}const XD=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),yx=e=>XD.has(e),QD=e=>Object.keys(e).some(yx),y0=e=>e===Qn||e===j,b0=(e,t)=>parseFloat(e.split(", ")[t]),S0=(e,t)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const o=n.match(/^matrix3d\((.+)\)$/);if(o)return b0(o[1],t);{const i=n.match(/^matrix\((.+)\)$/);return i?b0(i[1],e):0}},qD=new Set(["x","y","z"]),ZD=Wa.filter(e=>!qD.has(e));function JD(e){const t=[];return ZD.forEach(r=>{const n=e.getValue(r);n!==void 0&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t.length&&e.render(),t}const Jo={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:S0(4,13),y:S0(5,14)};Jo.translateX=Jo.x;Jo.translateY=Jo.y;const eI=(e,t,r)=>{const n=t.measureViewportBox(),o=t.current,i=getComputedStyle(o),{display:a}=i,s={};a==="none"&&t.setStaticValue("display",e.display||"block"),r.forEach(u=>{s[u]=Jo[u](n,i)}),t.render();const l=t.measureViewportBox();return r.forEach(u=>{const c=t.getValue(u);c&&c.jump(s[u]),e[u]=Jo[u](l,i)}),e},tI=(e,t,r={},n={})=>{t={...t},n={...n};const o=Object.keys(t).filter(yx);let i=[],a=!1;const s=[];if(o.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=r[l],d=wi(c);const f=t[l];let p;if(Xl(f)){const v=f.length,y=f[0]===null?1:0;c=f[y],d=wi(c);for(let x=y;x=0?window.pageYOffset:null,u=eI(t,e,s);return i.length&&i.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),Nu&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:n}}else return{target:t,transitionEnd:n}};function rI(e,t,r,n){return QD(t)?tI(e,t,r,n):{target:t,transitionEnd:n}}const nI=(e,t,r,n)=>{const o=YD(e,t,n);return t=o.target,n=o.transitionEnd,rI(e,t,r,n)},Df={current:null},bx={current:!1};function oI(){if(bx.current=!0,!!Nu)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Df.current=e.matches;e.addListener(t),t()}else Df.current=!1}function iI(e,t,r){const{willChange:n}=t;for(const o in t){const i=t[o],a=r[o];if(ht(i))e.addValue(o,i),Jl(n)&&n.add(o);else if(ht(a))e.addValue(o,Zo(i,{owner:e})),Jl(n)&&n.remove(o);else if(a!==i)if(e.hasValue(o)){const s=e.getValue(o);!s.hasAnimated&&s.set(i)}else{const s=e.getStaticValue(o);e.addValue(o,Zo(s!==void 0?s:i,{owner:e}))}}for(const o in r)t[o]===void 0&&e.removeValue(o);return t}const x0=new WeakMap,Sx=Object.keys(Ea),aI=Sx.length,w0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],sI=lp.length;class lI{constructor({parent:t,props:r,presenceContext:n,reducedMotionConfig:o,visualState:i},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},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.scheduleRender=()=>se.render(this.render,!1,!0);const{latestValues:s,renderState:l}=i;this.latestValues=s,this.baseTarget={...s},this.initialValues=r.initial?{...s}:{},this.renderState=l,this.parent=t,this.props=r,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.options=a,this.isControllingVariants=Wu(r),this.isVariantNode=nS(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(r,{});for(const d in c){const f=c[d];s[d]!==void 0&&ht(f)&&(f.set(s[d],!1),Jl(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,r){return{}}mount(t){this.current=t,x0.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),bx.current||oI(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Df.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){x0.delete(this.current),this.projection&&this.projection.unmount(),Ir(this.notifyUpdate),Ir(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,r){const n=Xn.has(t),o=r.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&se.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)}),i=r.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{o(),i()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...r},n,o,i){let a,s;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:i,layoutScroll:f,layoutRoot:p})}return s}updateFeatures(){for(const t in this.features){const r=this.features[t];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Te()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}makeTargetAnimatable(t,r=!0){return this.makeTargetAnimatableFromInstance(t,this.props,r)}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(t)}addValue(t,r){r!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,r)),this.values.set(t,r),this.latestValues[t]=r.get()}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return n===void 0&&r!==void 0&&(n=Zo(r,{owner:this}),this.addValue(t,n)),n}readValue(t){var r;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var r;const{initial:n}=this.props,o=typeof n=="string"||typeof n=="object"?(r=vp(this.props,n))===null||r===void 0?void 0:r[t]:void 0;if(n&&o!==void 0)return o;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!ht(i)?i:this.initialValues[t]!==void 0&&o===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new Pp),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}}class xx extends lI{sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){return t.style?t.style[r]:void 0}removeValueFromRenderState(t,{vars:r,style:n}){delete r[t],delete n[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:r,...n},{transformValues:o},i){let a=_F(n,t||{},this);if(o&&(r&&(r=o(r)),n&&(n=o(n)),a&&(a=o(a))),i){kF(this,n,a);const s=nI(this,n,a,r);r=s.transitionEnd,n=s.target}return{transition:t,transitionEnd:r,...n}}}function uI(e){return window.getComputedStyle(e)}class cI extends xx{readValueFromInstance(t,r){if(Xn.has(r)){const n=xp(r);return n&&n.default||0}else{const n=uI(t),o=(sS(r)?n.getPropertyValue(r):n[r])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:r}){return sx(t,r)}build(t,r,n,o){dp(t,r,n,o.transformTemplate)}scrapeMotionValuesFromProps(t,r){return mp(t,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ht(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}renderInstance(t,r,n,o){hS(t,r,n,o)}}class dI extends xx{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Xn.has(r)){const n=xp(r);return n&&n.default||0}return r=pS.has(r)?r:ap(r),t.getAttribute(r)}measureInstanceViewportBox(){return Te()}scrapeMotionValuesFromProps(t,r){return vS(t,r)}build(t,r,n,o){hp(t,r,n,this.isSVGTag,o.transformTemplate)}renderInstance(t,r,n,o){mS(t,r,n,o)}mount(t){this.isSVGTag=pp(t.tagName),super.mount(t)}}const fI=(e,t)=>cp(e)?new dI(t,{enableHardwareAcceleration:!1}):new cI(t,{enableHardwareAcceleration:!0}),hI={layout:{ProjectionNode:gx,MeasureLayout:cx}},pI={...BF,...s4,...HD,...hI},oi=v3((e,t)=>Y3(e,t,pI,fI));function wx(){const e=S.useRef(!1);return ip(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function mI(){const e=wx(),[t,r]=S.useState(0),n=S.useCallback(()=>{e.current&&r(t+1)},[t]);return[S.useCallback(()=>se.postRender(n),[n]),t]}class vI extends S.Component{getSnapshotBeforeUpdate(t){const r=this.props.childRef.current;if(r&&t.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function gI({children:e,isPresent:t}){const r=S.useId(),n=S.useRef(null),o=S.useRef({width:0,height:0,top:0,left:0});return S.useInsertionEffect(()=>{const{width:i,height:a,top:s,left:l}=o.current;if(t||!n.current||!i||!a)return;n.current.dataset.motionPopId=r;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` - [data-motion-pop-id="${r}"] { - position: absolute !important; - width: ${i}px !important; - height: ${a}px !important; - top: ${s}px !important; - left: ${l}px !important; - } - `),()=>{document.head.removeChild(u)}},[t]),S.createElement(vI,{isPresent:t,childRef:n,sizeRef:o},S.cloneElement(e,{ref:n}))}const ud=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:o,presenceAffectsLayout:i,mode:a})=>{const s=gS(yI),l=S.useId(),u=S.useMemo(()=>({id:l,initial:t,isPresent:r,custom:o,onExitComplete:c=>{s.set(c,!0);for(const d of s.values())if(!d)return;n&&n()},register:c=>(s.set(c,!1),()=>s.delete(c))}),i?void 0:[r]);return S.useMemo(()=>{s.forEach((c,d)=>s.set(d,!1))},[r]),S.useEffect(()=>{!r&&!s.size&&n&&n()},[r]),a==="popLayout"&&(e=S.createElement(gI,{isPresent:r},e)),S.createElement(Va.Provider,{value:u},e)};function yI(){return new Map}function bI(e){return S.useEffect(()=>()=>e(),[])}const _n=e=>e.key||"";function SI(e,t){e.forEach(r=>{const n=_n(r);t.set(n,r)})}function xI(e){const t=[];return S.Children.forEach(e,r=>{S.isValidElement(r)&&t.push(r)}),t}const Ka=({children:e,custom:t,initial:r=!0,onExitComplete:n,exitBeforeEnter:o,presenceAffectsLayout:i=!0,mode:a="sync"})=>{const s=S.useContext(up).forceRender||mI()[0],l=wx(),u=xI(e);let c=u;const d=S.useRef(new Map).current,f=S.useRef(c),p=S.useRef(new Map).current,v=S.useRef(!0);if(ip(()=>{v.current=!1,SI(u,p),f.current=c}),bI(()=>{v.current=!0,p.clear(),d.clear()}),v.current)return S.createElement(S.Fragment,null,c.map(h=>S.createElement(ud,{key:_n(h),isPresent:!0,initial:r?void 0:!1,presenceAffectsLayout:i,mode:a},h)));c=[...c];const y=f.current.map(_n),x=u.map(_n),m=y.length;for(let h=0;h{if(x.indexOf(g)!==-1)return;const C=p.get(g);if(!C)return;const _=y.indexOf(g);let $=h;if(!$){const T=()=>{d.delete(g);const A=Array.from(p.keys()).filter(M=>!x.includes(M));if(A.forEach(M=>p.delete(M)),f.current=u.filter(M=>{const I=_n(M);return I===g||A.includes(I)}),!d.size){if(l.current===!1)return;s(),n&&n()}};$=S.createElement(ud,{key:_n(C),isPresent:!1,onExitComplete:T,custom:t,presenceAffectsLayout:i,mode:a},C),d.set(g,$)}c.splice(_,0,$)}),c=c.map(h=>{const g=h.key;return d.has(g)?h:S.createElement(ud,{key:_n(h),isPresent:!0,presenceAffectsLayout:i,mode:a},h)}),S.createElement(S.Fragment,null,d.size?c:c.map(h=>S.cloneElement(h)))};var wI={initial:e=>{const{position:t}=e,r=["top","bottom"].includes(t)?"y":"x";let n=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(n=1),{opacity:0,[r]:n*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},kx=S.memo(e=>{const{id:t,message:r,onCloseComplete:n,onRequestRemove:o,requestClose:i=!1,position:a="bottom",duration:s=5e3,containerStyle:l,motionVariants:u=wI,toastSpacing:c="0.5rem"}=e,[d,f]=S.useState(s),p=sD();yg(()=>{p||n==null||n()},[p]),yg(()=>{f(s)},[s]);const v=()=>f(null),y=()=>f(s),x=()=>{p&&o()};S.useEffect(()=>{p&&i&&o()},[p,i,o]),a3(x,d);const m=S.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),h=S.useMemo(()=>n3(a),[a]);return E.jsx(oi.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:v,onHoverEnd:y,custom:{position:a},style:h,children:E.jsx(_e.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:m,children:lr(r,{id:t,onClose:x})})})});kx.displayName="ToastComponent";function kI(e,t){var r;const n=e??"bottom",i={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[n];return(r=i==null?void 0:i[t])!=null?r:n}var k0={path:E.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[E.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),E.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),E.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Ya=pt((e,t)=>{const{as:r,viewBox:n,color:o="currentColor",focusable:i=!1,children:a,className:s,__css:l,...u}=e,c=Be("chakra-icon",s),d=Bu("Icon",e),f={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:o,...l,...d},p={ref:t,focusable:i,className:c,__css:f},v=n??k0.viewBox;if(r&&typeof r!="string")return E.jsx(_e.svg,{as:r,...p,...u});const y=a??k0.path;return E.jsx(_e.svg,{verticalAlign:"middle",viewBox:v,...p,...u,children:y})});Ya.displayName="Icon";function CI(e){return E.jsx(Ya,{viewBox:"0 0 24 24",...e,children:E.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function _I(e){return E.jsx(Ya,{viewBox:"0 0 24 24",...e,children:E.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function C0(e){return E.jsx(Ya,{viewBox:"0 0 24 24",...e,children:E.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var PI=vP({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Tp=pt((e,t)=>{const r=Bu("Spinner",e),{label:n="Loading...",thickness:o="2px",speed:i="0.45s",emptyColor:a="transparent",className:s,...l}=Iu(e),u=Be("chakra-spinner",s),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:o,borderBottomColor:a,borderLeftColor:a,animation:`${PI} ${i} linear infinite`,...r};return E.jsx(_e.div,{ref:t,__css:c,className:u,...l,children:n&&E.jsx(_e.span,{srOnly:!0,children:n})})});Tp.displayName="Spinner";var[TI,Ep]=mn({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[EI,$p]=mn({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),Cx={info:{icon:_I,colorScheme:"blue"},warning:{icon:C0,colorScheme:"orange"},success:{icon:CI,colorScheme:"green"},error:{icon:C0,colorScheme:"red"},loading:{icon:Tp,colorScheme:"blue"}};function $I(e){return Cx[e].colorScheme}function AI(e){return Cx[e].icon}var _x=pt(function(t,r){const n=$p(),{status:o}=Ep(),i={display:"inline",...n.description};return E.jsx(_e.div,{ref:r,"data-status":o,...t,className:Be("chakra-alert__desc",t.className),__css:i})});_x.displayName="AlertDescription";function Px(e){const{status:t}=Ep(),r=AI(t),n=$p(),o=t==="loading"?n.spinner:n.icon;return E.jsx(_e.span,{display:"inherit","data-status":t,...e,className:Be("chakra-alert__icon",e.className),__css:o,children:e.children||E.jsx(r,{h:"100%",w:"100%"})})}Px.displayName="AlertIcon";var Tx=pt(function(t,r){const n=$p(),{status:o}=Ep();return E.jsx(_e.div,{ref:r,"data-status":o,...t,className:Be("chakra-alert__title",t.className),__css:n.title})});Tx.displayName="AlertTitle";var Ex=pt(function(t,r){var n;const{status:o="info",addRole:i=!0,...a}=Iu(t),s=(n=t.colorScheme)!=null?n:$I(o),l=Xb("Alert",{...t,colorScheme:s}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return E.jsx(TI,{value:{status:o},children:E.jsx(EI,{value:l,children:E.jsx(_e.div,{"data-status":o,role:i?"alert":void 0,ref:r,...a,className:Be("chakra-alert",t.className),__css:u})})})});Ex.displayName="Alert";function RI(e){return E.jsx(Ya,{focusable:"false","aria-hidden":!0,...e,children:E.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var Ap=pt(function(t,r){const n=Bu("CloseButton",t),{children:o,isDisabled:i,__css:a,...s}=Iu(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return E.jsx(_e.button,{type:"button","aria-label":"Close",ref:r,disabled:i,__css:{...l,...n,...a},...s,children:o||E.jsx(RI,{width:"1em",height:"1em"})})});Ap.displayName="CloseButton";var MI={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},ar=zI(MI);function zI(e){let t=e;const r=new Set,n=o=>{t=o(t),r.forEach(i=>i())};return{getState:()=>t,subscribe:o=>(r.add(o),()=>{n(()=>e),r.delete(o)}),removeToast:(o,i)=>{n(a=>({...a,[i]:a[i].filter(s=>s.id!=o)}))},notify:(o,i)=>{const a=FI(o,i),{position:s,id:l}=a;return n(u=>{var c,d;const p=s.includes("top")?[a,...(c=u[s])!=null?c:[]]:[...(d=u[s])!=null?d:[],a];return{...u,[s]:p}}),l},update:(o,i)=>{o&&n(a=>{const s={...a},{position:l,index:u}=gg(s,o);return l&&u!==-1&&(s[l][u]={...s[l][u],...i,message:$x(i)}),s})},closeAll:({positions:o}={})=>{n(i=>(o??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=i[u].map(c=>({...c,requestClose:!0})),l),{...i}))},close:o=>{n(i=>{const a=Jb(i,o);return a?{...i,[a]:i[a].map(s=>s.id==o?{...s,requestClose:!0}:s)}:i})},isActive:o=>!!gg(ar.getState(),o).position}}var _0=0;function FI(e,t={}){var r,n;_0+=1;const o=(r=t.id)!=null?r:_0,i=(n=t.position)!=null?n:"bottom";return{id:o,message:e,position:i,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>ar.removeToast(String(o),i),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var DI=e=>{const{status:t,variant:r="solid",id:n,title:o,isClosable:i,onClose:a,description:s,colorScheme:l,icon:u}=e,c=n?{root:`toast-${n}`,title:`toast-${n}-title`,description:`toast-${n}-description`}:void 0;return E.jsxs(Ex,{addRole:!1,status:t,variant:r,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[E.jsx(Px,{children:u}),E.jsxs(_e.div,{flex:"1",maxWidth:"100%",children:[o&&E.jsx(Tx,{id:c==null?void 0:c.title,children:o}),s&&E.jsx(_x,{id:c==null?void 0:c.description,display:"block",children:s})]}),i&&E.jsx(Ap,{size:"sm",onClick:a,position:"absolute",insetEnd:1,top:1})]})};function $x(e={}){const{render:t,toastComponent:r=DI}=e;return o=>typeof t=="function"?t({...o,...e}):E.jsx(r,{...o,...e})}function wB(e,t){const r=o=>{var i;return{...t,...o,position:kI((i=o==null?void 0:o.position)!=null?i:t==null?void 0:t.position,e)}},n=o=>{const i=r(o),a=$x(i);return ar.notify(a,i)};return n.update=(o,i)=>{ar.update(o,r(i))},n.promise=(o,i)=>{const a=n({...i.loading,status:"loading",duration:null});o.then(s=>n.update(a,{status:"success",duration:5e3,...lr(i.success,s)})).catch(s=>n.update(a,{status:"error",duration:5e3,...lr(i.error,s)}))},n.closeAll=ar.closeAll,n.close=ar.close,n.isActive=ar.isActive,n}var[II,kB]=mn({name:"ToastOptionsContext",strict:!1}),LI=e=>{const t=S.useSyncExternalStore(ar.subscribe,ar.getState,ar.getState),{motionVariants:r,component:n=kx,portalProps:o}=e,a=Object.keys(t).map(s=>{const l=t[s];return E.jsx("div",{role:"region","aria-live":"polite","aria-label":`Notifications-${s}`,id:`chakra-toast-manager-${s}`,style:o3(s),children:E.jsx(Ka,{initial:!1,children:l.map(u=>E.jsx(n,{motionVariants:r,...u},u.id))})},s)});return E.jsx(ja,{...o,children:a})},OI=e=>function({children:r,theme:n=e,toastOptions:o,...i}){return E.jsxs(t3,{theme:n,...i,children:[E.jsx(II,{value:o==null?void 0:o.defaultOptions,children:r}),E.jsx(LI,{...o})]})},BI=OI(Vb);function jI(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function If(...e){return t=>{e.forEach(r=>{jI(r,t)})}}function NI(...e){return S.useMemo(()=>If(...e),e)}var P0={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},On={enter:{duration:.2,ease:P0.easeOut},exit:{duration:.1,ease:P0.easeIn}},Bn={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},VI={enter:({transition:e,transitionEnd:t,delay:r}={})=>{var n;return{opacity:1,transition:(n=e==null?void 0:e.enter)!=null?n:Bn.enter(On.enter,r),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:r}={})=>{var n;return{opacity:0,transition:(n=e==null?void 0:e.exit)!=null?n:Bn.exit(On.exit,r),transitionEnd:t==null?void 0:t.exit}}},Ax={initial:"exit",animate:"enter",exit:"exit",variants:VI},WI=S.forwardRef(function(t,r){const{unmountOnExit:n,in:o,className:i,transition:a,transitionEnd:s,delay:l,...u}=t,c=o||n?"enter":"exit",d=n?o&&n:!0,f={transition:a,transitionEnd:s,delay:l};return E.jsx(Ka,{custom:f,children:d&&E.jsx(oi.div,{ref:r,className:Be("chakra-fade",i),custom:f,...Ax,animate:c,...u})})});WI.displayName="Fade";var UI={exit:({reverse:e,initialScale:t,transition:r,transitionEnd:n,delay:o})=>{var i;return{opacity:0,...e?{scale:t,transitionEnd:n==null?void 0:n.exit}:{transitionEnd:{scale:t,...n==null?void 0:n.exit}},transition:(i=r==null?void 0:r.exit)!=null?i:Bn.exit(On.exit,o)}},enter:({transitionEnd:e,transition:t,delay:r})=>{var n;return{opacity:1,scale:1,transition:(n=t==null?void 0:t.enter)!=null?n:Bn.enter(On.enter,r),transitionEnd:e==null?void 0:e.enter}}},Rx={initial:"exit",animate:"enter",exit:"exit",variants:UI},HI=S.forwardRef(function(t,r){const{unmountOnExit:n,in:o,reverse:i=!0,initialScale:a=.95,className:s,transition:l,transitionEnd:u,delay:c,...d}=t,f=n?o&&n:!0,p=o||n?"enter":"exit",v={initialScale:a,reverse:i,transition:l,transitionEnd:u,delay:c};return E.jsx(Ka,{custom:v,children:f&&E.jsx(oi.div,{ref:r,className:Be("chakra-offset-slide",s),...Rx,animate:p,custom:v,...d})})});HI.displayName="ScaleFade";var GI={initial:({offsetX:e,offsetY:t,transition:r,transitionEnd:n,delay:o})=>{var i;return{opacity:0,x:e,y:t,transition:(i=r==null?void 0:r.exit)!=null?i:Bn.exit(On.exit,o),transitionEnd:n==null?void 0:n.exit}},enter:({transition:e,transitionEnd:t,delay:r})=>{var n;return{opacity:1,x:0,y:0,transition:(n=e==null?void 0:e.enter)!=null?n:Bn.enter(On.enter,r),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:r,transitionEnd:n,reverse:o,delay:i})=>{var a;const s={x:t,y:e};return{opacity:0,transition:(a=r==null?void 0:r.exit)!=null?a:Bn.exit(On.exit,i),...o?{...s,transitionEnd:n==null?void 0:n.exit}:{transitionEnd:{...s,...n==null?void 0:n.exit}}}}},Ii={initial:"initial",animate:"enter",exit:"exit",variants:GI},KI=S.forwardRef(function(t,r){const{unmountOnExit:n,in:o,reverse:i=!0,className:a,offsetX:s=0,offsetY:l=8,transition:u,transitionEnd:c,delay:d,...f}=t,p=n?o&&n:!0,v=o||n?"enter":"exit",y={offsetX:s,offsetY:l,reverse:i,transition:u,transitionEnd:c,delay:d};return E.jsx(Ka,{custom:y,children:p&&E.jsx(oi.div,{ref:r,className:Be("chakra-offset-slide",a),custom:y,...Ii,animate:v,...f})})});KI.displayName="SlideFade";var[CB,YI]=mn({strict:!1,name:"ButtonGroupContext"});function XI(e){const[t,r]=S.useState(!e);return{ref:S.useCallback(i=>{i&&r(i.tagName==="BUTTON")},[]),type:t?"button":void 0}}function Lf(e){const{children:t,className:r,...n}=e,o=S.isValidElement(t)?S.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,i=Be("chakra-button__icon",r);return E.jsx(_e.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...n,className:i,children:o})}Lf.displayName="ButtonIcon";function Of(e){const{label:t,placement:r,spacing:n="0.5rem",children:o=E.jsx(Tp,{color:"currentColor",width:"1em",height:"1em"}),className:i,__css:a,...s}=e,l=Be("chakra-button__spinner",i),u=r==="start"?"marginEnd":"marginStart",c=S.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[u]:t?n:0,fontSize:"1em",lineHeight:"normal",...a}),[a,t,u,n]);return E.jsx(_e.div,{className:l,...s,__css:c,children:o})}Of.displayName="ButtonSpinner";var Mx=pt((e,t)=>{const r=YI(),n=Bu("Button",{...r,...e}),{isDisabled:o=r==null?void 0:r.isDisabled,isLoading:i,isActive:a,children:s,leftIcon:l,rightIcon:u,loadingText:c,iconSpacing:d="0.5rem",type:f,spinner:p,spinnerPlacement:v="start",className:y,as:x,...m}=Iu(e),h=S.useMemo(()=>{const $={...n==null?void 0:n._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...n,...!!r&&{_focus:$}}},[n,r]),{ref:g,type:C}=XI(x),_={rightIcon:u,leftIcon:l,iconSpacing:d,children:s};return E.jsxs(_e.button,{ref:NI(t,g),as:x,type:f??C,"data-active":_v(a),"data-loading":_v(i),__css:h,className:Be("chakra-button",y),...m,disabled:o||i,children:[i&&v==="start"&&E.jsx(Of,{className:"chakra-button__spinner--start",label:c,placement:"start",spacing:d,children:p}),i?c||E.jsx(_e.span,{opacity:0,children:E.jsx(T0,{..._})}):E.jsx(T0,{..._}),i&&v==="end"&&E.jsx(Of,{className:"chakra-button__spinner--end",label:c,placement:"end",spacing:d,children:p})]})});Mx.displayName="Button";function T0(e){const{leftIcon:t,rightIcon:r,children:n,iconSpacing:o}=e;return E.jsxs(E.Fragment,{children:[t&&E.jsx(Lf,{marginEnd:o,children:t}),n,r&&E.jsx(Lf,{marginStart:o,children:r})]})}function QI(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,i;for(i=0;i=0)&&(r[o]=e[o]);return r}var Bf="data-focus-lock",zx="data-focus-lock-disabled",qI="data-no-focus-lock",ZI="data-autofocus-inside",JI="data-no-autofocus";function eL(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function tL(e,t){var r=S.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=t,r.facade}function Fx(e,t){return tL(t||null,function(r){return e.forEach(function(n){return eL(n,r)})})}var cd={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},sr=function(){return sr=Object.assign||function(t){for(var r,n=1,o=arguments.length;n=0}).sort(bL)},SL=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],Fp=SL.join(","),xL="".concat(Fp,", [data-focus-guard]"),Zx=function(e,t){return pr((e.shadowRoot||e).children).reduce(function(r,n){return r.concat(n.matches(t?xL:Fp)?[n]:[],Zx(n))},[])},wL=function(e,t){var r;return e instanceof HTMLIFrameElement&&(!((r=e.contentDocument)===null||r===void 0)&&r.body)?Ku([e.contentDocument.body],t):[e]},Ku=function(e,t){return e.reduce(function(r,n){var o,i=Zx(n,t),a=(o=[]).concat.apply(o,i.map(function(s){return wL(s,t)}));return r.concat(a,n.parentNode?pr(n.parentNode.querySelectorAll(Fp)).filter(function(s){return s===n}):[])},[])},kL=function(e){var t=e.querySelectorAll("[".concat(ZI,"]"));return pr(t).map(function(r){return Ku([r])}).reduce(function(r,n){return r.concat(n)},[])},Dp=function(e,t){return pr(e).filter(function(r){return Gx(t,r)}).filter(function(r){return vL(r)})},E0=function(e,t){return t===void 0&&(t=new Map),pr(e).filter(function(r){return Kx(t,r)})},Nf=function(e,t,r){return qx(Dp(Ku(e,r),t),!0,r)},$0=function(e,t){return qx(Dp(Ku(e),t),!1)},CL=function(e,t){return Dp(kL(e),t)},Bo=function(e,t){return e.shadowRoot?Bo(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:pr(e.children).some(function(r){var n;if(r instanceof HTMLIFrameElement){var o=(n=r.contentDocument)===null||n===void 0?void 0:n.body;return o?Bo(o,t):!1}return Bo(r,t)})},_L=function(e){for(var t=new Set,r=e.length,n=0;n0&&t.add(o),(i&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(n)}return e.filter(function(a,s){return!t.has(s)})},Jx=function(e){return e.parentNode?Jx(e.parentNode):e},Ip=function(e){var t=tu(e);return t.filter(Boolean).reduce(function(r,n){var o=n.getAttribute(Bf);return r.push.apply(r,o?_L(pr(Jx(n).querySelectorAll("[".concat(Bf,'="').concat(o,'"]:not([').concat(zx,'="disabled"])')))):[n]),r},[])},PL=function(e){try{return e()}catch{return}},Ra=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Ra(t.shadowRoot):t instanceof HTMLIFrameElement&&PL(function(){return t.contentWindow.document})?Ra(t.contentWindow.document):t}},TL=function(e,t){return e===t},EL=function(e,t){return!!pr(e.querySelectorAll("iframe")).some(function(r){return TL(r,t)})},ew=function(e,t){return t===void 0&&(t=Ra(Wx(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:Ip(e).some(function(r){return Bo(r,t)||EL(r,t)})},$L=function(e){e===void 0&&(e=document);var t=Ra(e);return t?pr(e.querySelectorAll("[".concat(qI,"]"))).some(function(r){return Bo(r,t)}):!1},AL=function(e,t){return t.filter(Qx).filter(function(r){return r.name===e.name}).filter(function(r){return r.checked})[0]||e},Lp=function(e,t){return Qx(e)&&e.name?AL(e,t):e},RL=function(e){var t=new Set;return e.forEach(function(r){return t.add(Lp(r,e))}),e.filter(function(r){return t.has(r)})},A0=function(e){return e[0]&&e.length>1?Lp(e[0],e):e[0]},R0=function(e,t){return e.length>1?e.indexOf(Lp(e[t],e)):t},tw="NEW_FOCUS",ML=function(e,t,r,n){var o=e.length,i=e[0],a=e[o-1],s=zp(r);if(!(r&&e.indexOf(r)>=0)){var l=r!==void 0?t.indexOf(r):-1,u=n?t.indexOf(n):l,c=n?e.indexOf(n):-1,d=l-u,f=t.indexOf(i),p=t.indexOf(a),v=RL(t),y=r!==void 0?v.indexOf(r):-1,x=y-(n?v.indexOf(n):l),m=R0(e,0),h=R0(e,o-1);if(l===-1||c===-1)return tw;if(!d&&c>=0)return c;if(l<=f&&s&&Math.abs(d)>1)return h;if(l>=p&&s&&Math.abs(d)>1)return m;if(d&&Math.abs(x)>1)return c;if(l<=f)return h;if(l>p)return m;if(d)return Math.abs(d)>1?c:(o+c+d)%o}},zL=function(e){return function(t){var r,n=(r=Yx(t))===null||r===void 0?void 0:r.autofocus;return t.autofocus||n!==void 0&&n!=="false"||e.indexOf(t)>=0}},FL=function(e,t,r){var n=e.map(function(i){var a=i.node;return a}),o=E0(n.filter(zL(r)));return o&&o.length?A0(o):A0(E0(t))},Vf=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&Vf(e.parentNode.host||e.parentNode,t),t},dd=function(e,t){for(var r=Vf(e),n=Vf(t),o=0;o=0)return i}return!1},rw=function(e,t,r){var n=tu(e),o=tu(t),i=n[0],a=!1;return o.filter(Boolean).forEach(function(s){a=dd(a||s,s)||a,r.filter(Boolean).forEach(function(l){var u=dd(i,l);u&&(!a||Bo(u,a)?a=u:a=dd(u,a))})}),a},DL=function(e,t){return e.reduce(function(r,n){return r.concat(CL(n,t))},[])},IL=function(e,t){var r=new Map;return t.forEach(function(n){return r.set(n.node,n)}),e.map(function(n){return r.get(n)}).filter(yL)},LL=function(e,t){var r=Ra(tu(e).length>0?document:Wx(e).ownerDocument),n=Ip(e).filter(ru),o=rw(r||e,e,n),i=new Map,a=$0(n,i),s=Nf(n,i).filter(function(p){var v=p.node;return ru(v)});if(!(!s[0]&&(s=a,!s[0]))){var l=$0([o],i).map(function(p){var v=p.node;return v}),u=IL(l,s),c=u.map(function(p){var v=p.node;return v}),d=ML(c,l,r,t);if(d===tw){var f=FL(a,c,DL(n,i));if(f)return{node:f};console.warn("focus-lock: cannot find any node to move focus into");return}return d===void 0?d:u[d]}},OL=function(e){var t=Ip(e).filter(ru),r=rw(e,e,t),n=new Map,o=Nf([r],n,!0),i=Nf(t,n).filter(function(a){var s=a.node;return ru(s)}).map(function(a){var s=a.node;return s});return o.map(function(a){var s=a.node,l=a.index;return{node:s,index:l,lockItem:i.indexOf(s)>=0,guard:zp(s)}})},BL=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},fd=0,hd=!1,nw=function(e,t,r){r===void 0&&(r={});var n=LL(e,t);if(!hd&&n){if(fd>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),hd=!0,setTimeout(function(){hd=!1},1);return}fd++,BL(n.node,r.focusOptions),fd--}};function Op(e){setTimeout(e,1)}var jL=function(){return document&&document.activeElement===document.body},NL=function(){return jL()||$L()},jo=null,To=null,No=null,Ma=!1,VL=function(){return!0},WL=function(t){return(jo.whiteList||VL)(t)},UL=function(t,r){No={observerNode:t,portaledElement:r}},HL=function(t){return No&&No.portaledElement===t};function M0(e,t,r,n){var o=null,i=e;do{var a=n[i];if(a.guard)a.node.dataset.focusAutoGuard&&(o=a);else if(a.lockItem){if(i!==e)return;o=null}else break}while((i+=r)!==t);o&&(o.node.tabIndex=0)}var GL=function(t){return t&&"current"in t?t.current:t},KL=function(t){return t?!!Ma:Ma==="meanwhile"},YL=function e(t,r,n){return r&&(r.host===t&&(!r.activeElement||n.contains(r.activeElement))||r.parentNode&&e(t,r.parentNode,n))},XL=function(t,r){return r.some(function(n){return YL(t,n,n)})},nu=function(){var t=!1;if(jo){var r=jo,n=r.observed,o=r.persistentFocus,i=r.autoFocus,a=r.shards,s=r.crossFrame,l=r.focusOptions,u=n||No&&No.portaledElement,c=document&&document.activeElement;if(u){var d=[u].concat(a.map(GL).filter(Boolean));if((!c||WL(c))&&(o||KL(s)||!NL()||!To&&i)&&(u&&!(ew(d)||c&&XL(c,d)||HL(c))&&(document&&!To&&c&&!i?(c.blur&&c.blur(),document.body.focus()):(t=nw(d,To,{focusOptions:l}),No={})),Ma=!1,To=document&&document.activeElement),document){var f=document&&document.activeElement,p=OL(d),v=p.map(function(y){var x=y.node;return x}).indexOf(f);v>-1&&(p.filter(function(y){var x=y.guard,m=y.node;return x&&m.dataset.focusAutoGuard}).forEach(function(y){var x=y.node;return x.removeAttribute("tabIndex")}),M0(v,p.length,1,p),M0(v,-1,-1,p))}}}return t},ow=function(t){nu()&&t&&(t.stopPropagation(),t.preventDefault())},Bp=function(){return Op(nu)},QL=function(t){var r=t.target,n=t.currentTarget;n.contains(r)||UL(n,r)},qL=function(){return null},iw=function(){Ma="just",Op(function(){Ma="meanwhile"})},ZL=function(){document.addEventListener("focusin",ow),document.addEventListener("focusout",Bp),window.addEventListener("blur",iw)},JL=function(){document.removeEventListener("focusin",ow),document.removeEventListener("focusout",Bp),window.removeEventListener("blur",iw)};function eO(e){return e.filter(function(t){var r=t.disabled;return!r})}function tO(e){var t=e.slice(-1)[0];t&&!jo&&ZL();var r=jo,n=r&&t&&t.id===r.id;jo=t,r&&!n&&(r.onDeactivation(),e.filter(function(o){var i=o.id;return i===r.id}).length||r.returnFocus(!t)),t?(To=null,(!n||r.observed!==t.observed)&&t.onActivation(),nu(),Op(nu)):(JL(),To=null)}jx.assignSyncMedium(QL);Nx.assignMedium(Bp);oL.assignMedium(function(e){return e({moveFocusInside:nw,focusInside:ew})});const rO=dL(eO,tO)(qL);var aw=S.forwardRef(function(t,r){return S.createElement(Vx,Hn({sideCar:rO,ref:r},t))}),sw=Vx.propTypes||{};sw.sideCar;QI(sw,["sideCar"]);aw.propTypes={};const z0=aw;function lw(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function uw(e){var t;if(!lw(e))return!1;const r=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof r.HTMLElement}function _B(e){var t,r;return(r=(t=cw(e))==null?void 0:t.defaultView)!=null?r:window}function cw(e){return lw(e)?e.ownerDocument:document}function PB(e){return cw(e).activeElement}var dw=e=>e.hasAttribute("tabindex"),nO=e=>dw(e)&&e.tabIndex===-1;function oO(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function fw(e){return e.parentElement&&fw(e.parentElement)?!0:e.hidden}function iO(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function hw(e){if(!uw(e)||fw(e)||oO(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const n={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in n?n[t]():iO(e)?!0:dw(e)}function TB(e){return e?uw(e)&&hw(e)&&!nO(e):!1}var aO=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],sO=aO.join(),lO=e=>e.offsetWidth>0&&e.offsetHeight>0;function uO(e){const t=Array.from(e.querySelectorAll(sO));return t.unshift(e),t.filter(r=>hw(r)&&lO(r))}var F0,cO=(F0=z0.default)!=null?F0:z0,pw=e=>{const{initialFocusRef:t,finalFocusRef:r,contentRef:n,restoreFocus:o,children:i,isDisabled:a,autoFocus:s,persistentFocus:l,lockFocusAcrossFrames:u}=e,c=S.useCallback(()=>{t!=null&&t.current?t.current.focus():n!=null&&n.current&&uO(n.current).length===0&&requestAnimationFrame(()=>{var v;(v=n.current)==null||v.focus()})},[t,n]),d=S.useCallback(()=>{var p;(p=r==null?void 0:r.current)==null||p.focus()},[r]),f=o&&!r;return E.jsx(cO,{crossFrame:u,persistentFocus:l,autoFocus:s,disabled:a,onActivation:c,onDeactivation:d,returnFocus:f,children:i})};pw.displayName="FocusLock";var dO={slideInBottom:{...Ii,custom:{offsetY:16,reverse:!0}},slideInRight:{...Ii,custom:{offsetX:16,reverse:!0}},slideInTop:{...Ii,custom:{offsetY:-16,reverse:!0}},slideInLeft:{...Ii,custom:{offsetX:-16,reverse:!0}},scale:{...Rx,custom:{initialScale:.95,reverse:!0}},none:{}},fO=_e(oi.section),hO=e=>dO[e||"none"],mw=S.forwardRef((e,t)=>{const{preset:r,motionProps:n=hO(r),...o}=e;return E.jsx(fO,{ref:t,...n,...o})});mw.displayName="ModalTransition";var pO=Object.defineProperty,mO=(e,t,r)=>t in e?pO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vO=(e,t,r)=>(mO(e,typeof t!="symbol"?t+"":t,r),r),gO=class{constructor(){vO(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},Wf=new gO;function vw(e,t){const[r,n]=S.useState(0);return S.useEffect(()=>{const o=e.current;if(o){if(t){const i=Wf.add(o);n(i)}return()=>{Wf.remove(o),n(0)}}},[t,e]),r}var yO=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},to=new WeakMap,Ds=new WeakMap,Is={},pd=0,gw=function(e){return e&&(e.host||gw(e.parentNode))},bO=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=gw(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},SO=function(e,t,r,n){var o=bO(t,Array.isArray(e)?e:[e]);Is[r]||(Is[r]=new WeakMap);var i=Is[r],a=[],s=new Set,l=new Set(o),u=function(d){!d||s.has(d)||(s.add(d),u(d.parentNode))};o.forEach(u);var c=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else{var p=f.getAttribute(n),v=p!==null&&p!=="false",y=(to.get(f)||0)+1,x=(i.get(f)||0)+1;to.set(f,y),i.set(f,x),a.push(f),y===1&&v&&Ds.set(f,!0),x===1&&f.setAttribute(r,"true"),v||f.setAttribute(n,"true")}})};return c(t),s.clear(),pd++,function(){a.forEach(function(d){var f=to.get(d)-1,p=i.get(d)-1;to.set(d,f),i.set(d,p),f||(Ds.has(d)||d.removeAttribute(n),Ds.delete(d)),p||d.removeAttribute(r)}),pd--,pd||(to=new WeakMap,to=new WeakMap,Ds=new WeakMap,Is={})}},xO=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),o=t||yO(e);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),SO(n,o,r,"aria-hidden")):function(){return null}};function wO(e){const{isOpen:t,onClose:r,id:n,closeOnOverlayClick:o=!0,closeOnEsc:i=!0,useInert:a=!0,onOverlayClick:s,onEsc:l}=e,u=S.useRef(null),c=S.useRef(null),[d,f,p]=CO(n,"chakra-modal","chakra-modal--header","chakra-modal--body");kO(u,t&&a);const v=vw(u,t),y=S.useRef(null),x=S.useCallback(M=>{y.current=M.target},[]),m=S.useCallback(M=>{M.key==="Escape"&&(M.stopPropagation(),i&&(r==null||r()),l==null||l())},[i,r,l]),[h,g]=S.useState(!1),[C,_]=S.useState(!1),$=S.useCallback((M={},I=null)=>({role:"dialog",...M,ref:If(I,u),id:d,tabIndex:-1,"aria-modal":!0,"aria-labelledby":h?f:void 0,"aria-describedby":C?p:void 0,onClick:Ei(M.onClick,ee=>ee.stopPropagation())}),[p,C,d,f,h]),T=S.useCallback(M=>{M.stopPropagation(),y.current===M.target&&Wf.isTopModal(u.current)&&(o&&(r==null||r()),s==null||s())},[r,o,s]),A=S.useCallback((M={},I=null)=>({...M,ref:If(I,c),onClick:Ei(M.onClick,T),onKeyDown:Ei(M.onKeyDown,m),onMouseDown:Ei(M.onMouseDown,x)}),[m,x,T]);return{isOpen:t,onClose:r,headerId:f,bodyId:p,setBodyMounted:_,setHeaderMounted:g,dialogRef:u,overlayRef:c,getDialogProps:$,getDialogContainerProps:A,index:v}}function kO(e,t){const r=e.current;S.useEffect(()=>{if(!(!e.current||!t))return xO(e.current)},[t,e,r])}function CO(e,...t){const r=S.useId(),n=e||r;return S.useMemo(()=>t.map(o=>`${o}-${n}`),[n,t])}var[_O,ii]=mn({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[PO,Gn]=mn({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),yw=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:r,children:n,autoFocus:o,trapFocus:i,initialFocusRef:a,finalFocusRef:s,returnFocusOnClose:l,blockScrollOnMount:u,allowPinchZoom:c,preserveScrollBarGap:d,motionPreset:f,lockFocusAcrossFrames:p,onCloseComplete:v}=t,y=Xb("Modal",t),m={...wO(t),autoFocus:o,trapFocus:i,initialFocusRef:a,finalFocusRef:s,returnFocusOnClose:l,blockScrollOnMount:u,allowPinchZoom:c,preserveScrollBarGap:d,motionPreset:f,lockFocusAcrossFrames:p};return E.jsx(PO,{value:m,children:E.jsx(_O,{value:y,children:E.jsx(Ka,{onExitComplete:v,children:m.isOpen&&E.jsx(ja,{...r,children:n})})})})};yw.displayName="Modal";var fl="right-scroll-bar-position",hl="width-before-scroll-bar",TO="with-scroll-bars-hidden",EO="--removed-body-scroll-bar-size",bw=Ox(),md=function(){},Yu=S.forwardRef(function(e,t){var r=S.useRef(null),n=S.useState({onScrollCapture:md,onWheelCapture:md,onTouchMoveCapture:md}),o=n[0],i=n[1],a=e.forwardProps,s=e.children,l=e.className,u=e.removeScrollBar,c=e.enabled,d=e.shards,f=e.sideCar,p=e.noIsolation,v=e.inert,y=e.allowPinchZoom,x=e.as,m=x===void 0?"div":x,h=e.gapMode,g=Dx(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=f,_=Fx([r,t]),$=sr(sr({},g),o);return S.createElement(S.Fragment,null,c&&S.createElement(C,{sideCar:bw,removeScrollBar:u,shards:d,noIsolation:p,inert:v,setCallbacks:i,allowPinchZoom:!!y,lockRef:r,gapMode:h}),a?S.cloneElement(S.Children.only(s),sr(sr({},$),{ref:_})):S.createElement(m,sr({},$,{className:l,ref:_}),s))});Yu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Yu.classNames={fullWidth:hl,zeroRight:fl};var D0,$O=function(){if(D0)return D0;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function AO(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=$O();return t&&e.setAttribute("nonce",t),e}function RO(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function MO(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var zO=function(){var e=0,t=null;return{add:function(r){e==0&&(t=AO())&&(RO(t,r),MO(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},FO=function(){var e=zO();return function(t,r){S.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Sw=function(){var e=FO(),t=function(r){var n=r.styles,o=r.dynamic;return e(n,o),null};return t},DO={left:0,top:0,right:0,gap:0},vd=function(e){return parseInt(e||"",10)||0},IO=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[vd(r),vd(n),vd(o)]},LO=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return DO;var t=IO(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},OO=Sw(),BO=function(e,t,r,n){var o=e.left,i=e.top,a=e.right,s=e.gap;return r===void 0&&(r="margin"),` - .`.concat(TO,` { - overflow: hidden `).concat(n,`; - padding-right: `).concat(s,"px ").concat(n,`; - } - body { - overflow: hidden `).concat(n,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&` - padding-left: `.concat(o,`px; - padding-top: `).concat(i,`px; - padding-right: `).concat(a,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(s,"px ").concat(n,`; - `),r==="padding"&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),` - } - - .`).concat(fl,` { - right: `).concat(s,"px ").concat(n,`; - } - - .`).concat(hl,` { - margin-right: `).concat(s,"px ").concat(n,`; - } - - .`).concat(fl," .").concat(fl,` { - right: 0 `).concat(n,`; - } - - .`).concat(hl," .").concat(hl,` { - margin-right: 0 `).concat(n,`; - } - - body { - `).concat(EO,": ").concat(s,`px; - } -`)},jO=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,o=n===void 0?"margin":n,i=S.useMemo(function(){return LO(o)},[o]);return S.createElement(OO,{styles:BO(i,!t,o,r?"":"!important")})},Uf=!1;if(typeof window<"u")try{var Ls=Object.defineProperty({},"passive",{get:function(){return Uf=!0,!0}});window.addEventListener("test",Ls,Ls),window.removeEventListener("test",Ls,Ls)}catch{Uf=!1}var ro=Uf?{passive:!1}:!1,NO=function(e){return e.tagName==="TEXTAREA"},xw=function(e,t){var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!NO(e)&&r[t]==="visible")},VO=function(e){return xw(e,"overflowY")},WO=function(e){return xw(e,"overflowX")},I0=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=ww(e,n);if(o){var i=kw(e,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},UO=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},HO=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},ww=function(e,t){return e==="v"?VO(t):WO(t)},kw=function(e,t){return e==="v"?UO(t):HO(t)},GO=function(e,t){return e==="h"&&t==="rtl"?-1:1},KO=function(e,t,r,n,o){var i=GO(e,window.getComputedStyle(t).direction),a=i*n,s=r.target,l=t.contains(s),u=!1,c=a>0,d=0,f=0;do{var p=kw(e,s),v=p[0],y=p[1],x=p[2],m=y-x-i*v;(v||m)&&ww(e,s)&&(d+=m,f+=v),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(u=!0),u},Os=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},L0=function(e){return[e.deltaX,e.deltaY]},O0=function(e){return e&&"current"in e?e.current:e},YO=function(e,t){return e[0]===t[0]&&e[1]===t[1]},XO=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},QO=0,no=[];function qO(e){var t=S.useRef([]),r=S.useRef([0,0]),n=S.useRef(),o=S.useState(QO++)[0],i=S.useState(Sw)[0],a=S.useRef(e);S.useEffect(function(){a.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var y=rL([e.lockRef.current],(e.shards||[]).map(O0),!0).filter(Boolean);return y.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),y.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=S.useCallback(function(y,x){if("touches"in y&&y.touches.length===2)return!a.current.allowPinchZoom;var m=Os(y),h=r.current,g="deltaX"in y?y.deltaX:h[0]-m[0],C="deltaY"in y?y.deltaY:h[1]-m[1],_,$=y.target,T=Math.abs(g)>Math.abs(C)?"h":"v";if("touches"in y&&T==="h"&&$.type==="range")return!1;var A=I0(T,$);if(!A)return!0;if(A?_=T:(_=T==="v"?"h":"v",A=I0(T,$)),!A)return!1;if(!n.current&&"changedTouches"in y&&(g||C)&&(n.current=_),!_)return!0;var M=n.current||_;return KO(M,x,y,M==="h"?g:C,!0)},[]),l=S.useCallback(function(y){var x=y;if(!(!no.length||no[no.length-1]!==i)){var m="deltaY"in x?L0(x):Os(x),h=t.current.filter(function(_){return _.name===x.type&&(_.target===x.target||x.target===_.shadowParent)&&YO(_.delta,m)})[0];if(h&&h.should){x.cancelable&&x.preventDefault();return}if(!h){var g=(a.current.shards||[]).map(O0).filter(Boolean).filter(function(_){return _.contains(x.target)}),C=g.length>0?s(x,g[0]):!a.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),u=S.useCallback(function(y,x,m,h){var g={name:y,delta:x,target:m,should:h,shadowParent:ZO(m)};t.current.push(g),setTimeout(function(){t.current=t.current.filter(function(C){return C!==g})},1)},[]),c=S.useCallback(function(y){r.current=Os(y),n.current=void 0},[]),d=S.useCallback(function(y){u(y.type,L0(y),y.target,s(y,e.lockRef.current))},[]),f=S.useCallback(function(y){u(y.type,Os(y),y.target,s(y,e.lockRef.current))},[]);S.useEffect(function(){return no.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,ro),document.addEventListener("touchmove",l,ro),document.addEventListener("touchstart",c,ro),function(){no=no.filter(function(y){return y!==i}),document.removeEventListener("wheel",l,ro),document.removeEventListener("touchmove",l,ro),document.removeEventListener("touchstart",c,ro)}},[]);var p=e.removeScrollBar,v=e.inert;return S.createElement(S.Fragment,null,v?S.createElement(i,{styles:XO(o)}):null,p?S.createElement(jO,{gapMode:e.gapMode}):null)}function ZO(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const JO=nL(bw,qO);var Cw=S.forwardRef(function(e,t){return S.createElement(Yu,sr({},e,{ref:t,sideCar:JO}))});Cw.classNames=Yu.classNames;const eB=Cw;function tB(e){const{autoFocus:t,trapFocus:r,dialogRef:n,initialFocusRef:o,blockScrollOnMount:i,allowPinchZoom:a,finalFocusRef:s,returnFocusOnClose:l,preserveScrollBarGap:u,lockFocusAcrossFrames:c,isOpen:d}=Gn(),[f,p]=ux();S.useEffect(()=>{!f&&p&&setTimeout(p)},[f,p]);const v=vw(n,d);return E.jsx(pw,{autoFocus:t,isDisabled:!r,initialFocusRef:o,finalFocusRef:s,restoreFocus:l,contentRef:n,lockFocusAcrossFrames:c,children:E.jsx(eB,{removeScrollBar:!u,allowPinchZoom:a,enabled:v===1&&i,forwardProps:!0,children:e.children})})}var _w=pt((e,t)=>{const{className:r,children:n,containerProps:o,motionProps:i,...a}=e,{getDialogProps:s,getDialogContainerProps:l}=Gn(),u=s(a,t),c=l(o),d=Be("chakra-modal__content",r),f=ii(),p={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...f.dialog},v={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...f.dialogContainer},{motionPreset:y}=Gn();return E.jsx(tB,{children:E.jsx(_e.div,{...c,className:"chakra-modal__content-container",tabIndex:-1,__css:v,children:E.jsx(mw,{preset:y,motionProps:i,className:d,...u,__css:p,children:n})})})});_w.displayName="ModalContent";function rB(e){const{leastDestructiveRef:t,...r}=e;return E.jsx(yw,{...r,initialFocusRef:t})}var nB=pt((e,t)=>E.jsx(_w,{ref:t,role:"alertdialog",...e})),Pw=pt((e,t)=>{const{className:r,...n}=e,o=Be("chakra-modal__footer",r),a={display:"flex",alignItems:"center",justifyContent:"flex-end",...ii().footer};return E.jsx(_e.footer,{ref:t,...n,__css:a,className:o})});Pw.displayName="ModalFooter";var Tw=pt((e,t)=>{const{className:r,...n}=e,{headerId:o,setHeaderMounted:i}=Gn();S.useEffect(()=>(i(!0),()=>i(!1)),[i]);const a=Be("chakra-modal__header",r),l={flex:0,...ii().header};return E.jsx(_e.header,{ref:t,className:a,id:o,...n,__css:l})});Tw.displayName="ModalHeader";var oB=_e(oi.div),Ew=pt((e,t)=>{const{className:r,transition:n,motionProps:o,...i}=e,a=Be("chakra-modal__overlay",r),l={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...ii().overlay},{motionPreset:u}=Gn(),d=o||(u==="none"?{}:Ax);return E.jsx(oB,{...d,__css:l,ref:t,className:a,...i})});Ew.displayName="ModalOverlay";var $w=pt((e,t)=>{const{className:r,...n}=e,{bodyId:o,setBodyMounted:i}=Gn();S.useEffect(()=>(i(!0),()=>i(!1)),[i]);const a=Be("chakra-modal__body",r),s=ii();return E.jsx(_e.div,{ref:t,className:a,id:o,...n,__css:s.body})});$w.displayName="ModalBody";var Aw=pt((e,t)=>{const{onClick:r,className:n,...o}=e,{onClose:i}=Gn(),a=Be("chakra-modal__close-btn",n),s=ii();return E.jsx(Ap,{ref:t,__css:s.closeButton,className:a,onClick:Ei(r,l=>{l.stopPropagation(),i()}),...o})});Aw.displayName="ModalCloseButton";const Rw=S.createContext(void 0),EB=()=>{const e=S.useContext(Rw);if(!e)throw new Error("useDialog must be used within a DialogProvider");return e},iB=({children:e})=>{const[t,r]=S.useState(!1),[n,o]=S.useState(""),[i,a]=S.useState([]),[s,l]=S.useState(!1),[u,c]=S.useState(!0),d=Ar.useRef(null),f=S.useCallback((v,y,x)=>{o(v),a(y??[]),r(!0),l((x==null?void 0:x.hideCloseIcon)??!1),c((x==null?void 0:x.closeOnOverlayClick)??!0)},[]),p=S.useCallback(()=>{r(!1)},[]);return E.jsxs(Rw.Provider,{value:{showDialog:f},children:[e,t&&E.jsx(rB,{isOpen:t,leastDestructiveRef:d,onClose:p,size:"xl",closeOnOverlayClick:u,children:E.jsx(xb,{children:E.jsx(Ew,{children:E.jsxs(nB,{className:"workspace_manager",children:[E.jsx(Tw,{fontSize:"lg",fontWeight:"bold"}),s?null:E.jsx(Aw,{}),E.jsx($w,{whiteSpace:"pre-wrap",children:n}),E.jsx(Pw,{children:i.map((v,y)=>v&&E.jsx(Mx,{colorScheme:v.colorScheme??"gray",onClick:()=>{v.onClick(),p()},iconSpacing:1,leftIcon:v.icon,ml:3,children:v.label},y))})]})})})})]})},Mw=String.raw,aB=Mw` - :root, - :host { - --chakra-vh: 100vh; - --toast-z-index: 17000000; - } - - @supports (height: -webkit-fill-available) { - :root, - :host { - --chakra-vh: -webkit-fill-available; - } - } - - @supports (height: -moz-fill-available) { - :root, - :host { - --chakra-vh: -moz-fill-available; - } - } - - @supports (height: 100dvh) { - :root, - :host { - --chakra-vh: 100dvh; - } - } -`,sB=({scope:e=""})=>E.jsx(Ba,{styles:Mw` - ${e} { - font-family: var(--chakra-fonts-body); - color: var(--chakra-colors-chakra-body-text); - background: var(--chakra-colors-chakra-body-bg); - transition-property: background-color; - transition-duration: var(--chakra-transition-duration-normal); - line-height: var(--chakra-lineHeights-base); - } - ${e} *, ${e} ::before, ${e} ::after { - border-color: var(--chakra-colors-chakra-border-color); - } - - ${e} :where(html) { - line-height: 1.5; - -webkit-text-size-adjust: 100%; - font-family: system-ui, sans-serif; - -webkit-font-smoothing: antialiased; - text-rendering: optimizeLegibility; - -moz-osx-font-smoothing: grayscale; - touch-action: manipulation; - } - - ${e} :where(body) { - position: relative; - min-height: 100%; - margin: 0; - font-feature-settings: "kern"; - } - - ${e} :where(*, *::before, *::after) { - border-width: 0; - border-style: solid; - box-sizing: border-box; - word-wrap: break-word; - } - - ${e} :where(main) { - display: block; - } - - ${e} hr { - border-top-width: 1px; - box-sizing: content-box; - height: 0; - overflow: visible; - } - - ${e} :where(pre, code, kbd,samp) { - font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; - font-size: 1em; - } - - ${e} a { - background-color: transparent; - color: inherit; - text-decoration: inherit; - } - - ${e} abbr[title] { - border-bottom: none; - text-decoration: underline; - -webkit-text-decoration: underline dotted; - text-decoration: underline dotted; - } - - ${e} :where(b, strong) { - font-weight: bold; - } - - ${e} small { - font-size: 80%; - } - - ${e} :where(sub,sup) { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; - } - - ${e} sub { - bottom: -0.25em; - } - - ${e} :where(sup) { - top: -0.5em; - } - - ${e} :where(img) { - border-style: none; - } - - ${e} :where(button, input, optgroup, select, textarea) { - font-family: inherit; - font-size: 100%; - line-height: 1.15; - margin: 0; - } - - ${e} :where(button, input) { - overflow: visible; - } - - ${e} :where(button, select) { - text-transform: none; - } - - ${e} :where( - button::-moz-focus-inner, - [type="button"]::-moz-focus-inner, - [type="reset"]::-moz-focus-inner, - [type="submit"]::-moz-focus-inner - ) { - border-style: none; - padding: 0; - } - - ${e} fieldset { - padding: 0.35em 0.75em 0.625em; - } - - ${e} legend { - box-sizing: border-box; - color: inherit; - display: table; - max-width: 100%; - padding: 0; - white-space: normal; - } - - ${e} progress { - vertical-align: baseline; - } - - ${e} textarea { - overflow: auto; - } - - ${e} :where([type="checkbox"], [type="radio"]) { - box-sizing: border-box; - padding: 0; - } - - ${e} input[type="number"]::-webkit-inner-spin-button, - ${e} input[type="number"]::-webkit-outer-spin-button { - -webkit-appearance: none !important; - } - - ${e} input[type="number"] { - -moz-appearance: textfield; - } - - ${e} input[type="search"] { - -webkit-appearance: textfield; - outline-offset: -2px; - } - - ${e} input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none !important; - } - - ${e} ::-webkit-file-upload-button { - -webkit-appearance: button; - font: inherit; - } - - ${e} details { - display: block; - } - - ${e} summary { - display: list-item; - } - - ${e} template { - display: none; - } - - [hidden] { - display: none !important; - } - - ${e} :where( - blockquote, - dl, - dd, - h1, - h2, - h3, - h4, - h5, - h6, - hr, - figure, - p, - pre - ) { - margin: 0; - } - - ${e} :where(button) { - background: transparent; - padding: 0; - } - - ${e} fieldset { - margin: 0; - padding: 0; - } - - ${e} :where(ol, ul) { - margin: 0; - padding: 0; - } - - ${e} textarea { - resize: vertical; - } - - ${e} :where(button, [role="button"]) { - cursor: pointer; - } - - ${e} button::-moz-focus-inner { - border: 0 !important; - } - - ${e} table { - border-collapse: collapse; - } - - ${e} :where(h1, h2, h3, h4, h5, h6) { - font-size: inherit; - font-weight: inherit; - } - - ${e} :where(button, input, optgroup, select, textarea) { - padding: 0; - line-height: inherit; - color: inherit; - } - - ${e} :where(img, svg, video, canvas, audio, iframe, embed, object) { - display: block; - } - - ${e} :where(img, video) { - max-width: 100%; - height: auto; - } - - ${e} [data-js-focus-visible] - :focus:not([data-focus-visible-added]):not( - [data-focus-visible-disabled] - ) { - outline: none; - box-shadow: none; - } - - ${e} select::-ms-expand { - display: none; - } - - ${aB} - `}),zw=document.createElement("div");document.body.append(zw);const lB=Ar.lazy(()=>Xk(()=>import("./App-1AImvRpr.js").then(e=>e.aJ),__vite__mapDeps([0,1])).then(({default:e})=>({default:e}))),uB={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e7,sticky:11e6,banner:12e6,overlay:13e6,modal:14e6,popover:15e6,skipLink:16e6,toast:17e6,tooltip:18e6},cB=Pz({zIndices:uB,components:{Card:{baseStyle:e=>({container:{backgroundColor:e.colorMode==="dark"?"#171B21":"#F6F8FA"}})}}});gd.createRoot(zw).render(E.jsx(Ar.StrictMode,{children:E.jsxs(BI,{resetCSS:!1,disableGlobalStyle:!0,theme:cB,children:[E.jsx(sB,{scope:".workspace_manager"}),E.jsx(DP,{initialColorMode:"dark"}),E.jsx(iB,{children:E.jsx(S.Suspense,{children:E.jsx(lB,{})})})]})}));const Hf=document.body,dB={attributes:!0,attributeFilter:["class"]},fB=function(e,t){const r=document.documentElement;r.style.colorScheme==="dark"&&r.style.removeProperty("color-scheme");for(const n of e)if(n.type==="attributes"&&n.attributeName==="class")for(const o of Hf.classList)o.includes("chakra")&&Hf.classList.remove(o)},hB=new MutationObserver(fB);hB.observe(Hf,dB);export{vP as $,PB as A,CB as B,TB as C,_B as D,TP as E,lr as F,oi as G,vB as H,Ya as I,Ap as J,yB as K,Ka as L,yw as M,Ew as N,_w as O,ja as P,Tw as Q,Aw as R,$w as S,Pw as T,xb as U,EB as V,os as W,Ar as X,pB as Y,Qh as Z,Xk as _,kB as a,Tp as a0,rB as a1,nB as a2,gB as a3,mn as b,wB as c,i3 as d,Be as e,pt as f,_e as g,Mx as h,SB as i,E as j,Xb as k,_v as l,If as m,Bu as n,Iu as o,mB as p,Ei as q,S as r,Gf as s,uw as t,IP as u,bB as v,Kt as w,yg as x,Bl as y,uO as z}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["workspace_web/App-1AImvRpr.js","workspace_web/assets/App-JXePnJiV.css"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/workspace_web/useDebounceFn-ld478fd0.js b/dist/workspace_web/useDebounceFn-ld478fd0.js deleted file mode 100644 index 429c83a..0000000 --- a/dist/workspace_web/useDebounceFn-ld478fd0.js +++ /dev/null @@ -1 +0,0 @@ -import{r}from"./input.js";function a(u,c){const e=r.useRef(0),t=r.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=0)},[]),n=r.useCallback((...o)=>{t(),e.current=setTimeout(()=>u(...o),c)},[u,c,t]);return r.useEffect(()=>()=>{t()},[]),[n,t]}export{a as u}; diff --git a/ui/src/share/ShareDialog.tsx b/ui/src/share/ShareDialog.tsx index 615bbc1..21b2228 100644 --- a/ui/src/share/ShareDialog.tsx +++ b/ui/src/share/ShareDialog.tsx @@ -10,7 +10,6 @@ import { ModalContent, ModalHeader, ModalOverlay, - Radio, RadioGroup, Stack, Switch, @@ -19,14 +18,10 @@ import { useToast, } from "@chakra-ui/react"; import { WorkflowPrivacy, WorkflowVersion } from "../types/dbTypes"; -import { useContext, useEffect, useRef, useState } from "react"; +import { useContext, useEffect, useState } from "react"; import CustomSelector from "../components/CustomSelector"; import { IconCopy, IconExternalLink } from "@tabler/icons-react"; -import { - userSettingsTable, - workflowVersionsTable, - workflowsTable, -} from "../db-tables/WorkspaceDB"; +import { userSettingsTable, workflowsTable } from "../db-tables/WorkspaceDB"; // @ts-ignore import { api } from "/scripts/api.js"; import { @@ -45,6 +40,7 @@ import { WorkspaceContext } from "../WorkspaceContext"; import { DepsResult, WorkspaceInfoDeps, + extractAndFetchFileNames, } from "../spacejson/handleDownloadSpaceJson"; import { fetchApi } from "../Api"; import { COMFYSPACE_TRACKING_FIELD_NAME } from "../const"; @@ -67,7 +63,6 @@ export default function ShareDialog({ onClose }: Props) { const [selectedVersion, setSelectedVersion] = useState< string | "new_version" >("new_version"); - const cloudHostRef = useRef(""); const workflow = workflowsTable?.curWorkflow; const toast = useToast(); const [enableDeps, setEnableDeps] = useState(true); @@ -93,13 +88,17 @@ export default function ShareDialog({ onClose }: Props) { loadData(); window.open( - cloudHostRef.current + "/workflow/" + cloudID + "/" + cloudVersionID, + cloudHost + "/workflow/" + cloudID + "/" + cloudVersionID, "_blank", ); setLoading(false); }; useEffect(() => { loadData(); + const graph = app.graph.serialize(); + extractAndFetchFileNames(graph.nodes ?? []).then((depsRes) => { + setDeps(depsRes); + }); window.addEventListener("message", handleShareWorkflowSuccess); return () => { window.removeEventListener("message", handleShareWorkflowSuccess); @@ -107,13 +106,6 @@ export default function ShareDialog({ onClose }: Props) { }, []); const loadData = async () => { - const host = - import.meta.env.MODE === "production" - ? await userSettingsTable?.getSetting("cloudHost") - : "http://localhost:3000"; - if (host) { - cloudHostRef.current = host; - } if (workflow?.cloudID && workflow.cloudOrigin) { fetchCloudWorkflowPrivacy(workflow).then((privacy) => { setPrivacy(privacy); @@ -181,28 +173,29 @@ export default function ShareDialog({ onClose }: Props) { }; const onShare = async () => { - // upload images - setUploadingImage(true); - const imageDepsToUpload = Object.values(deps?.images ?? {}) - .filter((i) => !i.url) - .map((i) => i.filename); const imageDeps = deps?.images ?? {}; - - if (imageDepsToUpload.length) { - const uploadResp = await fetchApi("/workspace/upload_image", { - method: "POST", - body: JSON.stringify({ - images: imageDepsToUpload, - }), - }); - const json = (await uploadResp.json()) as Record; - Object.keys(json).forEach((key) => { - if (imageDeps?.[key]) { - imageDeps[key].url = json[key]; - } - }); + if (enableDeps) { + // upload images + setUploadingImage(true); + const imageDepsToUpload = Object.values(deps?.images ?? {}) + .filter((i) => !i.url) + .map((i) => i.filename); + if (imageDepsToUpload.length) { + const uploadResp = await fetchApi("/workspace/upload_image", { + method: "POST", + body: JSON.stringify({ + images: imageDepsToUpload, + }), + }); + const json = (await uploadResp.json()) as Record; + Object.keys(json).forEach((key) => { + if (imageDeps?.[key]) { + imageDeps[key].url = json[key]; + } + }); + } + setUploadingImage(false); } - setUploadingImage(false); const graph = app.graph.serialize(); (graph.extra ||= {})[COMFYSPACE_TRACKING_FIELD_NAME] ||= {}; @@ -320,25 +313,29 @@ export default function ShareDialog({ onClose }: Props) { - - setEnableDeps(!enableDeps)} - fontWeight={"600"} - > - Share input images - + {Object.keys(deps?.images ?? {}).length > 0 && ( + + setEnableDeps(!enableDeps)} + fontWeight={"600"} + > + Share input images + - - If enabled your input images will be uploaded and shared to{" "} - {cloudHost} - - - + + If enabled your input images will be uploaded and shared to{" "} + {cloudHost} + + {enableDeps && ( + + )} + + )} diff --git a/ui/src/spacejson/ResourceDepsForm.tsx b/ui/src/spacejson/ResourceDepsForm.tsx index bf61522..cdf10a2 100644 --- a/ui/src/spacejson/ResourceDepsForm.tsx +++ b/ui/src/spacejson/ResourceDepsForm.tsx @@ -17,16 +17,7 @@ export default function ResourceDepsForm({ setDeps: (deps: DepsResult) => void; uploadingImage: boolean; }) { - const init = useCallback(async () => { - const graph = app.graph.serialize(); - extractAndFetchFileNames(graph.nodes ?? []).then((depsRes) => { - setDeps(depsRes); - }); - }, []); - - useEffect(() => { - init(); - }, []); + useEffect(() => {}, []); const imageDepsArr = Object.values(deps?.images ?? {}); if (!deps) { From 0ced230c8f934903ce2e4514586acb78cf571180 Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Sat, 15 Jun 2024 01:49:34 +0800 Subject: [PATCH 09/13] improve share workflow --- ui/src/main.tsx | 4 +++ ui/src/share/ShareDialog.tsx | 43 ++++++++++++++------------- ui/src/spacejson/ResourceDepsForm.tsx | 12 +------- ui/src/types/dbTypes.ts | 1 + 4 files changed, 28 insertions(+), 32 deletions(-) diff --git a/ui/src/main.tsx b/ui/src/main.tsx index 09dabe9..f38499b 100644 --- a/ui/src/main.tsx +++ b/ui/src/main.tsx @@ -35,6 +35,10 @@ const zIndices = { }; const theme = extendTheme({ + config: { + initialColorMode: "dark", + useSystemColorMode: false, + }, zIndices, components: { Card: { diff --git a/ui/src/share/ShareDialog.tsx b/ui/src/share/ShareDialog.tsx index 21b2228..c1bb4f5 100644 --- a/ui/src/share/ShareDialog.tsx +++ b/ui/src/share/ShareDialog.tsx @@ -53,7 +53,7 @@ export default function ShareDialog({ onClose }: Props) { const [versionName, setVersionName, versionNameRef] = useStateRef( "v" + getCurDateString(), ); - const { saveCurWorkflow, setRoute } = useContext(WorkspaceContext); + const { saveCurWorkflow } = useContext(WorkspaceContext); const [deps, setDeps] = useState(); const [uploadingImage, setUploadingImage] = useState(false); const [loading, setLoading] = useState(false); @@ -127,7 +127,24 @@ export default function ShareDialog({ onClose }: Props) { console.error("Failed to copy text: ", err); }); }; - const pushToCloud = async (jsonToShare?: string) => { + const pushToCloud = async (imageDeps?: DepsResult["images"]) => { + const graph = app.graph.serialize(); + (graph.extra ||= {})[COMFYSPACE_TRACKING_FIELD_NAME] ||= {}; + graph.extra[COMFYSPACE_TRACKING_FIELD_NAME].deps = { + models: deps?.models ?? {}, + images: imageDeps ?? {}, + nodeRepos: deps?.nodeRepos ?? [], + } as WorkspaceInfoDeps; + + await saveCurWorkflow(); + + const apiPrompt = await app + .graphToPrompt(app.graph) + .then((data: { output: any; workflow: any }) => { + graph.extra[COMFYSPACE_TRACKING_FIELD_NAME].apiPrompt = data.output; + return data.output; + }); + const jsonToShare = JSON.stringify(graph); setLoading(true); const secretKey = generateRandomKey(32); const host = @@ -141,6 +158,7 @@ export default function ShareDialog({ onClose }: Props) { workflowID: workflow!.id, name: versionNameRef.current, createTime: Date.now(), + api_prompt: JSON.stringify(apiPrompt), json: jsonToShare ?? JSON.stringify(app.graph.serialize()), }; const protocol = window.location.protocol; @@ -178,7 +196,7 @@ export default function ShareDialog({ onClose }: Props) { // upload images setUploadingImage(true); const imageDepsToUpload = Object.values(deps?.images ?? {}) - .filter((i) => !i.url) + // .filter((i) => !i.url) .map((i) => i.filename); if (imageDepsToUpload.length) { const uploadResp = await fetchApi("/workspace/upload_image", { @@ -197,22 +215,7 @@ export default function ShareDialog({ onClose }: Props) { setUploadingImage(false); } - const graph = app.graph.serialize(); - (graph.extra ||= {})[COMFYSPACE_TRACKING_FIELD_NAME] ||= {}; - graph.extra[COMFYSPACE_TRACKING_FIELD_NAME].deps = { - models: deps?.models ?? {}, - images: imageDeps ?? {}, - nodeRepos: deps?.nodeRepos ?? [], - } as WorkspaceInfoDeps; - await app - .graphToPrompt(app.graph) - .then((data: { output: any; workflow: any }) => { - graph.extra[COMFYSPACE_TRACKING_FIELD_NAME].apiPrompt = data.output; - }); - - await saveCurWorkflow(); - - pushToCloud(JSON.stringify(graph)); + pushToCloud(imageDeps); }; const cloudWorkflowID = workflowsTable?.curWorkflow?.cloudID; @@ -286,7 +289,6 @@ export default function ShareDialog({ onClose }: Props) { )} - {/* Choose a version to share: */} { @@ -296,7 +298,6 @@ export default function ShareDialog({ onClose }: Props) { > - {/* */} void; uploadingImage: boolean; }) { - useEffect(() => {}, []); - const imageDepsArr = Object.values(deps?.images ?? {}); if (!deps) { return ; diff --git a/ui/src/types/dbTypes.ts b/ui/src/types/dbTypes.ts index 6a00160..1345ebb 100644 --- a/ui/src/types/dbTypes.ts +++ b/ui/src/types/dbTypes.ts @@ -65,6 +65,7 @@ export type WorkflowVersion = { workflowID: string; json: string; createTime: number; + api_prompt: string; cloudID?: string; cloudOrigin?: string; authorID?: string; From 9afa5b920fd036bf09aa5a164df8959f6fae8755 Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Sun, 16 Jun 2024 01:23:42 +0800 Subject: [PATCH 10/13] add try catch around send2trash, change all nodecafe.org to nodecafe.co --- __init__.py | 14 ++++++-- service/media_service.py | 2 +- service/twoway_sync_folder_service.py | 11 ++++-- ui/src/db-tables/UserSettingsTable.ts | 2 +- ui/src/settings/CloudHostSetting.tsx | 48 +++++++++++---------------- 5 files changed, 42 insertions(+), 35 deletions(-) diff --git a/__init__.py b/__init__.py index e66c866..1bdab8f 100644 --- a/__init__.py +++ b/__init__.py @@ -13,7 +13,10 @@ from .service.media_service import * from .service.file_sync_service import * from .service.db_service import get_my_workflows_dir from .service.node_service import * -from send2trash import send2trash +try: + from send2trash import send2trash +except ImportError: + send2trash = None WEB_DIRECTORY = "entry" NODE_CLASS_MAPPINGS = {} @@ -120,8 +123,13 @@ async def delete_file(request): full_path = os.path.join(my_workflows_dir, file_path) if os.path.exists(full_path): - send2trash(full_path) - "File deleted successfully" + if send2trash: + send2trash(full_path) + else: + os.remove(full_path) + print("❌⛔️send2trash is not available. Deleting file permanently. Please `pip install send2trash`") + + return "File deleted successfully" else: return "File not found" diff --git a/service/media_service.py b/service/media_service.py index 5cfe256..6281380 100644 --- a/service/media_service.py +++ b/service/media_service.py @@ -9,7 +9,7 @@ from .model_manager.model_preview import get_thumbnail_for_image_file image_extensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp'] video_extensions = ['.mp4', '.mov', '.avi', '.webm', '.mkv'] -API_URL = 'https://www.nodecafe.org/api/image/upload' +API_URL = 'https://www.nodecafe.co/api/image/upload' def view_media(filename, isPreview = False, isInput = False): if not filename: return web.Response(status=404) diff --git a/service/twoway_sync_folder_service.py b/service/twoway_sync_folder_service.py index e6b539c..e14a81a 100644 --- a/service/twoway_sync_folder_service.py +++ b/service/twoway_sync_folder_service.py @@ -3,9 +3,12 @@ import shutil from aiohttp import web import os from pathlib import Path -from send2trash import send2trash import server from .db_service import get_my_workflows_dir +try: + from send2trash import send2trash +except ImportError: + send2trash = None @server.PromptServer.instance.routes.post('/workspace/folder/create') async def create_folder(request): @@ -32,7 +35,11 @@ def delete_folder_sync(reqJson): folder_path = reqJson.get('path') folder_path = os.path.join(get_my_workflows_dir(), folder_path) try: - send2trash(folder_path) + if send2trash: + send2trash(folder_path) + else: + shutil.rmtree(folder_path) + print("❌⛔️send2trash is not available. Deleting file permanently. Please `pip install send2trash`") return {"success": True} except Exception as e: return {"success": False, "error": str(e)} diff --git a/ui/src/db-tables/UserSettingsTable.ts b/ui/src/db-tables/UserSettingsTable.ts index 1999f9c..d186a01 100644 --- a/ui/src/db-tables/UserSettingsTable.ts +++ b/ui/src/db-tables/UserSettingsTable.ts @@ -43,7 +43,7 @@ export class UserSettingsTable extends TableBase { autoSaveDuration: 3, twoWaySync: false, foldersOnTop: false, - cloudHost: "https://www.nodecafe.org", + cloudHost: "https://www.nodecafe.co", overwriteCurWorkflowWhenDroppingFileToCanvas: false, maximumChangelogNumber: 80, hideCoverImage: false, diff --git a/ui/src/settings/CloudHostSetting.tsx b/ui/src/settings/CloudHostSetting.tsx index dad3d85..96d1a13 100644 --- a/ui/src/settings/CloudHostSetting.tsx +++ b/ui/src/settings/CloudHostSetting.tsx @@ -1,27 +1,29 @@ -import { - Input, - Stack, - useToast, - Text, - HStack, - Flex, - Button, -} from "@chakra-ui/react"; -import { useEffect, useRef } from "react"; +import { Input, Stack, useToast, Text, Flex, Button } from "@chakra-ui/react"; +import { useEffect, useState } from "react"; import { userSettingsTable } from "../db-tables/WorkspaceDB"; export default function CloudHostSetting() { - const inputRef = useRef(null); const toast = useToast(); + const [text, setText] = useState(""); + const getSettings = () => { userSettingsTable?.getSetting("cloudHost").then((res) => { - inputRef.current?.setAttribute("value", res ?? ""); + setText(res ?? ""); }); }; useEffect(() => { getSettings(); }, []); + const submitChange = async (text: string) => { + await userSettingsTable?.upsert({ cloudHost: text }); + getSettings(); + toast({ + title: "Setting saved. Please refresh to see the changes.", + status: "success", + duration: 4000, + }); + }; return ( @@ -30,26 +32,16 @@ export default function CloudHostSetting() { { - console.log("onBlur", inputRef.current?.value); - userSettingsTable?.upsert({ cloudHost: inputRef.current?.value }); - getSettings(); - toast({ - title: "Setting saved. Please refresh to see the changes.", - status: "success", - duration: 4000, - }); - }} + value={text} + onChange={(e) => setText(e.target.value)} + onBlur={() => submitChange(text)} />